Fix compilation with uclibc
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 13 Jun 2011 14:24:46 +0000 (10:24 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 13 Jun 2011 14:24:46 +0000 (10:24 -0400)
Reported-by: Khem Raj <raj.khem@gmail.com>
Reported-by: Dexuan Cui <dexuan.cui@intel.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/Makefile.am
include/ust/compat.h [new file with mode: 0644]
libust/tracer.h

index bd649b6b6144bcb604eeed9516723b8e6dd75997..6b128faded4c581aacec48d8246b61d8cbdcc94d 100644 (file)
@@ -10,6 +10,7 @@ noinst_HEADERS = \
        usterr.h \
        ust_snprintf.h \
        usterr_signal_safe.h \
+       ust/compat.h \
        ust/config.h \
        ust/core.h \
        ust/marker-internal.h \
diff --git a/include/ust/compat.h b/include/ust/compat.h
new file mode 100644 (file)
index 0000000..c896e72
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef _UST_COMPAT_H
+#define _UST_COMPAT_H
+
+/*
+ * Copyright (C) 2011   Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#include <sys/syscall.h>
+
+#ifdef __UCLIBC__
+#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__ */
+#endif /* _UST_COMPAT_H */
index 03049aa32aaa43117f78995fe5bfaefcb3c97c19..4f72d7ad637e5e39de20df4b386fba84dd1e497e 100644 (file)
@@ -30,6 +30,7 @@
 #include <ust/marker-internal.h>
 #include <ust/probe-internal.h>
 #include <ust/core.h>
+#include <ust/compat.h>
 #include "channels.h"
 #include "tracercore.h"
 #include "tracerconst.h"
This page took 0.027552 seconds and 4 git commands to generate.