Yasuo Ohgaki
yohga****@users*****
2002年 8月 3日 (土) 17:55:29 JST
yohgaki 02/08/03 17:55:29 Modified: . TSRM.c TSRM.h tsrm_config_common.h tsrm_virtual_cwd.c tsrm_virtual_cwd.h Log: revert recent bogus commits Revision Changes Path 1.4 +0 -15 TSRM/TSRM.c Index: TSRM.c =================================================================== RCS file: /cvsroot/php-i18n/TSRM/TSRM.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TSRM.c 2 Aug 2002 09:47:43 -0000 1.3 +++ TSRM.c 3 Aug 2002 08:55:28 -0000 1.4 @@ -412,8 +412,6 @@ { #ifdef TSRM_WIN32 return GetCurrentThreadId(); -#elif defined(NETWARE) - return NXThreadGetId(); #elif defined(GNUPTH) return pth_self(); #elif defined(PTHREADS) @@ -432,17 +430,10 @@ TSRM_API MUTEX_T tsrm_mutex_alloc(void) { MUTEX_T mutexp; -#ifdef NETWARE - long flags = 0; /* Don't require NX_MUTEX_RECURSIVE, I guess */ - NXHierarchy_t order = 0; - NX_LOCK_INFO_ALLOC (lockInfo, "PHP-TSRM", 0); -#endif #ifdef TSRM_WIN32 mutexp = malloc(sizeof(CRITICAL_SECTION)); InitializeCriticalSection(mutexp); -#elif defined(NETWARE) - mutexp = NXMutexAlloc(flags, order, &lockInfo); /* return value ignored for now */ #elif defined(GNUPTH) mutexp = (MUTEX_T) malloc(sizeof(*mutexp)); pth_mutex_init(mutexp); @@ -469,8 +460,6 @@ if (mutexp) { #ifdef TSRM_WIN32 DeleteCriticalSection(mutexp); -#elif defined(NETWARE) - NXMutexFree(mutexp); #elif defined(GNUPTH) free(mutexp); #elif defined(PTHREADS) @@ -497,8 +486,6 @@ #ifdef TSRM_WIN32 EnterCriticalSection(mutexp); return 1; -#elif defined(NETWARE) - return NXLock(mutexp); #elif defined(GNUPTH) return pth_mutex_acquire(mutexp, 0, NULL); #elif defined(PTHREADS) @@ -520,8 +507,6 @@ #ifdef TSRM_WIN32 LeaveCriticalSection(mutexp); return 1; -#elif defined(NETWARE) - return NXUnlock(mutexp); #elif defined(GNUPTH) return pth_mutex_release(mutexp); #elif defined(PTHREADS) 1.4 +1 -8 TSRM/TSRM.h Index: TSRM.h =================================================================== RCS file: /cvsroot/php-i18n/TSRM/TSRM.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TSRM.h 2 Aug 2002 09:47:43 -0000 1.3 +++ TSRM.h 3 Aug 2002 08:55:28 -0000 1.4 @@ -13,8 +13,7 @@ #ifndef TSRM_H #define TSRM_H -/* #ifndef WIN32 */ -#if !defined(WIN32) && !defined(NETWARE) +#ifndef WIN32 # include "tsrm_config.h" #endif @@ -37,9 +36,6 @@ #ifdef TSRM_WIN32 # include <windows.h> -#elif defined(NETWARE) -# include <nks/thread.h> -# include <nks/synch.h> #elif defined(GNUPTH) # include <pth.h> #elif defined(PTHREADS) @@ -54,9 +50,6 @@ #ifdef TSRM_WIN32 # define THREAD_T DWORD # define MUTEX_T CRITICAL_SECTION * -#elif defined(NETWARE) -# define THREAD_T NXThreadId_t -# define MUTEX_T NXMutex_t * #elif defined(GNUPTH) # define THREAD_T pth_t # define MUTEX_T pth_mutex_t * 1.4 +3 -5 TSRM/tsrm_config_common.h Index: tsrm_config_common.h =================================================================== RCS file: /cvsroot/php-i18n/TSRM/tsrm_config_common.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- tsrm_config_common.h 2 Aug 2002 09:47:43 -0000 1.3 +++ tsrm_config_common.h 3 Aug 2002 08:55:28 -0000 1.4 @@ -5,13 +5,11 @@ # define TSRM_WIN32 #endif -#ifdef TSRM_WIN32 -# include "tsrm_config.w32.h" -#elif defined(NETWARE) -# include "tsrm_config.nw.h" -#else +#ifndef TSRM_WIN32 # include "tsrm_config.h" # include <sys/param.h> +#else +# include "tsrm_config.w32.h" #endif #ifdef TSRM_WIN32 1.4 +36 -125 TSRM/tsrm_virtual_cwd.c Index: tsrm_virtual_cwd.c =================================================================== RCS file: /cvsroot/php-i18n/TSRM/tsrm_virtual_cwd.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- tsrm_virtual_cwd.c 2 Aug 2002 09:47:43 -0000 1.3 +++ tsrm_virtual_cwd.c 3 Aug 2002 08:55:28 -0000 1.4 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tsrm_virtual_cwd.c,v 1.30 2002/05/29 08:41:21 rvenkat Exp $ */ +/* $Id: tsrm_virtual_cwd.c,v 1.29 2002/04/25 14:42:55 hirokawa Exp $ */ #include <sys/types.h> #include <sys/stat.h> @@ -36,17 +36,12 @@ #include "tsrm_win32.h" #endif -#ifdef NETWARE -/*#include "pipe.h"*/ -#include "tsrm_nw.h" -#endif - #define VIRTUAL_CWD_DEBUG 0 #include "TSRM.h" -/* Only need mutex for popen() in Windows and NetWare, because it doesn't chdir() on UNIX */ -#if (defined(TSRM_WIN32) || defined(NETWARE)) && defined(ZTS) +/* Only need mutex for popen() in Windows because it doesn't chdir() on UNIX */ +#if defined(TSRM_WIN32) && defined(ZTS) MUTEX_T cwd_mutex; #endif @@ -90,13 +85,6 @@ #define IS_DIRECTORY_CURRENT(element, len) \ (len == 1 && ptr[0] == '.') -#elif defined(NETWARE) -/* NetWare has strtok() (in LibC) and allows both slashes in paths, like Windows -- - but rest of the stuff is like Unix */ -/* strtok() call in LibC is abending when used in a different address space -- hence using - PHP's version itself for now */ -/*#define tsrm_strtok_r(a,b,c) strtok((a),(b))*/ -#define TOKENIZER_STRING "/\\" #else #define TOKENIZER_STRING "/" @@ -133,15 +121,9 @@ static int php_is_dir_ok(const cwd_state *state) { -#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH)) struct stat buf; if (stat(state->cwd, &buf) == 0 && S_ISDIR(buf.st_mode)) -#else - struct stat_libc buf; - - if (stat(state->cwd, (struct stat*)(&buf)) == 0 && S_ISDIR(buf.st_mode)) -#endif return (0); return (1); @@ -149,15 +131,9 @@ static int php_is_file_ok(const cwd_state *state) { -#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH)) struct stat buf; if (stat(state->cwd, &buf) == 0 && S_ISREG(buf.st_mode)) -#else - struct stat_libc buf; - - if (stat(state->cwd, (struct stat*)(&buf)) == 0 && S_ISREG(buf.st_mode)) -#endif return (0); return (1); @@ -298,7 +274,7 @@ if (path_length == 0) return (0); -#if !defined(TSRM_WIN32) && !defined(__BEOS__) && !defined(NETWARE) +#if !defined(TSRM_WIN32) && !defined(__BEOS__) if (IS_ABSOLUTE_PATH(path, path_length)) { if (realpath(path, resolved_path)) { path = resolved_path; @@ -333,12 +309,7 @@ fprintf(stderr,"cwd = %s path = %s\n", state->cwd, path); #endif if (IS_ABSOLUTE_PATH(path_copy, path_length)) { -/* COPY_WHEN_ABSOLUTE needs to account for volume name that is unique to NetWare absolute paths */ -#ifndef NETWARE copy_amount = COPY_WHEN_ABSOLUTE; -#else - copy_amount = COPY_WHEN_ABSOLUTE(path_copy); -#endif is_absolute = 1; #ifdef TSRM_WIN32 } else if (IS_UNC_PATH(path_copy, path_length)) { @@ -397,11 +368,6 @@ IsDBCSLeadByte(state->cwd[state->cwd_length-2])) { state->cwd[state->cwd_length++] = DEFAULT_SLASH; } -#elif defined(NETWARE) - /* If the token is a volume name, it will have colon at the end -- so, no slash before it */ - if (ptr[ptr_length-1] != ':') { - state->cwd[state->cwd_length++] = DEFAULT_SLASH; - } #else state->cwd[state->cwd_length++] = DEFAULT_SLASH; #endif @@ -411,12 +377,7 @@ ptr = tsrm_strtok_r(NULL, TOKENIZER_STRING, &tok); } -/* COPY_WHEN_ABSOLUTE needs to account for volume name that is unique to NetWare absolute paths */ -#ifndef NETWARE if (state->cwd_length == COPY_WHEN_ABSOLUTE) { -#else - if (state->cwd_length == COPY_WHEN_ABSOLUTE(state->cwd)) { -#endif state->cwd = (char *) realloc(state->cwd, state->cwd_length+1+1); state->cwd[state->cwd_length] = DEFAULT_SLASH; state->cwd[state->cwd_length+1] = '\0'; @@ -466,12 +427,7 @@ return -1; } -/* COPY_WHEN_ABSOLUTE needs to account for volume name that is unique to NetWare absolute paths */ -#ifndef NETWARE if (length == COPY_WHEN_ABSOLUTE && IS_ABSOLUTE_PATH(path, length+1)) { /* Also use trailing slash if this is absolute */ -#else - if (length == COPY_WHEN_ABSOLUTE(path) && IS_ABSOLUTE_PATH(path, length+1)) { /* Also use trailing slash if this is absolute */ -#endif length++; } temp = (char *) tsrm_do_alloca(length+1); @@ -570,7 +526,7 @@ return ret; } -#if !defined(TSRM_WIN32) && !defined(NETWARE) +#ifndef TSRM_WIN32 CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_DC) { cwd_state new_state; @@ -646,7 +602,6 @@ return retval; } -#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH)) CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC) { cwd_state new_state; @@ -660,23 +615,9 @@ CWD_STATE_FREE(&new_state); return retval; } -#else -CWD_API int virtual_stat(const char *path, struct stat_libc *buf TSRMLS_DC) -{ - cwd_state new_state; - int retval; - - CWD_STATE_COPY(&new_state, &CWDG(cwd)); - virtual_file_ex(&new_state, path, NULL); - retval = stat(new_state.cwd, (struct stat*)buf); - - CWD_STATE_FREE(&new_state); - return retval; -} -#endif +#ifndef TSRM_WIN32 -#if !defined(TSRM_WIN32) && !defined(NETWARE) CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC) { cwd_state new_state; @@ -690,6 +631,7 @@ CWD_STATE_FREE(&new_state); return retval; } + #endif CWD_API int virtual_unlink(const char *path TSRMLS_DC) @@ -755,41 +697,46 @@ return retval; } -#ifdef TSRM_WIN32 +#ifndef TSRM_WIN32 -/* On Windows the trick of prepending "cd cwd; " doesn't work so we need to perform - a real chdir() and mutex it - */ CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC) { - char prev_cwd[MAXPATHLEN]; - char *getcwd_result; + int command_length; + char *command_line; + char *ptr; FILE *retval; - getcwd_result = getcwd(prev_cwd, MAXPATHLEN); - if (!getcwd_result) { + command_length = strlen(command); + + ptr = command_line = (char *) malloc(command_length + sizeof("cd ; ") + CWDG(cwd).cwd_length+1); + if (!command_line) { return NULL; } + memcpy(ptr, "cd ", sizeof("cd ")-1); + ptr += sizeof("cd ")-1; -#ifdef ZTS - tsrm_mutex_lock(cwd_mutex); -#endif - - chdir(CWDG(cwd).cwd); - retval = popen(command, type); - chdir(prev_cwd); + if (CWDG(cwd).cwd_length == 0) { + *ptr++ = DEFAULT_SLASH; + } else { + memcpy(ptr, CWDG(cwd).cwd, CWDG(cwd).cwd_length); + ptr += CWDG(cwd).cwd_length; + } + + *ptr++ = ' '; + *ptr++ = ';'; + *ptr++ = ' '; -#ifdef ZTS - tsrm_mutex_unlock(cwd_mutex); -#endif + memcpy(ptr, command, command_length+1); + retval = popen(command_line, type); + free(command_line); return retval; } -#elif defined(NETWARE) +#else -/* On NetWare, the trick of prepending "cd cwd; " doesn't work so we need to perform - a VCWD_CHDIR() and mutex it +/* On Windows the trick of prepending "cd cwd; " doesn't work so we need to perform + a real chdir() and mutex it */ CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC) { @@ -797,7 +744,7 @@ char *getcwd_result; FILE *retval; - getcwd_result = VCWD_GETCWD(prev_cwd, MAXPATHLEN); + getcwd_result = getcwd(prev_cwd, MAXPATHLEN); if (!getcwd_result) { return NULL; } @@ -806,50 +753,14 @@ tsrm_mutex_lock(cwd_mutex); #endif - VCWD_CHDIR(CWDG(cwd).cwd); + chdir(CWDG(cwd).cwd); retval = popen(command, type); - VCWD_CHDIR(prev_cwd); + chdir(prev_cwd); #ifdef ZTS tsrm_mutex_unlock(cwd_mutex); #endif - return retval; -} - -#else /* Unix */ - -CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC) -{ - int command_length; - char *command_line; - char *ptr; - FILE *retval; - - command_length = strlen(command); - - ptr = command_line = (char *) malloc(command_length + sizeof("cd ; ") + CWDG(cwd).cwd_length+1); - if (!command_line) { - return NULL; - } - memcpy(ptr, "cd ", sizeof("cd ")-1); - ptr += sizeof("cd ")-1; - - if (CWDG(cwd).cwd_length == 0) { - *ptr++ = DEFAULT_SLASH; - } else { - memcpy(ptr, CWDG(cwd).cwd, CWDG(cwd).cwd_length); - ptr += CWDG(cwd).cwd_length; - } - - *ptr++ = ' '; - *ptr++ = ';'; - *ptr++ = ' '; - - memcpy(ptr, command, command_length+1); - retval = popen(command_line, type); - - free(command_line); return retval; } 1.4 +7 -24 TSRM/tsrm_virtual_cwd.h Index: tsrm_virtual_cwd.h =================================================================== RCS file: /cvsroot/php-i18n/TSRM/tsrm_virtual_cwd.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- tsrm_virtual_cwd.h 2 Aug 2002 09:47:43 -0000 1.3 +++ tsrm_virtual_cwd.h 3 Aug 2002 08:55:28 -0000 1.4 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tsrm_virtual_cwd.h,v 1.19 2002/05/29 08:41:21 rvenkat Exp $ */ +/* $Id: tsrm_virtual_cwd.h,v 1.18 2002/04/25 14:42:55 hirokawa Exp $ */ #ifndef VIRTUAL_CWD_H #define VIRTUAL_CWD_H @@ -58,19 +58,6 @@ #define IS_UNC_PATH(path, len) \ (len >= 2 && IS_SLASH(path[0]) && IS_SLASH(path[1])) -#elif defined(NETWARE) -#ifdef HAVE_DIRENT_H -#include <dirent.h> -#endif - -#define DEFAULT_SLASH '/' -#define DEFAULT_DIR_SEPARATOR ';' -#define IS_SLASH(c) ((c) == '/' || (c) == '\\') -#define COPY_WHEN_ABSOLUTE(path) \ - (strchr(path, ':') - path + 1) /* Take the volume name which ends with a colon */ -#define IS_ABSOLUTE_PATH(path, len) \ - (strchr(path, ':') != NULL) /* Colon indicates volume name */ - #else #ifdef HAVE_DIRENT_H #include <dirent.h> @@ -133,12 +120,8 @@ CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...); CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC); CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC); -#if !(defined(NETWARE) && defined(CLIB_STAT_PATCH)) CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC); -#else -CWD_API int virtual_stat(const char *path, struct stat_libc *buf TSRMLS_DC); -#endif -#if !defined(TSRM_WIN32) && !defined(NETWARE) +#ifndef TSRM_WIN32 CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC); #endif CWD_API int virtual_unlink(const char *path TSRMLS_DC); @@ -150,7 +133,7 @@ CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC); #endif CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC); -#if !defined(TSRM_WIN32) && !defined(NETWARE) +#ifndef TSRM_WIN32 CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_DC); #endif @@ -185,7 +168,7 @@ #define VCWD_REALPATH(path, real_path) virtual_realpath(path, real_path TSRMLS_CC) #define VCWD_RENAME(oldname, newname) virtual_rename(oldname, newname TSRMLS_CC) #define VCWD_STAT(path, buff) virtual_stat(path, buff TSRMLS_CC) -#if !defined(TSRM_WIN32) && !defined(NETWARE) +#ifdef TSRM_WIN32 #define VCWD_LSTAT(path, buff) virtual_stat(path, buff TSRMLS_CC) #else #define VCWD_LSTAT(path, buff) virtual_lstat(path, buff TSRMLS_CC) @@ -199,7 +182,7 @@ #define VCWD_UTIME(path, time) virtual_utime(path, time TSRMLS_CC) #endif #define VCWD_CHMOD(path, mode) virtual_chmod(path, mode TSRMLS_CC) -#if !defined(TSRM_WIN32) && !defined(NETWARE) +#ifndef TSRM_WIN32 #define VCWD_CHOWN(path, owner, group) virtual_chown(path, owner, group TSRMLS_CC) #endif @@ -222,7 +205,7 @@ #define VCWD_OPENDIR(pathname) opendir(pathname) #define VCWD_POPEN(command, type) popen(command, type) -#if !defined(TSRM_WIN32) && !defined(NETWARE) +#ifndef TSRM_WIN32 #define VCWD_REALPATH(path, real_path) realpath(path, real_path) #else #define VCWD_REALPATH(path, real_path) strcpy(real_path, path) @@ -232,7 +215,7 @@ #define VCWD_UTIME(path, time) utime(path, time) #endif #define VCWD_CHMOD(path, mode) chmod(path, mode) -#if !defined(TSRM_WIN32) && !defined(NETWARE) +#ifndef TSRM_WIN32 #define VCWD_CHOWN(path, owner, group) chown(path, owner, group) #endif