summaryrefslogtreecommitdiff
path: root/lib/frr_pthread.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-09-09 14:11:10 -0400
committerGitHub <noreply@github.com>2018-09-09 14:11:10 -0400
commit5381b930b38edbf6797ae058593546b718133cb1 (patch)
treeaeaabaa7a8231f096f91d07d9a488564761a9a82 /lib/frr_pthread.c
parent55e6c1329f78d5c672a58ff1fad86d7711a649c3 (diff)
parent7b34167d7dac6e898c49c675cfc80ae68c64bc98 (diff)
Merge pull request #2965 from opensourcerouting/buildfoo-20180904
more build fixes & warning-free build
Diffstat (limited to 'lib/frr_pthread.c')
-rw-r--r--lib/frr_pthread.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/frr_pthread.c b/lib/frr_pthread.c
index c0aae5e52e..d48b23f38a 100644
--- a/lib/frr_pthread.c
+++ b/lib/frr_pthread.c
@@ -19,6 +19,9 @@
#include <zebra.h>
#include <pthread.h>
+#ifdef HAVE_PTHREAD_NP_H
+#include <pthread_np.h>
+#endif
#include <sched.h>
#include "frr_pthread.h"
@@ -163,10 +166,14 @@ int frr_pthread_set_name(struct frr_pthread *fpt, const char *name,
pthread_mutex_lock(&fpt->mtx);
snprintf(fpt->os_name, OS_THREAD_NAMELEN, "%s", os_name);
pthread_mutex_unlock(&fpt->mtx);
-#ifdef GNU_LINUX
+#ifdef HAVE_PTHREAD_SETNAME_NP
+# ifdef GNU_LINUX
ret = pthread_setname_np(fpt->thread, fpt->os_name);
-#elif defined(OPEN_BSD)
- ret = pthread_set_name_np(fpt->thread, fpt->os_name);
+# else /* NetBSD */
+ ret = pthread_setname_np(fpt->thread, fpt->os_name, NULL);
+# endif
+#elif defined(HAVE_PTHREAD_SET_NAME_NP)
+ pthread_set_name_np(fpt->thread, fpt->os_name);
#endif
}