X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=liblttng-ust%2Fltt-events.c;h=ce4c2bb01719baab3b8bbf0f52fded018881bfef;hb=67e5f39161d80ea3d972a37ecf76f45a260c480d;hp=4a0981b630f14bc1691a3f943f86d51f139d37c7;hpb=f194f3b00d042154c35f1f9ec262e25f2cd83b8a;p=lttng-ust.git diff --git a/liblttng-ust/ltt-events.c b/liblttng-ust/ltt-events.c index 4a0981b6..ce4c2bb0 100644 --- a/liblttng-ust/ltt-events.c +++ b/liblttng-ust/ltt-events.c @@ -10,9 +10,11 @@ #define _GNU_SOURCE #include +#include #include #include #include +#include #include #include #include @@ -20,7 +22,7 @@ #include #include #include -#include +#include #include "clock.h" #include @@ -34,8 +36,6 @@ #include #include #include "error.h" -#include "compat.h" -#include "lttng-ust-uuid.h" #include "tracepoint-internal.h" #include "ltt-tracer.h" @@ -44,6 +44,8 @@ #include "../libringbuffer/shm.h" #include "jhash.h" +#define PROCNAME_LEN 17 + /* * The sessions mutex is the centralized mutex across UST tracing * control and probe registration. All operations within this file are @@ -277,7 +279,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++; @@ -295,7 +297,6 @@ void synchronize_trace(void) struct ltt_session *ltt_session_create(void) { struct ltt_session *session; - int ret; session = zmalloc(sizeof(struct ltt_session)); if (!session) @@ -303,10 +304,7 @@ struct ltt_session *ltt_session_create(void) CDS_INIT_LIST_HEAD(&session->chan); CDS_INIT_LIST_HEAD(&session->events); CDS_INIT_LIST_HEAD(&session->wildcards); - ret = lttng_ust_uuid_generate(session->uuid); - if (ret != 0) { - session->uuid[0] = '\0'; - } + uuid_generate(session->uuid); cds_list_add(&session->list, &sessions); return session; } @@ -495,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; } @@ -552,7 +550,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++; @@ -1091,12 +1089,11 @@ static int _ltt_session_metadata_statedump(struct ltt_session *session) { unsigned char *uuid_c = session->uuid; - char uuid_s[LTTNG_UST_UUID_STR_LEN], - clock_uuid_s[LTTNG_UST_UUID_STR_LEN]; + char uuid_s[37], clock_uuid_s[CLOCK_UUID_LEN]; struct ltt_channel *chan; struct ltt_event *event; int ret = 0; - char procname[LTTNG_UST_PROCNAME_LEN] = ""; + char procname[PROCNAME_LEN] = ""; if (!CMM_ACCESS_ONCE(session->active)) return 0; @@ -1150,8 +1147,8 @@ int _ltt_session_metadata_statedump(struct ltt_session *session) goto end; /* ignore error, just use empty string if error. */ - lttng_ust_getprocname(procname); - procname[LTTNG_UST_PROCNAME_LEN - 1] = '\0'; + (void) prctl(PR_GET_NAME, (unsigned long) procname, 0, 0, 0); + procname[PROCNAME_LEN - 1] = '\0'; ret = lttng_metadata_printf(session, "env {\n" " vpid = %d;\n" @@ -1458,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); +}