1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

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>
This commit is contained in:
Adhemerval Zanella Netto
2023-01-12 10:58:53 -03:00
committed by Adhemerval Zanella
parent 1e442efd57
commit 98f9435f33
3 changed files with 37 additions and 1 deletions

View File

@@ -241,4 +241,13 @@
# define __ASSUME_FUTEX_LOCK_PI2 0
#endif
/* The clone3 system call was introduced across on most architectures in
Linux 5.3. Not all ports implements it, so it should be used along
HAVE_CLONE3_WRAPPER define. */
#if __LINUX_KERNEL_VERSION >= 0x050300
# define __ASSUME_CLONE3 1
#else
# define __ASSUME_CLONE3 0
#endif
#endif /* kernel-features.h */