A version of flock is implemented on top of fcntl(2) locking. It does not provide complete binary compatibility, and the following differences exist between this version and the SunOS 4.x version:
flock requires the file to be opened for writing before requesting an exclusive lock.
Read permission is required on the file to obtain a shared lock.
Locking a segment that is already locked by the calling process causes the old lock type to be removed and the new lock type to take effect.
Locks are not inherited by a child process in a fork function.
Locks obtained through the flock mechanism under SunOS 4.x were known only within the system on which they were placed. This is no longer true.