summaryrefslogtreecommitdiff
path: root/ext/opcache/zend_shared_alloc.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2019-02-12 10:21:59 +0300
committerDmitry Stogov <dmitry@zend.com>2019-02-12 10:21:59 +0300
commit470f5891d48cad64fd73dbb34775b3bcce1337cf (patch)
tree449b03934361940f023bfd4d5b6c01acb3c90d56 /ext/opcache/zend_shared_alloc.c
parentb71146bde4fc5b829501341bd359fc8af94726ac (diff)
parent9222702633c63254b08466b322266b647ac3e905 (diff)
downloadphp-git-470f5891d48cad64fd73dbb34775b3bcce1337cf.tar.gz
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Avoid dependency on "struct flock" fields order.
Diffstat (limited to 'ext/opcache/zend_shared_alloc.c')
-rw-r--r--ext/opcache/zend_shared_alloc.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c
index 17ddadbdd8..3db3c0106a 100644
--- a/ext/opcache/zend_shared_alloc.c
+++ b/ext/opcache/zend_shared_alloc.c
@@ -375,15 +375,15 @@ void zend_shared_alloc_safe_unlock(void)
}
}
-#ifndef ZEND_WIN32
-/* name l_type l_whence l_start l_len */
-static FLOCK_STRUCTURE(mem_write_lock, F_WRLCK, SEEK_SET, 0, 1);
-static FLOCK_STRUCTURE(mem_write_unlock, F_UNLCK, SEEK_SET, 0, 1);
-#endif
-
void zend_shared_alloc_lock(void)
{
#ifndef ZEND_WIN32
+ struct flock mem_write_lock;
+
+ mem_write_lock.l_type = F_WRLCK;
+ mem_write_lock.l_whence = SEEK_SET;
+ mem_write_lock.l_start = 0;
+ mem_write_lock.l_len = 1;
#ifdef ZTS
tsrm_mutex_lock(zts_lock);
@@ -414,6 +414,15 @@ void zend_shared_alloc_lock(void)
void zend_shared_alloc_unlock(void)
{
+#ifndef ZEND_WIN32
+ struct flock mem_write_unlock;
+
+ mem_write_unlock.l_type = F_UNLCK;
+ mem_write_unlock.l_whence = SEEK_SET;
+ mem_write_unlock.l_start = 0;
+ mem_write_unlock.l_len = 1;
+#endif
+
ZCG(locked) = 0;
#ifndef ZEND_WIN32