diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2018-09-04 13:15:56 +0200 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2018-09-09 01:16:25 +0200 |
| commit | e9d938b82a630d61a5cb0890c424c42f3e9ce241 (patch) | |
| tree | 56e24ce6613b4c29aac6b30a386575f41f073bf2 /lib/frr_pthread.c | |
| parent | 324be174d79290281ec42b41636a5303c569a133 (diff) | |
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>
Diffstat (limited to 'lib/frr_pthread.c')
| -rw-r--r-- | lib/frr_pthread.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/frr_pthread.c b/lib/frr_pthread.c index 7cae889ca9..d48b23f38a 100644 --- a/lib/frr_pthread.c +++ b/lib/frr_pthread.c @@ -166,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 } |
