diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 52f68f07d7ec..917de57ca742 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -208,7 +208,6 @@ fork1(td, flags, pages, procp) * certain parts of a process from itself. */ if ((flags & RFPROC) == 0) { -#if 0 /* XXX no other OS tries to do this */ if (((p1->p_flag & (P_HADTHREADS|P_SYSTEM)) == P_HADTHREADS) && (flags & (RFCFDG | RFFDG))) { PROC_LOCK(p1); @@ -218,7 +217,6 @@ fork1(td, flags, pages, procp) } PROC_UNLOCK(p1); } -#endif vm_forkproc(td, NULL, NULL, flags); @@ -238,49 +236,21 @@ fork1(td, flags, pages, procp) if (flags & RFFDG) fdunshare(p1, td); -#if 0 /* XXX no other OS tries to do this */ if (((p1->p_flag & (P_HADTHREADS|P_SYSTEM)) == P_HADTHREADS) && (flags & (RFCFDG | RFFDG))) { PROC_LOCK(p1); thread_single_end(); PROC_UNLOCK(p1); } -#endif *procp = NULL; return (0); } -#if 0 /* XXX no other OS tries to do this */ /* - * Note 1:1 allows for forking with one thread coming out on the - * other side with the expectation that the process is about to - * exec. + * XXX + * We did have single-threading code here + * however it proved un-needed and caused problems */ - if ((p1->p_flag & (P_HADTHREADS|P_SYSTEM)) == P_HADTHREADS) { - /* - * Systems processes don't need this. - * Idle the other threads for a second. - * Since the user space is copied, it must remain stable. - * In addition, all threads (from the user perspective) - * need to either be suspended or in the kernel, - * where they will try restart in the parent and will - * be aborted in the child. - * keep threadds at the boundary there. - */ - PROC_LOCK(p1); - if (thread_single(SINGLE_BOUNDARY)) { - /* Abort. Someone else is single threading before us. */ - PROC_UNLOCK(p1); - return (ERESTART); - } - PROC_UNLOCK(p1); - /* - * All other activity in this process - * is now suspended at the user boundary, - * (or other safe places if we think of any). - */ - } -#endif /* Allocate new proc. */ newproc = uma_zalloc(proc_zone, M_WAITOK); @@ -729,17 +699,6 @@ fork1(td, flags, pages, procp) msleep(p1, &p2->p_mtx, PWAIT, "ppwait", 0); PROC_UNLOCK(p2); -#if 0 /* XXX no other OS tries to do this */ - /* - * If other threads are waiting, let them continue now. - */ - if ((p1->p_flag & (P_HADTHREADS|P_SYSTEM)) == P_HADTHREADS) { - PROC_LOCK(p1); - thread_single_end(); - PROC_UNLOCK(p1); - } - -#endif /* * Return child proc pointer to parent. */ @@ -755,11 +714,6 @@ fork1(td, flags, pages, procp) mac_proc_destroy(newproc); #endif uma_zfree(proc_zone, newproc); - if (p1->p_flag & P_HADTHREADS) { - PROC_LOCK(p1); - thread_single_end(); - PROC_UNLOCK(p1); - } pause("fork", hz / 2); return (error); }