From owner-cvs-src@FreeBSD.ORG Tue Dec 14 09:09:51 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A781716A4CE; Tue, 14 Dec 2004 09:09:51 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 96A9543D55; Tue, 14 Dec 2004 09:09:51 +0000 (GMT) (envelope-from phk@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id iBE99pnf026774; Tue, 14 Dec 2004 09:09:51 GMT (envelope-from phk@repoman.freebsd.org) Received: (from phk@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id iBE99phM026773; Tue, 14 Dec 2004 09:09:51 GMT (envelope-from phk) Message-Id: <200412140909.iBE99phM026773@repoman.freebsd.org> From: Poul-Henning Kamp Date: Tue, 14 Dec 2004 09:09:51 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/sys filedesc.h src/sys/kern kern_descrip.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Dec 2004 09:09:51 -0000 phk 2004-12-14 09:09:51 UTC FreeBSD src repository Modified files: sys/sys filedesc.h sys/kern kern_descrip.c Log: Add a new kind of reference count (fd_holdcnt) to struct filedesc which holds on to just the data structure and the mutex. (The existing refcount (fd_refcnt) holds onto the open files in the descriptor.) The fd_holdcnt is protected by fdesc_mtx, fd_refcnt by FILEDESC_LOCK. Add fdhold(struct proc *) which gets a hold on the filedescriptors of the specified proc.. Add fddrop(struct filedesc *) which drops the fd_holdcnt and if zero destroys the mutex and frees the memory. Initialize the fd_holdcnt to one in fdinit(). Normal operations on the filedesc structure will not change it. In fdfree() use fddrop() to dispose of the mutex and structure. Hold the FILEDESC_LOCK() until we have cleaned out the contents and carefully set the fields to null values during cleanup. Use fdhold()/fddrop() in mountcheckdirs() and sysctl_kern_file(). Revision Changes Path 1.269 +45 -16 src/sys/kern/kern_descrip.c 1.70 +2 -1 src/sys/sys/filedesc.h