Imported Upstream version 4.12 47/67747/1 submit/tizen_base/20160502.073429 upstream/4.12
authorsangsu <sangsu.choi@samsung.com>
Thu, 28 Apr 2016 07:09:43 +0000 (16:09 +0900)
committersangsu <sangsu.choi@samsung.com>
Thu, 28 Apr 2016 07:10:10 +0000 (16:10 +0900)
Change-Id: I9ef640fb4f553573573b47e6d1a07746a52f6b89
Signed-off-by: sangsu <sangsu.choi@samsung.com>
65 files changed:
.cvsignore [deleted file]
.hg_archival.txt [deleted file]
.hgignore [deleted file]
config/rules.mk
configure
configure.in
lib/ds/plarena.c
lib/ds/plarena.h
pr/include/md/_freebsd.cfg
pr/include/md/_freebsd.h
pr/include/md/_linux.cfg
pr/include/md/_linux.h
pr/include/md/_netbsd.h
pr/include/md/_openbsd.h
pr/include/md/_unixos.h
pr/include/pratom.h
pr/include/prenv.h
pr/include/prinit.h
pr/include/prlog.h
pr/include/prtime.h
pr/include/prtypes.h
pr/src/Makefile.in
pr/src/cplus/rcnetdb.cpp
pr/src/io/prfdcach.c
pr/src/io/priometh.c
pr/src/io/prlog.c
pr/src/io/prmwait.c
pr/src/io/prprf.c
pr/src/io/prscanf.c
pr/src/linking/prlink.c
pr/src/md/os2/os2thred.c
pr/src/md/unix/unix.c
pr/src/md/windows/ntinrval.c
pr/src/md/windows/w95io.c
pr/src/md/windows/w95thred.c
pr/src/misc/prenv.c
pr/src/misc/prinit.c
pr/src/misc/prnetdb.c
pr/src/misc/prolock.c
pr/src/misc/prsystem.c
pr/src/misc/prtime.c
pr/src/misc/prtpool.c
pr/src/misc/prtrace.c
pr/src/nspr.def
pr/src/pthreads/ptio.c
pr/src/pthreads/ptsynch.c
pr/src/pthreads/ptthread.c
pr/src/threads/combined/prucpu.c
pr/src/threads/combined/pruthr.c
pr/src/threads/prdump.c
pr/tests/Makefile.in
pr/tests/README.TXT
pr/tests/env.c
pr/tests/io_timeout.c
pr/tests/multiwait.c
pr/tests/nblayer.c
pr/tests/prfz.c [new file with mode: 0644]
pr/tests/priotest.c
pr/tests/runtests.pl
pr/tests/runtests.sh
pr/tests/rwlockrank.c
pr/tests/server_test.c
pr/tests/socket.c
pr/tests/testfile.c
pr/tests/vercheck.c

diff --git a/.cvsignore b/.cvsignore
deleted file mode 100644 (file)
index 5a12c76..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-Makefile
-config-defs.h
-config.cache
-config.log
-config.status
diff --git a/.hg_archival.txt b/.hg_archival.txt
deleted file mode 100644 (file)
index 39eb26c..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-repo: a4b34919bf34db2ee22acbbc305693c8980b6dc6
-node: 0f03651116c5b34ba48b5a5cd31234303d9806b6
-branch: default
-tag: NSPR_4_10_7_RTM
diff --git a/.hgignore b/.hgignore
deleted file mode 100644 (file)
index 17751f8..0000000
--- a/.hgignore
+++ /dev/null
@@ -1,5 +0,0 @@
-syntax: glob
-*~
-*OPT.OBJ/*
-*DBG.OBJ/*
-*DBG.OBJD/*
index cc01759..1c8fdc9 100644 (file)
@@ -81,15 +81,20 @@ ifeq (,$(filter-out WINNT WINCE OS2,$(OS_ARCH)))
 # other platforms do not.
 #
 ifeq (,$(filter-out WIN95 WINCE WINMO OS2,$(OS_TARGET)))
-LIBRARY                = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
 SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
-IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
 SHARED_LIB_PDB = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).pdb
+ifdef MSC_VER
+LIBRARY         = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
+IMPORT_LIBRARY  = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
+else
+LIBRARY         = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
+IMPORT_LIBRARY  = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
+endif
 else
-LIBRARY                = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
 SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
-IMPORT_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
 SHARED_LIB_PDB = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).pdb
+LIBRARY         = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX)
+IMPORT_LIBRARY  = $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX)
 endif
 
 else
@@ -359,7 +364,7 @@ endif
 ifdef MOZ_PROFILE_GENERATE
 # Clean up profiling data during PROFILE_GENERATE phase
 export::
-ifeq ($(OS_ARCH)_$(NS_USE_GCC), WINNT_)
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
        $(foreach pgd,$(wildcard *.pgd),pgomgr -clear $(pgd);)
 else
 ifdef NS_USE_GCC
index 40d342c..0ff06ec 100755 (executable)
--- a/configure
+++ b/configure
@@ -2488,8 +2488,8 @@ test -n "$target_alias" &&
   program_prefix=${target_alias}-
 
 MOD_MAJOR_VERSION=4
-MOD_MINOR_VERSION=10
-MOD_PATCH_VERSION=7
+MOD_MINOR_VERSION=12
+MOD_PATCH_VERSION=0
 NSPR_MODNAME=nspr20
 _HAVE_PTHREADS=
 USE_PTHREADS=
@@ -2666,19 +2666,6 @@ fi
 
 if test -n "$gonkdir" ; then
 
-        if test -z "$HOST_CPPFLAGS" ; then
-        HOST_CPPFLAGS=" "
-    fi
-    if test -z "$HOST_CFLAGS" ; then
-        HOST_CFLAGS=" "
-    fi
-    if test -z "$HOST_CXXFLAGS" ; then
-        HOST_CXXFLAGS=" "
-    fi
-    if test -z "$HOST_LDFLAGS" ; then
-        HOST_LDFLAGS=" "
-    fi
-
     $as_echo "#define ANDROID 1" >>confdefs.h
 
 else
@@ -2763,19 +2750,6 @@ $as_echo "$android_platform" >&6; }
     CXXFLAGS="-mandroid -I$android_platform/usr/include -fpic -fno-short-enums -fno-exceptions $CXXFLAGS"
     LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform $LDFLAGS"
 
-        if test -z "$HOST_CPPFLAGS" ; then
-        HOST_CPPFLAGS=" "
-    fi
-    if test -z "$HOST_CFLAGS" ; then
-        HOST_CFLAGS=" "
-    fi
-    if test -z "$HOST_CXXFLAGS" ; then
-        HOST_CXXFLAGS=" "
-    fi
-    if test -z "$HOST_LDFLAGS" ; then
-        HOST_LDFLAGS=" "
-    fi
-
     $as_echo "#define ANDROID 1" >>confdefs.h
 
     ;;
@@ -3152,12 +3126,6 @@ if test "$target" != "$host"; then
         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
         ;;
-      *:arm*-apple-darwin*)
-                                _SAVE_CFLAGS=$CFLAGS
-        _SAVE_CXXFLAGS=$CXXFLAGS
-        CFLAGS="-isysroot $MACOS_SDK_DIR $CFLAGS"
-        CXXFLAGS="-isysroot $MACOS_SDK_DIR $CXXFLAGS"
-        ;;
     esac
 
     for ac_prog in $CC "${target_alias}-gcc" "${target}-gcc"
@@ -4621,12 +4589,6 @@ test -n "$HOST_CC" || HOST_CC=""""
     fi
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HOST_CC" >&5
 $as_echo "$HOST_CC" >&6; }
-    if test -z "$HOST_CFLAGS"; then
-        HOST_CFLAGS="$CFLAGS"
-    fi
-    if test -z "$HOST_LDFLAGS"; then
-        HOST_LDFLAGS="$LDFLAGS"
-    fi
 
     CC="$HOST_CC"
     CFLAGS="$HOST_CFLAGS"
@@ -6584,6 +6546,7 @@ fi
     fi
     ac_fn_c_check_header_mongrel "$LINENO" "crt_externs.h" "ac_cv_header_crt_externs_h" "$ac_includes_default"
 if test "x$ac_cv_header_crt_externs_h" = xyes; then :
+  $as_echo "#define HAVE_CRT_EXTERNS_H 1" >>confdefs.h
 
 fi
 
@@ -7085,10 +7048,6 @@ tools are selected during the Xcode/Developer Tools installation." "$LINENO" 5
             PR_MD_ASFILES=os_Linux_ppc.s
         fi
         ;;
-    m68k)
-        CFLAGS="$CFLAGS -m68020-60"
-        CXXFLAGS="$CXXFLAGS -m68020-60"
-        ;;
     esac
     ;;
 
@@ -7124,7 +7083,11 @@ tools are selected during the Xcode/Developer Tools installation." "$LINENO" 5
 
         _MSVC_VER_FILTER='s|.* \([0-9]\+\.[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?\).*|\1|p'
 
-        CC_VERSION=`"${CC}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
+        CC_VERSION=`${CC} -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
+        if test -z "$CC_VERSION"; then
+            as_fn_error $? "Could not determine MSC version." "$LINENO" 5
+        fi
+
         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $1 }'`
         _CC_MINOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $2 }'`
         _CC_RELEASE=`echo ${CC_VERSION} | awk -F\. '{ print $3 }'`
@@ -7316,6 +7279,8 @@ $as_echo "$as_me: WARNING: Unknown version of the Microsoft (R) Manifest Tool."
 
     $as_echo "#define HAVE_BSD_FLOCK 1" >>confdefs.h
 
+    $as_echo "#define HAVE_SOCKLEN_T 1" >>confdefs.h
+
     if test -z "$USE_NSPR_THREADS"; then
         USE_PTHREADS=1
     fi
@@ -7382,7 +7347,7 @@ $as_echo "$as_me: WARNING: Unknown version of the Microsoft (R) Manifest Tool."
     if test -z "$USE_NSPR_THREADS"; then
         USE_PTHREADS=1
     fi
-    DSO_LDOPTS='-shared -fPIC'
+    DSO_LDOPTS='-shared -fPIC -Wl,-soname,$(notdir $@)'
     MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
     ;;
 
@@ -7925,7 +7890,7 @@ fi
 
 _SAVE_LIBS="$LIBS"
 LIBS="$LIBS $OS_LIBS"
-for ac_func in dladdr gettid lchown setpriority strerror syscall
+for ac_func in dladdr gettid lchown setpriority strerror syscall  secure_getenv __secure_getenv
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
index fba01ae..2ab2383 100644 (file)
@@ -15,8 +15,8 @@ dnl ========================================================
 dnl = Defaults
 dnl ========================================================
 MOD_MAJOR_VERSION=4
-MOD_MINOR_VERSION=10
-MOD_PATCH_VERSION=7
+MOD_MINOR_VERSION=12
+MOD_PATCH_VERSION=0
 NSPR_MODNAME=nspr20
 _HAVE_PTHREADS=
 USE_PTHREADS=
@@ -160,20 +160,6 @@ AC_ARG_WITH(gonk,
 if test -n "$gonkdir" ; then
     dnl Most things are directly configured by env vars when building for gonk
 
-    dnl prevent cross compile section from using these flags as host flags
-    if test -z "$HOST_CPPFLAGS" ; then
-        HOST_CPPFLAGS=" "
-    fi
-    if test -z "$HOST_CFLAGS" ; then
-        HOST_CFLAGS=" "
-    fi
-    if test -z "$HOST_CXXFLAGS" ; then
-        HOST_CXXFLAGS=" "
-    fi
-    if test -z "$HOST_LDFLAGS" ; then
-        HOST_LDFLAGS=" "
-    fi
-
     AC_DEFINE(ANDROID)
 else
 case "$target" in
@@ -257,20 +243,6 @@ case "$target" in
     CXXFLAGS="-mandroid -I$android_platform/usr/include -fpic -fno-short-enums -fno-exceptions $CXXFLAGS"
     LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform $LDFLAGS"
 
-    dnl prevent cross compile section from using these flags as host flags
-    if test -z "$HOST_CPPFLAGS" ; then
-        HOST_CPPFLAGS=" "
-    fi
-    if test -z "$HOST_CFLAGS" ; then
-        HOST_CFLAGS=" "
-    fi
-    if test -z "$HOST_CXXFLAGS" ; then
-        HOST_CXXFLAGS=" "
-    fi
-    if test -z "$HOST_LDFLAGS" ; then
-        HOST_LDFLAGS=" "
-    fi
-
     AC_DEFINE(ANDROID)
     ;;
 esac
@@ -596,15 +568,6 @@ if test "$target" != "$host"; then
         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
         ;;
-      *:arm*-apple-darwin*)
-        dnl The arm compiler doesn't appear to know about its root by default,
-        dnl so explicitly pass it one here. Later on we'll put this in CFLAGS
-        dnl anyway.
-        _SAVE_CFLAGS=$CFLAGS
-        _SAVE_CXXFLAGS=$CXXFLAGS
-        CFLAGS="-isysroot $MACOS_SDK_DIR $CFLAGS"
-        CXXFLAGS="-isysroot $MACOS_SDK_DIR $CXXFLAGS"
-        ;;
     esac
 
     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", echo)
@@ -653,12 +616,6 @@ if test "$target" != "$host"; then
         AC_MSG_ERROR([no acceptable cc found in \$PATH])
     fi
     AC_MSG_RESULT([$HOST_CC])
-    if test -z "$HOST_CFLAGS"; then
-        HOST_CFLAGS="$CFLAGS"
-    fi
-    if test -z "$HOST_LDFLAGS"; then
-        HOST_LDFLAGS="$LDFLAGS"
-    fi
 
     CC="$HOST_CC"
     CFLAGS="$HOST_CFLAGS"
@@ -1412,7 +1369,7 @@ case "$target" in
     if test "`echo $CC | grep -c '\-arch '`" = "0"; then
         CC="$CC -arch $CPU_ARCH"
     fi
-    AC_CHECK_HEADER(crt_externs.h)
+    AC_CHECK_HEADER(crt_externs.h, AC_DEFINE(HAVE_CRT_EXTERNS_H))
     DSO_CFLAGS=-fPIC
     DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @executable_path/$@ -headerpad_max_install_names'
     _OPTIMIZE_FLAGS=-O2
@@ -1899,10 +1856,6 @@ tools are selected during the Xcode/Developer Tools installation.])
             PR_MD_ASFILES=os_Linux_ppc.s
         fi
         ;;
-    m68k)
-        CFLAGS="$CFLAGS -m68020-60"
-        CXXFLAGS="$CXXFLAGS -m68020-60"
-        ;;
     esac    
     ;;
 
@@ -1936,7 +1889,11 @@ tools are selected during the Xcode/Developer Tools installation.])
         changequote(,)
         _MSVC_VER_FILTER='s|.* \([0-9]\+\.[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?\).*|\1|p'
         changequote([,])
-        CC_VERSION=`"${CC}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
+        CC_VERSION=`${CC} -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
+        if test -z "$CC_VERSION"; then
+            AC_MSG_ERROR([Could not determine MSC version.])
+        fi
+
         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $1 }'`
         _CC_MINOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $2 }'`
         _CC_RELEASE=`echo ${CC_VERSION} | awk -F\. '{ print $3 }'`
@@ -2120,6 +2077,7 @@ tools are selected during the Xcode/Developer Tools installation.])
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(NETBSD)
     AC_DEFINE(HAVE_BSD_FLOCK)
+    AC_DEFINE(HAVE_SOCKLEN_T)
     if test -z "$USE_NSPR_THREADS"; then
         USE_PTHREADS=1
     fi
@@ -2178,7 +2136,7 @@ tools are selected during the Xcode/Developer Tools installation.])
     if test -z "$USE_NSPR_THREADS"; then
         USE_PTHREADS=1
     fi
-    DSO_LDOPTS='-shared -fPIC'
+    DSO_LDOPTS='-shared -fPIC -Wl,-soname,$(notdir $@)'
     MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
     ;;
 
@@ -2581,7 +2539,8 @@ dnl ========================================================
 AC_PROG_GCC_TRADITIONAL
 _SAVE_LIBS="$LIBS"
 LIBS="$LIBS $OS_LIBS"
-AC_CHECK_FUNCS(dladdr gettid lchown setpriority strerror syscall)
+AC_CHECK_FUNCS(dladdr gettid lchown setpriority strerror syscall dnl
+ secure_getenv __secure_getenv)
 LIBS="$_SAVE_LIBS"
 
 dnl ========================================================
index 95e1931..689496d 100644 (file)
@@ -93,6 +93,9 @@ PR_IMPLEMENT(void) PL_InitArenaPool(
         pool->mask = PR_BITMASK(PR_CeilingLog2(align));
 
     pool->first.next = NULL;
+    /* Set all three addresses in pool->first to the same dummy value.
+     * These addresses are only compared with each other, but never
+     * dereferenced. */
     pool->first.base = pool->first.avail = pool->first.limit =
         (PRUword)PL_ARENA_ALIGN(pool, &pool->first + 1);
     pool->current = &pool->first;
