Subject: Re: "cannot lock mailbox"...
To: Curt Sampson <cjs@portal.ca>
From: John F. Woods <jfw@jfwhome.funhouse.com>
List: current-users
Date: 08/17/1997 22:58:19
> > Oh... The other thing - with elm, anyway - was that you can't use both
> > flocking and fcntlocking. I stuck with flocking, and it works.
> You can't use both with *any* application under NetBSD, because in
> the kernel itself flock just calls fcntl.

Well, almost, it calls VOP_ADVLOCK after faking the structures that fcntl
would have gotten from the user (but it's close enough).

So much for the comment in the fcntl manual page:

     If an applica-
     tion wishes only to do entire file locking, the flock(2) system call is
     much more efficient.

The flock and fcntl manual pages should probably warn that their locks are
now the same fundamental variety, rather than two separate implementations.
(When did that become the case?  flock() predated fcntl() locks by quite a
bit, so presumably someone at some time made a decision to abandon the flock
implementation (setting up a surprise for anyone who got used to fcntl in
the window when the implementations were different).)