procmail
[Top] [All Lists]

Re: FLOCK

2002-09-17 13:55:39

Homer wrote:
    Procmail 3.22, Linux 2.0.38 Perl 5.00503

    If I

    #!/usr/local/bin/prl5
    open (FILE,"/var/spool/mail/homer"); flock(FILE,2);
    $a = <>;


Phil answered:
You don't test open() or flock() for failure?  Bad programmer; no cookie!

     Thank you Phil for the answer.

     Truth is the locking works properly on SunOS where procmail itself
uses flock, but in linux the flock tests fail during the autoconf.h, and
so alas it ignores my perl flock.

     Homer




    in a perl script and then send mail to homer, will
procmail honor the open flock in the perl script and put
the mail in the mail queue?

It will if and only if procmail was compiled to use a method of locking
that's compatible with the actual form of kernel locking used by perl's
flock() call.

Running "procmail -v" will show you want procmail is using.  Figuring out
what perl is using takes more work.  For perl 5.6.1 and probably others,
this should tell what perl is really using flock() or fcntl() (assuming
it really implements it at all):

perl -MConfig -le 'print $Config{d_flock} ? "flock" : "fcntl"'

On some systems, the actual library calls may be implemented on top of
each other, so even if the method used by perl isn't used by procmail,
they might still block each other.  (Have I mentioned that this area of
UNIX programming is a mess?)


Philip Guenther


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>