summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/open.2
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2011-03-25 14:01:18 +0000
committerkib <kib@FreeBSD.org>2011-03-25 14:01:18 +0000
commit4dc12088a11c128c9cbe74247ccb5b2a1ddb92c8 (patch)
tree203974a6aa91367f543a3066472089db1d53e057 /lib/libc/sys/open.2
parentfc2bd01611a5db99f84b5d7f3109b9f9274f548d (diff)
downloadFreeBSD-src-4dc12088a11c128c9cbe74247ccb5b2a1ddb92c8.zip
FreeBSD-src-4dc12088a11c128c9cbe74247ccb5b2a1ddb92c8.tar.gz
Document O_CLOEXEC.
Reviewed by: jhb MFC after: 1 week
Diffstat (limited to 'lib/libc/sys/open.2')
-rw-r--r--lib/libc/sys/open.220
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2
index deca8bc..e0f5fff 100644
--- a/lib/libc/sys/open.2
+++ b/lib/libc/sys/open.2
@@ -28,7 +28,7 @@
.\" @(#)open.2 8.2 (Berkeley) 11/16/93
.\" $FreeBSD$
.\"
-.Dd February 28, 2009
+.Dd March 25, 2011
.Dt OPEN 2
.Os
.Sh NAME
@@ -118,6 +118,7 @@ O_NOFOLLOW do not follow symlinks
O_NOCTTY don't assign controlling terminal
O_TTY_INIT restore default terminal attributes
O_DIRECTORY error if file is not a directory
+O_CLOEXEC set FD_CLOEXEC upon open
.Ed
.Pp
Opening a file with
@@ -231,6 +232,11 @@ from opening files which are even unsafe to open with
.Dv O_RDONLY ,
such as device nodes.
.Pp
+.Dv O_CLOEXEC
+may be used to set
+.Dv FD_CLOEXEC
+flag for the newly returned file descriptor.
+.Pp
If successful,
.Fn open
returns a non-negative integer, termed a file descriptor.
@@ -241,12 +247,18 @@ file is set to the beginning of the file.
When a new file is created it is given the group of the directory
which contains it.
.Pp
-The new descriptor is set to remain open across
+Unless
+.Dv
+O_CLOEXEC
+flag was specified,
+the new descriptor is set to remain open across
.Xr execve 2
system calls; see
-.Xr close 2
+.Xr close 2 ,
+.Xr fcntl 2
and
-.Xr fcntl 2 .
+.Dv O_CLOEXEC
+description.
.Pp
The system imposes a limit on the number of file descriptors
open simultaneously by one process.
OpenPOWER on IntegriCloud