diff options
author | phk <phk@FreeBSD.org> | 2004-12-02 12:17:27 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-12-02 12:17:27 +0000 |
commit | 62476e023e538a6a64b6dd8280e221c107590046 (patch) | |
tree | b8268cb10ecb6d334c5cffeb26f340b30af99807 /sys/kern/kern_descrip.c | |
parent | 660e2d8605afb1066f3e1adf766ca5e89081d3e6 (diff) | |
download | FreeBSD-src-62476e023e538a6a64b6dd8280e221c107590046.zip FreeBSD-src-62476e023e538a6a64b6dd8280e221c107590046.tar.gz |
Drop ffree() as a separate function and incorporate the only place used.
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r-- | sys/kern/kern_descrip.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 3695844..99b9209 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1371,22 +1371,6 @@ falloc(struct thread *td, struct file **resultfp, int *resultfd) } /* - * Free a file descriptor. - */ -void -ffree(struct file *fp) -{ - - KASSERT(fp->f_count == 0, ("ffree: fp_fcount not 0!")); - sx_xlock(&filelist_lock); - LIST_REMOVE(fp, f_list); - openfiles--; - sx_xunlock(&filelist_lock); - crfree(fp->f_cred); - uma_zfree(file_zone, fp); -} - -/* * Build a new filedesc structure from another. * Copy the current, root, and jail root vnode references. */ @@ -2089,7 +2073,14 @@ fdrop_locked(struct file *fp, struct thread *td) error = fo_close(fp, td); else error = 0; - ffree(fp); + + sx_xlock(&filelist_lock); + LIST_REMOVE(fp, f_list); + openfiles--; + sx_xunlock(&filelist_lock); + crfree(fp->f_cred); + uma_zfree(file_zone, fp); + return (error); } |