summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdouard Oger <eoger@fastmail.com>2019-05-07 15:04:28 +0000
committerEdouard Oger <eoger@fastmail.com>2019-05-07 15:04:28 +0000
commitc138f0294f927c24840a9f554c3bd7ee02cb6d33 (patch)
treeb6f70fa46a14a354baafedd6774ba3a12bdb4e26
parent01359fd1d773651d6d62727796890c331119d44a (diff)
downloadnspr-hg-c138f0294f927c24840a9f554c3bd7ee02cb6d33.tar.gz
Bug 1541216 - Update PR_SetCurrentThreadName() to use prctl(PR_SET_NAME) on Android r=eoger
Differential Revision: https://phabricator.services.mozilla.com/D25880
-rw-r--r--pr/src/pthreads/ptthread.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/pr/src/pthreads/ptthread.c b/pr/src/pthreads/ptthread.c
index e61a4cbd..0a3a9a7c 100644
--- a/pr/src/pthreads/ptthread.c
+++ b/pr/src/pthreads/ptthread.c
@@ -25,6 +25,10 @@
#include <pthread_np.h>
#endif
+#if defined(ANDROID)
+#include <sys/prctl.h>
+#endif
+
#ifdef SYMBIAN
/* In Open C sched_get_priority_min/max do not work properly, so we undefine
* _POSIX_THREAD_PRIORITY_SCHEDULING here.
@@ -1633,6 +1637,8 @@ PR_IMPLEMENT(PRStatus) PR_SetCurrentThreadName(const char *name)
#if defined(OPENBSD) || defined(FREEBSD) || defined(DRAGONFLY)
pthread_set_name_np(thread->id, name);
+#elif defined(ANDROID)
+ prctl(PR_SET_NAME, (unsigned long)(name));
#elif defined(NETBSD)
result = pthread_setname_np(thread->id, "%s", (void *)name);
#else /* not BSD */