Date: Mon, 15 Jun 2009 20:38:55 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: cvs-src-old@freebsd.org Subject: cvs commit: src/include unistd.h src/lib/libc/sys Makefile.inc Symbol.map close.2 closefrom.2 src/sys/compat/freebsd32 syscalls.master src/sys/kern kern_descrip.c syscalls.master src/tools/regression/file/closefrom Makefile closefrom.c ... Message-ID: <200906152041.n5FKfgws089782@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
jhb 2009-06-15 20:38:55 UTC
FreeBSD src repository
Modified files:
include unistd.h
lib/libc/sys Makefile.inc Symbol.map close.2
sys/compat/freebsd32 syscalls.master
sys/kern kern_descrip.c syscalls.master
Added files:
lib/libc/sys closefrom.2
tools/regression/file/closefrom Makefile closefrom.c
closefrom.t
Log:
SVN rev 194262 on 2009-06-15 20:38:55Z by jhb
Add a new 'void closefrom(int lowfd)' system call. When called, it closes
any open file descriptors >= 'lowfd'. It is largely identical to the same
function on other operating systems such as Solaris, DFly, NetBSD, and
OpenBSD. One difference from other *BSD is that this closefrom() does not
fail with any errors. In practice, while the manpages for NetBSD and
OpenBSD claim that they return EINTR, they ignore internal errors from
close() and never return EINTR. DFly does return EINTR, but for the common
use case (closing fd's prior to execve()), the caller really wants all
fd's closed and returning EINTR just forces callers to call closefrom() in
a loop until it stops failing.
Note that this implementation of closefrom(2) does not make any effort to
resolve userland races with open(2) in other threads. As such, it is not
multithread safe.
Submitted by: rwatson (initial version)
Reviewed by: rwatson
MFC after: 2 weeks
Revision Changes Path
1.94 +1 -0 src/include/unistd.h
1.139 +1 -1 src/lib/libc/sys/Makefile.inc
1.22 +3 -0 src/lib/libc/sys/Symbol.map
1.28 +1 -0 src/lib/libc/sys/close.2
1.1 +53 -0 src/lib/libc/sys/closefrom.2 (new)
1.117 +1 -0 src/sys/compat/freebsd32/syscalls.master
1.354 +36 -0 src/sys/kern/kern_descrip.c
1.251 +1 -0 src/sys/kern/syscalls.master
1.1 +9 -0 src/tools/regression/file/closefrom/Makefile (new)
1.1 +274 -0 src/tools/regression/file/closefrom/closefrom.c (new)
1.1 +10 -0 src/tools/regression/file/closefrom/closefrom.t (new)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906152041.n5FKfgws089782>
