Apply, test or remove a POSIX lock on an open file. The file is specified by fd. This call is just an interface for fcntl(2). Valid operations are given below:
Set an exclusive lock to the file. Only one process may hold an exclusive lock for a given file at a given time. If the file is already locked it blocks until the previous lock is released.
Same as F_LOCK but never blocks and return error instead if the file is already locked.
Unlock the file.
The file is locked and the LOCK_NB flag was selected, or operation is prohibited because the file has been memory-mapped by another process.
fd is not an open file descriptor.
Specified lock operation would cause a deadlock.
An invalid operation was specified in fd.