"Fran=E7ois Revol" <revol@...> wrote:
> > a while ago, I implemented advisory locking support to the VFS.
> > However, I didn't add the non-POSIX flock() function; this locking
> > functionality is only available using the POSIX defined fcntl(...,
> > F=5FSETLK, ...) method.
> > Should we add flock() as well even though it's not part of POSIX=3F
> Beware, though fcntl(F=5FSETLK) uses a struct flock, this one has
> nothing
> to do and is not compatible with it, and has a different semantic
> (for
> ex one removes the lock on exec or a close, the other doesn't). I
> scratched my head several days on them.
> This one is a BSDism, but I think several apps wants it (samba =3F).
We should collect the differences and implement flock() and F=5FSETLK
correctly, then.
If possible, I would prefer to have flock() done via F=5FSETLK, and if
it's only the COE behaviour, I'm sure we can fix that :)
> IIRC Linux implements both via a single call with a flag to indicate
> the semantics used, and forbids using both on the same file.
> cf. locks.txt and mandatory.txt in /usr/src/linux/Documentation/
It doesn't really go in depth - it reads more like a comparison between
mandatory vs. advisory locking implementations. I don't want to expose
a mandatory locking to POSIX at all, I'm not even sure if I want to
have that in the Be API either (BNode::Lock() could also just do
advisory locking).
> You can also add lockf() but this one is just a simple call to
> fcntl(),
> and might actually be already don't in glibc.
I don't want to add too much cruft :-)
Bye,
Axel.
|