aboutsummaryrefslogtreecommitdiffstats
path: root/src/thread/Name.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-03-01 23:47:46 +0100
committerMax Kellermann <max@duempel.org>2014-03-01 23:58:59 +0100
commit7453c26ec4838760dec767b2f99afff9eb537d53 (patch)
tree6418ff0835555b3a0aa37ee5158aa27f14cf3773 /src/thread/Name.hxx
parentb059ba69d68afac4010ed0a2a629da3339f99678 (diff)
downloadmpd-7453c26ec4838760dec767b2f99afff9eb537d53.tar.gz
mpd-7453c26ec4838760dec767b2f99afff9eb537d53.tar.xz
mpd-7453c26ec4838760dec767b2f99afff9eb537d53.zip
thread/Name: fall back to prctl()
Diffstat (limited to 'src/thread/Name.hxx')
-rw-r--r--src/thread/Name.hxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/thread/Name.hxx b/src/thread/Name.hxx
index f86fc6e42..284d1e147 100644
--- a/src/thread/Name.hxx
+++ b/src/thread/Name.hxx
@@ -23,6 +23,8 @@
#ifdef HAVE_PTHREAD_SETNAME_NP
#include <pthread.h>
#include <stdio.h>
+#elif defined(HAVE_PRCTL)
+#include <sys/prctl.h>
#endif
static inline void
@@ -34,6 +36,8 @@ SetThreadName(const char *name)
#else
pthread_setname_np(pthread_self(), name);
#endif
+#elif defined(HAVE_PRCTL) && defined(PR_SET_NAME)
+ prctl(PR_SET_NAME, (unsigned long)name, 0, 0, 0);
#else
(void)name;
#endif