summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r--sys/kern/kern_fork.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index fbe7dcf19d4..dd4de7f0c9b 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.146 2013/04/06 03:44:34 tedu Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.147 2013/06/01 16:04:46 tedu Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -325,6 +325,14 @@ fork1(struct proc *curp, int exitsig, int flags, void *stack, pid_t *tidptr,
p->p_p = pr = curpr;
TAILQ_INSERT_TAIL(&pr->ps_threads, p, p_thr_link);
pr->ps_refcnt++;
+ /*
+ * if somebody else wants to take us to single threaded mode,
+ * count ourselves in.
+ */
+ if (pr->ps_single) {
+ curpr->ps_singlecount++;
+ atomic_setbits_int(&p->p_flag, P_SUSPSINGLE);
+ }
} else {
process_new(p, curpr);
pr = p->p_p;