]> granicus.if.org Git - php/commitdiff
Fix bug #77361 (configure fails on 64-bit AIX when opcache enabled)
authorKevin Adler <kadler@us.ibm.com>
Thu, 27 Dec 2018 19:54:08 +0000 (13:54 -0600)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 11 Jan 2019 09:21:02 +0000 (10:21 +0100)
In f9048300123, 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.

NEWS
ext/opcache/ZendAccelerator.h
ext/opcache/config.m4

diff --git a/NEWS b/NEWS
index fc828fac69bc39077ec2af10b5daa33c83d910c7..99bc6e51724ac79bfaed52d7df9e313da6f158bb 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,10 @@ PHP                                                                        NEWS
   . Fixed bug #75684 (In mysqlnd_ext_plugin.h the plugin methods family has
     no external visibility). (Anatol)
 
+- Opcache:
+  . Fixed bug #77361 (configure fails on 64-bit AIX when opcache enabled).
+    (Kevin Adler)
+
 - PDO:
   . Fixed bug #77273 (array_walk_recursive corrupts value types leading to PDO
     failure). (Nikita)
index c660038c75c6fc6ebef031b53e752740dcba8d5b..685d9e29cb9ab15d759e77dc973de6d975edbd70 100644 (file)
 #ifndef ZEND_WIN32
 extern int lock_file;
 
-# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || (defined(__APPLE__) && defined(__MACH__)/* Darwin */) || defined(__OpenBSD__) || defined(__NetBSD__)
+# if defined(HAVE_FLOCK_AIX64)
 #  define FLOCK_STRUCTURE(name, type, whence, start, len) \
-               struct flock name = {start, len, -1, type, whence}
-# elif defined(__svr4__)
-#  define FLOCK_STRUCTURE(name, type, whence, start, len) \
-               struct flock name = {type, whence, start, len}
-# elif defined(__linux__) || defined(__hpux) || defined(__GNU__)
-#  define FLOCK_STRUCTURE(name, type, whence, start, len) \
-               struct flock name = {type, whence, start, len, 0}
-# elif defined(_AIX)
-#  if defined(_LARGE_FILES) || defined(__64BIT__)
-#   define FLOCK_STRUCTURE(name, type, whence, start, len) \
                struct flock name = {type, whence, 0, 0, 0, start, len }
-#  else
-#   define FLOCK_STRUCTURE(name, type, whence, start, len) \
-               struct flock name = {type, whence, start, len}
-#  endif
 # elif defined(HAVE_FLOCK_BSD)
 #  define FLOCK_STRUCTURE(name, type, whence, start, len) \
                struct flock name = {start, len, -1, type, whence}
index 1e49c0d9584e502f2de0a174d9fc86a06a159c66..ec14487c123691f0a400a32cde828b0ad096d575 100644 (file)
@@ -344,7 +344,25 @@ int main() {
   AC_MSG_RESULT([$msg])
 
 flock_type=unknown
-AC_MSG_CHECKING("whether flock struct is linux ordered")
+AC_MSG_CHECKING(for struct flock layout)
+
+if test "$flock_type" = "unknown"; then
+AC_TRY_RUN([
+  #include <fcntl.h>
+  struct flock lock = { 1, 2, 3, 4, 5, 6, 7 };
+  int main() {
+    if(lock.l_type == 1 && lock.l_whence == 2 && lock.l_start == 6 && lock.l_len== 7) {
+               return 0;
+    }
+    return 1;
+  }
+], [
+    flock_type=aix64
+    AC_DEFINE([HAVE_FLOCK_AIX64], [], [Struct flock is 64-bit AIX-type])
+], [])
+fi
+
+if test "$flock_type" = "unknown"; then
 AC_TRY_RUN([
   #include <fcntl.h>
   struct flock lock = { 1, 2, 3, 4, 5 };
@@ -357,10 +375,10 @@ AC_TRY_RUN([
 ], [
        flock_type=linux
     AC_DEFINE([HAVE_FLOCK_LINUX], [], [Struct flock is Linux-type])
-    AC_MSG_RESULT("yes")
-], AC_MSG_RESULT("no") )
+], [])
+fi
 
-AC_MSG_CHECKING("whether flock struct is BSD ordered")
+if test "$flock_type" = "unknown"; then
 AC_TRY_RUN([
   #include <fcntl.h>
   struct flock lock = { 1, 2, 3, 4, 5 };
@@ -373,8 +391,10 @@ AC_TRY_RUN([
 ], [
        flock_type=bsd
     AC_DEFINE([HAVE_FLOCK_BSD], [], [Struct flock is BSD-type])
-    AC_MSG_RESULT("yes")
-], AC_MSG_RESULT("no") )
+], [])
+fi
+
+AC_MSG_RESULT([$flock_type])
 
 if test "$flock_type" = "unknown"; then
        AC_MSG_ERROR([Don't know how to define struct flock on this system[,] set --enable-opcache=no])