Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Nov 1997 08:44:05 -0700 (MST)
From:      Charles Mott <cmott@srv.net>
To:        Stephen McKay <syssgm@dtir.qld.gov.au>
Cc:        hackers@freebsd.org
Subject:   Re: flock() question 
Message-ID:  <Pine.BSF.3.96.971128083509.513B-100000@darkstar.home>
In-Reply-To: <199711281346.XAA01518@ogre.dtir.qld.gov.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 28 Nov 1997, Stephen McKay wrote:
> It's not entirely obvious from this that 1) your own exclusive lock will
> not prevent you from trying to assert an exclusive lock and 2) you are
> identified by your file table entry.  In other words, you can lock the
> same file over and over and it doesn't nest.  And you and your child are
> the same locker because you refer to the same file table entry.  This
> is the mechanism in action in the first example program.
> 
> It's so obscure that I think a manpage rewrite is in order, probably with
> some sample usage.  For example, locks don't really apply to "files"
> (ie dev/inode) but to "file table entries" (ie channels to files), so
> an example that opens the same file twice and attempts to lock both
> file descriptors would deadlock.  A few of these should scare most
> people off. :-)
> 
> Please beat me to this rewrite.  Otherwise it goes on my list.  Bit
> dusty that list, but if the "rellies" leave me alone this Christmas
> we might see some action. :-)

I'll try to do a rewrite and send you something within a week or two.  The
main problem I have is locating the relevant source code to verify exactly
what is going on.  There was no flock.c in /usr/src/lib/libc that I could
identify and /usr/syr/sys/kern/kern_flock.c was a little opaque to me.

Charles Mott




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.971128083509.513B-100000>