AC_CHECK_HEADERS([pthread_np.h],,, [
#include <pthread.h>
])
+AC_CHECK_FUNCS([pthread_setname_np pthread_set_name_np])
dnl Utility macro to avoid retyping includes all the time
m4_define([FRR_INCLUDES],
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
}