Applies or removes an advisory lock on a file. The compatibility version of flock has been implemented on top of fcntl(2) locking. This version is not completely compatible with the SunOS 4.1 version. The following differences exist:
To obtain a shared lock (LOCK_SH), read permission on file is required.
To obtain an exclusive lock (LOCK_EX), write permission on file is required.
EOPNOTSUPP may not be returned as a result of a call to flock.
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. That was not the case with flock in the SunOS 4.1 release.
Locks are not inherited by a child process in a fork(2) function.
Locks obtained through the flock mechanism under SunOS 4.1 were known only within the system on which they were placed. This is no longer true.