diff options
author | Renato Botelho <renato@netgate.com> | 2015-10-21 16:04:13 -0200 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-10-21 16:04:13 -0200 |
commit | 6dfdfbb12b356dae762c3bce132809457ed60d97 (patch) | |
tree | 4e87edfd6f7353e79d923ab457270e9351daec3d /sys/compat/linux/linux_fork.c | |
parent | 13010d6b0da4d97e56243edbea0a585b8285cd3e (diff) | |
parent | d621159ed6a7d1c98cf81f17e313dffc64bf7c4f (diff) | |
download | FreeBSD-src-6dfdfbb12b356dae762c3bce132809457ed60d97.zip FreeBSD-src-6dfdfbb12b356dae762c3bce132809457ed60d97.tar.gz |
Merge branch 'stable/10' into devel
Diffstat (limited to 'sys/compat/linux/linux_fork.c')
-rw-r--r-- | sys/compat/linux/linux_fork.c | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/sys/compat/linux/linux_fork.c b/sys/compat/linux/linux_fork.c index 2103636..0ab7d3a 100644 --- a/sys/compat/linux/linux_fork.c +++ b/sys/compat/linux/linux_fork.c @@ -111,9 +111,8 @@ linux_vfork(struct thread *td, struct linux_vfork_args *args) 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); td->td_retval[0] = p2->p_pid; @@ -122,10 +121,6 @@ linux_vfork(struct thread *td, struct linux_vfork_args *args) if (error) return (error); - PROC_LOCK(p2); - p2->p_flag |= P_PPWAIT; - PROC_UNLOCK(p2); - td2 = FIRST_THREAD_IN_PROC(p2); /* @@ -136,12 +131,6 @@ linux_vfork(struct thread *td, struct linux_vfork_args *args) 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); } @@ -203,6 +192,9 @@ linux_clone(struct thread *td, struct linux_clone_args *args) 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); @@ -271,12 +263,6 @@ linux_clone(struct thread *td, struct linux_clone_args *args) "stack %p sig = %d"), (int)p2->p_pid, args->stack, 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. */ @@ -288,13 +274,5 @@ linux_clone(struct thread *td, struct linux_clone_args *args) td->td_retval[0] = p2->p_pid; td->td_retval[1] = 0; - 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); } |