summaryrefslogtreecommitdiffstats
path: root/php-upstream.patch
diff options
context:
space:
mode:
Diffstat (limited to 'php-upstream.patch')
-rw-r--r--php-upstream.patch58
1 files changed, 58 insertions, 0 deletions
diff --git a/php-upstream.patch b/php-upstream.patch
new file mode 100644
index 0000000..b90cd03
--- /dev/null
+++ b/php-upstream.patch
@@ -0,0 +1,58 @@
+--- a/ext/opcache/ZendAccelerator.c 2015-11-25 05:04:23.000000000 +0100
++++ b/ext/opcache/tmp/ZendAccelerator.c 2015-11-27 12:38:07.806097341 +0100
+@@ -2515,6 +2515,8 @@
+ MAP_PRIVATE | MAP_ANONYMOUS,
+ -1, 0);
+ if (mem == MAP_FAILED) {
++ zend_error(E_WARNING,
++ ACCELERATOR_PRODUCT_NAME " huge_code_pages: mmap failed: %s (%d)", strerror(errno), errno);
+ return -1;
+ }
+ memcpy(mem, start, size);
+@@ -2525,17 +2527,42 @@
+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED | MAP_HUGETLB,
+ -1, 0);
+ # endif
+-# ifdef MADV_HUGEPAGE
+ if (ret == MAP_FAILED) {
++# ifdef MADV_HUGEPAGE
+ ret = mmap(start, size,
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED,
+ -1, 0);
+- madvise(start, size, MADV_HUGEPAGE);
+- }
++ if (ret == MAP_FAILED) {
++ zend_error(E_WARNING,
++ ACCELERATOR_PRODUCT_NAME " huge_code_pages: mmap(FIXED) failed: %s (%d)",
++ strerror(errno), errno);
++ munmap(mem, size);
++ return -1;
++ }
++ if (-1 == madvise(start, size, MADV_HUGEPAGE)) {
++ zend_error(E_WARNING,
++ ACCELERATOR_PRODUCT_NAME " huge_code_pages: madvise(HUGEPAGE) failed: %s (%d)",
++ strerror(errno), errno);
++ munmap(mem, size);
++ return -1;
++ }
++# else
++ ret = mmap(start, size,
++ PROT_READ | PROT_WRITE | PROT_EXEC,
++ MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
++ if (ret == MAP_FAILED) {
++ /* this should never happen */
++ }
++ memcpy(start, mem, size);
++ zend_error(E_WARNING,
++ ACCELERATOR_PRODUCT_NAME "huge_code_pages: mmap(HUGETLB) failed: %s (%d)", strerror(errno), errno);
++ return -1;
+ # endif
++ }
++
+ if (ret == start) {
+- memcpy(start, mem, size);
++ memcpy(start, mem, size);
+ mprotect(start, size, PROT_READ | PROT_EXEC);
+ }
+ munmap(mem, size);