Re: flock

"François Revol" <[email protected]>
Newsgroups gmane.os.openbeos.kernel.devel
Message-ID <1762888711-BeMail@laptop>
> Hi there,
> 
> 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 ?).

IIRC Linux implements both via a single call with a flag to indicate 
the semantics used, and forbids using both on the same file.

You can also add lockf() but this one is just a simple call to fcntl(), 
and might actually be already don't in glibc.

François.

-------------------------------------------------------------------------
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.