Bug report
Bug description:
This is an edge case but occurred in python-build-standalone, astral-sh/python-build-standalone#1163.
On systems using glibc that predates the addition of SYS_getrandom, os.pidfd_open() and os.pidfd_getfd() will not be built even when the required __NR_pidfd_* syscall macros are available. These macros were added to the kernel UAPI much later than getrandom but it is possible to build with modern kernel UAPI headers while using an older glibc. For example, this approach is taken in python-build-standalone to allow newer kernel syscalls to be used while maintaining compatibility with older glibc versions.
The fix is straightforward, guard the include with HAVE_SYS_SYSCALL_H rather than HAVE_GETRANDOM_SYSCALL.
CPython versions tested on:
3.15
Operating systems tested on:
Linux
Linked PRs
Bug report
Bug description:
This is an edge case but occurred in python-build-standalone, astral-sh/python-build-standalone#1163.
On systems using glibc that predates the addition of
SYS_getrandom,os.pidfd_open()andos.pidfd_getfd()will not be built even when the required__NR_pidfd_*syscall macros are available. These macros were added to the kernel UAPI much later thangetrandombut it is possible to build with modern kernel UAPI headers while using an older glibc. For example, this approach is taken in python-build-standalone to allow newer kernel syscalls to be used while maintaining compatibility with older glibc versions.The fix is straightforward, guard the include with
HAVE_SYS_SYSCALL_Hrather thanHAVE_GETRANDOM_SYSCALL.CPython versions tested on:
3.15
Operating systems tested on:
Linux
Linked PRs