1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

linux: Fix __NSIG_WORDS and add __NSIG_BYTES

The __NSIG_WORDS value is based on minimum number of words to hold
the maximum number of signals supported by the architecture.

This patch also adds __NSIG_BYTES, which is the number of bytes
required to represent the supported number of signals.  It is used in
syscalls which takes a sigset_t.

Checked on x86_64-linux-gnu and i686-linux-gnu.

Tested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
Adhemerval Zanella
2020-04-23 10:58:01 -03:00
parent f13d260190
commit f26d456b98
15 changed files with 42 additions and 27 deletions

View File

@ -68,7 +68,7 @@ static inline void
__libc_signal_block_all (sigset_t *set)
{
INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &sigall_set, set,
_NSIG / 8);
__NSIG_BYTES);
}
/* Block all application signals (excluding internal glibc ones). */
@ -78,7 +78,7 @@ __libc_signal_block_app (sigset_t *set)
sigset_t allset = sigall_set;
__clear_internal_signals (&allset);
INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &allset, set,
_NSIG / 8);
__NSIG_BYTES);
}
/* Block only SIGTIMER and return the previous set on SET. */
@ -86,7 +86,7 @@ static inline void
__libc_signal_block_sigtimer (sigset_t *set)
{
INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &sigtimer_set, set,
_NSIG / 8);
__NSIG_BYTES);
}
/* Unblock only SIGTIMER and return the previous set on SET. */
@ -94,7 +94,7 @@ static inline void
__libc_signal_unblock_sigtimer (sigset_t *set)
{
INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_UNBLOCK, &sigtimer_set, set,
_NSIG / 8);
__NSIG_BYTES);
}
/* Restore current process signal mask. */
@ -102,7 +102,7 @@ static inline void
__libc_signal_restore_set (const sigset_t *set)
{
INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_SETMASK, set, NULL,
_NSIG / 8);
__NSIG_BYTES);
}
/* Used to communicate with signal handler. */