diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2019-05-08 15:13:18 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2019-07-31 16:06:51 -0300 |
commit | 6e16e91ee4afacc0ea0b6494f784cf1ded0c7055 (patch) | |
tree | 1b66f56c6f48c2b3fc4d7a10672cfd14388f15cb /sysdeps/i386/dl-procinfo.h | |
parent | 75e785f6736024690f7671ea2831ce6682175a5e (diff) | |
download | glibc-6e16e91ee4afacc0ea0b6494f784cf1ded0c7055.tar.gz |
linux: Optimize posix_spawn spurious sigaction calls
The child helper process on Linux posix_spawn child must ensure that no signal
handler are enabled, so the signal disposition must be either SIG_DFL or
SIG_IGN. However, it requires a sigprocmask to obtain the current signal mask
and at least _NSIG sigaction calls to reset the signal handlers for each
posix_spawn call.
This patch optimizes it by tracking on sigaction implementation when a signal
action is set different than SIG_DFL or SIG_IGN. It allows remove a
sigprocmask call and isse sigaction to reset the disposition only the signals
that has non-default actions set.
It might incur in false positive, since it not easy to remove bits from the
mask without race conditions, but it does not allow false negative since the
mask is updated atomically prior the syscall. The false positive incur in
just extra sigactions on posix_spawn.
Checked on x86_64 and i686.
* include/atomic.h (atomic_fetch_or_seq_cst, atomic_fetch_or_seq_cst):
New macros.
* posix/Makefile (tests): Add tst-spawn6.
* posix/tst-spawn6.c: New file.
* sysdeps/generic/sigsetops.h (__sigorset_atomic): New macro.
* sysdeps/unix/sysv/linux/internal-signals.h (__get_sighandler_set):
New prototype.
* sysdeps/unix/sysv/linux/sigaction.c (__get_sighandler_set): New
function.
(__libc_sigaction): Set the internal handler_set for a new action.
* sysdeps/unix/sysv/linux/sigsetops.h (__sigorset_atomic,
__sigaddset_atomic): New macros.
* sysdeps/unix/sysv/linux/spawni.c (spawni_child): Replace
__sigprocmask with __get_sighandler_set.
Diffstat (limited to 'sysdeps/i386/dl-procinfo.h')
0 files changed, 0 insertions, 0 deletions