[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 10/24] linux-user: add setns and unshare
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PULL 10/24] linux-user: add setns and unshare |
Date: |
Fri, 15 Aug 2014 14:01:28 +0300 |
From: Riku Voipio <address@hidden>
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 <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
configure | 20 ++++++++++++++++++++
linux-user/strace.list | 3 +++
linux-user/syscall.c | 11 +++++++++++
3 files changed, 34 insertions(+)
diff --git a/configure b/configure
index 577e2b9..f6de265 100755
--- a/configure
+++ b/configure
@@ -3434,6 +3434,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
@@ -4503,6 +4520,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
diff --git a/linux-user/strace.list b/linux-user/strace.list
index 147f579..d5b8033 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -1191,6 +1191,9 @@
#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
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 74c5d49..e5c3ebb 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -9680,6 +9680,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);
--
2.0.1
- [Qemu-devel] [PULL 09/24] linux-user: support {name_to, open_by}_handle_at syscalls, (continued)
- [Qemu-devel] [PULL 09/24] linux-user: support {name_to, open_by}_handle_at syscalls, riku . voipio, 2014/08/15
- [Qemu-devel] [PULL 06/24] linux-user: fix readlink handling with magic exe symlink, riku . voipio, 2014/08/15
- [Qemu-devel] [PULL 16/24] linux-user: Detect Negative Message Sizes in msgsnd System Call, riku . voipio, 2014/08/15
- [Qemu-devel] [PULL 07/24] linux-user: support timerfd_{create, gettime, settime} syscalls, riku . voipio, 2014/08/15
- [Qemu-devel] [PULL 11/24] linux-user: PPC64 semid_ds Doesnt Include _unused1 and _unused2, riku . voipio, 2014/08/15
- [Qemu-devel] [PULL 13/24] linux-user: Properly Handle semun Structure In Cross-Endian Situations, riku . voipio, 2014/08/15
- [Qemu-devel] [PULL 17/24] linux-user: Handle NULL sched_param argument to sched_*, riku . voipio, 2014/08/15
- [Qemu-devel] [PULL 05/24] linux-user: Fix conversion of sigevent argument to timer_create, riku . voipio, 2014/08/15
- [Qemu-devel] [PULL 14/24] linux-user: Make ipc syscall's third argument an abi_long, riku . voipio, 2014/08/15
- [Qemu-devel] [PULL 03/24] linux-user: make binfmt flag O require P, riku . voipio, 2014/08/15
- [Qemu-devel] [PULL 10/24] linux-user: add setns and unshare,
riku . voipio <=
- [Qemu-devel] [PULL 08/24] linux-user: support ioprio_{get, set} syscalls, riku . voipio, 2014/08/15
- [Qemu-devel] [PULL 12/24] linux-user: Dereference Pointer Argument to ipc/semctl Sys Call, riku . voipio, 2014/08/15
- [Qemu-devel] [PULL 15/24] linux-user: Conditionally Pass Attribute Pointer to mq_open(), riku . voipio, 2014/08/15
- [Qemu-devel] [PULL 24/24] linux-user: check return value of malloc(), riku . voipio, 2014/08/15
- [Qemu-devel] [PULL 23/24] linux-user: writev Partial Writes, riku . voipio, 2014/08/15
- [Qemu-devel] [PULL 18/24] linux-user: Detect fault in sched_rr_get_interval, riku . voipio, 2014/08/15
- [Qemu-devel] [PULL 04/24] linux-user: Fix syscall instruction usermode emulation on X86_64, riku . voipio, 2014/08/15
- [Qemu-devel] [PULL 01/24] linux-user: /proc/self/maps content, riku . voipio, 2014/08/15
- [Qemu-devel] [PULL 22/24] linux-user: Support target-to-host translation of mlockall argument, riku . voipio, 2014/08/15
- [Qemu-devel] [PULL 19/24] linux-user: Move get_ppc64_abi, riku . voipio, 2014/08/15