]> git.proxmox.com Git - mirror_qemu.git/commitdiff
linux-user: add setns and unshare
authorRiku Voipio <riku.voipio@linaro.org>
Tue, 12 Aug 2014 12:58:57 +0000 (15:58 +0300)
committerRiku Voipio <riku.voipio@linaro.org>
Fri, 22 Aug 2014 12:06:34 +0000 (15:06 +0300)
Add support for the setns and unshare syscalls, trivially passed through to
the host. Based on patches by Paul Burton, added configure check.

Signed-off-by: Paul Burton <paul@archlinuxmips.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
configure
linux-user/strace.list
linux-user/syscall.c

index 3d0ab1b19393d8b26b3216eaa6187f780d6c910d..c4e47e1ea188123ef7b860299b2da56b47a03b65 100755 (executable)
--- a/configure
+++ b/configure
@@ -3470,6 +3470,23 @@ if compile_prog "" "" ; then
   timerfd=yes
 fi
 
+# check for setns and unshare support
+setns=no
+cat > $TMPC << EOF
+#include <sched.h>
+
+int main(void)
+{
+    int ret;
+    ret = setns(0, 0);
+    ret = unshare(0);
+    return ret;
+}
+EOF
+if compile_prog "" "" ; then
+  setns=yes
+fi
+
 # Check if tools are available to build documentation.
 if test "$docs" != "no" ; then
   if has makeinfo && has pod2man; then
@@ -4541,6 +4558,9 @@ fi
 if test "$timerfd" = "yes" ; then
   echo "CONFIG_TIMERFD=y" >> $config_host_mak
 fi
+if test "$setns" = "yes" ; then
+  echo "CONFIG_SETNS=y" >> $config_host_mak
+fi
 if test "$inotify" = "yes" ; then
   echo "CONFIG_INOTIFY=y" >> $config_host_mak
 fi
index 8de972a6ee642e6ad26c9d6f920c4e346fa4d24d..aa0cd735cce2467fbb872820426b1a62e6ff90f9 100644 (file)
 #ifdef TARGET_NR_set_mempolicy
 { TARGET_NR_set_mempolicy, "set_mempolicy" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_setns
+{ TARGET_NR_setns, "setns" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_setpgid
 { TARGET_NR_setpgid, "setpgid" , NULL, NULL, NULL },
 #endif
index f1c182bbaec3822bdce5e4467cbc6eb78559e077..dae10afcb84ef116d53c238329d6c803aad6d7d3 100644 (file)
@@ -9610,6 +9610,17 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         break;
 #endif
 
+#if defined(TARGET_NR_setns) && defined(CONFIG_SETNS)
+    case TARGET_NR_setns:
+        ret = get_errno(setns(arg1, arg2));
+        break;
+#endif
+#if defined(TARGET_NR_unshare) && defined(CONFIG_SETNS)
+    case TARGET_NR_unshare:
+        ret = get_errno(unshare(arg1));
+        break;
+#endif
+
     default:
     unimplemented:
         gemu_log("qemu: Unsupported syscall: %d\n", num);