summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/close.2
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/sys/close.2')
-rw-r--r--lib/libc/sys/close.243
1 files changed, 36 insertions, 7 deletions
diff --git a/lib/libc/sys/close.2 b/lib/libc/sys/close.2
index 885ac80..1a66e39 100644
--- a/lib/libc/sys/close.2
+++ b/lib/libc/sys/close.2
@@ -30,6 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)close.2 8.2 (Berkeley) 4/19/94
+.\" $Id$
.\"
.Dd April 19, 1994
.Dt CLOSE 2
@@ -78,7 +79,7 @@ of the descriptors can be rearranged with
or deleted with
.Fn close
before the
-.Xr execve
+.Xr execve 2
is attempted, but if some of these descriptors will still
be needed if the execve fails, it is necessary to arrange for them
to be closed if the execve succeeds.
@@ -90,6 +91,28 @@ execve; the call
.Dq Li fcntl(d, F_SETFD, 0)
restores the default,
which is to not close the descriptor.
+.Sh IMPLEMENTATION NOTES
+.Pp
+In the non-threaded library
+.Fn close
+is implemented as the
+.Va close
+syscall.
+.Pp
+In the threaded library, the
+.Va close
+syscall is assembled to
+.Fn _thread_sys_close
+and
+.Fn close
+is implemented as a function which locks
+.Va d
+for read and write, then calls
+.Fn _thread_sys_close .
+Before returning,
+.Fn close
+unlocks
+.Va d .
.Sh RETURN VALUES
Upon successful completion, a value of 0 is returned.
Otherwise, a value of -1 is returned and the global integer variable
@@ -107,14 +130,20 @@ An interrupt was received.
.El
.Sh SEE ALSO
.Xr accept 2 ,
+.Xr execve 2 ,
+.Xr fcntl 2 ,
.Xr flock 2 ,
.Xr open 2 ,
.Xr pipe 2 ,
.Xr socket 2 ,
-.Xr socketpair 2 ,
-.Xr execve 2 ,
-.Xr fcntl 2
+.Xr socketpair 2
.Sh STANDARDS
-.Fn Close
-conforms to IEEE Std 1003.1-1988
-.Pq Dq Tn POSIX .
+The
+.Fn close
+function call is expected to conform to
+.St -p1003.1-90 .
+.Sh HISTORY
+A
+.Fn close
+function call appeared in
+.At v7 .
OpenPOWER on IntegriCloud