Re: file locking question

From: Barry Margolin (barry.margolin_at_level3.com)
Date: 05/30/03


Date: Thu, 29 May 2003 23:12:55 GMT

In article <2937926.1054247535@dbforums.com>,
v_sridhar <member17620@dbforums.com> wrote:
>
>ok I think I got that wrong. fcntl() needs to be prepared for mandatory
>locking the SySV way( messing with the GID and XGRP bits).But still in
>the above code the parent is not able to write once the child locks the
>file.Would appreciate if anyone could clarify the behaviour.

The parent and child are both writing the file at the same location, so one
will overwrite what the other has written. The locking is irrelevant,
because the parent never checks the lock.

-- 
Barry Margolin, barry.margolin@level3.com
Level(3), Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.


Relevant Pages

  • Re: file locking question
    ... >>locking the SySV way(messing with the GID and XGRP bits).But still in ... >>the above code the parent is not able to write once the child locks the ... > The parent and child are both writing the file at the same location, ... The locking is irrelevant, ...
    (comp.unix.programmer)
  • Re: file locking question
    ... The parent writes to the file. ... to get Linux to do mandatory locking you need to mount the file ... system with a special option (beside messing around with the permission ...
    (comp.unix.programmer)
  • Re: file locking...
    ... In both approaches we are going to try and avoid using OS-specific locking mechanisms, advisory locking, flock etc. So it should work everywhere as long as you also have write access to the filesystem you're on. ... The parent constantly scans the WORK_DIR for new files to process and as it finds one it sends that filename to a child process. ... want to allow mutiple client processes to access unique groups of these ... process accesses a unique group of files, ...
    (comp.lang.python)
  • Re: Async resume patch (was: Re: [GIT PULL] PM updates for 2.6.33)
    ... Linus Torvalds wrote: ... Don't make up your own locking crap. ... I suggested using the rwsem locking for a good reason. ... parent and then the parent uses down_writeon itself. ...
    (Linux-Kernel)