summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
Diffstat (limited to 'sapi')
-rw-r--r--sapi/apache/php_apache.c2
-rw-r--r--sapi/apache2handler/php_apache.h2
-rw-r--r--sapi/apache2handler/php_functions.c4
-rw-r--r--sapi/apache2handler/sapi_apache2.c3
-rw-r--r--sapi/apache_hooks/php_apache.c2
-rw-r--r--sapi/cgi/cgi_main.c10
-rw-r--r--sapi/cli/php_cli.c5
-rw-r--r--sapi/cli/php_cli_server.c14
-rw-r--r--sapi/cli/php_cli_server.h1
-rw-r--r--sapi/embed/php_embed.c7
-rw-r--r--sapi/embed/php_embed.h6
11 files changed, 32 insertions, 24 deletions
diff --git a/sapi/apache/php_apache.c b/sapi/apache/php_apache.c
index 05bf75b226..f6e9e61203 100644
--- a/sapi/apache/php_apache.c
+++ b/sapi/apache/php_apache.c
@@ -129,7 +129,7 @@ static void php_apache_globals_ctor(php_apache_info_struct *apache_globals TSRML
static PHP_MINIT_FUNCTION(apache)
{
#ifdef ZTS
- TSRMG_ALLOCATE(php_apache_info_id, sizeof(php_apache_info_struct), (ts_allocate_ctor) php_apache_globals_ctor, NULL);
+ ts_allocate_id(&php_apache_info_id, sizeof(php_apache_info_struct), (ts_allocate_ctor) php_apache_globals_ctor, NULL);
#else
php_apache_globals_ctor(&php_apache_info TSRMLS_CC);
#endif
diff --git a/sapi/apache2handler/php_apache.h b/sapi/apache2handler/php_apache.h
index 26ddf222c4..f6f4f7a7c9 100644
--- a/sapi/apache2handler/php_apache.h
+++ b/sapi/apache2handler/php_apache.h
@@ -78,7 +78,7 @@ typedef struct {
extern zend_module_entry apache2_module_entry;
#ifdef ZTS
-TSRMG_DHE(php_apache2_info_struct, php_apache2_info_id);
+extern int php_apache2_info_id;
#define AP2(v) TSRMG(php_apache2_info_id, php_apache2_info_struct *, v)
#else
extern php_apache2_info_struct php_apache2_info;
diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c
index 3fc88edfbc..d9ae4d97ea 100644
--- a/sapi/apache2handler/php_functions.c
+++ b/sapi/apache2handler/php_functions.c
@@ -49,7 +49,7 @@
#include "php_apache.h"
#ifdef ZTS
-TSRMG_DE(php_apache2_info_struct, php_apache2_info_id);
+int php_apache2_info_id;
#else
php_apache2_info_struct php_apache2_info;
#endif
@@ -536,7 +536,7 @@ PHP_INI_END()
static PHP_MINIT_FUNCTION(apache)
{
#ifdef ZTS
- TSRMG_ALLOCATE(php_apache2_info_id, sizeof(php_apache2_info_struct), NULL, NULL);
+ ts_allocate_id(&php_apache2_info_id, sizeof(php_apache2_info_struct), (ts_allocate_ctor) NULL, NULL);
#endif
REGISTER_INI_ENTRIES();
return SUCCESS;
diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c
index 86372e126d..fe200304fd 100644
--- a/sapi/apache2handler/sapi_apache2.c
+++ b/sapi/apache2handler/sapi_apache2.c
@@ -451,7 +451,6 @@ php_apache_server_startup(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp
}
#ifdef ZTS
tsrm_startup(1, 1, 0, NULL);
- TSRMLS_INIT();
#endif
sapi_startup(&apache2_sapi_module);
apache2_sapi_module.startup(&apache2_sapi_module);
@@ -541,7 +540,7 @@ static int php_handler(request_rec *r)
apr_bucket *bucket;
apr_status_t rv;
request_rec * volatile parent_req = NULL;
- TSRMLS_INIT();
+ TSRMLS_FETCH();
#define PHPAP_INI_OFF php_apache_ini_dtor(r, parent_req TSRMLS_CC);
diff --git a/sapi/apache_hooks/php_apache.c b/sapi/apache_hooks/php_apache.c
index 771ebf821c..e5bd3f5d61 100644
--- a/sapi/apache_hooks/php_apache.c
+++ b/sapi/apache_hooks/php_apache.c
@@ -1392,7 +1392,7 @@ static PHP_MINIT_FUNCTION(apache)
zend_class_entry ce;
#ifdef ZTS
- TSRMG_ALLOCATE(php_apache_info_id, sizeof(php_apache_info_struct), (ts_allocate_ctor) php_apache_globals_ctor, NULL);
+ ts_allocate_id(&php_apache_info_id, sizeof(php_apache_info_struct), (ts_allocate_ctor) php_apache_globals_ctor, NULL);
#else
php_apache_globals_ctor(&php_apache_info TSRMLS_CC);
#endif
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 5f7b655dc6..dead1c3213 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -197,7 +197,7 @@ static void user_config_cache_entry_dtor(zval *el)
/* }}} */
#ifdef ZTS
-TSRMG_D(php_cgi_globals_struct, php_cgi_globals_id);
+static int php_cgi_globals_id;
#define CGIG(v) TSRMG(php_cgi_globals_id, php_cgi_globals_struct *, v)
#else
static php_cgi_globals_struct php_cgi_globals;
@@ -1486,7 +1486,7 @@ static void php_cgi_globals_ctor(php_cgi_globals_struct *php_cgi_globals TSRMLS_
static PHP_MINIT_FUNCTION(cgi)
{
#ifdef ZTS
- TSRMG_ALLOCATE(php_cgi_globals_id, sizeof(php_cgi_globals_struct), (ts_allocate_ctor) php_cgi_globals_ctor, NULL);
+ ts_allocate_id(&php_cgi_globals_id, sizeof(php_cgi_globals_struct), (ts_allocate_ctor) php_cgi_globals_ctor, NULL);
#else
php_cgi_globals_ctor(&php_cgi_globals TSRMLS_CC);
#endif
@@ -1741,6 +1741,10 @@ int main(int argc, char *argv[])
int ini_entries_len = 0;
/* end of temporary locals */
+#ifdef ZTS
+ void ***tsrm_ls;
+#endif
+
int max_requests = 500;
int requests = 0;
int fastcgi;
@@ -1785,7 +1789,7 @@ int main(int argc, char *argv[])
#ifdef ZTS
tsrm_startup(1, 1, 0, NULL);
- TSRMLS_INIT();
+ tsrm_ls = ts_resource(0);
#endif
sapi_startup(&cgi_sapi_module);
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 8c9792162b..19e56284e3 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -1177,6 +1177,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
int main(int argc, char *argv[])
#endif
{
+#ifdef ZTS
+ void ***tsrm_ls;
+#endif
#ifdef PHP_CLI_WIN32_NO_CONSOLE
int argc = __argc;
char **argv = __argv;
@@ -1232,7 +1235,7 @@ int main(int argc, char *argv[])
#ifdef ZTS
tsrm_startup(1, 1, 0, NULL);
- TSRMLS_INIT();
+ tsrm_ls = ts_resource_ex(0, NULL);
#endif
#ifdef PHP_WIN32
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index 13ebcf0b8e..1e42bd6c7b 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -1188,11 +1188,8 @@ static void php_cli_server_logf(const char *format TSRMLS_DC, ...) /* {{{ */
{
char *buf = NULL;
va_list ap;
-#ifdef PASS_TSRMLS
- va_start(ap, tsrm_ls);
-#else
+
va_start(ap, format);
-#endif
vspprintf(&buf, 0, format, ap);
va_end(ap);
@@ -2353,7 +2350,7 @@ static int php_cli_server_send_event(php_cli_server *server, php_cli_server_clie
/* }}} */
typedef struct php_cli_server_do_event_for_each_fd_callback_params {
-#ifdef PASS_TSRMLS
+#ifdef ZTS
void ***tsrm_ls;
#endif
php_cli_server *server;
@@ -2364,6 +2361,9 @@ typedef struct php_cli_server_do_event_for_each_fd_callback_params {
static int php_cli_server_do_event_for_each_fd_callback(void *_params, php_socket_t fd, int event) /* {{{ */
{
php_cli_server_do_event_for_each_fd_callback_params *params = _params;
+#ifdef ZTS
+ void ***tsrm_ls = params->tsrm_ls;
+#endif
php_cli_server *server = params->server;
if (server->server_sock == fd) {
php_cli_server_client *client = NULL;
@@ -2415,8 +2415,8 @@ static int php_cli_server_do_event_for_each_fd_callback(void *_params, php_socke
static void php_cli_server_do_event_for_each_fd(php_cli_server *server, int(*rhandler)(php_cli_server*, php_cli_server_client* TSRMLS_DC), int(*whandler)(php_cli_server*, php_cli_server_client* TSRMLS_DC) TSRMLS_DC) /* {{{ */
{
php_cli_server_do_event_for_each_fd_callback_params params = {
-#ifdef PASS_TSRMLS
- tsrm_ls,
+#ifdef ZTS
+ (void ***) tsrm_get_ls_cache(),
#endif
server,
rhandler,
diff --git a/sapi/cli/php_cli_server.h b/sapi/cli/php_cli_server.h
index e970008d79..476ee2919c 100644
--- a/sapi/cli/php_cli_server.h
+++ b/sapi/cli/php_cli_server.h
@@ -33,7 +33,6 @@ ZEND_END_MODULE_GLOBALS(cli_server)
#ifdef ZTS
#define CLI_SERVER_G(v) TSRMG(cli_server_globals_id, zend_cli_server_globals *, v)
-TSRMG_DHE(zend_cli_server_globals, cli_server_globals_id);
#else
#define CLI_SERVER_G(v) (cli_server_globals.v)
#endif
diff --git a/sapi/embed/php_embed.c b/sapi/embed/php_embed.c
index 1884604b77..e0df666108 100644
--- a/sapi/embed/php_embed.c
+++ b/sapi/embed/php_embed.c
@@ -155,6 +155,9 @@ static const zend_function_entry additional_functions[] = {
EMBED_SAPI_API int php_embed_init(int argc, char **argv PTSRMLS_DC)
{
zend_llist global_vars;
+#ifdef ZTS
+ void ***tsrm_ls = NULL;
+#endif
#ifdef HAVE_SIGNAL_H
#if defined(SIGPIPE) && defined(SIG_IGN)
@@ -169,8 +172,8 @@ EMBED_SAPI_API int php_embed_init(int argc, char **argv PTSRMLS_DC)
#ifdef ZTS
tsrm_startup(1, 1, 0, NULL);
- TSRMLS_INIT();
- *ptsrm_ls = ts_resource_ex(0, NULL);
+ tsrm_ls = ts_resource(0);
+ *ptsrm_ls = tsrm_ls;
#endif
sapi_startup(&php_embed_module);
diff --git a/sapi/embed/php_embed.h b/sapi/embed/php_embed.h
index a109a1bba2..b62fd9fe24 100644
--- a/sapi/embed/php_embed.h
+++ b/sapi/embed/php_embed.h
@@ -27,14 +27,14 @@
#include <main/php_ini.h>
#include <zend_ini.h>
-#ifdef PASS_TSRMLS
-#define PTSRMLS_D void ***ptsrm_ls
+#ifdef ZTS
+#define PTSRMLS_D void ****ptsrm_ls
#define PTSRMLS_DC , PTSRMLS_D
#define PTSRMLS_C &tsrm_ls
#define PTSRMLS_CC , PTSRMLS_C
#define PHP_EMBED_START_BLOCK(x,y) { \
- void **tsrm_ls; \
+ void ***tsrm_ls; \
php_embed_init(x, y PTSRMLS_CC); \
zend_first_try {