From b3aebda9eaf55706af2e21178f229a171725a168 Mon Sep 17 00:00:00 2001 From: krakjoe Date: Sat, 20 Sep 2014 20:22:14 +0100 Subject: native tls initial patch --- sapi/apache2handler/php_apache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sapi/apache2handler/php_apache.h') diff --git a/sapi/apache2handler/php_apache.h b/sapi/apache2handler/php_apache.h index f6f4f7a7c9..674eb9fbc6 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 -extern int php_apache2_info_id; +TSRMG_DH(php_apache2_info_struct, 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; -- cgit v1.2.1 From 4db75dc8533a69e8849651ab5d0fa84efa3d8bba Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 22 Sep 2014 20:58:45 +0200 Subject: basic windows fix --- sapi/apache2handler/php_apache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sapi/apache2handler/php_apache.h') diff --git a/sapi/apache2handler/php_apache.h b/sapi/apache2handler/php_apache.h index 674eb9fbc6..26ddf222c4 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_DH(php_apache2_info_struct, php_apache2_info_id); +TSRMG_DHE(php_apache2_info_struct, 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; -- cgit v1.2.1 From d11734b4b00f57de80d931ad1c522e00082443af Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 25 Sep 2014 18:48:27 +0200 Subject: reworked the patch, less new stuff but worky TLS is already used in TSRM, the way exporting the tsrm cache through a thread local variable is not portable. Additionally, the current patch suffers from bugs which are hard to find, but prevent it to be worky with apache. What is done here is mainly uses the idea from the RFC patch, but - __thread variable is removed - offset math and declarations are removed - extra macros and definitions are removed What is done merely is - use an inline function to access the tsrm cache. The function uses the portable tsrm_tls_get macro which is cheap - all the TSRM_* macros are set to placebo. Thus this opens the way remove them later Except that, the logic is old. TSRMLS_FETCH will have to be done once per thread, then tsrm_get_ls_cache() can be used. Things seeming to be worky are cli, cli server and apache. I also tried to enable bz2 shared and it has worked out of the box. The change is yet minimal diffing to the current master bus is a worky start, IMHO. Though will have to recheck the other previously done SAPIs - embed and cgi. The offsets can be added to the tsrm_resource_type struct, then it'll not be needed to declare them in the userspace. Even the "done" member type can be changed to int16 or smaller, then adding the offset as int16 will not change the struct size. As well on the todo might be removing the hashed storage, thread_id != thread_id and linked list logic in favour of the explicit TLS operations. --- sapi/apache2handler/php_apache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sapi/apache2handler/php_apache.h') 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; -- cgit v1.2.1 From 8aeffdd74c826b5012c9b052848cfa8e593776ed Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 15 Oct 2014 16:33:40 +0200 Subject: moved most of the core to use static tsrm ls cache pointer plus apache2handler, cli and cgi --- sapi/apache2handler/php_apache.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sapi/apache2handler/php_apache.h') diff --git a/sapi/apache2handler/php_apache.h b/sapi/apache2handler/php_apache.h index f6f4f7a7c9..da20072b14 100644 --- a/sapi/apache2handler/php_apache.h +++ b/sapi/apache2handler/php_apache.h @@ -79,7 +79,8 @@ extern zend_module_entry apache2_module_entry; #ifdef ZTS extern int php_apache2_info_id; -#define AP2(v) TSRMG(php_apache2_info_id, php_apache2_info_struct *, v) +#define AP2(v) ZEND_TSRMG(php_apache2_info_id, php_apache2_info_struct *, v) +ZEND_TSRMLS_CACHE_EXTERN; #else extern php_apache2_info_struct php_apache2_info; #define AP2(v) (php_apache2_info.v) -- cgit v1.2.1