diff --git a/NEWS b/NEWS index 27675244f83..ffa335f0f38 100644 --- a/NEWS +++ b/NEWS @@ -141,7 +141,7 @@ PHP NEWS . Added pcntl_getaffinity/pcntl_setaffinity. (David Carlier) . Updated pcntl_get_signal_handler signal id upper limit to be 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 SIGCKPT/SIGCKPTEXIT constants for DragonFlyBSD. (David Carlier) diff --git a/Zend/zend_call_stack.c b/Zend/zend_call_stack.c index 97e851012c8..cc10a2aa309 100644 --- a/Zend/zend_call_stack.c +++ b/Zend/zend_call_stack.c @@ -694,7 +694,7 @@ static bool zend_call_stack_get_solaris_proc_maps(zend_call_stack *stack) struct rlimit rlim; char path[PATH_MAX]; size_t size; - ssize_t len; + ssize_t len = -1; pid_t pid; int error, fd; diff --git a/ext/pcntl/config.m4 b/ext/pcntl/config.m4 index 073148a0a1d..c9da0fbb643 100644 --- a/ext/pcntl/config.m4 +++ b/ext/pcntl/config.m4 @@ -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([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([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 AC_MSG_CHECKING([if sched_getcpu is supported]) diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index 97baf1dc67e..83905d5d802 100644 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -78,6 +78,12 @@ typedef cpuset_t *cpu_set_t; #define HAVE_SCHED_SETAFFINITY 1 #endif +#if defined(HAVE_GETCPUID) +#include +#define sched_getcpu getcpuid +#define HAVE_SCHED_GETCPU 1 +#endif + #if defined(HAVE_PTHREAD_SET_QOS_CLASS_SELF_NP) #include static zend_class_entry *QosClass_ce;