lockf.2 (2010 09)

l
lockf(2) lockf(2)
Application Usage
Because in the future the variable errno
will be set to [EAGAIN] rather than [EACCES] when a section
of a file is already locked by another process, portable application programs should expect and test for
either value. For example:
if (lockf(fd, F_TLOCK, siz) == -1)
if ((errno == EAGAIN) || (errno == EACCES))
/*
* section locked by another process
* check for either EAGAIN or EACCES
* due to different implementations
*/
else if ...
/*
* check for other errors
*/
SEE ALSO
lockd(1M), statd(1M), chmod(2), close(2), creat(2), fcntl(2), creat64(2), open(2), pause(2), read(2), stat(2),
wait(2), write(2), unistd(5).
STANDARDS CONFORMANCE
lockf(): SVID2, SVID3, XPG2
HP-UX 11i Version 3: September 2010 3 Hewlett-Packard Company 3