diff options
author | Anatol Belski <ab@php.net> | 2015-10-09 23:07:10 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2015-10-09 23:47:59 +0200 |
commit | ffb5d0aca30f4730940b6f3265a2f634259ef5b0 (patch) | |
tree | 40e2012f9c7fa10e23477ae432aeacc4c0fead7d /ext/opcache/zend_shared_alloc.c | |
parent | d677b25b1c5fba2451ddeedb22cad29e1cda15cb (diff) | |
download | php-git-ffb5d0aca30f4730940b6f3265a2f634259ef5b0.tar.gz |
Implemented file_cache_fallback mechanism
which is essential as an attempt to fix the "failed to reattach"
error on Windows. If file_cache is enabled, Opcache will
automaticaly switch to file_cache_only mode in the case a process
failed to map the shared segment at the required address. The
important small part of the SHM will still be mapped, which
allows information exchange between normal processes using SHM
and those using the fallback mechanism.
This is based on Dmitry's, Matt's and mine ideas. So many thanks for
support!
Diffstat (limited to 'ext/opcache/zend_shared_alloc.c')
-rw-r--r-- | ext/opcache/zend_shared_alloc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c index 09da83a6a6..1ad3fd2e28 100644 --- a/ext/opcache/zend_shared_alloc.c +++ b/ext/opcache/zend_shared_alloc.c @@ -187,6 +187,11 @@ int zend_shared_alloc_startup(size_t requested_size) smm_shared_globals = NULL; return res; } +#if ENABLE_FILE_CACHE_FALLBACK + if (ALLOC_FALLBACK == res) { + return ALLOC_FALLBACK; + } +#endif if (!g_shared_alloc_handler) { /* try memory handlers in order */ @@ -207,6 +212,11 @@ int zend_shared_alloc_startup(size_t requested_size) if (res == SUCCESSFULLY_REATTACHED) { return res; } +#if ENABLE_FILE_CACHE_FALLBACK + if (ALLOC_FALLBACK == res) { + return ALLOC_FALLBACK; + } +#endif shared_segments_array_size = ZSMMG(shared_segments_count) * S_H(segment_type_size)(); |