intermachine flocking

Lusercop `the.lusercop' at
Tue Dec 13 16:58:40 GMT 2005

On Tue, Dec 13, 2005 at 04:38:02PM +0000, Dominic Mitchell wrote:
> If you're in Perl, flock() is probably implemented using fcntl(), which
> is supported over NFS.  Run strace over a test script to verify.
> If it's not, then you need to do jiggery pokery with lockfiles.  This
> involves, IIRC, creating a temp file using your hostname, pid, current
> time, and $i++.  You then have to call link() and then stat() in order
> to check that the number of links is correct.  Or something like that...
> Basically you want to look like a Maildir.

Maildirs are all about not using locking at all. You don't want that.

> This seems to describe what I'm thinking of:

I think that's what exim describes internally as a lockfile hitching post. It
is NFS safe, and sensible.

-- - LARTing Lusers everywhere since 2002

More information about the mailing list