X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=include%2Flttng%2Ftracepoint.h;h=222169732b6ee87f5563f3c8c2a7044464b0f000;hb=aae88c703374f4b1fbb8a5e7e95591bf8ce3e837;hp=709fadc11db744101ca31656cf297b1f51b2de98;hpb=93ffe3667d076b908015a1e00ce7285da41bf658;p=lttng-ust.git diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h index 709fadc1..22216973 100644 --- a/include/lttng/tracepoint.h +++ b/include/lttng/tracepoint.h @@ -14,10 +14,11 @@ * modified is included with the above copyright notice. */ -#include -#include +#include +#include #include #include /* for dlopen */ +#include #ifdef __cplusplus extern "C" { @@ -37,8 +38,18 @@ extern "C" { * fine too). * Each tuple is also separated by a comma. */ -#define _TP_COMBINE_TOKENS1(_tokena, _tokenb) _tokena##_tokenb -#define _TP_COMBINE_TOKENS(_tokena, _tokenb) _TP_COMBINE_TOKENS1(_tokena, _tokenb) +#define __TP_COMBINE_TOKENS(_tokena, _tokenb) \ + _tokena##_tokenb +#define _TP_COMBINE_TOKENS(_tokena, _tokenb) \ + __TP_COMBINE_TOKENS(_tokena, _tokenb) +#define __TP_COMBINE_TOKENS3(_tokena, _tokenb, _tokenc) \ + _tokena##_tokenb##_tokenc +#define _TP_COMBINE_TOKENS3(_tokena, _tokenb, _tokenc) \ + __TP_COMBINE_TOKENS3(_tokena, _tokenb, _tokenc) +#define __TP_COMBINE_TOKENS4(_tokena, _tokenb, _tokenc, _tokend) \ + _tokena##_tokenb##_tokenc##_tokend +#define _TP_COMBINE_TOKENS4(_tokena, _tokenb, _tokenc, _tokend) \ + __TP_COMBINE_TOKENS4(_tokena, _tokenb, _tokenc, _tokend) /* _TP_EXVAR* extract the var names. */ #define _TP_EXVAR0() @@ -109,10 +120,10 @@ static inline void __tracepoint_cb_##provider##___##name(_TP_ARGS_PROTO(__VA_ARG { \ struct tracepoint_probe *__tp_probe; \ \ - if (!rcu_read_lock_bp) \ + if (!TP_RCU_LINK_TEST()) \ return; \ - rcu_read_lock_bp(); \ - __tp_probe = rcu_dereference_bp(__tracepoint_##provider##___##name.probes); \ + tp_rcu_read_lock_bp(); \ + __tp_probe = tp_rcu_dereference_bp(__tracepoint_##provider##___##name.probes); \ if (caa_unlikely(!__tp_probe)) \ goto end; \ do { \ @@ -123,7 +134,7 @@ static inline void __tracepoint_cb_##provider##___##name(_TP_ARGS_PROTO(__VA_ARG (_TP_ARGS_DATA_VAR(__VA_ARGS__)); \ } while ((++__tp_probe)->func); \ end: \ - rcu_read_unlock_bp(); \ + tp_rcu_read_unlock_bp(); \ } \ static inline void __tracepoint_register_##provider##___##name(char *name, \ void *func, void *data) \ @@ -179,7 +190,7 @@ static void __attribute__((constructor)) __tracepoints__init(void) if (__tracepoint_registered++) return; - liblttngust_handle = dlopen("liblttng-ust.so", RTLD_NOW | RTLD_GLOBAL); + liblttngust_handle = dlopen("liblttng-ust-tracepoint.so.0", RTLD_NOW | RTLD_GLOBAL); if (!liblttngust_handle) return; tracepoint_register_lib = @@ -190,6 +201,20 @@ static void __attribute__((constructor)) __tracepoints__init(void) URCU_FORCE_CAST(int (*)(struct tracepoint * const *), dlsym(liblttngust_handle, "tracepoint_unregister_lib")); +#ifndef _LGPL_SOURCE + tp_rcu_read_lock_bp = + URCU_FORCE_CAST(void (*)(void), + dlsym(liblttngust_handle, + "tp_rcu_read_lock_bp")); + tp_rcu_read_unlock_bp = + URCU_FORCE_CAST(void (*)(void), + dlsym(liblttngust_handle, + "tp_rcu_read_unlock_bp")); + tp_rcu_dereference_sym_bp = + URCU_FORCE_CAST(void *(*)(void *p), + dlsym(liblttngust_handle, + "tp_rcu_dereference_sym_bp")); +#endif tracepoint_register_lib(__start___tracepoints_ptrs, __stop___tracepoints_ptrs - __start___tracepoints_ptrs);