From owner-svn-src-all@freebsd.org Tue Mar 8 15:08:24 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12100AC75A9; Tue, 8 Mar 2016 15:08:24 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D7AFB4E; Tue, 8 Mar 2016 15:08:23 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u28F8Mqc005784; Tue, 8 Mar 2016 15:08:22 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u28F8Mtq005783; Tue, 8 Mar 2016 15:08:22 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201603081508.u28F8Mtq005783@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Tue, 8 Mar 2016 15:08:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r296501 - head/sys/compat/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Mar 2016 15:08:24 -0000 Author: dchagin Date: Tue Mar 8 15:08:22 2016 New Revision: 296501 URL: https://svnweb.freebsd.org/changeset/base/296501 Log: 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. MFC after: 1 week Modified: head/sys/compat/linux/linux_fork.c Modified: head/sys/compat/linux/linux_fork.c ============================================================================== --- head/sys/compat/linux/linux_fork.c Tue Mar 8 14:55:50 2016 (r296500) +++ head/sys/compat/linux/linux_fork.c Tue Mar 8 15:08:22 2016 (r296501) @@ -222,6 +222,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, "