diff options
author | Anatol Belski <ab@php.net> | 2014-09-22 20:58:45 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-09-22 20:58:45 +0200 |
commit | 4db75dc8533a69e8849651ab5d0fa84efa3d8bba (patch) | |
tree | c9157b7b61f70e35ed94e7457ee06fbaa0221cc3 | |
parent | f2e636de051f2891a492d3ceaabc3afd6f930c7f (diff) | |
download | php-git-4db75dc8533a69e8849651ab5d0fa84efa3d8bba.tar.gz |
basic windows fix
-rw-r--r-- | TSRM/TSRM.c | 14 | ||||
-rw-r--r-- | TSRM/TSRM.h | 32 | ||||
-rw-r--r-- | TSRM/tsrm_win32.c | 2 | ||||
-rw-r--r-- | TSRM/tsrm_win32.h | 1 | ||||
-rw-r--r-- | Zend/zend.h | 5 | ||||
-rw-r--r-- | Zend/zend_API.h | 2 | ||||
-rw-r--r-- | ext/date/php_date.h | 1 | ||||
-rw-r--r-- | sapi/apache2handler/php_apache.h | 2 | ||||
-rw-r--r-- | sapi/apache2handler/php_functions.c | 2 | ||||
-rw-r--r-- | sapi/cli/php_cli_server.c | 2 | ||||
-rw-r--r-- | sapi/cli/php_cli_server.h | 2 | ||||
-rw-r--r-- | win32/globals.c | 2 | ||||
-rw-r--r-- | win32/php_win32_globals.h | 2 |
13 files changed, 46 insertions, 23 deletions
diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c index 6b0bf445e9..3bd66b3cf7 100644 --- a/TSRM/TSRM.c +++ b/TSRM/TSRM.c @@ -63,11 +63,7 @@ static int tsrm_error_level; static FILE *tsrm_error_file; #ifdef USE___THREAD -#ifdef TSRM_WIN32 TSRM_TLS void *tsrm_ls_cache = 0; -#else -TSRM_API TSRM_TLS void *tsrm_ls_cache = 0; -#endif #endif #ifdef PASS_TSRMLS @@ -833,4 +829,14 @@ void tsrm_error_set(int level, char *debug_filename) #endif } +TSRM_API void *get_tsrm_ls_cache(void) +{ + return tsrm_ls_cache; +} + +TSRM_API void set_tsrm_ls_cache(void **cache) +{ + tsrm_ls_cache = *cache; +} + #endif /* ZTS */ diff --git a/TSRM/TSRM.h b/TSRM/TSRM.h index 840c303d6c..765d5d44a0 100644 --- a/TSRM/TSRM.h +++ b/TSRM/TSRM.h @@ -26,10 +26,13 @@ # else # define TSRM_API __declspec(dllimport) # endif +# define TSRM_EXP_API __declspec(dllexport) #elif defined(__GNUC__) && __GNUC__ >= 4 # define TSRM_API __attribute__ ((visibility("default"))) +# define TSRM_EXP_API TSRM_API #else # define TSRM_API +# define TSRM_EXP_API #endif #ifdef _WIN64 @@ -109,16 +112,14 @@ extern "C" { # define TSRM_TLS __thread # endif -#ifdef TSRM_WIN32 -extern TSRM_TLS void *tsrm_ls_cache; -#else -TSRM_API extern TSRM_TLS void *tsrm_ls_cache; -#endif - #define TSRMG(id, type, element) \ - ((type)((tsrm_uintptr_t)tsrm_ls_cache + id##_offset))->element + ((type)((tsrm_uintptr_t) get_tsrm_ls_cache() + id##_offset))->element + +#define TSRMLS_INIT() do { \ + void *cache = (void *) ts_resource_ex(0, NULL); \ + set_tsrm_ls_cache(&cache); \ + } while (0) -#define TSRMLS_INIT() tsrm_ls_cache = (void *) ts_resource_ex(0, NULL); #define TSRMLS_FETCH() #define TSRMLS_FETCH_FROM_CTX(ctx) #define TSRMLS_SET_CTX(ctx) @@ -145,13 +146,21 @@ TSRM_API extern TSRM_TLS void *tsrm_ls_cache; #endif /* USE___THREAD */ +#define TSRMG_DHE(type, id) \ + TSRM_EXP_API extern ts_rsrc_id id; \ + TSRM_EXP_API extern ts_rsrc_offset id##_offset + +#define TSRMG_DE(type, id) \ + TSRM_EXP_API ts_rsrc_id id; \ + TSRM_EXP_API ts_rsrc_offset id##_offset + #define TSRMG_DH(type, id) \ TSRM_API extern ts_rsrc_id id; \ - TSRM_API extern ts_rsrc_offset id##_offset; + TSRM_API extern ts_rsrc_offset id##_offset #define TSRMG_D(type, id) \ TSRM_API ts_rsrc_id id; \ - TSRM_API ts_rsrc_offset id##_offset; + TSRM_API ts_rsrc_offset id##_offset #define TSRMG_ALLOCATE(id, size, ctor, dtor) \ TSRMG_ALLOCATE_EX(id, id##_offset, size, ctor, dtor); @@ -216,6 +225,9 @@ TSRM_API void *tsrm_new_interpreter_context(void); TSRM_API void *tsrm_set_interpreter_context(void *new_ctx); TSRM_API void tsrm_free_interpreter_context(void *context); +TSRM_API void *get_tsrm_ls_cache(void); +TSRM_API void set_tsrm_ls_cache(void **tsrm_ls_cache); + #ifdef __cplusplus } #endif diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c index 78712e769b..7002802cb8 100644 --- a/TSRM/tsrm_win32.c +++ b/TSRM/tsrm_win32.c @@ -35,7 +35,7 @@ #include "zend_virtual_cwd.h" #ifdef ZTS -static ts_rsrc_id win32_globals_id; +TSRMG_D(win32_globals, win32_globals_id); #else static tsrm_win32_globals win32_globals; #endif diff --git a/TSRM/tsrm_win32.h b/TSRM/tsrm_win32.h index 5933b54ddf..a78937a34a 100644 --- a/TSRM/tsrm_win32.h +++ b/TSRM/tsrm_win32.h @@ -69,6 +69,7 @@ typedef struct { #ifdef ZTS # define TWG(v) TSRMG(win32_globals_id, tsrm_win32_globals *, v) +TSRMG_DH(win32_globals, win32_globals_id); #else # define TWG(v) (win32_globals.v) #endif diff --git a/Zend/zend.h b/Zend/zend.h index 517d419665..7fa66cde55 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -71,6 +71,11 @@ void zend_error_noreturn(int type, const char *format, ...) ZEND_NORETURN; # define zend_error_noreturn zend_error #endif +#ifdef ZTS +TSRMG_DH(zend_compiler_globals, compiler_globals_id); +TSRMG_DH(zend_executor_globals, executor_globals_id); +#endif + /* overloaded elements data types */ #define OE_IS_ARRAY (1<<0) #define OE_IS_OBJECT (1<<1) diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 4c920ae9ac..1e41ecdd18 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -145,7 +145,7 @@ typedef struct _zend_fcall_info_cache { #ifdef ZTS #define ZEND_DECLARE_MODULE_GLOBALS(module_name) \ - TSRMG_D(zend_##module_name##_globals, module_name##_globals_id); + TSRMG_DE(zend_##module_name##_globals, module_name##_globals_id); #define ZEND_EXTERN_MODULE_GLOBALS(module_name) \ TSRMG_DH(zend_##module_name##_globals, module_name##_globals_id); #define ZEND_INIT_MODULE_GLOBALS(module_name, globals_ctor, globals_dtor) \ diff --git a/ext/date/php_date.h b/ext/date/php_date.h index aa46aa1b6c..a49a4c26b0 100644 --- a/ext/date/php_date.h +++ b/ext/date/php_date.h @@ -197,6 +197,7 @@ ZEND_BEGIN_MODULE_GLOBALS(date) ZEND_END_MODULE_GLOBALS(date) #ifdef ZTS +TSRMG_DH(zend_date_globals, date_globals_id); #define DATEG(v) TSRMG(date_globals_id, zend_date_globals *, v) #else #define DATEG(v) (date_globals.v) 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; diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c index 9529b708a6..3fc88edfbc 100644 --- a/sapi/apache2handler/php_functions.c +++ b/sapi/apache2handler/php_functions.c @@ -49,7 +49,7 @@ #include "php_apache.h" #ifdef ZTS -TSRMG_D(php_apache2_info_struct, php_apache2_info_id); +TSRMG_DE(php_apache2_info_struct, php_apache2_info_id); #else php_apache2_info_struct php_apache2_info; #endif diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index eb4dde4d0e..13ebcf0b8e 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -112,8 +112,6 @@ #define OUTPUT_IS_TTY 1 #define OUTPUT_NOT_TTY 0 -TSRMG_D(zend_cli_server_globals, cli_server_globals_id); - typedef struct php_cli_server_poller { fd_set rfds, wfds; struct { diff --git a/sapi/cli/php_cli_server.h b/sapi/cli/php_cli_server.h index 55810fcfbc..e970008d79 100644 --- a/sapi/cli/php_cli_server.h +++ b/sapi/cli/php_cli_server.h @@ -33,7 +33,7 @@ ZEND_END_MODULE_GLOBALS(cli_server) #ifdef ZTS #define CLI_SERVER_G(v) TSRMG(cli_server_globals_id, zend_cli_server_globals *, v) -TSRMG_DH(zend_cli_server_globals, cli_server_globals_id); +TSRMG_DHE(zend_cli_server_globals, cli_server_globals_id); #else #define CLI_SERVER_G(v) (cli_server_globals.v) #endif diff --git a/win32/globals.c b/win32/globals.c index ec4180db38..47f4ebacce 100644 --- a/win32/globals.c +++ b/win32/globals.c @@ -23,7 +23,7 @@ #include "syslog.h" #ifdef ZTS -PHPAPI int php_win32_core_globals_id; +TSRMG_D(php_win32_core_globals, php_win32_core_globals_id); #else php_win32_core_globals the_php_win32_core_globals; #endif diff --git a/win32/php_win32_globals.h b/win32/php_win32_globals.h index 42f5ec9411..ae975dcb31 100644 --- a/win32/php_win32_globals.h +++ b/win32/php_win32_globals.h @@ -27,7 +27,7 @@ typedef struct _php_win32_core_globals php_win32_core_globals; #ifdef ZTS # define PW32G(v) TSRMG(php_win32_core_globals_id, php_win32_core_globals*, v) -extern PHPAPI int php_win32_core_globals_id; +TSRMG_DH(php_win32_core_globals, php_win32_core_globals_id); #else # define PW32G(v) (the_php_win32_core_globals.v) extern PHPAPI struct _php_win32_core_globals the_php_win32_core_globals; |