summaryrefslogtreecommitdiff
path: root/sys/kern/kern_sig.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2023-08-16 07:55:53 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2023-08-16 07:55:53 +0000
commitf67eeabd00d333c34f7442e21b1a6d8c82711d65 (patch)
tree6c056c1bed182f30224a23993b27ba3b8c080d23 /sys/kern/kern_sig.c
parente369555b24c8421b46ebe65fda6633cc229dae11 (diff)
Move SCHED_LOCK after sleep_signal_check.
sleep_signal_check() is there to look for pending signals / single thread requests which were posted before sleep_setup() finished. Once p_stat is set to SSLEEP the wakeup and delivery of signals is taken care of by ptsignal and single_thread_set(). Moving the SCHED_LOCK further down allows to cleanup cursig() and to remove a SCHED_LOCK recursion in single_thread_check(). OK mpi@
Diffstat (limited to 'sys/kern/kern_sig.c')
-rw-r--r--sys/kern/kern_sig.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index eaa726642a0..af0e0d7f4eb 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.312 2023/08/13 15:53:31 claudio Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.313 2023/08/16 07:55:52 claudio Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -1251,7 +1251,6 @@ cursig(struct proc *p, struct sigctx *sctx)
{
struct process *pr = p->p_p;
int signum, mask, prop;
- int dolock = (p->p_flag & P_SINTR) == 0;
sigset_t ps_siglist;
int s;
@@ -1294,11 +1293,9 @@ cursig(struct proc *p, struct sigctx *sctx)
single_thread_set(p, SINGLE_SUSPEND, 0);
pr->ps_xsig = signum;
- if (dolock)
- SCHED_LOCK(s);
+ SCHED_LOCK(s);
proc_stop(p, 1);
- if (dolock)
- SCHED_UNLOCK(s);
+ SCHED_UNLOCK(s);
/*
* re-take the signal before releasing
@@ -1371,11 +1368,9 @@ cursig(struct proc *p, struct sigctx *sctx)
prop & SA_TTYSTOP))
break; /* == ignore */
pr->ps_xsig = signum;
- if (dolock)
- SCHED_LOCK(s);
+ SCHED_LOCK(s);
proc_stop(p, 1);
- if (dolock)
- SCHED_UNLOCK(s);
+ SCHED_UNLOCK(s);
break;
} else if (prop & SA_IGNORE) {
/*