If one attempts to flock()
a file on a lockless NFS mount, then flock
will hang even if LOCK_NB
is passed.
Is it possible to detect that the filesystem does not support locking ahead of time? Perhaps with something returned from statfs
?
If not, is there some suitable heuristic for when to avoid file locking? For example, by inspecting the filesystem magic numbers or mount flags?
Thanks for any help!