summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/kern_descrip.c25
-rw-r--r--sys/sys/filedesc.h1
2 files changed, 8 insertions, 18 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);
}
diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h
index fe606e3..beae405 100644
--- a/sys/sys/filedesc.h
+++ b/sys/sys/filedesc.h
@@ -167,7 +167,6 @@ void fdfree(struct thread *td);
struct filedesc *fdinit(struct filedesc *fdp);
struct filedesc *fdshare(struct filedesc *fdp);
void fdused(struct filedesc *fdp, int fd);
-void ffree(struct file *fp);
struct filedesc_to_leader *
filedesc_to_leader_alloc(struct filedesc_to_leader *old,
struct filedesc *fdp, struct proc *leader);
OpenPOWER on IntegriCloud