summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>2003-05-14 01:24:08 +0000
committerwtc%netscape.com <devnull@localhost>2003-05-14 01:24:08 +0000
commit2ee8b0177de17a746980b182b3380ae7666f7360 (patch)
tree71fe141d35c7c258179c85669f20dcb7bd36f32b
parenteca213f8e0d0e7397ad151f17449a55e73b50220 (diff)
downloadnspr-hg-2ee8b0177de17a746980b182b3380ae7666f7360.tar.gz
Merged the changes from NSPRPUB_PRE_4_2_CLIENT_BRANCH onto the trunk. Most
of these changes are for OS/2. Modified Files: configure.in build/cygwin-wrapper config/rules.mk lib/ds/Makefile.in lib/ds/plds.def lib/libc/src/Makefile.in lib/libc/src/plc.def pr/include/md/_os2.h pr/src/Makefile.in pr/src/nspr.def pr/src/linking/prlink.c pr/src/md/os2/Makefile.in pr/src/md/os2/objs.mk pr/src/md/os2/os2cv.c pr/src/md/os2/os2misc.c pr/src/md/os2/os2poll.c pr/src/md/os2/os2sock.c pr/src/md/os2/os2thred.c pr/tests/Makefile.in pr/tests/attach.c
-rwxr-xr-xbuild/cygwin-wrapper10
-rw-r--r--config/rules.mk29
-rw-r--r--configure.in51
-rw-r--r--lib/ds/Makefile.in6
-rw-r--r--lib/ds/plds.def63
-rw-r--r--lib/libc/src/Makefile.in6
-rw-r--r--lib/libc/src/plc.def63
-rw-r--r--pr/include/md/_os2.h8
-rw-r--r--pr/src/Makefile.in6
-rw-r--r--pr/src/linking/prlink.c4
-rw-r--r--pr/src/md/os2/Makefile.in4
-rw-r--r--pr/src/md/os2/objs.mk6
-rw-r--r--pr/src/md/os2/os2cv.c4
-rw-r--r--pr/src/md/os2/os2misc.c40
-rw-r--r--pr/src/md/os2/os2poll.c6
-rw-r--r--pr/src/md/os2/os2sock.c32
-rw-r--r--pr/src/md/os2/os2thred.c8
-rw-r--r--pr/src/nspr.def90
-rw-r--r--pr/tests/Makefile.in7
-rw-r--r--pr/tests/attach.c20
20 files changed, 301 insertions, 162 deletions
diff --git a/build/cygwin-wrapper b/build/cygwin-wrapper
index c510a7d7..3da3c508 100755
--- a/build/cygwin-wrapper
+++ b/build/cygwin-wrapper
@@ -7,11 +7,17 @@ shift
if test -z "$prog"; then
exit 0
fi
+mountpoint=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
+if test -z "$mountpoint"; then
+ print "Cannot determine cygwin mount points. Exiting"
+ exit 1
+fi
+mountpoint=`echo $mountpoint | sed 's|/$||'`
if test "$prog" = "-up"; then
prog=$1
shift
- args=`echo $* | sed -e 's|-I\(.\):|-I/cygdrive/\1|g;'`
+ args=`echo $* | sed -e "s|-I\([a-zA-Z]\):/|-I${mountpoint}/\1/|g;"`
else
- args=`echo $* | sed -e 's|/cygdrive/\(.\)/|\1:/|g;'`
+ args=`echo $* | sed -e "s|${mountpoint}/\([a-zA-Z]\)/|\1:/|g;"`
fi
exec $prog $args
diff --git a/config/rules.mk b/config/rules.mk
index 7d8a7aef..6aad726e 100644
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -311,8 +311,9 @@ endif
$(RANLIB) $@
ifeq ($(OS_TARGET), OS2)
-$(IMPORT_LIBRARY): $(SHARED_LIBRARY)
- $(IMPLIB) $@ $(SHARED_LIBRARY).def
+$(IMPORT_LIBRARY): $(MAPFILE)
+ rm -f $@
+ $(IMPLIB) $@ $(MAPFILE)
endif
$(SHARED_LIBRARY): $(OBJS) $(MAPFILE)
@@ -330,16 +331,9 @@ else # AIX 4.1
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
$(LINK_DLL) -MAP $(DLLBASE) $(DLL_LIBS) $(EXTRA_LIBS) $(OBJS)
else
-ifeq ($(OS_ARCH),OS2)
-# append ( >> ) doesn't seem to be working under OS/2 gmake. Run through OS/2 shell instead.
- @cmd /C "echo LIBRARY $(notdir $(basename $(SHARED_LIBRARY))) INITINSTANCE TERMINSTANCE >$@.def"
- @cmd /C "echo PROTMODE >>$@.def"
- @cmd /C "echo CODE LOADONCALL MOVEABLE DISCARDABLE >>$@.def"
- @cmd /C "echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >>$@.def"
- @cmd /C "echo EXPORTS >>$@.def"
- @cmd /C "$(FILTER) $(LIBRARY) | grep -v _DLL_InitTerm >>$@.def"
- $(LINK_DLL) $(DLLBASE) $(OBJS) $(OS_LIBS) $(EXTRA_LIBS) $@.def
-else # OS2
+ifeq ($(MOZ_OS2_TOOLS),VACPP)
+ $(LINK_DLL) $(DLLBASE) $(OBJS) $(OS_LIBS) $(EXTRA_LIBS) $(MAPFILE)
+else # !os2 vacpp
ifeq ($(OS_TARGET), OpenVMS)
@if test ! -f $(VMS_SYMVEC_FILE); then \
if test -f $(VMS_SYMVEC_FILE_MODULE); then \
@@ -349,7 +343,7 @@ ifeq ($(OS_TARGET), OpenVMS)
fi
endif # OpenVMS
$(MKSHLIB) $(OBJS) $(EXTRA_LIBS)
-endif # OS2
+endif # OS2 vacpp
endif # WINNT
endif # AIX 4.1
ifdef ENABLE_STRIP
@@ -378,6 +372,15 @@ ifeq ($(OS_ARCH),SunOS)
grep -v ';-' $< | \
sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@
endif
+ifeq ($(OS_ARCH),OS2)
+ echo LIBRARY $(LIBRARY_NAME)$(LIBRARY_VERSION) INITINSTANCE TERMINSTANCE > $@
+ echo PROTMODE >> $@
+ echo CODE LOADONCALL MOVEABLE DISCARDABLE >> $@
+ echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@
+ echo EXPORTS >> $@
+ grep -v ';+' $< | grep -v ';-' | \
+ sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' >> $@
+endif
#
# Translate source filenames to absolute paths. This is required for
diff --git a/configure.in b/configure.in
index b0ef0821..3abf69ba 100644
--- a/configure.in
+++ b/configure.in
@@ -342,7 +342,7 @@ if test -n "$MOZ_DEBUG"; then
beos*)
DEFINES="$DEFINES -DDEBUG_${USER}"
;;
- msvc*|mks*|cygwin*|mingw*)
+ msvc*|mks*|cygwin*|mingw*|os2*)
DEFINES="$DEFINES -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
;;
*)
@@ -451,7 +451,7 @@ fi
if test "$GXX" = "yes"; then
GNU_CXX=1
fi
-if test "`echo | $AS -V 2>&1 | grep -c GNU`" != "0"; then
+if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
GNU_AS=1
fi
rm -f a.out
@@ -1771,10 +1771,8 @@ mips-sony-newsos*)
AC_DEFINE(XP_PC)
AC_DEFINE(BSD_SELECT)
AC_DEFINE(_PR_GLOBAL_THREADS_ONLY)
- OBJ_SUFFIX=obj
LIB_SUFFIX=lib
DLL_SUFFIX=dll
- ASM_SUFFIX=asm
RC=rc.exe
PR_MD_ARCH_DIR=os2
PROG_SUFFIX=.exe
@@ -1783,40 +1781,43 @@ mips-sony-newsos*)
RESOLVE_LINK_SYMBOLS=1
# EMX/GCC build
- if test "$GNU_CC"; then
+ if test -n "$GNU_CC"; then
AC_DEFINE(XP_OS2_EMX)
AC_DEFINE(OS2)
AR=emxomfar
AR_FLAGS='-p256 r $@'
- CFLAGS="-Zmtd -Zomf"
- HOST_CFLAGS="$CFLAGS"
- CXXFLAGS="-Zmtd -Zomf"
+ CFLAGS="$CFLAGS -Wall -Zmtd -Zomf"
+ CXXFLAGS="$CFLAGS -Wall -Zmtd -Zomf"
+ MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
+ DSO_CFLAGS=
+ DSO_LDOPTS='-Zomf -Zdll -Zmtd'
+ _OPTIMIZE_FLAGS="-O2 -s"
+ _DEBUG_FLAGS="-g -fno-inline"
+ if test -n "$MOZ_OPTIMIZE"; then
+ DSO_LDOPTS="$DSO_LDOPTS -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
+ fi
OS_LIBS="-lsocket -lemxio"
- LD='$(CC)'
IMPLIB='emximp -o'
- FILTER='emxexp'
- OS_DLLFLAGS='$(DSO_LDOPTS) -o $@'
- _OPTIMIZE_FLAGS="-O2 -s"
- _DEBUG_FLAGS=-g
- if test -n "$MOZ_DEBUG"; then
- DLLFLAGS='-g'
- EXEFLAGS='-g $(OMF_FLAG) -Zmtd -L$(DIST)/lib -o $@'
- DSO_LDOPTS='-g -Zomf -Zdll -Zmt -Zcrtdll -Zlinker /NOO'
- else
- DLLFLAGS=
- EXEFLAGS='-Zmtd -o $@'
- DSO_LDOPTS='-Zomf -Zdll -Zmt -Zcrtdll -Zlinker /NOO'
+ FILTER='emxexp -o'
+
+ if test -z "$EMXOMFLD_LINKER"; then
+ # using LINK386.EXE
+ DSO_LDOPTS="$DSO_LDOPTS -Zlinker /NOO"
fi
- fi
-
+
+ # GCC for OS/2 currently predefines these, but we don't want them
+ DEFINES="$DEFINES -Uunix -U__unix -U__unix__"
+
# Visual Age C++ build
- if test "$VACPP" = "yes"; then
+ elif test "$VACPP" = "yes"; then
AC_DEFINE(XP_OS2_VACPP)
AC_DEFINE(OS2,4)
AC_DEFINE(TCPV40HDRS)
AC_DEFINE(_X86_)
+ OBJ_SUFFIX=obj
AS=alp
ASFLAGS='-Mb'
+ ASM_SUFFIX=asm
AR=-ilib
AR_FLAGS='/NOL /NOI /O:$(subst /,\\,$@)'
CFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Mp /Tl9'
@@ -1829,7 +1830,7 @@ mips-sony-newsos*)
MKSHLIB='$(LD) $(DSO_LDOPTS)'
IMPLIB='implib -nologo -noignorecase'
FILTER='cppfilt -q -B -P'
- _OPTIMIZE_FLAGS='/O+ /Gl+ /Gx+ /qtune=pentium /qarch=pentium'
+ _OPTIMIZE_FLAGS='/O+ /Gl+ /qtune=pentium /qarch=pentium'
_DEBUG_FLAGS='/Ti+ '
LDFLAGS='/NOL /M /L'
DLLFLAGS='/O:$@ /DLL /INC:_dllentry /MAP:$(@:.dll=.map) /L /NOL'
diff --git a/lib/ds/Makefile.in b/lib/ds/Makefile.in
index 08b4dd3d..4e7234fd 100644
--- a/lib/ds/Makefile.in
+++ b/lib/ds/Makefile.in
@@ -95,6 +95,12 @@ MKSHLIB += -M $(MAPFILE)
endif
endif
+ifeq ($(OS_ARCH),OS2)
+MAPFILE = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).def
+GARBAGE += $(MAPFILE)
+MKSHLIB += $(MAPFILE)
+endif
+
EXTRA_LIBS = $(LIBNSPR)
# On NCR and SCOOS, we can't link with extra libraries when
diff --git a/lib/ds/plds.def b/lib/ds/plds.def
index f062b58b..9e0b505a 100644
--- a/lib/ds/plds.def
+++ b/lib/ds/plds.def
@@ -1,6 +1,51 @@
-# nm -n -C -p libplds4.so | awk '/[^ ]* T PL_/ {print $3}'
-NSPR_4.0 {
- global:
+;+#
+;+# The contents of this file are subject to the Mozilla Public
+;+# License Version 1.1 (the "License"); you may not use this file
+;+# except in compliance with the License. You may obtain a copy of
+;+# the License at http://www.mozilla.org/MPL/
+;+#
+;+# Software distributed under the License is distributed on an "AS
+;+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+;+# implied. See the License for the specific language governing
+;+# rights and limitations under the License.
+;+#
+;+# The Original Code is the Netscape Portable Runtime (NSPR).
+;+#
+;+# The Initial Developer of the Original Code is Netscape
+;+# Communications Corporation. Portions created by Netscape are
+;+# Copyright (C) 2002-2003 Netscape Communications Corporation. All
+;+# Rights Reserved.
+;+#
+;+# Contributor(s):
+;+#
+;+# Alternatively, the contents of this file may be used under the
+;+# terms of the GNU General Public License Version 2 or later (the
+;+# "GPL"), in which case the provisions of the GPL are applicable
+;+# instead of those above. If you wish to allow use of your
+;+# version of this file only under the terms of the GPL and not to
+;+# allow others to use your version of this file under the MPL,
+;+# indicate your decision by deleting the provisions above and
+;+# replace them with the notice and other provisions required by
+;+# the GPL. If you do not delete the provisions above, a recipient
+;+# may use your version of this file under either the MPL or the
+;+# GPL.
+;+#
+;+# OK, this file is meant to support SUN, LINUX, AIX, OS/2 and WINDOWS
+;+# 1. For all unix platforms, the string ";-" means "remove this line"
+;+# 2. For all unix platforms, the string " DATA " will be removed from any
+;+# line on which it occurs.
+;+# 3. Lines containing ";+" will have ";+" removed on SUN and LINUX.
+;+# On AIX, lines containing ";+" will be removed.
+;+# 4. For all unix platforms, the string ";;" will thave the ";;" removed.
+;+# 5. For all unix platforms, after the above processing has taken place,
+;+# all characters after the first ";" on the line will be removed.
+;+# And for AIX, the first ";" will also be removed.
+;+# This file is passed directly to windows. Since ';' is a comment, all UNIX
+;+# directives are hidden behind ";", ";+", and ";-"
+;+NSPR_4.0 {
+;+ global:
+LIBRARY plds4 ;-
+EXPORTS ;-
PL_ArenaAllocate;
PL_ArenaFinish;
PL_ArenaGrow;
@@ -23,11 +68,11 @@ PL_HashTableRemove;
PL_InitArenaPool;
PL_NewHashTable;
libVersionPoint;
- local: *;
-};
-
-NSPR_4.1 {
- global:
+;+ local: *;
+;+};
+;+
+;+NSPR_4.1 {
+;+ global:
PL_HashTableLookupConst;
PL_HashTableRawLookupConst;
-} NSPR_4.0;
+;+} NSPR_4.0;
diff --git a/lib/libc/src/Makefile.in b/lib/libc/src/Makefile.in
index 39f71a3c..17a4dfa1 100644
--- a/lib/libc/src/Makefile.in
+++ b/lib/libc/src/Makefile.in
@@ -105,6 +105,12 @@ MKSHLIB += -M $(MAPFILE)
endif
endif
+ifeq ($(OS_ARCH),OS2)
+MAPFILE = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).def
+GARBAGE += $(MAPFILE)
+MKSHLIB += $(MAPFILE)
+endif
+
EXTRA_LIBS = $(LIBNSPR)
# On NCR and SCOOS, we can't link with extra libraries when
diff --git a/lib/libc/src/plc.def b/lib/libc/src/plc.def
index ad962e23..39eba5b7 100644
--- a/lib/libc/src/plc.def
+++ b/lib/libc/src/plc.def
@@ -1,6 +1,51 @@
-# nm -n -C -p libplc4.so | awk '/[^ ]* T PL_/ {print $3}'
-NSPR_4.0 {
- global:
+;+#
+;+# The contents of this file are subject to the Mozilla Public
+;+# License Version 1.1 (the "License"); you may not use this file
+;+# except in compliance with the License. You may obtain a copy of
+;+# the License at http://www.mozilla.org/MPL/
+;+#
+;+# Software distributed under the License is distributed on an "AS
+;+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+;+# implied. See the License for the specific language governing
+;+# rights and limitations under the License.
+;+#
+;+# The Original Code is the Netscape Portable Runtime (NSPR).
+;+#
+;+# The Initial Developer of the Original Code is Netscape
+;+# Communications Corporation. Portions created by Netscape are
+;+# Copyright (C) 2002-2003 Netscape Communications Corporation. All
+;+# Rights Reserved.
+;+#
+;+# Contributor(s):
+;+#
+;+# Alternatively, the contents of this file may be used under the
+;+# terms of the GNU General Public License Version 2 or later (the
+;+# "GPL"), in which case the provisions of the GPL are applicable
+;+# instead of those above. If you wish to allow use of your
+;+# version of this file only under the terms of the GPL and not to
+;+# allow others to use your version of this file under the MPL,
+;+# indicate your decision by deleting the provisions above and
+;+# replace them with the notice and other provisions required by
+;+# the GPL. If you do not delete the provisions above, a recipient
+;+# may use your version of this file under either the MPL or the
+;+# GPL.
+;+#
+;+# OK, this file is meant to support SUN, LINUX, AIX, OS/2 and WINDOWS
+;+# 1. For all unix platforms, the string ";-" means "remove this line"
+;+# 2. For all unix platforms, the string " DATA " will be removed from any
+;+# line on which it occurs.
+;+# 3. Lines containing ";+" will have ";+" removed on SUN and LINUX.
+;+# On AIX, lines containing ";+" will be removed.
+;+# 4. For all unix platforms, the string ";;" will thave the ";;" removed.
+;+# 5. For all unix platforms, after the above processing has taken place,
+;+# all characters after the first ";" on the line will be removed.
+;+# And for AIX, the first ";" will also be removed.
+;+# This file is passed directly to windows. Since ';' is a comment, all UNIX
+;+# directives are hidden behind ";", ";+", and ";-"
+;+NSPR_4.0 {
+;+ global:
+LIBRARY plc4 ;-
+EXPORTS ;-
PL_Base64Decode;
PL_Base64Encode;
PL_CreateOptState;
@@ -40,10 +85,10 @@ PL_strrchr;
PL_strrstr;
PL_strstr;
libVersionPoint;
- local: *;
-};
-
-NSPR_4.2 {
- global:
+;+ local: *;
+;+};
+;+
+;+NSPR_4.2 {
+;+ global:
PL_strtok_r;
-} NSPR_4.0;
+;+} NSPR_4.0;
diff --git a/pr/include/md/_os2.h b/pr/include/md/_os2.h
index 22fddd20..dc50982a 100644
--- a/pr/include/md/_os2.h
+++ b/pr/include/md/_os2.h
@@ -47,7 +47,10 @@
#include <errno.h>
+#ifdef XP_OS2_VACPP
+/* TODO RAMSEMs need to be written for GCC/EMX */
#define USE_RAMSEM
+#endif
#ifdef USE_RAMSEM
#pragma pack(4)
@@ -75,15 +78,14 @@ APIRET _Optlink SemReleasex86(PRAMSEM, ULONG);
#ifdef XP_OS2_EMX
/*
* EMX-specific tweaks:
- * o Use stricmp instead of strcmpi.
* o Use errno rather than sock_errno()
* o Use close rather than soclose
* o Ignore sock_init calls.
*/
-#define strcmpi stricmp
#define sock_errno() errno
#define soclose close
#define sock_init()
+#include <string.h>
#endif
/*
@@ -308,11 +310,13 @@ extern PRInt32 _MD_SELECT(int nfds, fd_set *readfds, fd_set *writefds,
#define _MD_FSYNC _PR_MD_FSYNC
#define _MD_SET_FD_INHERITABLE (_PR_MD_SET_FD_INHERITABLE)
+#ifdef _PR_HAVE_ATOMIC_OPS
#define _MD_INIT_ATOMIC()
#define _MD_ATOMIC_INCREMENT _PR_MD_ATOMIC_INCREMENT
#define _MD_ATOMIC_ADD _PR_MD_ATOMIC_ADD
#define _MD_ATOMIC_DECREMENT _PR_MD_ATOMIC_DECREMENT
#define _MD_ATOMIC_SET _PR_MD_ATOMIC_SET
+#endif
#define _MD_INIT_IO (_PR_MD_INIT_IO)
#define _MD_PR_POLL (_PR_MD_PR_POLL)
diff --git a/pr/src/Makefile.in b/pr/src/Makefile.in
index 7118c97f..fdf10cf1 100644
--- a/pr/src/Makefile.in
+++ b/pr/src/Makefile.in
@@ -141,6 +141,12 @@ endif
endif
endif
+ifeq ($(OS_ARCH),OS2)
+MAPFILE = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).def
+GARBAGE += $(MAPFILE)
+MKSHLIB += $(MAPFILE)
+endif
+
ifeq ($(OS_ARCH),OSF1)
ifeq ($(USE_PTHREADS), 1)
OS_LIBS = -lpthread -lrt
diff --git a/pr/src/linking/prlink.c b/pr/src/linking/prlink.c
index c70f1065..d42ad219 100644
--- a/pr/src/linking/prlink.c
+++ b/pr/src/linking/prlink.c
@@ -580,9 +580,11 @@ pr_UnlockedFindLibrary(const char *name)
while (lm) {
const char* cp = strrchr(lm->name, PR_DIRECTORY_SEPARATOR);
cp = cp ? cp + 1 : lm->name;
-#ifdef XP_PC
+#ifdef WIN32
/* Windows DLL names are case insensitive... */
if (strcmpi(np, cp) == 0)
+#elif defined(XP_OS2)
+ if (stricmp(np, cp) == 0)
#else
if (strcmp(np, cp) == 0)
#endif
diff --git a/pr/src/md/os2/Makefile.in b/pr/src/md/os2/Makefile.in
index 9898c88f..7db0b44b 100644
--- a/pr/src/md/os2/Makefile.in
+++ b/pr/src/md/os2/Makefile.in
@@ -62,6 +62,10 @@ ifeq ($(MOZ_OS2_TOOLS),VACPP)
ASFILES = os2vacpp.asm
endif
+ifeq ($(MOZ_OS2_TOOLS),EMX)
+ASFILES = os2emx.s
+endif
+
TARGETS = $(OBJS)
INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
diff --git a/pr/src/md/os2/objs.mk b/pr/src/md/os2/objs.mk
index 7c0bb943..3339a538 100644
--- a/pr/src/md/os2/objs.mk
+++ b/pr/src/md/os2/objs.mk
@@ -52,6 +52,10 @@ ifeq ($(MOZ_OS2_TOOLS),VACPP)
ASFILES = os2vacpp.asm
endif
+ifeq ($(MOZ_OS2_TOOLS),EMX)
+ASFILES = os2emx.s
+endif
+
OBJS += $(addprefix md/os2/$(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX))) \
- $(addprefix md/os2/$(OBJDIR)/,$(ASFILES:.asm=.$(OBJ_SUFFIX)))
+ $(addprefix md/os2/$(OBJDIR)/,$(ASFILES:.$(ASM_SUFFIX)=.$(OBJ_SUFFIX)))
diff --git a/pr/src/md/os2/os2cv.c b/pr/src/md/os2/os2cv.c
index 76c96330..44e1e68b 100644
--- a/pr/src/md/os2/os2cv.c
+++ b/pr/src/md/os2/os2cv.c
@@ -51,6 +51,10 @@
#ifdef USE_RAMSEM
ULONG _Far16 _Pascal Dos16GetInfoSeg(PSEL pselGlobal, PSEL pselLocal);
+#ifdef XP_OS2_EMX
+typedef unsigned short BOOL16;
+#endif
+
typedef struct _LINFOSEG
{
USHORT pidCurrent;
diff --git a/pr/src/md/os2/os2misc.c b/pr/src/md/os2/os2misc.c
index 3b7717f6..d14972c6 100644
--- a/pr/src/md/os2/os2misc.c
+++ b/pr/src/md/os2/os2misc.c
@@ -518,43 +518,3 @@ unsigned long _System _DLL_InitTerm( unsigned long mod_handle, unsigned long fla
return rc;
}
-#ifndef XP_OS2_VACPP
-
-PRInt32 _PR_MD_ATOMIC_SET(PRInt32 *intp, PRInt32 val)
-{
- PRInt32 result;
- asm volatile ("lock ; xchg %0, %1"
- : "=r"(result), "=m"(intp)
- : "0"(val), "m"(intp));
- return result;
-}
-
-PRInt32 _PR_MD_ATOMIC_ADD(PRInt32 *intp, PRInt32 val)
-{
- PRInt32 result;
- asm volatile ("lock ; xadd %0, %1"
- : "=r"(result), "=m"(intp)
- : "0"(val), "m"(intp));
- return result + val;
-}
-
-PRInt32 _PR_MD_ATOMIC_INCREMENT(PRInt32 *val)
-{
- PRInt32 result;
- asm volatile ("lock ; xadd %0, %1"
- : "=r"(result), "=m"(*val)
- : "0"(1), "m"(*val));
- return result + 1;
-}
-
-PRInt32 _PR_MD_ATOMIC_DECREMENT(PRInt32 *val)
-{
- PRInt32 result;
- asm volatile ("lock ; xadd %0, %1"
- : "=r"(result), "=m"(*val)
- : "0"(1), "m"(*val));
- return result - 1;
-}
-
-#endif
-
diff --git a/pr/src/md/os2/os2poll.c b/pr/src/md/os2/os2poll.c
index 0b9c0de6..3b087e11 100644
--- a/pr/src/md/os2/os2poll.c
+++ b/pr/src/md/os2/os2poll.c
@@ -265,7 +265,7 @@ retry:
ready = _MD_SELECT(socks, rd, wt, ex, msecs);
#endif
- if (ready == -1 && errno == SOCEINTR)
+ if (ready == -1 && errno == EINTR)
{
if (timeout == PR_INTERVAL_NO_TIMEOUT)
goto retry;
@@ -357,8 +357,8 @@ retry:
if (getsockopt(bottom->secret->md.osfd, SOL_SOCKET,
SO_TYPE, (char *) &optval, &optlen) == -1)
{
- PR_ASSERT(sock_errno() == SOCENOTSOCK);
- if (sock_errno() == SOCENOTSOCK)
+ PR_ASSERT(sock_errno() == ENOTSOCK);
+ if (sock_errno() == ENOTSOCK)
{
pd->out_flags = PR_POLL_NVAL;
ready++;
diff --git a/pr/src/md/os2/os2sock.c b/pr/src/md/os2/os2sock.c
index ecdb31ff..b9c812ba 100644
--- a/pr/src/md/os2/os2sock.c
+++ b/pr/src/md/os2/os2sock.c
@@ -151,7 +151,7 @@ socket_io_wait( PRInt32 osfd, PRInt32 fd_type, PRIntervalTime timeout )
else
rv = _MD_SELECT(socks, 0, 1, 0, lTimeout);
#endif
- if (rv == -1 && (syserror = sock_errno()) != SOCEINTR) {
+ if (rv == -1 && (syserror = sock_errno()) != EINTR) {
_PR_MD_MAP_SELECT_ERROR(syserror);
break;
}
@@ -209,7 +209,7 @@ socket_io_wait( PRInt32 osfd, PRInt32 fd_type, PRIntervalTime timeout )
/*
* we don't consider EINTR a real error
*/
- if (rv == -1 && (syserror = sock_errno()) != SOCEINTR) {
+ if (rv == -1 && (syserror = sock_errno()) != EINTR) {
_PR_MD_MAP_SELECT_ERROR(syserror);
break;
}
@@ -223,7 +223,7 @@ socket_io_wait( PRInt32 osfd, PRInt32 fd_type, PRIntervalTime timeout )
* We loop again if _MD_SELECT timed out or got interrupted
* by a signal, and the timeout deadline has not passed yet.
*/
- if (rv == 0 || (rv == -1 && syserror == SOCEINTR)) {
+ if (rv == 0 || (rv == -1 && syserror == EINTR)) {
/*
* If _MD_SELECT timed out, we know how much time
* we spent in blocking, so we can avoid a
@@ -252,7 +252,7 @@ socket_io_wait( PRInt32 osfd, PRInt32 fd_type, PRIntervalTime timeout )
remaining = timeout - elapsed;
}
}
- } while (rv == 0 || (rv == -1 && syserror == SOCEINTR));
+ } while (rv == 0 || (rv == -1 && syserror == EINTR));
break;
}
return(rv);
@@ -269,14 +269,14 @@ _MD_Accept(PRFileDesc *fd, PRNetAddr *addr,
while ((rv = accept(osfd, (struct sockaddr*) addr, (int*)addrlen)) == -1)
{
err = sock_errno();
- if ((err == SOCEWOULDBLOCK) || (err == SOCECONNABORTED))
+ if ((err == EWOULDBLOCK) || (err == ECONNABORTED))
{
if (fd->secret->nonblocking) {
break;
}
if ((rv = socket_io_wait(osfd, READ_FD, timeout)) < 0)
goto done;
- } else if ((err == SOCEINTR) && (!_PR_PENDING_INTERRUPT(me))){
+ } else if ((err == EINTR) && (!_PR_PENDING_INTERRUPT(me))){
continue;
} else {
break;
@@ -314,7 +314,7 @@ retry:
{
err = sock_errno();
- if (err == SOCEINTR) {
+ if (err == EINTR) {
if (_PR_PENDING_INTERRUPT(me)) {
me->flags &= ~_PR_INTERRUPT;
PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);
@@ -323,7 +323,7 @@ retry:
goto retry;
}
- if (!fd->secret->nonblocking && (err == SOCEINPROGRESS))
+ if (!fd->secret->nonblocking && (err == EINPROGRESS))
{
/*
* socket_io_wait() may return -1 or 1.
@@ -391,13 +391,13 @@ _PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags,
while ((rv = recv(osfd,buf,amount,flags)) == -1)
{
err = sock_errno();
- if ((err == SOCEWOULDBLOCK)) {
+ if ((err == EWOULDBLOCK)) {
if (fd->secret->nonblocking) {
break;
}
if ((rv = socket_io_wait(osfd, READ_FD, timeout)) < 0)
goto done;
- } else if ((err == SOCEINTR) && (!_PR_PENDING_INTERRUPT(me))){
+ } else if ((err == EINTR) && (!_PR_PENDING_INTERRUPT(me))){
continue;
} else {
break;
@@ -421,13 +421,13 @@ _PR_MD_SEND(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags,
while ((rv = send(osfd,buf,amount,flags)) == -1)
{
err = sock_errno();
- if ((err == SOCEWOULDBLOCK)) {
+ if ((err == EWOULDBLOCK)) {
if (fd->secret->nonblocking) {
break;
}
if ((rv = socket_io_wait(osfd, WRITE_FD, timeout)) < 0)
goto done;
- } else if ((err == SOCEINTR) && (!_PR_PENDING_INTERRUPT(me))){
+ } else if ((err == EINTR) && (!_PR_PENDING_INTERRUPT(me))){
continue;
} else {
break;
@@ -465,7 +465,7 @@ _PR_MD_SENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags,
(struct sockaddr *) addr, addrlen)) == -1)
{
err = sock_errno();
- if ((err == SOCEWOULDBLOCK))
+ if ((err == EWOULDBLOCK))
{
if (fd->secret->nonblocking) {
break;
@@ -498,13 +498,13 @@ _PR_MD_RECVFROM(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags,
(struct sockaddr *) addr, (int *)addrlen)) == -1))
{
err = sock_errno();
- if ((err == SOCEWOULDBLOCK)) {
+ if ((err == EWOULDBLOCK)) {
if (fd->secret->nonblocking) {
break;
}
if ((rv = socket_io_wait(osfd, READ_FD, timeout)) < 0)
goto done;
- } else if ((err == SOCEINTR) && (!_PR_PENDING_INTERRUPT(me))){
+ } else if ((err == EINTR) && (!_PR_PENDING_INTERRUPT(me))){
continue;
} else {
break;
@@ -541,7 +541,7 @@ _PR_MD_WRITEV(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size,
while ((rv = writev(osfd, (const struct iovec*)iov, iov_size)) == -1) {
err = sock_errno();
- if ((err == SOCEWOULDBLOCK)) {
+ if ((err == EWOULDBLOCK)) {
if (fd->secret->nonblocking) {
break;
}
diff --git a/pr/src/md/os2/os2thred.c b/pr/src/md/os2/os2thred.c
index 7c06126f..735856bd 100644
--- a/pr/src/md/os2/os2thred.c
+++ b/pr/src/md/os2/os2thred.c
@@ -93,14 +93,6 @@ PRStatus
_PR_MD_INIT_THREAD(PRThread *thread)
{
APIRET rv;
-#ifdef XP_OS2_EMX
- /* disable SIGPIPE */
- struct sigaction sa;
- sa.sa_handler = SIG_IGN;
- sa.sa_flags = 0;
- sigemptyset( &sa.sa_mask);
- sigaction( SIGPIPE, &sa, NULL);
-#endif
if (thread->flags & (_PR_PRIMORDIAL | _PR_ATTACHED)) {
_pr_SetThreadMDHandle(thread);
diff --git a/pr/src/nspr.def b/pr/src/nspr.def
index ba798d6a..676bd21d 100644
--- a/pr/src/nspr.def
+++ b/pr/src/nspr.def
@@ -1,6 +1,52 @@
-# nm -n -C -p libnspr4.so | awk '/[^ ]* T PR_/ {print $3}'
-NSPR_4.0 {
- global:
+;+#
+;+# The contents of this file are subject to the Mozilla Public
+;+# License Version 1.1 (the "License"); you may not use this file
+;+# except in compliance with the License. You may obtain a copy of
+;+# the License at http://www.mozilla.org/MPL/
+;+#
+;+# Software distributed under the License is distributed on an "AS
+;+# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+;+# implied. See the License for the specific language governing
+;+# rights and limitations under the License.
+;+#
+;+# The Original Code is the Netscape Portable Runtime (NSPR).
+;+#
+;+# The Initial Developer of the Original Code is Netscape
+;+# Communications Corporation. Portions created by Netscape are
+;+# Copyright (C) 2002-2003 Netscape Communications Corporation. All
+;+# Rights Reserved.
+;+#
+;+# Contributor(s):
+;+#
+;+# Alternatively, the contents of this file may be used under the
+;+# terms of the GNU General Public License Version 2 or later (the
+;+# "GPL"), in which case the provisions of the GPL are applicable
+;+# instead of those above. If you wish to allow use of your
+;+# version of this file only under the terms of the GPL and not to
+;+# allow others to use your version of this file under the MPL,
+;+# indicate your decision by deleting the provisions above and
+;+# replace them with the notice and other provisions required by
+;+# the GPL. If you do not delete the provisions above, a recipient
+;+# may use your version of this file under either the MPL or the
+;+# GPL.
+;+#
+;+# OK, this file is meant to support SUN, LINUX, AIX, OS/2 and WINDOWS
+;+# 1. For all unix platforms, the string ";-" means "remove this line"
+;+# 2. For all unix platforms, the string " DATA " will be removed from any
+;+# line on which it occurs.
+;+# 3. Lines containing ";+" will have ";+" removed on SUN and LINUX.
+;+# On AIX, lines containing ";+" will be removed.
+;+# 4. For all unix platforms, the string ";;" will thave the ";;" removed.
+;+# 5. For all unix platforms, after the above processing has taken place,
+;+# all characters after the first ";" on the line will be removed.
+;+# And for AIX, the first ";" will also be removed.
+;+# This file is passed directly to windows. Since ';' is a comment, all UNIX
+;+# directives are hidden behind ";", ";+", and ";-"
+;+#
+;+NSPR_4.0 {
+;+ global:
+LIBRARY nspr4 ;-
+EXPORTS ;-
LL_MaxInt;
LL_MinInt;
LL_Zero;
@@ -365,19 +411,19 @@ NSPR_4.0 {
PRP_NewNakedCondVar;
PRP_TryLock;
libVersionPoint;
- local: *;
-};
-
-NSPRprivate {
- global:
+;+ local: *;
+;+};
+;+
+;+NSPRprivate {
+;+ global:
GetExecutionEnvironment;
PT_FPrintStats;
SetExecutionEnvironment;
- local: *;
-};
-
-NSPR_4.1 {
- global:
+;+ local: *;
+;+};
+;+
+;+NSPR_4.1 {
+;+ global:
PR_ConnectContinue;
PR_CreateIOLayer;
PR_EmulateAcceptRead;
@@ -388,16 +434,16 @@ NSPR_4.1 {
PR_GetNumberOfProcessors;
PR_ImportPipe;
PR_SetEnv;
-} NSPR_4.0;
-
-NSPR_4.3 {
- global:
+;+} NSPR_4.0;
+;+
+;+NSPR_4.3 {
+;+ global:
LL_MaxUint;
PR_CallOnceWithArg;
PR_GetLibraryFilePathname;
-} NSPR_4.1;
-
-NSPR_4.4 {
- global:
+;+} NSPR_4.1;
+;+
+;+NSPR_4.4 {
+;+ global:
PR_GetPathSeparator;
-} NSPR_4.3;
+;+} NSPR_4.3;
diff --git a/pr/tests/Makefile.in b/pr/tests/Makefile.in
index a1b7c686..17105b4e 100644
--- a/pr/tests/Makefile.in
+++ b/pr/tests/Makefile.in
@@ -233,9 +233,8 @@ ifeq ($(OS_ARCH),OS2)
ifeq ($(MOZ_OS2_TOOLS),VACPP)
LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO
else
-ifeq ($(MOZ_OS2_EMX_OBJECTFORMAT),OMF)
- LDOPTS = -Zlinker /PM:VIO
-endif
+ EXTRA_LIBS = $(OS_LIBS)
+ LDOPTS = -Zmtd -Zomf -Zlinker /PM:VIO -Zlinker /ST:0x30000
endif
endif
@@ -487,7 +486,7 @@ $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
link $(LDOPTS) $(EXTRA_LDOPTS) $< $(LIBPLC) $(LIBNSPR) $(EXTRA_LIBS) -out:$@
else
-ifeq ($(OS_ARCH),OS2)
+ifeq ($(MOZ_OS2_TOOLS),VACPP)
$(LD) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC) $(LIBNSPR) $(OS_LIBS) $(EXTRA_LIBS)
else
$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(EXTRA_LIBS) -o $@
diff --git a/pr/tests/attach.c b/pr/tests/attach.c
index f13d7f3f..a17b31f5 100644
--- a/pr/tests/attach.c
+++ b/pr/tests/attach.c
@@ -329,19 +329,25 @@ int main(int argc, char **argv)
#elif defined(OS2)
+# ifdef __EMX__
+ threadID = (TID) _beginthread((void *)threadStartFunc, NULL,
+ 32768, NULL);
+# else
threadID = (TID) _beginthread((void(* _Optlink)(void*))threadStartFunc, NULL,
32768, NULL);
+# endif
if (threadID == -1) {
fprintf(stderr, "thread creation failed: error code %d\n", errno);
- failed_already=1;
- goto exit_now;
+ failed_already=1;
+ goto exit_now;
}
rv = DosWaitThread(&threadID, DCWW_WAIT);
- if (debug_mode)PR_ASSERT(rv == NO_ERROR);
- else if (rv == NO_ERROR) {
- failed_already=1;
- goto exit_now;
- }
+ if (debug_mode) {
+ PR_ASSERT(rv == NO_ERROR);
+ } else if (rv != NO_ERROR) {
+ failed_already=1;
+ goto exit_now;
+ }
#elif defined(XP_BEOS)