Linux: optimize clone3 internal usage
commit98f9435f336cbee5d57a1a16373331ca1bc648db
authorAdhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Thu, 12 Jan 2023 13:58:53 +0000 (12 10:58 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 1 Feb 2023 11:42:11 +0000 (1 08:42 -0300)
treef6e57c478194afb2323db3cba00db96e7582164b
parent1e442efd57f231bf76030d7a30f2095d1261db20
Linux: optimize clone3 internal usage

Add an optimization to avoid calling clone3 when glibc detects that
there is no kernel support.  It also adds __ASSUME_CLONE3, which allows
skipping this optimization and issuing the clone3 syscall directly.

It does not handle the the small window between 5.3 and 5.5 for
posix_spawn (CLONE_CLEAR_SIGHAND was added in 5.5).

Checked on x86_64-linux-gnu.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
include/clone_internal.h
sysdeps/unix/sysv/linux/clone-internal.c
sysdeps/unix/sysv/linux/kernel-features.h