summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/open.2
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/sys/open.2')
-rw-r--r--lib/libc/sys/open.240
1 files changed, 34 insertions, 6 deletions
diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2
index dea59fc..11d2906 100644
--- a/lib/libc/sys/open.2
+++ b/lib/libc/sys/open.2
@@ -136,7 +136,7 @@ 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
-.Xr execve
+.Xr execve 2
system calls; see
.Xr close 2
and
@@ -146,6 +146,33 @@ The system imposes a limit on the number of file descriptors
open simultaneously by one process.
.Xr Getdtablesize 2
returns the current system limit.
+.Pp
+.Sh IMPLEMENTATION NOTES
+In the non-threaded library
+.Fn open
+is implemented as the
+.Va open
+syscall.
+.Pp
+In the threaded library, the
+.Va open
+syscall is assembled to
+.Fn _thread_sys_open
+and
+.Fn open
+is implemented as a function which disables thread rescheduling
+and calls
+.Fn _thread_sys_open .
+Before returning,
+.Fn open
+enables thread rescheduling.
+.Sh RETURN VALUES
+If successful,
+.Fn open
+returns a non-negative integer, termed a file descriptor.
+It returns -1 on failure, and sets
+.Va errno
+to indicate the error.
.Sh ERRORS
The named file is opened unless:
.Bl -tag -width Er
@@ -188,7 +215,7 @@ special file, and the device associated with this special file
does not exist.
.It Bq Er EINTR
The
-.Nm
+.Fn open
operation was interrupted by a signal.
.It Bq Er EOPNOTSUPP
.Dv O_SHLOCK
@@ -249,9 +276,10 @@ An attempt was made to open a socket (not currently implemented).
.Xr getdtablesize 2 ,
.Xr lseek 2 ,
.Xr read 2 ,
-.Xr write 2 ,
-.Xr umask 2
+.Xr umask 2 ,
+.Xr write 2
.Sh HISTORY
An
-.Nm
-function call appeared in Version 6 AT&T UNIX.
+.Fn open
+function call appeared in
+.At v6 .
OpenPOWER on IntegriCloud