home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.mail.sendmail
- Path: sparky!uunet!wupost!darwin.sura.net!sgiblab!daver!hico2!sonyd1.Broadcast.Sony.COM!blilly.UUCP!bruce
- From: bruce@blilly.UUCP (Bruce Lilly)
- Subject: Re: file locking after forks in sendmail 5.65
- References: <1666@seqp4.sequoia.com> <1992Nov14.000809.25487@blilly.UUCP> <VIXIE.92Nov14195819@cognition.pa.dec.com>
- Organization: Bruce Lilly
- Date: Mon, 16 Nov 92 00:07:59 GMT
- Message-ID: <1992Nov16.000759.8818@blilly.UUCP>
- Lines: 37
-
- In article <VIXIE.92Nov14195819@cognition.pa.dec.com> vixie@pa.dec.com (Paul A Vixie) wrote:
- >Flock(2)-originated locks are inherited by child processes.
-
- How does that work with exclusive locks? According to ``The
- Design and Implementation of the 4.3BSD UNIX(R) Operating
- System'', by Leffler et. al., ``Only one process may have an
- exclusive lock on a file'' (p. 177).
-
- It would therefore seem that
- a) flock(2)-originated exclusive locks can not be inherited
- by child processes
- or
- b) more than one process may have an exclusive lock on a
- file (which seems self-contradictory)
- or
- c) the nature of a lock changes when it is inherited by a
- child process
- .
-
- In any event, file locking under BSD is advisory locking only,
- which means that it is ineffective at preventing random
- processes (e.g. cat(1), vi(1), sh(1), csh(1), etc.) from
- modifying a locked file while it is being written
- to or read from by the process holding the lock. In the context
- of the original poster's question (queue file processing) that
- should not be a problem under normal circumstances, since one
- would not expect any program other than sendmail to access the
- queue files. However it may be a problem when sendmail is
- updating a database (e.g. the aliases database), since it is
- quite possible that the text version of the database may be
- modified by a program other than sendmail, and one that doesn't
- check for locks (such as those named above). That's why the SV
- code submitted for UIUC/IDA sendmail incorporates mandatory file
- locking for the database files for automatic update.
- --
- Bruce Lilly blilly!bruce@Broadcast.Sony.COM
- ...uunet!sonyusa!sonyd1!blilly!bruce
-