[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MAIL_USE_FLOCK and Debian.

From: Rob Browning
Subject: Re: MAIL_USE_FLOCK and Debian.
Date: Tue, 18 Feb 2003 10:03:32 -0600
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-pc-linux-gnu)

Florian Weimer <address@hidden> writes:

> Maybe Emacs can offer access to the relevant system calls, so
> movemail can be implemented in Lisp?  It can't be *that* hard...

Oh, and although it looks like it's not going to matter, you're
definitely right about being able to implement movemail in Lisp if we
wanted to.  As an example, you might be able to implement the Debian
strategy (embodied in liblockfile) right now, without any changes to
Emacs, since it uses fairly unremarkable system calls.  From

  The algorithm that is used to create a lockfile in an atomic way,  even
  over NFS, is as follows:

  1      A unique file is created. In printf format, the name of the file
         is .lk%05d%x%s. The first argument (%05d) is the current process
         id. The second argument (%x) consists of the 4 minor bits of the
         value returned by time(2). The last argument is the system host-

  2      Then  the lockfile is created using link(2). The return value of
         link is ignored.

  3      Now the lockfile is stat()ed. If the stat fails, we go  to  step

  4      The stat value of the lockfile is compared with that of the tem-
         porary file. If they are the same, we have the lock. The  tempo-
         rary  file  is deleted and a value of 0 (success) is returned to
         the caller.

  5      A check is made to see if the existing lockfile is a valid  one.
         If it isn't valid, the stale lockfile is deleted.

  6      Before  retrying,  we sleep for n seconds. n is initially 5 sec-
         onds, but after every retry 5 extra seconds is  added  up  to  a
         maximum  of  60  seconds (an incremental backoff). Then we go to
         step 2 up to retries times.

Rob Browning
rlb @defaultvalue.org, @linuxdevel.com, and @debian.org
Previously @cs.utexas.edu
GPG starting 2002-11-03 = 14DD 432F AE39 534D B592  F9A0 25C8 D377 8C7E 73A4

reply via email to

[Prev in Thread] Current Thread [Next in Thread]