summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2006-04-30 15:37:08 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2006-04-30 15:37:08 +0000
commite2159d006e479a7fc790dceeec762cf715a3de2d (patch)
tree9cc80e8f10038e56b0c26c0961ef4fc516693720 /sys/kern
parenta4cb7d48e5f539c9c6c8918d25916b5fac8dcd8a (diff)
Backout last commit, it makes us crash when a ptraced program forks.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_fork.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 6ee931d9e05..a68f5b09815 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.83 2006/03/27 19:08:58 mickey Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.84 2006/04/30 15:37:07 kettenis Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -278,15 +278,18 @@ 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;
}
@@ -343,9 +346,6 @@ 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,16 +387,15 @@ 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.
*/