home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / mail / sendmail / 2796 < prev    next >
Encoding:
Text File  |  1992-11-15  |  2.1 KB  |  48 lines

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