public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Gary Benson <gbenson@redhat.com>
To: Peter Bergner <bergner@vnet.ibm.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Fix build issue due to Introduce nat/linux-namespaces.[ch] patch
Date: Tue, 14 Jul 2015 14:46:00 -0000	[thread overview]
Message-ID: <20150714144641.GC26999@blade.nx> (raw)
In-Reply-To: <1436474110.5367.27.camel@otta>

Hi Peter,

Peter Bergner wrote:
> I have a toolchain that dies building gdb with the following error:
> 
> /home/bergner/binutils/binutils-gdb/gdb/nat/linux-namespaces.c:39:1: error: static declaration of ‘setns’ follows non-static declaration
>  setns (int fd, int nstype)
>  ^
> In file included from /opt/at7.0/include/sched.h:41:0,
>                  from /home/bergner/binutils/binutils-gdb/gdb/nat/linux-namespaces.c:30:
> /opt/at7.0/include/bits/sched.h:91:12: note: previous declaration of ‘setns’ was here
>  extern int setns (int __fd, int __nstype) __THROW;
>             ^
> make[2]: *** [linux-namespaces.o] Error 1
> 
> My configure doesn't define HAVE_SETNS because my glibc defines
> __stub_setns, so nat/linux-namespaces.c defines its own setns
> routine.  However, my glibc also has its sched.h with a extern
> prototype for setns, which conflicts with this static version
> linux-namespaces.c is creating, so we get the error above.  How
> about the following patch to work around the error?  I can confirm
> that it fixes the problem on my multiple systems that do and do not
> have setns.
> 
> Ok for trunk?

I'd prefer it without the nested conditionals:

  #ifdef HAVE_SETNS
    return setns (fd, nstype);
  #elif defined __NR_setns
    return syscall (__NR_setns, fd, nstype);
  #else
    errno = ENOSYS;
    return -1;
  #endif

Otherwise ok.  Thanks for doing this work!

Cheers,
Gary

-- 
http://gbenson.net/

  reply	other threads:[~2015-07-14 14:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-09 20:36 Peter Bergner
2015-07-14 14:46 ` Gary Benson [this message]
2015-07-14 15:50   ` Peter Bergner
2015-07-15 12:32     ` Gary Benson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150714144641.GC26999@blade.nx \
    --to=gbenson@redhat.com \
    --cc=bergner@vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).