fcntl locking
The POSIX standard mechanism for advisory file locking, including byte-range locking.
fcntl() is Unix's standard way to request locks on parts of a file. It supports exclusive and shared locks and can lock byte ranges rather than the entire file. fcntl(F_SETLK, ...) attempts to take a lock immediately; F_SETLKW blocks until the lock is available. It is POSIX-standardized—unlike flock()—and works on both local and remote filesystems (the NFS server must support it, however). Many databases and applications use fcntl() for concurrency control.