1From ca9b419f2c146061f73ee045cb0a069c18b40cd0 Mon Sep 17 00:00:00 2001 2From: Mingli Yu <mingli.yu@windriver.com> 3Date: Wed, 15 Dec 2021 14:00:08 +0800 4Subject: [PATCH 01/11] ext/opcache/config.m4: enable opcache 5 6We can't use AC_TRY_RUN to run programs in a cross compile 7environment. Set the variables directly instead since we know 8that we'd be running on latest enough linux kernel. 9 10Upstream-Status: Inappropriate [Configuration] 11 12Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> 13 14update patch to version 7.4.4 15Signed-off-by: Changqing Li <changqing.li@windriver.com> 16 17update patch to version 8.0.12 18fix issue linking with librt 19Signed-off-by: Claude Bing <cbing@cybernetics.com> 20 21update patch to version 8.1.0 22Signed-off-by: Mingli Yu <mingli.yu@windriver.com> 23--- 24 ext/opcache/config.m4 | 204 ++---------------------------------------- 25 1 file changed, 8 insertions(+), 196 deletions(-) 26 27diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4 28index 2a83fa2..9471b5d 100644 29--- a/ext/opcache/config.m4 30+++ b/ext/opcache/config.m4 31@@ -108,209 +108,21 @@ if test "$PHP_OPCACHE" != "no"; then 32 AC_CHECK_FUNCS([mprotect]) 33 34 AC_MSG_CHECKING(for sysvipc shared memory support) 35- AC_RUN_IFELSE([AC_LANG_SOURCE([[ 36-#include <sys/types.h> 37-#include <sys/wait.h> 38-#include <sys/ipc.h> 39-#include <sys/shm.h> 40-#include <unistd.h> 41-#include <string.h> 42- 43-int main() { 44- pid_t pid; 45- int status; 46- int ipc_id; 47- char *shm; 48- struct shmid_ds shmbuf; 49- 50- ipc_id = shmget(IPC_PRIVATE, 4096, (IPC_CREAT | SHM_R | SHM_W)); 51- if (ipc_id == -1) { 52- return 1; 53- } 54- 55- shm = shmat(ipc_id, NULL, 0); 56- if (shm == (void *)-1) { 57- shmctl(ipc_id, IPC_RMID, NULL); 58- return 2; 59- } 60- 61- if (shmctl(ipc_id, IPC_STAT, &shmbuf) != 0) { 62- shmdt(shm); 63- shmctl(ipc_id, IPC_RMID, NULL); 64- return 3; 65- } 66- 67- shmbuf.shm_perm.uid = getuid(); 68- shmbuf.shm_perm.gid = getgid(); 69- shmbuf.shm_perm.mode = 0600; 70- 71- if (shmctl(ipc_id, IPC_SET, &shmbuf) != 0) { 72- shmdt(shm); 73- shmctl(ipc_id, IPC_RMID, NULL); 74- return 4; 75- } 76- 77- shmctl(ipc_id, IPC_RMID, NULL); 78- 79- strcpy(shm, "hello"); 80- 81- pid = fork(); 82- if (pid < 0) { 83- return 5; 84- } else if (pid == 0) { 85- strcpy(shm, "bye"); 86- return 6; 87- } 88- if (wait(&status) != pid) { 89- return 7; 90- } 91- if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) { 92- return 8; 93- } 94- if (strcmp(shm, "bye") != 0) { 95- return 9; 96- } 97- return 0; 98-} 99-]])],[have_shm_ipc=yes],[have_shm_ipc=no],[have_shm_ipc=no]) 100- if test "$have_shm_ipc" = "yes"; then 101- AC_DEFINE(HAVE_SHM_IPC, 1, [Define if you have SysV IPC SHM support]) 102- fi 103+ AC_DEFINE(HAVE_SHM_IPC, 1, [Define if you have SysV IPC SHM support]) 104+ have_shm_ipc=yes 105 AC_MSG_RESULT([$have_shm_ipc]) 106 107 AC_MSG_CHECKING(for mmap() using MAP_ANON shared memory support) 108- AC_RUN_IFELSE([AC_LANG_SOURCE([[ 109-#include <sys/types.h> 110-#include <sys/wait.h> 111-#include <sys/mman.h> 112-#include <unistd.h> 113-#include <string.h> 114- 115-#ifndef MAP_ANON 116-# ifdef MAP_ANONYMOUS 117-# define MAP_ANON MAP_ANONYMOUS 118-# endif 119-#endif 120-#ifndef MAP_FAILED 121-# define MAP_FAILED ((void*)-1) 122-#endif 123- 124-int main() { 125- pid_t pid; 126- int status; 127- char *shm; 128- 129- shm = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0); 130- if (shm == MAP_FAILED) { 131- return 1; 132- } 133- 134- strcpy(shm, "hello"); 135- 136- pid = fork(); 137- if (pid < 0) { 138- return 5; 139- } else if (pid == 0) { 140- strcpy(shm, "bye"); 141- return 6; 142- } 143- if (wait(&status) != pid) { 144- return 7; 145- } 146- if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) { 147- return 8; 148- } 149- if (strcmp(shm, "bye") != 0) { 150- return 9; 151- } 152- return 0; 153-} 154-]])],[have_shm_mmap_anon=yes],[have_shm_mmap_anon=no],[ 155- case $host_alias in 156- *linux*) 157- have_shm_mmap_anon=yes 158- ;; 159- *) 160- have_shm_mmap_anon=no 161- ;; 162- esac 163-]) 164- if test "$have_shm_mmap_anon" = "yes"; then 165- AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support]) 166- fi 167+ AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support]) 168+ have_shm_mmap_anon=yes 169 AC_MSG_RESULT([$have_shm_mmap_anon]) 170 171 PHP_CHECK_FUNC_LIB(shm_open, rt, root) 172 AC_MSG_CHECKING(for mmap() using shm_open() shared memory support) 173- AC_RUN_IFELSE([AC_LANG_SOURCE([[ 174-#include <sys/types.h> 175-#include <sys/wait.h> 176-#include <sys/mman.h> 177-#include <sys/stat.h> 178-#include <fcntl.h> 179-#include <unistd.h> 180-#include <string.h> 181-#include <stdlib.h> 182-#include <stdio.h> 183- 184-#ifndef MAP_FAILED 185-# define MAP_FAILED ((void*)-1) 186-#endif 187- 188-int main() { 189- pid_t pid; 190- int status; 191- int fd; 192- char *shm; 193- char tmpname[4096]; 194- 195- sprintf(tmpname,"/opcache.test.shm.%dXXXXXX", getpid()); 196- if (mktemp(tmpname) == NULL) { 197- return 1; 198- } 199- fd = shm_open(tmpname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); 200- if (fd == -1) { 201- return 2; 202- } 203- if (ftruncate(fd, 4096) < 0) { 204- close(fd); 205- shm_unlink(tmpname); 206- return 3; 207- } 208- 209- shm = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); 210- if (shm == MAP_FAILED) { 211- return 4; 212- } 213- shm_unlink(tmpname); 214- close(fd); 215- 216- strcpy(shm, "hello"); 217- 218- pid = fork(); 219- if (pid < 0) { 220- return 5; 221- } else if (pid == 0) { 222- strcpy(shm, "bye"); 223- return 6; 224- } 225- if (wait(&status) != pid) { 226- return 7; 227- } 228- if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) { 229- return 8; 230- } 231- if (strcmp(shm, "bye") != 0) { 232- return 9; 233- } 234- return 0; 235-} 236-]])],[have_shm_mmap_posix=yes],[have_shm_mmap_posix=no],[have_shm_mmap_posix=no]) 237- if test "$have_shm_mmap_posix" = "yes"; then 238- AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support]) 239- PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)]) 240- fi 241- AC_MSG_RESULT([$have_shm_mmap_posix]) 242+ AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support]) 243+ AC_MSG_RESULT([yes]) 244+ have_shm_mmap_posix=yes 245+ PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)]) 246 247 PHP_NEW_EXTENSION(opcache, 248 ZendAccelerator.c \ 249-- 2502.17.1 251 252