@@ -144,10 +147,14 @@ PR_IMPLEMENT(void *) PL_ArenaAllocate(PLArenaPool *pool, PRUint32 nb)
 {
     PLArena *a;   
     char *rp;     /* returned pointer */
+    PRUint32 nbOld;
 
     PR_ASSERT((nb & pool->mask) == 0);
     
+    nbOld = nb;
     nb = (PRUword)PL_ARENA_ALIGN(pool, nb); /* force alignment */
+    if (nb < nbOld)
+        return NULL;
 
     /* attempt to allocate from arenas at pool->current */
     {
@@ -208,6 +215,7 @@ PR_IMPLEMENT(void *) PL_ArenaAllocate(PLArenaPool *pool, PRUint32 nb)
             PL_MAKE_MEM_NOACCESS((void*)a->avail, a->limit - a->avail);
             rp = (char *)a->avail;
             a->avail += nb;
+            PR_ASSERT(a->avail <= a->limit);
             /* the newly allocated arena is linked after pool->current 
             *  and becomes pool->current */
             a->next = pool->current->next;
@@ -230,6 +238,8 @@ PR_IMPLEMENT(void *) PL_ArenaGrow(
 {
     void *newp;
 
+    if (PR_UINT32_MAX - size < incr)
+        return NULL;
     PL_ARENA_ALLOCATE(newp, pool, size + incr);
     if (newp)
         memcpy(newp, p, size);
index 8dcfb3e..2673a2a 100644 (file)
@@ -96,11 +96,11 @@ struct PLArenaPool {
 
 /* These definitions are usually provided through the
  * sanitizer/asan_interface.h header installed by ASan.
- * See https://code.google.com/p/address-sanitizer/wiki/ManualPoisoning
+ * See https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning
  */
 
-void __asan_poison_memory_region(void const volatile *addr, size_t size);
-void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
+PR_IMPORT(void) __asan_poison_memory_region(void const volatile *addr, size_t size);
+PR_IMPORT(void) __asan_unpoison_memory_region(void const volatile *addr, size_t size);
 
 #define PL_MAKE_MEM_NOACCESS(addr, size) \
     __asan_poison_memory_region((addr), (size))
@@ -137,34 +137,39 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
 #define PL_ARENA_ALLOCATE(p, pool, nb) \
     PR_BEGIN_MACRO \
         PLArena *_a = (pool)->current; \
-        PRUint32 _nb = PL_ARENA_ALIGN(pool, nb); \
+        PRUint32 _nb = PL_ARENA_ALIGN(pool, (PRUint32)nb); \
         PRUword _p = _a->avail; \
-        PRUword _q = _p + _nb; \
-        if (_q > _a->limit) { \
+        if (_nb < (PRUint32)nb) { \
+            _p = 0; \
+        } else if (_nb > (_a->limit - _a->avail)) { \
             _p = (PRUword)PL_ArenaAllocate(pool, _nb); \
         } else { \
-            _a->avail = _q; \
+            _a->avail += _nb; \
         } \
         p = (void *)_p; \
-        PL_MAKE_MEM_UNDEFINED(p, nb); \
-        PL_ArenaCountAllocation(pool, nb); \
+        if (p) { \
+            PL_MAKE_MEM_UNDEFINED(p, (PRUint32)nb); \
+            PL_ArenaCountAllocation(pool, (PRUint32)nb); \
+        } \
     PR_END_MACRO
 
 #define PL_ARENA_GROW(p, pool, size, incr) \
     PR_BEGIN_MACRO \
         PLArena *_a = (pool)->current; \
-        PRUint32 _incr = PL_ARENA_ALIGN(pool, incr); \
-        PRUword _p = _a->avail; \
-        PRUword _q = _p + _incr; \
-        if (_p == (PRUword)(p) + PL_ARENA_ALIGN(pool, size) && \
-            _q <= _a->limit) { \
-            PL_MAKE_MEM_UNDEFINED((unsigned char *)(p) + size, incr); \
-            _a->avail = _q; \
-            PL_ArenaCountInplaceGrowth(pool, size, incr); \
+        PRUint32 _incr = PL_ARENA_ALIGN(pool, (PRUint32)incr); \
+        if (_incr < (PRUint32)incr) { \
+            p = NULL; \
+        } else if (_a->avail == (PRUword)(p) + PL_ARENA_ALIGN(pool, size) && \
+            _incr <= (_a->limit - _a->avail)) { \
+            PL_MAKE_MEM_UNDEFINED((unsigned char *)(p) + size, (PRUint32)incr); \
+            _a->avail += _incr; \
+            PL_ArenaCountInplaceGrowth(pool, size, (PRUint32)incr); \
         } else { \
-            p = PL_ArenaGrow(pool, p, size, incr); \
+            p = PL_ArenaGrow(pool, p, size, (PRUint32)incr); \
+        } \
+        if (p) {\
+            PL_ArenaCountGrowth(pool, size, (PRUint32)incr); \
         } \
-        PL_ArenaCountGrowth(pool, size, incr); \
     PR_END_MACRO
 
 #define PL_ARENA_MARK(pool) ((void *) (pool)->current->avail)
index c120460..1d1039a 100644 (file)
 #define PR_ALIGN_OF_POINTER 8
 #define PR_ALIGN_OF_WORD    8
 
+#elif defined(__powerpc64__)
+
+#undef  IS_LITTLE_ENDIAN
+#define IS_BIG_ENDIAN    1
+#define IS_64
+
+#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   8
+#define PR_BYTES_PER_FLOAT  4
+#define PR_BYTES_PER_DOUBLE 8
+#define PR_BYTES_PER_WORD   8
+#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    64
+#define PR_BITS_PER_FLOAT   32
+#define PR_BITS_PER_DOUBLE  64
+#define PR_BITS_PER_WORD    64
+
+#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   6
+#define PR_BITS_PER_FLOAT_LOG2  5
+#define PR_BITS_PER_DOUBLE_LOG2 6
+#define PR_BITS_PER_WORD_LOG2   6
+
+#define PR_ALIGN_OF_SHORT   2
+#define PR_ALIGN_OF_INT     4
+#define PR_ALIGN_OF_LONG    8
+#define PR_ALIGN_OF_INT64   8
+#define PR_ALIGN_OF_FLOAT   4
+#define PR_ALIGN_OF_DOUBLE  8
+#define PR_ALIGN_OF_POINTER 8
+#define PR_ALIGN_OF_WORD    8
+
+#define PR_BYTES_PER_WORD_LOG2   3
+#define PR_BYTES_PER_DWORD_LOG2  3
+
+#elif defined(__powerpc__)
+
+#undef  IS_LITTLE_ENDIAN
+#define IS_BIG_ENDIAN    1
+
+#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   2
+#define PR_ALIGN_OF_INT     4
+#define PR_ALIGN_OF_LONG    4
+#define PR_ALIGN_OF_INT64   8
+#define PR_ALIGN_OF_FLOAT   4
+#define PR_ALIGN_OF_DOUBLE  8
+#define PR_ALIGN_OF_POINTER 4
+#define PR_ALIGN_OF_WORD    4
+
+#define PR_BYTES_PER_WORD_LOG2   2
+#define PR_BYTES_PER_DWORD_LOG2  3
+
+#elif defined(__aarch64__)
+
+#undef  IS_BIG_ENDIAN
+#define IS_LITTLE_ENDIAN 1
+#define IS_64
+
+#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   8
+#define PR_BYTES_PER_FLOAT  4
+#define PR_BYTES_PER_DOUBLE 8
+#define PR_BYTES_PER_WORD   8
+#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    64
+#define PR_BITS_PER_FLOAT   32
+#define PR_BITS_PER_DOUBLE  64
+#define PR_BITS_PER_WORD    64
+
+#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   6
+#define PR_BITS_PER_FLOAT_LOG2  5
+#define PR_BITS_PER_DOUBLE_LOG2 6
+#define PR_BITS_PER_WORD_LOG2   6
+
+#define PR_ALIGN_OF_SHORT   2
+#define PR_ALIGN_OF_INT     4
+#define PR_ALIGN_OF_LONG    8
+#define PR_ALIGN_OF_INT64   8
+#define PR_ALIGN_OF_FLOAT   4
+#define PR_ALIGN_OF_DOUBLE  8
+#define PR_ALIGN_OF_POINTER 8
+#define PR_ALIGN_OF_WORD    8
+
+#define PR_BYTES_PER_WORD_LOG2  3
+#define PR_BYTES_PER_DWORD_LOG2 3
+
+#elif defined(__arm__)
+
+#if defined(__ARMEB__) || defined(__ARM_BIG_ENDIAN__)
+#undef  IS_LITTLE_ENDIAN
+#define IS_BIG_ENDIAN    1
+#else
+#undef  IS_BIG_ENDIAN
+#define IS_LITTLE_ENDIAN 1
+#endif
+
+#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   2
+#define PR_ALIGN_OF_INT     4
+#define PR_ALIGN_OF_LONG    4
+#define PR_ALIGN_OF_INT64   8
+#define PR_ALIGN_OF_FLOAT   4
+#define PR_ALIGN_OF_DOUBLE  8
+#define PR_ALIGN_OF_POINTER 4
+#define PR_ALIGN_OF_WORD    4
+
+#define PR_BYTES_PER_WORD_LOG2   2
+#define PR_BYTES_PER_DWORD_LOG2  3
+
+#elif defined(__mips64__)
+
+#if defined(__MIPSEB__) || defined(_MIPSEB)
+#undef  IS_LITTLE_ENDIAN
+#define IS_BIG_ENDIAN    1
+#else
+#undef  IS_BIG_ENDIAN
+#define IS_LITTLE_ENDIAN 1
+#endif
+
+#define IS_64
+
+#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   8
+#define PR_BYTES_PER_FLOAT  4
+#define PR_BYTES_PER_DOUBLE 8
+#define PR_BYTES_PER_WORD   8
+#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    64
+#define PR_BITS_PER_FLOAT   32
+#define PR_BITS_PER_DOUBLE  64
+#define PR_BITS_PER_WORD    64
+
+#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   6
+#define PR_BITS_PER_FLOAT_LOG2  5
+#define PR_BITS_PER_DOUBLE_LOG2 6
+#define PR_BITS_PER_WORD_LOG2   6
+
+#define PR_ALIGN_OF_SHORT   2
+#define PR_ALIGN_OF_INT     4
+#define PR_ALIGN_OF_LONG    8
+#define PR_ALIGN_OF_INT64   8
+#define PR_ALIGN_OF_FLOAT   4
+#define PR_ALIGN_OF_DOUBLE  8
+#define PR_ALIGN_OF_POINTER 8
+#define PR_ALIGN_OF_WORD    8
+
+#define PR_BYTES_PER_WORD_LOG2   3
+#define PR_BYTES_PER_DWORD_LOG2  3
+
+#elif defined(__mips__)
+
+#if defined(__MIPSEB__) || defined(_MIPSEB)
+#undef  IS_LITTLE_ENDIAN
+#define IS_BIG_ENDIAN    1
+#else
+#undef  IS_BIG_ENDIAN
+#define IS_LITTLE_ENDIAN 1
+#endif
+
+#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   2
+#define PR_ALIGN_OF_INT     4
+#define PR_ALIGN_OF_LONG    4
+#define PR_ALIGN_OF_INT64   8
+#define PR_ALIGN_OF_FLOAT   4
+#define PR_ALIGN_OF_DOUBLE  8
+#define PR_ALIGN_OF_POINTER 4
+#define PR_ALIGN_OF_WORD    4
+
+#define PR_BYTES_PER_WORD_LOG2   2
+#define PR_BYTES_PER_DWORD_LOG2  3
+
 #else
 
 #error "Unknown CPU architecture"
index 1ea7b60..9a179bc 100644 (file)
 #define _PR_SI_ARCHITECTURE "ia64"
 #elif defined(__amd64__)
 #define _PR_SI_ARCHITECTURE "amd64"
+#elif defined(__powerpc64__)
+#define _PR_SI_ARCHITECTURE "powerpc64"
+#elif defined(__powerpc__)
+#define _PR_SI_ARCHITECTURE "powerpc"
+#elif defined(__aarch64__)
+#define _PR_SI_ARCHITECTURE "aarch64"
+#elif defined(__arm__)
+#define _PR_SI_ARCHITECTURE "arm"
+#elif defined(__mips64__)
+#define _PR_SI_ARCHITECTURE "mips64"
+#elif defined(__mips__)
+#define _PR_SI_ARCHITECTURE "mips"
 #else
 #error "Unknown CPU architecture"
 #endif
@@ -218,7 +230,7 @@ extern void _MD_EarlyInit(void);
 
 #define _MD_EARLY_INIT                  _MD_EarlyInit
 #define _MD_FINAL_INIT                 _PR_UnixInit
-#define _MD_INTERVAL_USE_GTOD
+#define _PR_HAVE_CLOCK_MONOTONIC
 
 /*
  * We wrapped the select() call.  _MD_SELECT refers to the built-in,
index 1d09b31..8cbf0cb 100644 (file)
 #error "Unknown MIPS endianness."
 #endif
 
+#if _MIPS_SIM == _ABI64
+
+#define IS_64
+
+#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   8
+#define PR_BYTES_PER_FLOAT  4
+#define PR_BYTES_PER_DOUBLE 8
+#define PR_BYTES_PER_WORD   8
+#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    64
+#define PR_BITS_PER_FLOAT   32
+#define PR_BITS_PER_DOUBLE  64
+#define PR_BITS_PER_WORD    64
+
+#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   6
+#define PR_BITS_PER_FLOAT_LOG2  5
+#define PR_BITS_PER_DOUBLE_LOG2 6
+#define PR_BITS_PER_WORD_LOG2   6
+
+#define PR_ALIGN_OF_SHORT   2
+#define PR_ALIGN_OF_INT     4
+#define PR_ALIGN_OF_LONG    8
+#define PR_ALIGN_OF_INT64   8
+#define PR_ALIGN_OF_FLOAT   4
+#define PR_ALIGN_OF_DOUBLE  8
+#define PR_ALIGN_OF_POINTER 8
+#define PR_ALIGN_OF_WORD    8
+
+#define PR_BYTES_PER_WORD_LOG2   3
+#define PR_BYTES_PER_DWORD_LOG2  3
+
+#else /* _ABI64 */
+
 #define PR_BYTES_PER_BYTE   1
 #define PR_BYTES_PER_SHORT  2
 #define PR_BYTES_PER_INT    4
 #define PR_BYTES_PER_WORD_LOG2   2
 #define PR_BYTES_PER_DWORD_LOG2  3
 
+#endif /* _ABI64 */
+
 #elif defined(__arm__)
 
 #ifdef __ARMEB__
 #define PR_BYTES_PER_WORD_LOG2   2
 #define PR_BYTES_PER_DWORD_LOG2  3
 
+#elif defined(__or1k__)
+
+#undef  IS_LITTLE_ENDIAN
+#define IS_BIG_ENDIAN 1
+
+#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   2
+#define PR_ALIGN_OF_INT     4
+#define PR_ALIGN_OF_LONG    4
+#define PR_ALIGN_OF_INT64   4
+#define PR_ALIGN_OF_FLOAT   4
+#define PR_ALIGN_OF_DOUBLE  4
+#define PR_ALIGN_OF_POINTER 4
+#define PR_ALIGN_OF_WORD    4
+
+#define PR_BYTES_PER_WORD_LOG2   2
+#define PR_BYTES_PER_DWORD_LOG2  3
+
 #else
 
 #error "Unknown CPU architecture"
index 278f90c..b4b298b 100644 (file)
@@ -55,6 +55,8 @@
 #define _PR_SI_ARCHITECTURE "avr32"
 #elif defined(__m32r__)
 #define _PR_SI_ARCHITECTURE "m32r"
+#elif defined(__or1k__)
+#define _PR_SI_ARCHITECTURE "or1k"
 #else
 #error "Unknown CPU architecture"
 #endif
@@ -65,7 +67,7 @@
 #define _MD_DEFAULT_STACK_SIZE 65536L
 #define _MD_MMAP_FLAGS          MAP_PRIVATE
 
-#if defined(__aarch64__)
+#if defined(__aarch64__) || defined(__mips__)
 #define _MD_MINIMUM_STACK_SIZE  0x20000
 #endif
 
@@ -123,6 +125,18 @@ extern PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval);
 #define _MD_ATOMIC_SET                _PR_x86_64_AtomicSet
 #endif
 
+#if defined(__or1k__)
+#if defined(__GNUC__)
+/* Use GCC built-in functions */
+#define _PR_HAVE_ATOMIC_OPS
+#define _MD_INIT_ATOMIC()
+#define _MD_ATOMIC_INCREMENT(ptr) __sync_add_and_fetch(ptr, 1)
+#define _MD_ATOMIC_DECREMENT(ptr) __sync_sub_and_fetch(ptr, 1)
+#define _MD_ATOMIC_ADD(ptr, i) __sync_add_and_fetch(ptr, i)
+#define _MD_ATOMIC_SET(ptr, nv) __sync_lock_test_and_set(ptr, nv)
+#endif
+#endif
+
 #if defined(__powerpc__) && !defined(__powerpc64__)
 #define _PR_HAVE_ATOMIC_OPS
 #define _MD_INIT_ATOMIC()
@@ -148,6 +162,16 @@ extern PRInt32 _PR_ppc_AtomicSet(PRInt32 *val, PRInt32 newval);
 #endif
 #endif
 
+#if defined(__mips__) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
+/* Use GCC built-in functions */
+#define _PR_HAVE_ATOMIC_OPS
+#define _MD_INIT_ATOMIC()
+#define _MD_ATOMIC_INCREMENT(ptr) __sync_add_and_fetch(ptr, 1)
+#define _MD_ATOMIC_DECREMENT(ptr) __sync_sub_and_fetch(ptr, 1)
+#define _MD_ATOMIC_ADD(ptr, i) __sync_add_and_fetch(ptr, i)
+#define _MD_ATOMIC_SET(ptr, nv) __sync_lock_test_and_set(ptr, nv)
+#endif
+
 #if defined(__alpha)
 #define _PR_HAVE_ATOMIC_OPS
 #define _MD_INIT_ATOMIC()
@@ -647,7 +671,7 @@ extern void _MD_EarlyInit(void);
 
 #define _MD_EARLY_INIT                  _MD_EarlyInit
 #define _MD_FINAL_INIT                  _PR_UnixInit
-#define HAVE_CLOCK_MONOTONIC
+#define _PR_HAVE_CLOCK_MONOTONIC
 
 /*
  * We wrapped the select() call.  _MD_SELECT refers to the built-in,
index 8b8e8dd..945d94f 100644 (file)
@@ -211,7 +211,7 @@ extern void _MD_EarlyInit(void);
 
 #define _MD_EARLY_INIT                  _MD_EarlyInit
 #define _MD_FINAL_INIT                 _PR_UnixInit
-#define _MD_INTERVAL_USE_GTOD
+#define _PR_HAVE_CLOCK_MONOTONIC
 
 /*
  * We wrapped the select() call.  _MD_SELECT refers to the built-in,
index e014088..666c177 100644 (file)
@@ -192,7 +192,7 @@ struct _MDCPU {
 
 #define _MD_EARLY_INIT                  _MD_EarlyInit
 #define _MD_FINAL_INIT                 _PR_UnixInit
-#define _MD_INTERVAL_USE_GTOD
+#define _PR_HAVE_CLOCK_MONOTONIC
 
 /*
  * We wrapped the select() call.  _MD_SELECT refers to the built-in,
index 04d9904..ea46b3a 100644 (file)
@@ -302,7 +302,7 @@ extern PRIntervalTime   _PR_UNIX_TicksPerSecond(void);
 #define _MD_INTERVAL_PER_SEC           _PR_UNIX_TicksPerSecond
 #endif
 
-#ifdef HAVE_CLOCK_MONOTONIC
+#ifdef _PR_HAVE_CLOCK_MONOTONIC
 extern PRIntervalTime   _PR_UNIX_GetInterval2(void);
 extern PRIntervalTime   _PR_UNIX_TicksPerSecond2(void);
 #define _MD_INTERVAL_INIT()
index 9dbe0fa..dff9d6c 100644 (file)
@@ -107,7 +107,9 @@ NSPR_API(PRInt32)   PR_AtomicAdd(PRInt32 *ptr, PRInt32 val);
            defined(__powerpc__) || \
            (defined(__arm__) && \
            defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)) || \
-           defined(__aarch64__) || defined(__alpha))))
+           defined(__aarch64__) || defined(__alpha) || \
+           (defined(__mips__) && \
+           defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)))))
 
 /*
  * Because the GCC manual warns that some processors may support
index 524fc75..468c7d5 100644 (file)
@@ -91,6 +91,20 @@ PR_BEGIN_EXTERN_C
 NSPR_API(char*) PR_GetEnv(const char *var);
 
 /*
+** PR_GetEnvSecure() -- get a security-sensitive environment variable
+**
+** Description:
+**
+** PR_GetEnvSecure() is similar to PR_GetEnv(), but it returns NULL if
+** the program was run with elevated privilege (e.g., setuid or setgid
+** on Unix).  This can be used for cases like log file paths which
+** could otherwise be used for privilege escalation.  Note that some
+** platforms may have platform-specific privilege elevation mechanisms
+** not recognized by this function; see the implementation for details.
+*/
+NSPR_API(char*) PR_GetEnvSecure(const char *var);
+
+/*
 ** PR_SetEnv() -- set, unset or change an environment variable
 ** 
 ** Description:
@@ -113,6 +127,36 @@ NSPR_API(char*) PR_GetEnv(const char *var);
 */
 NSPR_API(PRStatus) PR_SetEnv(const char *string);
 
+/*
+** PR_DuplicateEnvironment() -- Obtain a copy of the environment.
+**
+** Description:
+** PR_DuplicateEnvironment() copies the environment so that it can be
+** modified without changing the current process's environment, and
+** then passed to interfaces such as POSIX execve().  In particular,
+** this avoids needing to allocate memory or take locks in the child
+** after a fork(); neither of these is allowed by POSIX after a
+** multithreaded process calls fork(), and PR_SetEnv does both.
+**
+** Inputs:
+**   none
+**
+** Returns:
+**   A pointer to a null-terminated array of null-terminated strings,
+**   like the traditional global variable "environ".  The array and
+**   the strings are allocated with PR_Malloc(), and it is the
+**   caller's responsibility to free them.
+**
+**   In case of memory allocation failure, or if the operating system
+**   doesn't support reading the entire environment through the global
+**   variable "environ" or similar, returns NULL instead.
+**
+** Restrictions:
+**   Similarly to PR_GetEnv(), this function may not interoperate as
+**   expected with the operating system's native environment accessors.
+*/
+NSPR_API(char **) PR_DuplicateEnvironment(void);
+
 PR_END_EXTERN_C
 
 #endif /* prenv_h___ */
index a2b1365..523c2b9 100644 (file)
@@ -31,10 +31,10 @@ PR_BEGIN_EXTERN_C
 ** The format of the version string is
 **     "<major version>.<minor version>[.<patch level>] [<Beta>]"
 */
-#define PR_VERSION  "4.10.7"
+#define PR_VERSION  "4.12"
 #define PR_VMAJOR   4
-#define PR_VMINOR   10
-#define PR_VPATCH   7
+#define PR_VMINOR   12
+#define PR_VPATCH   0
 #define PR_BETA     PR_FALSE
 
 /*
index 6f825f2..4a291dc 100644 (file)
@@ -157,7 +157,8 @@ NSPR_API(void) PR_LogPrint(const char *fmt, ...);
 */
 NSPR_API(void) PR_LogFlush(void);
 
-NSPR_API(void) PR_Assert(const char *s, const char *file, PRIntn ln);
+NSPR_API(void) PR_Assert(const char *s, const char *file, PRIntn ln)
+    PR_PRETEND_NORETURN;
 
 #if defined(DEBUG) || defined(FORCE_PR_LOG)
 #define PR_LOGGING 1
index 732990e..caaee14 100644 (file)
@@ -248,14 +248,14 @@ NSPR_API(PRStatus) PR_ParseTimeString (
 
 /* Format a time value into a buffer. Same semantics as strftime() */
 NSPR_API(PRUint32) PR_FormatTime(char *buf, int buflen, const char *fmt,
-                                           const PRExplodedTime *tm);
+                                 const PRExplodedTime *time);
 
-/* Format a time value into a buffer. Time is always in US English format, regardless
- * of locale setting.
+/* Format a time value into a buffer. Time is always in US English format,
+ * regardless of locale setting.
  */
 NSPR_API(PRUint32)
-PR_FormatTimeUSEnglish( char* buf, PRUint32 bufSize,
-                        const char* format, const PRExplodedTime* tm );
+PR_FormatTimeUSEnglish(char *buf, PRUint32 bufSize,
+                       const char *format, const PRExplodedTime *time);
 
 PR_END_EXTERN_C
 
index a5069bb..52b3ab0 100644 (file)
@@ -510,6 +510,31 @@ typedef long PRWord;
 typedef unsigned long PRUword;
 #endif
 
+/*
+ * PR_PRETEND_NORETURN, specified at the end of a function declaration,
+ * indicates that for the purposes of static analysis, this function does not
+ * return.  (The function definition does not need to be annotated.)
+ *
+ * void PR_Assert(const char *s, const char *file, PRIntn ln)
+ *     PR_PRETEND_NORETURN;
+ *
+ * Some static analyzers, like scan-build from clang, can use this information
+ * to eliminate false positives.  From the upstream documentation of
+ * scan-build:
+ *     This attribute is useful for annotating assertion handlers that actually
+ *     can return, but for the purpose of using the analyzer we want to pretend
+ *     that such functions do not return.
+ */
+#ifdef __clang_analyzer__
+#if __has_extension(attribute_analyzer_noreturn)
+#define PR_PRETEND_NORETURN __attribute__((analyzer_noreturn))
+#endif
+#endif
+
+#ifndef PR_PRETEND_NORETURN
+#define PR_PRETEND_NORETURN /* no support */
+#endif
+
 #if defined(NO_NSPR_10_SUPPORT)
 #else
 /********* ???????????????? FIX ME       ??????????????????????????? *****/
index e656ccc..48b6fae 100644 (file)
@@ -165,9 +165,9 @@ endif
 
 ifeq ($(OS_ARCH),WINNT)
 ifdef NS_USE_GCC
-OS_LIBS                = -ladvapi32 -lws2_32 -lwinmm
+OS_LIBS                = -ladvapi32 -lws2_32 -lmswsock -lwinmm
 else
-OS_LIBS                = advapi32.lib ws2_32.lib winmm.lib
+OS_LIBS                = advapi32.lib ws2_32.lib mswsock.lib winmm.lib
 endif
 endif
 
index f8bd0ac..042943b 100644 (file)
@@ -35,7 +35,7 @@ RCNetAddr::RCNetAddr(RCNetAddr::HostValue host, PRUint16 port): RCBase()
     {
         case RCNetAddr::any: how = PR_IpAddrAny; break;
         case RCNetAddr::loopback: how = PR_IpAddrLoopback; break;
-        default: PR_ASSERT(!"This can't happen -- and did!");
+        default: PR_NOT_REACHED("This can't happen -- and did!");
     }
     (void)PR_InitializeNetAddr(how, port, &address);
 }  /* RCNetAddr::RCNetAddr */
index 9ca84dc..17b71fe 100644 (file)
@@ -31,13 +31,11 @@ typedef struct _PR_Fd_Cache
 {
     PRLock *ml;
     PRIntn count;
-    PRStack *stack;
     PRFileDesc *head, *tail;
     PRIntn limit_low, limit_high;
 } _PR_Fd_Cache;
 
 static _PR_Fd_Cache _pr_fd_cache;
-static PRFileDesc **stack2fd = &(((PRFileDesc*)NULL)->higher);
 
 
 /*
@@ -59,11 +57,7 @@ PRFileDesc *_PR_Getfd(void)
     */
     if (0 == _pr_fd_cache.limit_high)
     {
-        PRStackElem *pop;
-        PR_ASSERT(NULL != _pr_fd_cache.stack);
-        pop = PR_StackPop(_pr_fd_cache.stack);
-        if (NULL == pop) goto allocate;
-        fd = (PRFileDesc*)((PRPtrdiff)pop - (PRPtrdiff)stack2fd);
+        goto allocate;
     }
     else
     {
@@ -128,18 +122,9 @@ void _PR_Putfd(PRFileDesc *fd)
     fd->identity = PR_INVALID_IO_LAYER;
     fd->secret->state = _PR_FILEDESC_FREED;
 
-    if (0 == _pr_fd_cache.limit_high)
-    {
-        PR_StackPush(_pr_fd_cache.stack, (PRStackElem*)(&fd->higher));
-    }
-    else
+    if (0 != _pr_fd_cache.limit_high)
     {
-        if (_pr_fd_cache.count > _pr_fd_cache.limit_high)
-        {
-            PR_Free(fd->secret);
-            PR_Free(fd);
-        }
-        else
+        if (_pr_fd_cache.count < _pr_fd_cache.limit_high)
         {
             PR_Lock(_pr_fd_cache.ml);
             if (NULL == _pr_fd_cache.tail)
@@ -157,8 +142,12 @@ void _PR_Putfd(PRFileDesc *fd)
             fd->higher = NULL;  /* always so */
             _pr_fd_cache.count += 1;  /* count the new entry */
             PR_Unlock(_pr_fd_cache.ml);
+            return;
         }
     }
+
+    PR_Free(fd->secret);
+    PR_Free(fd);
 }  /* _PR_Putfd */
 
 PR_IMPLEMENT(PRStatus) PR_SetFDCacheSize(PRIntn low, PRIntn high)
@@ -173,48 +162,8 @@ PR_IMPLEMENT(PRStatus) PR_SetFDCacheSize(PRIntn low, PRIntn high)
     if (low > high) low = high;  /* sanity check the params */
     
     PR_Lock(_pr_fd_cache.ml);
-    if (0 == high)  /* shutting down or staying down */
-    {
-        if (0 != _pr_fd_cache.limit_high)  /* shutting down */
-        {
-            _pr_fd_cache.limit_high = 0;  /* stop use */
-            /*
-            ** Hold the lock throughout - nobody's going to want it
-            ** other than another caller to this routine. Just don't
-            ** let that happen.
-            **
-            ** Put all the cached fds onto the new cache.
-            */
-            while (NULL != _pr_fd_cache.head)
-            {
-                PRFileDesc *fd = _pr_fd_cache.head;
-                _pr_fd_cache.head = fd->higher;
-                PR_StackPush(_pr_fd_cache.stack, (PRStackElem*)(&fd->higher));
-            }
-            _pr_fd_cache.limit_low = 0;
-            _pr_fd_cache.tail = NULL;
-            _pr_fd_cache.count = 0;
-        }
-    }
-    else  /* starting up or just adjusting parameters */
-    {
-        PRBool was_using_stack = (0 == _pr_fd_cache.limit_high);
-        _pr_fd_cache.limit_low = low;
-        _pr_fd_cache.limit_high = high;
-        if (was_using_stack)  /* was using stack - feed into cache */
-        {
-            PRStackElem *pop;
-            while (NULL != (pop = PR_StackPop(_pr_fd_cache.stack)))
-            {
-                PRFileDesc *fd = (PRFileDesc*)
-                    ((PRPtrdiff)pop - (PRPtrdiff)stack2fd);
-                if (NULL == _pr_fd_cache.tail) _pr_fd_cache.tail = fd;
-                fd->higher = _pr_fd_cache.head;
-                _pr_fd_cache.head = fd;
-                _pr_fd_cache.count += 1;
-            }
-        }
-    }
+    _pr_fd_cache.limit_high = high;
+    _pr_fd_cache.limit_low = low;
     PR_Unlock(_pr_fd_cache.ml);
     return PR_SUCCESS;
 }  /* PR_SetFDCacheSize */
@@ -258,15 +207,12 @@ void _PR_InitFdCache(void)
 
     _pr_fd_cache.ml = PR_NewLock();
     PR_ASSERT(NULL != _pr_fd_cache.ml);
-    _pr_fd_cache.stack = PR_CreateStack("FD");
-    PR_ASSERT(NULL != _pr_fd_cache.stack);
 
 }  /* _PR_InitFdCache */
 
 void _PR_CleanupFdCache(void)
 {
     PRFileDesc *fd, *next;
-    PRStackElem *pop;
 
     for (fd = _pr_fd_cache.head; fd != NULL; fd = next)
     {
@@ -279,14 +225,6 @@ void _PR_CleanupFdCache(void)
     _pr_fd_cache.count = 0;
     PR_DestroyLock(_pr_fd_cache.ml);
     _pr_fd_cache.ml = NULL;
-    while ((pop = PR_StackPop(_pr_fd_cache.stack)) != NULL)
-    {
-        fd = (PRFileDesc*)((PRPtrdiff)pop - (PRPtrdiff)stack2fd);
-        PR_DELETE(fd->secret);
-        PR_DELETE(fd);
-    }
-    PR_DestroyStack(_pr_fd_cache.stack);
-    _pr_fd_cache.stack = NULL;
 }  /* _PR_CleanupFdCache */
 
 /* prfdcach.c */
index f254328..4208767 100644 (file)
@@ -51,14 +51,14 @@ PRIOMethods _pr_faulty_methods = {
 
 PRIntn _PR_InvalidInt(void)
 {
-    PR_ASSERT(!"I/O method is invalid");
+    PR_NOT_REACHED("I/O method is invalid");
     PR_SetError(PR_INVALID_METHOD_ERROR, 0);
     return -1;
 }  /* _PR_InvalidInt */
 
 PRInt16 _PR_InvalidInt16(void)
 {
-    PR_ASSERT(!"I/O method is invalid");
+    PR_NOT_REACHED("I/O method is invalid");
     PR_SetError(PR_INVALID_METHOD_ERROR, 0);
     return -1;
 }  /* _PR_InvalidInt */
@@ -67,7 +67,7 @@ PRInt64 _PR_InvalidInt64(void)
 {
     PRInt64 rv;
     LL_I2L(rv, -1);
-    PR_ASSERT(!"I/O method is invalid");
+    PR_NOT_REACHED("I/O method is invalid");
     PR_SetError(PR_INVALID_METHOD_ERROR, 0);
     return rv;
 }  /* _PR_InvalidInt */
@@ -78,7 +78,7 @@ PRInt64 _PR_InvalidInt64(void)
 
 PRStatus _PR_InvalidStatus(void)
 {
-    PR_ASSERT(!"I/O method is invalid");
+    PR_NOT_REACHED("I/O method is invalid");
     PR_SetError(PR_INVALID_METHOD_ERROR, 0);
     return PR_FAILURE;
 }  /* _PR_InvalidDesc */
@@ -89,7 +89,7 @@ PRStatus _PR_InvalidStatus(void)
 
 PRFileDesc *_PR_InvalidDesc(void)
 {
-    PR_ASSERT(!"I/O method is invalid");
+    PR_NOT_REACHED("I/O method is invalid");
     PR_SetError(PR_INVALID_METHOD_ERROR, 0);
     return NULL;
 }  /* _PR_InvalidDesc */
index eec95e8..6098460 100644 (file)
@@ -238,13 +238,7 @@ void _PR_InitLog(void)
         }
         PR_SetLogBuffering(isSync ? 0 : bufSize);
 
-#ifdef XP_UNIX
-        if ((getuid() != geteuid()) || (getgid() != getegid())) {
-            return;
-        }
-#endif /* XP_UNIX */
-
-        ev = PR_GetEnv("NSPR_LOG_FILE");
+        ev = PR_GetEnvSecure("NSPR_LOG_FILE");
         if (ev && ev[0]) {
             if (!PR_SetLogFile(ev)) {
 #ifdef XP_PC
@@ -537,6 +531,9 @@ PR_IMPLEMENT(void) PR_LogFlush(void)
 PR_IMPLEMENT(void) PR_Abort(void)
 {
     PR_LogPrint("Aborting");
+#ifdef ANDROID
+    __android_log_write(ANDROID_LOG_ERROR, "PRLog", "Aborting");
+#endif
     abort();
 }
 
@@ -547,9 +544,11 @@ PR_IMPLEMENT(void) PR_Assert(const char *s, const char *file, PRIntn ln)
     fflush(stderr);
 #ifdef WIN32
     DebugBreak();
-#endif
-#ifdef XP_OS2
+#elif defined(XP_OS2)
     asm("int $3");
+#elif defined(ANDROID)
+    __android_log_assert(NULL, "PRLog", "Assertion failure: %s, at %s:%d\n",
+                         s, file, ln);
 #endif
     abort();
 }
index 78813c4..ab32fb5 100644 (file)
@@ -475,6 +475,7 @@ static PRStatus _MW_PollInternal(PRWaitGroup *group)
             PR_Lock(group->ml);
             if (_prmw_running != group->state)
             {
+                PR_DELETE(poll_list);
                 PR_SetError(PR_INVALID_STATE_ERROR, 0);
                 goto aborted;
             }
@@ -658,7 +659,7 @@ static void NT_TimeProc(void *arg)
         if (closesocket(bottom->secret->md.osfd) == SOCKET_ERROR)
         {
             fprintf(stderr, "closesocket failed: %d\n", WSAGetLastError());
-            PR_ASSERT(!"What shall I do?");
+            PR_NOT_REACHED("What shall I do?");
         }
     }
     return;
index a2eb417..798ea2a 100644 (file)
@@ -18,7 +18,7 @@
 #include "prlog.h"
 #include "prmem.h"
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) && _MSC_VER < 1900
 #define snprintf _snprintf
 #endif
 
@@ -37,7 +37,7 @@ struct SprintfStateStr {
 
     char *base;
     char *cur;
-    PRUint32 maxlen;
+    PRUint32 maxlen;  /* Must not exceed PR_INT32_MAX. */
 
     int (*func)(void *arg, const char *sp, PRUint32 len);
     void *arg;
@@ -66,7 +66,11 @@ struct NumArg {
 
 #define NAS_DEFAULT_NUM 20  /* default number of NumberedArgument array */
 
-
+/*
+** For numeric types, the signed versions must have even values,
+** and their corresponding unsigned versions must have the subsequent
+** odd value.
+*/
 #define TYPE_INT16     0
 #define TYPE_UINT16    1
 #define TYPE_INTN      2
@@ -376,8 +380,8 @@ static int cvt_s(SprintfState *ss, const char *str, int width, int prec,
 
 /*
 ** BuildArgArray stands for Numbered Argument list Sprintf
-** for example,  
-**     fmp = "%4$i, %2$d, %3s, %1d";
+** for example,
+**     fmt = "%4$i, %2$d, %3s, %1d";
 ** the number must start from 1, and no gap among them
 */
 
@@ -515,6 +519,15 @@ static struct NumArg* BuildArgArray( const char *fmt, va_list ap, int* rv, struc
                nas[cn].type = TYPE_INT64;
                c = *p++;
            }
+       } else if (c == 'z') {
+           if (sizeof(size_t) == sizeof(PRInt32)) {
+               nas[ cn ].type = TYPE_INT32;
+           } else if (sizeof(size_t) == sizeof(PRInt64)) {
+               nas[ cn ].type = TYPE_INT64;
+           } else {
+               nas[ cn ].type = TYPE_UNKNOWN;
+           }
+           c = *p++;
        }
 
        /* format */
@@ -684,7 +697,7 @@ static int dosprintf(SprintfState *ss, const char *fmt, va_list ap)
     char *hexp;
     int rv, i;
     struct NumArg* nas = NULL;
-    struct NumArg* nap;
+    struct NumArg* nap = NULL;
     struct NumArg  nasArray[ NAS_DEFAULT_NUM ];
     char  pattern[20];
     const char* dolPt = NULL;  /* in "%4$.2f", dolPt will point to . */
@@ -809,6 +822,13 @@ static int dosprintf(SprintfState *ss, const char *fmt, va_list ap)
                type = TYPE_INT64;
                c = *fmt++;
            }
+       } else if (c == 'z') {
+           if (sizeof(size_t) == sizeof(PRInt32)) {
+               type = TYPE_INT32;
+           } else if (sizeof(size_t) == sizeof(PRInt64)) {
+               type = TYPE_INT64;
+           }
+           c = *fmt++;
        }
 
        /* format */
@@ -1040,6 +1060,13 @@ static int FuncStuff(SprintfState *ss, const char *sp, PRUint32 len)
 {
     int rv;
 
+    /*
+    ** We will add len to ss->maxlen at the end of the function. First check
+    ** if ss->maxlen + len would overflow or be greater than PR_INT32_MAX.
+    */
+    if (PR_UINT32_MAX - ss->maxlen < len || ss->maxlen + len > PR_INT32_MAX) {
+       return -1;
+    }
     rv = (*ss->func)(ss->arg, sp, len);
     if (rv < 0) {
        return rv;
@@ -1085,9 +1112,21 @@ static int GrowStuff(SprintfState *ss, const char *sp, PRUint32 len)
     PRUint32 newlen;
 
     off = ss->cur - ss->base;
+    if (PR_UINT32_MAX - len < off) {
+       /* off + len would be too big. */
+       return -1;
+    }
     if (off + len >= ss->maxlen) {
        /* Grow the buffer */
-       newlen = ss->maxlen + ((len > 32) ? len : 32);
+       PRUint32 increment = (len > 32) ? len : 32;
+       if (PR_UINT32_MAX - ss->maxlen < increment) {
+           /* ss->maxlen + increment would overflow. */
+           return -1;
+       }
+       newlen = ss->maxlen + increment;
+       if (newlen > PR_INT32_MAX) {
+           return -1;
+       }
        if (ss->base) {
            newbase = (char*) PR_REALLOC(ss->base, newlen);
        } else {
@@ -1190,8 +1229,8 @@ PR_IMPLEMENT(PRUint32) PR_vsnprintf(char *out, PRUint32 outlen,const char *fmt,
     SprintfState ss;
     PRUint32 n;
 
-    PR_ASSERT((PRInt32)outlen > 0);
-    if ((PRInt32)outlen <= 0) {
+    PR_ASSERT(outlen != 0 && outlen <= PR_INT32_MAX);
+    if (outlen == 0 || outlen > PR_INT32_MAX) {
        return 0;
     }
 
@@ -1227,7 +1266,10 @@ PR_IMPLEMENT(char *) PR_vsprintf_append(char *last, const char *fmt, va_list ap)
 
     ss.stuff = GrowStuff;
     if (last) {
-       int lastlen = strlen(last);
+       size_t lastlen = strlen(last);
+       if (lastlen > PR_INT32_MAX) {
+           return 0;
+       }
        ss.base = last;
        ss.cur = last + lastlen;
        ss.maxlen = lastlen;
index b95d656..9d75d82 100644 (file)
@@ -194,7 +194,7 @@ static PRStatus
 GetInt(ScanfState *state, int code)
 {
     char buf[FMAX + 1], *p;
-    int ch;
+    int ch = 0;
     static const char digits[] = "0123456789abcdefABCDEF";
     PRBool seenDigit = PR_FALSE;
     int base;
@@ -304,7 +304,7 @@ static PRStatus
 GetFloat(ScanfState *state)
 {
     char buf[FMAX + 1], *p;
-    int ch;
+    int ch = 0;
     PRBool seenDigit = PR_FALSE;
 
     if (state->width == 0 || state->width > FMAX) {
index d9ad10a..4715460 100644 (file)
@@ -1036,7 +1036,7 @@ PR_UnloadLibrary(PRLibrary *lib)
          * fail (the library is not on the _pr_loadmap list),
          * but don't wipe out an error from dlclose/shl_unload.
          */
-        PR_ASSERT(!"_pr_loadmap and lib->refCount inconsistent");
+        PR_NOT_REACHED("_pr_loadmap and lib->refCount inconsistent");
         if (result == 0) {
             PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
             status = PR_FAILURE;
index b918a74..edb9f5f 100644 (file)
@@ -272,7 +272,7 @@ PR_EXTERN(PRInt32)
 _PR_MD_SETTHREADAFFINITYMASK(PRThread *thread, PRUint32 mask )
 {
    /* Can we do this on OS/2?  Only on SMP versions? */
-   PR_ASSERT(!"Not implemented");
+   PR_NOT_REACHED("Not implemented");
    return 0;
 
  /* This is what windows does:
@@ -288,7 +288,7 @@ PR_EXTERN(PRInt32)
 _PR_MD_GETTHREADAFFINITYMASK(PRThread *thread, PRUint32 *mask)
 {
    /* Can we do this on OS/2?  Only on SMP versions? */
-   PR_ASSERT(!"Not implemented");
+   PR_NOT_REACHED("Not implemented");
    return 0;
 
  /* This is what windows does:
index 4f27b82..fdae119 100644 (file)
@@ -2715,7 +2715,7 @@ static void* _MD_Unix_mmap64(
 
 /* Android <= 19 doesn't have mmap64. */
 #if defined(ANDROID) && __ANDROID_API__ <= 19
-extern void *__mmap2(void *, size_t, int, int, int, size_t);
+PR_IMPORT(void) *__mmap2(void *, size_t, int, int, int, size_t);
 
 #define ANDROID_PAGE_SIZE 4096
 
@@ -3040,7 +3040,7 @@ PRIntervalTime _PR_UNIX_TicksPerSecond()
 }
 #endif
 
-#if defined(HAVE_CLOCK_MONOTONIC)
+#if defined(_PR_HAVE_CLOCK_MONOTONIC)
 PRIntervalTime _PR_UNIX_GetInterval2()
 {
     struct timespec time;
index dab9e3f..10aca11 100644 (file)
@@ -8,6 +8,10 @@
  *
  */
 
+/* Mozilla's build system defines this globally. */
+#ifdef WIN32_LEAN_AND_MEAN
+#undef WIN32_LEAN_AND_MEAN
+#endif
 #include "primpl.h"
 
 #ifdef WINCE
index de55a8f..9bae6f8 100644 (file)
@@ -955,9 +955,10 @@ _PR_MD_LOCKFILE(PROsfd f)
                0l, 0l,
                0x0l, 0xffffffffl ); 
        if ( rv == 0 ) {
-        DWORD rc = GetLastError();
+        DWORD err = GetLastError();
+        _PR_MD_MAP_DEFAULT_ERROR(err);
         PR_LOG( _pr_io_lm, PR_LOG_ERROR,
-            ("_PR_MD_LOCKFILE() failed. Error: %d", rc ));
+            ("_PR_MD_LOCKFILE() failed. Error: %d", err ));
         rc = PR_FAILURE;
     }
 
index 932c50c..c27d982 100644 (file)
@@ -65,7 +65,7 @@ _PR_MD_INIT_THREAD(PRThread *thread)
         ** suspending).  Therefore, get a real handle from
         ** the pseudo handle via DuplicateHandle(...)
         */
-        DuplicateHandle(
+        BOOL ok = DuplicateHandle(
                 GetCurrentProcess(),     /* Process of source handle */
                 GetCurrentThread(),      /* Pseudo Handle to dup */
                 GetCurrentProcess(),     /* Process of handle */
@@ -73,6 +73,11 @@ _PR_MD_INIT_THREAD(PRThread *thread)
                 0L,                      /* access flags */
                 FALSE,                   /* Inheritable */
                 DUPLICATE_SAME_ACCESS);  /* Options */
+        if (!ok) {
+            return PR_FAILURE;
+        }
+        thread->id = GetCurrentThreadId();
+        thread->md.id = thread->id;
     }
 
     /* Create the blocking IO semaphore */
index 7c9f58c..cc2e198 100644 (file)
@@ -4,7 +4,25 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <string.h>
+#include <stdlib.h>
 #include "primpl.h"
+#include "prmem.h"
+
+#if defined(XP_UNIX)
+#include <unistd.h>
+#if defined(DARWIN)
+#if defined(HAVE_CRT_EXTERNS_H)
+#include <crt_externs.h>
+#endif /* HAVE_CRT_EXTERNS_H */
+#else  /* DARWIN */
+PR_IMPORT_DATA(char **) environ;
+#endif /* DARWIN */
+#endif /* XP_UNIX */
+
+#if !defined(HAVE_SECURE_GETENV) && defined(HAVE___SECURE_GETENV)
+#define secure_getenv __secure_getenv
+#define HAVE_SECURE_GETENV 1
+#endif
 
 /* Lock used to lock the environment */
 #if defined(_PR_NO_PREEMPT)
@@ -52,16 +70,93 @@ PR_IMPLEMENT(char*) PR_GetEnv(const char *var)
     return ev;
 }
 
+PR_IMPLEMENT(char*) PR_GetEnvSecure(const char *var)
+{
+#ifdef HAVE_SECURE_GETENV
+  char *ev;
+
+  if (!_pr_initialized) _PR_ImplicitInitialization();
+
+  _PR_LOCK_ENV();
+  ev = secure_getenv(var);
+  _PR_UNLOCK_ENV();
+
+  return ev;
+#else
+#ifdef XP_UNIX
+  /*
+  ** Fall back to checking uids and gids.  This won't detect any other
+  ** privilege-granting mechanisms the platform may have.  This also
+  ** can't detect the case where the process already called
+  ** setuid(geteuid()) and/or setgid(getegid()).
+  */
+  if (getuid() != geteuid() || getgid() != getegid()) {
+    return NULL;
+  }
+#endif /* XP_UNIX */
+  return PR_GetEnv(var);
+#endif /* HAVE_SECURE_GETENV */
+}
+
 PR_IMPLEMENT(PRStatus) PR_SetEnv(const char *string)
 {
     PRIntn result;
 
     if (!_pr_initialized) _PR_ImplicitInitialization();
 
-    if ( !strchr(string, '=')) return(PR_FAILURE);
+    if (!strchr(string, '=')) return(PR_FAILURE);
+
+    _PR_LOCK_ENV();
+    result = _PR_MD_PUT_ENV((char*)string);
+    _PR_UNLOCK_ENV();
+    return result ? PR_FAILURE : PR_SUCCESS;
+}
+
+#if defined(XP_UNIX) && (!defined(DARWIN) || defined(HAVE_CRT_EXTERNS_H))
+PR_IMPLEMENT(char **) PR_DuplicateEnvironment(void)
+{
+    char **the_environ, **result, **end, **src, **dst;
 
     _PR_LOCK_ENV();
-    result = _PR_MD_PUT_ENV(string);
+#ifdef DARWIN
+    the_environ = *(_NSGetEnviron());
+#else
+    the_environ = environ;
+#endif
+
+    for (end = the_environ; *end != NULL; end++)
+        /* empty loop body */;
+
+    result = (char **)PR_Malloc(sizeof(char *) * (end - the_environ + 1));
+    if (result != NULL) {
+        for (src = the_environ, dst = result; src != end; src++, dst++) {
+            size_t len;
+
+            len = strlen(*src) + 1;
+            *dst = PR_Malloc(len);
+            if (*dst == NULL) {
+              /* Allocation failed.  Must clean up the half-copied env. */
+              char **to_delete;
+
+              for (to_delete = result; to_delete != dst; to_delete++) {
+                PR_Free(*to_delete);
+              }
+              PR_Free(result);
+              result = NULL;
+              goto out;
+            }
+            memcpy(*dst, *src, len);
+        }
+        *dst = NULL;
+    }
+ out:
     _PR_UNLOCK_ENV();
-    return (result)? PR_FAILURE : PR_SUCCESS;
+    return result;
+}
+#else
+/* This platform doesn't support raw access to the environ block. */
+PR_IMPLEMENT(char **) PR_DuplicateEnvironment(void)
+{
+    return NULL;
 }
+#endif
index 5eda4a2..43048a0 100644 (file)
@@ -642,7 +642,10 @@ PR_IMPLEMENT(PRFileDesc *) PR_GetInheritedFD(
     while (1) {
         if ((ptr[len] == ':') && (strncmp(ptr, name, len) == 0)) {
             ptr += len + 1;
-            PR_sscanf(ptr, "%d:0x%" PR_SCNxOSFD, &fileType, &osfd);
+            if (PR_sscanf(ptr, "%d:0x%" PR_SCNxOSFD, &fileType, &osfd) != 2) {
+                PR_SetError(PR_UNKNOWN_ERROR, 0);
+                return NULL;
+            }
             switch ((PRDescType)fileType) {
                 case PR_DESC_FILE:
                     fd = PR_ImportFile(osfd);
index b86248f..b2f6e43 100644 (file)
@@ -63,8 +63,7 @@ PRLock *_pr_dnsLock = NULL;
 
 #if defined(SOLARIS) || (defined(BSDI) && defined(_REENTRANT)) \
        || (defined(LINUX) && defined(_REENTRANT) \
-        && !(defined(__GLIBC__) && __GLIBC__ >= 2) \
-        && !defined(ANDROID))
+        && defined(__GLIBC__) && __GLIBC__ < 2)
 #define _PR_HAVE_GETPROTO_R
 #define _PR_HAVE_GETPROTO_R_POINTER
 #endif
index 312e1f4..38b7787 100644 (file)
@@ -19,7 +19,7 @@ PR_IMPLEMENT(PROrderedLock *)
         const char *name
 )
 {
-    PR_ASSERT(!"Not implemented"); /* Not implemented yet */
+    PR_NOT_REACHED("Not implemented"); /* Not implemented yet */
     PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
     return NULL;
 } /*  end PR_CreateOrderedLock() */
@@ -30,7 +30,7 @@ PR_IMPLEMENT(void)
         PROrderedLock *lock 
 )
 {
-    PR_ASSERT(!"Not implemented"); /* Not implemented yet */
+    PR_NOT_REACHED("Not implemented"); /* Not implemented yet */
     PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
 } /*  end PR_DestroyOrderedLock() */
 
@@ -40,7 +40,7 @@ PR_IMPLEMENT(void)
         PROrderedLock *lock 
 )
 {
-    PR_ASSERT(!"Not implemented"); /* Not implemented yet */
+    PR_NOT_REACHED("Not implemented"); /* Not implemented yet */
     PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
 } /*  end PR_LockOrderedLock() */
 
@@ -50,7 +50,7 @@ PR_IMPLEMENT(PRStatus)
         PROrderedLock *lock 
 )
 {
-    PR_ASSERT(!"Not implemented"); /* Not implemented yet */
+    PR_NOT_REACHED("Not implemented"); /* Not implemented yet */
     PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
     return PR_FAILURE;
 } /*  end PR_UnlockOrderedLock() */
index 7a25071..eba85fb 100644 (file)
@@ -24,7 +24,7 @@
 
 /* BSD-derived systems use sysctl() to get the number of processors */
 #if defined(BSDI) || defined(FREEBSD) || defined(NETBSD) \
-    || defined(OPENBSD) || defined(DARWIN)
+    || defined(OPENBSD) || defined(DRAGONFLY) || defined(DARWIN)
 #define _PR_HAVE_SYSCTL
 #include <sys/param.h>
 #include <sys/sysctl.h>
@@ -275,15 +275,24 @@ PR_IMPLEMENT(PRUint64) PR_GetPhysicalMemorySize(void)
     if (pageSize >= 0 && pageCount >= 0)
         bytes = (PRUint64) pageSize * pageCount;
 
-#elif defined(NETBSD) || defined(OPENBSD)
+#elif defined(NETBSD) || defined(OPENBSD) \
+    || defined(FREEBSD) || defined(DRAGONFLY)
 
     int mib[2];
     int rc;
+#ifdef HW_PHYSMEM64
     uint64_t memSize;
+#else
+    unsigned long memSize;
+#endif
     size_t len = sizeof(memSize);
 
     mib[0] = CTL_HW;
+#ifdef HW_PHYSMEM64
     mib[1] = HW_PHYSMEM64;
+#else
+    mib[1] = HW_PHYSMEM;
+#endif
     rc = sysctl(mib, 2, &memSize, &len, NULL, 0);
     if (-1 != rc)  {
         bytes = memSize;
index 95d034c..6735805 100644 (file)
@@ -1672,23 +1672,24 @@ PR_ParseTimeString(
  */
 
 PR_IMPLEMENT(PRUint32)
-PR_FormatTime(char *buf, int buflen, const char *fmt, const PRExplodedTime *tm)
+PR_FormatTime(char *buf, int buflen, const char *fmt,
+              const PRExplodedTime *time)
 {
     size_t rv;
     struct tm a;
     struct tm *ap;
 
-    if (tm) {
+    if (time) {
         ap = &a;
-        a.tm_sec = tm->tm_sec;
-        a.tm_min = tm->tm_min;
-        a.tm_hour = tm->tm_hour;
-        a.tm_mday = tm->tm_mday;
-        a.tm_mon = tm->tm_month;
-        a.tm_wday = tm->tm_wday;
-        a.tm_year = tm->tm_year - 1900;
-        a.tm_yday = tm->tm_yday;
-        a.tm_isdst = tm->tm_params.tp_dst_offset ? 1 : 0;
+        a.tm_sec = time->tm_sec;
+        a.tm_min = time->tm_min;
+        a.tm_hour = time->tm_hour;
+        a.tm_mday = time->tm_mday;
+        a.tm_mon = time->tm_month;
+        a.tm_wday = time->tm_wday;
+        a.tm_year = time->tm_year - 1900;
+        a.tm_yday = time->tm_yday;
+        a.tm_isdst = time->tm_params.tp_dst_offset ? 1 : 0;
 
         /*
          * On some platforms, for example SunOS 4, struct tm has two
@@ -1699,8 +1700,8 @@ PR_FormatTime(char *buf, int buflen, const char *fmt, const PRExplodedTime *tm)
         || defined(NETBSD) || defined(OPENBSD) || defined(FREEBSD) \
         || defined(DARWIN) || defined(SYMBIAN) || defined(ANDROID)
         a.tm_zone = NULL;
-        a.tm_gmtoff = tm->tm_params.tp_gmt_offset +
-                      tm->tm_params.tp_dst_offset;
+        a.tm_gmtoff = time->tm_params.tp_gmt_offset +
+                      time->tm_params.tp_dst_offset;
 #endif
     } else {
         ap = NULL;
index 8870a3c..0671cc1 100644 (file)
@@ -281,8 +281,8 @@ PRThreadPool *tp = (PRThreadPool *) arg;
 int pollfd_cnt, pollfds_used;
 int rv;
 PRCList *qp, *nextqp;
-PRPollDesc *pollfds;
-PRJob **polljobs;
+PRPollDesc *pollfds = NULL;
+PRJob **polljobs = NULL;
 int poll_timeout;
 PRIntervalTime now;
 
index e1b456c..058f700 100644 (file)
@@ -657,14 +657,8 @@ static PRFileDesc * InitializeRecording( void )
     logLostData = 0; /* reset at entry */
     logState = LogReset;
 
-#ifdef XP_UNIX
-    if ((getuid() != geteuid()) || (getgid() != getegid())) {
-        return NULL;
-    }
-#endif /* XP_UNIX */
-
     /* Get the filename for the logfile from the environment */
-    logFileName = PR_GetEnv( "NSPR_TRACE_LOG" );
+    logFileName = PR_GetEnvSecure( "NSPR_TRACE_LOG" );
     if ( logFileName == NULL )
     {
         PR_LOG( lm, PR_LOG_ERROR,
index 6b91e55..726979b 100644 (file)
@@ -455,3 +455,10 @@ EXPORTS ;-
 ;+      global:
                PR_SyncMemMap;
 ;+} NSPR_4.9.2;
+;+# Function PR_DuplicateEnvironment had been added in NSPR 4.10.9,
+;+# but we neglected to add it to nspr.def until NSPR 4.12
+;+NSPR_4.12 {
+;+      global:
+               PR_DuplicateEnvironment;
+               PR_GetEnvSecure;
+;+} NSPR_4.10.3;
index 125f1f9..e4fe519 100644 (file)
@@ -3765,7 +3765,7 @@ static PRInt32 _pr_poll_with_poll(
      * We use these variables to figure out how much time has
      * elapsed and how much of the timeout still remains.
      */
-    PRIntervalTime start, elapsed, remaining;
+    PRIntervalTime start = 0, elapsed, remaining;
 
     if (pt_TestAbort()) return -1;
 
@@ -4019,7 +4019,7 @@ static PRInt32 _pr_poll_with_select(
      * We use these variables to figure out how much time has
      * elapsed and how much of the timeout still remains.
      */
-    PRIntervalTime start, elapsed, remaining;
+    PRIntervalTime start = 0, elapsed, remaining;
 
     if (pt_TestAbort()) return -1;
 
@@ -4919,7 +4919,7 @@ PR_IMPLEMENT(PRInt32) PR_Select(
      * We use these variables to figure out how much time has elapsed
      * and how much of the timeout still remains.
      */
-    PRIntervalTime start, elapsed, remaining;
+    PRIntervalTime start = 0, elapsed, remaining;
 
     static PRBool unwarned = PR_TRUE;
     if (unwarned) unwarned = _PR_Obsolete( "PR_Select", "PR_Poll");
index 03c5720..8663a4c 100644 (file)
@@ -322,13 +322,21 @@ PR_IMPLEMENT(PRCondVar*) PR_NewCondVar(PRLock *lock)
     PR_ASSERT(lock != NULL);
     if (cv != NULL)
     {
-        int rv = _PT_PTHREAD_COND_INIT(cv->cv, _pt_cvar_attr); 
+        int rv = _PT_PTHREAD_COND_INIT(cv->cv, _pt_cvar_attr);
         PR_ASSERT(0 == rv);
-        cv->lock = lock;
-        cv->notify_pending = 0;
+        if (0 == rv)
+        {
+            cv->lock = lock;
+            cv->notify_pending = 0;
 #if defined(DEBUG)
-        pt_debug.cvars_created += 1;
+            pt_debug.cvars_created += 1;
 #endif
+        }
+        else
+        {
+            PR_DELETE(cv);
+            cv = NULL;
+        }
     }
     return cv;
 }  /* PR_NewCondVar */
@@ -337,10 +345,13 @@ PR_IMPLEMENT(void) PR_DestroyCondVar(PRCondVar *cvar)
 {
     if (0 > PR_ATOMIC_DECREMENT(&cvar->notify_pending))
     {
-        PRIntn rv = pthread_cond_destroy(&cvar->cv); PR_ASSERT(0 == rv);
+        PRIntn rv = pthread_cond_destroy(&cvar->cv);
 #if defined(DEBUG)
+        PR_ASSERT(0 == rv);
         memset(cvar, 0xaf, sizeof(PRCondVar));
         pt_debug.cvars_destroyed += 1;
+#else
+        (void)rv;
 #endif
         PR_Free(cvar);
     }
@@ -1181,9 +1192,17 @@ PR_IMPLEMENT(PRCondVar*) PRP_NewNakedCondVar(void)
     if (cv != NULL)
     {
         int rv;
-        rv = _PT_PTHREAD_COND_INIT(cv->cv, _pt_cvar_attr); 
+        rv = _PT_PTHREAD_COND_INIT(cv->cv, _pt_cvar_attr);
         PR_ASSERT(0 == rv);
-        cv->lock = _PR_NAKED_CV_LOCK;
+        if (0 == rv)
+        {
+            cv->lock = _PR_NAKED_CV_LOCK;
+        }
+        else
+        {
+            PR_DELETE(cv);
+            cv = NULL;
+        }
     }
     return cv;
 }  /* PRP_NewNakedCondVar */
index 4ab564a..9e12606 100644 (file)
 #include <signal.h>
 #include <dlfcn.h>
 
+#if defined(OPENBSD) || defined(FREEBSD) || defined(DRAGONFLY)
+#include <pthread_np.h>
+#endif
+
 #ifdef SYMBIAN
 /* In Open C sched_get_priority_min/max do not work properly, so we undefine
  * _POSIX_THREAD_PRIORITY_SCHEDULING here.
@@ -54,7 +58,7 @@ static struct _PT_Bookeeping
     pthread_key_t key;          /* thread private data key */
     PRBool keyCreated;          /* whether 'key' should be deleted */
     PRThread *first, *last;     /* list of threads we know about */
-#if defined(_PR_DCETHREADS) || defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
+#if defined(_PR_DCETHREADS) || _POSIX_THREAD_PRIORITY_SCHEDULING > 0
     PRInt32 minPrio, maxPrio;   /* range of scheduling priorities */
 #endif
 } pt_book = {0};
@@ -63,7 +67,7 @@ static void _pt_thread_death(void *arg);
 static void _pt_thread_death_internal(void *arg, PRBool callDestructors);
 static void init_pthread_gc_support(void);
 
-#if defined(_PR_DCETHREADS) || defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
+#if defined(_PR_DCETHREADS) || _POSIX_THREAD_PRIORITY_SCHEDULING > 0
 static PRIntn pt_PriorityMap(PRThreadPriority pri)
 {
 #ifdef NTO
@@ -325,11 +329,11 @@ static PRThread* _PR_CreateThread(
 
     if (EPERM != pt_schedpriv)
     {
-#if !defined(_PR_DCETHREADS) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
+#if !defined(_PR_DCETHREADS) && _POSIX_THREAD_PRIORITY_SCHEDULING > 0
         struct sched_param schedule;
 #endif
 
-#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
+#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0
         rv = pthread_attr_setinheritsched(&tattr, PTHREAD_EXPLICIT_SCHED);
         PR_ASSERT(0 == rv);
 #endif
@@ -339,7 +343,7 @@ static PRThread* _PR_CreateThread(
 #if defined(_PR_DCETHREADS)
         rv = pthread_attr_setprio(&tattr, pt_PriorityMap(priority));
         PR_ASSERT(0 == rv);
-#elif defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
+#elif _POSIX_THREAD_PRIORITY_SCHEDULING > 0
         rv = pthread_attr_getschedparam(&tattr, &schedule);
         PR_ASSERT(0 == rv);
         schedule.sched_priority = pt_PriorityMap(priority);
@@ -396,7 +400,7 @@ static PRThread* _PR_CreateThread(
                scope = PR_GLOBAL_THREAD;
                        
         if (PR_GLOBAL_BOUND_THREAD == scope) {
-#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
+#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0
                rv = pthread_attr_setscope(&tattr, PTHREAD_SCOPE_SYSTEM);
                        if (rv) {
                                /*
@@ -471,7 +475,7 @@ static PRThread* _PR_CreateThread(
             PR_LOG(_pr_thread_lm, PR_LOG_MIN,
                 ("_PR_CreateThread: no thread scheduling privilege"));
             /* Try creating the thread again without setting priority. */
-#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
+#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0
             rv = pthread_attr_setinheritsched(&tattr, PTHREAD_INHERIT_SCHED);
             PR_ASSERT(0 == rv);
 #endif
@@ -680,7 +684,7 @@ PR_IMPLEMENT(PRThreadPriority) PR_GetThreadPriority(const PRThread *thred)
 
 PR_IMPLEMENT(void) PR_SetThreadPriority(PRThread *thred, PRThreadPriority newPri)
 {
-    PRIntn rv = -1;
+    PRIntn rv;
 
     PR_ASSERT(NULL != thred);
 
@@ -692,7 +696,7 @@ PR_IMPLEMENT(void) PR_SetThreadPriority(PRThread *thred, PRThreadPriority newPri
 #if defined(_PR_DCETHREADS)
     rv = pthread_setprio(thred->id, pt_PriorityMap(newPri));
     /* pthread_setprio returns the old priority */
-#elif defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
+#elif _POSIX_THREAD_PRIORITY_SCHEDULING > 0
     if (EPERM != pt_schedpriv)
     {
         int policy;
@@ -736,6 +740,8 @@ PR_IMPLEMENT(void) PR_SetThreadPriority(PRThread *thred, PRThreadPriority newPri
                  errno));
         }
     }
+#else
+    (void)rv; /* rv is unused */
 #endif
 
     thred->priority = newPri;
@@ -921,7 +927,7 @@ void _PR_InitThreads(
     pthread_init();
 #endif
 
-#if defined(_PR_DCETHREADS) || defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
+#if defined(_PR_DCETHREADS) || _POSIX_THREAD_PRIORITY_SCHEDULING > 0
 #if defined(FREEBSD)
     {
     pthread_attr_t attr;
@@ -1731,7 +1737,7 @@ PR_IMPLEMENT(PRStatus) PR_SetCurrentThreadName(const char *name)
 {
     PRThread *thread;
     size_t nameLen;
-    int result;
+    int result = 0;
 
     if (!name) {
         PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
@@ -1749,8 +1755,10 @@ PR_IMPLEMENT(PRStatus) PR_SetCurrentThreadName(const char *name)
         return PR_FAILURE;
     memcpy(thread->name, name, nameLen + 1);
 
-#if defined(OPENBSD) || defined(FREEBSD)
-    result = pthread_set_name_np(thread->id, name);
+#if defined(OPENBSD) || defined(FREEBSD) || defined(DRAGONFLY)
+    pthread_set_name_np(thread->id, name);
+#elif defined(NETBSD)
+    result = pthread_setname_np(thread->id, "%s", (void *)name);
 #else /* not BSD */
     /*
      * On OSX, pthread_setname_np is only available in 10.6 or later, so test
index 56322bb..3913dc8 100644 (file)
@@ -124,7 +124,7 @@ static _PRCPUQueue *_PR_CreateCPUQueue(void)
     _MD_NEW_LOCK( &cpuQueue->sleepQLock );
     _MD_NEW_LOCK( &cpuQueue->miscQLock );
 
-    for (index = 0; index < PR_PRIORITY_LAST + 1; index++)
+    for (index = 0; index < PR_ARRAY_SIZE(cpuQueue->runQ); index++)
         PR_INIT_CLIST( &(cpuQueue->runQ[index]) );
     PR_INIT_CLIST( &(cpuQueue->sleepQ) );
     PR_INIT_CLIST( &(cpuQueue->pauseQ) );
index 825ed89..4625ab2 100644 (file)
@@ -73,13 +73,13 @@ void _PR_InitThreads(PRThreadType type, PRThreadPriority priority,
 #ifndef HAVE_CUSTOM_USER_THREADS
     stack = PR_NEWZAP(PRThreadStack);
 #ifdef HAVE_STACK_GROWING_UP
-    stack->stackTop = (char*) ((((long)&type) >> _pr_pageShift)
+    stack->stackTop = (char*) ((((PRWord)&type) >> _pr_pageShift)
                   << _pr_pageShift);
 #else
 #if defined(SOLARIS) || defined (UNIXWARE) && defined (USR_SVR4_THREADS)
     stack->stackTop = (char*) &thread;
 #else
-    stack->stackTop = (char*) ((((long)&type + _pr_pageSize - 1)
+    stack->stackTop = (char*) ((((PRWord)&type + _pr_pageSize - 1)
                 >> _pr_pageShift) << _pr_pageShift);
 #endif
 #endif
@@ -174,12 +174,12 @@ static void _PR_InitializeNativeStack(PRThreadStack *ts)
         ** Setup stackTop and stackBottom values.
         */
 #ifdef HAVE_STACK_GROWING_UP
-    ts->allocBase = (char*) ((((long)&ts) >> _pr_pageShift)
+    ts->allocBase = (char*) ((((PRWord)&ts) >> _pr_pageShift)
                   << _pr_pageShift);
         ts->stackBottom = ts->allocBase + ts->stackSize;
         ts->stackTop = ts->allocBase;
 #else
-        ts->allocBase = (char*) ((((long)&ts + _pr_pageSize - 1)
+        ts->allocBase = (char*) ((((PRWord)&ts + _pr_pageSize - 1)
                 >> _pr_pageShift) << _pr_pageShift);
         ts->stackTop    = ts->allocBase;
         ts->stackBottom = ts->allocBase - ts->stackSize;
index 7f3e591..b40bee3 100644 (file)
@@ -87,7 +87,7 @@ void _PR_DumpThreads(PRFileDesc *fd)
     _PR_DumpThread(fd, t);
 
     _PR_DumpPrintf(fd, "Runnable Threads:\n");
-    for (i = 0; i < 32; i++) {
+    for (i = 0; i < PR_ARRAY_SIZE(_PR_RUNQ(t->cpu)); i++) {
         DumpThreadQueue(fd, &_PR_RUNQ(t->cpu)[i]);
     }
 
index 9ebd923..df1f1f2 100644 (file)
@@ -111,6 +111,7 @@ CSRCS =             \
        prftest.c               \
        prftest1.c              \
        prftest2.c              \
+       prfz.c                          \
        primblok.c              \
        priotest.c              \
        provider.c              \
index eaab44f..94349fa 100644 (file)
@@ -227,6 +227,9 @@ prftest1.c
 prftest2.c
        Obsolete. Subsumed in prftest.c
 
+prfz.c
+       Tests printf handling of (s)size_t formats
+
 priotest.c
        Limited use. Tests NSPR thread dispatching priority.
 
index e5240c4..c11588d 100644 (file)
@@ -9,6 +9,7 @@
 **
 */
 #include "prenv.h"
+#include "prmem.h"
 #include "plgetopt.h"
 
 #include <stdio.h>
@@ -17,6 +18,7 @@
 
 PRIntn  debug = 0;
 PRIntn  verbose = 0;
+PRIntn  secure = 0;
 PRBool  failedAlready = PR_FALSE;
 
 #define  ENVNAME    "NSPR_ENVIRONMENT_TEST_VARIABLE"
@@ -42,7 +44,7 @@ int main(int argc, char **argv)
 
     {   /* Get command line options */
         PLOptStatus os;
-        PLOptState *opt = PL_CreateOptState(argc, argv, "vd");
+        PLOptState *opt = PL_CreateOptState(argc, argv, "vds");
 
            while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
         {
@@ -55,6 +57,15 @@ int main(int argc, char **argv)
             case 'v':  /* verbose */
                 verbose = 1;
                 break;
+            case 's':  /* secure / set[ug]id */
+                /*
+                ** To test PR_GetEnvSecure, make this executable (or a
+                ** copy of it) setuid / setgid / otherwise inherently
+                ** privileged (e.g., file capabilities) and run it
+                ** with this flag.
+                */
+                secure = 1;
+                break;
              default:
                 break;
             }
@@ -112,6 +123,109 @@ int main(int argc, char **argv)
         if (verbose) printf("env: PR_GetEnv() worked after setting it. Found: %s\n", value );
     }
 
+    if ( secure ) {
+        /*
+        ** In this case we've been run with elevated privileges, so
+        ** test that PR_GetEnvSecure *doesn't* find that env var.
+        */
+        value = PR_GetEnvSecure( ENVNAME );
+        if ( NULL != value ) {
+            if (debug) printf( "env: PR_GetEnvSecure() failed; expected NULL, found \"%s\"\n", value );
+            failedAlready = PR_TRUE;
+        } else {
+            if (verbose) printf("env: PR_GetEnvSecure() worked\n" );
+        }
+    } else {
+        /*
+        ** In this case the program is being run normally, so do the
+        ** same check for PR_GetEnvSecure as for PR_GetEnv.
+        */
+        value = PR_GetEnvSecure( ENVNAME );
+        if ( (NULL == value ) || (strcmp( value, ENVVALUE)))  {
+            if (debug) printf( "env: PR_GetEnvSecure() Failed after setting\n" );
+            failedAlready = PR_TRUE;
+        } else {
+            if (verbose) printf("env: PR_GetEnvSecure() worked after setting it. Found: %s\n", value );
+        }
+    }
+
+/* ---------------------------------------------------------------------- */
+    /* check that PR_DuplicateEnvironment() agrees with PR_GetEnv() */
+    {
+#if defined(XP_UNIX) && (!defined(DARWIN) || defined(HAVE_CRT_EXTERNS_H))
+        static const PRBool expect_failure = PR_FALSE;
+#else
+        static const PRBool expect_failure = PR_TRUE;
+#endif
+        char **i, **dupenv = PR_DuplicateEnvironment();
+
+
+        if ( NULL == dupenv ) {
+            if (expect_failure) {
+                if (verbose) printf("env: PR_DuplicateEnvironment failed, "
+                                    "as expected on this platform.\n");
+            } else {
+                if (debug) printf("env: PR_DuplicateEnvironment() failed.\n");
+                failedAlready = PR_TRUE;
+            }
+        } else {
+            unsigned found = 0;
+
+            if (expect_failure) {
+                if (debug) printf("env: PR_DuplicateEnvironment() succeeded, "
+                                  "but failure is expected on this platform.\n");
+                failedAlready = PR_TRUE;
+            } else {
+                if (verbose) printf("env: PR_DuplicateEnvironment() succeeded.\n");
+            }
+            for (i = dupenv; *i; i++) {
+                char *equals = strchr(*i, '=');
+
+                if ( equals == NULL ) {
+                    if (debug) printf("env: PR_DuplicateEnvironment() returned a string"
+                                      " with no '=': %s\n", *i);
+                    failedAlready = PR_TRUE;
+                } else {
+                    /* We own this string, so we can temporarily alter it */
+                    /* *i is the null-terminated name; equals + 1 is the value */
+                    *equals = '\0';
+
+                    if ( strcmp(*i, ENVNAME) == 0) {
+                        found++;
+                        if (verbose) printf("env: PR_DuplicateEnvironment() found " ENVNAME
+                                            " (%u so far).\n", found);
+                    }
+
+                    /* Multiple values for the same name can't happen, according to POSIX. */
+                    value = PR_GetEnv(*i);
+                    if ( value == NULL ) {
+                        if (debug) printf("env: PR_DuplicateEnvironment() returned a name"
+                                          " which PR_GetEnv() failed to find: %s\n", *i);
+                        failedAlready = PR_TRUE;
+                    } else if ( strcmp(equals + 1, value) != 0) {
+                        if (debug) printf("env: PR_DuplicateEnvironment() returned the wrong"
+                                          " value for %s: expected %s; found %s\n",
+                                          *i, value, equals + 1);
+                        failedAlready = PR_TRUE;
+                    } else {
+                        if (verbose) printf("env: PR_DuplicateEnvironment() agreed with"
+                                            " PR_GetEnv() about %s\n", *i);
+                    }
+                }
+                PR_Free(*i);
+            }
+            PR_Free(dupenv);
+
+            if (found != 1) {
+                if (debug) printf("env: PR_DuplicateEnvironment() found %u entries for " ENVNAME
+                                  " (expected 1)\n", found);
+                failedAlready = PR_TRUE;
+            } else {
+                if (verbose) printf("env: PR_DuplicateEnvironment() found 1 entry for " ENVNAME "\n");
+            }
+        }
+    }
+
 /* ---------------------------------------------------------------------- */
     /* un-set the variable, using RAW name... should not work */
     envBuf = NewBuffer( ENVBUFSIZE );
index b83ff37..fa6399c 100644 (file)
@@ -72,7 +72,7 @@ thread_main(void *_info)
                        scope_str = GLOBAL_BOUND_SCOPE_STRING;
                        break;
                default:
-                       PR_ASSERT(!"Invalid thread scope");
+                       PR_NOT_REACHED("Invalid thread scope");
                        break;
        }
        printf("thread id %d, scope %s\n", info->id, scope_str);
index a24342a..61b08df 100644 (file)
@@ -506,7 +506,7 @@ static void PR_CALLBACK ServerThread(void *arg)
         {
             if (PR_PENDING_INTERRUPT_ERROR == PR_GetError()) break;
             PL_PrintError("Accept failed");
-            MW_ASSERT(!"Accept failed");
+            MW_ASSERT(PR_FALSE && "Accept failed");
         }
         else
         {
index 553db6b..0d9aec4 100644 (file)
@@ -104,7 +104,7 @@ static void PR_CALLBACK Client(void *arg)
             ready = PR_Poll(&polldesc, 1, PR_INTERVAL_NO_TIMEOUT);
             if ((1 != ready)  /* if not 1, then we're dead */
             || (0 == (polldesc.in_flags & polldesc.out_flags)))
-                { PR_ASSERT(!"Whoa!"); break; }
+                { PR_NOT_REACHED("Whoa!"); break; }
             if (verbosity > quiet)
                 PR_fprintf(
                     logFile, "Client connect 'in progress' [0x%x]\n",
@@ -143,7 +143,7 @@ static void PR_CALLBACK Client(void *arg)
                 ready = PR_Poll(&polldesc, 1, PR_INTERVAL_NO_TIMEOUT);
                 if ((1 != ready)  /* if not 1, then we're dead */
                 || (0 == (polldesc.in_flags & polldesc.out_flags)))
-                    { PR_ASSERT(!"Whoa!"); break; }
+                    { PR_NOT_REACHED("Whoa!"); break; }
             }
             else break;
         } while (bytes_sent < sizeof(buffer));
@@ -171,7 +171,7 @@ static void PR_CALLBACK Client(void *arg)
                 ready = PR_Poll(&polldesc, 1, PR_INTERVAL_NO_TIMEOUT);
                 if ((1 != ready)  /* if not 1, then we're dead */
                 || (0 == (polldesc.in_flags & polldesc.out_flags)))
-                    { PR_ASSERT(!"Whoa!"); break; }
+                    { PR_NOT_REACHED("Whoa!"); break; }
             }
             else break;
         } while (bytes_read < bytes_sent);
@@ -213,7 +213,7 @@ static void PR_CALLBACK Server(void *arg)
             ready = PR_Poll(&polldesc, 1, PR_INTERVAL_NO_TIMEOUT);
             if ((1 != ready)  /* if not 1, then we're dead */
             || (0 == (polldesc.in_flags & polldesc.out_flags)))
-                { PR_ASSERT(!"Whoa!"); break; }
+                { PR_NOT_REACHED("Whoa!"); break; }
         }
     } while (NULL == service);
     PR_ASSERT(NULL != service);
@@ -244,7 +244,7 @@ static void PR_CALLBACK Server(void *arg)
                 ready = PR_Poll(&polldesc, 1, PR_INTERVAL_NO_TIMEOUT);
                 if ((1 != ready)  /* if not 1, then we're dead */
                 || (0 == (polldesc.in_flags & polldesc.out_flags)))
-                    { PR_ASSERT(!"Whoa!"); break; }
+                    { PR_NOT_REACHED("Whoa!"); break; }
             }
             else break;
         } while (bytes_read < sizeof(buffer));
@@ -273,7 +273,7 @@ static void PR_CALLBACK Server(void *arg)
                     ready = PR_Poll(&polldesc, 1, PR_INTERVAL_NO_TIMEOUT);
                     if ((1 != ready)  /* if not 1, then we're dead */
                     || (0 == (polldesc.in_flags & polldesc.out_flags)))
-                        { PR_ASSERT(!"Whoa!"); break; }
+                        { PR_NOT_REACHED("Whoa!"); break; }
                 }
                 else break;
             } while (bytes_sent < bytes_read);
@@ -329,7 +329,7 @@ static PRInt16 PR_CALLBACK MyPoll(
             default: break;
         }
     }
-    else PR_ASSERT(!"How'd I get here?");
+    else PR_NOT_REACHED("How'd I get here?");
     new_flags = (fd->lower->methods->poll)(fd->lower, my_flags, out_flags);
     if (verbosity > chatty)
         PR_fprintf(
diff --git a/pr/tests/prfz.c b/pr/tests/prfz.c
new file mode 100644 (file)
index 0000000..0c5a432
--- /dev/null
@@ -0,0 +1,84 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/*
+ * This is a simple test of the PR_fprintf() function for size_t formats.
+ */
+
+#include "prprf.h"
+#include <sys/types.h>
+#include <limits.h>
+#include <string.h>
+
+int
+main(int argc, char **argv)
+{
+    char buffer[128];
+
+    size_t  unsigned_small  = 266;
+#ifdef XP_UNIX
+    ssize_t signed_small_p  = 943;
+    ssize_t signed_small_n  = -1;
+#endif
+    size_t  unsigned_max    = SIZE_MAX;
+    size_t  unsigned_min    = 0;
+#ifdef XP_UNIX
+    ssize_t signed_max      = SSIZE_MAX;
+#endif
+
+    printf("Test: unsigned small '%%zu' : ");
+    PR_snprintf(buffer, sizeof(buffer), "%zu", unsigned_small);
+    if (strncmp(buffer, "266", sizeof(buffer)) != 0) {
+        printf("Failed, got '%s'\n", buffer);
+        return -1;
+    }
+    printf("OK\n");
+
+#ifdef XP_UNIX
+    printf("Test: signed small positive '%%zd' : ");
+    PR_snprintf(buffer, sizeof(buffer), "%zd", signed_small_p);
+    if (strncmp(buffer, "943", sizeof(buffer)) != 0) {
+        printf("Failed, got '%s'\n", buffer);
+        return -1;
+    }
+    printf("OK\n");
+
+    printf("Test: signed small negative '%%zd' : ");
+    PR_snprintf(buffer, sizeof(buffer), "%zd", signed_small_n);
+    if (strncmp(buffer, "-1", sizeof(buffer)) != 0) {
+        printf("Failed, got '%s'\n", buffer);
+        return -1;
+    }
+    printf("OK\n");
+#endif
+
+    printf("Test: 0 '%%zu' : ");
+    PR_snprintf(buffer, sizeof(buffer), "%zu", unsigned_min);
+    if (strncmp(buffer, "0", sizeof(buffer)) != 0) {
+        printf("Failed, got '%s'\n", buffer);
+        return -1;
+    }
+    printf("OK\n");
+
+    printf("Test: SIZE_MAX '%%zx' : ");
+    PR_snprintf(buffer, sizeof(buffer), "%zx", unsigned_max);
+    if (strspn(buffer, "f") != sizeof(size_t) * 2) {
+        printf("Failed, got '%s'\n", buffer);
+        return -1;
+    }
+    printf("OK\n");
+
+#ifdef XP_UNIX
+    printf("Test: SSIZE_MAX '%%zx' : ");
+    PR_snprintf(buffer, sizeof(buffer), "%zx", signed_max);
+    if (*buffer != '7' ||
+        strspn(buffer + 1, "f") != sizeof(ssize_t) * 2 - 1) {
+        printf("Failed, got '%s'\n", buffer);
+        return -1;
+    }
+    printf("OK\n");
+#endif
+
+    return 0;
+}
index ca7897e..577d553 100644 (file)
@@ -186,7 +186,7 @@ int main(int argc, char **argv)
 
     PR_ProcessExit((failed) ? 1 : 0);
 
-       PR_ASSERT(!"You can't get here -- but you did!");
+       PR_NOT_REACHED("You can't get here -- but you did!");
        return 1;  /* or here */
 
 }  /* main */
index 3a164b1..5dbc649 100755 (executable)
@@ -310,6 +310,7 @@ $prog = shift;  # Program to test
 "poll_to",
 "pollable",
 "prftest",
+"prfz",
 "primblok",
 "provider",
 "prpollml",
index 535b93a..760f032 100755 (executable)
@@ -140,6 +140,7 @@ poll_nm
 poll_to
 pollable
 prftest
+prfz
 primblok
 provider
 prpollml
index 8d128f3..5872fa1 100644 (file)
@@ -22,7 +22,7 @@ static void rwtest(void *args)
     PR_RWLock_Rlock(rwlock1);
     PR_RWLock_Unlock(rwlock1);
 
-    // Test correct lock rank.
+    /* Test correct lock rank. */
     PR_RWLock_Rlock(rwlock1);
     PR_RWLock_Rlock(rwlock2);
     PR_RWLock_Unlock(rwlock2);
@@ -41,7 +41,7 @@ static void rwtest(void *args)
     PR_RWLock_Unlock(rwlock1);
 
 #if 0
-    // Test incorrect lock rank.
+    /* Test incorrect lock rank. */
     PR_RWLock_Rlock(rwlock2);
     PR_RWLock_Rlock(rwlock1);
     PR_RWLock_Unlock(rwlock1);
index 5c608cd..b794a7f 100644 (file)
@@ -37,6 +37,7 @@
 #define PASS 0
 #define FAIL 1
 static int debug_mode = 0;
+static int failed_already = 0;
 
 static int _iterations = 1000;
 static int _clients = 1;
@@ -90,6 +91,7 @@ static void Test_Result (int result)
                        break;
                case FAIL:
                        printf ("FAIL\n");
+                       failed_already = 1;
                        break;
                default:
                        break;
@@ -246,21 +248,32 @@ PRFileDesc *
 ServerSetup(void)
 {
     PRFileDesc *listenSocket;
+    PRSocketOptionData sockOpt;
     PRNetAddr serverAddr;
     PRThread *WorkerThread;
 
-    if ( (listenSocket = PR_NewTCPSocket()) == NULL) {
+    if ((listenSocket = PR_NewTCPSocket()) == NULL) {
         if (debug_mode) printf("\tServer error creating listen socket\n");
                else Test_Result(FAIL);
         return NULL;
     }
 
+    sockOpt.option = PR_SockOpt_Reuseaddr;
+    sockOpt.value.reuse_addr = PR_TRUE;
+    if (PR_SetSocketOption(listenSocket, &sockOpt) != PR_SUCCESS) {
+        if (debug_mode) printf("\tServer error setting socket option: OS error %d\n",
+                PR_GetOSError());
+        else Test_Result(FAIL);
+        PR_Close(listenSocket);
+        return NULL;
+    }
+
     memset(&serverAddr, 0, sizeof(PRNetAddr));
     serverAddr.inet.family = PR_AF_INET;
     serverAddr.inet.port = PR_htons(PORT);
     serverAddr.inet.ip = PR_htonl(PR_INADDR_ANY);
 
-    if ( PR_Bind(listenSocket, &serverAddr) == PR_FAILURE) {
+    if (PR_Bind(listenSocket, &serverAddr) != PR_SUCCESS) {
         if (debug_mode) printf("\tServer error binding to server address: OS error %d\n",
                 PR_GetOSError());
                else Test_Result(FAIL);
@@ -268,7 +281,7 @@ ServerSetup(void)
         return NULL;
     }
 
-    if ( PR_Listen(listenSocket, 128) == PR_FAILURE) {
+    if (PR_Listen(listenSocket, 128) != PR_SUCCESS) {
         if (debug_mode) printf("\tServer error listening to server socket\n");
                else Test_Result(FAIL);
         PR_Close(listenSocket);
@@ -548,7 +561,7 @@ int main(int argc, char **argv)
        Usage: test_name -d
        */
        PLOptStatus os;
-       PLOptState *opt = PL_CreateOptState(argc, argv, "d:");
+       PLOptState *opt = PL_CreateOptState(argc, argv, "d");
        while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
     {
                if (PL_OPT_BAD == os) continue;
@@ -606,5 +619,5 @@ int main(int argc, char **argv)
 
     PR_Cleanup();
 
-    return 0;
+    return failed_already;
 }
index 3544ba5..5ee2b78 100644 (file)
@@ -328,7 +328,7 @@ PRInt32 native_thread = 0;
                        native_thread = 1;
                        break;
                default:
-                       PR_ASSERT(!"Invalid scope");
+                       PR_NOT_REACHED("Invalid scope");
                        break;
        }
        if (native_thread) {
index b5f07fa..2365987 100644 (file)
@@ -120,7 +120,7 @@ PRInt32 native_thread = 0;
                        native_thread = 1;
                        break;
                default:
-                       PR_ASSERT(!"Invalid scope");
+                       PR_NOT_REACHED("Invalid scope");
                        break;
        }
        if (native_thread) {
index f9f183b..b19b579 100644 (file)
 #include <stdlib.h>
 
 /*
- * This release (4.10.7) is backward compatible with the
+ * This release (4.10.10) is backward compatible with the
  * 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x, 4.6.x, 4.7.x,
- * 4.8.x, 4.9.x, 4.10, 4.10.1, 4.10.2, 4.10.3, 4.10.4,
- * 4.10.5, and 4.10.6 releases.
+ * 4.8.x, 4.9.x, 4.10.x and 4.11.X releases.
  * It, of course, is compatible with itself.
  */
 static char *compatible_version[] = {
@@ -39,7 +38,8 @@ static char *compatible_version[] = {
     "4.9", "4.9.1", "4.9.2", "4.9.3", "4.9.4", "4.9.5",
     "4.9.6",
     "4.10", "4.10.1", "4.10.2", "4.10.3", "4.10.4",
-    "4.10.5", "4.10.6",
+    "4.10.5", "4.10.6", "4.10.7", "4.10.8", "4.10.9",
+    "4.10.10", "4.11",
     PR_VERSION
 };
 
@@ -55,8 +55,8 @@ static char *incompatible_version[] = {
     "3.0", "3.0.1",
     "3.1", "3.1.1", "3.1.2", "3.1.3",
     "3.5", "3.5.1",
-    "4.10.8",
-    "4.11", "4.11.1",
+    "4.11.1",
+    "4.12.1",
     "10.0", "11.1", "12.14.20"
 };