summaryrefslogtreecommitdiff
path: root/posix/wordexp-test.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-05-08 15:13:18 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-07-31 16:06:51 -0300
commit6e16e91ee4afacc0ea0b6494f784cf1ded0c7055 (patch)
tree1b66f56c6f48c2b3fc4d7a10672cfd14388f15cb /posix/wordexp-test.c
parent75e785f6736024690f7671ea2831ce6682175a5e (diff)
downloadglibc-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 'posix/wordexp-test.c')
0 files changed, 0 insertions, 0 deletions