lock − lock or unlock a file descriptor
#include "lock.h"
int
lock_ex(int fd)
int lock_exnb(int fd)
int lock_un(int fd)
lock_ex locks fd exclusively.
lock_exnb locks fd exclusively but do not block when locking.
lock_un unlocks fd.
The lock functions take care about the different semantics of the POSIX locking implentations given flock and lockf.