X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Ftrace-ust.c;h=b70d63673fd8ed9d275d39066a39be3dc2c04380;hp=2740d0f803a6d3393a2431dac53e85e85f21e846;hb=627cbbe733b1d69d381c536243fac777ba04780f;hpb=a5dfbb9db7ba31913657ed921006b13977b7b426 diff --git a/src/bin/lttng-sessiond/trace-ust.c b/src/bin/lttng-sessiond/trace-ust.c index 2740d0f80..b70d63673 100644 --- a/src/bin/lttng-sessiond/trace-ust.c +++ b/src/bin/lttng-sessiond/trace-ust.c @@ -30,6 +30,7 @@ #include "trace-ust.h" #include "utils.h" #include "ust-app.h" +#include "agent.h" /* * Match function for the events hash table lookup. @@ -283,14 +284,6 @@ struct ltt_ust_session *trace_ust_create_session(uint64_t session_id) goto error_consumer; } - /* - * The tmp_consumer stays NULL until a set_consumer_uri command is - * executed. At this point, the consumer should be nullify until an - * enable_consumer command. This assignment is symbolic since we've zmalloc - * the struct. - */ - lus->tmp_consumer = NULL; - DBG2("UST trace session create successful"); return lus; @@ -308,7 +301,8 @@ error: * * Return pointer to structure or NULL. */ -struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *chan) +struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *chan, + enum lttng_domain_type domain) { struct ltt_ust_channel *luc; @@ -320,6 +314,8 @@ struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *chan) goto error; } + luc->domain = domain; + /* Copy UST channel attributes */ luc->attr.overwrite = chan->attr.overwrite; luc->attr.subbuf_size = chan->attr.subbuf_size; @@ -374,7 +370,8 @@ error: struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev, char *filter_expression, struct lttng_filter_bytecode *filter, - struct lttng_event_exclusion *exclusion) + struct lttng_event_exclusion *exclusion, + bool internal_event) { struct ltt_ust_event *lue; @@ -386,6 +383,8 @@ struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev, goto error; } + lue->internal = internal_event; + switch (ev->type) { case LTTNG_EVENT_PROBE: lue->attr.instrumentation = LTTNG_UST_PROBE; @@ -428,8 +427,8 @@ struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev, /* Same layout. */ lue->filter_expression = filter_expression; - lue->filter = (struct lttng_ust_filter_bytecode *) filter; - lue->exclusion = (struct lttng_event_exclusion *) exclusion; + lue->filter = filter; + lue->exclusion = exclusion; /* Init node */ lttng_ht_node_init_str(&lue->node, lue->attr.name); @@ -655,7 +654,7 @@ int pid_tracker_add_pid(struct ust_pid_tracker *pid_tracker, int pid) tracker_node = pid_tracker_lookup(pid_tracker, pid, &iter); if (tracker_node) { /* Already exists. */ - retval = LTTNG_ERR_INVALID; + retval = LTTNG_ERR_PID_TRACKED; goto end; } tracker_node = zmalloc(sizeof(*tracker_node)); @@ -683,7 +682,7 @@ int pid_tracker_del_pid(struct ust_pid_tracker *pid_tracker, int pid) tracker_node = pid_tracker_lookup(pid_tracker, pid, &iter); if (!tracker_node) { /* Not found */ - retval = LTTNG_ERR_INVALID; + retval = LTTNG_ERR_PID_NOT_TRACKED; goto end; } ret = lttng_ht_del(pid_tracker->ht, &iter); @@ -953,11 +952,6 @@ static void _trace_ust_destroy_channel(struct ltt_ust_channel *channel) DBG2("Trace destroy UST channel %s", channel->name); - /* Destroying all events of the channel */ - destroy_events(channel->events); - /* Destroying all context of the channel */ - destroy_contexts(channel->ctx); - free(channel); } @@ -976,6 +970,11 @@ static void destroy_channel_rcu(struct rcu_head *head) void trace_ust_destroy_channel(struct ltt_ust_channel *channel) { + /* Destroying all events of the channel */ + destroy_events(channel->events); + /* Destroying all context of the channel */ + destroy_contexts(channel->ctx); + call_rcu(&channel->node.head, destroy_channel_rcu); } @@ -1001,18 +1000,18 @@ void trace_ust_delete_channel(struct lttng_ht *ht, */ static void destroy_channels(struct lttng_ht *channels) { - int ret; struct lttng_ht_node_str *node; struct lttng_ht_iter iter; assert(channels); rcu_read_lock(); - cds_lfht_for_each_entry(channels->ht, &iter.iter, node, node) { - ret = lttng_ht_del(channels, &iter); - assert(!ret); - call_rcu(&node->head, destroy_channel_rcu); + struct ltt_ust_channel *chan = + caa_container_of(node, struct ltt_ust_channel, node); + + trace_ust_delete_channel(channels, chan); + trace_ust_destroy_channel(chan); } rcu_read_unlock(); @@ -1066,8 +1065,7 @@ void trace_ust_destroy_session(struct ltt_ust_session *session) buffer_reg_uid_destroy(reg, session->consumer); } - consumer_destroy_output(session->consumer); - consumer_destroy_output(session->tmp_consumer); + consumer_output_put(session->consumer); fini_pid_tracker(&session->pid_tracker);