Bug 778845 - Must upgrade Aurora 16 to NSPR 4.9.2 final, r=wtc
authorKai Engert <kaie@kuix.de>
Thu, 02 Aug 2012 23:04:47 +0200
changeset 101266 38b216220e608d9d1613765d3dbde93d1119a33f
parent 101265 90495de76df05a577ee4abb65aec19536e07bdb0
child 101267 032ba64ab1f107ff320f96d24f5d54a7d10458ba
child 101276 89dcadd42ec4b68b6e39b71061f04cd8d1aefc25
push id12926
push userkaie@kuix.de
push dateThu, 02 Aug 2012 21:41:52 +0000
treeherdermozilla-inbound@38b216220e60 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswtc
bugs778845
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 778845 - Must upgrade Aurora 16 to NSPR 4.9.2 final, r=wtc
nsprpub/TAG-INFO
nsprpub/pr/include/prinit.h
nsprpub/pr/src/pthreads/ptthread.c
--- a/nsprpub/TAG-INFO
+++ b/nsprpub/TAG-INFO
@@ -1,1 +1,1 @@
-NSPR_4_9_2_BETA2
+NSPR_4_9_2_RTM
--- a/nsprpub/pr/include/prinit.h
+++ b/nsprpub/pr/include/prinit.h
@@ -26,21 +26,21 @@ 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.9.2 Beta"
+#define PR_VERSION  "4.9.2"
 #define PR_VMAJOR   4
 #define PR_VMINOR   9
 #define PR_VPATCH   2
-#define PR_BETA     PR_TRUE
+#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/src/pthreads/ptthread.c
+++ b/nsprpub/pr/src/pthreads/ptthread.c
@@ -1638,41 +1638,46 @@ PR_IMPLEMENT(PRStatus) PR_SetCurrentThre
     memcpy(thread->name, name, nameLen + 1);
 
 #if defined(OPENBSD) || defined(FREEBSD)
     result = pthread_set_name_np(thread->id, name);
 #else /* not BSD */
     /*
      * On OSX, pthread_setname_np is only available in 10.6 or later, so test
      * for it at runtime.  It also may not be available on all linux distros.
-     * The name length limit is 16 bytes.
      */
 #if defined(DARWIN)
     int (*dynamic_pthread_setname_np)(const char*);
 #else
     int (*dynamic_pthread_setname_np)(pthread_t, const char*);
 #endif
 
     *(void**)(&dynamic_pthread_setname_np) =
         dlsym(RTLD_DEFAULT, "pthread_setname_np");
     if (!dynamic_pthread_setname_np)
         return PR_SUCCESS;
 
+    /*
+     * The 15-character name length limit is an experimentally determined
+     * length of a null-terminated string that most linux distros and OS X
+     * accept as an argument to pthread_setname_np.  Otherwise the E2BIG
+     * error is returned by the function.
+     */
 #define SETNAME_LENGTH_CONSTRAINT 15
 #define SETNAME_FRAGMENT1_LENGTH (SETNAME_LENGTH_CONSTRAINT >> 1)
 #define SETNAME_FRAGMENT2_LENGTH \
     (SETNAME_LENGTH_CONSTRAINT - SETNAME_FRAGMENT1_LENGTH - 1)
     char name_dup[SETNAME_LENGTH_CONSTRAINT + 1];
     if (nameLen > SETNAME_LENGTH_CONSTRAINT) {
         memcpy(name_dup, name, SETNAME_FRAGMENT1_LENGTH);
         name_dup[SETNAME_FRAGMENT1_LENGTH] = '~';
+        /* Note that this also copies the null terminator. */
         memcpy(name_dup + SETNAME_FRAGMENT1_LENGTH + 1,
                name + nameLen - SETNAME_FRAGMENT2_LENGTH,
-               SETNAME_FRAGMENT2_LENGTH);
-        name_dup[SETNAME_LENGTH_CONSTRAINT] = '\0';
+               SETNAME_FRAGMENT2_LENGTH + 1);
         name = name_dup;
     }
 
 #if defined(DARWIN)
     result = dynamic_pthread_setname_np(name);
 #else
     result = dynamic_pthread_setname_np(thread->id, name);
 #endif