* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#define _GNU_SOURCE
#define _LGPL_SOURCE
#include <stdio.h>
#include <stdlib.h>
{
struct ltt_ust_event *event;
const struct ltt_ust_ht_key *key;
+ int ev_loglevel_value;
+ int ll_match;
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. */
goto no_match;
}
- /* Event loglevel. */
- if (event->attr.loglevel != key->loglevel) {
- if (event->attr.loglevel_type == LTTNG_UST_LOGLEVEL_ALL
- && key->loglevel == 0 && event->attr.loglevel == -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
- * -1 are accepted for this loglevel type since 0 is the one set by
- * the API when receiving an enable event.
- */
- } else {
- goto no_match;
- }
+ /* Event loglevel value and type. */
+ ll_match = loglevels_match(event->attr.loglevel_type,
+ ev_loglevel_value, key->loglevel_type,
+ key->loglevel_value, LTTNG_UST_LOGLEVEL_ALL);
+
+ if (!ll_match) {
+ goto no_match;
}
/* Only one of the filters is NULL, fail. */
* 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,
+ char *name, struct lttng_filter_bytecode *filter,
+ enum lttng_ust_loglevel_type loglevel_type, int loglevel_value,
struct lttng_event_exclusion *exclusion)
{
struct lttng_ht_node_str *node;
key.name = name;
key.filter = filter;
- key.loglevel = loglevel;
+ key.loglevel_type = loglevel_type;
+ key.loglevel_value = loglevel_value;
key.exclusion = exclusion;
cds_lfht_lookup(ht->ht, ht->hash_fct((void *) name, lttng_ht_seed),
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 */
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);
}
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);
}
*/
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();