Re: Puzzling pop lock files
Randall Gellens <randy <at> qualcomm.com>
2006-03-04 00:48:35 GMT
You did a good job of summarizing the situation. Let me try and fill
in a few details, hopefully not making it too confusing.
There are two main kinds of locks that Qpopper uses (with some
potential variances within them):
To make sure that only one process at a time is modifying the mail
spool, a maillock is held only during the start and end of the
session. Qpopper obtains a maillock on the spool, copies the spool
to the temp drop, zeroes the spool, and releases the maillock. Local
delivery agents delay mail delivery while the maillock is held.
At the end of the session, Qpopper again obtains a maillock on the
spool, appends any mail that arrived during the session to the temp
drop, copies the temp drop to the spool, removes or zeroes the temp
drop, and releases the maillock.
Maillocks need to be interoperable between any program that accesses
the spool. It wouldn't be good if Qpopper used one method while the
local delivery agent used another. Not to mention all the other
programs that could be used to modify the spool. Qpopper by default
uses the ".lock" technique, which is compatible with maillock(3) as
implemented on many platforms.
While the session is in use, Qpopper holds an advisory lock on the
temp drop. The advisory lock is only needed to prevent multiple POP
sessions from altering the temp drop.