aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/sys/close.2
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2009-06-15 20:38:55 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2009-06-15 20:38:55 +0000
commitc4f16b69e19b67a2eb94b3d505ea3c28322a8b59 (patch)
tree5e2b271455a043dbcc3a4a6aa9fd155c1966ebb4 /lib/libc/sys/close.2
parentd659538f723dd4a908f76ad6103f070680b7fdc7 (diff)
downloadsrc-c4f16b69e19b67a2eb94b3d505ea3c28322a8b59.tar.gz
src-c4f16b69e19b67a2eb94b3d505ea3c28322a8b59.zip
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
Notes
Notes: svn path=/head/; revision=194262
Diffstat (limited to 'lib/libc/sys/close.2')
-rw-r--r--lib/libc/sys/close.21
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/libc/sys/close.2 b/lib/libc/sys/close.2
index aef03796222e..524322b1517b 100644
--- a/lib/libc/sys/close.2
+++ b/lib/libc/sys/close.2
@@ -120,6 +120,7 @@ before all pending data was delivered.
.El
.Sh SEE ALSO
.Xr accept 2 ,
+.Xr closefrom 2 ,
.Xr execve 2 ,
.Xr fcntl 2 ,
.Xr flock 2 ,