Skip to content

Commit 371211b

Browse files
committed
Merge branch 'PHP-8.4'
2 parents b6d6f99 + 91dc9aa commit 371211b

File tree

3 files changed

+26
-22
lines changed

3 files changed

+26
-22
lines changed

cmake/cmake/toolchains/template.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ set(ZEND_MM_EXITCODE__TRYRUN_OUTPUT "(size_t)8 (size_t)3 0")
5555
set(PHP_SAPI_FPM_HAS_PTRACE_EXITCODE 0)
5656

5757
# Set the process memory access file - 'mem' on Linux-alike or 'as' on
58-
# Solaris-alike target systems for the PHP FPM to use pread trace type.
59-
# (/proc/<pid>/<mem-or-as>)
60-
set(PROC_MEM_FILE mem)
58+
# Solaris-alike target systems for the PHP FPM to use pread trace type
59+
# (/proc/<pid>/<mem-or-as>), when neither 'ptrace' nor 'mach_vm_read' functions
60+
# work.
61+
set(PHP_SAPI_FPM_PROC_MEM_FILE mem)
6162

6263
################################################################################
6364
# ext/gd

cmake/sapi/fpm/cmake/CheckTrace.cmake

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ Check FPM trace implementation.
33
44
Result variables:
55
6-
* HAVE_PTRACE - Whether ptrace() is present and works as expected.
7-
* HAVE_MACH_VM_READ - Whether ptrace() didn't work and the mach_vm_read() is
8-
present.
9-
* PROC_MEM_FILE - If neither ptrace() or mach_vm_read() works, the
10-
/proc/pid/<file> interface ('mem' or 'as') is set if found and works as
11-
expected.
6+
* HAVE_PTRACE
7+
* HAVE_MACH_VM_READ
8+
* PROC_MEM_FILE
129
#]=============================================================================]
1310

1411
include(CheckSourceRuns)
@@ -113,14 +110,15 @@ if(NOT PHP_SAPI_FPM_HAS_PTRACE AND NOT PHP_SAPI_FPM_HAS_MACH_VM_READ)
113110
message(CHECK_START "Checking for process memory access file")
114111

115112
if(NOT CMAKE_CROSSCOMPILING)
116-
set(PROC_MEM_FILE "")
117-
if(EXISTS /proc/self/mem)
118-
set(PROC_MEM_FILE "mem")
119-
elseif(EXISTS /proc/self/as)
120-
set(PROC_MEM_FILE "as")
113+
if(NOT DEFINED PHP_SAPI_FPM_PROC_MEM_FILE)
114+
if(EXISTS /proc/self/mem)
115+
set(PHP_SAPI_FPM_PROC_MEM_FILE "mem")
116+
elseif(EXISTS /proc/self/as)
117+
set(PHP_SAPI_FPM_PROC_MEM_FILE "as")
118+
endif()
121119
endif()
122120

123-
if(PROC_MEM_FILE)
121+
if(PHP_SAPI_FPM_PROC_MEM_FILE)
124122
cmake_push_check_state(RESET)
125123
set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
126124
set(CMAKE_REQUIRED_QUIET TRUE)
@@ -138,7 +136,7 @@ if(NOT PHP_SAPI_FPM_HAS_PTRACE AND NOT PHP_SAPI_FPM_HAS_MACH_VM_READ)
138136
long v1 = (unsigned int) -1, v2 = 0;
139137
char buf[128];
140138
int fd;
141-
sprintf(buf, \"/proc/%d/${PROC_MEM_FILE}\", getpid());
139+
sprintf(buf, \"/proc/%d/${PHP_SAPI_FPM_PROC_MEM_FILE}\", getpid());
142140
fd = open(buf, O_RDONLY);
143141
if (0 > fd) {
144142
return 1;
@@ -154,13 +152,14 @@ if(NOT PHP_SAPI_FPM_HAS_PTRACE AND NOT PHP_SAPI_FPM_HAS_MACH_VM_READ)
154152
cmake_pop_check_state()
155153

156154
if(NOT PHP_HAS_PROC_MEM_FILE)
157-
unset(PROC_MEM_FILE)
155+
unset(PHP_SAPI_FPM_PROC_MEM_FILE)
158156
endif()
159157
endif()
160158
endif()
161159

162-
if(PROC_MEM_FILE)
163-
message(CHECK_PASS "yes (${PROC_MEM_FILE})")
160+
if(PHP_SAPI_FPM_PROC_MEM_FILE)
161+
message(CHECK_PASS "yes (${PHP_SAPI_FPM_PROC_MEM_FILE})")
162+
set(PROC_MEM_FILE "${PHP_SAPI_FPM_PROC_MEM_FILE}")
164163
else()
165164
message(CHECK_FAIL "no")
166165
endif()

cmake/sapi/fpm/cmake/config.h.in

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@
3131
/* Define to 1 if you have 'TCP_INFO'. */
3232
#cmakedefine HAVE_LQ_TCP_INFO 1
3333

34-
/* Define to 1 if you have the 'mach_vm_read' function. */
34+
/* Define to 1 if the system has the 'mach_vm_read' function (used when the
35+
'ptrace' function doesn't work). */
3536
#cmakedefine HAVE_MACH_VM_READ 1
3637

3738
/* Define to 1 if you have the 'port_create' function. */
3839
#cmakedefine HAVE_PORT_CREATE 1
3940

40-
/* Define to 1 if you have the 'ptrace' function. */
41+
/* Define to 1 if the system has a working 'ptrace' function. */
4142
#cmakedefine HAVE_PTRACE 1
4243

4344
/* Define to 1 if system has a working 'select' function. */
@@ -64,5 +65,8 @@
6465
/* Define to 1 if you have the 'times' function. */
6566
#cmakedefine HAVE_TIMES 1
6667

67-
/* Define to the /proc/pid/mem interface filename value. */
68+
/* The process memory access filename - 'mem' on Linux-alike or 'as' on
69+
Solaris-alike target systems for the PHP FPM to use pread trace type
70+
(/proc/<pid>/<mem-or-as>), when neither 'ptrace' nor 'mach_vm_read'
71+
functions work. */
6872
#cmakedefine PROC_MEM_FILE "@PROC_MEM_FILE@"

0 commit comments

Comments
 (0)