Index: sys/lwp.h =================================================================== RCS file: /cvsroot/src/sys/sys/lwp.h,v retrieving revision 1.163 diff -u -u -r1.163 lwp.h --- sys/lwp.h 22 Jul 2012 22:40:18 -0000 1.163 +++ sys/lwp.h 28 Aug 2012 13:52:47 -0000 @@ -1,4 +1,4 @@ -/* $NetBSD: lwp.h,v 1.163 2012/07/22 22:40:18 rmind Exp $ */ +/* $NetBSD: lwp.h,v 1.162 2012/06/09 02:31:15 christos Exp $ */ /*- * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010 @@ -53,9 +53,9 @@ #include /* Machine-dependent proc substruct. */ /* - * Lightweight process. Field markings and the corresponding locks: + * Lightweight process. Field markings and the corresponding locks: * - * a: proc_lock + * a: proclist_lock * c: condition variable interlock, passed to cv_wait() * l: *l_mutex * p: l_proc->p_lock @@ -124,7 +124,6 @@ u_int l_slptime; /* l: time since last blocked */ callout_t l_timeout_ch; /* !: callout for tsleep */ u_int l_emap_gen; /* !: emap generation number */ - kcondvar_t l_waitcv; /* a: vfork() wait */ #if PCU_UNIT_COUNT > 0 struct cpu_info * volatile l_pcu_cpu[PCU_UNIT_COUNT]; @@ -246,7 +245,6 @@ #define LP_INTR 0x00000040 /* Soft interrupt handler */ #define LP_SYSCTLWRITE 0x00000080 /* sysctl write lock held */ #define LP_MUSTJOIN 0x00000100 /* Must join kthread on exit */ -#define LP_VFORKWAIT 0x00000200 /* Waiting at vfork() for a child */ #define LP_TIMEINTR 0x00010000 /* Time this soft interrupt */ #define LP_RUNNING 0x20000000 /* Active on a CPU */ #define LP_BOUND 0x80000000 /* Bound to a CPU */ Index: sys/param.h =================================================================== RCS file: /cvsroot/src/sys/sys/param.h,v retrieving revision 1.418 diff -u -u -r1.418 param.h --- sys/param.h 22 Jul 2012 22:44:28 -0000 1.418 +++ sys/param.h 28 Aug 2012 13:52:47 -0000 @@ -63,7 +63,7 @@ * 2.99.9 (299000900) */ -#define __NetBSD_Version__ 699001000 /* NetBSD 6.99.10 */ +#define __NetBSD_Version__ 699001100 /* NetBSD 6.99.11 */ #define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \ (m) * 1000000) + (p) * 100) <= __NetBSD_Version__) Index: sys/proc.h =================================================================== RCS file: /cvsroot/src/sys/sys/proc.h,v retrieving revision 1.317 diff -u -u -r1.317 proc.h --- sys/proc.h 22 Jul 2012 22:40:18 -0000 1.317 +++ sys/proc.h 28 Aug 2012 13:52:47 -0000 @@ -1,4 +1,4 @@ -/* $NetBSD: proc.h,v 1.317 2012/07/22 22:40:18 rmind Exp $ */ +/* $NetBSD: proc.h,v 1.316 2012/02/19 21:06:58 rmind Exp $ */ /*- * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -212,7 +212,7 @@ krwlock_t p_reflock; /* p: lock for debugger, procfs */ kcondvar_t p_waitcv; /* p: wait, stop CV on children */ kcondvar_t p_lwpcv; /* p: wait, stop CV on LWPs */ - + /* Substructures: */ struct kauth_cred *p_cred; /* p: Master copy of credentials */ struct filedesc *p_fd; /* :: Ptr to open files structure */ @@ -256,7 +256,6 @@ u_int p_nstopchild; /* l: Count of stopped/dead children */ u_int p_waited; /* l: parent has waited on child */ struct lwp *p_zomblwp; /* p: detached LWP to be reaped */ - struct lwp *p_vforklwp; /* p: parent LWP waiting at vfork() */ /* scheduling */ void *p_sched_info; /* p: Scheduler-specific structure */ Index: kern/kern_exec.c =================================================================== RCS file: /cvsroot/src/sys/kern/kern_exec.c,v retrieving revision 1.354 diff -u -u -r1.354 kern_exec.c --- kern/kern_exec.c 27 Jul 2012 20:52:49 -0000 1.354 +++ kern/kern_exec.c 28 Aug 2012 13:52:48 -0000 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_exec.c,v 1.354 2012/07/27 20:52:49 christos Exp $ */ +/* $NetBSD: kern_exec.c,v 1.353 2012/07/22 22:40:19 rmind Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -1180,26 +1180,11 @@ * exited and exec()/exit() are the only places it will be cleared. */ if ((p->p_lflag & PL_PPWAIT) != 0) { -#if 0 - lwp_t *lp; - - mutex_enter(proc_lock); - lp = p->p_vforklwp; - p->p_vforklwp = NULL; - - l->l_lwpctl = NULL; /* was on loan from blocked parent */ - p->p_lflag &= ~PL_PPWAIT; - - lp->l_pflag &= ~LP_VFORKWAIT; /* XXX */ - cv_broadcast(&lp->l_waitcv); - mutex_exit(proc_lock); -#else mutex_enter(proc_lock); l->l_lwpctl = NULL; /* was on loan from blocked parent */ p->p_lflag &= ~PL_PPWAIT; cv_broadcast(&p->p_pptr->p_waitcv); mutex_exit(proc_lock); -#endif } /* Index: kern/kern_exit.c =================================================================== RCS file: /cvsroot/src/sys/kern/kern_exit.c,v retrieving revision 1.241 diff -u -u -r1.241 kern_exit.c --- kern/kern_exit.c 5 Aug 2012 14:53:25 -0000 1.241 +++ kern/kern_exit.c 28 Aug 2012 13:52:50 -0000 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_exit.c,v 1.241 2012/08/05 14:53:25 riastradh Exp $ */ +/* $NetBSD: kern_exit.c,v 1.239 2012/07/22 22:40:19 rmind Exp $ */ /*- * Copyright (c) 1998, 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -330,21 +330,9 @@ */ mutex_enter(proc_lock); if (p->p_lflag & PL_PPWAIT) { -#if 0 - lwp_t *lp; - - l->l_lwpctl = NULL; /* was on loan from blocked parent */ - p->p_lflag &= ~PL_PPWAIT; - - lp = p->p_vforklwp; - p->p_vforklwp = NULL; - lp->l_pflag &= ~LP_VFORKWAIT; /* XXX */ - cv_broadcast(&lp->l_waitcv); -#else l->l_lwpctl = NULL; /* was on loan from blocked parent */ p->p_lflag &= ~PL_PPWAIT; cv_broadcast(&p->p_pptr->p_waitcv); -#endif } if (SESS_LEADER(p)) { Index: kern/kern_fork.c =================================================================== RCS file: /cvsroot/src/sys/kern/kern_fork.c,v retrieving revision 1.191 diff -u -u -r1.191 kern_fork.c --- kern/kern_fork.c 27 Jul 2012 20:52:49 -0000 1.191 +++ kern/kern_fork.c 28 Aug 2012 13:52:51 -0000 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_fork.c,v 1.191 2012/07/27 20:52:49 christos Exp $ */ +/* $NetBSD: kern_fork.c,v 1.190 2012/07/22 22:40:19 rmind Exp $ */ /*- * Copyright (c) 1999, 2001, 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -373,14 +373,7 @@ p2->p_limit = lim_copy(p1_lim); } - if (flags & FORK_PPWAIT) { - /* Mark ourselves as waiting for a child. */ - l1->l_pflag |= LP_VFORKWAIT; - p2->p_lflag = PL_PPWAIT; - p2->p_vforklwp = l1; - } else { - p2->p_lflag = 0; - } + p2->p_lflag = ((flags & FORK_PPWAIT) ? PL_PPWAIT : 0); p2->p_sflag = 0; p2->p_slflag = 0; parent = (flags & FORK_NOWAIT) ? initproc : p1; @@ -572,29 +565,14 @@ sched_enqueue(l2, false); lwp_unlock(l2); } - - /* - * Return child pid to parent process, - * marking us as parent via retval[1]. - */ - if (retval != NULL) { - retval[0] = p2->p_pid; - retval[1] = 0; - } mutex_exit(p2->p_lock); /* * Preserve synchronization semantics of vfork. If waiting for * child to exec or exit, sleep until it clears LP_VFORKWAIT. */ -#if 0 - while (l1->l_pflag & LP_VFORKWAIT) { - cv_wait(&l1->l_waitcv, proc_lock); - } -#else while (p2->p_lflag & PL_PPWAIT) cv_wait(&p1->p_waitcv, proc_lock); -#endif /* * Let the parent know that we are tracing its child. @@ -607,7 +585,17 @@ ksi.ksi_lid = l1->l_lid; kpsignal(p1, &ksi, NULL); } + mutex_exit(proc_lock); + /* + * Return child pid to parent process, + * marking us as parent via retval[1]. + */ + if (retval != NULL) { + retval[0] = p2->p_pid; + retval[1] = 0; + } + return 0; } Index: kern/kern_lwp.c =================================================================== RCS file: /cvsroot/src/sys/kern/kern_lwp.c,v retrieving revision 1.171 diff -u -u -r1.171 kern_lwp.c --- kern/kern_lwp.c 22 Jul 2012 22:40:19 -0000 1.171 +++ kern/kern_lwp.c 28 Aug 2012 13:52:52 -0000 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_lwp.c,v 1.171 2012/07/22 22:40:19 rmind Exp $ */ +/* $NetBSD: kern_lwp.c,v 1.170 2012/06/09 02:55:32 christos Exp $ */ /*- * Copyright (c) 2001, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -211,7 +211,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.171 2012/07/22 22:40:19 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.170 2012/06/09 02:55:32 christos Exp $"); #include "opt_ddb.h" #include "opt_lockdebug.h" @@ -356,7 +356,6 @@ callout_init(&l->l_timeout_ch, CALLOUT_MPSAFE); callout_setfunc(&l->l_timeout_ch, sleepq_timeout, l); cv_init(&l->l_sigcv, "sigwait"); - cv_init(&l->l_waitcv, "vfork"); kauth_cred_hold(proc0.p_cred); l->l_cred = proc0.p_cred; @@ -825,7 +824,6 @@ callout_init(&l2->l_timeout_ch, CALLOUT_MPSAFE); callout_setfunc(&l2->l_timeout_ch, sleepq_timeout, l2); cv_init(&l2->l_sigcv, "sigwait"); - cv_init(&l2->l_waitcv, "vfork"); l2->l_syncobj = &sched_syncobj; if (rnewlwpp != NULL) @@ -1164,7 +1162,6 @@ sigclear(&l->l_sigpend, NULL, &kq); ksiginfo_queue_drain(&kq); cv_destroy(&l->l_sigcv); - cv_destroy(&l->l_waitcv); /* * Free lwpctl structure and affinity.