X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=include%2Fust%2Fust_trace.h;h=11d5940c68bed8ae85d1bb9b1f593fd8df9156d3;hb=fbae86d664c12e450d3cb702b602701d37781b41;hp=098c5f8f6f0230e31b28bb157b34e7e0d4ffee68;hpb=22d7294822cce9fdc893b8ab272e322270456ac9;p=lttng-ust.git diff --git a/include/ust/ust_trace.h b/include/ust/ust_trace.h index 098c5f8f..11d5940c 100644 --- a/include/ust/ust_trace.h +++ b/include/ust/ust_trace.h @@ -23,6 +23,8 @@ * to a printf */ +#include + /* * Stage 1. Create a struct and a printf calling function * that is connected to the tracepoint at load time. @@ -58,7 +60,7 @@ struct trace_raw_##name { \ tstruct \ }; \ - static void trace_printf_##name(proto) \ + static void trace_printf_##name(void *dummy, proto) \ { \ struct trace_raw_##name entry_struct, *__entry; \ __entry = &entry_struct; \ @@ -66,10 +68,24 @@ \ printf(print); \ } \ + static inline int register_event_##name(void *data) \ + { \ + return register_trace_##name(trace_printf_##name, data); \ + } \ + static inline int unregister_event_##name(void *data) \ + { \ + return unregister_trace_##name(trace_printf_##name, data); \ + } \ + struct trace_event __event_##name \ + __attribute__((section("__trace_events"), aligned(32))) = { \ + __tpstrtab_##name, \ + register_event_##name, \ + unregister_event_##name \ + }; \ static void __attribute__((constructor)) init_##name() \ { \ - printf("connecting tracepoint " #name "\n"); \ - register_trace_##name(trace_printf_##name); \ + void *dummy = NULL; \ + register_trace_##name(trace_printf_##name, dummy); \ }