+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
/* 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. */
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);
}