X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=liblttng-ust%2Fltt-events.c;h=2595ea89b11fd89e8cbfa375a00588eb15b98c86;hb=8c12a40c4649401a53d868d1cf24619a05d3f81b;hp=fc7dfc7c78a7334f6676e8b6ac9b2242a3bae855;hpb=c1fca4572d4458b2e6e96752f9efc595c5f72405;p=lttng-ust.git diff --git a/liblttng-ust/ltt-events.c b/liblttng-ust/ltt-events.c index fc7dfc7c..2595ea89 100644 --- a/liblttng-ust/ltt-events.c +++ b/liblttng-ust/ltt-events.c @@ -14,31 +14,36 @@ #include #include #include -#include -#include -#include #include -#include #include #include #include +#include +#include + +#include +#include +#include +#include + +#include #include -#include -#include "lttng/core.h" + +#include +#include + #include "ltt-tracer.h" #include "ltt-tracer-core.h" -#include "lttng/wait.h" +#include "wait.h" #include "../libringbuffer/shm.h" - -typedef u32 uint32_t; -#include +#include "jhash.h" /* * The sessions mutex is the centralized mutex across UST tracing * control and probe registration. All operations within this file are * called by the communication thread, under ust_lock protection. */ -static DEFINE_MUTEX(sessions_mutex); +static pthread_mutex_t sessions_mutex = PTHREAD_MUTEX_INITIALIZER; void ust_lock(void) { @@ -87,7 +92,7 @@ int add_pending_probe(struct ltt_event *event, const char *name) struct cds_hlist_head *head; struct ust_pending_probe *e; size_t name_len = strlen(name) + 1; - u32 hash = jhash(name, name_len - 1, 0); + uint32_t hash = jhash(name, name_len - 1, 0); head = &pending_probe_table[hash & (PENDING_PROBE_HASH_SIZE - 1)]; e = zmalloc(sizeof(struct ust_pending_probe) + name_len); @@ -126,7 +131,7 @@ int pending_probe_fix_events(const struct lttng_event_desc *desc) struct ust_pending_probe *e; const char *name = desc->name; size_t name_len = strlen(name) + 1; - u32 hash = jhash(name, name_len - 1, 0); + uint32_t hash = jhash(name, name_len - 1, 0); int ret = 0; head = &pending_probe_table[hash & (PENDING_PROBE_HASH_SIZE - 1)]; @@ -293,9 +298,10 @@ struct ltt_channel *ltt_channel_create(struct ltt_session *session, unsigned int switch_timer_interval, unsigned int read_timer_interval, int *shm_fd, int *wait_fd, - uint64_t *memory_map_size) + uint64_t *memory_map_size, + struct ltt_channel *chan_priv_init) { - struct ltt_channel *chan; + struct ltt_channel *chan = NULL; struct ltt_transport *transport; if (session->been_active) @@ -306,21 +312,18 @@ struct ltt_channel *ltt_channel_create(struct ltt_session *session, transport_name); goto notransport; } - chan = zmalloc(sizeof(struct ltt_channel)); - if (!chan) - goto nomem; - chan->session = session; - chan->id = session->free_chan_id++; + chan_priv_init->id = session->free_chan_id++; + chan_priv_init->session = session; /* * Note: the channel creation op already writes into the packet * headers. Therefore the "chan" information used as input * should be already accessible. */ - transport->ops.channel_create("[lttng]", chan, buf_addr, + chan = transport->ops.channel_create("[lttng]", buf_addr, subbuf_size, num_subbuf, switch_timer_interval, read_timer_interval, shm_fd, wait_fd, - memory_map_size); - if (!chan->chan) + memory_map_size, chan_priv_init); + if (!chan) goto create_error; chan->enabled = 1; chan->ops = &transport->ops; @@ -328,8 +331,6 @@ struct ltt_channel *ltt_channel_create(struct ltt_session *session, return chan; create_error: - free(chan); -nomem: notransport: active: return NULL; @@ -341,10 +342,9 @@ active: static void _ltt_channel_destroy(struct ltt_channel *chan) { - chan->ops->channel_destroy(chan); cds_list_del(&chan->list); lttng_destroy_context(chan->ctx); - free(chan); + chan->ops->channel_destroy(chan); } /* @@ -723,7 +723,7 @@ int _ltt_event_metadata_statedump(struct ltt_session *session, ret = lttng_metadata_printf(session, "event {\n" - " name = %s;\n" + " name = \"%s\";\n" " id = %u;\n" " stream_id = %u;\n", event->desc->name,