[2/9,v2] Introduce nat/linux-namespaces.[ch]

Message ID 20150616084033.GB15889@blade.nx
State New, archived
Headers

Commit Message

Gary Benson June 16, 2015, 8:40 a.m. UTC
  Michael Eager wrote:
> On 06/15/2015 08:02 AM, Michael Eager wrote:
> >On 04/30/2015 05:05 AM, Gary Benson wrote:
> > > This commit introduces new shared files linux-namespaces.[ch]
> > > containing code to support Linux namespaces that will be used
> > > by both GDB and gdbserver.
> >
> > This patch causes a build failure in nat/linux-namespaces.c with
> > glibc-2.5, which does not define MSG_CMSG_CLOEXEC.  It looks like
> > this symbol was introduced in glib-2.7.
> 
> Here is a patch which allows this to compile if the symbol is not
> defined.
[snip]

Looks good, though maybe with a comment (below).
Please commit this.

Cheers,
Gary

--
  

Comments

Michael Eager June 16, 2015, 2:19 p.m. UTC | #1
On 06/16/2015 01:40 AM, Gary Benson wrote:
> Michael Eager wrote:
>> On 06/15/2015 08:02 AM, Michael Eager wrote:
>>> On 04/30/2015 05:05 AM, Gary Benson wrote:
>>>> This commit introduces new shared files linux-namespaces.[ch]
>>>> containing code to support Linux namespaces that will be used
>>>> by both GDB and gdbserver.
>>>
>>> This patch causes a build failure in nat/linux-namespaces.c with
>>> glibc-2.5, which does not define MSG_CMSG_CLOEXEC.  It looks like
>>> this symbol was introduced in glib-2.7.
>>
>> Here is a patch which allows this to compile if the symbol is not
>> defined.
> [snip]
>
> Looks good, though maybe with a comment (below).
> Please commit this.
>
> Cheers,
> Gary
>
> --
> diff --git a/gdb/nat/linux-namespaces.c b/gdb/nat/linux-namespaces.c
> index f18e40d..a7a3e4d 100644
> --- a/gdb/nat/linux-namespaces.c
> +++ b/gdb/nat/linux-namespaces.c
> @@ -47,6 +47,12 @@ setns (int fd, int nstype)
>   }
>   #endif
>
> +/* Handle systems without MSG_CMSG_CLOEXEC.  */
> +
> +#ifndef MSG_CMSG_CLOEXEC
> +#define MSG_CMSG_CLOEXEC 0
> +#endif
> +
>   /* A Linux namespace.  */
>
>   struct linux_ns

Committed: 4da680addb9.
  
Gary Benson June 17, 2015, 9:51 a.m. UTC | #2
Michael Eager wrote:
> On 06/16/2015 01:40 AM, Gary Benson wrote:
> > Michael Eager wrote:
> > > On 06/15/2015 08:02 AM, Michael Eager wrote:
> > > > On 04/30/2015 05:05 AM, Gary Benson wrote:
> > > > > This commit introduces new shared files linux-namespaces.[ch]
> > > > > containing code to support Linux namespaces that will be used
> > > > > by both GDB and gdbserver.
> > > >
> > > > Tis patch causes a build failure in nat/linux-namespaces.c with
> > > > glibc-2.5, which does not define MSG_CMSG_CLOEXEC.  It looks like
> > > > this symbol was introduced in glib-2.7.
> > >
> > > Here is a patch which allows this to compile if the symbol is not
> > > defined.
> > [snip]
> >
> > Looks good, though maybe with a comment (below).
> > Please commit this.
> > 
> > --
> > diff --git a/gdb/nat/linux-namespaces.c b/gdb/nat/linux-namespaces.c
> > index f18e40d..a7a3e4d 100644
> > --- a/gdb/nat/linux-namespaces.c
> > +++ b/gdb/nat/linux-namespaces.c
> > @@ -47,6 +47,12 @@ setns (int fd, int nstype)
> >   }
> >   #endif
> > 
> > +/* Handle systems without MSG_CMSG_CLOEXEC.  */
> > +
> > +#ifndef MSG_CMSG_CLOEXEC
> > +#define MSG_CMSG_CLOEXEC 0
> > +#endif
> > +
> >   /* A Linux namespace.  */
> > 
> >   struct linux_ns
> 
> Committed: 4da680addb9.

Thanks Michael.

Cheers,
Gary
  

Patch

diff --git a/gdb/nat/linux-namespaces.c b/gdb/nat/linux-namespaces.c
index f18e40d..a7a3e4d 100644
--- a/gdb/nat/linux-namespaces.c
+++ b/gdb/nat/linux-namespaces.c
@@ -47,6 +47,12 @@  setns (int fd, int nstype)
 }
 #endif
 
+/* Handle systems without MSG_CMSG_CLOEXEC.  */
+
+#ifndef MSG_CMSG_CLOEXEC
+#define MSG_CMSG_CLOEXEC 0
+#endif
+
 /* A Linux namespace.  */
 
 struct linux_ns