diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2002-02-08 16:32:28 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2002-02-08 16:32:28 +0000 |
commit | ba84f8081ea8d9ac6cbf27a225e3d79eac0814ce (patch) | |
tree | f0d174b54078f639838b01e4ea84ebe1cb28dcd1 /sys | |
parent | 0e31aec87e545a4e3f3d51781361eab6b72da8ad (diff) |
No more need for ffree. Since it's hard to use it safely, remove it.
Diffstat (limited to 'sys')
-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)); |