Cygwin: Fix multiple loaded instances of liblttng-ust-tracepoint due to dlopen
[lttng-ust.git] / include / lttng / tracepoint.h
index 5bab476b86485a112c98a5ab433fa13ec88cca7d..7d714db84a67b73f56c183a48770be2f776a1586 100644 (file)
@@ -235,49 +235,40 @@ extern struct tracepoint_dlopen tracepoint_dlopen;
                __attribute__((used, section("__tracepoints_ptrs"))) =          \
                        &__tracepoint_##_provider##___##_name;
 
-/*
- * These weak symbols, the constructor, and destructor take care of
- * registering only _one_ instance of the tracepoints per shared-ojbect
- * (or for the whole main program).
- */
 extern struct tracepoint * const __start___tracepoints_ptrs[]
-       __attribute__((weak, visibility("hidden")));
+       __attribute__((visibility("hidden")));
 extern struct tracepoint * const __stop___tracepoints_ptrs[]
-       __attribute__((weak, visibility("hidden")));
+       __attribute__((visibility("hidden")));
 int __tracepoint_registered
-       __attribute__((weak, visibility("hidden")));
+       __attribute__((visibility("hidden")));
 struct tracepoint_dlopen tracepoint_dlopen
-       __attribute__((weak, visibility("hidden")));
+       __attribute__((visibility("hidden")));
 
 static void __attribute__((constructor)) __tracepoints__init(void)
 {
        if (__tracepoint_registered++)
                return;
 
-       tracepoint_dlopen.liblttngust_handle =
-               dlopen("liblttng-ust-tracepoint.so.0", RTLD_NOW | RTLD_GLOBAL);
-       if (!tracepoint_dlopen.liblttngust_handle)
-               return;
        tracepoint_dlopen.tracepoint_register_lib =
                URCU_FORCE_CAST(int (*)(struct tracepoint * const *, int),
-                               dlsym(tracepoint_dlopen.liblttngust_handle,
+                               dlsym(RTLD_DEFAULT,
                                        "tracepoint_register_lib"));
        tracepoint_dlopen.tracepoint_unregister_lib =
                URCU_FORCE_CAST(int (*)(struct tracepoint * const *),
-                               dlsym(tracepoint_dlopen.liblttngust_handle,
+                               dlsym(RTLD_DEFAULT,
                                        "tracepoint_unregister_lib"));
 #ifndef _LGPL_SOURCE
        tracepoint_dlopen.rcu_read_lock_sym_bp =
                URCU_FORCE_CAST(void (*)(void),
-                               dlsym(tracepoint_dlopen.liblttngust_handle,
+                               dlsym(RTLD_DEFAULT,
                                        "tp_rcu_read_lock_bp"));
        tracepoint_dlopen.rcu_read_unlock_sym_bp =
                URCU_FORCE_CAST(void (*)(void),
-                               dlsym(tracepoint_dlopen.liblttngust_handle,
+                               dlsym(RTLD_DEFAULT,
                                        "tp_rcu_read_unlock_bp"));
        tracepoint_dlopen.rcu_dereference_sym_bp =
                URCU_FORCE_CAST(void *(*)(void *p),
-                               dlsym(tracepoint_dlopen.liblttngust_handle,
+                               dlsym(RTLD_DEFAULT,
                                        "tp_rcu_dereference_sym_bp"));
 #endif
        tracepoint_dlopen.tracepoint_register_lib(__start___tracepoints_ptrs,
This page took 0.025107 seconds and 4 git commands to generate.