diff options
author | wtc%netscape.com <devnull@localhost> | 1998-11-23 06:33:00 +0000 |
---|---|---|
committer | wtc%netscape.com <devnull@localhost> | 1998-11-23 06:33:00 +0000 |
commit | d976305902688512ed8a651effbe7f2a3171f8af (patch) | |
tree | 852159b8e0c870d67fbc76d8a53dfa2930725d2f | |
parent | ff2890ebc6c7d2d10ea434010a65f4d1e9340178 (diff) | |
download | nspr-hg-RDF_19981124_BASE.tar.gz |
A jumbo checkin, consisting of:RDF_19981124_BASE
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.
53 files changed, 713 insertions, 229 deletions
diff --git a/config/AIX.mk b/config/AIX.mk index beec0ea7..79f20536 100644 --- a/config/AIX.mk +++ b/config/AIX.mk @@ -33,8 +33,15 @@ 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 = @@ -57,18 +64,35 @@ 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) @@ -83,7 +107,6 @@ ifeq (,$(filter-out 4.2 4.3,$(OS_RELEASE))) ifneq ($(CLASSIC_NSPR),1) OS_CFLAGS += -DHAVE_POINTER_LOCALTIME_R endif -OS_CFLAGS += -D_PR_HAVE_OFF64_T endif # @@ -92,7 +115,7 @@ endif # 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 diff --git a/config/BSD_OS.mk b/config/BSD_OS.mk index 87b63b93..66d20b70 100644 --- a/config/BSD_OS.mk +++ b/config/BSD_OS.mk @@ -21,25 +21,37 @@ 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 diff --git a/config/IRIX.mk b/config/IRIX.mk index 8c5e9f30..24c1f7ba 100644 --- a/config/IRIX.mk +++ b/config/IRIX.mk @@ -32,10 +32,16 @@ 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 @@ -108,6 +114,10 @@ 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 diff --git a/config/Linux.mk b/config/Linux.mk index 855ac2c9..8a1de57f 100644 --- a/config/Linux.mk +++ b/config/Linux.mk @@ -50,7 +50,7 @@ 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) diff --git a/config/Makefile b/config/Makefile index ab391b22..7212711b 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 NEXTSTEP SCOOS UNIXWARE,$(OS_ARCH))) +ifeq (,$(filter-out NEC NEXTSTEP QNX SCOOS UNIXWARE,$(OS_ARCH))) DEFINES += -DOMIT_LIB_BUILD_TIME endif @@ -83,7 +83,7 @@ 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) diff --git a/config/NCR.mk b/config/NCR.mk index 98d07596..f87af2df 100644 --- a/config/NCR.mk +++ b/config/NCR.mk @@ -33,6 +33,12 @@ 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 diff --git a/config/OSF1.mk b/config/OSF1.mk index b1d10694..0b09dc2f 100644 --- a/config/OSF1.mk +++ b/config/OSF1.mk @@ -39,13 +39,16 @@ 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 @@ -53,9 +56,11 @@ else USE_PTHREADS = 1 IMPL_STRATEGY = _PTH endif -endif -CC = cc $(NON_LD_FLAGS) -std1 -readonly_strings +CC = cc $(NON_LD_FLAGS) -std1 +ifneq ($(OS_RELEASE),V2.0) +CC += -readonly_strings +endif # The C++ compiler cxx has -readonly_strings on by default. CCC = cxx @@ -71,7 +76,11 @@ 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 diff --git a/config/QNX.mk b/config/QNX.mk new file mode 100644 index 00000000..eb1aa063 --- /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 diff --git a/config/SINIX.mk b/config/SINIX.mk index 1be48be5..9133ba79 100644 --- a/config/SINIX.mk +++ b/config/SINIX.mk @@ -21,6 +21,13 @@ 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 @@ -30,8 +37,14 @@ 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 @@ -62,8 +75,6 @@ ifeq ($(OS_RELEASE),5.43) ODD_CFLAGS += -DIP_MULTICAST endif -CPU_ARCH = mips - RANLIB = /bin/true # For purify diff --git a/config/SunOS5.mk b/config/SunOS5.mk index 4438e722..323a8a58 100644 --- a/config/SunOS5.mk +++ b/config/SunOS5.mk @@ -102,8 +102,12 @@ 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 diff --git a/config/UNIX.mk b/config/UNIX.mk index d822543f..c1f8b2f2 100644 --- a/config/UNIX.mk +++ b/config/UNIX.mk @@ -71,5 +71,5 @@ 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 diff --git a/config/arch.mk b/config/arch.mk index 3fa5599c..140830ab 100644 --- a/config/arch.mk +++ b/config/arch.mk @@ -60,6 +60,9 @@ 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 @@ -70,6 +73,9 @@ 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 diff --git a/config/nsinstall.c b/config/nsinstall.c index 67c0d225..d522cb7c 100644 --- a/config/nsinstall.c +++ b/config/nsinstall.c @@ -43,7 +43,9 @@ #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 @@ -93,6 +95,10 @@ my_getcwd (char *buf, size_t size) extern int fchmod(int fildes, mode_t mode); #endif +#ifdef QNX +#define d_ino d_stat.st_ino +#endif + static void usage(void) { diff --git a/config/rules.mk b/config/rules.mk index 326504dc..1c95360d 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -195,10 +195,14 @@ ifdef RELEASE_LIBS @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 @@ -207,10 +211,14 @@ ifdef RELEASE_HEADERS @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 @@ -324,7 +332,7 @@ 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) $< diff --git a/pr/include/md/Makefile b/pr/include/md/Makefile index 25bc965c..0c091b5b 100644 --- a/pr/include/md/Makefile +++ b/pr/include/md/Makefile @@ -127,6 +127,10 @@ 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 diff --git a/pr/include/md/_aix.h b/pr/include/md/_aix.h index 4ba958ea..7329a39f 100644 --- a/pr/include/md/_aix.h +++ b/pr/include/md/_aix.h @@ -56,7 +56,6 @@ #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 @@ -69,6 +68,7 @@ extern PRIntervalTime _MD_AixIntervalPerSec(void); #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 @@ -78,6 +78,7 @@ extern PRIntervalTime _MD_AixIntervalPerSec(void); #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 @@ -213,7 +214,7 @@ struct _MDCPU { #define _MD_CLEAN_THREAD(_thread) #endif /* PTHREADS_USER */ -#ifdef AIX4_1 +#ifdef AIX_RENAME_SELECT #define _MD_SELECT select #define _MD_POLL poll #endif diff --git a/pr/include/md/_bsdi.h b/pr/include/md/_bsdi.h index 2639b2e3..9679f298 100644 --- a/pr/include/md/_bsdi.h +++ b/pr/include/md/_bsdi.h @@ -32,26 +32,21 @@ #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] -#else +#elif defined(_PR_BSDI_JMPBUF_IS_STRUCT) #define _MD_GET_SP(_t) (_t)->md.context[0].jb_esp +#else +#error "Unknown BSDI jmp_buf type" #endif #define PR_NUM_GCREGS _JBLEN diff --git a/pr/include/md/_darwin.h b/pr/include/md/_darwin.h index 476b8e38..8a1a249c 100644 --- a/pr/include/md/_darwin.h +++ b/pr/include/md/_darwin.h @@ -39,6 +39,7 @@ #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 diff --git a/pr/include/md/_ncr.h b/pr/include/md/_ncr.h index 2c5ebb0d..766ad9ba 100644 --- a/pr/include/md/_ncr.h +++ b/pr/include/md/_ncr.h @@ -48,7 +48,6 @@ #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 diff --git a/pr/include/md/_nextstep.h b/pr/include/md/_nextstep.h index 97c0ca9a..8902b4f9 100644 --- a/pr/include/md/_nextstep.h +++ b/pr/include/md/_nextstep.h @@ -54,9 +54,8 @@ error Unknown NEXTSTEP architecture #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 @@ -252,8 +251,6 @@ extern PRIntervalTime _PR_UNIX_TicksPerSecond(void); ** 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); diff --git a/pr/include/md/_osf1.h b/pr/include/md/_osf1.h index ab2baadd..476e0adc 100644 --- a/pr/include/md/_osf1.h +++ b/pr/include/md/_osf1.h @@ -42,8 +42,6 @@ #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 @@ -187,6 +185,7 @@ struct _MDCPU { #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 @@ -197,13 +196,15 @@ 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___ */ diff --git a/pr/include/md/_qnx.cfg b/pr/include/md/_qnx.cfg new file mode 100644 index 00000000..9abb5ab6 --- /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___ */ diff --git a/pr/include/md/_qnx.h b/pr/include/md/_qnx.h new file mode 100644 index 00000000..f81d7aea --- /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___ */ diff --git a/pr/include/md/_reliantunix.h b/pr/include/md/_reliantunix.h index a327b122..027ff2dc 100644 --- a/pr/include/md/_reliantunix.h +++ b/pr/include/md/_reliantunix.h @@ -49,6 +49,8 @@ #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 diff --git a/pr/include/md/_rhapsody.h b/pr/include/md/_rhapsody.h index 476b8e38..8a1a249c 100644 --- a/pr/include/md/_rhapsody.h +++ b/pr/include/md/_rhapsody.h @@ -39,6 +39,7 @@ #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 diff --git a/pr/include/md/_unixos.h b/pr/include/md/_unixos.h index ab507d86..4b9a429b 100644 --- a/pr/include/md/_unixos.h +++ b/pr/include/md/_unixos.h @@ -144,6 +144,11 @@ extern void _MD_unix_init_running_cpu(struct _PRCPU *cpu); ** 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() */ @@ -563,7 +568,6 @@ struct _MD_IOVector _MD_Mmap64 _mmap64; _MD_Stat64 _stat64; _MD_Fstat64 _fstat64; - _MD_Lockf64 _lockf64; _MD_Lseek64 _lseek64; }; extern struct _MD_IOVector _md_iovector; diff --git a/pr/include/md/prosdep.h b/pr/include/md/prosdep.h index b0150007..a1aaac15 100644 --- a/pr/include/md/prosdep.h +++ b/pr/include/md/prosdep.h @@ -110,6 +110,9 @@ PR_BEGIN_EXTERN_C #elif defined(DGUX) #include "md/_dgux.h" +#elif defined(QNX) +#include "md/_qnx.h" + #else #error unknown Unix flavor diff --git a/pr/include/obsolete/Makefile b/pr/include/obsolete/Makefile index aa05cd0d..d8965ed3 100644 --- a/pr/include/obsolete/Makefile +++ b/pr/include/obsolete/Makefile @@ -21,7 +21,7 @@ MOD_DEPTH = ../../.. include $(MOD_DEPTH)/config/config.mk -HEADERS = *.h +HEADERS = $(wildcard *.h) RELEASE_HEADERS = $(HEADERS) RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)/obsolete diff --git a/pr/include/prinet.h b/pr/include/prinet.h index 149b943e..9ac10c20 100644 --- a/pr/include/prinet.h +++ b/pr/include/prinet.h @@ -52,7 +52,7 @@ #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 diff --git a/pr/include/private/primpl.h b/pr/include/private/primpl.h index 200b8fc3..3f381206 100644 --- a/pr/include/private/primpl.h +++ b/pr/include/private/primpl.h @@ -1537,6 +1537,7 @@ extern PRBool _pr_ipv6_enabled; /* defined in prnetdb.c */ && !defined(PURIFY) \ && !defined(RHAPSODY) \ && !defined(NEXTSTEP) \ + && !defined(QNX) \ && !(defined (UNIXWARE) && defined (USE_SVR4_THREADS)) #define _PR_OVERRIDE_MALLOC #endif diff --git a/pr/src/Makefile b/pr/src/Makefile index 6a9e9e41..c424ac58 100644 --- a/pr/src/Makefile +++ b/pr/src/Makefile @@ -75,7 +75,7 @@ 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 diff --git a/pr/src/io/prfile.c b/pr/src/io/prfile.c index ffe6479a..0bd1d258 100644 --- a/pr/src/io/prfile.c +++ b/pr/src/io/prfile.c @@ -22,7 +22,7 @@ #include <fcntl.h> #ifdef XP_UNIX -#ifdef AIX +#if defined(AIX) || defined(QNX) /* To pick up sysconf */ #include <unistd.h> #else @@ -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) && !defined(NEXTSTEP) +#if defined(XP_UNIX) && !defined(AIX) && !defined(NEXTSTEP) && !defined(QNX) struct rlimit rlim; if ( getrlimit(RLIMIT_NOFILE, &rlim) < 0) { @@ -274,7 +274,7 @@ PRInt32 PR_GetSysfdTableMax(void) } 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) /* @@ -294,7 +294,7 @@ PRInt32 PR_GetSysfdTableMax(void) 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(); @@ -318,8 +318,8 @@ PRInt32 PR_SetSysfdTableSize(int table_size) } 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) diff --git a/pr/src/io/prmapopt.c b/pr/src/io/prmapopt.c index 88496d82..49c15863 100644 --- a/pr/src/io/prmapopt.c +++ b/pr/src/io/prmapopt.c @@ -350,9 +350,15 @@ PRStatus PR_CALLBACK _PR_SocketSetSocketOption(PRFileDesc *fd, const PRSocketOpt #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 @@ -388,6 +394,10 @@ PRStatus PR_CALLBACK _PR_SocketSetSocketOption(PRFileDesc *fd, const PRSocketOpt #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 diff --git a/pr/src/io/prprf.c b/pr/src/io/prprf.c index ee6fc44d..ff31d87d 100644 --- a/pr/src/io/prprf.c +++ b/pr/src/io/prprf.c @@ -35,7 +35,7 @@ ** 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) diff --git a/pr/src/io/prsocket.c b/pr/src/io/prsocket.c index f75bbf28..5ad9c720 100644 --- a/pr/src/io/prsocket.c +++ b/pr/src/io/prsocket.c @@ -51,7 +51,21 @@ static PRBool IsValidNetAddrLen(const PRNetAddr *addr, PRInt32 addr_len) && (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; } diff --git a/pr/src/linking/prlink.c b/pr/src/linking/prlink.c index 853fea91..4c61979c 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) || defined(NEXTSTEP) +#elif defined(USE_MACH_DYLD) #include <mach-o/dyld.h> #endif @@ -71,7 +71,7 @@ struct PRLibrary { #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; @@ -170,7 +170,7 @@ void _PR_InitLinker(void) #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 @@ -284,7 +284,7 @@ PR_GetLibraryPath() #endif #ifdef XP_UNIX -#if defined USE_DLFCN || defined RHAPSODY +#if defined USE_DLFCN || defined USE_MACH_DYLD { char *home; char *local; @@ -639,7 +639,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) || defined(NEXTSTEP) +#elif defined(USE_MACH_DYLD) NSObjectFileImage ofi; NSModule h = NULL; if (NSCreateObjectFileImageFromFile(name, &ofi) @@ -712,7 +712,7 @@ PR_UnloadLibrary(PRLibrary *lib) 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 @@ -825,7 +825,7 @@ pr_FindSymbolInLib(PRLibrary *lm, const char *name) 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 */ diff --git a/pr/src/malloc/prmalloc.c b/pr/src/malloc/prmalloc.c index 61f50023..cae8b2a8 100644 --- a/pr/src/malloc/prmalloc.c +++ b/pr/src/malloc/prmalloc.c @@ -84,7 +84,6 @@ static int malloc_event; #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <memory.h> #include <string.h> #include <errno.h> #include <sys/types.h> diff --git a/pr/src/md/unix/Makefile b/pr/src/md/unix/Makefile index 3d9e41df..8379ed24 100644 --- a/pr/src/md/unix/Makefile +++ b/pr/src/md/unix/Makefile @@ -118,6 +118,10 @@ DGUX_CSRCS = \ dgux.c \ $(NULL) +QNX_CSRCS = \ + qnx.c \ + $(NULL) + ifeq ($(PTHREADS_USER),1) CSRCS += $(PTH_USER_CSRCS) endif @@ -185,6 +189,9 @@ 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. @@ -223,7 +230,7 @@ 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 @@ -249,7 +256,7 @@ 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 diff --git a/pr/src/md/unix/aix.c b/pr/src/md/unix/aix.c index 524346e8..d7d260e2 100644 --- a/pr/src/md/unix/aix.c +++ b/pr/src/md/unix/aix.c @@ -18,6 +18,7 @@ #include "primpl.h" +#ifdef AIX_HAVE_ATOMIC_OP_H #include <sys/atomic_op.h> PRInt32 _AIX_AtomicSet(PRInt32 *val, PRInt32 newval) @@ -31,6 +32,7 @@ PRInt32 _AIX_AtomicSet(PRInt32 *val, PRInt32 newval) } while (!stored); return oldval; } /* _AIX_AtomicSet */ +#endif /* AIX_HAVE_ATOMIC_OP_H */ #if defined(AIX_TIMERS) @@ -181,7 +183,7 @@ _MD_CREATE_THREAD( * 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> @@ -249,7 +251,7 @@ void _pr_aix_dummy() poll(0,0,0); } -#endif /* !defined(AIX4_1) */ +#endif /* !defined(AIX_RENAME_SELECT) */ #ifdef _PR_HAVE_ATOMIC_CAS diff --git a/pr/src/md/unix/aixwrap.c b/pr/src/md/unix/aixwrap.c index e5c0a630..94a49f1d 100644 --- a/pr/src/md/unix/aixwrap.c +++ b/pr/src/md/unix/aixwrap.c @@ -26,8 +26,8 @@ * 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> @@ -43,4 +43,4 @@ int _MD_POLL(void *listptr, unsigned long nfds, long timeout) return poll(listptr, nfds, timeout); } -#endif /* AIX4_1 */ +#endif /* AIX_RENAME_SELECT */ diff --git a/pr/src/md/unix/objs.mk b/pr/src/md/unix/objs.mk index 311926a9..d47103df 100644 --- a/pr/src/md/unix/objs.mk +++ b/pr/src/md/unix/objs.mk @@ -110,6 +110,10 @@ DGUX_CSRCS = \ dgux.c \ $(NULL) +QNX_CSRCS = \ + qnx.c \ + $(NULL) + ifeq ($(PTHREADS_USER),1) CSRCS += $(PTH_USER_CSRCS) @@ -178,6 +182,9 @@ 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. diff --git a/pr/src/md/unix/qnx.c b/pr/src/md/unix/qnx.c new file mode 100644 index 00000000..f154ab1c --- /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; +} diff --git a/pr/src/md/unix/unix.c b/pr/src/md/unix/unix.c index 88a9a064..72922f1d 100644 --- a/pr/src/md/unix/unix.c +++ b/pr/src/md/unix/unix.c @@ -21,7 +21,6 @@ #include <string.h> #include <signal.h> #include <unistd.h> -#include <memory.h> #include <fcntl.h> #include <sys/types.h> #include <sys/socket.h> @@ -47,10 +46,11 @@ || 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" @@ -89,10 +89,6 @@ static sigset_t empty_set; #define PIPE_BUF 512 #endif -#ifndef PROT_NONE -#define PROT_NONE 0 -#endif - /* * _nspr_noclock - if set clock interrupts are disabled */ @@ -835,12 +831,9 @@ PRInt32 _MD_recvfrom(PRFileDesc *fd, void *buf, PRInt32 amount, 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 */ @@ -916,9 +909,19 @@ PRInt32 _MD_sendto( 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) { @@ -1044,12 +1047,9 @@ PRInt32 _MD_accept(PRFileDesc *fd, PRNetAddr *addr, 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 */ @@ -1067,6 +1067,13 @@ PRInt32 _MD_connect( 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() @@ -1084,8 +1091,12 @@ 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) { @@ -1136,8 +1147,16 @@ retry: 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); @@ -1191,12 +1210,9 @@ PRStatus _MD_getsockname(PRFileDesc *fd, PRNetAddr *addr, (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 */ @@ -1216,12 +1232,9 @@ PRStatus _MD_getpeername(PRFileDesc *fd, PRNetAddr *addr, (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 */ @@ -2246,20 +2259,34 @@ 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) /* @@ -2558,35 +2585,6 @@ static PRIntn _MD_solaris25_stat64(const char *fn, _MDStat64 *buf) #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; @@ -2611,32 +2609,6 @@ static void* _MD_Unix_mmap64( } /* _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) @@ -2651,7 +2623,6 @@ static void _PR_InitIOV(void) _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); } @@ -2661,7 +2632,6 @@ static void _PR_InitIOV(void) _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) @@ -2669,30 +2639,22 @@ static void _PR_InitIOV(void) _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" diff --git a/pr/src/md/unix/uxwrap.c b/pr/src/md/unix/uxwrap.c index 783b9885..b28c8fbc 100644 --- a/pr/src/md/unix/uxwrap.c +++ b/pr/src/md/unix/uxwrap.c @@ -27,7 +27,7 @@ #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() */ @@ -86,10 +86,10 @@ 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 @@ -101,7 +101,7 @@ int select(int width, fd_set *rd, fd_set *wr, fd_set *ex, struct timeval *tv) 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; @@ -113,7 +113,7 @@ int select(int width, fd_set *rd, fd_set *wr, fd_set *ex, struct timeval *tv) * 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); @@ -308,9 +308,9 @@ int select(int width, fd_set *rd, fd_set *wr, fd_set *ex, struct timeval *tv) #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) diff --git a/pr/src/misc/pratom.c b/pr/src/misc/pratom.c index 499c7480..d7c1809c 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 *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(); } } @@ -55,9 +55,9 @@ _PR_MD_ATOMIC_INCREMENT(PRInt32 *val) if (!_pr_initialized) { _PR_ImplicitInitialization(); } - PR_Lock(lock); + PR_Lock(atomic_lock); rv = ++(*val); - PR_Unlock(lock); + PR_Unlock(atomic_lock); return rv; } @@ -69,9 +69,9 @@ _PR_MD_ATOMIC_ADD(PRInt32 *ptr, PRInt32 val) if (!_pr_initialized) { _PR_ImplicitInitialization(); } - PR_Lock(lock); + PR_Lock(atomic_lock); rv = ((*ptr) += val); - PR_Unlock(lock); + PR_Unlock(atomic_lock); return rv; } @@ -83,9 +83,9 @@ _PR_MD_ATOMIC_DECREMENT(PRInt32 *val) if (!_pr_initialized) { _PR_ImplicitInitialization(); } - PR_Lock(lock); + PR_Lock(atomic_lock); rv = --(*val); - PR_Unlock(lock); + PR_Unlock(atomic_lock); return rv; } @@ -97,10 +97,10 @@ _PR_MD_ATOMIC_SET(PRInt32 *val, PRInt32 newval) 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; } diff --git a/pr/src/misc/prcountr.c b/pr/src/misc/prcountr.c index 33e85d82..d1331392 100644 --- a/pr/src/misc/prcountr.c +++ b/pr/src/misc/prcountr.c @@ -494,17 +494,6 @@ PR_IMPLEMENT(PRCounterHandle) ** ** */ +/* Some compilers don't like an empty compilation unit. */ +static int dummy = 0; #endif /* defined(DEBUG) || defined(FORCE_NSPR_COUNTERS) */ - - - - - - - - - - - - - diff --git a/pr/src/misc/prerror.c b/pr/src/misc/prerror.c index c7ea4707..a462f36e 100644 --- a/pr/src/misc/prerror.c +++ b/pr/src/misc/prerror.c @@ -18,7 +18,6 @@ #include "primpl.h" -#include <memory.h> #include <string.h> #include <stdlib.h> diff --git a/pr/src/misc/prinit.c b/pr/src/misc/prinit.c index 6960b153..8b830c1a 100644 --- a/pr/src/misc/prinit.c +++ b/pr/src/misc/prinit.c @@ -564,12 +564,11 @@ PRBool _PR_Obsolete(const char *obsolete, const char *preferred) 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 */ diff --git a/pr/src/misc/prinrval.c b/pr/src/misc/prinrval.c index 2fe46a76..87112926 100644 --- a/pr/src/misc/prinrval.c +++ b/pr/src/misc/prinrval.c @@ -35,6 +35,14 @@ 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 */ } /* diff --git a/pr/src/misc/prolock.c b/pr/src/misc/prolock.c index 08123640..86943923 100644 --- a/pr/src/misc/prolock.c +++ b/pr/src/misc/prolock.c @@ -75,17 +75,6 @@ PR_IMPLEMENT(PRStatus) ** */ +/* Some compilers don't like an empty compilation unit. */ +static int dummy = 0; #endif /* defined(FORCE_NSPR_ORDERED_LOCK */ - - - - - - - - - - - - - diff --git a/pr/src/misc/prtrace.c b/pr/src/misc/prtrace.c index c2a64b6c..b9baffe9 100644 --- a/pr/src/misc/prtrace.c +++ b/pr/src/misc/prtrace.c @@ -907,6 +907,8 @@ PR_IMPLEMENT(PRIntn) ** */ +/* Some compilers don't like an empty compilation unit. */ +static int dummy = 0; #endif /* defined(FORCE_NSPR_TRACE) */ /* end prtrace.c */ diff --git a/pr/src/threads/combined/prustack.c b/pr/src/threads/combined/prustack.c index 4e0053f6..bac39f32 100644 --- a/pr/src/threads/combined/prustack.c +++ b/pr/src/threads/combined/prustack.c @@ -18,10 +18,6 @@ #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); diff --git a/pr/tests/Makefile b/pr/tests/Makefile index 5abb3b95..90f6d8d9 100644 --- a/pr/tests/Makefile +++ b/pr/tests/Makefile @@ -212,7 +212,7 @@ ifeq ($(OS_ARCH), OSF1) 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 @@ -351,8 +351,10 @@ 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) |