Hi all,
I've an 'old' application based on sendmail-8.8.7 on an Linux box RH 5.2.
using procmail v3.10 as LDA.
Each incoming message is
- delivered in the standard user maibox (/var/spool/mail/$LOGNAME" )
- handled by a 'filter'
via .procmailrc specified in the user home directory.
A need may arose to restore on demand selected messages
into the mbox (from a previous backup).
So my 'restore application' need to serialize on user mailbox with
procmail.
From the procmail log chunk attached I argue that procmail dotlocking
convention for the standard mailbox "/var/spool/mail/$LOGNAME" is to
create the file pmlock="/var/spool/mail/$LOGNAME.lock" to protect
critical section handling mbox.
Is the following schema in aggreement with procmail locking convention
i.e. a good implementation of 'restore application'
to serialize with procmail delivery ?
snipp ...
/* set effective uid to $LOGNAME */
while ( fd = open(pmlock, O_WRONLY | O_CREAT | O_EXCL , 0666)) == -1
&& errno == EEXIST ) {
/* wait for procmail termination; nop */
}
close(fd);
/* restore mbox */
unlink(pmlock);
snipp ...
Thanks for your help
Federico Tesei
____________________________________________________________________________
Federico Tesei
NETikos S.p.A
I.T. Telecom Italia
Via Matteucci, 34/b
56124 Pisa - Italy
phone: +39-(0)50-968-1 (operator) 968-616 (direct)
email: tesei(_at_)tecsiel(_dot_)it
____________________________________________________________________________
--------------------- procmail log chunk start ----------------
snip ...
procmail: Locking "/var/spool/mail/<$LOGNAME>.lock"
procmail: Assigning "LASTFOLDER=/var/spool/mail/<$LOGNAME>"
procmail: Opening "/var/spool/mail/<$LOGNAME>"
procmail: Acquiring kernel-lock
procmail: Unlocking "/var/spool/mail/<$LOGNAME>.lock"
snip ...
--------------------- procmail log chunk end ----------------
--
____________________________________________________________________________
Federico Tesei
NetIkos S.p.A
I.T. Telecom Italia
Via Matteucci, 34/b
56124 Pisa - Italy
phone: +39-(0)50-968-1 (operator) 968-616 (direct)
email: tesei(_at_)tecsiel(_dot_)it
____________________________________________________________________________
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail