CVS update: php31/main

From: Date: Wed, 23 Sep 1998 01:00:40 +0000
Subject: CVS update: php31/main
Groups: php.dev 
Request: Send a blank email to php-dev+get-1428@lists.php.net to get a copy of this message
Date: Tuesday September 22, 1998 @ 21:00 Author: shane Update of /repository/php31/main In directory asf:/u2/tmp/cvs-serv3443/main Modified Files: main.c mtparser.bat php3_threads.h Log Message: some fixes Index: php31/main/main.c diff -c php31/main/main.c:2.40 php31/main/main.c:2.41 *** php31/main/main.c:2.40 Tue Sep 22 15:19:47 1998 --- php31/main/main.c Tue Sep 22 21:00:32 1998 *************** *** 29,35 **** +----------------------------------------------------------------------+ */ ! /* $Id: main.c,v 2.40 1998/09/22 19:19:47 shane Exp $ */ /* #define CRASH_DETECTION */ --- 29,35 ---- +----------------------------------------------------------------------+ */ ! /* $Id: main.c,v 2.41 1998/09/23 01:00:32 shane Exp $ */ /* #define CRASH_DETECTION */ *************** *** 236,242 **** ! /*wrapper for modules to use PHPWRITE */ PHPAPI int php3_write(void *buf, int size) { TLS_VARS; --- 236,242 ---- ! /* wrapper for modules to use PHPWRITE */ PHPAPI int php3_write(void *buf, int size) { TLS_VARS; *************** *** 415,426 **** return 0; } /* FIXME? Do we realy want to abort the script if the client is ! no longer alive? That could reek havoc in someone's script. ! for now, letting the script finish. ! if (!GLOBAL(client_alive)) { ! GLOBAL(shutdown_requested) = ABNORMAL_SHUTDOWN; ! return 0; ! } */ #ifdef THREAD_SAFE --- 415,427 ---- return 0; } /* FIXME? Do we realy want to abort the script if the client is ! * no longer alive? That could reek havoc in someone's script. ! * for now, letting the script finish. ! * ! * if (!GLOBAL(client_alive)) { ! * GLOBAL(shutdown_requested) = ABNORMAL_SHUTDOWN; ! * return 0; ! * } */ #ifdef THREAD_SAFE *************** *** 521,537 **** /* * Copy the master php3_ini struct into the request copy */ - /* for now we'll simply copy the master ini into the request ini - later, well come up with some idea for a per directory ini file. - - Probably have to add a sapi callback to the server module. We - could set a ini variable to tell us wether or not to make that - call. Will need to do this before apache directives will - work again. ! Note this is called before request startup, so we dont use ! emalloc. We have to free this at the end of this request. */ GLOBAL(php3_ini) = _php3_copy_ini_master(); #if defined(CRASH_DETECTION) --- 522,540 ---- /* * Copy the master php3_ini struct into the request copy */ ! /* for now we'll simply copy the master ini into the request ini ! * later, well come up with some idea for a per directory ini file. ! * ! * Probably have to add a sapi callback to the server module. We ! * could set a ini variable to tell us wether or not to make that ! * call. Will need to do this before apache directives will ! * work again. ! * ! * Note this is called before request startup, so we dont use ! * emalloc. We have to free this at the end of this request. */ + GLOBAL(php3_ini) = _php3_copy_ini_master(); #if defined(CRASH_DETECTION) *************** *** 543,549 **** GLOBAL(initialized) = 0; ! /*get the server config from the registry, if we are using that */ #if WIN32|WINNT if (php3_ini_master.use_registry) { _reg_get_server_config(GLOBAL(sapi_rqst)->server_name _INLINE_TLS); --- 546,552 ---- GLOBAL(initialized) = 0; ! /* get the server config from the registry, if we are using that */ #if WIN32|WINNT if (php3_ini_master.use_registry) { _reg_get_server_config(GLOBAL(sapi_rqst)->server_name _INLINE_TLS); *************** *** 561,570 **** * * FIXME, we need to figure out how to handle this for other servers, * meanwhile am commenting out. ! */ ! //GLOBAL(sapi_rqst)->blockalarms(SAPI_GLOBAL_PASS_V); ! //GLOBAL(sapi_rqst)->register_clean(SAPI_GLOBAL_PASS NULL, php3_request_shutdown, php3_request_shutdown_for_exec); ! //GLOBAL(sapi_rqst)->unblockalarms(SAPI_GLOBAL_PASS_V); /* initialize global variables */ { --- 564,575 ---- * * FIXME, we need to figure out how to handle this for other servers, * meanwhile am commenting out. ! ! GLOBAL(sapi_rqst)->blockalarms(SAPI_GLOBAL_PASS_V); ! GLOBAL(sapi_rqst)->register_clean(SAPI_GLOBAL_PASS NULL, php3_request_shutdown, php3_request_shutdown_for_exec); ! GLOBAL(sapi_rqst)->unblockalarms(SAPI_GLOBAL_PASS_V); ! ! */ /* initialize global variables */ { *************** *** 680,686 **** GLOBAL(error_reporting) = 0; /* FIXME this should only be called in sapi_thread_end or sapi_process_end ! memory_manager_mshutdown();*/ } --- 685,693 ---- GLOBAL(error_reporting) = 0; /* FIXME this should only be called in sapi_thread_end or sapi_process_end ! ! memory_manager_mshutdown(); ! */ } *************** *** 852,861 **** debug_log("%d:timer unset\n", GetCurrentThreadId()); #endif - /* FIXME free up per-server config */ - #if WIN32|WINNT - /*_reg_free_server_config();*/ - #endif /* FIXME ok we're freeing the ini now */ free(GLOBAL(php3_ini)); --- 859,864 ---- *************** *** 920,926 **** int php3_module_startup(INLINE_TLS_VOID) { ! #ifdef THREAD_SAFE /* FIXME * this is simply to prevent accidentaly double calling startup, * should be removed at some point when we are closer to being --- 923,929 ---- int php3_module_startup(INLINE_TLS_VOID) { ! #if 0 && THREAD_SAFE /* FIXME * this is simply to prevent accidentaly double calling startup, * should be removed at some point when we are closer to being *************** *** 931,937 **** } #endif ! #if HAVE_SETLOCALE setlocale(LC_CTYPE, ""); #endif --- 934,940 ---- } #endif ! #if 0 && HAVE_SETLOCALE /* set in sapi_process_startup */ setlocale(LC_CTYPE, ""); #endif *************** *** 1222,1227 **** --- 1225,1231 ---- /* for registry cache, only needed for process start/end */ extern void *reg_mutex; extern void _reg_clear_cache(void); + #define USE_EXCEPTION #endif PHPAPI int _php3_sapi_process_start(php3_module_entry * module_info) *************** *** 1230,1237 **** php3_globals_struct *php3_globals; #endif - start_memory_manager(); - #if WIN32|WINNT _fmode = _O_BINARY; /* sets default for file streams to binary */ /* make the stdio mode be binary */ --- 1234,1239 ---- *************** *** 1257,1262 **** --- 1259,1265 ---- return 0; } + if (!PHP3_TLS_THREAD_INIT(TlsIndex, php3_globals, php3_globals_struct)) { return 0; } *************** *** 1267,1272 **** --- 1270,1282 ---- #endif return 0; } + + #endif + + start_memory_manager(); + + #ifdef THREAD_SAFE + #if defined(CRASH_DETECTION) debug_log("%d:TLS Init Success\n", GetCurrentThreadId()); #endif *************** *** 1321,1328 **** php3_globals_struct *php3_globals; #endif - start_memory_manager(); - #ifdef THREAD_SAFE #if defined(CRASH_DETECTION) debug_log("########################\n%d:Thread Start\n", GetCurrentThreadId()); --- 1331,1336 ---- *************** *** 1338,1343 **** --- 1346,1357 ---- #endif return 0; } + + #endif + + start_memory_manager(); + + #ifdef THREAD_SAFE if (!yy_init_tls()) return 0; *************** *** 1346,1352 **** #if WIN32|WINNT ! _fmode = _O_BINARY; /*sets default for file streams to binary */ #endif /* make a temporary php3_ini for startup */ --- 1360,1366 ---- #if WIN32|WINNT ! _fmode = _O_BINARY; /* sets default for file streams to binary */ #endif /* make a temporary php3_ini for startup */ *************** *** 1355,1365 **** memory_manager_mshutdown(); return 0; } ! /*load dl's from ini file */ #ifdef THREAD_SAFE php3_dlload(_INLINE_TLS_VOID); #endif ! /*register server specific functions */ if (module_info) { module_info->type = MODULE_PERSISTENT; _php3_load_module(module_info, NULL); --- 1369,1379 ---- memory_manager_mshutdown(); return 0; } ! /* load dl's from ini file */ #ifdef THREAD_SAFE php3_dlload(_INLINE_TLS_VOID); #endif ! /* register server specific functions */ if (module_info) { module_info->type = MODULE_PERSISTENT; _php3_load_module(module_info, NULL); *************** *** 1469,1478 **** PHP3_TLS_GET(TlsIndex, php3_globals); if (!php3_globals) { /* ! something is realy screwed up if we get here. ! send output to the browser manualy, because nothing in ! php is or can be initialized, but we can because sapi ! is (should be) initialized */ sapi_info->send_header(SAPI_GLOBAL_PASS_V); PUTS("IIS Internal Error: Thread could not initialized!"); --- 1483,1492 ---- PHP3_TLS_GET(TlsIndex, php3_globals); if (!php3_globals) { /* ! * something is realy screwed up if we get here. ! * send output to the browser manualy, because nothing in ! * php is or can be initialized, but we can because sapi ! * is (should be) initialized */ sapi_info->send_header(SAPI_GLOBAL_PASS_V); PUTS("IIS Internal Error: Thread could not initialized!"); *************** *** 1524,1532 **** } } /* ! if sapi_rqst.filename is null and cgi, fopen_for_parser is responsible ! sapi_rqst.filename will only be estrduped in fopen_for parser ! if it is null at this point */ #if defined(CRASH_DETECTION) debug_log("%d:opening file %s\n", GetCurrentThreadId(), sapi_info->filename); --- 1538,1546 ---- } } /* ! * if sapi_rqst.filename is null and cgi, fopen_for_parser is responsible ! * sapi_rqst.filename will only be estrduped in fopen_for parser ! * if it is null at this point */ #if defined(CRASH_DETECTION) debug_log("%d:opening file %s\n", GetCurrentThreadId(), sapi_info->filename); *************** *** 1593,1600 **** #if defined(USE_EXCEPTION) __try { ! /*use an exception handler here to try and protect ! against dl's that may be bad */ #endif if (in) --- 1607,1615 ---- #if defined(USE_EXCEPTION) __try { ! /* use an exception handler here to try and protect ! * against dl's that may be bad ! */ #endif if (in) *************** *** 1604,1616 **** #if defined(USE_EXCEPTION) } __except(EXCEPTION_EXECUTE_HANDLER) { ! int i = 0; /*dummy statement */ #if MSVC5 char logmessage[80]; snprintf(logmessage, 79, "%d:php3_parse exception\n", GetCurrentThreadId()); OutputDebugString(logmessage); #endif ! /*lets let this request try to shut down normaly */ } #endif --- 1619,1631 ---- #if defined(USE_EXCEPTION) } __except(EXCEPTION_EXECUTE_HANDLER) { ! int i = 0; /* dummy statement */ #if MSVC5 char logmessage[80]; snprintf(logmessage, 79, "%d:php3_parse exception\n", GetCurrentThreadId()); OutputDebugString(logmessage); #endif ! /* lets let this request try to shut down normaly */ } #endif Index: php31/main/mtparser.bat diff -c php31/main/mtparser.bat:2.3 php31/main/mtparser.bat:2.4 *** php31/main/mtparser.bat:2.3 Tue Sep 15 17:58:13 1998 --- php31/main/mtparser.bat Tue Sep 22 21:00:35 1998 *************** *** 1,11 **** @echo off echo !!!!!!!!!!! No need to use this anymore, integrated into MSVC !!!!!!!!!!!!!! ! bison -S bison.simple -p php -v -d language-parser.y plex -x -m %3 -Pphp -olanguage-scanner.c -i language-scanner.l ! bison.exe -p ini -v -d ini-parser.y ! echo Bison Done ! flex.exe -Pini -oini-scanner.c -i ini-scanner.l ! echo Flex Done copy ini-parser.tab.h ini-parser.h copy language-parser.tab.h language-parser.h --- 1,13 ---- @echo off echo !!!!!!!!!!! No need to use this anymore, integrated into MSVC !!!!!!!!!!!!!! ! echo Generating language parser ! bison -S ./bison.php.simple -p php -v -d language-parser.y ! echo Generating language scanner plex -x -m %3 -Pphp -olanguage-scanner.c -i language-scanner.l ! echo Generating ini parser ! bison -p ini -v -d ini-parser.y ! echo Generating ini scanner ! flex -Pini -oini-scanner.c -i ini-scanner.l copy ini-parser.tab.h ini-parser.h copy language-parser.tab.h language-parser.h Index: php31/main/php3_threads.h diff -c php31/main/php3_threads.h:2.2 php31/main/php3_threads.h:2.3 *** php31/main/php3_threads.h:2.2 Mon Sep 14 12:56:32 1998 --- php31/main/php3_threads.h Tue Sep 22 21:00:39 1998 *************** *** 22,29 **** # define TLS_GET_DATA(a,b) b=TlsGetValue(a) # define TLS_SET_DATA(a,b) TlsSetValue(a,b) # define TLS_FREE(a) TlsFree(a) ! # define TLS_MALLOC(a) LocalAlloc(LPTR, a) ! # define TLS_MFREE(a) LocalFree((HLOCAL) a) # else /*PTHREADS this all needs to be scrutinized before use! */ # define MUTEX_T pthread_mutex_t * --- 22,29 ---- # define TLS_GET_DATA(a,b) b=TlsGetValue(a) # define TLS_SET_DATA(a,b) TlsSetValue(a,b) # define TLS_FREE(a) TlsFree(a) ! # define TLS_MALLOC(a) calloc(1,a) ! # define TLS_MFREE(a) free(a) # else /*PTHREADS this all needs to be scrutinized before use! */ # define MUTEX_T pthread_mutex_t * -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#1428) next »