Date: Sun, 27 Mar 2016 06:55:49 +0000 (UTC) From: Dmitry Chagin <dchagin@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r297305 - stable/10/sys/compat/linux Message-ID: <201603270655.u2R6tnTm018142@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dchagin Date: Sun Mar 27 06:55:49 2016 New Revision: 297305 URL: https://svnweb.freebsd.org/changeset/base/297305 Log: MFC r296501: Link the newly created process to the corresponding parent as if CLONE_PARENT is set, then the parent of the new process will be the same as that of the calling process. Modified: stable/10/sys/compat/linux/linux_fork.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/compat/linux/linux_fork.c ============================================================================== --- stable/10/sys/compat/linux/linux_fork.c Sun Mar 27 06:52:40 2016 (r297304) +++ stable/10/sys/compat/linux/linux_fork.c Sun Mar 27 06:55:49 2016 (r297305) @@ -213,6 +213,18 @@ linux_clone_proc(struct thread *td, stru 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, "
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603270655.u2R6tnTm018142>