summaryrefslogtreecommitdiff
path: root/ext/opcache/zend_shared_alloc.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2016-04-07 13:58:00 +0800
committerXinchen Hui <laruence@gmail.com>2016-04-07 13:58:00 +0800
commit079239a7cececfca9344b24f5bb1cca127d4bcc9 (patch)
treec02a94788db9aac4f3834a7029ce6af28e905b29 /ext/opcache/zend_shared_alloc.c
parent7e042224a26282938b866a49ca3d4af1b368c0cc (diff)
parent5ab950cb2ca362af3f718179f1da430922c1e0dd (diff)
downloadphp-git-079239a7cececfca9344b24f5bb1cca127d4bcc9.tar.gz
Merge branch 'PHP-7.0' of git.php.net:/php-src into PHP-7.0
* 'PHP-7.0' of git.php.net:/php-src: Remove __halt_compiler from semi-reserved tokens Fixed Bug #71974 Trans sid will always be send, even if cookies are available Optimized array_fill(). This is a perfect function for fast creation of packed arrays. Fixed build fix merge mistake fix tests PostgreSQL's PDOStatement::getColumnMeta() fills in table's name. fix indent Fixed bug #71978 (Existence of return type hint affects other compatibility rules) fix test fix bug #71667 (emulate how mssql extension names "computed" columns) update NEWS add 32-bit specific variont for #62498 skip test on 32-bit make opcache lockfile path configurable return zvals instead of strings, cast or not based on stringify attribute fix test add skip slow test
Diffstat (limited to 'ext/opcache/zend_shared_alloc.c')
-rw-r--r--ext/opcache/zend_shared_alloc.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c
index 663d905c8d..ff42c4cf0b 100644
--- a/ext/opcache/zend_shared_alloc.c
+++ b/ext/opcache/zend_shared_alloc.c
@@ -38,7 +38,6 @@
# include "sys/mman.h"
#endif
-#define TMP_DIR "/tmp"
#define SEM_FILENAME_PREFIX ".ZendSem."
#define S_H(s) g_shared_alloc_handler->s
@@ -55,7 +54,7 @@ zend_smm_shared_globals *smm_shared_globals;
static MUTEX_T zts_lock;
#endif
int lock_file;
-static char lockfile_name[sizeof(TMP_DIR) + sizeof(SEM_FILENAME_PREFIX) + 8];
+static char lockfile_name[MAXPATHLEN];
#endif
static const zend_shared_memory_handler_entry handler_table[] = {
@@ -75,7 +74,7 @@ static const zend_shared_memory_handler_entry handler_table[] = {
};
#ifndef ZEND_WIN32
-void zend_shared_alloc_create_lock(void)
+void zend_shared_alloc_create_lock(char *lockfile_path)
{
int val;
@@ -83,7 +82,7 @@ void zend_shared_alloc_create_lock(void)
zts_lock = tsrm_mutex_alloc();
#endif
- sprintf(lockfile_name, "%s/%sXXXXXX", TMP_DIR, SEM_FILENAME_PREFIX);
+ snprintf(lockfile_name, sizeof(lockfile_name), "%s/%sXXXXXX", lockfile_path, SEM_FILENAME_PREFIX);
lock_file = mkstemp(lockfile_name);
fchmod(lock_file, 0666);
@@ -163,7 +162,11 @@ int zend_shared_alloc_startup(size_t requested_size)
smm_shared_globals = &tmp_shared_globals;
ZSMMG(shared_free) = requested_size; /* goes to tmp_shared_globals.shared_free */
+#ifndef ZEND_WIN32
+ zend_shared_alloc_create_lock(ZCG(accel_directives).lockfile_path);
+#else
zend_shared_alloc_create_lock();
+#endif
if (ZCG(accel_directives).memory_model && ZCG(accel_directives).memory_model[0]) {
char *model = ZCG(accel_directives).memory_model;