diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2014-02-26 16:51:28 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2014-02-27 00:28:39 +0000 |
commit | 38593e942ad4b16b2c3c43ea521167368771cbfb (patch) | |
tree | 1d495359a95b84a1ffebddd5c4ad19a5fcd1f121 /desc.c | |
parent | d354130b3ac060051b55cda46c45ab5f5574548d (diff) | |
download | strace-38593e942ad4b16b2c3c43ea521167368771cbfb.tar.gz strace-38593e942ad4b16b2c3c43ea521167368771cbfb.tar.bz2 strace-38593e942ad4b16b2c3c43ea521167368771cbfb.tar.xz |
Rewrite signal mask decoding without sigset_t
The sigset_t provided by libc is not quite convenient.
In glibc, sigset_t is an array with space for 1024 bits, which is much
more than required: all architectures supported by Linux have only 64
signals except MIPS, which has 128.
In bionic libc, LP32 sigset_t is only 4 bytes long, which is less than
necessary.
With this change, signal mask is decoded without use of intermediate
sigset_t structure, which saves us some cpu cycles in case of glibc with
its inflated sigset_t, and enables build with libcs where sigset_t is
broken.
Old implementation used to check each signal number in the given signal
mask twice using sigismember().
New implementation is based on popcount and next_set_bit() so it's
noticeably faster.
* configure.ac: Check for __builtin_popcount.
* signal.c: Ensure that NSIG >= 32.
(sprintsigmask, sprintsigmask_long, printsigmask): Remove.
(popcount32, sprintsigmask_n): New functions.
(tprintsigmask_addr, sprintsigmask_val, tprintsigmask_val): New macros.
(print_sigset_addr_len, sys_sigsetmask, sys_sigreturn, sys_siggetmask,
sys_sigsuspend, sys_sigprocmask, decode_new_sigaction): Update to use
new signal mask decoding interface.
* tests/sigaction.c (main): Add a test with almost filled signal mask.
* tests/sigaction.awk: Update.
Diffstat (limited to 'desc.c')
0 files changed, 0 insertions, 0 deletions