diff options
author | Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> | 2023-01-12 10:58:51 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-02-01 08:42:11 -0300 |
commit | 2053c11331991818882f7cf023ed2ce4ff44b274 (patch) | |
tree | b1edaafb8036456c39bff1756ed8827922c0b3b5 /sysdeps/unix/sysv/linux/clone3.h | |
parent | 2290cf73cce1292d9345a8183fd29ae3994a9481 (diff) | |
download | glibc-2053c11331991818882f7cf023ed2ce4ff44b274.tar glibc-2053c11331991818882f7cf023ed2ce4ff44b274.tar.gz glibc-2053c11331991818882f7cf023ed2ce4ff44b274.tar.bz2 glibc-2053c11331991818882f7cf023ed2ce4ff44b274.zip |
linux: Add clone3 CLONE_CLEAR_SIGHAND optimization to posix_spawn
The clone3 flag resets all signal handlers of the child not set to
SIG_IGN to SIG_DFL. It allows to skip most of the sigaction calls
to setup child signal handling, where previously a posix_spawn
had to issue 2 times NSIG sigaction calls (one to obtain the current
disposition and another to set either SIG_DFL or SIG_IGN).
With POSIX_SPAWN_SETSIGDEF the child will setup the signal for the case
where the disposition is SIG_IGN.
The code must handle the fallback where clone3 is not available. This is
done by splitting __clone_internal_fallback from __clone_internal.
Checked on x86_64-linux-gnu.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'sysdeps/unix/sysv/linux/clone3.h')
-rw-r--r-- | sysdeps/unix/sysv/linux/clone3.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/clone3.h b/sysdeps/unix/sysv/linux/clone3.h index e4d642e521..451b156405 100644 --- a/sysdeps/unix/sysv/linux/clone3.h +++ b/sysdeps/unix/sysv/linux/clone3.h @@ -23,6 +23,13 @@ #include <stddef.h> #include <bits/types.h> + +/* Flags for the clone3 syscall. */ +#define CLONE_CLEAR_SIGHAND 0x100000000ULL /* Clear any signal handler and + reset to SIG_DFL. */ +#define CLONE_INTO_CGROUP 0x200000000ULL /* Clone into a specific cgroup given + the right permissions. */ + /* The unsigned 64-bit and 8-byte aligned integer type. */ typedef __U64_TYPE __aligned_uint64_t __attribute__ ((__aligned__ (8))); |