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/cgi/cgi_main.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'sapi/cgi/cgi_main.c') diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index dead1c3213..4c7ffceab0 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 -static int php_cgi_globals_id; +TSRMG_D(php_cgi_globals_struct, 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 - ts_allocate_id(&php_cgi_globals_id, sizeof(php_cgi_globals_struct), (ts_allocate_ctor) php_cgi_globals_ctor, NULL); + TSRMG_ALLOCATE(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 @@ -1719,7 +1719,7 @@ static zend_module_entry cgi_module_entry = { NULL, PHP_MINFO(cgi), NO_VERSION_YET, - STANDARD_MODULE_PROPERTIES + STANDARD_MODULE_PROPERTIES_EX }; /* {{{ main @@ -1741,10 +1741,6 @@ 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; @@ -1789,7 +1785,7 @@ int main(int argc, char *argv[]) #ifdef ZTS tsrm_startup(1, 1, 0, NULL); - tsrm_ls = ts_resource(0); + TSRMLS_INIT(); #endif sapi_startup(&cgi_sapi_module); -- cgit v1.2.1 From 6a5c006827bc4cbc98029c1c43ea038781dae942 Mon Sep 17 00:00:00 2001 From: krakjoe Date: Tue, 23 Sep 2014 12:46:16 +0100 Subject: correct macro --- sapi/cgi/cgi_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sapi/cgi/cgi_main.c') diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 4c7ffceab0..5f7b655dc6 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -1719,7 +1719,7 @@ static zend_module_entry cgi_module_entry = { NULL, PHP_MINFO(cgi), NO_VERSION_YET, - STANDARD_MODULE_PROPERTIES_EX + STANDARD_MODULE_PROPERTIES }; /* {{{ main -- 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/cgi/cgi_main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'sapi/cgi/cgi_main.c') 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); -- 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/cgi/cgi_main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sapi/cgi/cgi_main.c') diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index f06787543e..426c3a704e 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -198,7 +198,8 @@ static void user_config_cache_entry_dtor(zval *el) #ifdef ZTS static int php_cgi_globals_id; -#define CGIG(v) TSRMG(php_cgi_globals_id, php_cgi_globals_struct *, v) +#define CGIG(v) ZEND_TSRMG(php_cgi_globals_id, php_cgi_globals_struct *, v) +ZEND_TSRMLS_CACHE_DEFINE; #else static php_cgi_globals_struct php_cgi_globals; #define CGIG(v) (php_cgi_globals.v) @@ -1471,6 +1472,9 @@ PHP_INI_END() */ static void php_cgi_globals_ctor(php_cgi_globals_struct *php_cgi_globals TSRMLS_DC) { +#ifdef ZTS + ZEND_TSRMLS_CACHE_UPDATE; +#endif php_cgi_globals->rfc2616_headers = 0; php_cgi_globals->nph = 0; php_cgi_globals->check_shebang_line = 1; @@ -1795,6 +1799,7 @@ int main(int argc, char *argv[]) #ifdef ZTS tsrm_startup(1, 1, 0, NULL); tsrm_ls = ts_resource(0); + ZEND_TSRMLS_CACHE_UPDATE; #endif sapi_startup(&cgi_sapi_module); -- cgit v1.2.1 From aff66a94a631b5711549395bb282f61b6f6f9e49 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 15 Oct 2014 16:55:47 +0200 Subject: don't define tsrm ls in SAPIs under linux as it's compiled statically with the core --- sapi/cgi/cgi_main.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sapi/cgi/cgi_main.c') diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 426c3a704e..10c7fbf355 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -199,7 +199,9 @@ static void user_config_cache_entry_dtor(zval *el) #ifdef ZTS static int php_cgi_globals_id; #define CGIG(v) ZEND_TSRMG(php_cgi_globals_id, php_cgi_globals_struct *, v) +#if defined(PHP_WIN32) ZEND_TSRMLS_CACHE_DEFINE; +#endif #else static php_cgi_globals_struct php_cgi_globals; #define CGIG(v) (php_cgi_globals.v) -- 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 --- sapi/cgi/cgi_main.c | 170 ++++++++++++++++++++++++++-------------------------- 1 file changed, 85 insertions(+), 85 deletions(-) (limited to 'sapi/cgi/cgi_main.c') diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 94f35a6c83..283090d977 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -97,7 +97,7 @@ int __riscosify_control = __RISCOSIFY_STRICT_UNIX_SPECS; struct sigaction act, old_term, old_quit, old_int; #endif -static void (*php_php_import_environment_variables)(zval *array_ptr TSRMLS_DC); +static void (*php_php_import_environment_variables)(zval *array_ptr); #ifndef PHP_WIN32 /* these globals used for forking children on unix systems */ @@ -220,14 +220,14 @@ static php_cgi_globals_struct php_cgi_globals; #define TRANSLATE_SLASHES(path) #endif -static int print_module_info(zval *element TSRMLS_DC) +static int print_module_info(zval *element) { zend_module_entry *module = Z_PTR_P(element); php_printf("%s\n", module->name); return ZEND_HASH_APPLY_KEEP; } -static int module_name_cmp(const void *a, const void *b TSRMLS_DC) +static int module_name_cmp(const void *a, const void *b) { Bucket *f = (Bucket *) a; Bucket *s = (Bucket *) b; @@ -236,37 +236,37 @@ static int module_name_cmp(const void *a, const void *b TSRMLS_DC) ((zend_module_entry *)Z_PTR(s->val))->name); } -static void print_modules(TSRMLS_D) +static void print_modules(void) { HashTable sorted_registry; zend_hash_init(&sorted_registry, 64, NULL, NULL, 1); zend_hash_copy(&sorted_registry, &module_registry, NULL); - zend_hash_sort(&sorted_registry, zend_qsort, module_name_cmp, 0 TSRMLS_CC); - zend_hash_apply(&sorted_registry, print_module_info TSRMLS_CC); + zend_hash_sort(&sorted_registry, zend_qsort, module_name_cmp, 0); + zend_hash_apply(&sorted_registry, print_module_info); zend_hash_destroy(&sorted_registry); } -static int print_extension_info(zend_extension *ext, void *arg TSRMLS_DC) +static int print_extension_info(zend_extension *ext, void *arg) { php_printf("%s\n", ext->name); return 0; } -static int extension_name_cmp(const zend_llist_element **f, const zend_llist_element **s TSRMLS_DC) +static int extension_name_cmp(const zend_llist_element **f, const zend_llist_element **s) { return strcmp( ((zend_extension *)(*f)->data)->name, ((zend_extension *)(*s)->data)->name); } -static void print_extensions(TSRMLS_D) +static void print_extensions(void) { zend_llist sorted_exts; zend_llist_copy(&sorted_exts, &zend_extensions); sorted_exts.dtor = NULL; - zend_llist_sort(&sorted_exts, extension_name_cmp TSRMLS_CC); - zend_llist_apply_with_argument(&sorted_exts, (llist_apply_with_arg_func_t) print_extension_info, NULL TSRMLS_CC); + zend_llist_sort(&sorted_exts, extension_name_cmp); + zend_llist_apply_with_argument(&sorted_exts, (llist_apply_with_arg_func_t) print_extension_info, NULL); zend_llist_destroy(&sorted_exts); } @@ -274,7 +274,7 @@ static void print_extensions(TSRMLS_D) #define STDOUT_FILENO 1 #endif -static inline size_t sapi_cgi_single_write(const char *str, size_t str_length TSRMLS_DC) +static inline size_t sapi_cgi_single_write(const char *str, size_t str_length) { #ifdef PHP_WRITE_STDOUT int ret; @@ -290,14 +290,14 @@ static inline size_t sapi_cgi_single_write(const char *str, size_t str_length TS #endif } -static size_t sapi_cgi_ub_write(const char *str, size_t str_length TSRMLS_DC) +static size_t sapi_cgi_ub_write(const char *str, size_t str_length) { const char *ptr = str; size_t remaining = str_length; size_t ret; while (remaining > 0) { - ret = sapi_cgi_single_write(ptr, remaining TSRMLS_CC); + ret = sapi_cgi_single_write(ptr, remaining); if (!ret) { php_handle_aborted_connection(); return str_length - remaining; @@ -309,7 +309,7 @@ static size_t sapi_cgi_ub_write(const char *str, size_t str_length TSRMLS_DC) return str_length; } -static size_t sapi_fcgi_ub_write(const char *str, size_t str_length TSRMLS_DC) +static size_t sapi_fcgi_ub_write(const char *str, size_t str_length) { const char *ptr = str; size_t remaining = str_length; @@ -330,14 +330,14 @@ static size_t sapi_fcgi_ub_write(const char *str, size_t str_length TSRMLS_DC) return str_length; } -static void sapi_cgi_flush(void *server_context TSRMLS_DC) +static void sapi_cgi_flush(void *server_context) { if (fflush(stdout) == EOF) { php_handle_aborted_connection(); } } -static void sapi_fcgi_flush(void *server_context TSRMLS_DC) +static void sapi_fcgi_flush(void *server_context) { fcgi_request *request = (fcgi_request*) server_context; @@ -403,7 +403,7 @@ static const http_error http_error_codes[] = { {0, NULL} }; -static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) +static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers) { char buf[SAPI_CGI_MAX_HEADER_LENGTH]; sapi_header_struct *h; @@ -509,7 +509,7 @@ static int sapi_cgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) # define STDIN_FILENO 0 #endif -static size_t sapi_cgi_read_post(char *buffer, size_t count_bytes TSRMLS_DC) +static size_t sapi_cgi_read_post(char *buffer, size_t count_bytes) { size_t read_bytes = 0; int tmp_read_bytes; @@ -537,7 +537,7 @@ static size_t sapi_cgi_read_post(char *buffer, size_t count_bytes TSRMLS_DC) return read_bytes; } -static size_t sapi_fcgi_read_post(char *buffer, size_t count_bytes TSRMLS_DC) +static size_t sapi_fcgi_read_post(char *buffer, size_t count_bytes) { size_t read_bytes = 0; int tmp_read_bytes; @@ -560,12 +560,12 @@ static size_t sapi_fcgi_read_post(char *buffer, size_t count_bytes TSRMLS_DC) return read_bytes; } -static char *sapi_cgi_getenv(char *name, size_t name_len TSRMLS_DC) +static char *sapi_cgi_getenv(char *name, size_t name_len) { return getenv(name); } -static char *sapi_fcgi_getenv(char *name, size_t name_len TSRMLS_DC) +static char *sapi_fcgi_getenv(char *name, size_t name_len) { /* when php is started by mod_fastcgi, no regular environment * is provided to PHP. It is always sent to PHP at the start @@ -625,30 +625,30 @@ static char *_sapi_cgi_putenv(char *name, size_t name_len, char *value) return getenv(name); } -static char *sapi_cgi_read_cookies(TSRMLS_D) +static char *sapi_cgi_read_cookies(void) { return getenv("HTTP_COOKIE"); } -static char *sapi_fcgi_read_cookies(TSRMLS_D) +static char *sapi_fcgi_read_cookies(void) { fcgi_request *request = (fcgi_request*) SG(server_context); return FCGI_GETENV(request, "HTTP_COOKIE"); } -static void cgi_php_load_env_var(char *var, unsigned int var_len, char *val, unsigned int val_len, void *arg TSRMLS_DC) +static void cgi_php_load_env_var(char *var, unsigned int var_len, char *val, unsigned int val_len, void *arg) { zval *array_ptr = (zval*)arg; int filter_arg = (Z_ARR_P(array_ptr) == Z_ARR(PG(http_globals)[TRACK_VARS_ENV]))?PARSE_ENV:PARSE_SERVER; size_t new_val_len; - if (sapi_module.input_filter(filter_arg, var, &val, strlen(val), &new_val_len TSRMLS_CC)) { - php_register_variable_safe(var, val, new_val_len, array_ptr TSRMLS_CC); + if (sapi_module.input_filter(filter_arg, var, &val, strlen(val), &new_val_len)) { + php_register_variable_safe(var, val, new_val_len, array_ptr); } } -static void cgi_php_import_environment_variables(zval *array_ptr TSRMLS_DC) +static void cgi_php_import_environment_variables(zval *array_ptr) { if (Z_TYPE(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY && Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_ENV]) && @@ -667,15 +667,15 @@ static void cgi_php_import_environment_variables(zval *array_ptr TSRMLS_DC) } /* call php's original import as a catch-all */ - php_php_import_environment_variables(array_ptr TSRMLS_CC); + php_php_import_environment_variables(array_ptr); if (fcgi_is_fastcgi()) { fcgi_request *request = (fcgi_request*) SG(server_context); - fcgi_loadenv(request, cgi_php_load_env_var, array_ptr TSRMLS_CC); + fcgi_loadenv(request, cgi_php_load_env_var, array_ptr); } } -static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC) +static void sapi_cgi_register_variables(zval *track_vars_array) { size_t php_self_len; char *php_self; @@ -683,7 +683,7 @@ static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC) /* In CGI mode, we consider the environment to be a part of the server * variables */ - php_import_environment_variables(track_vars_array TSRMLS_CC); + php_import_environment_variables(track_vars_array); if (CGIG(fix_pathinfo)) { char *script_name = SG(request_info).request_uri; @@ -726,8 +726,8 @@ static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC) } /* Build the special-case PHP_SELF variable for the CGI version */ - if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &php_self, php_self_len, &php_self_len TSRMLS_CC)) { - php_register_variable_safe("PHP_SELF", php_self, php_self_len, track_vars_array TSRMLS_CC); + if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &php_self, php_self_len, &php_self_len)) { + php_register_variable_safe("PHP_SELF", php_self, php_self_len, track_vars_array); } if (free_php_self) { free_alloca(php_self, use_heap); @@ -735,13 +735,13 @@ static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC) } else { php_self = SG(request_info).request_uri ? SG(request_info).request_uri : ""; php_self_len = strlen(php_self); - if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &php_self, php_self_len, &php_self_len TSRMLS_CC)) { - php_register_variable_safe("PHP_SELF", php_self, php_self_len, track_vars_array TSRMLS_CC); + if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &php_self, php_self_len, &php_self_len)) { + php_register_variable_safe("PHP_SELF", php_self, php_self_len, track_vars_array); } } } -static void sapi_cgi_log_message(char *message TSRMLS_DC) +static void sapi_cgi_log_message(char *message) { if (fcgi_is_fastcgi() && CGIG(fcgi_logging)) { fcgi_request *request; @@ -766,11 +766,11 @@ static void sapi_cgi_log_message(char *message TSRMLS_DC) /* {{{ php_cgi_ini_activate_user_config */ -static void php_cgi_ini_activate_user_config(char *path, size_t path_len, const char *doc_root, size_t doc_root_len, int start TSRMLS_DC) +static void php_cgi_ini_activate_user_config(char *path, size_t path_len, const char *doc_root, size_t doc_root_len, int start) { char *ptr; user_config_cache_entry *new_entry, *entry; - time_t request_time = (time_t)sapi_get_request_time(TSRMLS_C); + time_t request_time = (time_t)sapi_get_request_time(); /* Find cached config entry: If not found, create one */ if ((entry = zend_hash_str_find_ptr(&CGIG(user_config_cache), path, path_len)) == NULL) { @@ -792,7 +792,7 @@ static void php_cgi_ini_activate_user_config(char *path, size_t path_len, const zend_hash_clean(entry->user_config); if (!IS_ABSOLUTE_PATH(path, path_len)) { - real_path = tsrm_realpath(path, NULL TSRMLS_CC); + real_path = tsrm_realpath(path, NULL); if (real_path == NULL) { return; } @@ -823,12 +823,12 @@ static void php_cgi_ini_activate_user_config(char *path, size_t path_len, const ptr = s2 + start; /* start is the point where doc_root ends! */ while ((ptr = strchr(ptr, DEFAULT_SLASH)) != NULL) { *ptr = 0; - php_parse_user_ini_file(path, PG(user_ini_filename), entry->user_config TSRMLS_CC); + php_parse_user_ini_file(path, PG(user_ini_filename), entry->user_config); *ptr = '/'; ptr++; } } else { - php_parse_user_ini_file(path, PG(user_ini_filename), entry->user_config TSRMLS_CC); + php_parse_user_ini_file(path, PG(user_ini_filename), entry->user_config); } if (real_path) { @@ -838,11 +838,11 @@ static void php_cgi_ini_activate_user_config(char *path, size_t path_len, const } /* Activate ini entries with values from the user config hash */ - php_ini_activate_config(entry->user_config, PHP_INI_PERDIR, PHP_INI_STAGE_HTACCESS TSRMLS_CC); + php_ini_activate_config(entry->user_config, PHP_INI_PERDIR, PHP_INI_STAGE_HTACCESS); } /* }}} */ -static int sapi_cgi_activate(TSRMLS_D) +static int sapi_cgi_activate(void) { char *path, *doc_root, *server_name; size_t path_len, doc_root_len, server_name_len; @@ -866,7 +866,7 @@ static int sapi_cgi_activate(TSRMLS_D) server_name_len = strlen(server_name); server_name = estrndup(server_name, server_name_len); zend_str_tolower(server_name, server_name_len); - php_ini_activate_per_host_config(server_name, server_name_len TSRMLS_CC); + php_ini_activate_per_host_config(server_name, server_name_len); efree(server_name); } } @@ -890,7 +890,7 @@ static int sapi_cgi_activate(TSRMLS_D) path[path_len] = 0; /* Activate per-dir-system-configuration defined in php.ini and stored into configuration_hash during startup */ - php_ini_activate_per_dir_config(path, path_len TSRMLS_CC); /* Note: for global settings sake we check from root to path */ + php_ini_activate_per_dir_config(path, path_len); /* Note: for global settings sake we check from root to path */ /* Load and activate user ini files in path starting from DOCUMENT_ROOT */ if (PG(user_ini_filename) && *PG(user_ini_filename)) { @@ -912,7 +912,7 @@ static int sapi_cgi_activate(TSRMLS_D) doc_root = estrndup(doc_root, doc_root_len); zend_str_tolower(doc_root, doc_root_len); #endif - php_cgi_ini_activate_user_config(path, path_len, doc_root, doc_root_len, (doc_root_len > 0 && (doc_root_len - 1)) TSRMLS_CC); + php_cgi_ini_activate_user_config(path, path_len, doc_root, doc_root_len, (doc_root_len > 0 && (doc_root_len - 1))); #ifdef PHP_WIN32 efree(doc_root); @@ -926,7 +926,7 @@ static int sapi_cgi_activate(TSRMLS_D) return SUCCESS; } -static int sapi_cgi_deactivate(TSRMLS_D) +static int sapi_cgi_deactivate(void) { /* flush only when SAPI was started. The reasons are: 1. SAPI Deactivate is called from two places: module init and request shutdown @@ -942,7 +942,7 @@ static int sapi_cgi_deactivate(TSRMLS_D) php_handle_aborted_connection(); } } else { - sapi_cgi_flush(SG(server_context) TSRMLS_CC); + sapi_cgi_flush(SG(server_context)); } } return SUCCESS; @@ -1149,7 +1149,7 @@ static int is_valid_path(const char *path) Comments in the code below refer to using the above URL in a request */ -static void init_request_info(fcgi_request *request TSRMLS_DC) +static void init_request_info(fcgi_request *request) { char *env_script_filename = CGI_GETENV("SCRIPT_FILENAME"); char *env_path_translated = CGI_GETENV("PATH_TRANSLATED"); @@ -1249,7 +1249,7 @@ static void init_request_info(fcgi_request *request TSRMLS_DC) #ifdef PHP_WIN32 script_path_translated[script_path_translated_len-1] == '\\' || #endif - (real_path = tsrm_realpath(script_path_translated, NULL TSRMLS_CC)) == NULL) + (real_path = tsrm_realpath(script_path_translated, NULL)) == NULL) ) { char *pt = estrndup(script_path_translated, script_path_translated_len); size_t len = script_path_translated_len; @@ -1439,7 +1439,7 @@ static void init_request_info(fcgi_request *request TSRMLS_DC) /* The CGI RFC allows servers to pass on unvalidated Authorization data */ auth = CGI_GETENV("HTTP_AUTHORIZATION"); - php_handle_auth_data(auth TSRMLS_CC); + php_handle_auth_data(auth); } } /* }}} */ @@ -1483,7 +1483,7 @@ PHP_INI_END() /* {{{ php_cgi_globals_ctor */ -static void php_cgi_globals_ctor(php_cgi_globals_struct *php_cgi_globals TSRMLS_DC) +static void php_cgi_globals_ctor(php_cgi_globals_struct *php_cgi_globals) { #ifdef ZTS ZEND_TSRMLS_CACHE_UPDATE; @@ -1510,7 +1510,7 @@ static PHP_MINIT_FUNCTION(cgi) #ifdef ZTS 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); + php_cgi_globals_ctor(&php_cgi_globals); #endif REGISTER_INI_ENTRIES(); return SUCCESS; @@ -1547,7 +1547,7 @@ PHP_FUNCTION(apache_child_terminate) /* {{{ */ } /* }}} */ -static void add_request_header(char *var, unsigned int var_len, char *val, unsigned int val_len, void *arg TSRMLS_DC) /* {{{ */ +static void add_request_header(char *var, unsigned int var_len, char *val, unsigned int val_len, void *arg) /* {{{ */ { zval *return_value = (zval*)arg; char *str = NULL; @@ -1604,7 +1604,7 @@ PHP_FUNCTION(apache_request_headers) /* {{{ */ if (fcgi_is_fastcgi()) { fcgi_request *request = (fcgi_request*) SG(server_context); - fcgi_loadenv(request, add_request_header, return_value TSRMLS_CC); + fcgi_loadenv(request, add_request_header, return_value); } else { char buf[128]; char **env, *p, *q, *var, *val, *t = buf; @@ -1678,7 +1678,7 @@ PHP_FUNCTION(apache_request_headers) /* {{{ */ } /* }}} */ -static void add_response_header(sapi_header_struct *h, zval *return_value TSRMLS_DC) /* {{{ */ +static void add_response_header(sapi_header_struct *h, zval *return_value) /* {{{ */ { char *s, *p; size_t len = 0; @@ -1718,7 +1718,7 @@ PHP_FUNCTION(apache_response_headers) /* {{{ */ RETURN_FALSE; } array_init(return_value); - zend_llist_apply_with_argument(&SG(sapi_headers).headers, (llist_apply_with_arg_func_t)add_response_header, return_value TSRMLS_CC); + zend_llist_apply_with_argument(&SG(sapi_headers).headers, (llist_apply_with_arg_func_t)add_response_header, return_value); } /* }}} */ @@ -2145,7 +2145,7 @@ consult the installation file that came with this distribution, or visit \n\ no_headers = 1; SG(headers_sent) = 1; php_cgi_usage(argv[0]); - php_output_end_all(TSRMLS_C); + php_output_end_all(); exit_status = 0; goto out; } @@ -2164,7 +2164,7 @@ consult the installation file that came with this distribution, or visit \n\ #endif while (!fastcgi || fcgi_accept_request(request) >= 0) { SG(server_context) = fastcgi ? (void *) request : (void *) 1; - init_request_info(request TSRMLS_CC); + init_request_info(request); if (!cgi && !fastcgi) { while ((c = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0, 2)) != -1) { @@ -2194,16 +2194,16 @@ consult the installation file that came with this distribution, or visit \n\ if (script_file) { efree(script_file); } - if (php_request_startup(TSRMLS_C) == FAILURE) { + if (php_request_startup() == FAILURE) { SG(server_context) = NULL; - php_module_shutdown(TSRMLS_C); + php_module_shutdown(); return FAILURE; } if (no_headers) { SG(headers_sent) = 1; SG(request_info).no_headers = 1; } - php_print_info(0xFFFFFFFF TSRMLS_CC); + php_print_info(0xFFFFFFFF); php_request_shutdown((void *) 0); fcgi_shutdown(); exit_status = 0; @@ -2220,11 +2220,11 @@ consult the installation file that came with this distribution, or visit \n\ } SG(headers_sent) = 1; php_printf("[PHP Modules]\n"); - print_modules(TSRMLS_C); + print_modules(); php_printf("\n[Zend Modules]\n"); - print_extensions(TSRMLS_C); + print_extensions(); php_printf("\n"); - php_output_end_all(TSRMLS_C); + php_output_end_all(); fcgi_shutdown(); exit_status = 0; goto out; @@ -2244,9 +2244,9 @@ consult the installation file that came with this distribution, or visit \n\ efree(script_file); } no_headers = 1; - if (php_request_startup(TSRMLS_C) == FAILURE) { + if (php_request_startup() == FAILURE) { SG(server_context) = NULL; - php_module_shutdown(TSRMLS_C); + php_module_shutdown(); return FAILURE; } if (no_headers) { @@ -2268,7 +2268,7 @@ consult the installation file that came with this distribution, or visit \n\ break; case 'z': /* load extension file */ - zend_load_extension(php_optarg TSRMLS_CC); + zend_load_extension(php_optarg); break; default: @@ -2353,12 +2353,12 @@ consult the installation file that came with this distribution, or visit \n\ /* request startup only after we've done all we can to * get path_translated */ - if (php_request_startup(TSRMLS_C) == FAILURE) { + if (php_request_startup() == FAILURE) { if (fastcgi) { fcgi_finish_request(request, 1); } SG(server_context) = NULL; - php_module_shutdown(TSRMLS_C); + php_module_shutdown(); return FAILURE; } if (no_headers) { @@ -2372,7 +2372,7 @@ consult the installation file that came with this distribution, or visit \n\ 2. we are running as cgi or fastcgi */ if (cgi || fastcgi || SG(request_info).path_translated) { - if (php_fopen_primary_script(&file_handle TSRMLS_CC) == FAILURE) { + if (php_fopen_primary_script(&file_handle) == FAILURE) { zend_try { if (errno == EACCES) { SG(sapi_headers).http_response_code = 403; @@ -2399,7 +2399,7 @@ consult the installation file that came with this distribution, or visit \n\ php_request_shutdown((void *) 0); SG(server_context) = NULL; - php_module_shutdown(TSRMLS_C); + php_module_shutdown(); sapi_shutdown(); #ifdef ZTS tsrm_shutdown(); @@ -2482,11 +2482,11 @@ consult the installation file that came with this distribution, or visit \n\ switch (behavior) { case PHP_MODE_STANDARD: - php_execute_script(&file_handle TSRMLS_CC); + php_execute_script(&file_handle); break; case PHP_MODE_LINT: PG(during_request_startup) = 0; - exit_status = php_lint_script(&file_handle TSRMLS_CC); + exit_status = php_lint_script(&file_handle); if (exit_status == SUCCESS) { zend_printf("No syntax errors detected in %s\n", file_handle.filename); } else { @@ -2494,9 +2494,9 @@ consult the installation file that came with this distribution, or visit \n\ } break; case PHP_MODE_STRIP: - if (open_file_for_scanning(&file_handle TSRMLS_CC) == SUCCESS) { - zend_strip(TSRMLS_C); - zend_file_handle_dtor(&file_handle TSRMLS_CC); + if (open_file_for_scanning(&file_handle) == SUCCESS) { + zend_strip(); + zend_file_handle_dtor(&file_handle); php_output_teardown(); } return SUCCESS; @@ -2505,13 +2505,13 @@ consult the installation file that came with this distribution, or visit \n\ { zend_syntax_highlighter_ini syntax_highlighter_ini; - if (open_file_for_scanning(&file_handle TSRMLS_CC) == SUCCESS) { + if (open_file_for_scanning(&file_handle) == SUCCESS) { php_get_highlight_struct(&syntax_highlighter_ini); - zend_highlight(&syntax_highlighter_ini TSRMLS_CC); + zend_highlight(&syntax_highlighter_ini); if (fastcgi) { goto fastcgi_request_done; } - zend_file_handle_dtor(&file_handle TSRMLS_CC); + zend_file_handle_dtor(&file_handle); php_output_teardown(); } return SUCCESS; @@ -2520,9 +2520,9 @@ consult the installation file that came with this distribution, or visit \n\ #if 0 /* Zeev might want to do something with this one day */ case PHP_MODE_INDENT: - open_file_for_scanning(&file_handle TSRMLS_CC); - zend_indent(TSRMLS_C); - zend_file_handle_dtor(&file_handle TSRMLS_CC); + open_file_for_scanning(&file_handle); + zend_indent(); + zend_file_handle_dtor(&file_handle); php_output_teardown(); return SUCCESS; break; @@ -2627,7 +2627,7 @@ parent_out: #endif SG(server_context) = NULL; - php_module_shutdown(TSRMLS_C); + php_module_shutdown(); sapi_shutdown(); #ifdef ZTS -- cgit v1.2.1