diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2006-03-27 19:08:59 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2006-03-27 19:08:59 +0000 |
commit | a03ddf31d2955f416026e0d13f0b2b1d2a3d4871 (patch) | |
tree | 580cb81f0e2a6c8ba2844dd60ef581b59dc68dbf /sys/kern/kern_fork.c | |
parent | 6dfa999be4be2d009da392852bc3216aecf4bc0c (diff) |
do not rush putting embrionic process on child/thread/sibling lists and set timeouts earlier as we can sleep later and get signals and exit and cause all kinds of hell; pedro@ ok
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r-- | sys/kern/kern_fork.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index a1c18286d57..6ee931d9e05 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.82 2006/02/20 19:39:11 miod Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.83 2006/03/27 19:08:58 mickey Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -278,18 +278,15 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize, p2->p_flag |= P_CONTROLT; if (flags & FORK_PPWAIT) p2->p_flag |= P_PPWAIT; - LIST_INSERT_AFTER(p1, p2, p_pglist); p2->p_pptr = p1; if (flags & FORK_NOZOMBIE) p2->p_flag |= P_NOZOMBIE; - LIST_INSERT_HEAD(&p1->p_children, p2, p_sibling); LIST_INIT(&p2->p_children); #ifdef RTHREADS if (flags & FORK_THREAD) { p2->p_flag |= P_THREAD; p2->p_thrparent = p1->p_thrparent; - LIST_INSERT_HEAD(&p1->p_thrparent->p_thrchildren, p2, p_thrsib); } else { p2->p_thrparent = p2; } @@ -346,6 +343,9 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize, uvm_fork(p1, p2, ((flags & FORK_SHAREVM) ? TRUE : FALSE), stack, stacksize, func ? func : child_return, arg ? arg : p2); + timeout_set(&p2->p_stats->p_virt_to, virttimer_trampoline, p2); + timeout_set(&p2->p_stats->p_prof_to, proftimer_trampoline, p2); + vm = p2->p_vmspace; if (flags & FORK_FORK) { @@ -387,15 +387,16 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize, LIST_INSERT_HEAD(&allproc, p2, p_list); LIST_INSERT_HEAD(PIDHASH(p2->p_pid), p2, p_hash); + LIST_INSERT_HEAD(&p1->p_children, p2, p_sibling); + LIST_INSERT_AFTER(p1, p2, p_pglist); + if (flags & FORK_THREAD) + LIST_INSERT_HEAD(&p1->p_thrparent->p_thrchildren, p2, p_thrsib); #if NSYSTRACE > 0 if (ISSET(p1->p_flag, P_SYSTRACE)) systrace_fork(p1, p2); #endif - timeout_set(&p2->p_stats->p_virt_to, virttimer_trampoline, p2); - timeout_set(&p2->p_stats->p_prof_to, proftimer_trampoline, p2); - /* * Make child runnable, set start time, and add to run queue. */ |