Russ Allbery wrote: > Way back in the day, it used to matter whether you used flock or fcntl and > one type of lock was potentially invisible to the other type of lock. Has > this been fixed, or is that still a concern?
It's still a concern, in that those are two different kinds of locks in most circumstances. (In the broader universe of POSIX it's even less specified, but in the narrower universe of things Debian supports we can primarily focus on fcntl and flock.) I intended to specify in the full text more precisely that there are multiple kinds of locks, and it's okay to use one or the other as long as all cooperating software agrees. Generally speaking, I think very few programs actually want to use the byte-range locking that fcntl can do, and that in practice the options usually boil down to either flock or whole-file fcntl, which are roughly equivalent but unfortunately distinct. The main advantage of flock, apart from simplicity, is that flock always follows the file descriptor, while fcntl *normally* follows the process (unless you use the non-portable "open file description locks", which act like flock).

