A jumbo checkin, consisting of:
1. Ports to older revisions of some Unix variants, e.g., BSD/OS 1.1,
OSF1 V2.0, etc., contributed by Brian Ostrom <briano@netscape.com>.
2. QNX port, also contributed by Brian Ostrom.
3. New macro USE_MACH_DYLD to represent the dynamic library loading
API of NEXTSTEP and Rhapsody.
4. On platforms whose socket address has the sa_len field, make a
copy of the PRNetAddr argument for PR_Bind, PR_Connect, and PR_SendTo
and set its sa_len before passing it to the system calls. This
fix is suggested by Bert Driehuis <driehuis@playbeing.org>.
5. Removed the unused field _lockf64 of struct _MD_IOVector. Not
every Unix platform has lockf, and the POSIX file locking API
uses fcntl.
--- a/config/AIX.mk
+++ b/config/AIX.mk
@@ -28,18 +28,25 @@ include $(MOD_DEPTH)/config/UNIX.mk
ifdef MOZILLA_CLIENT
ifneq ($(USE_PTHREADS),1)
CLASSIC_NSPR = 1
endif
endif
#
# There are three implementation strategies available on AIX:
-# pthreads, classic, and pthreads-user. The default is pthreads.
+# pthreads, classic, and pthreads-user.
+#
+# On AIX 3.2, classic nspr is the default (and only) implementation
+# strategy. On AIX 4.1 and later, the default is pthreads.
#
+ifeq ($(OS_RELEASE),3.2)
+CLASSIC_NSPR = 1
+endif
+
ifeq ($(CLASSIC_NSPR),1)
PTHREADS_USER =
USE_PTHREADS =
IMPL_STRATEGY = _EMU
DEFINES += -D_PR_LOCAL_THREADS_ONLY
else
ifeq ($(PTHREADS_USER),1)
USE_PTHREADS =
@@ -52,52 +59,68 @@ endif
ifeq ($(CLASSIC_NSPR),1)
CC = xlC
CCC = xlC
else
CC = xlC_r
CCC = xlC_r
endif
+OS_CFLAGS = -qro -qroconst
CPU_ARCH = rs6000
RANLIB = ranlib
-OS_CFLAGS = -qro -qroconst -DAIX -DSYSV
+OS_CFLAGS += -DAIX -DSYSV
ifeq ($(CC),xlC_r)
OS_CFLAGS += -qarch=com
endif
+ifneq ($(OS_RELEASE),3.2)
+OS_CFLAGS += -DAIX_HAVE_ATOMIC_OP_H -DAIX_TIMERS
+endif
+
+ifeq (,$(filter-out 3.2 4.1,$(OS_RELEASE)))
+ifndef USE_PTHREADS
+OS_CFLAGS += -DAIX_RENAME_SELECT
+endif
+endif
+
+ifeq (,$(filter-out 3.2 4.1,$(OS_RELEASE)))
+OS_CFLAGS += -D_PR_NO_LARGE_FILES
+else
+OS_CFLAGS += -D_PR_HAVE_OFF64_T
+endif
+
ifeq ($(OS_RELEASE),4.1)
-OS_CFLAGS += -DAIX4_1 -D_PR_NO_LARGE_FILES
+OS_CFLAGS += -DAIX4_1
else
DSO_LDOPTS = -brtl -bM:SRE -bnoentry -bexpall
MKSHLIB = $(LD) $(DSO_LDOPTS)
ifeq ($(OS_RELEASE),4.3)
OS_CFLAGS += -DAIX4_3
endif
endif
ifeq (,$(filter-out 4.2 4.3,$(OS_RELEASE)))
# On these OS revisions, localtime_r() is declared if _THREAD_SAFE
# is defined.
ifneq ($(CLASSIC_NSPR),1)
OS_CFLAGS += -DHAVE_POINTER_LOCALTIME_R
endif
-OS_CFLAGS += -D_PR_HAVE_OFF64_T
endif
#
# Special link info for constructing AIX programs. On AIX we have to
# statically link programs that use NSPR into a single .o, rewriting the
# calls to select to call "aix". Once that is done we then can
# link that .o with a .o built in nspr which implements the system call.
#
-ifneq ($(OS_RELEASE),4.1)
+ifneq (,$(filter-out 3.2 4.1,$(OS_RELEASE)))
AIX_LINK_OPTS = -brtl -bnso -berok
else
AIX_LINK_OPTS = -bnso -berok
#AIX_LINK_OPTS = -bnso -berok -brename:.select,.wrap_select -brename:.poll,.wrap_poll -bI:/usr/lib/syscalls.exp
endif
AIX_WRAP = $(DIST)/lib/aixwrap.o
AIX_TMP = $(OBJDIR)/_aix_tmp.o
--- a/config/BSD_OS.mk
+++ b/config/BSD_OS.mk
@@ -16,30 +16,42 @@
#
#
# Config stuff for BSDI Unix for x86.
#
include $(MOD_DEPTH)/config/UNIX.mk
-#CC = gcc -Wall -Wno-format
-#CCC = g++
+ifeq ($(OS_RELEASE),1.1)
+CC = gcc -Wall -Wno-format
+CCC = g++
+else
CC = shlicc2
CCC = shlicc2
+endif
RANLIB = ranlib
DEFINES += -D_PR_LOCAL_THREADS_ONLY
OS_CFLAGS = -DBSDI -DHAVE_STRERROR -D__386BSD__ -DNEED_BSDREGEX -Di386
-OS_LIBS = -lcompat -ldl
ifeq ($(OS_RELEASE),2.1)
-OS_CFLAGS += -DBSDI_2 -D_PR_TIMESPEC_HAS_TS_SEC
+OS_CFLAGS += -D_PR_TIMESPEC_HAS_TS_SEC
endif
-G++INCLUDES = -I/usr/include/g++
+ifeq (,$(filter-out 1.1 2.1,$(OS_RELEASE)))
+OS_CFLAGS += -D_PR_BSDI_JMPBUF_IS_ARRAY
+else
+OS_CFLAGS += -D_PR_SELECT_CONST_TIMEVAL -D_PR_BSDI_JMPBUF_IS_STRUCT
+endif
CPU_ARCH = x86
NOSUCHFILE = /no-such-file
+ifeq ($(OS_RELEASE),1.1)
+OS_CFLAGS += -D_PR_STAT_HAS_ONLY_ST_ATIME -D_PR_NEED_H_ERRNO
+else
+OS_CFLAGS += -DHAVE_DLL -DUSE_DLFCN -D_PR_STAT_HAS_ST_ATIMESPEC
+OS_LIBS = -ldl
MKSHLIB = $(LD) $(DSO_LDOPTS)
DSO_LDOPTS = -r
+endif
--- a/config/IRIX.mk
+++ b/config/IRIX.mk
@@ -27,20 +27,26 @@ include $(MOD_DEPTH)/config/UNIX.mk
#
ifdef MOZILLA_CLIENT
ifneq ($(USE_PTHREADS),1)
CLASSIC_NSPR = 1
endif
endif
#
-# The default implementation strategy for Irix is pthreads.
-# Classic nspr (user-level threads on top of sprocs) is also
-# available.
+# On IRIX 5.3, classic nspr (user-level threads on top of sprocs)
+# is the default (and only) implementation strategy.
#
+# On IRIX 6.2 and later, the default implementation strategy is
+# pthreads. Classic nspr is also available.
+#
+ifeq ($(OS_RELEASE),5.3)
+CLASSIC_NSPR = 1
+endif
+
ifeq ($(CLASSIC_NSPR),1)
IMPL_STRATEGY = _MxN
else
USE_PTHREADS = 1
USE_N32 = 1
IMPL_STRATEGY = _PTH
endif
@@ -103,16 +109,20 @@ RANLIB = /bin/true
# For purify
# XXX: should always define _SGI_MP_SOURCE
NOMD_OS_CFLAGS = $(ODD_CFLAGS) -D_SGI_MP_SOURCE
ifeq ($(OS_RELEASE),5.3)
OS_CFLAGS += -DIRIX5_3
endif
+ifeq (,$(filter-out 6.5,$(OS_RELEASE)))
+OS_CFLAGS += -D_PR_HAVE_GETPROTO_R -D_PR_HAVE_GETPROTO_R_POINTER
+endif
+
ifndef NO_MDUPDATE
OS_CFLAGS += $(NOMD_OS_CFLAGS) -MDupdate $(DEPENDENCIES)
else
OS_CFLAGS += $(NOMD_OS_CFLAGS)
endif
# -rdata_shared is an ld option that puts string constants and
# const data into the text segment, where they will be shared
--- a/config/Linux.mk
+++ b/config/Linux.mk
@@ -45,17 +45,17 @@ else
USE_PTHREADS = 1
IMPL_STRATEGY = _PTH
DEFINES += -D_REENTRANT
endif
ifeq (86,$(findstring 86,$(OS_TEST)))
CPU_ARCH := x86
else
-ifeq (,$(filter-out sa110,$(OS_TEST)))
+ifeq (,$(filter-out armv41 sa110,$(OS_TEST)))
CPU_ARCH := arm
else
CPU_ARCH := $(OS_TEST)
endif
endif
CPU_ARCH_TAG = _$(CPU_ARCH)
CC = gcc
--- a/config/Makefile
+++ b/config/Makefile
@@ -29,17 +29,17 @@ ifeq ($(OS_ARCH), WINNT)
PROG_SUFFIX = .exe
else
PROG_SUFFIX =
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 NEXTSTEP SCOOS UNIXWARE,$(OS_ARCH)))
+ifeq (,$(filter-out NEC NEXTSTEP QNX SCOOS UNIXWARE,$(OS_ARCH)))
DEFINES += -DOMIT_LIB_BUILD_TIME
endif
ifeq ($(OS_ARCH), IRIX)
ifeq ($(basename $(OS_RELEASE)),6)
ifeq ($(USE_N32),1)
XLDOPTS += -n32 -Wl,-woff,85
ifeq ($(OS_RELEASE), 6_2)
@@ -78,17 +78,17 @@ ifeq ($(OS_ARCH),WINNT)
TARGETS = $(PROGS)
else
PROGS += $(OBJDIR)/nsinstall$(PROG_SUFFIX)
TARGETS = $(PROGS) $(PLSRCS:.pl=)
endif
# Redefine MAKE_OBJDIR for just this directory
define MAKE_OBJDIR
-if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); fi
+if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); else true; fi
endef
export:: $(TARGETS)
$(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
@$(MAKE_OBJDIR)
ifeq ($(MOZ_OS2_TOOLS),VACPP)
$(LINK) $(EXEFLAGS) $<
--- a/config/NCR.mk
+++ b/config/NCR.mk
@@ -28,16 +28,22 @@ NS_USE_NATIVE = 1
export PATH:=$(PATH):/opt/ncc/bin
###
RANLIB = true
GCC_FLAGS_EXTRA = -pipe
DEFINES += -DSVR4 -DSYSV -DHAVE_STRERROR -DNCR -D_PR_LOCAL_THREADS_ONLY
+ifeq (,$(filter-out 2.03,$(OS_RELEASE)))
+DEFINES += -D_PR_STAT_HAS_ST_ATIM
+else
+DEFINES += -D_PR_STAT_HAS_ST_ATIM_UNION
+endif
+
ifdef NS_USE_NATIVE
CC = cc
CCC = ncc
OS_CFLAGS = -Hnocopyr
#OS_LIBS = -L/opt/ncc/lib
else
#OS_LIBS =
endif
--- a/config/OSF1.mk
+++ b/config/OSF1.mk
@@ -34,49 +34,58 @@ include $(MOD_DEPTH)/config/UNIX.mk
#
ifdef MOZILLA_CLIENT
ifneq ($(USE_PTHREADS),1)
CLASSIC_NSPR = 1
endif
endif
#
-# On OSF1 V3.2, classic nspr is the default (and only) implementation
+# Prior to OSF1 V4.0, classic nspr is the default (and only) implementation
# strategy.
#
# On OSF1 V4.0, pthreads is the default implementation strategy.
# Classic nspr is also available.
#
-ifneq ($(OS_RELEASE),V3.2)
+ifeq (,$(filter-out V2.0 V3.2,$(OS_RELEASE)))
+CLASSIC_NSPR = 1
+endif
+
ifeq ($(CLASSIC_NSPR), 1)
IMPL_STRATEGY = _EMU
DEFINES += -D_PR_LOCAL_THREADS_ONLY
else
USE_PTHREADS = 1
IMPL_STRATEGY = _PTH
endif
+
+CC = cc $(NON_LD_FLAGS) -std1
+ifneq ($(OS_RELEASE),V2.0)
+CC += -readonly_strings
endif
-
-CC = cc $(NON_LD_FLAGS) -std1 -readonly_strings
# The C++ compiler cxx has -readonly_strings on by default.
CCC = cxx
RANLIB = /bin/true
CPU_ARCH = alpha
ifdef BUILD_OPT
OPTIMIZER += -Olimit 4000
endif
NON_LD_FLAGS = -ieee_with_inexact
OS_CFLAGS = -DOSF1 -D_REENTRANT
-ifeq ($(OS_RELEASE),V3.2)
+ifneq (,$(filter-out V2.0 V3.2,$(OS_RELEASE)))
+OS_CFLAGS += -DOSF1_HAVE_MACHINE_BUILTINS_H
+endif
+
+ifeq (,$(filter-out V2.0 V3.2,$(OS_RELEASE)))
OS_CFLAGS += -DHAVE_INT_LOCALTIME_R
endif
ifeq (V4,$(findstring V4,$(OS_RELEASE)))
OS_CFLAGS += -DHAVE_POINTER_LOCALTIME_R
endif
ifeq ($(USE_PTHREADS),1)
new file mode 100644
--- /dev/null
+++ b/config/QNX.mk
@@ -0,0 +1,39 @@
+#
+# The contents of this file are subject to the Netscape Public License
+# Version 1.0 (the "NPL"); you may not use this file except in
+# compliance with the NPL. You may obtain a copy of the NPL at
+# http://www.mozilla.org/NPL/
+#
+# Software distributed under the NPL is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
+# for the specific language governing rights and limitations under the
+# NPL.
+#
+# The Initial Developer of this code under the NPL is Netscape
+# Communications Corporation. Portions created by Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All Rights
+# Reserved.
+#
+
+######################################################################
+# Config stuff for QNX.
+######################################################################
+
+include $(MOD_DEPTH)/config/UNIX.mk
+
+CPU_ARCH = x86
+
+ifndef NS_USE_GCC
+CC = cc
+CCC = cc
+endif
+RANLIB = true
+
+G++INCLUDES =
+OS_LIBS =
+XLDOPTS = -lunix
+
+OS_CFLAGS = -DQNX -Di386 -D_PR_LOCAL_THREADS_ONLY -D_PR_NEED_H_ERRNO
+#IMPL_STRATEGY = _EMU
+
+NOSUCHFILE = /no-such-file
--- a/config/SINIX.mk
+++ b/config/SINIX.mk
@@ -16,27 +16,40 @@
#
#
# Config stuff for SNI SINIX (aka ReliantUNIX)
#
include $(MOD_DEPTH)/config/UNIX.mk
+ifeq (86,$(findstring 86,$(OS_TEST)))
+CPU_ARCH = x86
+else
+CPU_ARCH = mips
+endif
+CPU_ARCH_TAG = _$(CPU_ARCH)
+
# use gcc -tf-
NS_USE_GCC = 1
ifeq ($(NS_USE_GCC),1)
## gcc-2.7.2 homebrewn
CC = gcc
COMPILER_TAG = _gcc
CCC = g++
AS = $(CC) -x assembler-with-cpp
+ifeq ($(CPU_ARCH),mips)
LD = gld
-ODD_CFLAGS = -pipe -Wall -Wno-format
+endif
+ODD_CFLAGS = -Wall -Wno-format
+ifeq ($(CPU_ARCH),mips)
+# The -pipe flag only seems to work on the mips version of SINIX.
+ODD_CFLAGS += -pipe
+endif
ifdef BUILD_OPT
OPTIMIZER = -O
#OPTIMIZER = -O6
endif
MKSHLIB = $(LD) -G -z defs -h $(@:$(OBJDIR)/%.so=%.so)
#DSO_LDOPTS = -G -Xlinker -Blargedynsym
else
## native compiler (CDS++ 1.0)
@@ -57,18 +70,16 @@ ODD_CFLAGS += -DSVR4 -DSNI -DRELIANTUNI
# On SINIX 5.43, need to define IP_MULTICAST in order to get the
# IP multicast macro and struct definitions in netinet/in.h.
# (SINIX 5.42 does not have IP multicast at all.)
ifeq ($(OS_RELEASE),5.43)
ODD_CFLAGS += -DIP_MULTICAST
endif
-CPU_ARCH = mips
-
RANLIB = /bin/true
# For purify
NOMD_OS_CFLAGS = $(ODD_CFLAGS)
# we do not have -MDupdate ...
OS_CFLAGS = $(NOMD_OS_CFLAGS)
OS_LIBS = -lsocket -lnsl -lresolv -ldl -lc
--- a/config/SunOS5.mk
+++ b/config/SunOS5.mk
@@ -97,18 +97,22 @@ endif
else
CPU_ARCH = sparc
endif
CPU_ARCH_TAG = _$(CPU_ARCH)
ifeq (5.5,$(findstring 5.5,$(OS_RELEASE)))
OS_DEFINES += -DSOLARIS2_5
else
+ifeq (,$(filter-out 5.3 5.4,$(OS_RELEASE)))
+OS_DEFINES += -D_PR_NO_LARGE_FILES
+else
OS_DEFINES += -D_PR_HAVE_OFF64_T
endif
+endif
ifneq ($(LOCAL_THREADS_ONLY),1)
OS_DEFINES += -D_REENTRANT -DHAVE_POINTER_LOCALTIME_R
endif
# Purify doesn't like -MDupdate
NOMD_OS_CFLAGS = $(DSO_CFLAGS) $(OS_DEFINES) $(SOL_CFLAGS)
--- a/config/UNIX.mk
+++ b/config/UNIX.mk
@@ -66,10 +66,10 @@ ifeq ($(NSDISTMODE),absolute_symlink)
INSTALL = $(NSINSTALL) -L `$(NFSPWD)`
else
# install using relative symbolic links
INSTALL = $(NSINSTALL) -R
endif
endif
define MAKE_OBJDIR
-if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi
+if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); else true; fi
endef
--- a/config/arch.mk
+++ b/config/arch.mk
@@ -55,26 +55,32 @@ OS_ARCH := NCR
endif
# This is the only way to correctly determine the actual OS version on NCR boxes.
ifeq ($(OS_ARCH),NCR)
OS_RELEASE := $(shell awk '{print $$3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$$/\2.\3/')
endif
ifeq ($(OS_ARCH),UNIX_System_V)
OS_ARCH := NEC
endif
+ifeq ($(OS_ARCH),QNX)
+OS_RELEASE := $(shell uname -v | sed 's/^\([0-9]\)\([0-9]*\)$$/\1.\2/')
+endif
ifeq ($(OS_ARCH),SCO_SV)
OS_ARCH := SCOOS
OS_RELEASE := 5.0
endif
ifeq ($(OS_ARCH),SINIX-N)
OS_ARCH := SINIX
endif
ifeq ($(OS_ARCH),SINIX-Y)
OS_ARCH := SINIX
endif
+ifeq ($(OS_ARCH),SINIX-Z)
+OS_ARCH := SINIX
+endif
# SINIX changes name to ReliantUNIX with 5.43
ifeq ($(OS_ARCH),ReliantUNIX-N)
OS_ARCH := SINIX
endif
ifeq ($(OS_ARCH),UnixWare)
OS_ARCH := UNIXWARE
OS_RELEASE := $(shell uname -v)
endif
--- a/config/nsinstall.c
+++ b/config/nsinstall.c
@@ -38,17 +38,19 @@
#ifdef USE_REENTRANT_LIBC
#include "libc_r.h"
#endif /* USE_REENTRANT_LIBC */
#include "pathsub.h"
#define HAVE_LCHOWN
-#if defined(AIX) || defined(BSDI) || defined(HPUX) || defined(LINUX) || defined(SUNOS4) || defined(SCO) || defined(UNIXWARE) || defined(RHAPSODY) || defined(NEXTSTEP)
+#if defined(AIX) || defined(BSDI) || defined(HPUX) || defined(LINUX) \
+ || defined(SUNOS4) || defined(SCO) || defined(UNIXWARE) \
+ || defined(RHAPSODY) || defined(NEXTSTEP) || defined(QNX)
#undef HAVE_LCHOWN
#endif
/*
* Does getcwd() take NULL as the first argument and malloc
* the result buffer?
*/
#if !defined(RHAPSODY) && !defined(NEXTSTEP)
@@ -88,16 +90,20 @@ my_getcwd (char *buf, size_t size)
#define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK)
#endif
#endif
#if defined(SNI)
extern int fchmod(int fildes, mode_t mode);
#endif
+#ifdef QNX
+#define d_ino d_stat.st_ino
+#endif
+
static void
usage(void)
{
fprintf(stderr,
"usage: %s [-C cwd] [-L linkprefix] [-m mode] [-o owner] [-g group]\n"
" %*s [-DdltR] file [file ...] directory\n",
program, (int)strlen(program), "");
exit(2);
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -190,32 +190,40 @@ realclean clobber_all::
+$(LOOP_OVER_DIRS)
release:: export
ifdef RELEASE_LIBS
@echo "Copying libraries to release directory"
@if test -z "$(BUILD_NUMBER)"; then \
echo "BUILD_NUMBER must be defined"; \
false; \
+ else \
+ true; \
fi
@if test ! -d $(RELEASE_LIB_DIR); then \
rm -rf $(RELEASE_LIB_DIR); \
$(NSINSTALL) -D $(RELEASE_LIB_DIR);\
+ else \
+ true; \
fi
cp $(RELEASE_LIBS) $(RELEASE_LIB_DIR)
endif
ifdef RELEASE_HEADERS
@echo "Copying header files to release directory"
@if test -z "$(BUILD_NUMBER)"; then \
echo "BUILD_NUMBER must be defined"; \
false; \
+ else \
+ true; \
fi
@if test ! -d $(RELEASE_HEADERS_DEST); then \
rm -rf $(RELEASE_HEADERS_DEST); \
$(NSINSTALL) -D $(RELEASE_HEADERS_DEST);\
+ else \
+ true; \
fi
cp $(RELEASE_HEADERS) $(RELEASE_HEADERS_DEST)
endif
+$(LOOP_OVER_DIRS)
alltags:
rm -f TAGS tags
find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs etags -a
@@ -319,17 +327,17 @@ endif
endif
$(OBJDIR)/%.$(OBJ_SUFFIX): %.cpp
@$(MAKE_OBJDIR)
ifeq ($(OS_ARCH), WINNT)
ifndef XP_OS2_EMX
$(CCC) -Fo$@ -c $(CCCFLAGS) $<
else
- $(CCC) -o $@ -c $(CFLAGS) $<
+ $(CCC) -o $@ -c $(CCCFLAGS) $<
endif
else
$(CCC) -o $@ -c $(CCCFLAGS) $<
endif
WCCFLAGS1 = $(subst /,\\,$(CFLAGS))
WCCFLAGS2 = $(subst -I,-i=,$(WCCFLAGS1))
WCCFLAGS3 = $(subst -D,-d,$(WCCFLAGS2))
--- a/pr/include/md/Makefile
+++ b/pr/include/md/Makefile
@@ -122,16 +122,20 @@ endif
ifeq ($(OS_ARCH),NCR)
MDCPUCFG_H = _ncr.cfg
endif
ifeq ($(OS_ARCH),DGUX)
MDCPUCFG_H = _dgux.cfg
endif
+ifeq ($(OS_ARCH),QNX)
+MDCPUCFG_H = _qnx.cfg
+endif
+
export:: $(HEADERS) $(MDCPUCFG_H)
$(INSTALL) -m 444 $(HEADERS) $(DIST)/include/md
$(INSTALL) -m 444 $(MDCPUCFG_H) $(DIST)/include
ifeq ($(MOZ_BITS),16)
cp $(DIST)/include/$(MDCPUCFG_H) $(DIST)/include/prcpucfg.h
$(INSTALL) -m 444 $(HEADERS) $(MOZ_INCL)/md
$(INSTALL) -m 444 $(MDCPUCFG_H) $(MOZ_INCL)
mv -f $(DIST)/include/$(MDCPUCFG_H) $(MOZ_INCL)/prcpucfg.h
--- a/pr/include/md/_aix.h
+++ b/pr/include/md/_aix.h
@@ -51,38 +51,39 @@
#define HAVE_DLL
#define USE_DLFCN
#define _PR_HAVE_SOCKADDR_LEN
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
#define _PR_STAT_HAS_ONLY_ST_ATIME
/* Timer operations */
-#define AIX_TIMERS
#if defined(AIX_TIMERS)
extern PRIntervalTime _MD_AixGetInterval(void);
#define _MD_GET_INTERVAL _MD_AixGetInterval
extern PRIntervalTime _MD_AixIntervalPerSec(void);
#define _MD_INTERVAL_PER_SEC _MD_AixIntervalPerSec
#else /* defined(AIX_TIMERS) */
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
#endif /* defined(AIX_TIMERS) */
+#ifdef AIX_HAVE_ATOMIC_OP_H
/* The atomic operations */
#include <sys/atomic_op.h>
#define _PR_HAVE_ATOMIC_OPS
#define _PR_HAVE_ATOMIC_CAS
#define _MD_INIT_ATOMIC()
#define _MD_ATOMIC_INCREMENT(val) ((PRInt32)fetch_and_add((atomic_p)val, 1) + 1)
#define _MD_ATOMIC_ADD(ptr, val) ((PRInt32)fetch_and_add((atomic_p)ptr, val) + val)
#define _MD_ATOMIC_DECREMENT(val) ((PRInt32)fetch_and_add((atomic_p)val, -1) - 1)
#define _MD_ATOMIC_SET(val, newval) _AIX_AtomicSet(val, newval)
+#endif /* AIX_HAVE_ATOMIC_OP_H */
#define USE_SETJMP
#include <setjmp.h>
#define _MD_GET_SP(_t) (_t)->md.jb[3]
#define _MD_SET_THR_SP(_t, _sp) ((_t)->md.jb[3] = (int) (_sp - 2 * 64))
#define PR_NUM_GCREGS _JBLEN
@@ -208,14 +209,14 @@ struct _MDCPU {
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread)
#define _MD_RESUME_THREAD(thread)
#define _MD_CLEAN_THREAD(_thread)
#endif /* PTHREADS_USER */
-#ifdef AIX4_1
+#ifdef AIX_RENAME_SELECT
#define _MD_SELECT select
#define _MD_POLL poll
#endif
#endif /* nspr_aix_defs_h___ */
--- a/pr/include/md/_bsdi.h
+++ b/pr/include/md/_bsdi.h
@@ -27,36 +27,31 @@
#define _PR_SI_SYSNAME "BSDI"
#define _PR_SI_ARCHITECTURE "x86"
#define PR_DLL_SUFFIX ".so"
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MMAP_FLAGS MAP_PRIVATE
-#define HAVE_DLL
-#define USE_DLFCN
#define HAVE_BSD_FLOCK
#define NEED_TIME_R
#define _PR_HAVE_SOCKADDR_LEN
-#define _PR_STAT_HAS_ST_ATIMESPEC
#define _PR_NO_LARGE_FILES
-#if defined(BSDI_2)
-#define PROT_NONE 0x0
-#endif
-
#define USE_SETJMP
#include <setjmp.h>
-#if defined(BSDI_2)
+#if defined(_PR_BSDI_JMPBUF_IS_ARRAY)
#define _MD_GET_SP(_t) (_t)->md.context[2]
+#elif defined(_PR_BSDI_JMPBUF_IS_STRUCT)
+#define _MD_GET_SP(_t) (_t)->md.context[0].jb_esp
#else
-#define _MD_GET_SP(_t) (_t)->md.context[0].jb_esp
+#error "Unknown BSDI jmp_buf type"
#endif
#define PR_NUM_GCREGS _JBLEN
#define PR_CONTEXT_TYPE jmp_buf
#define CONTEXT(_th) ((_th)->md.context)
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
--- a/pr/include/md/_darwin.h
+++ b/pr/include/md/_darwin.h
@@ -34,16 +34,17 @@
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#undef HAVE_STACK_GROWING_UP
#define HAVE_DLL
+#define USE_MACH_DYLD
#define _PR_HAVE_SOCKADDR_LEN
#define _PR_STAT_HAS_ST_ATIMESPEC
#define _PR_TIMESPEC_HAS_TS_SEC
#define _PR_NO_LARGE_FILES
#define USE_SETJMP
#if !defined(_PR_PTHREADS)
--- a/pr/include/md/_ncr.h
+++ b/pr/include/md/_ncr.h
@@ -43,17 +43,16 @@
#ifndef HAVE_WEAK_IO_SYMBOLS
#define HAVE_WEAK_IO_SYMBOLS
#endif
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
#define _PR_NO_LARGE_FILES
-#define _PR_STAT_HAS_ST_ATIM_UNION
#undef HAVE_STACK_GROWING_UP
#define HAVE_NETCONFIG
#define NEED_STRFTIME_LOCK
#define NEED_TIME_R
#define NEED_LOCALTIME_R
#define NEED_GMTIME_R
#define NEED_ASCTIME_R
--- a/pr/include/md/_nextstep.h
+++ b/pr/include/md/_nextstep.h
@@ -49,19 +49,18 @@ error Unknown NEXTSTEP architecture
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#undef HAVE_STACK_GROWING_UP
#define HAVE_WEAK_MALLOC_SYMBOLS
-/* do this until I figure out the rhapsody dll stuff. */
#define HAVE_DLL
-#define USE_RLD
+#define USE_MACH_DYLD
#define _PR_HAVE_SOCKADDR_LEN
#define _PR_STAT_HAS_ONLY_ST_ATIME
#define _PR_NO_LARGE_FILES
#define USE_SETJMP
#ifndef _PR_PTHREADS
@@ -247,18 +246,16 @@ extern PRIntervalTime _PR_UNIX_TicksPerS
/* mmap */
/* balazs.pataki@sztaki.hu: NEXTSTEP doesn't have mmap, at least not
** publically. We have sys/mman.h, but it doesn't declare mmap(), and
** PROT_NONE is also missing. syscall.h has entries for mmap, munmap, and
** mprotect so I wrap these in nextstep.c as mmap(), munmap() and mprotect()
** and pray for it to work.
**
*/
-#define PROT_NONE 0x0
-
caddr_t mmap(caddr_t addr, size_t len, int prot, int flags,
int fildes, off_t off);
int munmap(caddr_t addr, size_t len);
int mprotect(caddr_t addr, size_t len, int prot);
/* my_mmap() is implemented in nextstep.c and is based on map_fd() of mach.
*/
caddr_t my_mmap(caddr_t addr, size_t len, int prot, int flags,
--- a/pr/include/md/_osf1.h
+++ b/pr/include/md/_osf1.h
@@ -37,18 +37,16 @@
#undef HAVE_WEAK_IO_SYMBOLS
#undef HAVE_WEAK_MALLOC_SYMBOLS
#define HAVE_DLL
#define HAVE_BSD_FLOCK
#define NEED_TIME_R
#define USE_DLFCN
-#define _PR_HAVE_ATOMIC_OPS
-#define _PR_HAVE_ATOMIC_CAS
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
#define _PR_STAT_HAS_ONLY_ST_ATIME
#define _PR_HAVE_LARGE_OFF_T
#define USE_SETJMP
#include <setjmp.h>
@@ -182,28 +180,31 @@ struct _MDCPU {
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread)
#define _MD_RESUME_THREAD(thread)
#define _MD_CLEAN_THREAD(_thread)
/* The following defines unwrapped versions of select() and poll(). */
+#include <sys/time.h>
extern int __select (int, fd_set *, fd_set *, fd_set *, struct timeval *);
#define _MD_SELECT __select
#include <sys/poll.h>
#define _MD_POLL __poll
extern int __poll(struct pollfd filedes[], unsigned int nfds, int timeout);
/*
* Atomic operations
*/
-#ifdef _PR_HAVE_ATOMIC_OPS
+#ifdef OSF1_HAVE_MACHINE_BUILTINS_H
#include <machine/builtins.h>
+#define _PR_HAVE_ATOMIC_OPS
+#define _PR_HAVE_ATOMIC_CAS
#define _MD_INIT_ATOMIC()
#define _MD_ATOMIC_INCREMENT(val) (__ATOMIC_INCREMENT_LONG(val) + 1)
#define _MD_ATOMIC_ADD(ptr, val) (__ATOMIC_ADD_LONG(ptr, val) + val)
#define _MD_ATOMIC_DECREMENT(val) (__ATOMIC_DECREMENT_LONG(val) - 1)
#define _MD_ATOMIC_SET(val, newval) __ATOMIC_EXCH_LONG(val, newval)
-#endif /* _PR_HAVE_ATOMIC_OPS */
+#endif /* OSF1_HAVE_MACHINE_BUILTINS_H */
#endif /* nspr_osf1_defs_h___ */
new file mode 100644
--- /dev/null
+++ b/pr/include/md/_qnx.cfg
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.0 (the "NPL"); you may not use this file except in
+ * compliance with the NPL. You may obtain a copy of the NPL at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the NPL is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
+ * for the specific language governing rights and limitations under the
+ * NPL.
+ *
+ * The Initial Developer of this code under the NPL is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All Rights
+ * Reserved.
+ */
+
+#ifndef nspr_cpucfg___
+#define nspr_cpucfg___
+
+#ifndef XP_UNIX
+#define XP_UNIX
+#endif
+
+#ifndef QNX
+#define QNX
+#endif
+
+#define IS_LITTLE_ENDIAN 1
+#undef IS_BIG_ENDIAN
+#undef HAVE_LONG_LONG
+#undef HAVE_ALIGNED_DOUBLES
+#undef HAVE_ALIGNED_LONGLONGS
+
+#define PR_BYTES_PER_BYTE 1
+#define PR_BYTES_PER_SHORT 2
+#define PR_BYTES_PER_INT 4
+#define PR_BYTES_PER_INT64 8
+#define PR_BYTES_PER_LONG 4
+#define PR_BYTES_PER_FLOAT 4
+#define PR_BYTES_PER_DOUBLE 8
+#define PR_BYTES_PER_WORD 4
+#define PR_BYTES_PER_DWORD 8
+
+#define PR_BITS_PER_BYTE 8
+#define PR_BITS_PER_SHORT 16
+#define PR_BITS_PER_INT 32
+#define PR_BITS_PER_INT64 64
+#define PR_BITS_PER_LONG 32
+#define PR_BITS_PER_FLOAT 32
+#define PR_BITS_PER_DOUBLE 64
+#define PR_BITS_PER_WORD 32
+
+#define PR_BITS_PER_BYTE_LOG2 3
+#define PR_BITS_PER_SHORT_LOG2 4
+#define PR_BITS_PER_INT_LOG2 5
+#define PR_BITS_PER_INT64_LOG2 6
+#define PR_BITS_PER_LONG_LOG2 5
+#define PR_BITS_PER_FLOAT_LOG2 5
+#define PR_BITS_PER_DOUBLE_LOG2 6
+#define PR_BITS_PER_WORD_LOG2 5
+
+#define PR_ALIGN_OF_SHORT 1
+#define PR_ALIGN_OF_INT 1
+#define PR_ALIGN_OF_LONG 1
+#define PR_ALIGN_OF_INT64 1
+#define PR_ALIGN_OF_FLOAT 1
+#define PR_ALIGN_OF_DOUBLE 1
+#define PR_ALIGN_OF_POINTER 1
+#define PR_ALIGN_OF_WORD 1
+
+#define PR_BYTES_PER_WORD_LOG2 2
+#define PR_BYTES_PER_DWORD_LOG2 3
+#define PR_WORDS_PER_DWORD_LOG2 1
+
+#endif /* nspr_cpucfg___ */
new file mode 100644
--- /dev/null
+++ b/pr/include/md/_qnx.h
@@ -0,0 +1,196 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.0 (the "NPL"); you may not use this file except in
+ * compliance with the NPL. You may obtain a copy of the NPL at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the NPL is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
+ * for the specific language governing rights and limitations under the
+ * NPL.
+ *
+ * The Initial Developer of this code under the NPL is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All Rights
+ * Reserved.
+ */
+
+#ifndef nspr_qnx_defs_h___
+#define nspr_qnx_defs_h___
+
+/*
+** Internal configuration macros
+*/
+#define PR_LINKER_ARCH "qnx"
+#define _PR_SI_SYSNAME "QNX"
+#define _PR_SI_ARCHITECTURE "x86"
+#define PR_DLL_SUFFIX ".so"
+
+#define _PR_VMBASE 0x30000000
+#define _PR_STACK_VMBASE 0x50000000
+#define _MD_DEFAULT_STACK_SIZE 65536L
+#define _MD_MMAP_FLAGS MAP_PRIVATE
+
+#ifndef HAVE_WEAK_IO_SYMBOLS
+#define HAVE_WEAK_IO_SYMBOLS
+#endif
+
+#undef _PR_POLL_AVAILABLE
+#undef _PR_USE_POLL
+#define _PR_HAVE_SOCKADDR_LEN
+#define HAVE_BSD_FLOCK
+#define _PR_NO_LARGE_FILES
+#define _PR_STAT_HAS_ONLY_ST_ATIME
+
+#include <sys/select.h>
+
+#undef HAVE_STACK_GROWING_UP
+#undef HAVE_DLL
+#undef USE_DLFCN
+#define NEED_STRFTIME_LOCK
+#define NEED_TIME_R
+#define _PR_NEED_STRCASECMP
+
+#ifndef HAVE_STRERROR
+#define HAVE_STRERROR
+#endif
+
+#define USE_SETJMP
+
+#include <setjmp.h>
+
+#define _SETJMP setjmp
+#define _LONGJMP longjmp
+#define _PR_CONTEXT_TYPE jmp_buf
+#define _PR_NUM_GCREGS _JBLEN
+#define _MD_GET_SP(_t) (_t)->md.context[7]
+
+#define CONTEXT(_th) ((_th)->md.context)
+
+/*
+** Initialize the thread context preparing it to execute _main.
+*/
+#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
+{ \
+ *status = PR_TRUE; \
+ if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
+ _MD_GET_SP(_thread) = (int) ((_sp) - 128); \
+}
+
+#define _MD_SWITCH_CONTEXT(_thread) \
+ if (!_SETJMP(CONTEXT(_thread))) { \
+ (_thread)->md.errcode = errno; \
+ _PR_Schedule(); \
+ }
+
+/*
+** Restore a thread context, saved by _MD_SWITCH_CONTEXT
+*/
+#define _MD_RESTORE_CONTEXT(_thread) \
+{ \
+ errno = (_thread)->md.errcode; \
+ _MD_SET_CURRENT_THREAD(_thread); \
+ _LONGJMP(CONTEXT(_thread), 1); \
+}
+
+/*
+** Machine-dependent (MD) data structures.
+*/
+struct _MDThread {
+ _PR_CONTEXT_TYPE context;
+ int id;
+ int errcode;
+};
+
+struct _MDThreadStack {
+ PRInt8 notused;
+};
+
+struct _MDLock {
+ PRInt8 notused;
+};
+
+struct _MDSemaphore {
+ PRInt8 notused;
+};
+
+struct _MDCVar {
+ PRInt8 notused;
+};
+
+struct _MDSegment {
+ PRInt8 notused;
+};
+
+/*
+** md-specific cpu structure field
+*/
+#define _PR_MD_MAX_OSFD FD_SETSIZE
+
+struct _MDCPU_Unix {
+ PRCList ioQ;
+ PRUint32 ioq_timeout;
+ PRInt32 ioq_max_osfd;
+ PRInt32 ioq_osfd_cnt;
+#ifndef _PR_USE_POLL
+ fd_set fd_read_set, fd_write_set, fd_exception_set;
+ PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD], fd_write_cnt[_PR_MD_MAX_OSFD], fd_exception_cnt[_PR_MD_MAX_OSFD];
+#else
+ struct pollfd *ioq_pollfds;
+ int ioq_pollfds_size;
+#endif
+};
+
+#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
+#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
+#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
+#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
+#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
+#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
+#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
+#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
+#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
+#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
+#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
+#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
+#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
+
+#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
+
+struct _MDCPU {
+ struct _MDCPU_Unix md_unix;
+};
+
+#define _MD_INIT_LOCKS()
+#define _MD_NEW_LOCK(lock) PR_SUCCESS
+#define _MD_FREE_LOCK(lock)
+#define _MD_LOCK(lock)
+#define _MD_UNLOCK(lock)
+#define _MD_INIT_IO()
+#define _MD_IOQ_LOCK()
+#define _MD_IOQ_UNLOCK()
+
+#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
+#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
+#define _MD_EARLY_INIT _MD_EarlyInit
+#define _MD_FINAL_INIT _PR_UnixInit
+#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
+#define _MD_INIT_THREAD _MD_InitializeThread
+#define _MD_EXIT_THREAD(thread)
+#define _MD_SUSPEND_THREAD(thread)
+#define _MD_RESUME_THREAD(thread)
+#define _MD_CLEAN_THREAD(_thread)
+
+/*
+** We wrapped the select() call. _MD_SELECT refers to the built-in,
+** unwrapped version.
+*/
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/select.h>
+#define _MD_SELECT select
+
+#define SA_RESTART 0
+
+#endif /* nspr_qnx_defs_h___ */
--- a/pr/include/md/_reliantunix.h
+++ b/pr/include/md/_reliantunix.h
@@ -44,16 +44,18 @@
#define NEED_STRFTIME_LOCK
#define NEED_TIME_R
#define HAVE_NETCONFIG
#define HAVE_WEAK_IO_SYMBOLS
#define HAVE_WEAK_MALLOC_SYMBOLS
#define _PR_RECV_BROKEN /* recv doesn't work on Unix Domain Sockets */
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
+#define _PR_STAT_HAS_ST_ATIM
+#define _PR_NO_LARGE_FILES
/*
* Mike Patnode indicated that it is possibly safe now to use context-switching
* calls that do not change the signal mask, like setjmp vs. sigsetjmp.
* So we'll use our homegrown, getcontext/setcontext-compatible stuff which
* will save us the getcontext/setcontext system calls at each context switch.
* It already works in FastTrack 2.01, so it should do it here :-)
* - chrisk 040497
--- a/pr/include/md/_rhapsody.h
+++ b/pr/include/md/_rhapsody.h
@@ -34,16 +34,17 @@
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#undef HAVE_STACK_GROWING_UP
#define HAVE_DLL
+#define USE_MACH_DYLD
#define _PR_HAVE_SOCKADDR_LEN
#define _PR_STAT_HAS_ST_ATIMESPEC
#define _PR_TIMESPEC_HAS_TS_SEC
#define _PR_NO_LARGE_FILES
#define USE_SETJMP
#if !defined(_PR_PTHREADS)
--- a/pr/include/md/_unixos.h
+++ b/pr/include/md/_unixos.h
@@ -139,16 +139,21 @@ struct _PRCPU;
extern void _MD_unix_init_running_cpu(struct _PRCPU *cpu);
/*
** Make a redzone at both ends of the stack segment. Disallow access
** to those pages of memory. It's ok if the mprotect call's don't
** work - it just means that we don't really have a functional
** redzone.
*/
+#include <sys/mman.h>
+#ifndef PROT_NONE
+#define PROT_NONE 0x0
+#endif
+
#if defined(DEBUG) && !defined(RHAPSODY) && !defined(NEXTSTEP)
#if !defined(SOLARIS)
#include <string.h> /* for memset() */
#define _MD_INIT_STACK(ts,REDZONE) \
PR_BEGIN_MACRO \
(void) mprotect((void*)ts->seg->vaddr, REDZONE, PROT_NONE); \
(void) mprotect((void*) ((char*)ts->seg->vaddr + REDZONE + ts->stackSize),\
REDZONE, PROT_NONE); \
@@ -558,14 +563,13 @@ typedef void* (*_MD_Mmap64)(
void *addr, PRSize len, PRIntn prot, PRIntn flags,
PRIntn fildes, PRInt64 offset);
struct _MD_IOVector
{
_MD_Open64 _open64;
_MD_Mmap64 _mmap64;
_MD_Stat64 _stat64;
_MD_Fstat64 _fstat64;
- _MD_Lockf64 _lockf64;
_MD_Lseek64 _lseek64;
};
extern struct _MD_IOVector _md_iovector;
#endif /* prunixos_h___ */
--- a/pr/include/md/prosdep.h
+++ b/pr/include/md/prosdep.h
@@ -105,16 +105,19 @@ PR_BEGIN_EXTERN_C
#include "md/_unixware.h"
#elif defined(NCR)
#include "md/_ncr.h"
#elif defined(DGUX)
#include "md/_dgux.h"
+#elif defined(QNX)
+#include "md/_qnx.h"
+
#else
#error unknown Unix flavor
#endif
#include "md/_unixos.h"
#include "md/_unix_errors.h"
--- a/pr/include/obsolete/Makefile
+++ b/pr/include/obsolete/Makefile
@@ -16,17 +16,17 @@
#
#! gmake
MOD_DEPTH = ../../..
include $(MOD_DEPTH)/config/config.mk
-HEADERS = *.h
+HEADERS = $(wildcard *.h)
RELEASE_HEADERS = $(HEADERS)
RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)/obsolete
include $(MOD_DEPTH)/config/rules.mk
export:: $(HEADERS)
$(INSTALL) -m 444 $(HEADERS) $(DIST)/include/obsolete
--- a/pr/include/prinet.h
+++ b/pr/include/prinet.h
@@ -47,17 +47,17 @@
#include <netinet/in.h> /* INADDR_ANY, ..., ntohl(), ... */
#ifdef XP_OS2
#include <sys/ioctl.h>
#else
#include <arpa/inet.h>
#endif
#include <netdb.h>
-#if defined(FREEBSD) || defined(BSDI)
+#if defined(FREEBSD) || defined(BSDI) || defined(QNX)
#include <rpc/types.h> /* the only place that defines INADDR_LOOPBACK */
#endif
/*
* OS/2 hack. For some reason INADDR_LOOPBACK is not defined in the
* socket headers.
*/
#if defined(OS2) && !defined(INADDR_LOOPBACK)
--- a/pr/include/private/primpl.h
+++ b/pr/include/private/primpl.h
@@ -1532,16 +1532,17 @@ extern PRBool _pr_ipv6_enabled; /* defi
#endif
/* Overriding malloc, free, etc. */
#if !defined(_PR_NO_PREEMPT) && defined(XP_UNIX) \
&& !defined(_PR_PTHREADS) && !defined(_PR_GLOBAL_THREADS_ONLY) \
&& !defined(PURIFY) \
&& !defined(RHAPSODY) \
&& !defined(NEXTSTEP) \
+ && !defined(QNX) \
&& !(defined (UNIXWARE) && defined (USE_SVR4_THREADS))
#define _PR_OVERRIDE_MALLOC
#endif
/*************************************************************************
* External machine-dependent code provided by each OS. * *
*************************************************************************/
--- a/pr/src/Makefile
+++ b/pr/src/Makefile
@@ -70,17 +70,17 @@ else
OS_LIBS = -lpthreads -ldl -lC_r -lC -lc_r -lm /usr/lib/libc.a
endif
endif
endif
# On AIX, we override malloc in non-pthread versions. On AIX 4.2 or
# above, this requires that we use the rtl-enabled version of libc.a.
ifeq ($(OS_ARCH),AIX)
-ifneq ($(OS_RELEASE),4.1)
+ifneq (,$(filter-out 3.2 4.1,$(OS_RELEASE)))
ifneq ($(USE_PTHREADS),1)
BUILD_AIX_RTL_LIBC = 1
AIX_RTL_LIBC = $(OBJDIR)/libc.a
endif
endif
endif
ifeq ($(OS_ARCH),OSF1)
--- a/pr/src/io/prfile.c
+++ b/pr/src/io/prfile.c
@@ -17,17 +17,17 @@
*/
#include "primpl.h"
#include <string.h>
#include <fcntl.h>
#ifdef XP_UNIX
-#ifdef AIX
+#if defined(AIX) || defined(QNX)
/* To pick up sysconf */
#include <unistd.h>
#else
/* To pick up getrlimit, setrlimit */
#include <sys/time.h>
#include <sys/resource.h>
#endif
#endif /* XP_UNIX */
@@ -260,26 +260,26 @@ PR_IMPLEMENT(PRFileDesc*) PR_Open(const
(void) _PR_MD_CLOSE_FILE(osfd);
}
}
return fd;
}
PRInt32 PR_GetSysfdTableMax(void)
{
-#if defined(XP_UNIX) && !defined(AIX) && !defined(NEXTSTEP)
+#if defined(XP_UNIX) && !defined(AIX) && !defined(NEXTSTEP) && !defined(QNX)
struct rlimit rlim;
if ( getrlimit(RLIMIT_NOFILE, &rlim) < 0) {
/* XXX need to call PR_SetError() */
return -1;
}
return rlim.rlim_max;
-#elif defined(AIX) || defined(NEXTSTEP)
+#elif defined(AIX) || defined(NEXTSTEP) || defined(QNX)
return sysconf(_SC_OPEN_MAX);
#elif defined(WIN32) || defined(OS2)
/*
* There is a systemwide limit of 65536 user handles.
* Not sure on OS/2, but sounds good.
*/
return 16384;
#elif defined (WIN16)
@@ -289,17 +289,17 @@ PRInt32 PR_GetSysfdTableMax(void)
return -1;
#else
write me;
#endif
}
PRInt32 PR_SetSysfdTableSize(int table_size)
{
-#if defined(XP_UNIX) && !defined(AIX) && !defined(NEXTSTEP)
+#if defined(XP_UNIX) && !defined(AIX) && !defined(NEXTSTEP) && !defined(QNX)
struct rlimit rlim;
PRInt32 tableMax = PR_GetSysfdTableMax();
if (tableMax < 0)
return -1;
if (tableMax > FD_SETSIZE)
tableMax = FD_SETSIZE;
@@ -313,18 +313,18 @@ PRInt32 PR_SetSysfdTableSize(int table_s
rlim.rlim_cur = table_size;
if ( setrlimit(RLIMIT_NOFILE, &rlim) < 0) {
/* XXX need to call PR_SetError() */
return -1;
}
return rlim.rlim_cur;
-#elif defined(AIX) || defined(WIN32) || defined(WIN16) || defined(OS2) \
- || defined(NEXTSTEP)
+#elif defined(AIX) || defined(NEXTSTEP) || defined(QNX) \
+ || defined(WIN32) || defined(WIN16) || defined(OS2)
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return -1;
#elif defined (XP_MAC)
#pragma unused (table_size)
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return -1;
#else
write me;
--- a/pr/src/io/prmapopt.c
+++ b/pr/src/io/prmapopt.c
@@ -345,19 +345,25 @@ PRStatus PR_CALLBACK _PR_SocketSetSocket
* appropriate header files. Then any undefined socket options
* are really missing.
*/
#if !defined(SO_LINGER)
#error "SO_LINGER is not defined"
#endif
+/*
+ * Some platforms, such as NCR 2.03, don't have TCP_NODELAY defined
+ * in <netinet/tcp.h>
+ */
+#if !defined(NCR)
#if !defined(TCP_NODELAY)
#error "TCP_NODELAY is not defined"
#endif
+#endif
/*
* Make sure the value of _PR_NO_SUCH_SOCKOPT is not
* a valid socket option.
*/
#define _PR_NO_SUCH_SOCKOPT -1
#ifndef IP_MULTICAST_IF /* set/get IP multicast interface */
@@ -383,16 +389,20 @@ PRStatus PR_CALLBACK _PR_SocketSetSocket
#ifndef IP_TTL /* set/get IP Time To Live */
#define IP_TTL _PR_NO_SUCH_SOCKOPT
#endif
#ifndef IP_TOS /* set/get IP Type Of Service */
#define IP_TOS _PR_NO_SUCH_SOCKOPT
#endif
+#ifndef TCP_NODELAY /* don't delay to coalesce data */
+#define TCP_NODELAY _PR_NO_SUCH_SOCKOPT
+#endif
+
#ifndef TCP_MAXSEG /* maxumum segment size for tcp */
#define TCP_MAXSEG _PR_NO_SUCH_SOCKOPT
#endif
PRStatus _PR_MapOptionName(
PRSockOption optname, PRInt32 *level, PRInt32 *name)
{
static PRInt32 socketOptions[PR_SockOpt_Last] =
--- a/pr/src/io/prprf.c
+++ b/pr/src/io/prprf.c
@@ -30,17 +30,17 @@
#include "prlong.h"
#include "prlog.h"
#include "prmem.h"
/*
** Note: on some platforms va_list is defined as an array,
** and requires array notation.
*/
-#if (defined(LINUX) && defined(__powerpc__)) || defined(WIN16)
+#if (defined(LINUX) && defined(__powerpc__)) || defined(WIN16) || defined(QNX)
#define VARARGS_ASSIGN(foo, bar) foo[0] = bar[0]
#else
#define VARARGS_ASSIGN(foo, bar) (foo) = (bar)
#endif
/*
** WARNING: This code may *NOT* call PR_LOG (because PR_LOG calls it)
*/
--- a/pr/src/io/prsocket.c
+++ b/pr/src/io/prsocket.c
@@ -46,17 +46,31 @@ static PRBool IsValidNetAddrLen(const PR
* The definition of the length of a Unix domain socket address
* is not uniform, so we don't check it.
*/
if ((addr != NULL)
#ifdef XP_UNIX
&& (addr->raw.family != AF_UNIX)
#endif
&& (PR_NETADDR_SIZE(addr) != addr_len)) {
+ /*
+ * The accept(), getsockname(), etc. calls on some platforms
+ * do not set the actual socket address length on return.
+ * In this case, we verifiy addr_len is still the value we
+ * passed in (i.e., sizeof(PRNetAddr)).
+ */
+#if defined(QNX)
+ if (sizeof(PRNetAddr) != addr_len) {
+ return PR_FALSE;
+ } else {
+ return PR_TRUE;
+ }
+#else
return PR_FALSE;
+#endif
}
return PR_TRUE;
}
#endif /* DEBUG */
static PRInt32 PR_CALLBACK SocketWritev(PRFileDesc *fd, PRIOVec *iov, PRInt32 iov_size,
PRIntervalTime timeout)
--- a/pr/src/linking/prlink.c
+++ b/pr/src/linking/prlink.c
@@ -27,17 +27,17 @@
#include <Strings.h>
#endif
#ifdef XP_UNIX
#ifdef USE_DLFCN
#include <dlfcn.h>
#elif defined(USE_HPSHL)
#include <dl.h>
-#elif defined(RHAPSODY) || defined(NEXTSTEP)
+#elif defined(USE_MACH_DYLD)
#include <mach-o/dyld.h>
#endif
/* Define this on systems which don't have it (AIX) */
#ifndef RTLD_LAZY
#define RTLD_LAZY RTLD_NOW
#endif
#endif /* XP_UNIX */
@@ -66,17 +66,17 @@ struct PRLibrary {
#endif
#ifdef XP_MAC
CFragConnectionID dlh;
#endif
#ifdef XP_UNIX
#if defined(USE_HPSHL)
shl_t dlh;
-#elif defined(RHAPSODY) || defined(NEXTSTEP)
+#elif defined(USE_MACH_DYLD)
NSModule dlh;
#else
void* dlh;
#endif
#endif
};
static PRLibrary *pr_loadmap;
@@ -165,17 +165,17 @@ void _PR_InitLinker(void)
fprintf(stderr, "failed to initialize shared libraries [%s]\n",
error);
PR_DELETE(error);
abort();/* XXX */
}
#elif defined(USE_HPSHL)
h = NULL;
/* don't abort with this NULL */
-#elif defined(RHAPSODY) || defined(NEXTSTEP)
+#elif defined(USE_MACH_DYLD)
h = NULL; /* XXXX toshok */
#else
#error no dll strategy
#endif /* USE_DLFCN */
lm = PR_NEWZAP(PRLibrary);
if (lm) {
lm->name = strdup("a.out");
@@ -279,17 +279,17 @@ PR_GetLibraryPath()
if (p) {
strcpy(p, ev);
}
ev = p;
}
#endif
#ifdef XP_UNIX
-#if defined USE_DLFCN || defined RHAPSODY
+#if defined USE_DLFCN || defined USE_MACH_DYLD
{
char *home;
char *local;
char *p=NULL;
char * mozilla_home=NULL;
int len;
ev = getenv("LD_LIBRARY_PATH");
@@ -634,17 +634,17 @@ PR_LoadLibrary(const char *name)
#ifdef XP_UNIX
#ifdef HAVE_DLL
{
#if defined(USE_DLFCN)
void *h = dlopen(name, RTLD_LAZY);
#elif defined(USE_HPSHL)
shl_t h = shl_load(name, BIND_DEFERRED | DYNAMIC_PATH, 0L);
-#elif defined(RHAPSODY) || defined(NEXTSTEP)
+#elif defined(USE_MACH_DYLD)
NSObjectFileImage ofi;
NSModule h = NULL;
if (NSCreateObjectFileImageFromFile(name, &ofi)
== NSObjectFileImageSuccess) {
h = NSLinkModule(ofi, name, TRUE);
}
#else
#error Configuration error
@@ -707,17 +707,17 @@ PR_UnloadLibrary(PRLibrary *lib)
goto done;
}
#ifdef XP_UNIX
#ifdef HAVE_DLL
#ifdef USE_DLFCN
result = dlclose(lib->dlh);
#elif defined(USE_HPSHL)
result = shl_unload(lib->dlh);
-#elif defined(RHAPSODY) || defined(NEXTSTEP)
+#elif defined(USE_MACH_DYLD)
result = NSUnLinkModule(lib->dlh, FALSE);
#else
#error Configuration error
#endif
#endif /* HAVE_DLL */
#endif /* XP_UNIX */
#ifdef XP_PC
if (lib->dlh) {
@@ -820,17 +820,17 @@ pr_FindSymbolInLib(PRLibrary *lm, const
#ifdef XP_UNIX
#ifdef HAVE_DLL
#ifdef USE_DLFCN
f = dlsym(lm->dlh, name);
#elif defined(USE_HPSHL)
if (shl_findsym(&lm->dlh, name, TYPE_PROCEDURE, &f) == -1) {
f = NULL;
}
-#elif defined(RHAPSODY) || defined(NEXTSTEP)
+#elif defined(USE_MACH_DYLD)
f = NSAddressOfSymbol(NSLookupAndBindSymbol(name));
#endif
#endif /* HAVE_DLL */
#endif /* XP_UNIX */
if (f == NULL) {
PR_SetError(PR_FIND_SYMBOL_ERROR, _MD_ERRNO());
DLLErrorInternal(_MD_ERRNO());
}
--- a/pr/src/malloc/prmalloc.c
+++ b/pr/src/malloc/prmalloc.c
@@ -79,17 +79,16 @@ static int malloc_event;
/* XXX Pick a number, any number */
# define malloc_pagesize 4096UL
# define malloc_pageshift 12UL
#ifdef XP_UNIX
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <memory.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/mman.h>
#endif
/*
* This structure describes a page's worth of chunks.
--- a/pr/src/md/unix/Makefile
+++ b/pr/src/md/unix/Makefile
@@ -113,16 +113,20 @@ NCR_CSRCS = \
SCOOS_CSRCS = \
scoos.c \
$(NULL)
DGUX_CSRCS = \
dgux.c \
$(NULL)
+QNX_CSRCS = \
+ qnx.c \
+ $(NULL)
+
ifeq ($(PTHREADS_USER),1)
CSRCS += $(PTH_USER_CSRCS)
endif
ifeq ($(OS_ARCH),IRIX)
CSRCS += $(IRIX_CSRCS)
endif
@@ -180,16 +184,19 @@ ifeq ($(OS_ARCH),NCR)
CSRCS += $(NCR_CSRCS)
endif
ifeq ($(OS_ARCH),SCOOS)
CSRCS += $(SCOOS_CSRCS)
endif
ifeq ($(OS_ARCH),DGUX)
CSRCS += $(DGUX_CSRCS)
endif
+ifeq ($(OS_ARCH),QNX)
+CSRCS += $(QNX_CSRCS)
+endif
#
# Some Unix platforms have an assembly language file.
# E.g., AIX 3.2, Solaris (both sparc and x86).
#
ifeq ($(OS_ARCH), AIX)
ifeq ($(OS_RELEASE), 3.2)
ASFILES = os_$(OS_ARCH).s
@@ -218,17 +225,17 @@ endif
ifeq ($(OS_ARCH), IRIX)
ASFILES = os_Irix.s
endif
TARGETS = $(OBJS)
ifeq ($(OS_ARCH),AIX)
-ifneq ($(OS_RELEASE),4.2)
+ifeq (,$(filter-out 3.2 4.1,$(OS_RELEASE)))
ifneq ($(USE_PTHREADS), 1)
#TARGETS += $(OBJDIR)/aixwrap.$(OBJ_SUFFIX)
endif
endif
endif
ifeq ($(OS_ARCH),SunOS)
ifneq ($(OS_RELEASE),4.1.3_U1)
@@ -244,17 +251,17 @@ ifeq ($(OS_ARCH),SunOS)
endif
INCLUDES = -I$(DIST)/include/private -I$(DIST)/include
include $(MOD_DEPTH)/config/rules.mk
export:: $(TARGETS)
#ifeq ($(OS_ARCH),AIX)
-#ifneq ($(OS_RELEASE),4.2)
+#ifeq (,$(filter-out 3.2 4.1,$(OS_RELEASE)))
#ifneq ($(USE_PTHREADS), 1)
# $(INSTALL) -m 444 $(OBJDIR)/aixwrap.$(OBJ_SUFFIX) $(DIST)/lib
#endif
#endif
#endif
ifeq ($(OS_ARCH),SunOS)
ifneq ($(OS_RELEASE),4.1.3_U1)
--- a/pr/src/md/unix/aix.c
+++ b/pr/src/md/unix/aix.c
@@ -13,29 +13,31 @@
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "primpl.h"
+#ifdef AIX_HAVE_ATOMIC_OP_H
#include <sys/atomic_op.h>
PRInt32 _AIX_AtomicSet(PRInt32 *val, PRInt32 newval)
{
PRIntn oldval;
boolean_t stored;
oldval = fetch_and_add((atomic_p)val, 0);
do
{
stored = compare_and_swap((atomic_p)val, &oldval, newval);
} while (!stored);
return oldval;
} /* _AIX_AtomicSet */
+#endif /* AIX_HAVE_ATOMIC_OP_H */
#if defined(AIX_TIMERS)
#include <sys/time.h>
static PRUint32 _aix_baseline_epoch;
static void _MD_AixIntervalInit(void)
@@ -176,17 +178,17 @@ PR_IMPLEMENT(PRStatus)
#endif /* PTHREADS_USER */
/*
* NSPR 2.0 overrides the system select() and poll() functions.
* On AIX 4.2, we use dlopen("/unix", RTLD_NOW) and dlsym() to get
* at the original system select() and poll() functions.
*/
-#if !defined(AIX4_1)
+#if !defined(AIX_RENAME_SELECT)
#include <sys/select.h>
#include <sys/poll.h>
#include <dlfcn.h>
static int (*aix_select_fcn)() = NULL;
static int (*aix_poll_fcn)() = NULL;
@@ -244,17 +246,17 @@ int _MD_POLL(void *listptr, unsigned lon
* to work. So we must have this dummy function that references poll().
*/
#include <sys/poll.h>
void _pr_aix_dummy()
{
poll(0,0,0);
}
-#endif /* !defined(AIX4_1) */
+#endif /* !defined(AIX_RENAME_SELECT) */
#ifdef _PR_HAVE_ATOMIC_CAS
#include "pratom.h"
#define _PR_AIX_ATOMIC_LOCK -1
PR_IMPLEMENT(void)
--- a/pr/src/md/unix/aixwrap.c
+++ b/pr/src/md/unix/aixwrap.c
@@ -21,26 +21,26 @@
* Description:
* This file contains a single function, _MD_SELECT(), which simply
* invokes the select() function. This file is used in an ugly
* hack to override the system select() function on AIX releases
* prior to 4.2. (On AIX 4.2, we use a different mechanism to
* override select().)
*/
-#ifndef AIX4_1
-#error aixwrap.c should only be used on AIX 4.1
+#ifndef AIX_RENAME_SELECT
+#error aixwrap.c should only be used on AIX 3.2 or 4.1
#else
#include <sys/select.h>
#include <sys/poll.h>
int _MD_SELECT(int width, fd_set *r, fd_set *w, fd_set *e, struct timeval *t)
{
return select(width, r, w, e, t);
}
int _MD_POLL(void *listptr, unsigned long nfds, long timeout)
{
return poll(listptr, nfds, timeout);
}
-#endif /* AIX4_1 */
+#endif /* AIX_RENAME_SELECT */
--- a/pr/src/md/unix/objs.mk
+++ b/pr/src/md/unix/objs.mk
@@ -105,16 +105,20 @@ NCR_CSRCS = \
SCOOS_CSRCS = \
scoos.c \
$(NULL)
DGUX_CSRCS = \
dgux.c \
$(NULL)
+QNX_CSRCS = \
+ qnx.c \
+ $(NULL)
+
ifeq ($(PTHREADS_USER),1)
CSRCS += $(PTH_USER_CSRCS)
endif
ifeq ($(OS_ARCH),IRIX)
CSRCS += $(IRIX_CSRCS)
endif
@@ -173,16 +177,19 @@ ifeq ($(OS_ARCH),NCR)
CSRCS += $(NCR_CSRCS)
endif
ifeq ($(OS_ARCH),SCOOS)
CSRCS += $(SCOOS_CSRCS)
endif
ifeq ($(OS_ARCH),DGUX)
CSRCS += $(DGUX_CSRCS)
endif
+ifeq ($(OS_ARCH),QNX)
+CSRCS += $(QNX_CSRCS)
+endif
#
# Some Unix platforms have an assembly language file.
# E.g., AIX 3.2, Solaris (both sparc and x86).
#
ifeq ($(OS_ARCH), AIX)
ifeq ($(OS_RELEASE), 3.2)
ASFILES = os_$(OS_ARCH).s
new file mode 100644
--- /dev/null
+++ b/pr/src/md/unix/qnx.c
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.0 (the "NPL"); you may not use this file except in
+ * compliance with the NPL. You may obtain a copy of the NPL at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the NPL is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
+ * for the specific language governing rights and limitations under the
+ * NPL.
+ *
+ * The Initial Developer of this code under the NPL is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All Rights
+ * Reserved.
+ */
+
+#include "primpl.h"
+
+#include <setjmp.h>
+
+void _MD_EarlyInit(void)
+{
+}
+
+PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np)
+{
+ if (isCurrent) {
+ (void) setjmp(CONTEXT(t));
+ }
+ *np = sizeof(CONTEXT(t)) / sizeof(PRWord);
+ return (PRWord *) CONTEXT(t);
+}
+
+void
+_MD_SET_PRIORITY(_MDThread *thread, PRUintn newPri)
+{
+ return;
+}
+
+PRStatus
+_MD_InitializeThread(PRThread *thread)
+{
+ return PR_SUCCESS;
+}
+
+PRStatus
+_MD_WAIT(PRThread *thread, PRIntervalTime ticks)
+{
+ PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE));
+ _PR_MD_SWITCH_CONTEXT(thread);
+ return PR_SUCCESS;
+}
+
+PRStatus
+_MD_WAKEUP_WAITER(PRThread *thread)
+{
+ if (thread) {
+ PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE));
+ }
+ return PR_SUCCESS;
+}
+
+/* These functions should not be called for Unixware */
+void
+_MD_YIELD(void)
+{
+ PR_NOT_REACHED("_MD_YIELD should not be called for Unixware.");
+}
+
+PRStatus
+_MD_CREATE_THREAD(
+ PRThread *thread,
+ void (*start) (void *),
+ PRUintn priority,
+ PRThreadScope scope,
+ PRThreadState state,
+ PRUint32 stackSize)
+{
+ PR_NOT_REACHED("_MD_CREATE_THREAD should not be called for Unixware.");
+ return PR_FAILURE;
+}
--- a/pr/src/md/unix/unix.c
+++ b/pr/src/md/unix/unix.c
@@ -16,17 +16,16 @@
* Reserved.
*/
#include "primpl.h"
#include <string.h>
#include <signal.h>
#include <unistd.h>
-#include <memory.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#ifdef _PR_POLL_AVAILABLE
@@ -42,20 +41,21 @@
/*
* Make sure _PRSockLen_t is 32-bit, because we will cast a PRUint32* or
* PRInt32* pointer to a _PRSockLen_t* pointer.
*/
#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(NEXTSTEP)
+ || defined(NEXTSTEP) || defined(QNX)
#define _PRSockLen_t int
#elif (defined(AIX) && !defined(AIX4_1)) || defined(FREEBSD) \
- || defined(NETBSD) || defined(OPENBSD) || defined(UNIXWARE) || defined(DGUX)
+ || defined(NETBSD) || defined(OPENBSD) || defined(UNIXWARE) \
+ || defined(DGUX)
#define _PRSockLen_t size_t
#else
#error "Cannot determine architecture"
#endif
/*
** Global lock variable used to bracket calls into rusty libraries that
** aren't thread safe (like libc, libX, etc).
@@ -84,20 +84,16 @@ static sigset_t empty_set;
#include <sys/file.h>
#include <sys/filio.h>
#endif
#ifndef PIPE_BUF
#define PIPE_BUF 512
#endif
-#ifndef PROT_NONE
-#define PROT_NONE 0
-#endif
-
/*
* _nspr_noclock - if set clock interrupts are disabled
*/
int _nspr_noclock = 1;
#ifdef IRIX
extern PRInt32 _nspr_terminate_on_error;
#endif
@@ -830,22 +826,19 @@ PRInt32 _MD_recvfrom(PRFileDesc *fd, voi
}
}
if (rv < 0) {
_PR_MD_MAP_RECVFROM_ERROR(err);
}
done:
#ifdef _PR_HAVE_SOCKADDR_LEN
if (rv != -1) {
- /* mask off the first byte of struct sockaddr (the length field) */
+ /* ignore the sa_len field of struct sockaddr */
if (addr) {
- *((unsigned char *) addr) = 0;
-#ifdef IS_LITTLE_ENDIAN
- addr->raw.family = ntohs(addr->raw.family);
-#endif
+ addr->raw.family = ((struct sockaddr *) addr)->sa_family;
}
}
#endif /* _PR_HAVE_SOCKADDR_LEN */
return(rv);
}
PRInt32 _MD_send(PRFileDesc *fd, const void *buf, PRInt32 amount,
PRInt32 flags, PRIntervalTime timeout)
@@ -911,19 +904,29 @@ done:
PRInt32 _MD_sendto(
PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags,
const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout)
{
PRInt32 osfd = fd->secret->md.osfd;
PRInt32 rv, err;
PRThread *me = _PR_MD_CURRENT_THREAD();
+#ifdef _PR_HAVE_SOCKADDR_LEN
+ PRNetAddr addrCopy;
+
+ addrCopy = *addr;
+ ((struct sockaddr *) &addrCopy)->sa_len = addrlen;
+ ((struct sockaddr *) &addrCopy)->sa_family = addr->raw.family;
while ((rv = sendto(osfd, buf, amount, flags,
+ (struct sockaddr *) &addrCopy, addrlen)) == -1) {
+#else
+ while ((rv = sendto(osfd, buf, amount, flags,
(struct sockaddr *) addr, addrlen)) == -1) {
+#endif
err = _MD_ERRNO();
if ((err == EAGAIN) || (err == EWOULDBLOCK)) {
if (fd->secret->nonblocking) {
break;
}
if (!_PR_IS_NATIVE_THREAD(me)) {
if ((rv = local_io_wait(osfd, _PR_UNIX_POLL_WRITE, timeout)) < 0)
goto done;
@@ -1039,22 +1042,19 @@ PRInt32 _MD_accept(PRFileDesc *fd, PRNet
}
}
if (rv < 0) {
_PR_MD_MAP_ACCEPT_ERROR(err);
}
done:
#ifdef _PR_HAVE_SOCKADDR_LEN
if (rv != -1) {
- /* mask off the first byte of struct sockaddr (the length field) */
+ /* ignore the sa_len field of struct sockaddr */
if (addr) {
- *((unsigned char *) addr) = 0;
-#ifdef IS_LITTLE_ENDIAN
- addr->raw.family = ntohs(addr->raw.family);
-#endif
+ addr->raw.family = ((struct sockaddr *) addr)->sa_family;
}
}
#endif /* _PR_HAVE_SOCKADDR_LEN */
return(rv);
}
extern int _connect (int s, const struct sockaddr *name, int namelen);
PRInt32 _MD_connect(
@@ -1062,16 +1062,23 @@ PRInt32 _MD_connect(
{
PRInt32 rv, err;
PRThread *me = _PR_MD_CURRENT_THREAD();
PRInt32 osfd = fd->secret->md.osfd;
#ifdef IRIX
extern PRInt32 _MD_irix_connect(
PRInt32 osfd, const PRNetAddr *addr, PRInt32 addrlen, PRIntervalTime timeout);
#endif
+#ifdef _PR_HAVE_SOCKADDR_LEN
+ PRNetAddr addrCopy;
+
+ addrCopy = *addr;
+ ((struct sockaddr *) &addrCopy)->sa_len = addrlen;
+ ((struct sockaddr *) &addrCopy)->sa_family = addr->raw.family;
+#endif
/*
* We initiate the connection setup by making a nonblocking connect()
* call. If the connect() call fails, there are two cases we handle
* specially:
* 1. The connect() call was interrupted by a signal. In this case
* we simply retry connect().
* 2. The NSPR socket is nonblocking and connect() fails with
@@ -1079,18 +1086,22 @@ extern PRInt32 _MD_irix_connect(
* Then we try to find out whether the connection setup succeeded
* or failed.
*/
retry:
#ifdef IRIX
if ((rv = _MD_irix_connect(osfd, addr, addrlen, timeout)) == -1) {
#else
+#ifdef _PR_HAVE_SOCKADDR_LEN
+ if ((rv = connect(osfd, (struct sockaddr *)&addrCopy, addrlen)) == -1) {
+#else
if ((rv = connect(osfd, (struct sockaddr *)addr, addrlen)) == -1) {
#endif
+#endif
err = _MD_ERRNO();
if (err == EINTR) {
if (_PR_PENDING_INTERRUPT(me)) {
me->flags &= ~_PR_INTERRUPT;
PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);
return -1;
}
@@ -1131,18 +1142,26 @@ retry:
}
return rv;
} /* _MD_connect */
PRInt32 _MD_bind(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen)
{
PRInt32 rv, err;
-
+#ifdef _PR_HAVE_SOCKADDR_LEN
+ PRNetAddr addrCopy;
+
+ addrCopy = *addr;
+ ((struct sockaddr *) &addrCopy)->sa_len = addrlen;
+ ((struct sockaddr *) &addrCopy)->sa_family = addr->raw.family;
+ rv = bind(fd->secret->md.osfd, (struct sockaddr *) &addrCopy, (int )addrlen);
+#else
rv = bind(fd->secret->md.osfd, (struct sockaddr *) addr, (int )addrlen);
+#endif
if (rv < 0) {
err = _MD_ERRNO();
_PR_MD_MAP_BIND_ERROR(err);
}
return(rv);
}
PRInt32 _MD_listen(PRFileDesc *fd, PRIntn backlog)
@@ -1186,22 +1205,19 @@ PRStatus _MD_getsockname(PRFileDesc *fd,
PRUint32 *addrlen)
{
PRInt32 rv, err;
rv = getsockname(fd->secret->md.osfd,
(struct sockaddr *) addr, (_PRSockLen_t *)addrlen);
#ifdef _PR_HAVE_SOCKADDR_LEN
if (rv == 0) {
- /* mask off the first byte of struct sockaddr (the length field) */
+ /* ignore the sa_len field of struct sockaddr */
if (addr) {
- *((unsigned char *) addr) = 0;
-#ifdef IS_LITTLE_ENDIAN
- addr->raw.family = ntohs(addr->raw.family);
-#endif
+ addr->raw.family = ((struct sockaddr *) addr)->sa_family;
}
}
#endif /* _PR_HAVE_SOCKADDR_LEN */
if (rv < 0) {
err = _MD_ERRNO();
_PR_MD_MAP_GETSOCKNAME_ERROR(err);
}
return rv==0?PR_SUCCESS:PR_FAILURE;
@@ -1211,22 +1227,19 @@ PRStatus _MD_getpeername(PRFileDesc *fd,
PRUint32 *addrlen)
{
PRInt32 rv, err;
rv = getpeername(fd->secret->md.osfd,
(struct sockaddr *) addr, (_PRSockLen_t *)addrlen);
#ifdef _PR_HAVE_SOCKADDR_LEN
if (rv == 0) {
- /* mask off the first byte of struct sockaddr (the length field) */
+ /* ignore the sa_len field of struct sockaddr */
if (addr) {
- *((unsigned char *) addr) = 0;
-#ifdef IS_LITTLE_ENDIAN
- addr->raw.family = ntohs(addr->raw.family);
-#endif
+ addr->raw.family = ((struct sockaddr *) addr)->sa_family;
}
}
#endif /* _PR_HAVE_SOCKADDR_LEN */
if (rv < 0) {
err = _MD_ERRNO();
_PR_MD_MAP_GETPEERNAME_ERROR(err);
}
return rv==0?PR_SUCCESS:PR_FAILURE;
@@ -2241,30 +2254,44 @@ done:
/*
** struct stat has st_atim, st_mtim, and st_ctim fields of
** type timestruc_t.
*/
static void _MD_set_fileinfo_times(
const struct stat *sb,
PRFileInfo *info)
{
- info->modifyTime = ((PRTime)sb->st_mtim.tv_sec * PR_USEC_PER_SEC);
- info->modifyTime += (sb->st_mtim.tv_nsec / 1000);
- info->creationTime = ((PRTime)sb->st_ctim.tv_sec * PR_USEC_PER_SEC);
- info->creationTime += (sb->st_ctim.tv_nsec / 1000);
+ PRInt64 us, s2us;
+
+ LL_I2L(s2us, PR_USEC_PER_SEC);
+ LL_I2L(info->modifyTime, sb->st_mtim.tv_sec);
+ LL_MUL(info->modifyTime, info->modifyTime, s2us);
+ LL_I2L(us, sb->st_mtim.tv_nsec / 1000);
+ LL_ADD(info->modifyTime, info->modifyTime, us);
+ LL_I2L(info->creationTime, sb->st_ctim.tv_sec);
+ LL_MUL(info->creationTime, info->creationTime, s2us);
+ LL_I2L(us, sb->st_ctim.tv_nsec / 1000);
+ LL_ADD(info->creationTime, info->creationTime, us);
}
static void _MD_set_fileinfo64_times(
const _MDStat64 *sb,
PRFileInfo64 *info)
{
- info->modifyTime = ((PRTime)sb->st_mtim.tv_sec * PR_USEC_PER_SEC);
- info->modifyTime += (sb->st_mtim.tv_nsec / 1000);
- info->creationTime = ((PRTime)sb->st_ctim.tv_sec * PR_USEC_PER_SEC);
- info->creationTime += (sb->st_ctim.tv_nsec / 1000);
+ PRInt64 us, s2us;
+
+ LL_I2L(s2us, PR_USEC_PER_SEC);
+ LL_I2L(info->modifyTime, sb->st_mtim.tv_sec);
+ LL_MUL(info->modifyTime, info->modifyTime, s2us);
+ LL_I2L(us, sb->st_mtim.tv_nsec / 1000);
+ LL_ADD(info->modifyTime, info->modifyTime, us);
+ LL_I2L(info->creationTime, sb->st_ctim.tv_sec);
+ LL_MUL(info->creationTime, info->creationTime, s2us);
+ LL_I2L(us, sb->st_ctim.tv_nsec / 1000);
+ LL_ADD(info->creationTime, info->creationTime, us);
}
#elif defined(_PR_STAT_HAS_ST_ATIM_UNION)
/*
** The st_atim, st_mtim, and st_ctim fields in struct stat are
** unions with a st__tim union member of type timestruc_t.
*/
static void _MD_set_fileinfo_times(
const struct stat *sb,
@@ -2553,45 +2580,16 @@ static PRIntn _MD_solaris25_stat64(const
buf->st_size = sb.st_size;
}
return rv;
} /* _MD_solaris25_stat64 */
#endif /* defined(SOLARIS2_5) */
#if defined(_PR_NO_LARGE_FILES) || defined(SOLARIS2_5)
-static PRIntn _MD_Unix_lockf64(PRIntn osfd, PRIntn function, PRInt64 size)
-{
-#if defined(HAVE_BSD_FLOCK)
- /*
- * XXX: HAVE_BSD_FLOCK is not really the appropriate macro
- * to test for here. We are trying to identify the platforms
- * that don't have lockf, e.g., BSD/OS, FreeBSD, and Rhapsody.
- */
- /* No lockf */
- PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
- return -1;
-#else
- PRInt64 desired, maxoff;
- PRInt32 current = lseek(osfd, SEEK_CUR, 0);
-
- LL_I2L(maxoff, 0x7fffffff);
- LL_I2L(desired, current);
- LL_ADD(desired, desired, size);
- if (LL_CMP(desired, <=, maxoff))
- {
- off_t offset;
- LL_L2I(offset, size);
- return lockf(osfd, function, offset);
- }
- PR_SetError(PR_FILE_TOO_BIG_ERROR, 0);
- return -1;
-#endif
-} /* _MD_Unix_lockf64 */
-
static PRInt64 _MD_Unix_lseek64(PRIntn osfd, PRInt64 offset, PRIntn whence)
{
PRUint64 maxoff;
PRInt64 rv = minus_one;
LL_I2L(maxoff, 0x7fffffff);
if (LL_CMP(offset, <=, maxoff))
{
off_t off;
@@ -2606,98 +2604,62 @@ static void* _MD_Unix_mmap64(
void *addr, PRSize len, PRIntn prot, PRIntn flags,
PRIntn fildes, PRInt64 offset)
{
PR_SetError(PR_FILE_TOO_BIG_ERROR, 0);
return NULL;
} /* _MD_Unix_mmap64 */
#endif /* defined(_PR_NO_LARGE_FILES) || defined(SOLARIS2_5) */
-#if defined(IRIX) || defined(UNIXWARE)
-
-/*
-** This function emulates a lock64 for IRIX using fcntl calls. It is a true
-** 64-bit operation, just a different system API to get it.
-*/
-static PRIntn _MD_irix_lockf64(PRIntn osfd, PRIntn function, PRInt64 size)
-{
-#if 1
- PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
- PR_NOT_REACHED("NOT IMPLEMENTED");
- return -1;
-#else
- flock64_t lock;
- /* $$$ have no idea what I'm doing $$$ */
- lock.l_type = function;
- lock.l_whence = SEEK_CUR;
- lock.l_start = 0;
- lock.l_len = size;
-
- return fcntl(osfd, F_SETLKW64, &lock);
-#endif
-} /* _MD_irix_lockf64 */
-
-#endif /* defined(IRIX) */
-
static void _PR_InitIOV(void)
{
#if defined(SOLARIS2_5)
PRLibrary *lib;
void *open64_func;
open64_func = PR_FindSymbolAndLibrary("open64", &lib);
if (NULL != open64_func)
{
PR_ASSERT(NULL != lib);
_md_iovector._open64 = (_MD_Open64)open64_func;
_md_iovector._mmap64 = (_MD_Mmap64)PR_FindSymbol(lib, "mmap64");
_md_iovector._fstat64 = (_MD_Fstat64)PR_FindSymbol(lib, "fstat64");
_md_iovector._stat64 = (_MD_Stat64)PR_FindSymbol(lib, "stat64");
- _md_iovector._lockf64 = (_MD_Lockf64)PR_FindSymbol(lib, "lockf64");
_md_iovector._lseek64 = (_MD_Lseek64)PR_FindSymbol(lib, "lseek64");
(void)PR_UnloadLibrary(lib);
}
else
{
_md_iovector._open64 = open;
_md_iovector._mmap64 = _MD_Unix_mmap64;
_md_iovector._fstat64 = _MD_solaris25_fstat64;
_md_iovector._stat64 = _MD_solaris25_stat64;
- _md_iovector._lockf64 = _MD_Unix_lockf64;
_md_iovector._lseek64 = _MD_Unix_lseek64;
}
#elif defined(_PR_NO_LARGE_FILES)
_md_iovector._open64 = open;
_md_iovector._mmap64 = _MD_Unix_mmap64;
_md_iovector._fstat64 = fstat;
_md_iovector._stat64 = stat;
- _md_iovector._lockf64 = _MD_Unix_lockf64;
_md_iovector._lseek64 = _MD_Unix_lseek64;
#elif defined(_PR_HAVE_OFF64_T)
+#if defined(IRIX5_3)
+ _md_iovector._open64 = open;
+#else
_md_iovector._open64 = open64;
+#endif
_md_iovector._mmap64 = mmap64;
_md_iovector._fstat64 = fstat64;
_md_iovector._stat64 = stat64;
-
-/*
-** $$$ IRIX does not have a lockf64. One must fabricate it from fcntl
-** calls with 64 bit arguments.
-*/
-#if defined(IRIX) || defined(UNIXWARE)
- _md_iovector._lockf64 = _MD_irix_lockf64;
-#else
- _md_iovector._lockf64 = lockf64;
-#endif
_md_iovector._lseek64 = lseek64;
#elif defined(_PR_HAVE_LARGE_OFF_T)
_md_iovector._open64 = open;
_md_iovector._mmap64 = mmap;
_md_iovector._fstat64 = fstat;
_md_iovector._stat64 = stat;
- _md_iovector._lockf64 = lockf;
_md_iovector._lseek64 = lseek;
#else
#error "I don't know yet"
#endif
LL_I2L(minus_one, -1);
} /* _PR_InitIOV */
void _PR_UnixInit(void)
--- a/pr/src/md/unix/uxwrap.c
+++ b/pr/src/md/unix/uxwrap.c
@@ -22,17 +22,17 @@
*
* Our wrapped versions of the Unix select() and poll() system calls.
*
*------------------------------------------------------------------------
*/
#include "primpl.h"
-#if defined(_PR_PTHREADS) || defined(_PR_GLOBAL_THREADS_ONLY)
+#if defined(_PR_PTHREADS) || defined(_PR_GLOBAL_THREADS_ONLY) || defined(QNX)
/* Do not wrap select() and poll(). */
#else /* defined(_PR_PTHREADS) || defined(_PR_GLOBAL_THREADS_ONLY) */
/* The include files for select() */
#ifdef IRIX
#include <unistd.h>
#include <bstring.h>
#endif
@@ -81,44 +81,44 @@ void PR_SetXtHackOkayToReleaseXLockFn(in
*-----------------------------------------------------------------------
*/
#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)
+#elif defined(AIX_RENAME_SELECT)
int wrap_select(unsigned long width, void *rl, void *wl, void *el,
struct timeval *tv)
-#elif (defined(BSDI) && !defined(BSDI_2))
+#elif defined(_PR_SELECT_CONST_TIMEVAL)
int select(int width, fd_set *rd, fd_set *wr, fd_set *ex,
const struct timeval *tv)
#else
int select(int width, fd_set *rd, fd_set *wr, fd_set *ex, struct timeval *tv)
#endif
{
int osfd;
_PRUnixPollDesc *unixpds, *unixpd, *eunixpd;
PRInt32 pdcnt;
PRIntervalTime timeout;
int retVal;
-#if defined(HPUX9) || defined(AIX4_1)
+#if defined(HPUX9) || defined(AIX_RENAME_SELECT)
fd_set *rd = (fd_set*) rl;
fd_set *wr = (fd_set*) wl;
fd_set *ex = (fd_set*) el;
#endif
#if 0
/*
* Easy special case: zero timeout. Simply call the native
* select() with no fear of blocking.
*/
if (tv != NULL && tv->tv_sec == 0 && tv->tv_usec == 0) {
-#if defined(HPUX9) || defined(AIX4_1)
+#if defined(HPUX9) || defined(AIX_RENAME_SELECT)
return _MD_SELECT(width, rl, wl, el, tv);
#else
return _MD_SELECT(width, rd, wr, ex, tv);
#endif
}
#endif
if (!_pr_initialized) {
@@ -303,19 +303,19 @@ int select(int width, fd_set *rd, fd_set
* positive value: the number of file descriptors for which poll()
* has set the revents bitmask.
*
*-----------------------------------------------------------------------
*/
#include <poll.h>
-#if defined(AIX4_1)
+#if defined(AIX_RENAME_SELECT)
int wrap_poll(void *listptr, unsigned long nfds, long timeout)
-#elif (defined(AIX) && !defined(AIX4_1))
+#elif (defined(AIX) && !defined(AIX_RENAME_SELECT))
int poll(void *listptr, unsigned long nfds, long timeout)
#elif defined(OSF1) || (defined(HPUX) && !defined(HPUX9))
int poll(struct pollfd filedes[], unsigned int nfds, int timeout)
#elif defined(HPUX9)
int poll(struct pollfd filedes[], int nfds, int timeout)
#elif defined(NETBSD)
int poll(struct pollfd *filedes, nfds_t nfds, int timeout)
#elif defined(OPENBSD)
--- a/pr/src/misc/pratom.c
+++ b/pr/src/misc/pratom.c
@@ -34,78 +34,78 @@
#ifndef _PR_HAVE_ATOMIC_OPS
/*
* We use a single lock for all the emulated atomic operations.
* The lock contention should be acceptable.
*/
-static PRLock *lock = NULL;
+static PRLock *atomic_lock = NULL;
void _PR_MD_INIT_ATOMIC()
{
- if (lock == NULL) {
- lock = PR_NewLock();
+ if (atomic_lock == NULL) {
+ atomic_lock = PR_NewLock();
}
}
PRInt32
_PR_MD_ATOMIC_INCREMENT(PRInt32 *val)
{
PRInt32 rv;
if (!_pr_initialized) {
_PR_ImplicitInitialization();
}
- PR_Lock(lock);
+ PR_Lock(atomic_lock);
rv = ++(*val);
- PR_Unlock(lock);
+ PR_Unlock(atomic_lock);
return rv;
}
PRInt32
_PR_MD_ATOMIC_ADD(PRInt32 *ptr, PRInt32 val)
{
PRInt32 rv;
if (!_pr_initialized) {
_PR_ImplicitInitialization();
}
- PR_Lock(lock);
+ PR_Lock(atomic_lock);
rv = ((*ptr) += val);
- PR_Unlock(lock);
+ PR_Unlock(atomic_lock);
return rv;
}
PRInt32
_PR_MD_ATOMIC_DECREMENT(PRInt32 *val)
{
PRInt32 rv;
if (!_pr_initialized) {
_PR_ImplicitInitialization();
}
- PR_Lock(lock);
+ PR_Lock(atomic_lock);
rv = --(*val);
- PR_Unlock(lock);
+ PR_Unlock(atomic_lock);
return rv;
}
PRInt32
_PR_MD_ATOMIC_SET(PRInt32 *val, PRInt32 newval)
{
PRInt32 rv;
if (!_pr_initialized) {
_PR_ImplicitInitialization();
}
- PR_Lock(lock);
+ PR_Lock(atomic_lock);
rv = *val;
*val = newval;
- PR_Unlock(lock);
+ PR_Unlock(atomic_lock);
return rv;
}
#endif /* !_PR_HAVE_ATOMIC_OPS */
void _PR_InitAtomic(void)
{
_PR_MD_INIT_ATOMIC();
--- a/pr/src/misc/prcountr.c
+++ b/pr/src/misc/prcountr.c
@@ -489,22 +489,11 @@ PR_IMPLEMENT(PRCounterHandle)
#else /* !(defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)) */
/*
** NSPR Counters are not defined in this case
**
**
*/
+/* Some compilers don't like an empty compilation unit. */
+static int dummy = 0;
#endif /* defined(DEBUG) || defined(FORCE_NSPR_COUNTERS) */
-
-
-
-
-
-
-
-
-
-
-
-
-
--- a/pr/src/misc/prerror.c
+++ b/pr/src/misc/prerror.c
@@ -13,17 +13,16 @@
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "primpl.h"
-#include <memory.h>
#include <string.h>
#include <stdlib.h>
PR_IMPLEMENT(PRErrorCode) PR_GetError()
{
PRThread *thread = PR_GetCurrentThread();
return thread->errorCode;
}
--- a/pr/src/misc/prinit.c
+++ b/pr/src/misc/prinit.c
@@ -559,19 +559,18 @@ PR_IMPLEMENT(PRStatus) PR_CallOnce(
PRBool _PR_Obsolete(const char *obsolete, const char *preferred)
{
#if defined(DEBUG)
#ifndef XP_MAC
PR_fprintf(
PR_STDERR, "'%s' is obsolete. Use '%s' instead.\n",
obsolete, (NULL == preferred) ? "something else" : preferred);
- return PR_FALSE;
#else
#pragma unused (obsolete, preferred)
- return PR_FALSE;
#endif
#endif
+ return PR_FALSE;
} /* _PR_Obsolete */
/* prinit.c */
--- a/pr/src/misc/prinrval.c
+++ b/pr/src/misc/prinrval.c
@@ -30,16 +30,24 @@
*
*
*-----------------------------------------------------------------------
*/
void _PR_InitClock(void)
{
_PR_MD_INTERVAL_INIT();
+#ifdef DEBUG
+ {
+ PRIntervalTime ticksPerSec = PR_TicksPerSecond();
+
+ PR_ASSERT(ticksPerSec >= PR_INTERVAL_MIN);
+ PR_ASSERT(ticksPerSec <= PR_INTERVAL_MAX);
+ }
+#endif /* DEBUG */
}
/*
* This version of interval times is based on the time of day
* capability offered by system. This isn't valid for two reasons:
* 1) The time of day is neither linear nor montonically increasing
* 2) The units here are milliseconds. That's not appropriate for our use.
*/
--- a/pr/src/misc/prolock.c
+++ b/pr/src/misc/prolock.c
@@ -70,22 +70,11 @@ PR_IMPLEMENT(PRStatus)
} /* end PR_UnlockOrderedLock() */
#else /* ! defined(FORCE_NSPR_ORDERED_LOCK) */
/*
** NSPR Ordered Lock is not defined when !DEBUG and !FORCE_NSPR_ORDERED_LOCK
**
*/
+/* Some compilers don't like an empty compilation unit. */
+static int dummy = 0;
#endif /* defined(FORCE_NSPR_ORDERED_LOCK */
-
-
-
-
-
-
-
-
-
-
-
-
-
--- a/pr/src/misc/prtrace.c
+++ b/pr/src/misc/prtrace.c
@@ -902,11 +902,13 @@ PR_IMPLEMENT(PRIntn)
} /* end PR_GetTraceEntries() */
#else /* !defined(FORCE_NSPR_TRACE) */
/*
** The trace facility is not defined when !DEBUG and !FORCE_NSPR_TRACE
**
*/
+/* Some compilers don't like an empty compilation unit. */
+static int dummy = 0;
#endif /* defined(FORCE_NSPR_TRACE) */
/* end prtrace.c */
--- a/pr/src/threads/combined/prustack.c
+++ b/pr/src/threads/combined/prustack.c
@@ -13,20 +13,16 @@
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "primpl.h"
-#ifdef XP_UNIX
-#include <sys/mman.h>
-#endif
-
/* List of free stack virtual memory chunks */
PRLock *_pr_stackLock;
PRCList _pr_freeStacks = PR_INIT_STATIC_CLIST(&_pr_freeStacks);
PRIntn _pr_numFreeStacks;
PRIntn _pr_maxFreeStacks = 4;
#ifdef DEBUG
/*
--- a/pr/tests/Makefile
+++ b/pr/tests/Makefile
@@ -207,17 +207,17 @@ ifeq ($(OS_ARCH), IRIX)
endif
ifeq ($(OS_ARCH), OSF1)
ifeq ($(USE_CPLUS), 1)
CC = cxx
endif
# I haven't figured out how to pass -rpath to cc on OSF1 V3.2, so
# we do static linking.
- ifeq ($(OS_RELEASE), V3.2)
+ ifeq (,$(filter-out V2.0 V3.2,$(OS_RELEASE)))
LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).a
LIBPLC = $(DIST)/lib/libplc$(MOD_VERSION).a
EXTRA_LIBS = -lc_r
else
LDOPTS += -rpath $(PWD)/$(DIST)/lib
endif
endif
@@ -346,18 +346,20 @@ endif
ifeq ($(OS_ARCH),FreeBSD)
ifeq ($(USE_PTHREADS),1)
EXTRA_LIBS = -lc_r
endif
LDOPTS += -Xlinker -R $(PWD)/$(DIST)/lib
endif
ifeq ($(OS_ARCH),BSD_OS)
+ifneq ($(OS_RELEASE),1.1)
EXTRA_LIBS = -ldl
endif
+endif
ifeq ($(USE_PTHREADS),1)
ifeq ($(OS_ARCH),AIX)
LIBPTHREAD = -lpthreads
else
ifeq ($(OS_ARCH),FreeBSD)
LIBPTHREAD = -lc_r
else