提交 9af5c906 编写于 作者: R Riku Voipio

linux-user: add setns and unshare

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: NPaul Burton <paul@archlinuxmips.org>
Signed-off-by: NRiku Voipio <riku.voipio@linaro.org>
上级 ab31cda3
...@@ -3470,6 +3470,23 @@ if compile_prog "" "" ; then ...@@ -3470,6 +3470,23 @@ if compile_prog "" "" ; then
timerfd=yes timerfd=yes
fi 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. # Check if tools are available to build documentation.
if test "$docs" != "no" ; then if test "$docs" != "no" ; then
if has makeinfo && has pod2man; then if has makeinfo && has pod2man; then
...@@ -4541,6 +4558,9 @@ fi ...@@ -4541,6 +4558,9 @@ fi
if test "$timerfd" = "yes" ; then if test "$timerfd" = "yes" ; then
echo "CONFIG_TIMERFD=y" >> $config_host_mak echo "CONFIG_TIMERFD=y" >> $config_host_mak
fi fi
if test "$setns" = "yes" ; then
echo "CONFIG_SETNS=y" >> $config_host_mak
fi
if test "$inotify" = "yes" ; then if test "$inotify" = "yes" ; then
echo "CONFIG_INOTIFY=y" >> $config_host_mak echo "CONFIG_INOTIFY=y" >> $config_host_mak
fi fi
......
...@@ -1185,6 +1185,9 @@ ...@@ -1185,6 +1185,9 @@
#ifdef TARGET_NR_set_mempolicy #ifdef TARGET_NR_set_mempolicy
{ TARGET_NR_set_mempolicy, "set_mempolicy" , NULL, NULL, NULL }, { TARGET_NR_set_mempolicy, "set_mempolicy" , NULL, NULL, NULL },
#endif #endif
#ifdef TARGET_NR_setns
{ TARGET_NR_setns, "setns" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_setpgid #ifdef TARGET_NR_setpgid
{ TARGET_NR_setpgid, "setpgid" , NULL, NULL, NULL }, { TARGET_NR_setpgid, "setpgid" , NULL, NULL, NULL },
#endif #endif
......
...@@ -9610,6 +9610,17 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, ...@@ -9610,6 +9610,17 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
break; break;
#endif #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: default:
unimplemented: unimplemented:
gemu_log("qemu: Unsupported syscall: %d\n", num); gemu_log("qemu: Unsupported syscall: %d\n", num);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册