summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2005-12-22 06:58:20 +0000
committertedu <tedu@openbsd.org>2005-12-22 06:58:20 +0000
commitdbd5ca442c3b321de5246186c78e16bf7d2d9183 (patch)
tree97116dbabb6e8f4cd9ec2ad236689b8fe39972ac
parentfix memory leak conditions in thrsleep and significantly simplify (diff)
downloadwireguard-openbsd-dbd5ca442c3b321de5246186c78e16bf7d2d9183.tar.xz
wireguard-openbsd-dbd5ca442c3b321de5246186c78e16bf7d2d9183.zip
1. when signalling a process group, don't deliver a copy to every thread
2. when delivering a STOP or CONT signal to a process, now replicate to every thread. makes ^Z and fg work nicer, first noticed by peter hessler. signals and threads are not right, but this is at least a little less wrong.
-rw-r--r--sys/kern/kern_sig.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 9656982fe7c..5a2a913667b 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.78 2005/12/03 18:09:08 tedu Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.79 2005/12/22 06:58:20 tedu Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -705,7 +705,8 @@ pgsignal(struct pgrp *pgrp, int signum, int checkctty)
if (pgrp)
LIST_FOREACH(p, &pgrp->pg_members, p_pglist)
- if (checkctty == 0 || p->p_flag & P_CONTROLT)
+ if ((checkctty == 0 || p->p_flag & P_CONTROLT) &&
+ (p->p_flag & P_THREAD) == 0)
psignal(p, signum);
}
@@ -831,10 +832,15 @@ psignal(struct proc *p, int signum)
}
}
- if (prop & SA_CONT)
+ if (prop & SA_CONT) {
+ LIST_FOREACH(q, &p->p_thrchildren, p_thrsib)
+ psignal(q, signum);
p->p_siglist &= ~stopsigmask;
+ }
if (prop & SA_STOP) {
+ LIST_FOREACH(q, &p->p_thrchildren, p_thrsib)
+ psignal(q, signum);
p->p_siglist &= ~contsigmask;
p->p_flag &= ~P_CONTINUED;
}