flock.2 (2010 09)

f
flock(2) flock(2)
RETURN VALUES
flock() returns:
0 for successful completion
-1 for unsuccessful completion; errno is set to indicate the error
ERRORS
If the
flock() function fails, errno may be set to one of the following values:
[EBADF] The filedes parameter is not a valid open file descriptor.
A shared lock was requested and filedes was not opened for reading, or an
exclusive lock was requested and filedes was not opened for writing.
[EDEADLK] The lock is blocked by some lock from another process. Putting the calling pro-
cess to sleep while waiting for that lock to become free would cause a deadlock.
[EINTR] A signal interrupted the
flock() call.
[EINVAL] The filedes parameter refers to a file that does not support locking.
The operation parameter is not valid.
[ENOLCK] The lock table is full. Too many files are already locked.
The filedes parameter refers to an NFS file with the access bits set for enforce-
ment mode.
The filedes parameter refers to an NFS file, and a system error occurred on the
remote node.
[EWOULDBLOCK] The file is locked and the
LOCK_NB option was specified.
The file is mapped into virtual memory via the
mmap() system call (see
mmap(2)).
SEE ALSO
lockd(1M) chmod(2), close(2), creat(2), dup(2), dup2(2), exec(2), fcntl(2), fork(2), lockf(2), open(2), read(2),
truncate(2), write(2).
STANDARDS CONFORMANCE
flock(): Not part of any UNIX standard.
2 Hewlett-Packard Company 2 HP-UX 11i Version 3: September 2010