Date: Tue, 14 Dec 2004 09:09:51 +0000 (UTC) From: Poul-Henning Kamp <phk@FreeBSD.org> To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/sys filedesc.h src/sys/kern kern_descrip.c Message-ID: <200412140909.iBE99phM026773@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200412140909.iBE99phM026773>