Message ID | 1397220945-11926-2-git-send-email-jlayton@redhat.com |
---|---|
State | Superseded |
Delegated to: | Carlos O'Donell |
Headers |
Return-Path: <x14307373@homiemail-mx21.g.dreamhost.com> X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx21.g.dreamhost.com (peon2454.g.dreamhost.com [208.113.200.127]) by wilcox.dreamhost.com (Postfix) with ESMTP id C54D636007A for <siddhesh@wilcox.dreamhost.com>; Fri, 11 Apr 2014 05:56:06 -0700 (PDT) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14307373) id 6B02D119A114; Fri, 11 Apr 2014 05:56:06 -0700 (PDT) X-Original-To: glibc@patchwork.siddhesh.in Delivered-To: x14307373@homiemail-mx21.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx21.g.dreamhost.com (Postfix) with ESMTPS id 46796119EA3F for <glibc@patchwork.siddhesh.in>; Fri, 11 Apr 2014 05:56:06 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=O5nl/i5Womzaz0MOL8bq2ScgeX0N3yi JP74ZjXj2P763Ddo9c3rEAJllVsHh25kIWC4I4nuJOOoFTK9czaTwzeIgGgje2Qp c8QI2jaGHVBF4jjhIXoZfjWOuPCvoyIMXa0md06nqBGR0JsRTnj/ZzSvLdTZQW9+ BD81WPxG54hk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=VPLwmDPNXrq9NlJ+C/ZXrQ8RLcA=; b=Z0WtN cWK9mN2RJh0uNCfI05HsElcsm4FOestwDXGOmH29cuzjfFLjLttLjbmoyVv3nHjz pMHDtXRkpysEkrQPlMtzgDMwLHCH3YBzBvD349/3+ce0VfMyUCMSvoC+dgI8RjIM fGFOfdTYmjjdxPamEIwTZMzJeAql8wWJ3l0KlU= Received: (qmail 11232 invoked by alias); 11 Apr 2014 12:55:56 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <libc-alpha.sourceware.org> List-Unsubscribe: <mailto:libc-alpha-unsubscribe-glibc=patchwork.siddhesh.in@sourceware.org> List-Subscribe: <mailto:libc-alpha-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 11207 invoked by uid 89); 11 Apr 2014 12:55:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-HELO: mail-qa0-f45.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=2fMqFDmpSOkakKX7S7m3RpKAW9KBgoG0++bZ4SJ9tho=; b=eEmuRnMBvYNg1dBV7ZfrdIhsU5F2dXZERRgwmEDBXmbf4QeKK6WUYcC8CNcAfcGPqn k+dMINT+ULxf6ljmcPvXgLuLedD7UH95a4QHs/lJLPR9yd8N4tg6OIp7o7Yps5aND7QU 4snN5ypo/jqQEBjBsmOCva0eIyEwQIh2SgCF4sj4SA2mcMRgB3Q2ddg6DaHEBKLgMbNy 9+m1CaSHWpcqZ4g81HxYjbVlJLU1ymoKf5/pl+MRqpUFLKVTGDUhQYeAOVbFG9yM0k42 udPiu4xppXnGXaTt5oFYUcXCX/SOd4M1roO6TDYYYgs8umTzlH2WzO5n7RfPYaHx2SpX Xfzg== X-Gm-Message-State: ALoCoQmgDCsaeVTO63BnJyLnZLCUdBtvWDHJQ0Xe2A9wLoNm3Xha2M4onbAdsdaledVGCfX4CuKN X-Received: by 10.140.102.167 with SMTP id w36mr27039260qge.43.1397220952487; Fri, 11 Apr 2014 05:55:52 -0700 (PDT) From: Jeff Layton <jlayton@redhat.com> To: libc-alpha@sourceware.org Subject: [PATCH v2 1/2] fcntl-linux.h: add new definitions for file-private lock cmd values Date: Fri, 11 Apr 2014 08:55:44 -0400 Message-Id: <1397220945-11926-2-git-send-email-jlayton@redhat.com> In-Reply-To: <1397220945-11926-1-git-send-email-jlayton@redhat.com> References: <1397220945-11926-1-git-send-email-jlayton@redhat.com> X-DH-Original-To: glibc@patchwork.siddhesh.in |
Commit Message
Jeff Layton
April 11, 2014, 12:55 p.m. UTC
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
ChangeLog | 5 +++++
sysdeps/unix/sysv/linux/bits/fcntl-linux.h | 19 +++++++++++++++++++
2 files changed, 24 insertions(+)
Comments
On 04/11/2014 08:55 AM, Jeff Layton wrote: > Signed-off-by: Jeff Layton <jlayton@redhat.com> Thank you very much for contributing this. Don't read anything in the thoroughness or harshness of the review, I think this patch is important, but needs some adjustment. Some things are just nits, other are questions I have about the actual changes. Please see: https://sourceware.org/glibc/wiki/Contribution%20checklist This needs a bug filed since it's a user visible change in features e.g. Bug XXXX "Add support for file-private locks." This also needs a NEWS entry to tell users it's new and they can use it. > --- > ChangeLog | 5 +++++ > sysdeps/unix/sysv/linux/bits/fcntl-linux.h | 19 +++++++++++++++++++ > 2 files changed, 24 insertions(+) > > diff --git a/ChangeLog b/ChangeLog > index 5708d4eb64c2..55a84e598e46 100644 > --- a/ChangeLog > +++ b/ChangeLog > @@ -1,3 +1,8 @@ > +2014-04-11 Jeff Layton <jlayton@redhat.com> > + [BZ #XXXX] > + * sysdeps/unix/sysv/linux/bits/fcntl-linux.h: > + (F_GETLKP, F_SETLKP, F_SETLKPW): New macros. > + ChangeLog is generally posted outside of the patch and not part of the diff so we can just paste it into the top of the ChangeLog. > 2014-04-11 Stefan Liebler <stli@linux.vnet.ibm.com> > > * sysdeps/s390/s390-32/configure.ac: Unify file with ... > diff --git a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h > index 915eb3ede560..ae8ec1598a15 100644 > --- a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h > +++ b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h > @@ -117,6 +117,25 @@ > # define F_SETLKW64 14 /* Set record locking info (blocking). */ > #endif > > +/* fd "private" POSIX locks. > + > + Usually POSIX locks held by a process are released on *any* close and are > + not inherited across a fork. > + > + These cmd values will set locks that conflict with normal POSIX locks, but > + are "owned" by the opened file, not the process. This means that they are > + inherited across fork like BSD (flock) locks, and they are only released > + automatically when the last reference to the the open file against which > + they were acquired is put. > + */ Move '*/' up to the end of the line e.g. 'put. */'. > +#ifdef __USE_GNU > +# ifndef F_GETLKP Why `ifndef F_GETLKP'? Why not just define them? If this is a header order inclusion conflict it needs to be solved like this: https://sourceware.org/glibc/wiki/Synchronizing_Headers?highlight=%28header%29 If it's not a header order inclusion conflict, and you're using #ifndef to allow machines a chance to define the constants themselves, don't, this is a generic constant that is in upstream UAPI asm-generic and everyone should be using the new values. Note: Be aware we've started a typo-safe campaign using -Wundef and are looking to avoid ifndef/ifdef in favour of just if. This way a typo doesn't lead to unintended consequences. > +# define F_GETLKP 36 > +# define F_SETLKP 37 > +# define F_SETLKPW 38 > +# endif > +#endif > + > #ifdef __USE_LARGEFILE64 > # define O_LARGEFILE __O_LARGEFILE > #endif > Please post a new version with the changes. Cheers, Carlos.
On Fri, 11 Apr 2014 19:38:13 -0400 "Carlos O'Donell" <carlos@redhat.com> wrote: > On 04/11/2014 08:55 AM, Jeff Layton wrote: > > Signed-off-by: Jeff Layton <jlayton@redhat.com> > > Thank you very much for contributing this. > > Don't read anything in the thoroughness or harshness of the > review, I think this patch is important, but needs some adjustment. > Some things are just nits, other are questions I have about the > actual changes. > Not a problem, I appreciate the feedback. > Please see: > https://sourceware.org/glibc/wiki/Contribution%20checklist > > This needs a bug filed since it's a user visible change in features > e.g. Bug XXXX "Add support for file-private locks." > Ok. I'll go over that doc and file a bug. > This also needs a NEWS entry to tell users it's new and they can use it. > Ok, does that go in with the patch (in contrast to the ChangeLog entry) ? > > --- > > ChangeLog | 5 +++++ > > sysdeps/unix/sysv/linux/bits/fcntl-linux.h | 19 +++++++++++++++++++ > > 2 files changed, 24 insertions(+) > > > > diff --git a/ChangeLog b/ChangeLog > > index 5708d4eb64c2..55a84e598e46 100644 > > --- a/ChangeLog > > +++ b/ChangeLog > > @@ -1,3 +1,8 @@ > > +2014-04-11 Jeff Layton <jlayton@redhat.com> > > + > [BZ #XXXX] > > + * sysdeps/unix/sysv/linux/bits/fcntl-linux.h: > > + (F_GETLKP, F_SETLKP, F_SETLKPW): New macros. > > + > > ChangeLog is generally posted outside of the patch and not part of > the diff so we can just paste it into the top of the ChangeLog. > Ok. I'll drop that hunk. > > 2014-04-11 Stefan Liebler <stli@linux.vnet.ibm.com> > > > > * sysdeps/s390/s390-32/configure.ac: Unify file with ... > > diff --git a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h > > index 915eb3ede560..ae8ec1598a15 100644 > > --- a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h > > +++ b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h > > @@ -117,6 +117,25 @@ > > # define F_SETLKW64 14 /* Set record locking info (blocking). */ > > #endif > > > > +/* fd "private" POSIX locks. > > + > > + Usually POSIX locks held by a process are released on *any* close and are > > + not inherited across a fork. > > + > > + These cmd values will set locks that conflict with normal POSIX locks, but > > + are "owned" by the opened file, not the process. This means that they are > > + inherited across fork like BSD (flock) locks, and they are only released > > + automatically when the last reference to the the open file against which > > + they were acquired is put. > > + */ > > Move '*/' up to the end of the line e.g. 'put. */'. > No problem. I think I got confused by another comment block above that had it on a newline. > > +#ifdef __USE_GNU > > +# ifndef F_GETLKP > > Why `ifndef F_GETLKP'? Why not just define them? > > If this is a header order inclusion conflict it needs to be solved like this: > > https://sourceware.org/glibc/wiki/Synchronizing_Headers?highlight=%28header%29 > > If it's not a header order inclusion conflict, and you're using #ifndef to > allow machines a chance to define the constants themselves, don't, this is > a generic constant that is in upstream UAPI asm-generic and everyone should > be using the new values. > I don't think there's any reason that we can't leave that off. They shouldn't be defined anywhere else (aside from the uapi headers), and I tried to pick values that are not used on any existing arches so that we can use the same ones everywhere. I'll respin with that removed. Now, that said...I don't really have a great feel for how to get the header file synchronization right so I'd appreciate any guidance here. If you have time, could you also take a look at these definitions in the kernel tree as well? Is there some way we could wrap these there such that we wouldn't need to separately define them in glibc? For now I'll assume that that's not feasible unless you tell me otherwise. > Note: Be aware we've started a typo-safe campaign using -Wundef and are looking > to avoid ifndef/ifdef in favour of just if. This way a typo doesn't lead to > unintended consequences. > Does that mean I should do this instead? #if defined __USE_GNU > > +# define F_GETLKP 36 > > +# define F_SETLKP 37 > > +# define F_SETLKPW 38 > > +# endif > > +#endif > > + > > #ifdef __USE_LARGEFILE64 > > # define O_LARGEFILE __O_LARGEFILE > > #endif > > > > Please post a new version with the changes. > No problem, will do. It turns out that I have a mistake in patch #2 as well, so I'll fix that too and repost both. Thanks for the help so far!
On 04/11/2014 08:37 PM, Jeff Layton wrote: > On Fri, 11 Apr 2014 19:38:13 -0400 > "Carlos O'Donell" <carlos@redhat.com> wrote: > >> On 04/11/2014 08:55 AM, Jeff Layton wrote: >>> Signed-off-by: Jeff Layton <jlayton@redhat.com> >> >> Thank you very much for contributing this. >> >> Don't read anything in the thoroughness or harshness of the >> review, I think this patch is important, but needs some adjustment. >> Some things are just nits, other are questions I have about the >> actual changes. >> > > Not a problem, I appreciate the feedback. > >> Please see: >> https://sourceware.org/glibc/wiki/Contribution%20checklist >> >> This needs a bug filed since it's a user visible change in features >> e.g. Bug XXXX "Add support for file-private locks." >> > > Ok. I'll go over that doc and file a bug. Thanks. >> This also needs a NEWS entry to tell users it's new and they can use it. >> > > Ok, does that go in with the patch (in contrast to the ChangeLog entry) ? As the contributor of the patch you just make a writeup for the NEWS file and the committer adds it there along with the fixed BZ#. So your contribution just looks like: NEWS: * Cool new feature! Blah blah blah! See the existing NEWS file for examples. >>> --- >>> ChangeLog | 5 +++++ >>> sysdeps/unix/sysv/linux/bits/fcntl-linux.h | 19 +++++++++++++++++++ >>> 2 files changed, 24 insertions(+) >>> >>> diff --git a/ChangeLog b/ChangeLog >>> index 5708d4eb64c2..55a84e598e46 100644 >>> --- a/ChangeLog >>> +++ b/ChangeLog >>> @@ -1,3 +1,8 @@ >>> +2014-04-11 Jeff Layton <jlayton@redhat.com> >>> + >> [BZ #XXXX] >>> + * sysdeps/unix/sysv/linux/bits/fcntl-linux.h: >>> + (F_GETLKP, F_SETLKP, F_SETLKPW): New macros. >>> + >> >> ChangeLog is generally posted outside of the patch and not part of >> the diff so we can just paste it into the top of the ChangeLog. >> > > Ok. I'll drop that hunk. Thanks. See other posts for the right (tm) way of posting. >>> 2014-04-11 Stefan Liebler <stli@linux.vnet.ibm.com> >>> >>> * sysdeps/s390/s390-32/configure.ac: Unify file with ... >>> diff --git a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h >>> index 915eb3ede560..ae8ec1598a15 100644 >>> --- a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h >>> +++ b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h >>> @@ -117,6 +117,25 @@ >>> # define F_SETLKW64 14 /* Set record locking info (blocking). */ >>> #endif >>> >>> +/* fd "private" POSIX locks. >>> + >>> + Usually POSIX locks held by a process are released on *any* close and are >>> + not inherited across a fork. >>> + >>> + These cmd values will set locks that conflict with normal POSIX locks, but >>> + are "owned" by the opened file, not the process. This means that they are >>> + inherited across fork like BSD (flock) locks, and they are only released >>> + automatically when the last reference to the the open file against which >>> + they were acquired is put. >>> + */ >> >> Move '*/' up to the end of the line e.g. 'put. */'. >> > > No problem. I think I got confused by another comment block above that > had it on a newline. The GNU Coding Style applies. In general: https://sourceware.org/glibc/wiki/Style_and_Conventions >>> +#ifdef __USE_GNU >>> +# ifndef F_GETLKP >> >> Why `ifndef F_GETLKP'? Why not just define them? >> >> If this is a header order inclusion conflict it needs to be solved like this: >> >> https://sourceware.org/glibc/wiki/Synchronizing_Headers?highlight=%28header%29 >> >> If it's not a header order inclusion conflict, and you're using #ifndef to >> allow machines a chance to define the constants themselves, don't, this is >> a generic constant that is in upstream UAPI asm-generic and everyone should >> be using the new values. >> > > > I don't think there's any reason that we can't leave that off. They > shouldn't be defined anywhere else (aside from the uapi headers), and I > tried to pick values that are not used on any existing arches so that > we can use the same ones everywhere. I'll respin with that removed. Thanks for the respin. > Now, that said...I don't really have a great feel for how to get the > header file synchronization right so I'd appreciate any guidance here. > > If you have time, could you also take a look at these definitions in > the kernel tree as well? Is there some way we could wrap these there > such that we wouldn't need to separately define them in glibc? > > For now I'll assume that that's not feasible unless you tell me > otherwise. For now that is not feasible. That is to say that things are not structured yet to use kernel constants directly without redefining them in glibc, particularly for fcntl.h. It isn't impossible, but it is a distinct project with unique requirements that far exceeds the scope of the work you're trying to accomplish. >> Note: Be aware we've started a typo-safe campaign using -Wundef and are looking >> to avoid ifndef/ifdef in favour of just if. This way a typo doesn't lead to >> unintended consequences. >> > > Does that mean I should do this instead? > > #if defined __USE_GNU Same problem. The typeo-safe alternative is: #if __USE_GNU Where __USE_GNU is defined as 0 or 1. The goal is to move away from defined vs. undefined, and towards always being defined with various values. That avoids typos where you accidentally undefine a constant or never define it in the first place. So please use `#if __USE_GNU'. >>> +# define F_GETLKP 36 >>> +# define F_SETLKP 37 >>> +# define F_SETLKPW 38 >>> +# endif >>> +#endif >>> + >>> #ifdef __USE_LARGEFILE64 >>> # define O_LARGEFILE __O_LARGEFILE >>> #endif >>> >> >> Please post a new version with the changes. >> > > No problem, will do. It turns out that I have a mistake in patch #2 as > well, so I'll fix that too and repost both. > > Thanks for the help so far! You're welcome. Cheers, Carlos.
On Sat, 12 Apr 2014, Carlos O'Donell wrote:
> So please use `#if __USE_GNU'.
No. Please keep what's done with any given macro consistent rather than
confusing things by mixing styles for a single macro. That means
__USE_GNU is tested with #ifdef / #ifndef unless and until all definitions
and users are changed to use 0/1 values instead of undefined/defined.
On Fri, 11 Apr 2014, Carlos O'Donell wrote: > This needs a bug filed since it's a user visible change in features > e.g. Bug XXXX "Add support for file-private locks." My comment in <https://sourceware.org/ml/libc-alpha/2014-03/msg00992.html> applies. I don't think we should be asking for bugs to be filed for new features, only if there was an actual bug that was user-visible in a past release. (It's not wrong to file such a bug, just unnecessary.)
diff --git a/ChangeLog b/ChangeLog index 5708d4eb64c2..55a84e598e46 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-04-11 Jeff Layton <jlayton@redhat.com> + + * sysdeps/unix/sysv/linux/bits/fcntl-linux.h: + (F_GETLKP, F_SETLKP, F_SETLKPW): New macros. + 2014-04-11 Stefan Liebler <stli@linux.vnet.ibm.com> * sysdeps/s390/s390-32/configure.ac: Unify file with ... diff --git a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h index 915eb3ede560..ae8ec1598a15 100644 --- a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h +++ b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h @@ -117,6 +117,25 @@ # define F_SETLKW64 14 /* Set record locking info (blocking). */ #endif +/* fd "private" POSIX locks. + + Usually POSIX locks held by a process are released on *any* close and are + not inherited across a fork. + + These cmd values will set locks that conflict with normal POSIX locks, but + are "owned" by the opened file, not the process. This means that they are + inherited across fork like BSD (flock) locks, and they are only released + automatically when the last reference to the the open file against which + they were acquired is put. + */ +#ifdef __USE_GNU +# ifndef F_GETLKP +# define F_GETLKP 36 +# define F_SETLKP 37 +# define F_SETLKPW 38 +# endif +#endif + #ifdef __USE_LARGEFILE64 # define O_LARGEFILE __O_LARGEFILE #endif