summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/thread
diff options
context:
space:
mode:
authormini <mini@FreeBSD.org>2002-10-30 07:13:27 +0000
committermini <mini@FreeBSD.org>2002-10-30 07:13:27 +0000
commita963f9fb881b31316300f38e6a4723e9b8246a66 (patch)
treec3abfff2c7618c281b3dd4d6a01ced6d9b843585 /lib/libpthread/thread
parent496051977b6f082563b810ef3eff40cc59d76be4 (diff)
downloadFreeBSD-src-a963f9fb881b31316300f38e6a4723e9b8246a66.zip
FreeBSD-src-a963f9fb881b31316300f38e6a4723e9b8246a66.tar.gz
Make pthread_sigmask(3) operate on the thread signal mask, not the process
signal mask.
Diffstat (limited to 'lib/libpthread/thread')
-rw-r--r--lib/libpthread/thread/thr_sigmask.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/libpthread/thread/thr_sigmask.c b/lib/libpthread/thread/thr_sigmask.c
index 846062a..f98c421 100644
--- a/lib/libpthread/thread/thr_sigmask.c
+++ b/lib/libpthread/thread/thr_sigmask.c
@@ -44,6 +44,32 @@ __weak_reference(_pthread_sigmask, pthread_sigmask);
int
_pthread_sigmask(int how, const sigset_t *set, sigset_t *oset)
{
+ int i;
+ struct pthread *curthread = _get_curthread();
- return (sigprocmask(how, set, oset));
+ if (oset != NULL)
+ bcopy(&curthread->mailbox.tm_context.uc_sigmask, oset,
+ sizeof(sigset_t));
+ if (set == NULL)
+ return (0);
+ switch (how) {
+ case SIG_BLOCK:
+ for (i = 0; i < _SIG_WORDS; i++)
+ curthread->mailbox.tm_context.uc_sigmask.__bits[i] |=
+ set->__bits[i];
+ break;
+ case SIG_UNBLOCK:
+ for (i = 0; i < _SIG_WORDS; i++)
+ curthread->mailbox.tm_context.uc_sigmask.__bits[i] &=
+ ~set->__bits[i];
+ break;
+ case SIG_SETMASK:
+ bcopy(set, &curthread->mailbox.tm_context.uc_sigmask,
+ sizeof(sigset_t));
+ break;
+ default:
+ errno = EINVAL;
+ return (-1);
+ }
+ return (0);
}
OpenPOWER on IntegriCloud