summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/standard/dl.c32
-rw-r--r--ext/standard/dns.c9
-rw-r--r--ext/standard/file.c12
-rw-r--r--ext/standard/filestat.c51
-rw-r--r--ext/standard/flock_compat.c8
-rw-r--r--ext/standard/fsock.c19
-rw-r--r--ext/standard/fsock.h8
-rw-r--r--ext/standard/ftp_fopen_wrapper.c13
-rw-r--r--ext/standard/head.c5
-rw-r--r--ext/standard/http_fopen_wrapper.c13
-rwxr-xr-xmain/php_streams.h4
11 files changed, 160 insertions, 14 deletions
diff --git a/ext/standard/dl.c b/ext/standard/dl.c
index 07613a1ad2..af4879cc64 100644
--- a/ext/standard/dl.c
+++ b/ext/standard/dl.c
@@ -26,7 +26,8 @@
#include "ext/standard/info.h"
#include "SAPI.h"
-#ifndef PHP_WIN32
+/*#ifndef PHP_WIN32*/
+#if !defined(PHP_WIN32) && !defined(NETWARE)
#include "build-defs.h"
#endif
@@ -34,7 +35,8 @@
#include <stdlib.h>
#include <stdio.h>
-#if HAVE_STRING_H
+/*#if HAVE_STRING_H*/
+#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
@@ -43,6 +45,13 @@
#include "win32/param.h"
#include "win32/winutil.h"
#define GET_DL_ERROR() php_win_err()
+#elif defined(NETWARE)
+#ifdef NEW_LIBC
+#include <sys/param.h>
+#else
+#include "netware/param.h"
+#endif
+#define GET_DL_ERROR() dlerror()
#else
#include <sys/param.h>
#define GET_DL_ERROR() DL_ERROR()
@@ -141,7 +150,7 @@ void php_dl(pval *file, int type, pval *return_value TSRMLS_DC)
efree(libpath);
-
+#ifndef NETWARE
get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "get_module");
/*
@@ -152,6 +161,23 @@ void php_dl(pval *file, int type, pval *return_value TSRMLS_DC)
if (!get_module)
get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "_get_module");
+#else
+ /* NetWare doesn't support two NLMs exporting same symbol */
+ {
+ char symbol_name[64] = "\0";
+ int module_name_length = Z_STRLEN_P(file) - 4; /* '.nlm' is 4 characters; knock it off */
+
+ /* Take the module name (e.g.: 'php_ldap') and append '@get_module' to it */
+ strncpy(symbol_name, Z_STRVAL_P(file), module_name_length);
+ symbol_name[module_name_length] = '\0';
+ strcat(symbol_name, "@");
+ strcat(symbol_name, "get_module");
+
+ get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, symbol_name);
+ }
+ /* NetWare doesn't prepend '_' to symbol names; so the corresponding portion of code is also
+ not required for NetWare */
+#endif
if (!get_module) {
DL_UNLOAD(handle);
diff --git a/ext/standard/dns.c b/ext/standard/dns.c
index 261a5e7c4c..221c8afeb4 100644
--- a/ext/standard/dns.c
+++ b/ext/standard/dns.c
@@ -42,7 +42,7 @@
#endif
#endif
#include <winsock.h>
-#else
+#else /* This holds good for NetWare too, both for Winsock and Berkeley sockets */
#include <netinet/in.h>
#if HAVE_ARPA_INET_H
#include <arpa/inet.h>
@@ -60,6 +60,11 @@
#endif
#endif
+/* Borrowed from SYS/SOCKET.H */
+#if defined(NETWARE) && defined(USE_WINSOCK)
+#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
+#endif
+
#include "dns.h"
/* }}} */
@@ -201,7 +206,7 @@ static char *php_gethostbyname(char *name)
}
/* }}} */
-#if HAVE_RES_SEARCH && !(defined(__BEOS__)||defined(PHP_WIN32))
+#if HAVE_RES_SEARCH && !(defined(__BEOS__)||defined(PHP_WIN32) || defined(NETWARE))
/* {{{ proto int checkdnsrr(string host [, string type])
Check DNS records corresponding to a given Internet host name or IP address */
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 84cc8020e7..b55900aeb1 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -47,11 +47,19 @@
#define O_RDONLY _O_RDONLY
#include "win32/param.h"
#include "win32/winutil.h"
+#elif defined(NETWARE) && !defined(NEW_LIBC)
+/*#include <ws2nlm.h>*/
+#include <sys/socket.h>
+#include "netware/param.h"
#else
#include <sys/param.h>
+#if defined(NETWARE) && defined(USE_WINSOCK)
+#include <novsock2.h>
+#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
+#endif
#if HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
@@ -63,6 +71,8 @@
#if HAVE_PWD_H
#ifdef PHP_WIN32
#include "win32/pwd.h"
+#elif defined(NETWARE)
+#include "netware/pwd.h"
#else
#include <pwd.h>
#endif
@@ -2114,7 +2124,7 @@ PHP_FUNCTION(fgetcsv)
/* }}} */
-#if (!defined(PHP_WIN32) && !defined(__BEOS__) && HAVE_REALPATH) || defined(ZTS)
+#if (!defined(PHP_WIN32) && !defined(__BEOS__) && !defined(NETWARE) && HAVE_REALPATH) || defined(ZTS)
/* {{{ proto string realpath(string path)
Return the resolved path */
PHP_FUNCTION(realpath)
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
index 119773553f..65dde0cfaa 100644
--- a/ext/standard/filestat.c
+++ b/ext/standard/filestat.c
@@ -54,6 +54,8 @@
#if HAVE_PWD_H
# ifdef PHP_WIN32
# include "win32/pwd.h"
+# elif defined(NETWARE)
+# include "netware/pwd.h"
# else
# include <pwd.h>
# endif
@@ -335,7 +337,8 @@ PHP_FUNCTION(disk_free_space)
Change file group */
PHP_FUNCTION(chgrp)
{
-#ifndef WINDOWS
+/*#ifndef WINDOWS*/
+#if !defined(WINDOWS) && !defined(NETWARE) /* I guess 'chgrp' won't be available on NetWare */
pval **filename, **group;
gid_t gid;
struct group *gr=NULL;
@@ -383,7 +386,8 @@ PHP_FUNCTION(chgrp)
Change file owner */
PHP_FUNCTION(chown)
{
-#ifndef WINDOWS
+/*#ifndef WINDOWS*/
+#if !defined(WINDOWS) && !defined(NETWARE) /* I guess 'chown' won't be available on NetWare */
pval **filename, **user;
int ret;
uid_t uid;
@@ -472,7 +476,11 @@ PHP_FUNCTION(touch)
{
pval **filename, **filetime, **fileatime;
int ret;
+#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
+ struct stat_libc sb;
+#else
struct stat sb;
+#endif
FILE *file;
struct utimbuf newtimebuf;
struct utimbuf *newtime = NULL;
@@ -546,7 +554,11 @@ static void php_stat(const char *filename, php_stat_len filename_length, int typ
{
zval *stat_dev, *stat_ino, *stat_mode, *stat_nlink, *stat_uid, *stat_gid, *stat_rdev,
*stat_size, *stat_atime, *stat_mtime, *stat_ctime, *stat_blksize, *stat_blocks;
+#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
+ struct stat_libc *stat_sb;
+#else
struct stat *stat_sb;
+#endif
int rmask=S_IROTH, wmask=S_IWOTH, xmask=S_IXOTH; /* access rights defaults to other */
char *stat_sb_names[13]={"dev", "ino", "mode", "nlink", "uid", "gid", "rdev",
"size", "atime", "mtime", "ctime", "blksize", "blocks"};
@@ -612,6 +624,7 @@ static void php_stat(const char *filename, php_stat_len filename_length, int typ
#endif
+#ifndef NETWARE
if (type >= FS_IS_W && type <= FS_IS_X) {
if(BG(sb).st_uid==getuid()) {
rmask=S_IRUSR;
@@ -641,6 +654,7 @@ static void php_stat(const char *filename, php_stat_len filename_length, int typ
}
}
}
+#endif
switch (type) {
case FS_PERMS:
@@ -654,11 +668,23 @@ static void php_stat(const char *filename, php_stat_len filename_length, int typ
case FS_GROUP:
RETURN_LONG((long)BG(sb).st_gid);
case FS_ATIME:
- RETURN_LONG((long)BG(sb).st_atime);
+#if defined(NETWARE) && defined(NEW_LIBC)
+ RETURN_LONG((long)(BG(sb).st_atime).tv_nsec);
+#else
+ RETURN_LONG((long)BG(sb).st_atime);
+#endif
case FS_MTIME:
- RETURN_LONG((long)BG(sb).st_mtime);
+#if defined(NETWARE) && defined(NEW_LIBC)
+ RETURN_LONG((long)(BG(sb).st_mtime).tv_nsec);
+#else
+ RETURN_LONG((long)BG(sb).st_mtime);
+#endif
case FS_CTIME:
- RETURN_LONG((long)BG(sb).st_ctime);
+#if defined(NETWARE) && defined(NEW_LIBC)
+ RETURN_LONG((long)(BG(sb).st_ctime).tv_nsec);
+#else
+ RETURN_LONG((long)BG(sb).st_ctime);
+#endif
case FS_TYPE:
#if HAVE_SYMLINK
if (S_ISLNK(BG(lsb).st_mode)) {
@@ -678,16 +704,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);
+#else
if (getuid()==0) {
RETURN_TRUE; /* root */
}
RETURN_BOOL((BG(sb).st_mode & wmask) != 0);
case FS_IS_R:
+#ifdef NETWARE
+ RETURN_LONG(0);
+#else
if (getuid()==0) {
RETURN_TRUE; /* root */
}
RETURN_BOOL((BG(sb).st_mode&rmask)!=0);
case FS_IS_X:
+#ifdef NETWARE
+ RETURN_LONG(0);
+#else
if (getuid()==0) {
xmask = S_IXROOT; /* root */
}
@@ -726,9 +761,15 @@ static void php_stat(const char *filename, php_stat_len filename_length, int typ
MAKE_LONG_ZVAL_INCREF(stat_rdev, -1);
#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);
+#else
MAKE_LONG_ZVAL_INCREF(stat_atime, stat_sb->st_atime);
MAKE_LONG_ZVAL_INCREF(stat_mtime, stat_sb->st_mtime);
MAKE_LONG_ZVAL_INCREF(stat_ctime, stat_sb->st_ctime);
+#endif
#ifdef HAVE_ST_BLKSIZE
MAKE_LONG_ZVAL_INCREF(stat_blksize, stat_sb->st_blksize);
#else
diff --git a/ext/standard/flock_compat.c b/ext/standard/flock_compat.c
index 7cec78dbe9..35f7ea411e 100644
--- a/ext/standard/flock_compat.c
+++ b/ext/standard/flock_compat.c
@@ -32,6 +32,14 @@
#include <io.h>
#endif
+#ifdef NETWARE
+#ifdef NEW_LIBC
+#include <netinet/in.h>
+#else
+#include <sys/socket.h>
+#endif
+#endif
+
#ifndef HAVE_FLOCK
int flock(int fd, int operation)
#if HAVE_STRUCT_FLOCK
diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c
index b12a533ec3..ec181f125e 100644
--- a/ext/standard/fsock.c
+++ b/ext/standard/fsock.c
@@ -47,6 +47,19 @@
#endif
#ifdef PHP_WIN32
#include <winsock.h>
+#elif defined(NETWARE)
+#ifdef NEW_LIBC
+#ifdef USE_WINSOCK
+#include <novsock2.h>
+#else
+#include <netinet/in.h>
+#include <netdb.h>
+/*#include <sys/socket.h>*/
+#include <sys/select.h>
+/*#else
+#include <sys/socket.h>*/
+#endif
+#endif
#else
#include <netinet/in.h>
#include <netdb.h>
@@ -54,7 +67,7 @@
#include <arpa/inet.h>
#endif
#endif
-#if defined(PHP_WIN32) || defined(__riscos__)
+#if defined(PHP_WIN32) || defined(__riscos__) || defined(NETWARE)
#undef AF_UNIX
#endif
#if defined(AF_UNIX)
@@ -88,6 +101,10 @@ static int fsock_globals_id;
#ifdef PHP_WIN32
#define EWOULDBLOCK WSAEWOULDBLOCK
+#elif defined(NETWARE)
+#ifdef USE_WINSOCK
+#define EWOULDBLOCK WSAEWOULDBLOCK
+#endif
#else
#include "build-defs.h"
#endif
diff --git a/ext/standard/fsock.h b/ext/standard/fsock.h
index fb134e97bc..5297bbf729 100644
--- a/ext/standard/fsock.h
+++ b/ext/standard/fsock.h
@@ -25,6 +25,14 @@
#ifndef FSOCK_H
#define FSOCK_H
+#ifdef NETWARE
+#ifdef NEW_LIBC
+#include "sys/timeval.h"
+#else
+#include "netware/time_nw.h" /* For 'timeval' */
+#endif
+#endif
+
#include "file.h"
#include "php_network.h"
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
index 054d39a5e3..003fd1e65c 100644
--- a/ext/standard/ftp_fopen_wrapper.c
+++ b/ext/standard/ftp_fopen_wrapper.c
@@ -35,6 +35,14 @@
#include <winsock.h>
#define O_RDONLY _O_RDONLY
#include "win32/param.h"
+#elif defined(NETWARE)
+/*#include <ws2nlm.h>*/
+/*#include <sys/socket.h>*/
+#ifdef NEW_LIBC
+#include <sys/param.h>
+#else
+#include "netware/param.h"
+#endif
#else
#include <sys/param.h>
#endif
@@ -48,6 +56,9 @@
#ifdef PHP_WIN32
#include <winsock.h>
+#elif defined(NETWARE) && defined(USE_WINSOCK)
+/*#include <ws2nlm.h>*/
+#include <novsock2.h>
#else
#include <netinet/in.h>
#include <netdb.h>
@@ -56,7 +67,7 @@
#endif
#endif
-#if defined(PHP_WIN32) || defined(__riscos__)
+#if defined(PHP_WIN32) || defined(__riscos__) || defined(NETWARE)
#undef AF_UNIX
#endif
diff --git a/ext/standard/head.c b/ext/standard/head.c
index 8845d8c86f..a6672239aa 100644
--- a/ext/standard/head.c
+++ b/ext/standard/head.c
@@ -18,6 +18,11 @@
/* $Id$ */
#include <stdio.h>
+
+#if defined(NETWARE) && !defined(NEW_LIBC)
+#include <sys/socket.h>
+#endif
+
#include "php.h"
#include "ext/standard/php_standard.h"
#include "SAPI.h"
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index 71989e53bd..b48cb90de6 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -37,6 +37,14 @@
#include <winsock.h>
#define O_RDONLY _O_RDONLY
#include "win32/param.h"
+#elif defined(NETWARE)
+/*#include <ws2nlm.h>*/
+/*#include <sys/socket.h>*/
+#ifdef NEW_LIBC
+#include <sys/param.h>
+#else
+#include "netware/param.h"
+#endif
#else
#include <sys/param.h>
#endif
@@ -50,6 +58,9 @@
#ifdef PHP_WIN32
#include <winsock.h>
+#elif defined(NETWARE) && defined(USE_WINSOCK)
+/*#include <ws2nlm.h>*/
+#include <novsock2.h>
#else
#include <netinet/in.h>
#include <netdb.h>
@@ -58,7 +69,7 @@
#endif
#endif
-#if defined(PHP_WIN32) || defined(__riscos__)
+#if defined(PHP_WIN32) || defined(__riscos__) || defined(NETWARE)
#undef AF_UNIX
#endif
diff --git a/main/php_streams.h b/main/php_streams.h
index 9745105d65..0bbd9d954e 100755
--- a/main/php_streams.h
+++ b/main/php_streams.h
@@ -101,7 +101,11 @@ typedef void (*php_stream_notification_func)(php_stream_context *context,
void * ptr TSRMLS_DC);
typedef struct _php_stream_statbuf {
+#if defined(NETWARE) && defined(CLIB_STAT_PATCH)
+ struct stat_libc sb; /* regular info */
+#else
struct stat sb; /* regular info */
+#endif
/* extended info to go here some day: content-type etc. etc. */
} php_stream_statbuf;