From: Anantha Kesari H Y Date: Fri, 3 Jan 2003 14:37:42 +0000 (+0000) Subject: Modified for NetWare. X-Git-Tag: PHP_5_0_dev_before_13561_fix~491 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=830298beb8de78f1571975a4521b86e45eb414c1;p=php Modified for NetWare. --- diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 4b7bbfc699..2ca6dc07cf 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -896,6 +896,18 @@ PHP_FUNCTION(proc_open) child = pi.hProcess; CloseHandle(pi.hThread); +#elif defined(NETWARE) + + /* clean up all the descriptors */ + for (i = 0; i < ndesc; i++) { + close(descriptors[i].childend); + close(descriptors[i].parentend); + } + + php_error_docref(NULL TSRMLS_CC, E_WARNING, "fork not supported on NetWare"); + + goto exit_fail; + #else /* the unix way */ diff --git a/ext/standard/file.c b/ext/standard/file.c index cd1042a56b..ca87537691 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -54,6 +54,7 @@ #include "netware/param.h" #else #include +#include #if defined(NETWARE) && defined(USE_WINSOCK) #include #else @@ -1979,9 +1980,16 @@ PHP_NAMED_FUNCTION(php_if_fstat) MAKE_LONG_ZVAL_INCREF(stat_rdev, -1); #endif MAKE_LONG_ZVAL_INCREF(stat_size, stat_ssb.sb.st_size); +#if defined(NETWARE) && defined(CLIB_STAT_PATCH) + MAKE_LONG_ZVAL_INCREF(stat_atime, stat_ssb.sb.st_atime.tv_sec); + MAKE_LONG_ZVAL_INCREF(stat_mtime, stat_ssb.sb.st_mtime.tv_sec); + MAKE_LONG_ZVAL_INCREF(stat_ctime, stat_ssb.sb.st_ctime.tv_sec); +#else MAKE_LONG_ZVAL_INCREF(stat_atime, stat_ssb.sb.st_atime); MAKE_LONG_ZVAL_INCREF(stat_mtime, stat_ssb.sb.st_mtime); MAKE_LONG_ZVAL_INCREF(stat_ctime, stat_ssb.sb.st_ctime); +#endif + #ifdef HAVE_ST_BLKSIZE MAKE_LONG_ZVAL_INCREF(stat_blksize, stat_ssb.sb.st_blksize); #else diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index d3a056568f..aa5e2ebda7 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -664,26 +664,30 @@ static void php_stat(const char *filename, php_stat_len filename_length, int typ case FS_INODE: RETURN_LONG((long)BG(sb).st_ino); case FS_SIZE: +#if defined(NETWARE) && defined(NEW_LIBC) + RETURN_LONG((long)(stat_sb->st_size)); +#else RETURN_LONG((long)BG(sb).st_size); +#endif case FS_OWNER: RETURN_LONG((long)BG(sb).st_uid); case FS_GROUP: RETURN_LONG((long)BG(sb).st_gid); case FS_ATIME: #if defined(NETWARE) && defined(NEW_LIBC) - RETURN_LONG((long)(BG(sb).st_atime).tv_nsec); + RETURN_LONG((long)((stat_sb->st_atime).tv_sec)); #else RETURN_LONG((long)BG(sb).st_atime); #endif case FS_MTIME: #if defined(NETWARE) && defined(NEW_LIBC) - RETURN_LONG((long)(BG(sb).st_mtime).tv_nsec); + RETURN_LONG((long)((stat_sb->st_mtime).tv_sec)); #else - RETURN_LONG((long)BG(sb).st_mtime); + RETURN_LONG((long)BG(sb).st_mtime); #endif case FS_CTIME: #if defined(NETWARE) && defined(NEW_LIBC) - RETURN_LONG((long)(BG(sb).st_ctime).tv_nsec); + RETURN_LONG((long)((stat_sb->st_ctime).tv_sec)); #else RETURN_LONG((long)BG(sb).st_ctime); #endif @@ -706,28 +710,25 @@ static void php_stat(const char *filename, php_stat_len filename_length, int typ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown file type (%d)", BG(sb).st_mode&S_IFMT); RETURN_STRING("unknown", 1); case FS_IS_W: -#ifdef NETWARE - RETURN_LONG(0); -#endif + #ifndef NETWARE /* getuid is not available on NetWare */ if (getuid()==0) { RETURN_TRUE; /* root */ } + #endif /* NETWARE */ RETURN_BOOL((BG(sb).st_mode & wmask) != 0); case FS_IS_R: -#ifdef NETWARE - RETURN_LONG(0); -#endif + #ifndef NETWARE /* getuid is not available on NetWare */ if (getuid()==0) { RETURN_TRUE; /* root */ } + #endif /* NETWARE */ RETURN_BOOL((BG(sb).st_mode&rmask)!=0); case FS_IS_X: -#ifdef NETWARE - RETURN_LONG(0); -#endif + #ifndef NETWARE /* getuid is not available on NetWare */ if (getuid()==0) { xmask = S_IXROOT; /* root */ } + #endif /* NETWARE */ RETURN_BOOL((BG(sb).st_mode&xmask)!=0 && !S_ISDIR(BG(sb).st_mode)); case FS_IS_FILE: RETURN_BOOL(S_ISREG(BG(sb).st_mode)); @@ -762,9 +763,9 @@ static void php_stat(const char *filename, php_stat_len filename_length, int typ #endif MAKE_LONG_ZVAL_INCREF(stat_size, stat_sb->st_size); #if defined(NETWARE) && defined(NEW_LIBC) - MAKE_LONG_ZVAL_INCREF(stat_atime, (stat_sb->st_atime).tv_nsec); - MAKE_LONG_ZVAL_INCREF(stat_mtime, (stat_sb->st_mtime).tv_nsec); - MAKE_LONG_ZVAL_INCREF(stat_ctime, (stat_sb->st_ctime).tv_nsec); + MAKE_LONG_ZVAL_INCREF(stat_atime, (stat_sb->st_atime).tv_sec); + MAKE_LONG_ZVAL_INCREF(stat_mtime, (stat_sb->st_mtime).tv_sec); + MAKE_LONG_ZVAL_INCREF(stat_ctime, (stat_sb->st_ctime).tv_sec); #else MAKE_LONG_ZVAL_INCREF(stat_atime, stat_sb->st_atime); MAKE_LONG_ZVAL_INCREF(stat_mtime, stat_sb->st_mtime); diff --git a/ext/standard/html.c b/ext/standard/html.c index 4e7d51be59..c784deec60 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -23,6 +23,8 @@ #include "php.h" #if PHP_WIN32 #include "config.w32.h" +#elif defined NETWARE +#include "config.nw.h" #else #include "php_config.h" #endif diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c index 39d57d6686..14294fb3eb 100644 --- a/ext/standard/syslog.c +++ b/ext/standard/syslog.c @@ -75,7 +75,7 @@ PHP_MINIT_FUNCTION(syslog) /* AIX doesn't have LOG_AUTHPRIV */ REGISTER_LONG_CONSTANT("LOG_AUTHPRIV", LOG_AUTHPRIV, CONST_CS | CONST_PERSISTENT); #endif -#if !defined(PHP_WIN32) +#if !defined(PHP_WIN32) && !defined(NETWARE) REGISTER_LONG_CONSTANT("LOG_LOCAL0", LOG_LOCAL0, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("LOG_LOCAL1", LOG_LOCAL1, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("LOG_LOCAL2", LOG_LOCAL2, CONST_CS | CONST_PERSISTENT); @@ -159,7 +159,7 @@ static void start_syslog(TSRMLS_D) /* AIX doesn't have LOG_AUTHPRIV */ SET_VAR_LONG("LOG_AUTHPRIV", LOG_AUTHPRIV); #endif -#if !defined(PHP_WIN32) +#if !defined(PHP_WIN32) && !defined(NETWARE) SET_VAR_LONG("LOG_LOCAL0", LOG_LOCAL0); SET_VAR_LONG("LOG_LOCAL1", LOG_LOCAL1); SET_VAR_LONG("LOG_LOCAL2", LOG_LOCAL2);