summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/lttng/lttng-ust/uclibc-sched_getcpu.patch
blob: 7102a69184cd133942a405137feab7c650090ec1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
uClibc does not have sched_getcpu() implemented. So we create a wrapper
to getcpu syscall when compiling for uclibc.

So far execinfo.h does not exist on uclibc but it turns out to be that
this header is not needed even in eglibc case so it can be removed

Signed-off-by: Khem Raj <raj.khem@gmail.com>

Upstream-status: Pending

Index: ust-0.12/libust/tracer.h
===================================================================
--- ust-0.12.orig/libust/tracer.h
+++ ust-0.12/libust/tracer.h
@@ -342,14 +342,22 @@ static __inline__ void ltt_write_trace_h
 	header->start_freq = trace->start_freq;
 	header->freq_scale = trace->freq_scale;
 }
-
+#ifdef __UCLIBC__
+#define sched_getcpu(cpu, node, cache) syscall(__NR_getcpu, cpu, node, cache)
+#endif
 #ifndef UST_VALGRIND
 
 static __inline__ int ust_get_cpu(void)
 {
 	int cpu;
 
+#ifdef __UCLIBC__
+	int c, s;
+	s = syscall(__NR_getcpu, &c, NULL, NULL);
+	cpu = (s == -1) ? s : c;
+#else
 	cpu = sched_getcpu();
+#endif
 	if (likely(cpu >= 0))
 		return cpu;
 	/*
Index: ust-0.12/libustcomm/ustcomm.c
===================================================================
--- ust-0.12.orig/libustcomm/ustcomm.c
+++ ust-0.12/libustcomm/ustcomm.c
@@ -31,7 +31,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <execinfo.h>
 
 #include "ustcomm.h"
 #include "usterr.h"