1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

ext/pcntl: following up #15921 rework SYS_pidfd_open configure detection. (#18931)

This commit is contained in:
David CARLIER
2025-06-24 21:55:00 +01:00
committed by GitHub
parent 720917f39a
commit 2965fb843d
2 changed files with 12 additions and 8 deletions

View File

@@ -13,7 +13,6 @@ if test "$PHP_PCNTL" != "no"; then
forkx
getcpuid
getpriority
pidfd_open
pset_bind
pthread_set_qos_class_self_np
rfork
@@ -48,6 +47,9 @@ if test "$PHP_PCNTL" != "no"; then
AC_CHECK_DECLS([SYS_waitid],,,
[#include <sys/syscall.h>])
AC_CHECK_DECLS([SYS_pidfd_open],,,
[#include <sys/syscall.h>])
dnl if unsupported, -1 means automatically ENOSYS in this context
AC_CACHE_CHECK([if sched_getcpu is supported], [php_cv_func_sched_getcpu],
[AC_RUN_IFELSE([AC_LANG_SOURCE([

View File

@@ -125,18 +125,20 @@ typedef psetid_t cpu_set_t;
#include <pthread/qos.h>
#endif
#if defined(__linux__) && defined(HAVE_DECL_SYS_WAITID) && HAVE_DECL_SYS_WAITID == 1 && defined(HAVE_SYSCALL)
#define HAVE_LINUX_RAW_SYSCALL_WAITID 1
#if defined(__linux__) && defined(HAVE_SYSCALL)
# include <sys/syscall.h>
# if defined(HAVE_DECL_SYS_WAITID) && HAVE_DECL_SYS_WAITID == 1
# define HAVE_LINUX_RAW_SYSCALL_WAITID 1
# endif
# if defined(HAVE_DECL_SYS_PIDFD_OPEN) && HAVE_DECL_SYS_PIDFD_OPEN == 1
# define HAVE_LINUX_RAW_SYSCALL_PIDFD_OPEN 1
# endif
#endif
#if defined(HAVE_LINUX_RAW_SYSCALL_WAITID)
#include <unistd.h>
#endif
#if defined(HAVE_PIDFD_OPEN) || defined(HAVE_LINUX_RAW_SYSCALL_WAITID)
#include <sys/syscall.h>
#endif
#ifdef HAVE_FORKX
#include <sys/fork.h>
#endif
@@ -1607,7 +1609,7 @@ PHP_FUNCTION(pcntl_forkx)
#endif
/* }}} */
#ifdef HAVE_PIDFD_OPEN
#ifdef HAVE_LINUX_RAW_SYSCALL_PIDFD_OPEN
// The `pidfd_open` syscall is available since 5.3
// and `setns` since 3.0.
PHP_FUNCTION(pcntl_setns)