It's stated that flock()
(BSD-locks) and fcntl()
(POSIX record-level locks) gives the user incompatible semantics, particularly, in regards of lock release.
However, in glibc
flock()
is implemented in terms of POSIX fcntl()
. (I checked this on official git repo, here is just a viewable link)
https://code.woboq.org/userspace/glibc/sysdeps/posix/flock.c.html#18
/* This file implements the
flock' function in terms of the POSIX.1
fcntl' locking mechanism. In 4BSD, these are two incompatible locking mechanisms, perhaps with different semantics? */
How can these facts hold together?