Re: On file locking - Mailing list pgsql-hackers

From Curt Sampson
Subject Re: On file locking
Date
Msg-id Pine.NEB.4.51.0302011509320.610@angelic.cynic.net
Whole thread Raw
In response to Re: On file locking  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: On file locking  (Giles Lean <giles@nemeton.com.au>)
List pgsql-hackers
On Fri, 31 Jan 2003, Tom Lane wrote:

> Antti Haapala <antti.haapala@iki.fi> writes:
> > And from SunOS 5.8 flock
> >      Locks are on files, not file  descriptors.   That  is,  file
> >      descriptors  duplicated  through  dup(2)  or  fork(2) do not
> >      result in multiple instances of a lock, but rather  multiple
> >      references to a single lock.  If a process holding a lock on
> >      a file forks and the child explicitly unlocks the file,  the
> >      parent  will  lose  its  lock.  Locks are not inherited by a
> >      child process.
>
> That seems self-contradictory.

Yes. I note that in NetBSD, that paragraph of the manual page is
identical except that the last sentence has been removed.

At any rate, it seems to me highly unlikely that, since the child has
the *same* descriptor as the parent had, that the lock would disappear.

The other option would be that the lock belongs to the process, in which
case one would think that a child doing an unlock should not affect the
parent, because it's a different process....

cjs
-- 
Curt Sampson  <cjs@cynic.net>   +81 90 7737 2974   http://www.netbsd.org   Don't you know, in this new Dark Age, we're
alllight.  --XTC
 


pgsql-hackers by date:

Previous
From: Curt Sampson
Date:
Subject: Re: Linux.conf.au 2003 Report
Next
From: Curt Sampson
Date:
Subject: Re: PostgreSQL, NetBSD and NFS