This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC][glibc PATCH] fcntl-linux.h: add new definitions and manual updates for open file description locks
- From: "Michael Kerrisk (man-pages)" <mtk dot manpages at gmail dot com>
- To: ams at gnu dot org
- Cc: Jeff Layton <jlayton at redhat dot com>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>, "linux-fsdevel at vger dot kernel dot org" <linux-fsdevel at vger dot kernel dot org>, lkml <linux-kernel at vger dot kernel dot org>, "Theodore Ts'o" <tytso at mit dot edu>, Rich Felker <dalias at libc dot org>, samba-technical at lists dot samba dot org, Ganesha NFS List <nfs-ganesha-devel at lists dot sourceforge dot net>, "Carlos O'Donell" <carlos at redhat dot com>, "Stefan (metze) Metzmacher" <metze at samba dot org>, Christoph Hellwig <hch at infradead dot org>, Boaz Harrosh <bharrosh at panasas dot com>
- Date: Wed, 23 Apr 2014 21:13:03 +0200
- Subject: Re: [RFC][glibc PATCH] fcntl-linux.h: add new definitions and manual updates for open file description locks
- Authentication-results: sourceware.org; auth=none
- References: <1398253172-9221-1-git-send-email-jlayton at redhat dot com> <E1Wcyo3-0000Eg-UC at fencepost dot gnu dot org> <20140423112843 dot 77889d16 at tlielax dot poochiereds dot net> <E1Wd2Os-00061e-GU at fencepost dot gnu dot org>
- Reply-to: mtk dot manpages at gmail dot com
On Wed, Apr 23, 2014 at 9:00 PM, Alfred M. Szmidt <ams@gnu.org> wrote:
> > Likewise. You infact write that it does get the lock information
> > later in the document wrt. F_OFD_GETLK.
>
> Sorry, I disagree here...GETLK is really a misnomer, IMO. TESTLK
> would have been a better name.
I'm inclined to agree.
> GETLK are used is to "get the first lock".
>
> It's a way to test whether a particular lock can be applied, and to
> return information about a conflicting lock if it can't. If, for
> instance there is no conflicting lock, then you don't "get" any
> lock information back (l_type just gets reset to F_UNLCK).
>
> While I kinda see your point, it isn't what GETLK does; it really does
> get you information about the first lock -- you're not testing
> anything. It is also the terminology used in the POSIX standard.
The POSIX wording is a little confused. For example, what does "first"
mean in this context? F_GETLK returns information about one
(arbitrarily selected) lock that blocks a lock you would like to
place. So, I'm inclined to agree with Jeff -- this really is a "test"
(or "can I lock it") operation.
Of course, the operation has no reliable use: by the time it returns
the information might already be out of date. I suspect that it was
designed to solve the problem: "My F_GETLK operation failed. Who's
blocking me?"
Cheers,
Michael
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/