Date: Sat, 9 Jan 2016 18:28:15 +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: r293608 - stable/10/sys/compat/linux Message-ID: <201601091828.u09ISFmg078684@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dchagin Date: Sat Jan 9 18:28:15 2016 New Revision: 293608 URL: https://svnweb.freebsd.org/changeset/base/293608 Log: MFC r288994 (by bdrewery): Remove redundant RFFPWAIT/vfork(2) handling in Linux fork(2) and clone(2) wrappers. r161611 added some of the code from sys_vfork() directly into the Linux module wrappers since they use RFSTOPPED. In r232240, the RFFPWAIT handling was moved to syscallret(), thus this code in the Linux module is no longer needed as it will be called later. This also allows the Linux wrappers to benefit from the fix in r275616 for threads not getting suspended if their vforked child is stopped while they wait on them. 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 Sat Jan 9 18:24:53 2016 (r293607) +++ stable/10/sys/compat/linux/linux_fork.c Sat Jan 9 18:28:15 2016 (r293608) @@ -107,20 +107,14 @@ linux_vfork(struct thread *td, struct li printf(ARGS(vfork, "")); #endif - /* Exclude RFPPWAIT */ - if ((error = fork1(td, RFFDG | RFPROC | RFMEM | RFSTOPPED, 0, &p2, - NULL, 0)) != 0) + if ((error = fork1(td, RFFDG | RFPROC | RFMEM | RFPPWAIT | RFSTOPPED, + 0, &p2, NULL, 0)) != 0) return (error); - td2 = FIRST_THREAD_IN_PROC(p2); linux_proc_init(td, td2, 0); - PROC_LOCK(p2); - p2->p_flag |= P_PPWAIT; - PROC_UNLOCK(p2); - td->td_retval[0] = p2->p_pid; /* @@ -131,12 +125,6 @@ linux_vfork(struct thread *td, struct li sched_add(td2, SRQ_BORING); thread_unlock(td2); - /* wait for the children to exit, ie. emulate vfork */ - PROC_LOCK(p2); - while (p2->p_flag & P_PPWAIT) - cv_wait(&p2->p_pwait, &p2->p_mtx); - PROC_UNLOCK(p2); - return (0); } @@ -180,6 +168,9 @@ linux_clone_proc(struct thread *td, stru if (args->parent_tidptr == NULL) return (EINVAL); + if (args->flags & LINUX_CLONE_VFORK) + ff |= RFPPWAIT; + error = fork1(td, ff, 0, &p2, NULL, 0); if (error) return (error); @@ -229,12 +220,6 @@ linux_clone_proc(struct thread *td, stru exit_signal); #endif - if (args->flags & LINUX_CLONE_VFORK) { - PROC_LOCK(p2); - p2->p_flag |= P_PPWAIT; - PROC_UNLOCK(p2); - } - /* * Make this runnable after we are finished with it. */ @@ -245,14 +230,6 @@ linux_clone_proc(struct thread *td, stru td->td_retval[0] = p2->p_pid; - if (args->flags & LINUX_CLONE_VFORK) { - /* wait for the children to exit, ie. emulate vfork */ - PROC_LOCK(p2); - while (p2->p_flag & P_PPWAIT) - cv_wait(&p2->p_pwait, &p2->p_mtx); - PROC_UNLOCK(p2); - } - return (0); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601091828.u09ISFmg078684>