Index: nspr/pr/src/pthreads/ptthread.c |
diff --git a/nspr/pr/src/pthreads/ptthread.c b/nspr/pr/src/pthreads/ptthread.c |
index de90e4d39fdf4485f42240665db5ee913d162f05..9e12606ea3f4227943318fede21dc7799851e880 100644 |
--- a/nspr/pr/src/pthreads/ptthread.c |
+++ b/nspr/pr/src/pthreads/ptthread.c |
@@ -21,6 +21,10 @@ |
#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. |
@@ -1733,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); |
@@ -1751,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 |