diff options
author | 2002-02-08 16:32:27 +0000 | |
---|---|---|
committer | 2002-02-08 16:32:27 +0000 | |
commit | 6cb8c23f5f75883db55ea9b1f8c5cb106389eb2a (patch) | |
tree | f5b53257f4c7b98367e3dc3873648ff761628579 | |
parent | - Rename FILE_{,UN}USE to FREF and FRELE. USE is a bad verb and we don't have (diff) | |
download | wireguard-openbsd-6cb8c23f5f75883db55ea9b1f8c5cb106389eb2a.tar.xz wireguard-openbsd-6cb8c23f5f75883db55ea9b1f8c5cb106389eb2a.zip |
No more need for ffree. Since it's hard to use it safely, remove it.
-rw-r--r-- | sys/kern/kern_descrip.c | 33 | ||||
-rw-r--r-- | sys/sys/filedesc.h | 3 |
2 files changed, 13 insertions, 23 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 335cf1a5aee..86fed5839b2 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_descrip.c,v 1.48 2002/02/08 13:53:28 art Exp $ */ +/* $OpenBSD: kern_descrip.c,v 1.49 2002/02/08 16:32:27 art Exp $ */ /* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */ /* @@ -825,24 +825,6 @@ restart: } /* - * Free a file descriptor. - */ -void -ffree(fp) - register struct file *fp; -{ - LIST_REMOVE(fp, f_list); - crfree(fp->f_cred); -#ifdef DIAGNOSTIC - fp->f_count = 0; - if (fp->f_usecount != 0) - panic("ffree: usecount != 0"); -#endif - nfiles--; - pool_put(&file_pool, fp); -} - -/* * Build a new filedesc structure. */ struct filedesc * @@ -1091,8 +1073,17 @@ closef(struct file *fp, struct proc *p) error = (*fp->f_ops->fo_close)(fp, p); else error = 0; - fp->f_usecount--; - ffree(fp); + + /* Free fp */ + LIST_REMOVE(fp, f_list); + crfree(fp->f_cred); +#ifdef DIAGNOSTIC + if (fp->f_count != 0 || fp->f_usecount != 1) + panic("closef: count: %d/%d", fp->f_count, fp->f_usecount); +#endif + nfiles--; + pool_put(&file_pool, fp); + return (error); } diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h index 5b737a8f712..31f93efe938 100644 --- a/sys/sys/filedesc.h +++ b/sys/sys/filedesc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: filedesc.h,v 1.13 2001/10/26 12:03:28 art Exp $ */ +/* $OpenBSD: filedesc.h,v 1.14 2002/02/08 16:32:27 art Exp $ */ /* $NetBSD: filedesc.h,v 1.14 1996/04/09 20:55:28 cgd Exp $ */ /* @@ -120,7 +120,6 @@ int dupfdopen __P((struct filedesc *fdp, int indx, int dfd, int mode, int fdalloc __P((struct proc *p, int want, int *result)); void fdexpand __P((struct proc *)); int falloc __P((struct proc *p, struct file **resultfp, int *resultfd)); -void ffree __P((struct file *)); struct filedesc *fdinit __P((struct proc *p)); struct filedesc *fdshare __P((struct proc *p)); struct filedesc *fdcopy __P((struct proc *p)); |