[lkml]   [1996]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Pre2.0-8 & Sendmail

John Henders wrote:
> In <> (Andrew Walker) writes:
> >Recompile your sendmail to lock with flock() (#define HASFLOCK I think).
> >In newer kernels I disallowed mixing BSD (flock) and SYSV(lockf)/POSIX(fcntl)
> >locks on a file. The GDBM routines use flock() to lock the alias database,
> >and then sendmail tries to lock the same files with lockf() - hence the
> >problem.
> You might want to reconsider your recommendation for flock() as the
> standard. I agree that mixed locks are a bad thing, but standardizing on
> flock means anyone wanting to try doing locking over NFS will have to
> maintain custom versions of the system libraries. Debian has already
> changed their gdbm to use fcntl() locking.
> Is there any particular reason to recommending flock()? My book on Posix
> programming uses fcntl() and calls flock() a BSD'ism.

flock() *is* a BSD'ism, and one of the better ones ;-)

I'm not really advocating one style or the other, although flock() has much
better semantics(*) with the exception of NFS locking. The problem in this case
is that people already have GDBM libraries that use flock(), and if sendmail
is compiled to use these libraries then sendmail must use flock() as well.

Personally I'd compile with the Berkeley DB library instead of GDBM and stop
worrying about flock() vs fcntl(). Eric Allman tried to switch over to fcntl()
as the sendmail standard. He ended up recommending flock() as the only method
that had sensible behaviour on all platforms that support it.


(*) - especially for a program that forks a lot and wants to share locks with
its children

Andy Walker Kvaerner Engineering a.s. P.O. Box 222, N-1324 Lysaker, Norway

......if the answer isn't violence, neither is your silence......

 \ /
  Last update: 2005-03-22 13:37    [W:0.049 / U:0.948 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site