mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 10:37:29 +00:00
lib: make pthread_set[_]name_np test OS agnostic
FreeBSD supports pthread_set_name_np() too. Also, pthread_set_name_np() returns void. And NetBSD has pthread_setname_np() with an extra arg... Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
parent
324be174d7
commit
e9d938b82a
@ -818,6 +818,7 @@ int main(int argc, char **argv) {
|
|||||||
AC_CHECK_HEADERS([pthread_np.h],,, [
|
AC_CHECK_HEADERS([pthread_np.h],,, [
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
])
|
])
|
||||||
|
AC_CHECK_FUNCS([pthread_setname_np pthread_set_name_np])
|
||||||
|
|
||||||
dnl Utility macro to avoid retyping includes all the time
|
dnl Utility macro to avoid retyping includes all the time
|
||||||
m4_define([FRR_INCLUDES],
|
m4_define([FRR_INCLUDES],
|
||||||
|
@ -166,10 +166,14 @@ int frr_pthread_set_name(struct frr_pthread *fpt, const char *name,
|
|||||||
pthread_mutex_lock(&fpt->mtx);
|
pthread_mutex_lock(&fpt->mtx);
|
||||||
snprintf(fpt->os_name, OS_THREAD_NAMELEN, "%s", os_name);
|
snprintf(fpt->os_name, OS_THREAD_NAMELEN, "%s", os_name);
|
||||||
pthread_mutex_unlock(&fpt->mtx);
|
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);
|
ret = pthread_setname_np(fpt->thread, fpt->os_name);
|
||||||
#elif defined(OPEN_BSD)
|
# else /* NetBSD */
|
||||||
ret = pthread_set_name_np(fpt->thread, fpt->os_name);
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user