Hello, "Nils!
You wrote on 25 Feb 2006 10:50:06 +0100:
??>> expect that 'fcnt()' will return -1 and errno=EACCESS (or EAGAIN),
??>> because lock is
NOS> No - it will block on the fcntl call until it aquires the lock.
??>> occupied with another process. But it's not done, lock is done in
??>> second instance as well.
NOS> How do you determin that, with the above example program ?
Please, read my reply to Alex Fraser.
With best regards, Roman Mashak. E-mail: mrv@xxxxxxxx
Re: question on file locking ...NOS> obtain the lock. ... NOS> You said both your instances obtained the lock.... now what about an strace of the second instance?... The first fcntl call in the code reads: ... (comp.unix.programmer)
Re: question on file locking ...NOS> Good, now what about an strace of the second instance?... NOS> the lock, it blocks/waits until it can aquire the lock. ... NOS> The first instance gets the lock, and is then stuck in an infinte ... (comp.unix.programmer)
Re: question on file locking ...NOS> Good, now what about an strace of the second instance?... NOS> the lock, it blocks/waits until it can aquire the lock. ... NOS> The first instance gets the lock, and is then stuck in an infinte ... (comp.unix.programmer)
Re: question on file locking ... ??>> Actually, I expected that second instance fnctl() should return -1, ...NOS> obtain the lock. ... NOS> You said both your instances obtained the lock....Second instance should've failed, ... (comp.unix.programmer)
Re: Locking in C++ ... even if the file is locked by fcntl or lockf,... > But it's even worse than that; The locking functions provided to obtain ... > a lock operate on file descriptors, ... (comp.unix.programmer)