{
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. */
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) {
+ /* Event loglevel value and type. */
+ if (event->attr.loglevel_type == key->loglevel_type) {
+ /* Same loglevel type. */
+ if (key->loglevel_type != LTTNG_UST_LOGLEVEL_ALL) {
/*
- * 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.
+ * Loglevel value must also match since the loglevel
+ * type is not all.
*/
- } else {
- goto no_match;
+ if (ev_loglevel_value != key->loglevel_value) {
+ goto no_match;
+ }
}
+ } else {
+ /* Loglevel type is different: no 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),
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;
*
* 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;
goto error;
}
+ luc->domain = domain;
+
/* Copy UST channel attributes */
luc->attr.overwrite = chan->attr.overwrite;
luc->attr.subbuf_size = chan->attr.subbuf_size;
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;
goto error;
}
+ lue->internal = internal_event;
+
switch (ev->type) {
case LTTNG_EVENT_PROBE:
lue->attr.instrumentation = LTTNG_UST_PROBE;
/* 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);
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));
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);
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();
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);