IMHO, relying on any such thing is evil. People will surely use your code
in environments where that assumption doesn't hold; after all, it works (almost)
flawlessly regardless, right?
The "almost" is the problem.
Read maildir(5), a manual page from the qmail system. It describes a reliable
mail delivery system which works over NFS, even if multiple mail servers
write to the same mail spool.
Obviously, this is a one-file-per-message system. This has other
advantages; for instance, it's very easy to accomplish a "mails older than
a month and bigger than 10k will vanish" trick with a simple find | xargs rm.
Equally obviously, you need client support for maildir. I haven't found
much yet, unfortunately. However, IMHO it's a much better idea to create a
patch for elm which supports maildir than to invent yet another limited-use
locking scheme.
-- Assembly line workers do it over and over.-- Matthias Urlichs \ noris network GmbH / Xlink-POP Nürnberg Schleiermacherstraße 12 \ Linux+Internet / EMail: urlichs@noris.de 90491 Nürnberg (Germany) \ Consulting+Programming+Networking+etc'ing PGP: 1024/4F578875 1B 89 E2 1C 43 EA 80 44 15 D2 29 CF C6 C7 E0 DE Click <A HREF="http://info.noris.de/~smurf/finger">here</A>. 42