X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Ftrace-ust.c;h=906f916a91b51ceb1b075ff172ef14281583a577;hp=9bc0b73d05cdb80363e159d76d703b102bd88141;hb=2106efa08d11229241a114d1d71635a02006690e;hpb=6addfa379ee608b20cfe5e15d135bcb6a9724e90 diff --git a/src/bin/lttng-sessiond/trace-ust.c b/src/bin/lttng-sessiond/trace-ust.c index 9bc0b73d0..906f916a9 100644 --- a/src/bin/lttng-sessiond/trace-ust.c +++ b/src/bin/lttng-sessiond/trace-ust.c @@ -71,12 +71,14 @@ int trace_ust_ht_match_event(struct cds_lfht_node *node, const void *_key) { struct ltt_ust_event *event; const struct ltt_ust_ht_key *key; + int ev_loglevel_value; assert(node); assert(_key); event = caa_container_of(node, struct ltt_ust_event, node.node); key = _key; + ev_loglevel_value = event->attr.loglevel; /* Match the 4 elements of the key: name, filter, loglevel, exclusions. */ @@ -86,9 +88,9 @@ int trace_ust_ht_match_event(struct cds_lfht_node *node, const void *_key) } /* Event loglevel. */ - if (event->attr.loglevel != key->loglevel) { + if (ev_loglevel_value != key->loglevel_type) { if (event->attr.loglevel_type == LTTNG_UST_LOGLEVEL_ALL - && key->loglevel == 0 && event->attr.loglevel == -1) { + && key->loglevel_type == 0 && ev_loglevel_value == -1) { /* * Match is accepted. This is because on event creation, the * loglevel is set to -1 if the event loglevel type is ALL so 0 and @@ -171,8 +173,8 @@ error: * MUST be acquired before calling this. */ struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht, - char *name, struct lttng_filter_bytecode *filter, int loglevel, - struct lttng_event_exclusion *exclusion) + char *name, struct lttng_filter_bytecode *filter, + int loglevel_value, struct lttng_event_exclusion *exclusion) { struct lttng_ht_node_str *node; struct lttng_ht_iter iter; @@ -183,7 +185,7 @@ struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht, key.name = name; key.filter = filter; - key.loglevel = loglevel; + key.loglevel_type = loglevel_value; key.exclusion = exclusion; cds_lfht_lookup(ht->ht, ht->hash_fct((void *) name, lttng_ht_seed), @@ -788,7 +790,8 @@ int trace_ust_untrack_pid(struct ltt_ust_session *session, int pid) struct ust_app *app; if (!session->pid_tracker.ht) { - retval = LTTNG_ERR_INVALID; + /* No PID being tracked. */ + retval = LTTNG_ERR_PID_NOT_TRACKED; goto end; } /* Remove PID from tracker */ @@ -952,11 +955,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); } @@ -975,6 +973,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); } @@ -1000,18 +1003,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();