summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>1998-11-18 23:59:34 +0000
committerwtc%netscape.com <devnull@localhost>1998-11-18 23:59:34 +0000
commit0d6e12afef9c1a8aedb4e6db2ae29d7bf4739303 (patch)
tree91746586a02de262f04ac299ff194c699526b7a4
parentb612abbac0e15acb48c7e27fb357c1658fc83134 (diff)
downloadnspr-hg-NSPRPUB_RELEASE_3_0_BRANCH.tar.gz
NEXTSTEP port. Contributed by Balazs Pataki (balazs.pataki@sztaki.hu).NSPRPUB_RELEASE_3_0_BRANCH
-rw-r--r--config/Makefile2
-rw-r--r--config/nsinstall.c30
-rw-r--r--pr/include/gencfg.c6
-rw-r--r--pr/include/md/Makefile4
-rw-r--r--pr/include/md/_unixos.h4
-rw-r--r--pr/include/md/prosdep.h3
-rw-r--r--pr/include/private/primpl.h1
-rw-r--r--pr/src/io/prfile.c9
-rw-r--r--pr/src/io/prmapopt.c5
-rw-r--r--pr/src/linking/prlink.c14
-rw-r--r--pr/src/md/prosdep.c3
-rw-r--r--pr/src/md/unix/Makefile7
-rw-r--r--pr/src/md/unix/objs.mk7
-rw-r--r--pr/src/md/unix/unix.c3
-rw-r--r--pr/src/md/unix/uxwrap.c8
-rw-r--r--pr/src/misc/pratom.c22
-rw-r--r--pr/tests/Makefile6
17 files changed, 102 insertions, 32 deletions
diff --git a/config/Makefile b/config/Makefile
index e8002edf..6afd21d8 100644
--- a/config/Makefile
+++ b/config/Makefile
@@ -34,7 +34,7 @@ endif
# Temporary workaround to disable the generation of
# library build time because now.c uses the 'long long'
# data type that's not available on some platforms.
-ifeq (,$(filter-out NEC SCOOS UNIXWARE,$(OS_ARCH)))
+ifeq (,$(filter-out NEC NEXTSTEP SCOOS UNIXWARE,$(OS_ARCH)))
DEFINES += -DOMIT_LIB_BUILD_TIME
endif
diff --git a/config/nsinstall.c b/config/nsinstall.c
index c3a3bba8..67c0d225 100644
--- a/config/nsinstall.c
+++ b/config/nsinstall.c
@@ -43,7 +43,7 @@
#define HAVE_LCHOWN
-#if defined(AIX) || defined(BSDI) || defined(HPUX) || defined(LINUX) || defined(SUNOS4) || defined(SCO) || defined(UNIXWARE) || defined(RHAPSODY)
+#if defined(AIX) || defined(BSDI) || defined(HPUX) || defined(LINUX) || defined(SUNOS4) || defined(SCO) || defined(UNIXWARE) || defined(RHAPSODY) || defined(NEXTSTEP)
#undef HAVE_LCHOWN
#endif
@@ -51,15 +51,39 @@
* Does getcwd() take NULL as the first argument and malloc
* the result buffer?
*/
-#if !defined(RHAPSODY)
+#if !defined(RHAPSODY) && !defined(NEXTSTEP)
#define GETCWD_CAN_MALLOC
#endif
+#ifdef NEXTSTEP
+#include <bsd/libc.h>
+
+/*
+** balazs.pataki@sztaki.hu: The getcwd is broken in NEXTSTEP (returns 0),
+** when called on a mounted fs. Did anyone notice this? Here's an ugly
+** workaround ...
+*/
+#define getcwd(b,s) my_getcwd(b,s)
+
+static char *
+my_getcwd (char *buf, size_t size)
+{
+ FILE *pwd = popen("pwd", "r");
+ char *result = fgets(buf, size, pwd);
+
+ if (result) {
+ buf[strlen(buf)-1] = '\0';
+ }
+ pclose (pwd);
+ return buf;
+}
+#endif /* NEXTSTEP */
+
#ifdef LINUX
#include <getopt.h>
#endif
-#if defined(SCO) || defined(UNIXWARE) || defined(SNI) || defined(NCR) || defined(NEC)
+#if defined(SCO) || defined(UNIXWARE) || defined(SNI) || defined(NCR) || defined(NEC) || defined(NEXTSTEP)
#if !defined(S_ISLNK) && defined(S_IFLNK)
#define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK)
#endif
diff --git a/pr/include/gencfg.c b/pr/include/gencfg.c
index 695f17ba..f8160611 100644
--- a/pr/include/gencfg.c
+++ b/pr/include/gencfg.c
@@ -83,6 +83,12 @@
#endif
#endif
+#if defined(__NeXT__)
+#ifndef NEXTSTEP
+ error - NEXTSTEP is not defined
+#endif
+#endif
+
/************************************************************************/
/* Generate cpucfg.h */
diff --git a/pr/include/md/Makefile b/pr/include/md/Makefile
index a365ef91..d2563544 100644
--- a/pr/include/md/Makefile
+++ b/pr/include/md/Makefile
@@ -99,6 +99,10 @@ ifeq ($(OS_ARCH),Rhapsody)
MDCPUCFG_H = _rhapsody.cfg
endif
+ifeq ($(OS_ARCH),NEXTSTEP)
+MDCPUCFG_H = _nextstep.cfg
+endif
+
ifeq ($(OS_ARCH),NEWS-OS)
MDCPUCFG_H = _sony.cfg
endif
diff --git a/pr/include/md/_unixos.h b/pr/include/md/_unixos.h
index a801553f..2cf719bd 100644
--- a/pr/include/md/_unixos.h
+++ b/pr/include/md/_unixos.h
@@ -27,7 +27,7 @@
* Linux: FD_SETSIZE is defined in /usr/include/sys/select.h and should
* not be redefined.
*/
-#if !defined(LINUX) && !defined(RHAPSODY)
+#if !defined(LINUX) && !defined(RHAPSODY) && !defined(NEXTSTEP)
#ifndef FD_SETSIZE
#define FD_SETSIZE 4096
#endif
@@ -144,7 +144,7 @@ extern void _MD_unix_init_running_cpu(struct _PRCPU *cpu);
** work - it just means that we don't really have a functional
** redzone.
*/
-#if defined(DEBUG) && !defined(RHAPSODY)
+#if defined(DEBUG) && !defined(RHAPSODY) && !defined(NEXTSTEP)
#if !defined(SOLARIS)
#include <string.h> /* for memset() */
#define _MD_INIT_STACK(ts,REDZONE) \
diff --git a/pr/include/md/prosdep.h b/pr/include/md/prosdep.h
index 98002558..b0150007 100644
--- a/pr/include/md/prosdep.h
+++ b/pr/include/md/prosdep.h
@@ -80,6 +80,9 @@ PR_BEGIN_EXTERN_C
#elif defined(RHAPSODY)
#include "md/_rhapsody.h"
+#elif defined(NEXTSTEP)
+#include "md/_nextstep.h"
+
#elif defined(SOLARIS)
#include "md/_solaris.h"
diff --git a/pr/include/private/primpl.h b/pr/include/private/primpl.h
index f4c32230..200b8fc3 100644
--- a/pr/include/private/primpl.h
+++ b/pr/include/private/primpl.h
@@ -1536,6 +1536,7 @@ extern PRBool _pr_ipv6_enabled; /* defined in prnetdb.c */
&& !defined(_PR_PTHREADS) && !defined(_PR_GLOBAL_THREADS_ONLY) \
&& !defined(PURIFY) \
&& !defined(RHAPSODY) \
+ && !defined(NEXTSTEP) \
&& !(defined (UNIXWARE) && defined (USE_SVR4_THREADS))
#define _PR_OVERRIDE_MALLOC
#endif
diff --git a/pr/src/io/prfile.c b/pr/src/io/prfile.c
index ece72b0a..ffe6479a 100644
--- a/pr/src/io/prfile.c
+++ b/pr/src/io/prfile.c
@@ -265,7 +265,7 @@ PR_IMPLEMENT(PRFileDesc*) PR_Open(const char *name, PRIntn flags, PRIntn mode)
PRInt32 PR_GetSysfdTableMax(void)
{
-#if defined(XP_UNIX) && !defined(AIX)
+#if defined(XP_UNIX) && !defined(AIX) && !defined(NEXTSTEP)
struct rlimit rlim;
if ( getrlimit(RLIMIT_NOFILE, &rlim) < 0) {
@@ -274,7 +274,7 @@ PRInt32 PR_GetSysfdTableMax(void)
}
return rlim.rlim_max;
-#elif defined(AIX)
+#elif defined(AIX) || defined(NEXTSTEP)
return sysconf(_SC_OPEN_MAX);
#elif defined(WIN32) || defined(OS2)
/*
@@ -294,7 +294,7 @@ PRInt32 PR_GetSysfdTableMax(void)
PRInt32 PR_SetSysfdTableSize(int table_size)
{
-#if defined(XP_UNIX) && !defined(AIX)
+#if defined(XP_UNIX) && !defined(AIX) && !defined(NEXTSTEP)
struct rlimit rlim;
PRInt32 tableMax = PR_GetSysfdTableMax();
@@ -318,7 +318,8 @@ PRInt32 PR_SetSysfdTableSize(int table_size)
}
return rlim.rlim_cur;
-#elif defined(AIX) || defined(WIN32) || defined(WIN16) || defined(OS2)
+#elif defined(AIX) || defined(WIN32) || defined(WIN16) || defined(OS2) \
+ || defined(NEXTSTEP)
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return -1;
#elif defined (XP_MAC)
diff --git a/pr/src/io/prmapopt.c b/pr/src/io/prmapopt.c
index 6bd4dddc..88496d82 100644
--- a/pr/src/io/prmapopt.c
+++ b/pr/src/io/prmapopt.c
@@ -36,6 +36,11 @@
#include "primpl.h"
+#if defined(NEXTSTEP)
+/* NEXTSTEP is special: this must come before netinet/tcp.h. */
+#include <netinet/in_systm.h> /* n_short, n_long, n_time */
+#endif
+
#if defined(XP_UNIX) || defined(OS2)
#include <netinet/tcp.h> /* TCP_NODELAY, TCP_MAXSEG */
#endif
diff --git a/pr/src/linking/prlink.c b/pr/src/linking/prlink.c
index ff06b33d..7516ef0e 100644
--- a/pr/src/linking/prlink.c
+++ b/pr/src/linking/prlink.c
@@ -32,7 +32,7 @@
#include <dlfcn.h>
#elif defined(USE_HPSHL)
#include <dl.h>
-#elif defined(RHAPSODY)
+#elif defined(RHAPSODY) || defined(NEXTSTEP)
#include <mach-o/dyld.h>
#endif
@@ -45,7 +45,7 @@
/*
* On these platforms, symbols have a leading '_'.
*/
-#if defined(SUNOS4) || defined(RHAPSODY) || defined(WIN16)
+#if defined(SUNOS4) || defined(RHAPSODY) || defined(NEXTSTEP) || defined(WIN16)
#define NEED_LEADING_UNDERSCORE
#endif
@@ -71,7 +71,7 @@ struct PRLibrary {
#ifdef XP_UNIX
#if defined(USE_HPSHL)
shl_t dlh;
-#elif defined(RHAPSODY)
+#elif defined(RHAPSODY) || defined(NEXTSTEP)
NSModule dlh;
#else
void* dlh;
@@ -170,7 +170,7 @@ void _PR_InitLinker(void)
#elif defined(USE_HPSHL)
h = NULL;
/* don't abort with this NULL */
-#elif defined(RHAPSODY)
+#elif defined(RHAPSODY) || defined(NEXTSTEP)
h = NULL; /* XXXX toshok */
#else
#error no dll strategy
@@ -641,7 +641,7 @@ PR_LoadLibrary(const char *name)
void *h = dlopen(name, RTLD_LAZY);
#elif defined(USE_HPSHL)
shl_t h = shl_load(name, BIND_DEFERRED | DYNAMIC_PATH, 0L);
-#elif defined(RHAPSODY)
+#elif defined(RHAPSODY) || defined(NEXTSTEP)
NSObjectFileImage ofi;
NSModule h = NULL;
if (NSCreateObjectFileImageFromFile(name, &ofi)
@@ -714,7 +714,7 @@ PR_UnloadLibrary(PRLibrary *lib)
result = dlclose(lib->dlh);
#elif defined(USE_HPSHL)
result = shl_unload(lib->dlh);
-#elif defined(RHAPSODY)
+#elif defined(RHAPSODY) || defined(NEXTSTEP)
result = NSUnLinkModule(lib->dlh, FALSE);
#else
#error Configuration error
@@ -827,7 +827,7 @@ pr_FindSymbolInLib(PRLibrary *lm, const char *name)
if (shl_findsym(&lm->dlh, name, TYPE_PROCEDURE, &f) == -1) {
f = NULL;
}
-#elif defined(RHAPSODY)
+#elif defined(RHAPSODY) || defined(NEXTSTEP)
f = NSAddressOfSymbol(NSLookupAndBindSymbol(name));
#endif
#endif /* HAVE_DLL */
diff --git a/pr/src/md/prosdep.c b/pr/src/md/prosdep.c
index 326b3536..3d288b07 100644
--- a/pr/src/md/prosdep.c
+++ b/pr/src/md/prosdep.c
@@ -42,7 +42,8 @@ static void GetPageSize(void)
/* Get page size */
#ifdef XP_UNIX
#if defined SUNOS4 || defined LINUX || defined BSDI || defined AIX \
- || defined FREEBSD || defined NETBSD || defined OPENBSD || defined RHAPSODY
+ || defined FREEBSD || defined NETBSD || defined OPENBSD \
+ || defined RHAPSODY || defined NEXTSTEP
_pr_pageSize = getpagesize();
#elif defined(HPUX)
/* I have no idea. Don't get me started. --Rob */
diff --git a/pr/src/md/unix/Makefile b/pr/src/md/unix/Makefile
index 7d36371c..3d9e41df 100644
--- a/pr/src/md/unix/Makefile
+++ b/pr/src/md/unix/Makefile
@@ -94,6 +94,10 @@ RHAPSODY_CSRCS = \
rhapsody.c \
$(NULL)
+NEXTSTEP_CSRCS = \
+ nextstep.c \
+ $(NULL)
+
NEC_CSRCS = \
nec.c \
$(NULL)
@@ -163,6 +167,9 @@ endif
ifeq ($(OS_ARCH),Rhapsody)
CSRCS += $(RHAPSODY_CSRCS)
endif
+ifeq ($(OS_ARCH),NEXTSTEP)
+CSRCS += $(NEXTSTEP_CSRCS)
+endif
ifeq ($(OS_ARCH),NEC)
CSRCS += $(NEC_CSRCS)
endif
diff --git a/pr/src/md/unix/objs.mk b/pr/src/md/unix/objs.mk
index 1d321324..311926a9 100644
--- a/pr/src/md/unix/objs.mk
+++ b/pr/src/md/unix/objs.mk
@@ -86,6 +86,10 @@ RHAPSODY_CSRCS = \
rhapsody.c \
$(NULL)
+NEXTSTEP_CSRCS = \
+ nextstep.c \
+ $(NULL)
+
NEC_CSRCS = \
nec.c \
$(NULL)
@@ -156,6 +160,9 @@ endif
ifeq ($(OS_ARCH),Rhapsody)
CSRCS += $(RHAPSODY_CSRCS)
endif
+ifeq ($(OS_ARCH),NEXTSTEP)
+CSRCS += $(NEXTSTEP_CSRCS)
+endif
ifeq ($(OS_ARCH),NEC)
CSRCS += $(NEC_CSRCS)
endif
diff --git a/pr/src/md/unix/unix.c b/pr/src/md/unix/unix.c
index 62de2cab..62096a6d 100644
--- a/pr/src/md/unix/unix.c
+++ b/pr/src/md/unix/unix.c
@@ -46,7 +46,8 @@
#if defined(IRIX) || defined(HPUX) || defined(OSF1) || defined(SOLARIS) \
|| defined(AIX4_1) || defined(LINUX) || defined(SONY) \
|| defined(BSDI) || defined(SCO) || defined(NEC) || defined(SNI) \
- || defined(SUNOS4) || defined(NCR) || defined(RHAPSODY)
+ || defined(SUNOS4) || defined(NCR) || defined(RHAPSODY) \
+ || defined(NEXTSTEP)
#define _PRSockLen_t int
#elif (defined(AIX) && !defined(AIX4_1)) || defined(FREEBSD) \
|| defined(NETBSD) || defined(OPENBSD) || defined(UNIXWARE) || defined(DGUX)
diff --git a/pr/src/md/unix/uxwrap.c b/pr/src/md/unix/uxwrap.c
index a6c7cc06..dd76fd87 100644
--- a/pr/src/md/unix/uxwrap.c
+++ b/pr/src/md/unix/uxwrap.c
@@ -83,6 +83,9 @@ void PR_SetXtHackOkayToReleaseXLockFn(int (*fn)(void))
#if defined(HPUX9)
int select(size_t width, int *rl, int *wl, int *el, const struct timeval *tv)
+#elif defined(NEXTSTEP)
+int wrap_select(int width, fd_set *rd, fd_set *wr, fd_set *ex,
+ const struct timeval *tv)
#elif defined(AIX4_1)
int wrap_select(unsigned long width, void *rl, void *wl, void *el,
struct timeval *tv)
@@ -285,10 +288,11 @@ int select(int width, fd_set *rd, fd_set *wr, fd_set *ex, struct timeval *tv)
}
/*
- * Linux, BSDI, FreeBSD, and Rhapsody don't have poll().
+ * Linux, BSDI, FreeBSD, Rhapsody, and NEXTSTEP don't have poll().
*/
-#if !defined(LINUX) && !defined(FREEBSD) && !defined(BSDI) && !defined(RHAPSODY)
+#if !defined(LINUX) && !defined(FREEBSD) && !defined(BSDI) \
+ && !defined(RHAPSODY) && !defined(NEXTSTEP)
/*
*-----------------------------------------------------------------------
diff --git a/pr/src/misc/pratom.c b/pr/src/misc/pratom.c
index d69bb6b0..499c7480 100644
--- a/pr/src/misc/pratom.c
+++ b/pr/src/misc/pratom.c
@@ -39,11 +39,11 @@
* The lock contention should be acceptable.
*/
-static PRLock *monitor = NULL;
+static PRLock *lock = NULL;
void _PR_MD_INIT_ATOMIC()
{
- if (monitor == NULL) {
- monitor = PR_NewLock();
+ if (lock == NULL) {
+ lock = PR_NewLock();
}
}
@@ -55,9 +55,9 @@ _PR_MD_ATOMIC_INCREMENT(PRInt32 *val)
if (!_pr_initialized) {
_PR_ImplicitInitialization();
}
- PR_Lock(monitor);
+ PR_Lock(lock);
rv = ++(*val);
- PR_Unlock(monitor);
+ PR_Unlock(lock);
return rv;
}
@@ -69,9 +69,9 @@ _PR_MD_ATOMIC_ADD(PRInt32 *ptr, PRInt32 val)
if (!_pr_initialized) {
_PR_ImplicitInitialization();
}
- PR_Lock(monitor);
+ PR_Lock(lock);
rv = ((*ptr) += val);
- PR_Unlock(monitor);
+ PR_Unlock(lock);
return rv;
}
@@ -83,9 +83,9 @@ _PR_MD_ATOMIC_DECREMENT(PRInt32 *val)
if (!_pr_initialized) {
_PR_ImplicitInitialization();
}
- PR_Lock(monitor);
+ PR_Lock(lock);
rv = --(*val);
- PR_Unlock(monitor);
+ PR_Unlock(lock);
return rv;
}
@@ -97,10 +97,10 @@ _PR_MD_ATOMIC_SET(PRInt32 *val, PRInt32 newval)
if (!_pr_initialized) {
_PR_ImplicitInitialization();
}
- PR_Lock(monitor);
+ PR_Lock(lock);
rv = *val;
*val = newval;
- PR_Unlock(monitor);
+ PR_Unlock(lock);
return rv;
}
diff --git a/pr/tests/Makefile b/pr/tests/Makefile
index a004d214..b84afe65 100644
--- a/pr/tests/Makefile
+++ b/pr/tests/Makefile
@@ -281,6 +281,12 @@ ifeq ($(OS_ARCH), NCR)
export LD_RUN_PATH = $(PWD)/$(DIST)/lib
endif
+ifeq ($(OS_ARCH), NEXTSTEP)
+# balazs.pataki@sztaki.hu: linkage is done in a different pass in the `tests'
+# modeul, so we have to pass the `-posix' flag by "hand" to `ld'
+LDOPTS += -posix
+endif
+
ifeq ($(OS_ARCH), NEWS-OS)
# This hardcodes in the executable programs the directory to find
# libnspr.so etc. at program startup. Equivalent to the -R or -rpath