Re: flock

"Axel Dörfler" <[email protected]>
Newsgroups gmane.os.openbeos.kernel.devel
Message-ID <52581071517-BeMail@zon>
"François Revol" <[email protected]> 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_SETLK, ...) method.
> > Should we add flock() as well even though it's not part of POSIX?
> Beware, though fcntl(F_SETLK) 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 ?).

We should collect the differences and implement flock() and F_SETLK 
correctly, then.
If possible, I would prefer to have flock() done via F_SETLK, 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.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.