Re: [EXIM] Serializing local delivery to a procmail pipe

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Ian Jackson
Ημερομηνία:  
Προς: Vadim Vygonets
Υ/ο: exim-users
Αντικείμενο: Re: [EXIM] Serializing local delivery to a procmail pipe
Vadim Vygonets writes ("Re: [EXIM] Serializing local delivery to a procmail pipe"):
> Quoth Ian Jackson on Wed, Jun 23, 1999:
> > If so, the following small C program may be of some help. Try
> > something like
> > "|with-lock-ex -w /path/to/lockfile program arg arg ..."
> > in the appropriate Exim aliasfile or wherever.
>
> But there already is exim_lock...


exim_lock didn't exist when I first wrote with-lock[-ex], but I still
think you're more likely to want my program. It:

* Doesn't have lots of extraneous stuff to do with lockfile-style
locking.

* Uses F_SETLKW once rather than F_SETLK with a number of retries.
This is original poster's requirement - using exim_lock will give
exactly the same problem as they had before. Furthermore,
arrangements involving retries inevitably result in systems which fail
when heavily loaded, because the retry limit is exceeded.

* Has proper adverb syntax. You use an adverb like this:
<adverb> <options to adverb> <original-command> <arg> <arg> ...
This is like nohup, sudo, nice, etc. The other arrangement (as
provided by su -c, exim_lock, rsh, etc) passes a single argument to
system() and therefore requires an extra level of shell-quoting which
can be quite tedious.

* Doesn't have extraneous code for ~-expansion (this is the job of the
shell).

* Does not fork. Instead it uses exec to replace itself with the
called program, and relies in the system to clean up the leftover fd
and lock. (This can misbehave on programs which unexpectedly fork a
long-running daemon but fail to close file descriptors, but there are
very few of those.)

* Exits with status 255, instead of status 1, if it fails. This
allows you to distinguish failure when (eg) running a program like
diff which uses status 1 for something else.

Ian.

--
*** Exim information can be found at http://www.exim.org/ ***