* [ltt-dev] [PATCH 1/1] Fix compilation on uclibc
@ 2011-06-13 6:49 Dexuan Cui
2011-06-13 14:25 ` Mathieu Desnoyers
[not found] ` <BLU0-SMTP35DED9EACFA9202779957696690@phx.gbl>
0 siblings, 2 replies; 5+ messages in thread
From: Dexuan Cui @ 2011-06-13 6:49 UTC (permalink / raw)
The origin of the patch is
http://git.pokylinux.org/cgit/cgit.cgi/poky/commit/?id=196f689f63f363b245634131c94fd10e6e84b604
"
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 at gmail.com>
"
I applied it to ust 0.14 and tested it.
Signed-off-by: Dexuan Cui <dexuan.cui at intel.com>
---
libust/tracer.h | 10 ++++++++++
libustcomm/ustcomm.c | 1 -
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/libust/tracer.h b/libust/tracer.h
index 03049aa..4013471 100644
--- a/libust/tracer.h
+++ b/libust/tracer.h
@@ -344,13 +344,23 @@ static __inline__ void ltt_write_trace_header(struct ust_trace *trace,
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;
/*
diff --git a/libustcomm/ustcomm.c b/libustcomm/ustcomm.c
index 3c7c0bb..07f7f87 100644
--- a/libustcomm/ustcomm.c
+++ b/libustcomm/ustcomm.c
@@ -33,7 +33,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <execinfo.h>
#include "ustcomm.h"
#include "usterr.h"
--
1.7.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ltt-dev] [PATCH 1/1] Fix compilation on uclibc
2011-06-13 6:49 [ltt-dev] [PATCH 1/1] Fix compilation on uclibc Dexuan Cui
@ 2011-06-13 14:25 ` Mathieu Desnoyers
[not found] ` <BLU0-SMTP35DED9EACFA9202779957696690@phx.gbl>
1 sibling, 0 replies; 5+ messages in thread
From: Mathieu Desnoyers @ 2011-06-13 14:25 UTC (permalink / raw)
* Dexuan Cui (dexuan.cui at intel.com) wrote:
> The origin of the patch is
> http://git.pokylinux.org/cgit/cgit.cgi/poky/commit/?id=196f689f63f363b245634131c94fd10e6e84b604
> "
> 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 at gmail.com>
> "
>
> I applied it to ust 0.14 and tested it.
>
> Signed-off-by: Dexuan Cui <dexuan.cui at intel.com>
Hi Dexuan,
> ---
> libust/tracer.h | 10 ++++++++++
> libustcomm/ustcomm.c | 1 -
> 2 files changed, 10 insertions(+), 1 deletions(-)
>
> diff --git a/libust/tracer.h b/libust/tracer.h
> index 03049aa..4013471 100644
> --- a/libust/tracer.h
> +++ b/libust/tracer.h
> @@ -344,13 +344,23 @@ static __inline__ void ltt_write_trace_header(struct ust_trace *trace,
> 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
I am going for an approach less intrusive into the code:
adding ust/compat.h with the sched_getcpu wrapper, and including it into
tracer.h: commit 0a2aba1397f90fa65c293ab856d18579ae14b77f
> cpu = sched_getcpu();
> +#endif
> if (likely(cpu >= 0))
> return cpu;
> /*
> diff --git a/libustcomm/ustcomm.c b/libustcomm/ustcomm.c
> index 3c7c0bb..07f7f87 100644
> --- a/libustcomm/ustcomm.c
> +++ b/libustcomm/ustcomm.c
> @@ -33,7 +33,6 @@
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> -#include <execinfo.h>
I created a separate commit for this one:
5c3950f8809ce2c5272fdbfa27b606f648b485fb
Testing on uclibc would be very welcome.
Thanks,
Mathieu
>
> #include "ustcomm.h"
> #include "usterr.h"
> --
> 1.7.2
>
>
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
>
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ltt-dev] [PATCH 1/1] Fix compilation on uclibc
[not found] ` <BLU0-SMTP35DED9EACFA9202779957696690@phx.gbl>
@ 2011-06-13 16:05 ` Cui, Dexuan
2011-06-13 16:30 ` Mathieu Desnoyers
[not found] ` <BLU0-SMTP75B31C33200C11B9D8DED296690@phx.gbl>
0 siblings, 2 replies; 5+ messages in thread
From: Cui, Dexuan @ 2011-06-13 16:05 UTC (permalink / raw)
Mathieu Desnoyers wrote:
> * Dexuan Cui (dexuan.cui at intel.com) wrote:
>
> I am going for an approach less intrusive into the code:
>
> adding ust/compat.h with the sched_getcpu wrapper, and including it
> into tracer.h: commit 0a2aba1397f90fa65c293ab856d18579ae14b77f
Hi Mathieu,
Sorry, actually it's my first time to submit patch to ust -- where is the commit 0a2aba139?
I can't find it in git://git.lttng.org/ust.git.
>
>> cpu = sched_getcpu();
>> +#endif
>> if (likely(cpu >= 0))
>> return cpu;
>> /*
>> diff --git a/libustcomm/ustcomm.c b/libustcomm/ustcomm.c
>> index 3c7c0bb..07f7f87 100644
>> --- a/libustcomm/ustcomm.c
>> +++ b/libustcomm/ustcomm.c
>> @@ -33,7 +33,6 @@
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <string.h>
>> -#include <execinfo.h>
>
> I created a separate commit for this one:
>
> 5c3950f8809ce2c5272fdbfa27b606f648b485fb
Ditto. I can't find it in git://git.lttng.org/ust.git.
Thanks,
-- Dexuan
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ltt-dev] [PATCH 1/1] Fix compilation on uclibc
2011-06-13 16:05 ` Cui, Dexuan
@ 2011-06-13 16:30 ` Mathieu Desnoyers
[not found] ` <BLU0-SMTP75B31C33200C11B9D8DED296690@phx.gbl>
1 sibling, 0 replies; 5+ messages in thread
From: Mathieu Desnoyers @ 2011-06-13 16:30 UTC (permalink / raw)
* Cui, Dexuan (dexuan.cui at intel.com) wrote:
> Mathieu Desnoyers wrote:
> > * Dexuan Cui (dexuan.cui at intel.com) wrote:
> >
> > I am going for an approach less intrusive into the code:
> >
> > adding ust/compat.h with the sched_getcpu wrapper, and including it
> > into tracer.h: commit 0a2aba1397f90fa65c293ab856d18579ae14b77f
> Hi Mathieu,
> Sorry, actually it's my first time to submit patch to ust -- where is the commit 0a2aba139?
> I can't find it in git://git.lttng.org/ust.git.
My bad, I did not push them into the public repository. You can try
again now.
Thanks,
Mathieu
>
> >
> >> cpu = sched_getcpu();
> >> +#endif
> >> if (likely(cpu >= 0))
> >> return cpu;
> >> /*
> >> diff --git a/libustcomm/ustcomm.c b/libustcomm/ustcomm.c
> >> index 3c7c0bb..07f7f87 100644
> >> --- a/libustcomm/ustcomm.c
> >> +++ b/libustcomm/ustcomm.c
> >> @@ -33,7 +33,6 @@
> >> #include <stdio.h>
> >> #include <stdlib.h>
> >> #include <string.h>
> >> -#include <execinfo.h>
> >
> > I created a separate commit for this one:
> >
> > 5c3950f8809ce2c5272fdbfa27b606f648b485fb
> Ditto. I can't find it in git://git.lttng.org/ust.git.
>
> Thanks,
> -- Dexuan
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ltt-dev] [PATCH 1/1] Fix compilation on uclibc
[not found] ` <BLU0-SMTP75B31C33200C11B9D8DED296690@phx.gbl>
@ 2011-06-13 16:40 ` Cui, Dexuan
0 siblings, 0 replies; 5+ messages in thread
From: Cui, Dexuan @ 2011-06-13 16:40 UTC (permalink / raw)
Mathieu Desnoyers wrote:
> * Cui, Dexuan (dexuan.cui at intel.com) wrote:
>> Mathieu Desnoyers wrote:
>>> * Dexuan Cui (dexuan.cui at intel.com) wrote:
>>>
>>> I am going for an approach less intrusive into the code:
>>>
>>> adding ust/compat.h with the sched_getcpu wrapper, and including it
>>> into tracer.h: commit 0a2aba1397f90fa65c293ab856d18579ae14b77f
>> Hi Mathieu,
>> Sorry, actually it's my first time to submit patch to ust -- where
>> is the commit 0a2aba139? I can't find it in
>> git://git.lttng.org/ust.git.
>
> My bad, I did not push them into the public repository. You can try
> again now.
Yes, now I can see the 2 commits. I think they're fine.
Thanks for making a better patch!
Thanks,
-- Dexuan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-06-13 16:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-13 6:49 [ltt-dev] [PATCH 1/1] Fix compilation on uclibc Dexuan Cui
2011-06-13 14:25 ` Mathieu Desnoyers
[not found] ` <BLU0-SMTP35DED9EACFA9202779957696690@phx.gbl>
2011-06-13 16:05 ` Cui, Dexuan
2011-06-13 16:30 ` Mathieu Desnoyers
[not found] ` <BLU0-SMTP75B31C33200C11B9D8DED296690@phx.gbl>
2011-06-13 16:40 ` Cui, Dexuan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox