Ensure that multiplication of clock offset is done on 64-bit
[lttng-ust.git] / liblttng-ust / ltt-events.c
index e42b6de64314c914a1c67908f128e628bd2b1ad1..2b06f3c0bcb50be40de644158372d25fed82e707 100644 (file)
@@ -1,15 +1,28 @@
 /*
  * ltt-events.c
  *
- * Copyright 2010 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
  * Holds LTTng per-session event registry.
  *
- * Dual LGPL v2.1/GPL v2 license.
+ * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; only
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #define _GNU_SOURCE
 #include <stdio.h>
+#include <endian.h>
 #include <urcu/list.h>
 #include <urcu/hlist.h>
 #include <pthread.h>
@@ -22,7 +35,6 @@
 #include <inttypes.h>
 #include <time.h>
 #include <sys/prctl.h>
-#include <lttng/ust-endian.h>
 #include "clock.h"
 
 #include <urcu-bp.h>
@@ -279,7 +291,7 @@ int pending_probe_fix_events(const struct lttng_event_desc *desc)
                remove_pending_probe(e);
                ret |= __tracepoint_probe_register(name,
                                event->desc->probe_callback,
-                               event);
+                               event, event->desc->signature);
                if (ret)
                        continue;
                event->id = chan->free_event_id++;
@@ -453,7 +465,7 @@ struct ltt_channel *ltt_channel_create(struct ltt_session *session,
         * headers. Therefore the "chan" information used as input
         * should be already accessible.
         */
-       chan = transport->ops.channel_create("[lttng]", buf_addr,
+       chan = transport->ops.channel_create(transport_name, buf_addr,
                        subbuf_size, num_subbuf, switch_timer_interval,
                        read_timer_interval, shm_fd, wait_fd,
                        memory_map_size, chan_priv_init);
@@ -550,7 +562,7 @@ int ltt_event_create(struct ltt_channel *chan,
                if (event->desc) {
                        ret = __tracepoint_probe_register(event_param->name,
                                        event->desc->probe_callback,
-                                       event);
+                                       event, event->desc->signature);
                        if (ret)
                                goto register_error;
                        event->id = chan->free_event_id++;
@@ -1076,7 +1088,7 @@ uint64_t measure_clock_offset(void)
                return 0;
        monotonic[1] = trace_clock_read64();
        offset = (monotonic[0] + monotonic[1]) >> 1;
-       realtime = rts.tv_sec * 1000000000ULL;
+       realtime = (uint64_t) rts.tv_sec * 1000000000ULL;
        realtime += rts.tv_nsec;
        offset = realtime - offset;
        return offset;
@@ -1455,3 +1467,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.023884 seconds and 4 git commands to generate.