This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC][PATCH 1/2] fcntl.h: add new definitions for file-private lock cmd values
- From: Jeff Layton <jlayton at redhat dot com>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: libc-alpha at sourceware dot org, linux-fsdevel at vger dot kernel dot org
- Date: Tue, 11 Feb 2014 18:57:48 -0500
- Subject: Re: [RFC][PATCH 1/2] fcntl.h: add new definitions for file-private lock cmd values
- Authentication-results: sourceware.org; auth=none
- References: <1392145436-13983-1-git-send-email-jlayton at redhat dot com> <1392145436-13983-2-git-send-email-jlayton at redhat dot com> <20140211214915 dot 2FB4774438 at topped-with-meat dot com>
On Tue, 11 Feb 2014 13:49:15 -0800 (PST)
Roland McGrath <roland@hack.frob.com> wrote:
> > +2014-02-11 Jeff Layton <jlayton@redhat.com>
> > +
> > + * add new fcntl cmd macros for file-private locks
>
> Proper format is:
>
> * sysdeps/unix/sysv/linux/bits/fcntl-linux.h
> (F_GETLKP, F_SETLKP, F_SETLKPW): New macros.
>
> > +/*
> > + * fd "private" POSIX locks.
> > + *
> > + * Usually POSIX locks held by a process are released on *any* close and are
> > + * not inherited across a fork().
>
> Use GNU style for comments, as you see elsewhere in the file. Use two
> spaces between sentences. Don't use "function()" when referring to a
> function, just the name.
>
> > +#ifndef F_GETLKP
> > +# define F_GETLKP 36
> > +# define F_SETLKP 37
> > +# define F_SETLKPW 38
> > +#endif
>
> These need to be protected by #ifdef __USE_GNU.
Thanks for the comments, Roland. I'll fix the patch accordingly.
My plan is to eventually submit this to become part of the POSIX
standard though they won't take it until there's at least one shipping
implementation. I assume that we just need to stick that inside of
__USE_GNU for now, and if POSIX eventually picks it up then we'll just
remove that protection?
Also, I'm a little curious in looking at this and have a (probably
stupid) question:
Why does glibc have its own definitions for the fcntl F_* cmd values
instead of using the ones in the uapi kernel headers? Would it not be
simpler to just have the fcntl.h include those instead of duplicating
them?
Thanks,
--
Jeff Layton <jlayton@redhat.com>