[PLUG] file locking

steve steve at lonetwin.net
Tue Jul 21 10:08:17 IST 2009


Hi,

It's weird that you haven't got a useful answer yet[1] !

Aditya Godbole wrote:
> On Fri, Jul 17, 2009 at 8:48 AM, Vishal Rao<vishalrao at gmail.com> wrote:
>>>
>>> I am looking at a user level approach, not a programmer level approach.
>>>
>>
>> For a user level (requires cooperation) approach, assume you have the same
>> app sharing files in the same folder, then this app co-operates with other
>> instances by always calling for exclusive lock, then NOT working on the file
>> until it can gain the lock.
> 
> I did not expect to be misunderstood on such a grand scale; let me be
> more specific.
> If a file (inode) has already been opened, all other calls to 'open'
> the file should fail. As simple as that. Is there a way to do this
> using either the native filesystem, or using samba?
> 

No, there isn't a 'automatic' way to do this. If you are interested in knowing 
why, google for 'mandatory and advisory locks on linux'. To start off, you can 
do a man fcntl and scroll down to the 'Advisory/Mandatory locking' sections.

hth,
cheers,
- steve


[1] After a long time, I've resubscribed to PLUG and not much has changed, i see :)

-- 
why procrastinate when you can perendinate ?
          --------------------
random non tech spiel: http://lonetwin.blogspot.com/
tech randomness: http://lonetwin.blogspot.com/
what i'm stumbling into: http://lonetwin.blogspot.com/
          --------------------





More information about the Plug-mail mailing list