in reply to NFS locking with Fcntl

Of course, shortly after posting - I found the answer, in this answer

use strict; use Fcntl qw(SEEK_SET F_WRLCK F_UNLCK F_SETLKW); my($pack); open(FILE,">a"); $pack = pack('s s l l s', F_WRLCK, SEEK_SET, 0, 1, 0); print(fcntl(FILE, F_SETLKW, $pack) . "\n"); sleep(20); $pack = pack('s s l l s', F_UNLCK, SEEK_SET, 0, 1, 0); print(fcntl(FILE, F_SETLKW, $pack) . "\n"); close(FILE);

This worked for me on my Linux implementation, to test whether locking over NFS works.

Replies are listed 'Best First'.
Re^2: NFS locking with Fcntl
by QM (Parson) on May 10, 2016 at 12:43 UTC

      Nor I. However, my requirement isn't to use it, it's to test whether it actually works at all. Further test may follow.