2 ms·
You can also use the BSD extension, flock(2), which is supported everywhere except commercial SysV clones like Solaris and HP/UX. flock has the semantics you wo
by wahern 8y ago
You can also use the BSD extension, flock(2), which is supported everywhere except commercial SysV clones like Solaris and HP/UX. flock has the semantics you would expect[1] and isn't Linux-only.
This LWN article has a great explanation of all the behaviors: https://lwn.net/Articles/586904/ https://lwn.net/Articles/586904/
[1] Effectively identical to the Linux extension/POSIX proposal except that (1) they don't support ranges, (2) don't contend with POSIX locks (they do on real BSDs but not Linux), and (3) BSD flock won't work across NFS.
- amerianwookie 8y agoI was under the impression that since[1] 2.6.12, when using BSD flock(), NFS will use POSIX locks that emulate BSD locking behavior and work over NFS. So long as you use consistent NFS implementations, shouldn't this work? [1] http://nfs.sourceforge.net/#faq_d10 http://nfs.sourceforge.net/#faq_d10
- wahern 8y agoI stand corrected.