diff options
author | mini <mini@FreeBSD.org> | 2002-10-30 07:13:27 +0000 |
---|---|---|
committer | mini <mini@FreeBSD.org> | 2002-10-30 07:13:27 +0000 |
commit | a963f9fb881b31316300f38e6a4723e9b8246a66 (patch) | |
tree | c3abfff2c7618c281b3dd4d6a01ced6d9b843585 /lib/libkse/thread | |
parent | 496051977b6f082563b810ef3eff40cc59d76be4 (diff) | |
download | FreeBSD-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/libkse/thread')
-rw-r--r-- | lib/libkse/thread/thr_sigmask.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/libkse/thread/thr_sigmask.c b/lib/libkse/thread/thr_sigmask.c index 846062a..f98c421 100644 --- a/lib/libkse/thread/thr_sigmask.c +++ b/lib/libkse/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); } |