cvs commit: src/sys/sys filedesc.h src/sys/kern kern_descrip.c

Poul-Henning Kamp phk at
Tue Dec 14 01:09:51 PST 2004

phk         2004-12-14 09:09:51 UTC

  FreeBSD src repository

  Modified files:
    sys/sys              filedesc.h 
    sys/kern             kern_descrip.c 
  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
  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

More information about the cvs-all mailing list