From 787364e8bac9a146f9d65c763633c2b75eb76463 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Mon, 30 May 2016 16:31:33 -0400 Subject: [PATCH] Use config.h to detect sched_getcpu support Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- libringbuffer/getcpu.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/libringbuffer/getcpu.h b/libringbuffer/getcpu.h index fbddb798..7b009dc6 100644 --- a/libringbuffer/getcpu.h +++ b/libringbuffer/getcpu.h @@ -22,6 +22,7 @@ #include #include #include +#include void lttng_ust_getcpu_init(void); @@ -47,10 +48,7 @@ int lttng_ust_get_cpu_internal(void) */ #ifdef __linux__ -/* old uClibc versions didn't have sched_getcpu */ -#if defined(__UCLIBC__) && __UCLIBC_MAJOR__ == 0 && \ - (__UCLIBC_MINOR__ < 9 || \ - (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ <= 32)) +#if !HAVE_SCHED_GETCPU #include #define __getcpu(cpu, node, cache) syscall(__NR_getcpu, cpu, node, cache) /* @@ -64,9 +62,9 @@ int lttng_ust_get_cpu_internal(void) ret = __getcpu(&cpu, NULL, NULL); if (caa_unlikely(ret < 0)) return 0; - return c; + return cpu; } -#else /* __UCLIBC__ */ +#else /* HAVE_SCHED_GETCPU */ #include /* @@ -82,7 +80,7 @@ int lttng_ust_get_cpu_internal(void) return 0; return cpu; } -#endif /* __UCLIBC__ */ +#endif /* HAVE_SCHED_GETCPU */ #elif (defined(__FreeBSD__) || defined(__CYGWIN__)) -- 2.34.1