ext/pcntl: add pcntl_getcpu support for solaris.

using getcpuid having similar signature too.

close GH-14188
This commit is contained in:
David Carlier 2024-05-09 22:36:48 +00:00
parent 46db8931f1
commit 19c8a10f3f
No known key found for this signature in database
GPG key ID: CEF290BB40D2086B
4 changed files with 23 additions and 3 deletions

2
NEWS
View file

@ -141,7 +141,7 @@ PHP NEWS
. Added pcntl_getaffinity/pcntl_setaffinity. (David Carlier) . Added pcntl_getaffinity/pcntl_setaffinity. (David Carlier)
. Updated pcntl_get_signal_handler signal id upper limit to be . Updated pcntl_get_signal_handler signal id upper limit to be
more in line with platforms limits. (David Carlier) more in line with platforms limits. (David Carlier)
. Added pcntl_getcpu for Linux/FreeBSD. (David Carlier) . Added pcntl_getcpu for Linux/FreeBSD/Solaris/Illumos. (David Carlier)
. Added pcntl_getqos_class/pcntl_setqos_class for macOs. (David Carlier) . Added pcntl_getqos_class/pcntl_setqos_class for macOs. (David Carlier)
. Added SIGCKPT/SIGCKPTEXIT constants for DragonFlyBSD. (David Carlier) . Added SIGCKPT/SIGCKPTEXIT constants for DragonFlyBSD. (David Carlier)

View file

@ -694,7 +694,7 @@ static bool zend_call_stack_get_solaris_proc_maps(zend_call_stack *stack)
struct rlimit rlim; struct rlimit rlim;
char path[PATH_MAX]; char path[PATH_MAX];
size_t size; size_t size;
ssize_t len; ssize_t len = -1;
pid_t pid; pid_t pid;
int error, fd; int error, fd;

View file

@ -7,7 +7,21 @@ if test "$PHP_PCNTL" != "no"; then
AC_CHECK_FUNCS([fork], [], [AC_MSG_ERROR([pcntl: fork() not supported by this platform])]) AC_CHECK_FUNCS([fork], [], [AC_MSG_ERROR([pcntl: fork() not supported by this platform])])
AC_CHECK_FUNCS([waitpid], [], [AC_MSG_ERROR([pcntl: waitpid() not supported by this platform])]) AC_CHECK_FUNCS([waitpid], [], [AC_MSG_ERROR([pcntl: waitpid() not supported by this platform])])
AC_CHECK_FUNCS([sigaction], [], [AC_MSG_ERROR([pcntl: sigaction() not supported by this platform])]) AC_CHECK_FUNCS([sigaction], [], [AC_MSG_ERROR([pcntl: sigaction() not supported by this platform])])
AC_CHECK_FUNCS([getpriority setpriority wait3 wait4 sigwaitinfo sigtimedwait unshare rfork forkx pidfd_open sched_setaffinity pthread_set_qos_class_self_np]) AC_CHECK_FUNCS(m4_normalize([
forkx
getcpuid
getpriority
pidfd_open
pthread_set_qos_class_self_np
rfork
sched_setaffinity
setpriority
sigwaitinfo
sigtimedwait
unshare
wait3
wait4
]))
dnl if unsupported, -1 means automatically ENOSYS in this context dnl if unsupported, -1 means automatically ENOSYS in this context
AC_MSG_CHECKING([if sched_getcpu is supported]) AC_MSG_CHECKING([if sched_getcpu is supported])

View file

@ -78,6 +78,12 @@ typedef cpuset_t *cpu_set_t;
#define HAVE_SCHED_SETAFFINITY 1 #define HAVE_SCHED_SETAFFINITY 1
#endif #endif
#if defined(HAVE_GETCPUID)
#include <sys/processor.h>
#define sched_getcpu getcpuid
#define HAVE_SCHED_GETCPU 1
#endif
#if defined(HAVE_PTHREAD_SET_QOS_CLASS_SELF_NP) #if defined(HAVE_PTHREAD_SET_QOS_CLASS_SELF_NP)
#include <pthread/qos.h> #include <pthread/qos.h>
static zend_class_entry *QosClass_ce; static zend_class_entry *QosClass_ce;