Revert "Add freebsd support for getcpu (use cpu nr 0)"
[lttng-ust.git] / liblttng-ust / compat.h
index 37480671052edcb872c58345958b7c543c2ddea4..05b85a930615516da7175af84661ce144f7d5127 100644 (file)
  * modified is included with the above copyright notice.
  */
 
+/*
+ * sched_getcpu.
+ */
+#ifdef __linux__
+
+#ifdef __UCLIBC__
+#include <sys/syscall.h>
+#define __getcpu(cpu, node, cache)     syscall(__NR_getcpu, cpu, node, cache)
+static inline
+int sched_getcpu(void)
+{
+       int c, s;
+
+       s = __getcpu(&c, NULL, NULL);
+       return (s == -1) ? s : c;
+}
+#endif /* __UCLIBC__ */
+
+#else
+#error "Please add support for your OS into liblttng-ust/compat.h."
+#endif
+
 /*
  * lttng_ust_getprocname.
  */
This page took 0.024083 seconds and 4 git commands to generate.