Fix: fix deadlock with dlopen() lttng-ust
[lttng-ust.git] / liblttng-ust / ltt-events.c
index f49746e99ff17b1676b8fba02feb1898a6547a04..72e315ec8593bb229f83788a681f84aae3e36147 100644 (file)
@@ -10,6 +10,7 @@
 
 #define _GNU_SOURCE
 #include <stdio.h>
+#include <endian.h>
 #include <urcu/list.h>
 #include <urcu/hlist.h>
 #include <pthread.h>
@@ -22,7 +23,6 @@
 #include <inttypes.h>
 #include <time.h>
 #include <sys/prctl.h>
-#include <lttng/ust-endian.h>
 #include "clock.h"
 
 #include <urcu-bp.h>
@@ -493,7 +493,7 @@ int ltt_event_create(struct ltt_channel *chan,
        struct ltt_event *event;
        int ret = 0;
 
-       if (chan->used_event_id == -1UL) {
+       if (chan->used_event_id == -1U) {
                ret = -ENOMEM;
                goto full;
        }
@@ -1455,3 +1455,16 @@ int ltt_wildcard_disable(struct session_wildcard *wildcard)
        wildcard->enabled = 0;
        return 0;
 }
+
+/*
+ * Take the TLS "fault" in libuuid if dlopen'd, which can take the
+ * dynamic linker mutex, outside of the UST lock, since the UST lock is
+ * taken in constructors, which are called with dynamic linker mutex
+ * held.
+ */
+void lttng_fixup_event_tls(void)
+{
+       unsigned char uuid[37];
+
+       (void) uuid_generate(uuid);
+}
This page took 0.023198 seconds and 4 git commands to generate.