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 --- main/php.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main/php.h') diff --git a/main/php.h b/main/php.h index 2a683e1924..224a65dd82 100644 --- a/main/php.h +++ b/main/php.h @@ -301,7 +301,7 @@ static inline ZEND_ATTRIBUTE_DEPRECATED void php_std_error_handling() {} PHPAPI void php_verror(const char *docref, const char *params, int type, const char *format, va_list args TSRMLS_DC) PHP_ATTRIBUTE_FORMAT(printf, 4, 0); -#ifdef ZTS +#ifdef PASS_TSRMLS #define PHP_ATTR_FMT_OFFSET 1 #else #define PHP_ATTR_FMT_OFFSET 0 -- 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. --- main/php.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main/php.h') diff --git a/main/php.h b/main/php.h index 224a65dd82..2a683e1924 100644 --- a/main/php.h +++ b/main/php.h @@ -301,7 +301,7 @@ static inline ZEND_ATTRIBUTE_DEPRECATED void php_std_error_handling() {} PHPAPI void php_verror(const char *docref, const char *params, int type, const char *format, va_list args TSRMLS_DC) PHP_ATTRIBUTE_FORMAT(printf, 4, 0); -#ifdef PASS_TSRMLS +#ifdef ZTS #define PHP_ATTR_FMT_OFFSET 1 #else #define PHP_ATTR_FMT_OFFSET 0 -- cgit v1.2.1 From bdeb220f48825642f84cdbf3ff23a30613c92e86 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sat, 13 Dec 2014 23:06:14 +0100 Subject: first shot remove TSRMLS_* things --- main/php.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'main/php.h') diff --git a/main/php.h b/main/php.h index 2a683e1924..515d1bb9c1 100644 --- a/main/php.h +++ b/main/php.h @@ -280,11 +280,11 @@ ssize_t pread(int, void *, size_t, off64_t); BEGIN_EXTERN_C() void phperror(char *error); -PHPAPI size_t php_write(void *buf, size_t size TSRMLS_DC); +PHPAPI size_t php_write(void *buf, size_t size); PHPAPI size_t php_printf(const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1, 2); PHPAPI int php_get_module_initialized(void); -PHPAPI void php_log_err(char *log_message TSRMLS_DC); +PHPAPI void php_log_err(char *log_message); int Debug(char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1, 2); int cfgparse(void); END_EXTERN_C() @@ -293,13 +293,13 @@ END_EXTERN_C() #define error_handling_t zend_error_handling_t BEGIN_EXTERN_C() -static inline ZEND_ATTRIBUTE_DEPRECATED void php_set_error_handling(error_handling_t error_handling, zend_class_entry *exception_class TSRMLS_DC) +static inline ZEND_ATTRIBUTE_DEPRECATED void php_set_error_handling(error_handling_t error_handling, zend_class_entry *exception_class) { - zend_replace_error_handling(error_handling, exception_class, NULL TSRMLS_CC); + zend_replace_error_handling(error_handling, exception_class, NULL); } static inline ZEND_ATTRIBUTE_DEPRECATED void php_std_error_handling() {} -PHPAPI void php_verror(const char *docref, const char *params, int type, const char *format, va_list args TSRMLS_DC) PHP_ATTRIBUTE_FORMAT(printf, 4, 0); +PHPAPI void php_verror(const char *docref, const char *params, int type, const char *format, va_list args) PHP_ATTRIBUTE_FORMAT(printf, 4, 0); #ifdef ZTS #define PHP_ATTR_FMT_OFFSET 1 @@ -308,14 +308,14 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c #endif /* PHPAPI void php_error(int type, const char *format, ...); */ -PHPAPI void php_error_docref0(const char *docref TSRMLS_DC, int type, const char *format, ...) +PHPAPI void php_error_docref0(const char *docref, int type, const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, PHP_ATTR_FMT_OFFSET + 3, PHP_ATTR_FMT_OFFSET + 4); -PHPAPI void php_error_docref1(const char *docref TSRMLS_DC, const char *param1, int type, const char *format, ...) +PHPAPI void php_error_docref1(const char *docref, const char *param1, int type, const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, PHP_ATTR_FMT_OFFSET + 4, PHP_ATTR_FMT_OFFSET + 5); -PHPAPI void php_error_docref2(const char *docref TSRMLS_DC, const char *param1, const char *param2, int type, const char *format, ...) +PHPAPI void php_error_docref2(const char *docref, const char *param1, const char *param2, int type, const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, PHP_ATTR_FMT_OFFSET + 5, PHP_ATTR_FMT_OFFSET + 6); #ifdef PHP_WIN32 -PHPAPI void php_win32_docref2_from_error(DWORD error, const char *param1, const char *param2 TSRMLS_DC); +PHPAPI void php_win32_docref2_from_error(DWORD error, const char *param1, const char *param2); #endif END_EXTERN_C() @@ -332,12 +332,12 @@ END_EXTERN_C() /* functions */ BEGIN_EXTERN_C() -PHPAPI extern int (*php_register_internal_extensions_func)(TSRMLS_D); -PHPAPI int php_register_internal_extensions(TSRMLS_D); -PHPAPI int php_mergesort(void *base, size_t nmemb, register size_t size, int (*cmp)(const void *, const void * TSRMLS_DC) TSRMLS_DC); +PHPAPI extern int (*php_register_internal_extensions_func)(void); +PHPAPI int php_register_internal_extensions(void); +PHPAPI int php_mergesort(void *base, size_t nmemb, register size_t size, int (*cmp)(const void *, const void *)); PHPAPI void php_register_pre_request_shutdown(void (*func)(void *), void *userdata); -PHPAPI void php_com_initialize(TSRMLS_D); -PHPAPI char *php_get_current_user(TSRMLS_D); +PHPAPI void php_com_initialize(void); +PHPAPI char *php_get_current_user(void); END_EXTERN_C() /* PHP-named Zend macro wrappers */ -- cgit v1.2.1