Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: mjeanson@efficios.com (Michael Jeanson)
Subject: [lttng-dev] [PATCH lttng-ust 4/4] Use config.h to detect sched_getcpu support
Date: Mon, 30 May 2016 16:31:33 -0400	[thread overview]
Message-ID: <1464640293-10157-4-git-send-email-mjeanson@efficios.com> (raw)
In-Reply-To: <1464640293-10157-1-git-send-email-mjeanson@efficios.com>

Signed-off-by: Michael Jeanson <mjeanson at efficios.com>
---
 libringbuffer/getcpu.h | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/libringbuffer/getcpu.h b/libringbuffer/getcpu.h
index fbddb79..7b009dc 100644
--- a/libringbuffer/getcpu.h
+++ b/libringbuffer/getcpu.h
@@ -22,6 +22,7 @@
 #include <urcu/compiler.h>
 #include <urcu/system.h>
 #include <urcu/arch.h>
+#include <config.h>
 
 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 <sys/syscall.h>
 #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 <sched.h>
 
 /*
@@ -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.7.4



  parent reply	other threads:[~2016-05-30 20:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-30 20:31 [lttng-dev] [PATCH lttng-ust 1/4] Add support for musl libc to ust-dlfcn.h Michael Jeanson
2016-05-30 20:31 ` [lttng-dev] [PATCH lttng-ust 2/4] Fix: strerror_r behavior is glibc specific Michael Jeanson
2016-05-30 20:31 ` [lttng-dev] [PATCH lttng-ust 3/4] Fix: use limits.h in ust-elf test Michael Jeanson
2016-05-30 20:31 ` Michael Jeanson [this message]
2016-05-31  4:38 ` [lttng-dev] [PATCH lttng-ust 1/4] Add support for musl libc to ust-dlfcn.h Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464640293-10157-4-git-send-email-mjeanson@efficios.com \
    --to=mjeanson@efficios.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox