diff options
author | Harald Welte <laforge@osmocom.org> | 2022-03-28 15:38:28 +0200 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2022-03-29 12:58:01 +0000 |
commit | c17546faff2ecdc688cdcb25875a26492d43733e (patch) | |
tree | 5e37858ce5e2a699b4e6234321480ceb51785e07 /src | |
parent | c80a004f0beab7cb49a39226ae6ac6c402853765 (diff) |
vty: Support platforms that don't support pthread_getname_np()
pthread_getname_np() is a non-portable extension of pthreads. While
it exists in glibc, for example musl didn't have it until rather
recently (April 2021) and there still hasn't yet been a musl release
with this change, resulting even current OpenWRT not yet supporting
pthread_getname_np.
So let's check if pthread_getname_np is supported, and only use it
in that case.
Change-Id: Ibd01485af24e2fe574006f8d049bf37226dda966
Diffstat (limited to 'src')
-rw-r--r-- | src/vty/cpu_sched_vty.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vty/cpu_sched_vty.c b/src/vty/cpu_sched_vty.c index 0b4b2492..dbb3cd59 100644 --- a/src/vty/cpu_sched_vty.c +++ b/src/vty/cpu_sched_vty.c @@ -25,6 +25,8 @@ #define _GNU_SOURCE +#include "../../config.h" + #include <string.h> #include <stdlib.h> #include <errno.h> @@ -637,8 +639,10 @@ int osmo_cpu_sched_vty_apply_localthread(void) return 0; } +#ifdef HAVE_PTHREAD_GETNAME_NP if (pthread_getname_np(pthread_self(), name, sizeof(name)) == 0) has_name = true; +#endif /* Get latest matching mask for the thread */ pthread_mutex_lock(&sched_vty_opts->cpu_affinity_li_mutex); |