1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Make pthread_sigmask(3) operate on the thread signal mask, not the process

signal mask.
This commit is contained in:
Jonathan Mini 2002-10-30 07:13:27 +00:00
parent 0cda444bef
commit 40e044cbd3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=106193
2 changed files with 54 additions and 2 deletions

View File

@ -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);
}

View File

@ -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);
}