From a85da45a66d05047ab66669622990e652c719f8d Mon Sep 17 00:00:00 2001 From: Zeev Suraski Date: Sat, 13 Jan 2001 23:49:44 +0000 Subject: [PATCH] Both thread-safe and thread-unsafe builds should be ok now --- ext/standard/basic_functions.c | 3 +-- ext/standard/file.c | 18 ++++++++++++++++-- ext/standard/file.h | 3 ++- ext/standard/fsock.c | 13 ------------- ext/standard/fsock.h | 2 -- 5 files changed, 19 insertions(+), 20 deletions(-) diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 4ed1a2d8cf..7221f83dc9 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -710,7 +710,6 @@ PHP_MINIT_FUNCTION(basic) PHP_MINIT(regex)(INIT_FUNC_ARGS_PASSTHRU); PHP_MINIT(file)(INIT_FUNC_ARGS_PASSTHRU); - PHP_MINIT(fsock)(INIT_FUNC_ARGS_PASSTHRU); PHP_MINIT(pack)(INIT_FUNC_ARGS_PASSTHRU); PHP_MINIT(browscap)(INIT_FUNC_ARGS_PASSTHRU); PHP_MINIT(lcg)(INIT_FUNC_ARGS_PASSTHRU); @@ -763,13 +762,13 @@ PHP_MSHUTDOWN_FUNCTION(basic) UNREGISTER_INI_ENTRIES(); PHP_MSHUTDOWN(regex)(SHUTDOWN_FUNC_ARGS_PASSTHRU); - PHP_MSHUTDOWN(fsock)(SHUTDOWN_FUNC_ARGS_PASSTHRU); PHP_MSHUTDOWN(browscap)(SHUTDOWN_FUNC_ARGS_PASSTHRU); PHP_MSHUTDOWN(array)(SHUTDOWN_FUNC_ARGS_PASSTHRU); PHP_MSHUTDOWN(assert)(SHUTDOWN_FUNC_ARGS_PASSTHRU); #ifdef TRANS_SID PHP_MSHUTDOWN(url_scanner_ex)(SHUTDOWN_FUNC_ARGS_PASSTHRU); #endif + PHP_MSHUTDOWN(file)(SHUTDOWN_FUNC_ARGS_PASSTHRU); return SUCCESS; } diff --git a/ext/standard/file.c b/ext/standard/file.c index 590e6dee0f..c8d605b41e 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -149,7 +149,6 @@ PHPAPI int php_file_le_socket(void) /* XXX doe we really want this???? */ } -#ifdef ZTS static void file_globals_ctor(FLS_D) { zend_hash_init(&FG(ht_fsock_keys), 0, NULL, NULL, 1); @@ -159,13 +158,15 @@ static void file_globals_ctor(FLS_D) FG(fgetss_state) = 0; FG(pclose_ret) = 0; } + + static void file_globals_dtor(FLS_D) { zend_hash_destroy(&FG(ht_fsock_socks)); zend_hash_destroy(&FG(ht_fsock_keys)); php_cleanup_sockbuf(1 FLS_CC); } -#endif + PHP_MINIT_FUNCTION(file) { @@ -191,6 +192,19 @@ PHP_MINIT_FUNCTION(file) } /* }}} */ + +PHP_MSHUTDOWN_FUNCTION(file) +{ +#ifndef ZTS + FLS_FETCH(); + + file_globals_dtor(FLS_C); +#endif + return SUCCESS; +} + + + /* {{{ proto bool flock(int fp, int operation [, int wouldblock]) Portable file locking */ diff --git a/ext/standard/file.h b/ext/standard/file.h index 4559a322a0..d1b58d937c 100644 --- a/ext/standard/file.h +++ b/ext/standard/file.h @@ -23,7 +23,8 @@ #ifndef FILE_H #define FILE_H -extern PHP_MINIT_FUNCTION(file); +PHP_MINIT_FUNCTION(file); +PHP_MSHUTDOWN_FUNCTION(file); PHP_FUNCTION(tempnam); PHP_NAMED_FUNCTION(php_if_tmpfile); diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index 39e9d06111..60679fe541 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -715,19 +715,6 @@ void php_msock_destroy(int *data) /* }}} */ -PHP_MINIT_FUNCTION(fsock) -{ - return SUCCESS; -} - -PHP_MSHUTDOWN_FUNCTION(fsock) -{ -#ifndef ZTS - fsock_globals_dtor(FLS_C); -#endif - return SUCCESS; -} - PHP_RSHUTDOWN_FUNCTION(fsock) { FLS_FETCH(); diff --git a/ext/standard/fsock.h b/ext/standard/fsock.h index 9ee369eb62..2ea86613a9 100644 --- a/ext/standard/fsock.h +++ b/ext/standard/fsock.h @@ -87,8 +87,6 @@ void php_cleanup_sockbuf(int persistent FLS_DC); PHPAPI int connect_nonb(int sockfd, struct sockaddr *addr, socklen_t addrlen, struct timeval *timeout); PHPAPI struct php_sockbuf *php_get_socket(int socket); -PHP_MINIT_FUNCTION(fsock); -PHP_MSHUTDOWN_FUNCTION(fsock); PHP_RSHUTDOWN_FUNCTION(fsock); #endif /* FSOCK_H */ -- 2.40.0