summaryrefslogtreecommitdiff
path: root/sys/kern/sys_generic.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2002-02-08 13:53:29 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2002-02-08 13:53:29 +0000
commit0e31aec87e545a4e3f3d51781361eab6b72da8ad (patch)
tree3d1627b892c0d47f7ed56f61d4361e9c6fbb2266 /sys/kern/sys_generic.c
parenta25f400aa62632e991663528e26a5426c250d001 (diff)
- Rename FILE_{,UN}USE to FREF and FRELE. USE is a bad verb and we don't have
the same semantics as NetBSD anyway, so it's good to avoid name collissions. - Always fdremove before freeing the file, not the other way around. - falloc FREFs the file. - have FILE_SET_MATURE FRELE the file (It feels like a good ortogonality to falloc FREFing the file). - Use closef as much as possible instead of ffree in error paths of falloc:ing functions. closef is much more careful with the fd and can deal with the fd being forcibly closed by dup2. Also try to avoid manually calling *fo_close when closef can do that for us (this makes some error paths mroe complicated (sys_socketpair and sys_pipe), but others become simpler (sys_open)).
Diffstat (limited to 'sys/kern/sys_generic.c')
-rw-r--r--sys/kern/sys_generic.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index fd32b2a9959..c02c07b1eda 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_generic.c,v 1.33 2002/02/05 16:02:27 art Exp $ */
+/* $OpenBSD: sys_generic.c,v 1.34 2002/02/08 13:53:28 art Exp $ */
/* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */
/*
@@ -91,7 +91,7 @@ sys_read(p, v, retval)
if ((fp->f_flag & FREAD) == 0)
return (EBADF);
- FILE_USE(fp);
+ FREF(fp);
/* dofileread() will unuse the descriptor for us */
return (dofileread(p, fd, fp, SCARG(uap, buf), SCARG(uap, nbyte),
@@ -154,7 +154,7 @@ dofileread(p, fd, fp, buf, nbyte, offset, retval)
#endif
*retval = cnt;
out:
- FILE_UNUSE(fp);
+ FRELE(fp);
return (error);
}
@@ -273,9 +273,6 @@ dofilereadv(p, fd, fp, iovp, iovcnt, offset, retval)
if (needfree)
free(needfree, M_IOV);
out:
-#if notyet
- FILE_UNUSE(fp, p);
-#endif
return (error);
}
@@ -366,9 +363,6 @@ dofilewrite(p, fd, fp, buf, nbyte, offset, retval)
#endif
*retval = cnt;
out:
-#if notyet
- FILE_UNUSE(fp, p);
-#endif
return (error);
}
@@ -488,9 +482,6 @@ dofilewritev(p, fd, fp, iovp, iovcnt, offset, retval)
if (needfree)
free(needfree, M_IOV);
out:
-#if notyet
- FILE_UNUSE(fp, p);
-#endif
return (error);
}