diff options
author | des <des@FreeBSD.org> | 2009-06-06 18:47:03 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2009-06-06 18:47:03 +0000 |
commit | 94e760567d654ada216cd794352e9deca31dff08 (patch) | |
tree | 31cf1578dd1fe8b1672c288942548b816d815953 /lib/libutil/flopen.3 | |
parent | 78eb93ba011f848dcde1cab4b81989885ad564bf (diff) | |
download | FreeBSD-src-94e760567d654ada216cd794352e9deca31dff08.zip FreeBSD-src-94e760567d654ada216cd794352e9deca31dff08.tar.gz |
Revert (once again, and hopefully for the last time) to flock(2) locks.
The problem with fcntl(2) locks is that they are not inherited by child
processes. This breaks pidfile(3), where the common idiom is to open
and lock the PID file before daemonizing.
Diffstat (limited to 'lib/libutil/flopen.3')
-rw-r--r-- | lib/libutil/flopen.3 | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/lib/libutil/flopen.3 b/lib/libutil/flopen.3 index fe54b76..26d1c04 100644 --- a/lib/libutil/flopen.3 +++ b/lib/libutil/flopen.3 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 10, 2007 +.Dd June 6, 2009 .Dt FLOPEN 3 .Os .Sh NAME @@ -46,13 +46,12 @@ The function opens or creates a file and acquires an exclusive lock on it. It is essentially equivalent with calling .Fn open -with the same parameters followed by an -.Fn fcntl -.Dv F_SETLK -or -.Dv F_SETLKW -operation with lock type -.Dv F_WRLCK , +with the same parameters followed by +.Fn flock +with an +.Va operation +argument of +.Dv LOCK_EX , except that .Fn flopen will attempt to detect and handle races that may occur between opening @@ -87,18 +86,13 @@ returns a valid file descriptor. Otherwise, it returns -1, and sets .Va errno as described in -.Xr fcntl 2 +.Xr flock 2 and .Xr open 2 . .Sh SEE ALSO .Xr errno 2 , -.Xr fcntl 2 , +.Xr flock 2 , .Xr open 2 -.Sh HISTORY -The -.Fn flopen -function first appeared in -.Fx 6.3 . .Sh AUTHORS .An -nosplit The |