summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/uthread/uthread_sigmask.c
diff options
context:
space:
mode:
authorfgsch <fgsch@openbsd.org>2002-02-21 20:57:41 +0000
committerfgsch <fgsch@openbsd.org>2002-02-21 20:57:41 +0000
commitfc921cf4f688d20d70fee0c576d41d7d3d453d75 (patch)
tree14d9e3c2d743ec2a2e3732e147285fdd9774c6ad /lib/libpthread/uthread/uthread_sigmask.c
parentcorrect .Xr's. (diff)
downloadwireguard-openbsd-fc921cf4f688d20d70fee0c576d41d7d3d453d75.tar.xz
wireguard-openbsd-fc921cf4f688d20d70fee0c576d41d7d3d453d75.zip
account for the process signal mask when dealing with signals; tested
a while ago by marc@ and brad@
Diffstat (limited to 'lib/libpthread/uthread/uthread_sigmask.c')
-rw-r--r--lib/libpthread/uthread/uthread_sigmask.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/libpthread/uthread/uthread_sigmask.c b/lib/libpthread/uthread/uthread_sigmask.c
index 03fb4963395..12dd6ec3c69 100644
--- a/lib/libpthread/uthread/uthread_sigmask.c
+++ b/lib/libpthread/uthread/uthread_sigmask.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_sigmask.c,v 1.4 2001/08/21 19:24:53 fgsch Exp $ */
+/* $OpenBSD: uthread_sigmask.c,v 1.5 2002/02/21 20:57:41 fgsch Exp $ */
/*
* Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
* All rights reserved.
@@ -42,6 +42,7 @@ int
pthread_sigmask(int how, const sigset_t *set, sigset_t *oset)
{
struct pthread *curthread = _get_curthread();
+ sigset_t sigset;
int ret = 0;
/* Check if the existing signal process mask is to be returned: */
@@ -79,11 +80,22 @@ pthread_sigmask(int how, const sigset_t *set, sigset_t *oset)
break;
}
+ /* Increment the sequence number: */
+ curthread->sigmask_seqno++;
+
/*
- * Dispatch signals to the running thread that are pending
- * and now unblocked:
+ * Check if there are pending signals for the running
+ * thread or process that aren't blocked:
*/
- _dispatch_signals();
+ sigset = curthread->sigpend;
+ sigset |= _process_sigpending;
+ sigset &= ~curthread->sigmask;
+ if (sigset != 0)
+ /*
+ * Call the kernel scheduler which will safely
+ * install a signal frame for the running thread:
+ */
+ _thread_kern_sched_sig();
}
/* Return the completion status: */