summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2011-11-05 23:02:38 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2011-11-05 23:02:38 +0000
commitc81cd76e1c8f5439389618307bdb0b67927d844c (patch)
tree5dba74410a391d6ac4e8f9a8e7126d9a61eb29fe /sys/kern
parent01a8c2d9105a6ee8f6b5d6a23c10ae496bc75681 (diff)
I had moved earlier the adding of processes to the pgrp and children lists
during the big rework at c2k10, but it's too early as signals can be posted before the process is fully built. Move those list adds back down to the late stage they were before. Problem seen on sebastia@'s sparc. ok deraadt@ miod@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_fork.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 39c2249638b..e8bd9e85326 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.129 2011/10/15 23:35:29 guenther Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.130 2011/11/05 23:02:37 guenther Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -200,9 +200,7 @@ process_new(struct proc *newproc, struct proc *parentproc)
TAILQ_INIT(&pr->ps_threads);
TAILQ_INSERT_TAIL(&pr->ps_threads, newproc, p_thr_link);
- LIST_INSERT_AFTER(parent, pr, ps_pglist);
pr->ps_pptr = parent;
- LIST_INSERT_HEAD(&parent->ps_children, pr, ps_sibling);
LIST_INIT(&pr->ps_children);
pr->ps_refcnt = 1;
@@ -442,6 +440,10 @@ fork1(struct proc *p1, int exitsig, int flags, void *stack, pid_t *tidptr,
LIST_INSERT_HEAD(&allproc, p2, p_list);
LIST_INSERT_HEAD(PIDHASH(p2->p_pid), p2, p_hash);
+ if ((flags & FORK_THREAD) == 0) {
+ LIST_INSERT_AFTER(p1->p_p, p2->p_p, ps_pglist);
+ LIST_INSERT_HEAD(&p1->p_p->ps_children, p2->p_p, ps_sibling);
+ }
if (p2->p_flag & P_TRACED) {
p2->p_oppid = p1->p_pid;