HP-UX Reference (11i v2 07/12) - 2 System Calls (vol 5)
f
flock(2) flock(2)
locks associated with the crashed server. If a lock cannot be reclaimed, the process that held the lock is
issued a SIGLOST signal. See lockd(1M).
File locking as implemented for NFS files is only advisory.
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:
[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)).
[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.
[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 enforcement mode.
The filedes parameter refers to an NFS file, and a system error occurred on the remote
node.
[EDEADLK] The lock is blocked by some lock from another process. Putting the calling process to sleep
while waiting for that lock to become free would cause a deadlock.
WARNINGS
Users of flock() should note that the libcext library will not be available in future releases of HP-
UX. However this function will be available as part of the C library libc.
AUTHOR
flock() function was developed by HP.
SEE ALSO
Commands:
lockd(1M).
Functions:
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.
HP-UX 11i Version 2: December 2007 Update − 2 − Hewlett-Packard Company 97