summaryrefslogtreecommitdiff
path: root/main/reentrancy.c
diff options
context:
space:
mode:
authorAnantha Kesari H Y <hyanantha@php.net>2002-09-11 09:30:01 +0000
committerAnantha Kesari H Y <hyanantha@php.net>2002-09-11 09:30:01 +0000
commitd3642b5488835981af440801896a5676a1590149 (patch)
tree413cb491a123666af58284e8c7f4cf59cfc39701 /main/reentrancy.c
parentfdf1c12195d06b3e98b8ec13b49a449dfa6e030f (diff)
downloadphp-git-d3642b5488835981af440801896a5676a1590149.tar.gz
NetWare related changes/modifications
Diffstat (limited to 'main/reentrancy.c')
-rw-r--r--main/reentrancy.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/main/reentrancy.c b/main/reentrancy.c
index d5f4909760..73e3b8eb8d 100644
--- a/main/reentrancy.c
+++ b/main/reentrancy.c
@@ -28,6 +28,11 @@
#include "win32/readdir.h"
#endif
+#if defined(NETWARE) && !(NEW_LIBC)
+/*#include <ws2nlm.h>*/
+#include <sys/socket.h>
+#endif
+
#include "php_reentrancy.h"
#include "ext/standard/php_rand.h" /* for RAND_MAX */
@@ -114,6 +119,51 @@ PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm)
#endif
+#if defined(NETWARE)
+/*
+ Re-entrant versions of functions seem to be better for loading NLMs in different address space.
+ Since we have them now in LibC, we might as well make use of them.
+*/
+
+#define HAVE_LOCALTIME_R 1
+#define HAVE_CTIME_R 1
+#define HAVE_ASCTIME_R 1
+#define HAVE_GMTIME_R 1
+
+PHPAPI struct tm *php_localtime_r(const time_t *const timep, struct tm *p_tm)
+{
+ /* Modified according to LibC definition */
+ if (localtime_r(timep, p_tm) != NULL)
+ return (p_tm);
+ return (NULL);
+}
+
+PHPAPI char *php_ctime_r(const time_t *clock, char *buf)
+{
+ /* Modified according to LibC definition */
+ if (ctime_r(clock, buf) != NULL)
+ return (buf);
+ return (NULL);
+}
+
+PHPAPI char *php_asctime_r(const struct tm *tm, char *buf)
+{
+ /* Modified according to LibC definition */
+ if (asctime_r(tm, buf) != NULL)
+ return (buf);
+ return (NULL);
+}
+
+PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm)
+{
+ /* Modified according to LibC definition */
+ if (gmtime_r(timep, p_tm) != NULL)
+ return (p_tm);
+ return (NULL);
+}
+
+#endif /* NETWARE */
+
#if !defined(HAVE_POSIX_READDIR_R)
PHPAPI int php_readdir_r(DIR *dirp, struct dirent *entry,