Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!watmath!clyde!floyd!harpo!utah-cs!lepreau
From: lepreau@utah-cs.UUCP (Jay Lepreau)
Newsgroups: net.unix
Subject: Re: mail locking
Message-ID: <2587@utah-cs.UUCP>
Date: Fri, 16-Mar-84 02:04:00 EST
Article-I.D.: utah-cs.2587
Posted: Fri Mar 16 02:04:00 1984
Date-Received: Sat, 17-Mar-84 02:37:44 EST
References: amd70.4430
Lines: 16

That's the whole point, that EVERY program that writes on /usr/spool/mail/user
must observe the same locking protocol.  Another problem with the locking as
distributed (in 4.x bsd at least) is that the timeout in binmail is too
short: only 30 seconds.  After that binmail declares the lock defunct and
merrily appends to the mail file.  That can easily be exceeded on a not very
loaded system by a user with a big mailbox, and many keep their boxes full of
pending mail.  As distributed, UCB Mail has the long timeout of 5 minutes,
but that is the program that normally only needs a short timeout, as
/bin/mail will append quickly.

Anyway, I have extracted the relevant locking code into a module mlock.c
containing, ah hah, mlock and mfree, which lock on /tmp.  If people want I'll
send it out (it's pretty minor, but it's done).  I didn't use 4.2 file locking
locking so it is portable.

Jay Lepreau