summaryrefslogtreecommitdiff
path: root/ext/posix
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2019-03-12 14:15:47 +0300
committerDmitry Stogov <dmitry@zend.com>2019-03-12 14:15:47 +0300
commitf1b306fe117cfbbe69ab4ef9713d39ea068e74c0 (patch)
tree876485fc86d30924b161cd623919ddfc11a5c69a /ext/posix
parent5aa1176238f41097ea7295ba6911aa19ae7c1021 (diff)
downloadphp-git-f1b306fe117cfbbe69ab4ef9713d39ea068e74c0.tar.gz
Switch to use ZTS cache
Diffstat (limited to 'ext/posix')
-rw-r--r--ext/posix/config.m42
-rw-r--r--ext/posix/php_posix.h9
-rw-r--r--ext/posix/posix.c6
3 files changed, 12 insertions, 5 deletions
diff --git a/ext/posix/config.m4 b/ext/posix/config.m4
index f56f6c60cd..ea67485597 100644
--- a/ext/posix/config.m4
+++ b/ext/posix/config.m4
@@ -8,7 +8,7 @@ PHP_ARG_ENABLE([posix],
if test "$PHP_POSIX" = "yes"; then
AC_DEFINE(HAVE_POSIX, 1, [whether to include POSIX-like functions])
- PHP_NEW_EXTENSION(posix, posix.c, $ext_shared)
+ PHP_NEW_EXTENSION(posix, posix.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
AC_CHECK_HEADERS([sys/mkdev.h sys/sysmacros.h])
diff --git a/ext/posix/php_posix.h b/ext/posix/php_posix.h
index 7fff314be2..17d8b038c2 100644
--- a/ext/posix/php_posix.h
+++ b/ext/posix/php_posix.h
@@ -125,12 +125,13 @@ ZEND_BEGIN_MODULE_GLOBALS(posix)
int last_error;
ZEND_END_MODULE_GLOBALS(posix)
-#ifdef ZTS
-# define POSIX_G(v) TSRMG(posix_globals_id, zend_posix_globals *, v)
-#else
-# define POSIX_G(v) (posix_globals.v)
+#if defined(ZTS) && defined(COMPILE_DL_POSIX)
+ZEND_TSRMLS_CACHE_EXTERN()
#endif
+ZEND_EXTERN_MODULE_GLOBALS(posix)
+#define POSIX_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(posix, v)
+
#else
#define posix_module_ptr NULL
diff --git a/ext/posix/posix.c b/ext/posix/posix.c
index 3e72304394..e95064d0fa 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@ -324,6 +324,9 @@ static PHP_MINFO_FUNCTION(posix)
static PHP_GINIT_FUNCTION(posix) /* {{{ */
{
+#if defined(COMPILE_DL_POSIX) && defined(ZTS)
+ ZEND_TSRMLS_CACHE_UPDATE();
+#endif
posix_globals->last_error = 0;
}
/* }}} */
@@ -427,6 +430,9 @@ zend_module_entry posix_module_entry = {
/* }}} */
#ifdef COMPILE_DL_POSIX
+#ifdef ZTS
+ZEND_TSRMLS_CACHE_DEFINE()
+#endif
ZEND_GET_MODULE(posix)
#endif