This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Fix build issue with nat/linux-namespaces.c.
- From: Peter Bergner <bergner at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 14 Jul 2015 15:46:27 -0000
- Subject: [binutils-gdb] Fix build issue with nat/linux-namespaces.c.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=99fe86f7999afd2743b08c550b10f083ae4bd9bd
commit 99fe86f7999afd2743b08c550b10f083ae4bd9bd
Author: Peter Bergner <bergner@vnet.ibm.com>
Date: Tue Jul 14 10:46:16 2015 -0500
Fix build issue with nat/linux-namespaces.c.
* 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 | 6 ++++++
gdb/nat/linux-namespaces.c | 12 ++++++------
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a49f354..158ebcb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2015-07-14 Peter Bergner <bergner@vnet.ibm.com>
+
+ * 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-07-13 Yao Qi <yao.qi@linaro.org>
* exec.c (exec_file_attach): Add period at the end of error
diff --git a/gdb/nat/linux-namespaces.c b/gdb/nat/linux-namespaces.c
index a7a3e4d..fd0d4b0 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);
}