Skip to content

Commit 19c8a10

Browse files
committed
ext/pcntl: add pcntl_getcpu support for solaris.
using getcpuid having similar signature too. close GH-14188
1 parent 46db893 commit 19c8a10

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

NEWS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ PHP NEWS
141141
. Added pcntl_getaffinity/pcntl_setaffinity. (David Carlier)
142142
. Updated pcntl_get_signal_handler signal id upper limit to be
143143
more in line with platforms limits. (David Carlier)
144-
. Added pcntl_getcpu for Linux/FreeBSD. (David Carlier)
144+
. Added pcntl_getcpu for Linux/FreeBSD/Solaris/Illumos. (David Carlier)
145145
. Added pcntl_getqos_class/pcntl_setqos_class for macOs. (David Carlier)
146146
. Added SIGCKPT/SIGCKPTEXIT constants for DragonFlyBSD. (David Carlier)
147147

Zend/zend_call_stack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ static bool zend_call_stack_get_solaris_proc_maps(zend_call_stack *stack)
694694
struct rlimit rlim;
695695
char path[PATH_MAX];
696696
size_t size;
697-
ssize_t len;
697+
ssize_t len = -1;
698698
pid_t pid;
699699
int error, fd;
700700

ext/pcntl/config.m4

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,21 @@ if test "$PHP_PCNTL" != "no"; then
77
AC_CHECK_FUNCS([fork], [], [AC_MSG_ERROR([pcntl: fork() not supported by this platform])])
88
AC_CHECK_FUNCS([waitpid], [], [AC_MSG_ERROR([pcntl: waitpid() not supported by this platform])])
99
AC_CHECK_FUNCS([sigaction], [], [AC_MSG_ERROR([pcntl: sigaction() not supported by this platform])])
10-
AC_CHECK_FUNCS([getpriority setpriority wait3 wait4 sigwaitinfo sigtimedwait unshare rfork forkx pidfd_open sched_setaffinity pthread_set_qos_class_self_np])
10+
AC_CHECK_FUNCS(m4_normalize([
11+
forkx
12+
getcpuid
13+
getpriority
14+
pidfd_open
15+
pthread_set_qos_class_self_np
16+
rfork
17+
sched_setaffinity
18+
setpriority
19+
sigwaitinfo
20+
sigtimedwait
21+
unshare
22+
wait3
23+
wait4
24+
]))
1125

1226
dnl if unsupported, -1 means automatically ENOSYS in this context
1327
AC_MSG_CHECKING([if sched_getcpu is supported])

ext/pcntl/pcntl.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ typedef cpuset_t *cpu_set_t;
7878
#define HAVE_SCHED_SETAFFINITY 1
7979
#endif
8080

81+
#if defined(HAVE_GETCPUID)
82+
#include <sys/processor.h>
83+
#define sched_getcpu getcpuid
84+
#define HAVE_SCHED_GETCPU 1
85+
#endif
86+
8187
#if defined(HAVE_PTHREAD_SET_QOS_CLASS_SELF_NP)
8288
#include <pthread/qos.h>
8389
static zend_class_entry *QosClass_ce;

0 commit comments

Comments
 (0)