From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 68116 invoked by alias); 17 Apr 2015 13:41:28 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 68103 invoked by uid 89); 17 Apr 2015 13:41:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 17 Apr 2015 13:41:26 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 6ABD591763; Fri, 17 Apr 2015 13:41:25 +0000 (UTC) Received: from blade.nx (ovpn-116-95.ams2.redhat.com [10.36.116.95]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3HDfOAc026544; Fri, 17 Apr 2015 09:41:25 -0400 Received: by blade.nx (Postfix, from userid 1000) id 1ECCB263FBA; Fri, 17 Apr 2015 14:41:24 +0100 (BST) Date: Fri, 17 Apr 2015 13:41:00 -0000 From: Gary Benson To: Doug Evans Cc: gdb-patches Subject: Re: [PATCH 3/7] Introduce nat/linux-namespaces.[ch] Message-ID: <20150417134123.GB26681@blade.nx> References: <1429186791-6867-1-git-send-email-gbenson@redhat.com> <1429186791-6867-4-git-send-email-gbenson@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg00676.txt.bz2 Doug Evans wrote: > On Thu, Apr 16, 2015 at 5:19 AM, Gary Benson wrote: > > diff --git a/gdb/nat/linux-namespaces.c b/gdb/nat/linux-namespaces.c > > new file mode 100644 > > index 0000000..f6fe863 > > --- /dev/null > > +++ b/gdb/nat/linux-namespaces.c > > @@ -0,0 +1,231 @@ [snip] > > +#include "common-defs.h" > > +#include "nat/linux-namespaces.h" > > +#include "filestuff.h" > > +#include > > +#include > > +#include > > + > > +/* Handle systems with __NR_setns but no setns. */ > > +#if defined(__NR_setns) && !defined(HAVE_SETNS) > > +static int > > +setns (int fd, int nstype) > > +{ > > + return syscall (__NR_setns, fd, nstype); > > +} > > +#define HAVE_SETNS 1 > > +#endif /* defined(__NR_setns) && !defined(HAVE_SETNS) */ > > Nit: > I understand the goal here, but I think it would be better to do > this slightly differently. > The value of HAVE_SETNS is potentially different in this file than > for the rest of gdb, > and I generally think of config.h as being consistent across the app. > I don't have a strong preference on how to change this, other than I > think values defined in config.h should be left alone. The value of HAVE_SETNS is potentially different in this file than for the rest of gdb, but so is the existence of a setns function. That's why I did it that way. I certainly didn't want to make our own setns available to any other file, as really anything accessing namespaces should go through this file. > E.g., one could just just define another macro locally here. > > #if defined(__NR_setns) || defined(HAVE_SETNS) > #define REALLY_HAVE_SETNS 1 > #endif > > #ifdef REALLY_HAVE_SETNS > ... the rest of the file ... > > or some such. I could do that (I'd probably call it HAVE_LINUX_NAMESPACES). I prefer the way I did it but I won't fight this. Cheers, Gary -- http://gbenson.net/