Switch to use ZTS cache

This commit is contained in:
Dmitry Stogov 2019-03-12 14:15:47 +03:00
parent 5aa1176238
commit f1b306fe11
24 changed files with 84 additions and 47 deletions

View File

@ -700,7 +700,7 @@ if test "$HAVE_DBA" = "1"; then
AC_MSG_RESULT([yes])
fi
AC_DEFINE(HAVE_DBA, 1, [ ])
PHP_NEW_EXTENSION(dba, dba.c dba_cdb.c dba_dbm.c dba_gdbm.c dba_ndbm.c dba_db1.c dba_db2.c dba_db3.c dba_db4.c dba_flatfile.c dba_inifile.c dba_qdbm.c dba_tcadb.c dba_lmdb.c $cdb_sources $flat_sources $ini_sources, $ext_shared)
PHP_NEW_EXTENSION(dba, dba.c dba_cdb.c dba_dbm.c dba_gdbm.c dba_ndbm.c dba_db1.c dba_db2.c dba_db3.c dba_db4.c dba_flatfile.c dba_inifile.c dba_qdbm.c dba_tcadb.c dba_lmdb.c $cdb_sources $flat_sources $ini_sources, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_ADD_BUILD_DIR($ext_builddir/libinifile)
PHP_ADD_BUILD_DIR($ext_builddir/libcdb)
PHP_ADD_BUILD_DIR($ext_builddir/libflatfile)

View File

@ -6,7 +6,7 @@ ARG_WITH("db", "DBA: Berkeley DB support", "no");
ARG_WITH("lmdb", "DBA: Lightning memory-mapped database support", "no");
if (PHP_DBA != "no") {
EXTENSION("dba", "dba.c dba_cdb.c dba_db1.c dba_db2.c dba_db3.c dba_dbm.c dba_flatfile.c dba_gdbm.c dba_ndbm.c dba_inifile.c");
EXTENSION("dba", "dba.c dba_cdb.c dba_db1.c dba_db2.c dba_db3.c dba_dbm.c dba_flatfile.c dba_gdbm.c dba_ndbm.c dba_inifile.c", null, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
ADD_SOURCES("ext/dba/libcdb", "cdb.c cdb_make.c uint32.c", "dba");
ADD_SOURCES("ext/dba/libflatfile", "flatfile.c", "dba");
ADD_SOURCES("ext/dba/libinifile", "inifile.c", "dba");

View File

@ -160,11 +160,7 @@ ZEND_END_MODULE_GLOBALS(dba)
ZEND_DECLARE_MODULE_GLOBALS(dba)
#ifdef ZTS
#define DBA_G(v) TSRMG(dba_globals_id, zend_dba_globals *, v)
#else
#define DBA_G(v) (dba_globals.v)
#endif
#define DBA_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(dba, v)
static PHP_GINIT_FUNCTION(dba);
@ -186,6 +182,9 @@ zend_module_entry dba_module_entry = {
};
#ifdef COMPILE_DL_DBA
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(dba)
#endif
@ -515,6 +514,9 @@ PHP_INI_END()
*/
static PHP_GINIT_FUNCTION(dba)
{
#if defined(COMPILE_DL_DBA) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
dba_globals->default_handler = "";
dba_globals->default_hptr = NULL;
}

View File

@ -112,7 +112,7 @@ PHP_ARG_WITH([imap-ssl],
if test "$PHP_IMAP" != "no"; then
PHP_SUBST(IMAP_SHARED_LIBADD)
PHP_NEW_EXTENSION(imap, php_imap.c, $ext_shared)
PHP_NEW_EXTENSION(imap, php_imap.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
AC_DEFINE(HAVE_IMAP,1,[ ])
for i in $PHP_IMAP /usr/local /usr; do

View File

@ -13,7 +13,7 @@ if (PHP_IMAP == "yes") {
CHECK_LIB("ws2_32.lib", "imap");
CHECK_LIB("Secur32.lib", "imap");
CHECK_LIB("crypt32.lib", "imap");
EXTENSION("imap", "php_imap.c", true);
EXTENSION("imap", "php_imap.c", true, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
ADD_FLAG("CFLAGS_IMAP", "/D HAVE_IMAP2000=1 /D HAVE_IMAP2004=1 /D HAVE_IMAP2007a=1 /D HAVE_IMAP2007b=1 /D HAVE_IMAP_SSL=1");
AC_DEFINE('HAVE_IMAP', 1, 'Have IMAP support', true);

View File

@ -592,6 +592,9 @@ zend_module_entry imap_module_entry = {
/* }}} */
#ifdef COMPILE_DL_IMAP
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(imap)
#endif
@ -808,6 +811,9 @@ void mail_getacl(MAILSTREAM *stream, char *mailbox, ACLLIST *alist)
*/
static PHP_GINIT_FUNCTION(imap)
{
#if defined(COMPILE_DL_IMAP) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
imap_globals->imap_user = NIL;
imap_globals->imap_password = NIL;

View File

@ -232,12 +232,13 @@ ZEND_BEGIN_MODULE_GLOBALS(imap)
zend_bool enable_rsh;
ZEND_END_MODULE_GLOBALS(imap)
#ifdef ZTS
# define IMAPG(v) TSRMG(imap_globals_id, zend_imap_globals *, v)
#else
# define IMAPG(v) (imap_globals.v)
#if defined(ZTS) && defined(COMPILE_DL_IMAP)
ZEND_TSRMLS_CACHE_EXTERN()
#endif
ZEND_EXTERN_MODULE_GLOBALS(imap)
#define IMAPG(v) ZEND_MODULE_GLOBALS_ACCESSOR(imap, v)
#else
#define imap_module_ptr NULL

View File

@ -96,7 +96,7 @@ PHP_ARG_WITH([ldap-sasl],
if test "$PHP_LDAP" != "no"; then
PHP_NEW_EXTENSION(ldap, ldap.c, $ext_shared,,-DLDAP_DEPRECATED=1)
PHP_NEW_EXTENSION(ldap, ldap.c, $ext_shared,,-DLDAP_DEPRECATED=1 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
if test "$PHP_LDAP" = "yes"; then
for i in /usr/local /usr; do

View File

@ -10,7 +10,7 @@ if (PHP_LDAP != "no") {
CHECK_LIB("oldap32_a.lib", "ldap", PHP_LDAP) &&
CHECK_LIB("olber32_a.lib", "ldap", PHP_LDAP)&&
CHECK_LIB("libsasl.lib", "ldap", PHP_LDAP)) {
EXTENSION('ldap', 'ldap.c');
EXTENSION('ldap', 'ldap.c', null, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
AC_DEFINE('HAVE_LDAP_PARSE_RESULT', 1);
AC_DEFINE('HAVE_LDAP_PARSE_REFERENCE', 1);

View File

@ -96,6 +96,9 @@ static PHP_GINIT_FUNCTION(ldap);
static int le_link, le_result, le_result_entry;
#ifdef COMPILE_DL_LDAP
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(ldap)
#endif
@ -661,6 +664,9 @@ PHP_INI_END()
*/
static PHP_GINIT_FUNCTION(ldap)
{
#if defined(COMPILE_DL_LDAP) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
ldap_globals->num_links = 0;
}
/* }}} */

View File

@ -43,12 +43,13 @@ ZEND_BEGIN_MODULE_GLOBALS(ldap)
zend_long max_links;
ZEND_END_MODULE_GLOBALS(ldap)
#ifdef ZTS
# define LDAPG(v) TSRMG(ldap_globals_id, zend_ldap_globals *, v)
#else
# define LDAPG(v) (ldap_globals.v)
#if defined(ZTS) && defined(COMPILE_DL_LDAP)
ZEND_TSRMLS_CACHE_EXTERN()
#endif
ZEND_EXTERN_MODULE_GLOBALS(ldap)
#define LDAPG(v) ZEND_MODULE_GLOBALS_ACCESSOR(ldap, v)
#define phpext_ldap_ptr ldap_module_ptr
/* Constants for ldap_modify_batch */

View File

@ -26,5 +26,5 @@ if test "$PHP_PCNTL" != "no"; then
AC_MSG_RESULT([no])
])
PHP_NEW_EXTENSION(pcntl, pcntl.c php_signal.c, $ext_shared, cli, $PCNTL_CFLAGS)
PHP_NEW_EXTENSION(pcntl, pcntl.c php_signal.c, $ext_shared, cli, $PCNTL_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
fi

View File

@ -238,6 +238,9 @@ zend_module_entry pcntl_module_entry = {
};
#ifdef COMPILE_DL_PCNTL
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(pcntl)
#endif
@ -576,6 +579,9 @@ static void php_pcntl_register_errno_constants(INIT_FUNC_ARGS)
static PHP_GINIT_FUNCTION(pcntl)
{
#if defined(COMPILE_DL_PCNTL) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
memset(pcntl_globals, 0, sizeof(*pcntl_globals));
}

View File

@ -91,12 +91,13 @@ ZEND_BEGIN_MODULE_GLOBALS(pcntl)
zend_bool async_signals;
ZEND_END_MODULE_GLOBALS(pcntl)
#ifdef ZTS
#define PCNTL_G(v) TSRMG(pcntl_globals_id, zend_pcntl_globals *, v)
#else
#define PCNTL_G(v) (pcntl_globals.v)
#if defined(ZTS) && defined(COMPILE_DL_PCNTL)
ZEND_TSRMLS_CACHE_EXTERN()
#endif
ZEND_EXTERN_MODULE_GLOBALS(pcntl)
#define PCNTL_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(pcntl, v)
#define REGISTER_PCNTL_ERRNO_CONSTANT(name) REGISTER_LONG_CONSTANT("PCNTL_" #name, name, CONST_CS | CONST_PERSISTENT)
#endif /* PHP_PCNTL_H */

View File

@ -71,7 +71,7 @@ if test "$PHP_PDO_DBLIB" != "no"; then
])
PDO_DBLIB_DEFS="-DPDO_DBLIB_FLAVOUR=\\\"freetds\\\""
PHP_NEW_EXTENSION(pdo_dblib, pdo_dblib.c dblib_driver.c dblib_stmt.c, $ext_shared,,-I$pdo_cv_inc_path $PDO_DBLIB_DEFS)
PHP_NEW_EXTENSION(pdo_dblib, pdo_dblib.c dblib_driver.c dblib_stmt.c, $ext_shared,,-I$pdo_cv_inc_path $PDO_DBLIB_DEFS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
AC_CHECK_LIB(dnet_stub, dnet_addr,
[ PHP_ADD_LIBRARY_WITH_PATH(dnet_stub,,PDO_DBLIB_SHARED_LIBADD)
AC_DEFINE(HAVE_LIBDNET_STUB,1,[ ])

View File

@ -10,7 +10,7 @@ if (PHP_PDO_DBLIB != "no") {
CHECK_HEADER_ADD_INCLUDE("sybfront.h", "CFLAGS_PDO_DBLIB",
PHP_PDO_DBLIB, null, null, true))
{
EXTENSION("pdo_dblib", "pdo_dblib.c dblib_driver.c dblib_stmt.c");
EXTENSION("pdo_dblib", "pdo_dblib.c dblib_driver.c dblib_stmt.c", null, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
ADD_FLAG('CFLAGS_PDO_DBLIB', "/D PDO_DBLIB_FLAVOUR=\\\"freetds\\\"");
ADD_EXTENSION_DEP('pdo_dblib', 'pdo');
} else {

View File

@ -71,6 +71,9 @@ zend_module_entry pdo_dblib_module_entry = {
};
#if defined(COMPILE_DL_PDO_DBLIB) || defined(COMPILE_DL_PDO_MSSQL)
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE()
#endif
#if PDO_DBLIB_IS_MSSQL
ZEND_GET_MODULE(pdo_mssql)
#else
@ -166,6 +169,9 @@ void pdo_dblib_err_dtor(pdo_dblib_err *err)
static PHP_GINIT_FUNCTION(dblib)
{
#if defined(ZTS) && (defined(COMPILE_DL_PDO_DBLIB) || defined(COMPILE_DL_PDO_MSSQL))
ZEND_TSRMLS_CACHE_UPDATE();
#endif
memset(dblib_globals, 0, sizeof(*dblib_globals));
dblib_globals->err.sqlstate = dblib_globals->sqlstate;
}

View File

@ -145,12 +145,13 @@ ZEND_BEGIN_MODULE_GLOBALS(dblib)
char sqlstate[6];
ZEND_END_MODULE_GLOBALS(dblib)
#ifdef ZTS
# define DBLIB_G(v) TSRMG(dblib_globals_id, zend_dblib_globals *, v)
#else
# define DBLIB_G(v) (dblib_globals.v)
#if defined(ZTS) && (defined(COMPILE_DL_PDO_DBLIB) || defined(COMPILE_DL_PDO_MSSQL))
ZEND_TSRMLS_CACHE_EXTERN()
#endif
ZEND_EXTERN_MODULE_GLOBALS(dblib)
#define DBLIB_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(dblib, v)
ZEND_EXTERN_MODULE_GLOBALS(dblib)
enum {

View File

@ -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])

View File

@ -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

View File

@ -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

View File

@ -59,5 +59,5 @@ recode_format_table();
PHP_ADD_INCLUDE($RECODE_DIR/$RECODE_INC)
PHP_SUBST(RECODE_SHARED_LIBADD)
AC_CHECK_HEADERS(stdbool.h)
PHP_NEW_EXTENSION(recode, recode.c, $ext_shared)
PHP_NEW_EXTENSION(recode, recode.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
fi

View File

@ -55,11 +55,7 @@ ZEND_BEGIN_MODULE_GLOBALS(recode)
RECODE_OUTER outer;
ZEND_END_MODULE_GLOBALS(recode)
#ifdef ZTS
# define ReSG(v) TSRMG(recode_globals_id, zend_recode_globals *, v)
#else
# define ReSG(v) (recode_globals.v)
#endif
#define ReSG(v) ZEND_MODULE_GLOBALS_ACCESSOR(recode, v)
ZEND_DECLARE_MODULE_GLOBALS(recode)
static PHP_GINIT_FUNCTION(recode);
@ -103,11 +99,17 @@ zend_module_entry recode_module_entry = {
};
#ifdef COMPILE_DL_RECODE
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(recode)
#endif
static PHP_GINIT_FUNCTION(recode)
{
#if defined(COMPILE_DL_RECODE) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
recode_globals->outer = NULL;
}

View File

@ -29,15 +29,13 @@ ZEND_BEGIN_MODULE_GLOBALS(sqlite3)
int dbconfig_defensive;
ZEND_END_MODULE_GLOBALS(sqlite3)
#ifdef ZTS
# define SQLITE3G(v) TSRMG(sqlite3_globals_id, zend_sqlite3_globals *, v)
# ifdef COMPILE_DL_SQLITE3
#if defined(ZTS) && defined(COMPILE_DL_SQLITE3)
ZEND_TSRMLS_CACHE_EXTERN()
# endif
#else
# define SQLITE3G(v) (sqlite3_globals.v)
#endif
ZEND_EXTERN_MODULE_GLOBALS(sqlite3)
#define SQLITE3G(v) ZEND_MODULE_GLOBALS_ACCESSOR(sqlite3, v)
#define PHP_SQLITE3_ASSOC 1<<0
#define PHP_SQLITE3_NUM 1<<1
#define PHP_SQLITE3_BOTH (PHP_SQLITE3_ASSOC|PHP_SQLITE3_NUM)