#endif
#include "util.h"
-#include <lib_internal/sys_unshare.h>
+#include <lib_internal/sys_clone.h>
#include <vserver.h>
static void
newNamespace(void)
{
- int rc;
+ pid_t pid;
- rc = sys_unshare(CLONE_NEWNS);
- if (rc!=0) {
- perror("vnamespace: unshare()");
- exit(wrapper_exit_code);
+ signal(SIGCHLD, SIG_DFL);
+
+#ifdef NDEBUG
+ pid = sys_clone(CLONE_NEWNS|CLONE_VFORK|SIGCHLD, 0);
+#else
+ pid = sys_clone(CLONE_NEWNS|SIGCHLD, 0);
+#endif
+
+ switch (pid) {
+ case -1 :
+ perror("vnamespace: clone()");
+ exit(wrapper_exit_code);
+ case 0 :
+ break;
+ default :
+ vc_exitLikeProcess(pid, wrapper_exit_code);
}
}