Skip to content

Commit 332b58f

Browse files
kadlernikic
authored andcommitted
Fix bug #77361 (configure fails on 64-bit AIX when opcache enabled)
In f904830, support for GNU Hurd was added to the opcache and the configure check to ensure the opcache knows the flock struct layout prior to building was changed check for two cases: BSD layout and Linux layout. All the existing hard-coded cases in ZendAccelerator.h follow these two cases, except for 64-bit AIX. This means that even though building on 64-bit AIX would work, the configure script refuses to continue. Add a new configure check for the 64-bit AIX case and a new compiler definition HAVE_FLOCK_AIX64. Now that all the cases are covered, simplify the ifdef logic around these three HAVE_FLOCK_* macros: - The macOS and the various BSD flavors fall under HAVE_FLOCK_BSD - Linux, HP-UX, GNU Hurd, 32-bit AIX, and SVR4 environments fall under HAVE_FLOCK_LINUX - 64-bit AIX falls under HAVE_FLOCK_AIX64 The only difference between the existing HAVE_FLOCK_LINUX and the hard-coded Linux/HP-UX/Hurd case is that the latter initialized the 5th member to 0, but since the C standard already says that un-initialized members will be initialized to 0, it's effectively the same.
1 parent 1a1e12c commit 332b58f

File tree

3 files changed

+31
-21
lines changed

3 files changed

+31
-21
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ PHP NEWS
1515
. Fixed bug #75684 (In mysqlnd_ext_plugin.h the plugin methods family has
1616
no external visibility). (Anatol)
1717

18+
- Opcache:
19+
. Fixed bug #77361 (configure fails on 64-bit AIX when opcache enabled).
20+
(Kevin Adler)
21+
1822
- PDO:
1923
. Fixed bug #77273 (array_walk_recursive corrupts value types leading to PDO
2024
failure). (Nikita)

ext/opcache/ZendAccelerator.h

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,23 +90,9 @@
9090
#ifndef ZEND_WIN32
9191
extern int lock_file;
9292

93-
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || (defined(__APPLE__) && defined(__MACH__)/* Darwin */) || defined(__OpenBSD__) || defined(__NetBSD__)
93+
# if defined(HAVE_FLOCK_AIX64)
9494
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
95-
struct flock name = {start, len, -1, type, whence}
96-
# elif defined(__svr4__)
97-
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
98-
struct flock name = {type, whence, start, len}
99-
# elif defined(__linux__) || defined(__hpux) || defined(__GNU__)
100-
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
101-
struct flock name = {type, whence, start, len, 0}
102-
# elif defined(_AIX)
103-
# if defined(_LARGE_FILES) || defined(__64BIT__)
104-
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
10595
struct flock name = {type, whence, 0, 0, 0, start, len }
106-
# else
107-
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
108-
struct flock name = {type, whence, start, len}
109-
# endif
11096
# elif defined(HAVE_FLOCK_BSD)
11197
# define FLOCK_STRUCTURE(name, type, whence, start, len) \
11298
struct flock name = {start, len, -1, type, whence}

ext/opcache/config.m4

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,25 @@ int main() {
344344
AC_MSG_RESULT([$msg])
345345

346346
flock_type=unknown
347-
AC_MSG_CHECKING("whether flock struct is linux ordered")
347+
AC_MSG_CHECKING(for struct flock layout)
348+
349+
if test "$flock_type" = "unknown"; then
350+
AC_TRY_RUN([
351+
#include <fcntl.h>
352+
struct flock lock = { 1, 2, 3, 4, 5, 6, 7 };
353+
int main() {
354+
if(lock.l_type == 1 && lock.l_whence == 2 && lock.l_start == 6 && lock.l_len== 7) {
355+
return 0;
356+
}
357+
return 1;
358+
}
359+
], [
360+
flock_type=aix64
361+
AC_DEFINE([HAVE_FLOCK_AIX64], [], [Struct flock is 64-bit AIX-type])
362+
], [])
363+
fi
364+
365+
if test "$flock_type" = "unknown"; then
348366
AC_TRY_RUN([
349367
#include <fcntl.h>
350368
struct flock lock = { 1, 2, 3, 4, 5 };
@@ -357,10 +375,10 @@ AC_TRY_RUN([
357375
], [
358376
flock_type=linux
359377
AC_DEFINE([HAVE_FLOCK_LINUX], [], [Struct flock is Linux-type])
360-
AC_MSG_RESULT("yes")
361-
], AC_MSG_RESULT("no") )
378+
], [])
379+
fi
362380

363-
AC_MSG_CHECKING("whether flock struct is BSD ordered")
381+
if test "$flock_type" = "unknown"; then
364382
AC_TRY_RUN([
365383
#include <fcntl.h>
366384
struct flock lock = { 1, 2, 3, 4, 5 };
@@ -373,8 +391,10 @@ AC_TRY_RUN([
373391
], [
374392
flock_type=bsd
375393
AC_DEFINE([HAVE_FLOCK_BSD], [], [Struct flock is BSD-type])
376-
AC_MSG_RESULT("yes")
377-
], AC_MSG_RESULT("no") )
394+
], [])
395+
fi
396+
397+
AC_MSG_RESULT([$flock_type])
378398

379399
if test "$flock_type" = "unknown"; then
380400
AC_MSG_ERROR([Don't know how to define struct flock on this system[,] set --enable-opcache=no])

0 commit comments

Comments
 (0)