http://qs1969.pair.com?node_id=1162628


in reply to NFS locking with Fcntl

Greetings, Preceptor.

While I've never been particularly excited about the way the nfs protocol is implemented. It's your project. :)

So I asked cpan about fcntl. Given the description: "Set / reset locks using fcntl", IPC::SRLock::Fcntl might be a good candidate. If you're implementing this on UNIX, or a UNIX-like system, POSIX::1003::Fcntl might also be of value. If for no other reason, than to provide some insight into the inner workings of the related functions. Lastly, perlfunc would be a good reference for you. :)

--Chris

¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH

Replies are listed 'Best First'.
Re^2: NFS locking with Fcntl
by Preceptor (Deacon) on May 10, 2016 at 15:42 UTC

    Well, no, it isn't. It's my storage array, and I'm being asked to test locking functionality. I know locking in general (and NFS specifically) are a bit of a 'fuzzy area' when it comes to file locking. And there's huge caveats on the relative interoperability. I'm trying to avoid specific perl modules, simply because this _should_ be language independent. I don't mind knocking up my test cases in C, if that's necessary - but I thought it _should_ be possible using perl built in hooks into C calls.

      It's only going to ever be, as good as the OS's implementation of it. So you're mileage will vary greatly, depending on what, and where it's implemented. Version is also a variable to consider. They're all based on the BSD/SUN implementation (links to follow(1, 2)) which dates back to the late 70's to the early 80's, and hasn't changed much, since then. My point being; your results won't have absolute returns -- they all pretty much suck. The client side/implementation is also a factor. Are/will you be testing on/for that, as well?

      The references I provided were just as good for use as modules, as they were for references for a better understanding of the underlying protocol(s). You could have just as easily "cobbled" up something that suites your needs using the code/references therein.

      You also might be interested in mmap for more efficient use of reading/writing of data from/to memory, from disk.

      --Chris

      1) unix history repo
      2) berkeley software distribution

      ¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH