Bug 1021287 - Update NSPR to 4.10.6 RTM. r=kaie, a=lsblakk
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 05 Jun 2014 18:03:11 -0400
changeset 200479 fc83bcd4ed6d243c4b1e65ad1800d78dc6b47965
parent 200478 cf4871067d2abf62534498c864b55bdf78412992
child 200480 1009c320a2b6fa1648a7ddc96f4061b78b7d3f13
push id486
push userasasaki@mozilla.com
push dateMon, 14 Jul 2014 18:39:42 +0000
treeherdermozilla-release@d33428174ff1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskaie, lsblakk
bugs1021287
milestone31.0a2
Bug 1021287 - Update NSPR to 4.10.6 RTM. r=kaie, a=lsblakk
configure.in
nsprpub/TAG-INFO
nsprpub/config/nsinstall.c
nsprpub/config/prdepend.h
nsprpub/configure
nsprpub/configure.in
nsprpub/pr/include/md/_linux.h
nsprpub/pr/include/prinit.h
nsprpub/pr/include/prio.h
nsprpub/pr/src/io/prmapopt.c
nsprpub/pr/src/io/prprf.c
nsprpub/pr/src/misc/prsystem.c
nsprpub/pr/src/pthreads/ptio.c
nsprpub/pr/tests/Makefile.in
nsprpub/pr/tests/prfdbl.c
nsprpub/pr/tests/sockopt.c
nsprpub/pr/tests/vercheck.c
--- a/configure.in
+++ b/configure.in
@@ -3546,17 +3546,17 @@ dnl ====================================
 dnl = If NSPR was not detected in the system,
 dnl = use the one in the source tree (mozilla/nsprpub)
 dnl ========================================================
 MOZ_ARG_WITH_BOOL(system-nspr,
 [  --with-system-nspr      Use system installed NSPR],
     _USE_SYSTEM_NSPR=1 )
 
 if test -n "$_USE_SYSTEM_NSPR"; then
