summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_fork.c
diff options
context:
space:
mode:
authorLuiz Otavio O Souza <luiz@netgate.com>2016-03-30 12:50:25 -0500
committerLuiz Otavio O Souza <luiz@netgate.com>2016-03-30 12:50:25 -0500
commitcda345b593ec84d7abbf45b2ce284a9d7f53307c (patch)
tree7ad875acd35d7cd5a18a7676761b35e5385b1b0c /sys/compat/linux/linux_fork.c
parentc35924db4e1edd83f5a845760098fc8cbd7f7456 (diff)
parentf08e8e5dd415880269fb4ce4cb2fd7bccefe336d (diff)
downloadFreeBSD-src-cda345b593ec84d7abbf45b2ce284a9d7f53307c.zip
FreeBSD-src-cda345b593ec84d7abbf45b2ce284a9d7f53307c.tar.gz
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'sys/compat/linux/linux_fork.c')
-rw-r--r--sys/compat/linux/linux_fork.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/compat/linux/linux_fork.c b/sys/compat/linux/linux_fork.c
index 9e7c71f..f96559c 100644
--- a/sys/compat/linux/linux_fork.c
+++ b/sys/compat/linux/linux_fork.c
@@ -213,6 +213,18 @@ linux_clone_proc(struct thread *td, struct linux_clone_args *args)
if (args->flags & LINUX_CLONE_SETTLS)
linux_set_cloned_tls(td2, args->tls);
+ /*
+ * If CLONE_PARENT is set, then the parent of the new process will be
+ * the same as that of the calling process.
+ */
+ if (args->flags & LINUX_CLONE_PARENT) {
+ sx_xlock(&proctree_lock);
+ PROC_LOCK(p2);
+ proc_reparent(p2, td->td_proc->p_pptr);
+ PROC_UNLOCK(p2);
+ sx_xunlock(&proctree_lock);
+ }
+
#ifdef DEBUG
if (ldebug(clone))
printf(LMSG("clone: successful rfork to %d, "
OpenPOWER on IntegriCloud