cvs: TSRM(PHP_4_4) / TSRM.c TSRM.h tsrm_virtual_cwd.c tsrm_virtual_cwd.h
| From: | Anantha Kesari H Y | Date: | Tue, 26 Jul 2005 13:34:53 +0000 |
| Subject: | cvs: TSRM(PHP_4_4) / TSRM.c TSRM.h tsrm_virtual_cwd.c tsrm_virtual_cwd.h | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-3940@lists.php.net to get a copy of this message | ||
hyanantha Tue Jul 26 09:34:53 2005 EDT
Modified files: (Branch: PHP_4_4)
/TSRM TSRM.h TSRM.c tsrm_virtual_cwd.c tsrm_virtual_cwd.h
Log:
TSRM/TSRM.h
NetWare can make use of autoconf based build.
PTHREADS implementation of NetWare is good enough so dropping the code for NetWare specific thread
implementation in preference to PTHREADS
TSRM/TSRM.c
PTHREADS implementation of NetWare is good enough so dropping the code for NetWare specific thread
implementation in preference to PTHREADS
TSRM/tsrm_virtual_cwd.c
NetWare can make use of autoconf based build.
Removed redundant CLIB_STAT_PATCH checks
NetWare specific fixes from PHP_5_0.
TSRM/tsrm_virtual_cwd.h
Removed redundant CLIB_STAT_PATCH checks
NetWare specific fixes from PHP_5_0.
--Kamesh
http://cvs.php.net/diff.php/TSRM/TSRM.h?r1=1.36.2.3&r2=1.36.2.3.2.1&ty=u Index: TSRM/TSRM.h diff -u TSRM/TSRM.h:1.36.2.3 TSRM/TSRM.h:1.36.2.3.2.1 --- TSRM/TSRM.h:1.36.2.3 Thu Feb 10 22:34:04 2005 +++ TSRM/TSRM.h Tue Jul 26 09:34:52 2005 @@ -14,7 +14,7 @@ #define TSRM_H /* #ifndef WIN32 */ -#if !defined(WIN32) && !defined(NETWARE) +#if !defined(WIN32) # include <tsrm_config.h> #endif @@ -38,9 +38,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) @@ -58,9 +55,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 * http://cvs.php.net/diff.php/TSRM/TSRM.c?r1=1.47.2.7&r2=1.47.2.7.2.1&ty=u Index: TSRM/TSRM.c diff -u TSRM/TSRM.c:1.47.2.7 TSRM/TSRM.c:1.47.2.7.2.1 --- TSRM/TSRM.c:1.47.2.7 Sun Mar 20 04:04:03 2005 +++ TSRM/TSRM.c Tue Jul 26 09:34:52 2005 @@ -428,8 +428,6 @@ { #ifdef TSRM_WIN32 return GetCurrentThreadId(); -#elif defined(NETWARE) - return NXThreadGetId(); #elif defined(GNUPTH) return pth_self(); #elif defined(PTHREADS) @@ -450,17 +448,9 @@ 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); @@ -492,8 +482,6 @@ #ifdef TSRM_WIN32 DeleteCriticalSection(mutexp); free(mutexp); -#elif defined(NETWARE) - NXMutexFree(mutexp); #elif defined(GNUPTH) free(mutexp); #elif defined(PTHREADS) @@ -523,8 +511,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) @@ -550,8 +536,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) http://cvs.php.net/diff.php/TSRM/tsrm_virtual_cwd.c?r1=1.41.2.11&r2=1.41.2.11.2.1&ty=u Index: TSRM/tsrm_virtual_cwd.c diff -u TSRM/tsrm_virtual_cwd.c:1.41.2.11 TSRM/tsrm_virtual_cwd.c:1.41.2.11.2.1 --- TSRM/tsrm_virtual_cwd.c:1.41.2.11 Thu Feb 10 22:34:04 2005 +++ TSRM/tsrm_virtual_cwd.c Tue Jul 26 09:34:52 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tsrm_virtual_cwd.c,v 1.41.2.11 2005/02/11 03:34:04 sniper Exp $ */ +/* $Id: tsrm_virtual_cwd.c,v 1.41.2.11.2.1 2005/07/26 13:34:52 hyanantha Exp $ */ #include <sys/types.h> #include <sys/stat.h> @@ -37,8 +37,7 @@ #endif #ifdef NETWARE -/*#include "pipe.h"*/ -#include "tsrm_nw.h" +#include <fsio.h> #endif #ifndef HAVE_REALPATH @@ -137,15 +136,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); @@ -153,15 +146,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); @@ -196,8 +183,20 @@ { char cwd[MAXPATHLEN]; char *result; - - result = getcwd(cwd, sizeof(cwd)); +#ifdef NETWARE + result = getcwdpath(cwd, NULL, 1); + if(result) + { + char *c=cwd; + while(c = strchr(c, '\\')) + { + *c='/'; + ++c; + } + } +#else + result = getcwd(cwd, sizeof(cwd)); +#endif if (!result) { cwd[0] = '\0'; } @@ -210,7 +209,7 @@ cwd_globals_ctor(&cwd_globals TSRMLS_CC); #endif -#if defined(TSRM_WIN32) && defined(ZTS) +#if (defined(TSRM_WIN32) || defined(NETWARE)) && defined(ZTS) cwd_mutex = tsrm_mutex_alloc(); #endif } @@ -220,7 +219,7 @@ #ifndef ZTS cwd_globals_dtor(&cwd_globals TSRMLS_CC); #endif -#if defined(TSRM_WIN32) && defined(ZTS) +#if (defined(TSRM_WIN32) || defined(NETWARE)) && defined(ZTS) tsrm_mutex_free(cwd_mutex); #endif @@ -418,8 +417,20 @@ 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] != ':') { + /* + Below code keeps appending to state->cwd a File system seperator + cases where this appending should not happen is given below, + a) sys: should just be left as it is + b) sys:system should just be left as it is, + Colon is allowed only in the first token as volume names alone can have the : in their names. + Files and Directories cannot have : in their names + So the check goes like this, + For second token and above simply append the DEFAULT_SLASH to the state->cwd. + For first token check for the existence of : + if it exists don't append the DEFAULT_SLASH to the state->cwd. + */ + if(((state->cwd_length == 0) && (strchr(ptr, ':') == NULL)) || (state->cwd_length > 0)) + { state->cwd[state->cwd_length++] = DEFAULT_SLASH; } #else @@ -683,7 +694,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; @@ -697,21 +707,6 @@ 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, 1); - - retval = stat(new_state.cwd, (struct stat*)buf); - - CWD_STATE_FREE(&new_state); - return retval; -} -#endif #if !defined(TSRM_WIN32) && !defined(NETWARE) CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC) http://cvs.php.net/diff.php/TSRM/tsrm_virtual_cwd.h?r1=1.25.2.10&r2=1.25.2.10.2.1&ty=u Index: TSRM/tsrm_virtual_cwd.h diff -u TSRM/tsrm_virtual_cwd.h:1.25.2.10 TSRM/tsrm_virtual_cwd.h:1.25.2.10.2.1 --- TSRM/tsrm_virtual_cwd.h:1.25.2.10 Thu Feb 10 22:34:04 2005 +++ TSRM/tsrm_virtual_cwd.h Tue Jul 26 09:34:52 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tsrm_virtual_cwd.h,v 1.25.2.10 2005/02/11 03:34:04 sniper Exp $ */ +/* $Id: tsrm_virtual_cwd.h,v 1.25.2.10.2.1 2005/07/26 13:34:52 hyanantha Exp $ */ #ifndef VIRTUAL_CWD_H #define VIRTUAL_CWD_H @@ -74,10 +74,10 @@ #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_SLASH_P(c) IS_SLASH(*(c)) +/* Colon indicates volume name, either first character should be forward slash or backward slash */ #define IS_ABSOLUTE_PATH(path, len) \ - (strchr(path, ':') != NULL) /* Colon indicates volume name */ + ((strchr(path, ':') != NULL) || ((len >= 1) && ((path[0] == '/') || (path[0] == '\\')))) #else #ifdef HAVE_DIRENT_H @@ -141,11 +141,7 @@ 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) CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC); #endif
http://cvs.php.net/diff.php/TSRM/TSRM.h?r1=1.36.2.3&r2=1.36.2.3.2.1&ty=u Index: TSRM/TSRM.h diff -u TSRM/TSRM.h:1.36.2.3 TSRM/TSRM.h:1.36.2.3.2.1 --- TSRM/TSRM.h:1.36.2.3 Thu Feb 10 22:34:04 2005 +++ TSRM/TSRM.h Tue Jul 26 09:34:52 2005 @@ -14,7 +14,7 @@ #define TSRM_H /* #ifndef WIN32 */ -#if !defined(WIN32) && !defined(NETWARE) +#if !defined(WIN32) # include <tsrm_config.h> #endif @@ -38,9 +38,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) @@ -58,9 +55,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 * http://cvs.php.net/diff.php/TSRM/TSRM.c?r1=1.47.2.7&r2=1.47.2.7.2.1&ty=u Index: TSRM/TSRM.c diff -u TSRM/TSRM.c:1.47.2.7 TSRM/TSRM.c:1.47.2.7.2.1 --- TSRM/TSRM.c:1.47.2.7 Sun Mar 20 04:04:03 2005 +++ TSRM/TSRM.c Tue Jul 26 09:34:52 2005 @@ -428,8 +428,6 @@ { #ifdef TSRM_WIN32 return GetCurrentThreadId(); -#elif defined(NETWARE) - return NXThreadGetId(); #elif defined(GNUPTH) return pth_self(); #elif defined(PTHREADS) @@ -450,17 +448,9 @@ 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); @@ -492,8 +482,6 @@ #ifdef TSRM_WIN32 DeleteCriticalSection(mutexp); free(mutexp); -#elif defined(NETWARE) - NXMutexFree(mutexp); #elif defined(GNUPTH) free(mutexp); #elif defined(PTHREADS) @@ -523,8 +511,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) @@ -550,8 +536,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) http://cvs.php.net/diff.php/TSRM/tsrm_virtual_cwd.c?r1=1.41.2.11&r2=1.41.2.11.2.1&ty=u Index: TSRM/tsrm_virtual_cwd.c diff -u TSRM/tsrm_virtual_cwd.c:1.41.2.11 TSRM/tsrm_virtual_cwd.c:1.41.2.11.2.1 --- TSRM/tsrm_virtual_cwd.c:1.41.2.11 Thu Feb 10 22:34:04 2005 +++ TSRM/tsrm_virtual_cwd.c Tue Jul 26 09:34:52 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tsrm_virtual_cwd.c,v 1.41.2.11 2005/02/11 03:34:04 sniper Exp $ */ +/* $Id: tsrm_virtual_cwd.c,v 1.41.2.11.2.1 2005/07/26 13:34:52 hyanantha Exp $ */ #include <sys/types.h> #include <sys/stat.h> @@ -37,8 +37,7 @@ #endif #ifdef NETWARE -/*#include "pipe.h"*/ -#include "tsrm_nw.h" +#include <fsio.h> #endif #ifndef HAVE_REALPATH @@ -137,15 +136,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); @@ -153,15 +146,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); @@ -196,8 +183,20 @@ { char cwd[MAXPATHLEN]; char *result; - - result = getcwd(cwd, sizeof(cwd)); +#ifdef NETWARE + result = getcwdpath(cwd, NULL, 1); + if(result) + { + char *c=cwd; + while(c = strchr(c, '\\')) + { + *c='/'; + ++c; + } + } +#else + result = getcwd(cwd, sizeof(cwd)); +#endif if (!result) { cwd[0] = '\0'; } @@ -210,7 +209,7 @@ cwd_globals_ctor(&cwd_globals TSRMLS_CC); #endif -#if defined(TSRM_WIN32) && defined(ZTS) +#if (defined(TSRM_WIN32) || defined(NETWARE)) && defined(ZTS) cwd_mutex = tsrm_mutex_alloc(); #endif } @@ -220,7 +219,7 @@ #ifndef ZTS cwd_globals_dtor(&cwd_globals TSRMLS_CC); #endif -#if defined(TSRM_WIN32) && defined(ZTS) +#if (defined(TSRM_WIN32) || defined(NETWARE)) && defined(ZTS) tsrm_mutex_free(cwd_mutex); #endif @@ -418,8 +417,20 @@ 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] != ':') { + /* + Below code keeps appending to state->cwd a File system seperator + cases where this appending should not happen is given below, + a) sys: should just be left as it is + b) sys:system should just be left as it is, + Colon is allowed only in the first token as volume names alone can have the : in their names. + Files and Directories cannot have : in their names + So the check goes like this, + For second token and above simply append the DEFAULT_SLASH to the state->cwd. + For first token check for the existence of : + if it exists don't append the DEFAULT_SLASH to the state->cwd. + */ + if(((state->cwd_length == 0) && (strchr(ptr, ':') == NULL)) || (state->cwd_length > 0)) + { state->cwd[state->cwd_length++] = DEFAULT_SLASH; } #else @@ -683,7 +694,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; @@ -697,21 +707,6 @@ 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, 1); - - retval = stat(new_state.cwd, (struct stat*)buf); - - CWD_STATE_FREE(&new_state); - return retval; -} -#endif #if !defined(TSRM_WIN32) && !defined(NETWARE) CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC) http://cvs.php.net/diff.php/TSRM/tsrm_virtual_cwd.h?r1=1.25.2.10&r2=1.25.2.10.2.1&ty=u Index: TSRM/tsrm_virtual_cwd.h diff -u TSRM/tsrm_virtual_cwd.h:1.25.2.10 TSRM/tsrm_virtual_cwd.h:1.25.2.10.2.1 --- TSRM/tsrm_virtual_cwd.h:1.25.2.10 Thu Feb 10 22:34:04 2005 +++ TSRM/tsrm_virtual_cwd.h Tue Jul 26 09:34:52 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tsrm_virtual_cwd.h,v 1.25.2.10 2005/02/11 03:34:04 sniper Exp $ */ +/* $Id: tsrm_virtual_cwd.h,v 1.25.2.10.2.1 2005/07/26 13:34:52 hyanantha Exp $ */ #ifndef VIRTUAL_CWD_H #define VIRTUAL_CWD_H @@ -74,10 +74,10 @@ #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_SLASH_P(c) IS_SLASH(*(c)) +/* Colon indicates volume name, either first character should be forward slash or backward slash */ #define IS_ABSOLUTE_PATH(path, len) \ - (strchr(path, ':') != NULL) /* Colon indicates volume name */ + ((strchr(path, ':') != NULL) || ((len >= 1) && ((path[0] == '/') || (path[0] == '\\')))) #else #ifdef HAVE_DIRENT_H @@ -141,11 +141,7 @@ 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) CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC); #endif