-    AM_PATH_NSPR(4.10.3, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
+    AM_PATH_NSPR(4.10.6, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
 fi
 
 if test -n "$MOZ_NATIVE_NSPR"; then
     _SAVE_CFLAGS=$CFLAGS
     CFLAGS="$CFLAGS $NSPR_CFLAGS"
     AC_TRY_COMPILE([#include "prtypes.h"],
                 [#ifndef PR_STATIC_ASSERT
                  #error PR_STATIC_ASSERT not defined or requires including prtypes.h
--- a/nsprpub/TAG-INFO
+++ b/nsprpub/TAG-INFO
@@ -1,1 +1,1 @@
-NSPR_4_10_5_RTM
+NSPR_4_10_6_RTM
--- a/nsprpub/config/nsinstall.c
+++ b/nsprpub/config/nsinstall.c
@@ -203,17 +203,16 @@ main(int argc, char **argv)
     }
     xchdir(todir);
 #ifdef GETCWD_CAN_MALLOC
     todir = getcwd(0, PATH_MAX);
 #else
     todir = malloc(PATH_MAX + 1);
     todir = getcwd(todir, PATH_MAX);
 #endif
-    tdlen = strlen(todir);
     xchdir(cwd);
     tdlen = strlen(todir);
 
     uid = owner ? touid(owner) : -1;
     gid = group ? togid(group) : -1;
 
     while (--argc > 0) {
 	name = *argv++;
--- a/nsprpub/config/prdepend.h
+++ b/nsprpub/config/prdepend.h
@@ -5,9 +5,8 @@
 
 /*
  * A dummy header file that is a dependency for all the object files.
  * Used to force a full recompilation of NSPR in Mozilla's Tinderbox
  * depend builds.  See comments in rules.mk.
  */
 
 #error "Do not include this header file."
-
--- a/nsprpub/configure
+++ b/nsprpub/configure
@@ -2482,17 +2482,17 @@ case $target_os in *\ *) target_os=`echo
 # will get canonicalized.
 test -n "$target_alias" &&
   test "$program_prefix$program_suffix$program_transform_name" = \
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
 MOD_MAJOR_VERSION=4
 MOD_MINOR_VERSION=10
-MOD_PATCH_VERSION=5
+MOD_PATCH_VERSION=6
 NSPR_MODNAME=nspr20
 _HAVE_PTHREADS=
 USE_PTHREADS=
 USE_USER_PTHREADS=
 USE_NSPR_THREADS=
 USE_N32=
 USE_X32=
 USE_64=
@@ -2898,16 +2898,18 @@ if test "${enable_symbian_target+set}" =
   enableval=$enable_symbian_target; OS_TARGET=`echo $enableval | tr a-z A-Z`
 fi
 
 
 # Check whether --enable-debug-rtl was given.
 if test "${enable_debug_rtl+set}" = set; then :
   enableval=$enable_debug_rtl;  if test "$enableval" = "yes"; then
 	    USE_DEBUG_RTL=1
+      else
+	    USE_DEBUG_RTL=0
       fi
 fi
 
 
 # Check whether --enable-n32 was given.
 if test "${enable_n32+set}" = set; then :
   enableval=$enable_n32;  if test "$enableval" = "yes"; then
 	USE_N32=1
@@ -5737,17 +5739,17 @@ CYGWIN_NT*|MINGW*_NT*|MSYS_NT*)
     if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then
         CPU_ARCH=x86
     fi
     ;;
 esac
 
 if test -n "$MOZILLA_CLIENT" && test "$OS_ARCH" = "WINNT"; then
     OS_TARGET=WIN95
-    if test -n "$MOZ_DEBUG"; then
+    if test -n "$MOZ_DEBUG" -a -z "$USE_DEBUG_RTL"; then
         USE_DEBUG_RTL=1
     fi
 fi
 if test -z "$OS_TARGET"; then
     OS_TARGET=$OS_ARCH
 fi
 if test "$OS_TARGET" = "WIN95"; then
     OS_RELEASE="4.0"
@@ -7178,17 +7180,17 @@ tools are selected during the Xcode/Deve
                                     PROFILE_GEN_CFLAGS="$PROFILE_GEN_CFLAGS -Gw"
             PROFILE_USE_CFLAGS="$PROFILE_USE_CFLAGS -Gw"
         fi
 
         if test -z "$MOZ_OPTIMIZE"; then
             CFLAGS="$CFLAGS -Od"
         fi
 
-        if test -n "$USE_DEBUG_RTL"; then
+        if test "$USE_DEBUG_RTL" = 1; then
             CFLAGS="$CFLAGS -MDd"
         else
             CFLAGS="$CFLAGS -MD"
         fi
 
         if test -n "$MOZ_DEBUG"; then
             $as_echo "#define _DEBUG 1" >>confdefs.h
 
@@ -7239,17 +7241,17 @@ tools are selected during the Xcode/Deve
     fi
 
     if test "$CPU_ARCH" = "x86"; then
         CPU_ARCH_TAG=
     else
         CPU_ARCH_TAG=$CPU_ARCH
     fi
 
-    if test -n "$USE_DEBUG_RTL"; then
+    if test "$USE_DEBUG_RTL" = 1; then
         OBJDIR_SUFFIX=OBJD
     fi
 
     case "$OS_TARGET" in
     WINNT)
 	    MDCPUCFG_H=_winnt.cfg
 	    ;;
     WIN95)
--- a/nsprpub/configure.in
+++ b/nsprpub/configure.in
@@ -11,17 +11,17 @@ AC_CONFIG_SRCDIR([pr/include/nspr.h])
 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
 AC_CANONICAL_TARGET
 
 dnl ========================================================
 dnl = Defaults
 dnl ========================================================
 MOD_MAJOR_VERSION=4
 MOD_MINOR_VERSION=10
-MOD_PATCH_VERSION=5
+MOD_PATCH_VERSION=6
 NSPR_MODNAME=nspr20
 _HAVE_PTHREADS=
 USE_PTHREADS=
 USE_USER_PTHREADS=
 USE_NSPR_THREADS=
 USE_N32=
 USE_X32=
 USE_64=
@@ -379,16 +379,18 @@ AC_ARG_ENABLE(symbian-target,
     [  --enable-symbian-target=\$t
                           Specify symbian flavor. (WINSCW or GCCE)],
     OS_TARGET=`echo $enableval | tr a-z A-Z`)
 
 AC_ARG_ENABLE(debug-rtl,
     [  --enable-debug-rtl      Use the MSVC debug runtime library],
     [ if test "$enableval" = "yes"; then
 	    USE_DEBUG_RTL=1
+      else
+	    USE_DEBUG_RTL=0
       fi ])
 
 AC_ARG_ENABLE(n32,
     [  --enable-n32            Enable n32 ABI support (IRIX only)],
     [ if test "$enableval" = "yes"; then
 	USE_N32=1
       else if test "$enableval" = "no"; then
 	USE_N32=
@@ -976,17 +978,17 @@ CYGWIN_NT*|MINGW*_NT*|MSYS_NT*)
     if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then
         CPU_ARCH=x86
     fi
     ;;
 esac
 
 if test -n "$MOZILLA_CLIENT" && test "$OS_ARCH" = "WINNT"; then
     OS_TARGET=WIN95
-    if test -n "$MOZ_DEBUG"; then
+    if test -n "$MOZ_DEBUG" -a -z "$USE_DEBUG_RTL"; then
         USE_DEBUG_RTL=1
     fi
 fi
 if test -z "$OS_TARGET"; then
     OS_TARGET=$OS_ARCH
 fi
 if test "$OS_TARGET" = "WIN95"; then
     OS_RELEASE="4.0"
@@ -1996,17 +1998,17 @@ tools are selected during the Xcode/Deve
             PROFILE_GEN_CFLAGS="$PROFILE_GEN_CFLAGS -Gw"
             PROFILE_USE_CFLAGS="$PROFILE_USE_CFLAGS -Gw"
         fi
 
         if test -z "$MOZ_OPTIMIZE"; then
             CFLAGS="$CFLAGS -Od"
         fi
 
-        if test -n "$USE_DEBUG_RTL"; then
+        if test "$USE_DEBUG_RTL" = 1; then
             CFLAGS="$CFLAGS -MDd"
         else
             CFLAGS="$CFLAGS -MD"
         fi
 
         if test -n "$MOZ_DEBUG"; then
             AC_DEFINE(_DEBUG)
         else
@@ -2052,17 +2054,17 @@ tools are selected during the Xcode/Deve
     fi
 
     if test "$CPU_ARCH" = "x86"; then
         CPU_ARCH_TAG=
     else
         CPU_ARCH_TAG=$CPU_ARCH
     fi
 
-    if test -n "$USE_DEBUG_RTL"; then
+    if test "$USE_DEBUG_RTL" = 1; then
         OBJDIR_SUFFIX=OBJD
     fi
 
     case "$OS_TARGET" in
     WINNT)
 	    MDCPUCFG_H=_winnt.cfg
 	    ;;
     WIN95)
--- a/nsprpub/pr/include/md/_linux.h
+++ b/nsprpub/pr/include/md/_linux.h
@@ -75,17 +75,17 @@
  * Elf linux supports dl* functions
  */
 #define HAVE_DLL
 #define USE_DLFCN
 #if defined(ANDROID)
 #define NO_DLOPEN_NULL
 #endif
 
-#ifdef __FreeBSD_kernel__
+#if defined(__FreeBSD_kernel__) || defined(__GNU__)
 #define _PR_HAVE_SOCKADDR_LEN
 #endif
 
 #if defined(__i386__)
 #define _PR_HAVE_ATOMIC_OPS
 #define _MD_INIT_ATOMIC()
 extern PRInt32 _PR_x86_AtomicIncrement(PRInt32 *val);
 #define _MD_ATOMIC_INCREMENT          _PR_x86_AtomicIncrement
--- a/nsprpub/pr/include/prinit.h
+++ b/nsprpub/pr/include/prinit.h
@@ -26,20 +26,20 @@ PR_BEGIN_EXTERN_C
 /*
 ** NSPR's version is used to determine the likelihood that the version you
 ** used to build your component is anywhere close to being compatible with
 ** what is in the underlying library.
 **
 ** The format of the version string is
 **     "<major version>.<minor version>[.<patch level>] [<Beta>]"
 */
-#define PR_VERSION  "4.10.5"
+#define PR_VERSION  "4.10.6"
 #define PR_VMAJOR   4
 #define PR_VMINOR   10
-#define PR_VPATCH   5
+#define PR_VPATCH   6
 #define PR_BETA     PR_FALSE
 
 /*
 ** PRVersionCheck
 **
 ** The basic signature of the function that is called to provide version
 ** checking. The result will be a boolean that indicates the likelihood
 ** that the underling library will perform as the caller expects.
--- a/nsprpub/pr/include/prio.h
+++ b/nsprpub/pr/include/prio.h
@@ -206,16 +206,18 @@ typedef enum PRSockOption
     PR_SockOpt_DropMember,      /* drop an IP group membership */
     PR_SockOpt_McastInterface,  /* multicast interface address */
     PR_SockOpt_McastTimeToLive, /* multicast timetolive */
     PR_SockOpt_McastLoopback,   /* multicast loopback */
 
     PR_SockOpt_NoDelay,         /* don't delay send to coalesce packets */
     PR_SockOpt_MaxSegment,      /* maximum segment size */
     PR_SockOpt_Broadcast,       /* enable broadcast */
+    PR_SockOpt_Reuseport,       /* allow local address & port reuse on
+                                 * platforms that support it */
     PR_SockOpt_Last
 } PRSockOption;
 
 typedef struct PRLinger {
 	PRBool polarity;		    /* Polarity of the option's setting */
 	PRIntervalTime linger;	    /* Time to linger before closing */
 } PRLinger;
 
@@ -229,16 +231,18 @@ typedef struct PRSocketOptionData
     PRSockOption option;
     union
     {
         PRUintn ip_ttl;             /* IP time to live */
         PRUintn mcast_ttl;          /* IP multicast time to live */
         PRUintn tos;                /* IP type of service and precedence */
         PRBool non_blocking;        /* Non-blocking (network) I/O */
         PRBool reuse_addr;          /* Allow local address reuse */
+        PRBool reuse_port;          /* Allow local address & port reuse on
+                                     * platforms that support it */
         PRBool keep_alive;          /* Keep connections alive */
         PRBool mcast_loopback;      /* IP multicast loopback */
         PRBool no_delay;            /* Don't delay send to coalesce packets */
         PRBool broadcast;           /* Enable broadcast */
         PRSize max_segment;         /* Maximum segment size */
         PRSize recv_buffer_size;    /* Receive buffer size */
         PRSize send_buffer_size;    /* Send buffer size */
         PRLinger linger;            /* Time to linger on close if data present */
--- a/nsprpub/pr/src/io/prmapopt.c
+++ b/nsprpub/pr/src/io/prmapopt.c
@@ -80,16 +80,17 @@ PRStatus PR_CALLBACK _PR_SocketGetSocket
                 PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
                 return PR_FAILURE;
 #endif
             }
             case PR_SockOpt_Reuseaddr:
             case PR_SockOpt_Keepalive:
             case PR_SockOpt_NoDelay:
             case PR_SockOpt_Broadcast:
+            case PR_SockOpt_Reuseport:
             {
 #ifdef WIN32 /* Winsock */
                 BOOL value;
 #else
                 PRIntn value;
 #endif
                 length = sizeof(value);
                 rv = _PR_MD_GETSOCKOPT(
@@ -231,16 +232,17 @@ PRStatus PR_CALLBACK _PR_SocketSetSocket
                 PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
                 return PR_FAILURE;
 #endif
             }
             case PR_SockOpt_Reuseaddr:
             case PR_SockOpt_Keepalive:
             case PR_SockOpt_NoDelay:
             case PR_SockOpt_Broadcast:
+            case PR_SockOpt_Reuseport:
             {
 #ifdef WIN32 /* Winsock */
                 BOOL value;
 #else
                 PRIntn value;
 #endif
                 value = (data->value.reuse_addr) ? 1 : 0;
                 rv = _PR_MD_SETSOCKOPT(
@@ -407,36 +409,40 @@ PRStatus PR_CALLBACK _PR_SocketSetSocket
 #ifndef TCP_NODELAY                     /* don't delay to coalesce data     */
 #define TCP_NODELAY         _PR_NO_SUCH_SOCKOPT
 #endif
 
 #ifndef TCP_MAXSEG                      /* maxumum segment size for tcp     */
 #define TCP_MAXSEG          _PR_NO_SUCH_SOCKOPT
 #endif
 
-#ifndef SO_BROADCAST                 /* enable broadcast on udp sockets */
+#ifndef SO_BROADCAST                    /* enable broadcast on UDP sockets  */
 #define SO_BROADCAST        _PR_NO_SUCH_SOCKOPT
 #endif
 
+#ifndef SO_REUSEPORT                    /* allow local address & port reuse */
+#define SO_REUSEPORT        _PR_NO_SUCH_SOCKOPT
+#endif
+
 PRStatus _PR_MapOptionName(
     PRSockOption optname, PRInt32 *level, PRInt32 *name)
 {
     static PRInt32 socketOptions[PR_SockOpt_Last] =
     {
         0, SO_LINGER, SO_REUSEADDR, SO_KEEPALIVE, SO_RCVBUF, SO_SNDBUF,
         IP_TTL, IP_TOS, IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIP,
         IP_MULTICAST_IF, IP_MULTICAST_TTL, IP_MULTICAST_LOOP,
-        TCP_NODELAY, TCP_MAXSEG, SO_BROADCAST
+        TCP_NODELAY, TCP_MAXSEG, SO_BROADCAST, SO_REUSEPORT
     };
     static PRInt32 socketLevels[PR_SockOpt_Last] =
     {
         0, SOL_SOCKET, SOL_SOCKET, SOL_SOCKET, SOL_SOCKET, SOL_SOCKET,
         IPPROTO_IP, IPPROTO_IP, IPPROTO_IP, IPPROTO_IP,
         IPPROTO_IP, IPPROTO_IP, IPPROTO_IP,
-        IPPROTO_TCP, IPPROTO_TCP, SOL_SOCKET
+        IPPROTO_TCP, IPPROTO_TCP, SOL_SOCKET, SOL_SOCKET
     };
 
     if ((optname < PR_SockOpt_Linger)
     || (optname >= PR_SockOpt_Last))
     {
         PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
         return PR_FAILURE;
     }
--- a/nsprpub/pr/src/io/prprf.c
+++ b/nsprpub/pr/src/io/prprf.c
@@ -13,16 +13,20 @@
 #include <stdio.h>
 #include <string.h>
 #include "primpl.h"
 #include "prprf.h"
 #include "prlong.h"
 #include "prlog.h"
 #include "prmem.h"
 
+#ifdef _MSC_VER
+#define snprintf _snprintf
+#endif
+
 /*
 ** WARNING: This code may *NOT* call PR_LOG (because PR_LOG calls it)
 */
 
 /*
 ** XXX This needs to be internationalized!
 */
 
@@ -299,50 +303,46 @@ static int cvt_ll(SprintfState *ss, PRIn
     */
     return fill_n(ss, cvt, digits, width, prec, type, flags);
 }
 
 /*
 ** Convert a double precision floating point number into its printable
 ** form.
 **
-** XXX stop using sprintf to convert floating point
+** XXX stop using snprintf to convert floating point
 */
 static int cvt_f(SprintfState *ss, double d, const char *fmt0, const char *fmt1)
 {
     char fin[20];
     char fout[300];
     int amount = fmt1 - fmt0;
 
-    PR_ASSERT((amount > 0) && (amount < sizeof(fin)));
-    if (amount >= sizeof(fin)) {
-	/* Totally bogus % command to sprintf. Just ignore it */
+    if (amount <= 0 || amount >= sizeof(fin)) {
+	/* Totally bogus % command to snprintf. Just ignore it */
 	return 0;
     }
     memcpy(fin, fmt0, amount);
     fin[amount] = 0;
 
-    /* Convert floating point using the native sprintf code */
+    /* Convert floating point using the native snprintf code */
 #ifdef DEBUG
     {
         const char *p = fin;
         while (*p) {
             PR_ASSERT(*p != 'L');
             p++;
         }
     }
 #endif
-    sprintf(fout, fin, d);
-
-    /*
-    ** This assert will catch overflow's of fout, when building with
-    ** debugging on. At least this way we can track down the evil piece
-    ** of calling code and fix it!
-    */
-    PR_ASSERT(strlen(fout) < sizeof(fout));
+    memset(fout, 0, sizeof(fout));
+    snprintf(fout, sizeof(fout), fin, d);
+    /* Explicitly null-terminate fout because on Windows snprintf doesn't
+     * append a null-terminator if the buffer is too small. */
+    fout[sizeof(fout) - 1] = '\0';
 
     return (*ss->stuff)(ss, fout, strlen(fout));
 }
 
 /*
 ** Convert a string into its printable form.  "width" is the output
 ** width. "prec" is the maximum number of characters of "s" to output,
 ** where -1 means until NUL.
--- a/nsprpub/pr/src/misc/prsystem.c
+++ b/nsprpub/pr/src/misc/prsystem.c
@@ -28,16 +28,17 @@
 #define _PR_HAVE_SYSCTL
 #include <sys/param.h>
 #include <sys/sysctl.h>
 #endif
 
 #if defined(DARWIN)
 #include <mach/mach_init.h>
 #include <mach/mach_host.h>
+#include <mach/mach_port.h>
 #endif
 
 #if defined(HPUX)
 #include <sys/mpctl.h>
 #include <sys/pstat.h>
 #endif
 
 #if defined(XP_UNIX)
@@ -292,23 +293,25 @@ PR_IMPLEMENT(PRUint64) PR_GetPhysicalMem
 
     struct pst_static info;
     int result = pstat_getstatic(&info, sizeof(info), 1, 0);
     if (result == 1)
         bytes = (PRUint64) info.physical_memory * info.page_size;
 
 #elif defined(DARWIN)
 
+    mach_port_t mach_host = mach_host_self();
     struct host_basic_info hInfo;
     mach_msg_type_number_t count = HOST_BASIC_INFO_COUNT;
 
-    int result = host_info(mach_host_self(),
+    int result = host_info(mach_host,
                            HOST_BASIC_INFO,
                            (host_info_t) &hInfo,
                            &count);
+    mach_port_deallocate(mach_task_self(), mach_host);
     if (result == KERN_SUCCESS)
         bytes = hInfo.max_mem;
 
 #elif defined(WIN32)
 
     MEMORYSTATUSEX memStat;
     memStat.dwLength = sizeof(memStat);
     if (GlobalMemoryStatusEx(&memStat))
--- a/nsprpub/pr/src/pthreads/ptio.c
+++ b/nsprpub/pr/src/pthreads/ptio.c
@@ -2849,16 +2849,17 @@ static PRStatus pt_GetSocketOption(PRFil
                 data->value.linger.linger =
                     PR_SecondsToInterval(linger.l_linger);
                 break;
             }
             case PR_SockOpt_Reuseaddr:
             case PR_SockOpt_Keepalive:
             case PR_SockOpt_NoDelay:
             case PR_SockOpt_Broadcast:
+            case PR_SockOpt_Reuseport:
             {
                 PRIntn value;
                 length = sizeof(PRIntn);
                 rv = getsockopt(
                     fd->secret->md.osfd, level, name, (char*)&value, &length);
                 PR_ASSERT((-1 == rv) || (sizeof(PRIntn) == length));
                 data->value.reuse_addr = (0 == value) ? PR_FALSE : PR_TRUE;
                 break;
@@ -2968,16 +2969,17 @@ static PRStatus pt_SetSocketOption(PRFil
                 rv = setsockopt(
                     fd->secret->md.osfd, level, name, (char*)&linger, sizeof(linger));
                 break;
             }
             case PR_SockOpt_Reuseaddr:
             case PR_SockOpt_Keepalive:
             case PR_SockOpt_NoDelay:
             case PR_SockOpt_Broadcast:
+            case PR_SockOpt_Reuseport:
             {
                 PRIntn value = (data->value.reuse_addr) ? 1 : 0;
                 rv = setsockopt(
                     fd->secret->md.osfd, level, name,
                     (char*)&value, sizeof(PRIntn));
 #ifdef LINUX
                 /* for pt_LinuxSendFile */
                 if (name == TCP_NODELAY && rv == 0) {
--- a/nsprpub/pr/tests/Makefile.in
+++ b/nsprpub/pr/tests/Makefile.in
@@ -102,16 +102,17 @@ CSRCS =             \
 	pipeping2.c		\
 	pipepong.c		\
 	pipepong2.c		\
 	pipeself.c		\
 	poll_er.c		\
 	poll_nm.c		\
 	poll_to.c		\
 	pollable.c		\
+	prfdbl.c		\
 	prftest.c		\
 	prftest1.c		\
 	prftest2.c		\
 	primblok.c		\
 	priotest.c		\
 	provider.c		\
 	prpoll.c		\
 	prpollml.c		\
new file mode 100644
--- /dev/null
+++ b/nsprpub/pr/tests/prfdbl.c
@@ -0,0 +1,29 @@
+/* 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 doubles.
+ */
+
+#include "prprf.h"
+
+int main()
+{
+    double pi = 3.1415926;
+    double e = 2.71828;
+    double root2 = 1.414;
+    double zero = 0.0;
+    double nan = zero / zero;
+
+    PR_fprintf(PR_STDOUT, "pi is %f.\n", pi);
+    PR_fprintf(PR_STDOUT, "e is %f.\n", e);
+    PR_fprintf(PR_STDOUT, "The square root of 2 is %f.\n", root2);
+    PR_fprintf(PR_STDOUT, "NaN is %f.\n", nan);
+
+    PR_fprintf(PR_STDOUT, "pi is %301f.\n", pi);
+    PR_fprintf(PR_STDOUT, "e is %65416.123f.\n", e);
+    PR_fprintf(PR_STDOUT, "e is %0000000000000000000065416.123f.\n", e);
+    PR_fprintf(PR_STDOUT, "NaN is %1024.1f.\n", nan);
+    return 0;
+}
--- a/nsprpub/pr/tests/sockopt.c
+++ b/nsprpub/pr/tests/sockopt.c
@@ -6,16 +6,20 @@
 #include "nspr.h"
 #include "prio.h"
 #include "prinit.h"
 #include "prprf.h"
 #include "obsolete/probslet.h"
 
 #include "plerror.h"
 
+#ifdef XP_UNIX
+#include <sys/socket.h>  /* SO_REUSEPORT */
+#endif
+
 static PRFileDesc *err = NULL;
 static PRBool failed = PR_FALSE;
 
 static void Failed(const char *msg1, const char *msg2)
 {
     if (NULL != msg1) PR_fprintf(err, "%s ", msg1);
     PL_FPrintError(err, msg2);
     failed = PR_TRUE;
@@ -49,16 +53,17 @@ int main(int argc, char **argv)
         "PR_SockOpt_DropMember",      /* drop an IP group membership */
         "PR_SockOpt_McastInterface",  /* multicast interface address */
         "PR_SockOpt_McastTimeToLive", /* multicast timetolive */
         "PR_SockOpt_McastLoopback",   /* multicast loopback */
 
         "PR_SockOpt_NoDelay",         /* don't delay send to coalesce packets */
         "PR_SockOpt_MaxSegment",      /* maximum segment size */
         "PR_SockOpt_Broadcast",       /* Enable broadcast */
+        "PR_SockOpt_Reuseport",       /* allow local address & port reuse */
         "PR_SockOpt_Last"
     };
 
     err = PR_GetSpecialFD(PR_StandardError);
     PR_STDIO_INIT();
 
     if (NULL == udp) Failed("PR_NewUDPSocket()", NULL);
     else if (NULL == tcp) Failed("PR_NewTCPSocket()", NULL);
@@ -125,16 +130,21 @@ int main(int argc, char **argv)
                     break;    
 #endif
 #ifndef SYMBIAN
                 case PR_SockOpt_Broadcast:
                     fd = udp; 
                     data.value.broadcast = PR_TRUE;         
                     break;    
 #endif
+#ifdef SO_REUSEPORT
+                case PR_SockOpt_Reuseport:
+                    data.value.reuse_port = PR_TRUE;
+                    break;
+#endif
                 default: continue;
             }
 
 			/*
 			 * TCP_MAXSEG can only be read, not set
 			 */
             if (option != PR_SockOpt_MaxSegment) {
 #ifdef WIN32
--- a/nsprpub/pr/tests/vercheck.c
+++ b/nsprpub/pr/tests/vercheck.c
@@ -15,51 +15,52 @@
  */
 
 #include "prinit.h"
 
 #include <stdio.h>
 #include <stdlib.h>
 
 /*
- * This release (4.10.5) is backward compatible with the
+ * This release (4.10.6) 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, and 4.10.4
- * releases.
+ * 4.8.x, 4.9.x, 4.10, 4.10.1, 4.10.2, 4.10.3, 4.10.4, and
+ * 4.10.5 releases.
  * It, of course, is compatible with itself.
  */
 static char *compatible_version[] = {
     "4.0", "4.0.1", "4.1", "4.1.1", "4.1.2", "4.1.3",
     "4.2", "4.2.1", "4.2.2", "4.3", "4.4", "4.4.1",
     "4.5", "4.5.1",
     "4.6", "4.6.1", "4.6.2", "4.6.3", "4.6.4", "4.6.5",
     "4.6.6", "4.6.7", "4.6.8",
     "4.7", "4.7.1", "4.7.2", "4.7.3", "4.7.4", "4.7.5",
     "4.7.6",
     "4.8", "4.8.1", "4.8.2", "4.8.3", "4.8.4", "4.8.5",
     "4.8.6", "4.8.7", "4.8.8", "4.8.9",
     "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",
     PR_VERSION
 };
 
 /*
  * This release is not backward compatible with the old
  * NSPR 2.1 and 3.x releases.
  *
  * Any release is incompatible with future releases and
  * patches.
  */
 static char *incompatible_version[] = {
     "2.1 19980529",
     "3.0", "3.0.1",
     "3.1", "3.1.1", "3.1.2", "3.1.3",
     "3.5", "3.5.1",
-    "4.10.6",
+    "4.10.7",
     "4.11", "4.11.1",
     "10.0", "11.1", "12.14.20"
 };
 
 int main(int argc, char **argv)
 {
     int idx;
     int num_compatible = sizeof(compatible_version) / sizeof(char *);