summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/flock.2
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/sys/flock.2')
-rw-r--r--lib/libc/sys/flock.232
1 files changed, 29 insertions, 3 deletions
diff --git a/lib/libc/sys/flock.2 b/lib/libc/sys/flock.2
index bb6abb7..966f7a9 100644
--- a/lib/libc/sys/flock.2
+++ b/lib/libc/sys/flock.2
@@ -109,6 +109,28 @@ forks and the child explicitly unlocks the file, the parent will
lose its lock.
.Pp
Processes blocked awaiting a lock may be awakened by signals.
+.Sh IMPLEMENTATION NOTES
+.Pp
+In the non-threaded library
+.Fn flock
+is implemented as the
+.Va flock
+syscall.
+.Pp
+In the threaded library, the
+.Va flock
+syscall is assembled to
+.Fn _thread_sys_flock
+and
+.Fn flock
+is implemented as a function which locks
+.Va fd
+for read and write, then calls
+.Fn _thread_sys_flock .
+Before returning,
+.Fn flock
+unlocks
+.Va fd .
.Sh RETURN VALUES
Zero is returned if the operation was successful;
on an error a -1 is returned and an error code is left in
@@ -131,15 +153,19 @@ is an invalid descriptor.
The argument
.Fa fd
refers to an object other than a file.
+.It Bq Er EOPNOTSUPP
+The argument
+.Fa fd
+refers to an object that does not support file locking.
.El
.Sh SEE ALSO
-.Xr open 2 ,
.Xr close 2 ,
.Xr dup 2 ,
.Xr execve 2 ,
-.Xr fork 2
+.Xr fork 2 ,
+.Xr open 2
.Sh HISTORY
The
-.Nm
+.Fn flock
function call appeared in
.Bx 4.2 .
OpenPOWER on IntegriCloud