This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb/gdb-7.10-branch] Fix build issue with nat/linux-namespaces.c


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a8c636cb54328fb9a71dcf27b66a7e7ab5443d88

commit a8c636cb54328fb9a71dcf27b66a7e7ab5443d88
Author: Gary Benson <gbenson@redhat.com>
Date:   Mon Sep 14 11:02:06 2015 +0100

    Fix build issue with nat/linux-namespaces.c
    
    This commit fixes a build issue on systems with a prototype for setns
    in their header files but no working setns is detected by configure.
    
    gdb/ChangeLog:
    
    	PR gdb/18957
    	* nat/linux-namespaces.c (setns): Rename from this ...
    	(do_setns): ... to this.  Support calling setns if it exists.
    	(mnsh_handle_setns): Call do_setns.

Diff:
---
 gdb/ChangeLog              |  7 +++++++
 gdb/nat/linux-namespaces.c | 12 ++++++------
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a2629f1..94bcf9f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2015-09-14  Peter Bergner  <bergner@vnet.ibm.com>
+
+	PR gdb/18957
+	* nat/linux-namespaces.c (setns): Rename from this ...
+	(do_setns): ... to this.  Support calling setns if it exists.
+	(mnsh_handle_setns): Call do_setns.
+
 2015-08-28  Joel Brobecker  <brobecker@adacore.com>
 
 	* version.in: Set GDB version number to 7.10.0.DATE-cvs.
diff --git a/gdb/nat/linux-namespaces.c b/gdb/nat/linux-namespaces.c
index 6fb0a2b..4341429 100644
--- a/gdb/nat/linux-namespaces.c
+++ b/gdb/nat/linux-namespaces.c
@@ -34,18 +34,18 @@ int debug_linux_namespaces;
 
 /* Handle systems without setns.  */
 
-#ifndef HAVE_SETNS
-static int
-setns (int fd, int nstype)
+static inline int
+do_setns (int fd, int nstype)
 {
-#ifdef __NR_setns
+#ifdef HAVE_SETNS
+  return setns (fd, nstype);
+#elif defined __NR_setns
   return syscall (__NR_setns, fd, nstype);
 #else
   errno = ENOSYS;
   return -1;
 #endif
 }
-#endif
 
 /* Handle systems without MSG_CMSG_CLOEXEC.  */
 
@@ -495,7 +495,7 @@ mnsh_recv_message (int sock, enum mnsh_msg_type *type,
 static ssize_t
 mnsh_handle_setns (int sock, int fd, int nstype)
 {
-  int result = setns (fd, nstype);
+  int result = do_setns (fd, nstype);
 
   return mnsh_return_int (sock, result, errno);
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]