[misc] Explicitly check for pthread_setname_np/pthread_set_name_np

Seems there is no pthread_setname_np in OpenWrt
This commit is contained in:
ejurgensen
2016-05-05 19:39:15 +02:00
parent 95d0c25be3
commit 9a56044c77
8 changed files with 36 additions and 29 deletions

View File

@@ -38,6 +38,9 @@
#include <fcntl.h>
#include <dirent.h>
#include <pthread.h>
#ifdef HAVE_PTHREAD_NP_H
# include <pthread_np.h>
#endif
#include <unistr.h>
#include <unictype.h>
@@ -45,10 +48,6 @@
#include <event2/event.h>
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# include <pthread_np.h>
#endif
#ifdef HAVE_REGEX_H
# include <regex.h>
#endif
@@ -2165,9 +2164,9 @@ filescanner_init(void)
goto thread_fail;
}
#if defined(__linux__)
#if defined(HAVE_PTHREAD_SETNAME_NP)
pthread_setname_np(tid_scan, "filescanner");
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#elif defined(HAVE_PTHREAD_SET_NAME_NP)
pthread_set_name_np(tid_scan, "filescanner");
#endif