summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Quèze <florian@queze.net>2021-02-24 19:50:59 +0100
committerFlorian Quèze <florian@queze.net>2021-02-24 19:50:59 +0100
commitf38f2b5a172e11e5d9030684987f22a7e92a9b3e (patch)
tree97595423b9fe8fcf56b75dcc164ad96772652f9e
parentceede85703ac3fbab34ee2e71c1bf932731bcebb (diff)
downloadnspr-hg-f38f2b5a172e11e5d9030684987f22a7e92a9b3e.tar.gz
Bug 1693762 - Extend the thread name length limit to 63 characters on Mac. r=kaieNSPR_4_30_BETA1
-rw-r--r--pr/src/pthreads/ptthread.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/pr/src/pthreads/ptthread.c b/pr/src/pthreads/ptthread.c
index 292c89eb..92c9c788 100644
--- a/pr/src/pthreads/ptthread.c
+++ b/pr/src/pthreads/ptthread.c
@@ -1694,13 +1694,20 @@ PR_IMPLEMENT(PRStatus) PR_SetCurrentThreadName(const char *name)
return PR_SUCCESS;
}
+#if defined(DARWIN)
+ /* Mac OS X has a length limit of 63 characters, but there is no API
+ * exposing it.
+ */
+#define SETNAME_LENGTH_CONSTRAINT 63
+#else
/*
* 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
+ * length of a null-terminated string that most linux distros accept
+ * as an argument to pthread_setname_np. Otherwise the E2BIG
* error is returned by the function.
*/
#define SETNAME_LENGTH_CONSTRAINT 15
+#endif
#define SETNAME_FRAGMENT1_LENGTH (SETNAME_LENGTH_CONSTRAINT >> 1)
#define SETNAME_FRAGMENT2_LENGTH \
(SETNAME_LENGTH_CONSTRAINT - SETNAME_FRAGMENT1_LENGTH - 1)