}
/* Same layout. */
uevent->filter = (struct lttng_ust_filter_bytecode *) bytecode;
+ uevent->filter->seqnum = usess->filter_seq_num;
switch (domain) {
case LTTNG_DOMAIN_UST:
if (ret < 0) {
goto error;
}
+ usess->filter_seq_num++;
break;
default:
ret = -ENOSYS;
* Add UST context to tracer.
*/
int filter_ust_set(struct ltt_ust_session *usess, int domain,
- struct lttng_filter_bytecode *bytecode, char *event_name,
+ struct lttng_filter_bytecode *bytecode, struct lttng_event *event,
char *channel_name)
{
- int ret = LTTCOMM_OK, have_event = 0;
+ int ret = LTTNG_OK, have_event = 0;
struct lttng_ht_iter iter;
struct lttng_ht *chan_ht;
struct ltt_ust_channel *uchan = NULL;
case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN:
#endif
default:
- ret = LTTCOMM_UND;
+ ret = LTTNG_ERR_UND;
goto error;
}
- /* Do we have an event name */
- if (strlen(event_name) != 0) {
+ /* Do we have a valid event. */
+ if (event && event->name[0] != '\0') {
have_event = 1;
}
if (strlen(channel_name) != 0) {
uchan = trace_ust_find_channel_by_name(chan_ht, channel_name);
if (uchan == NULL) {
- ret = LTTCOMM_UST_CHAN_NOT_FOUND;
+ ret = LTTNG_ERR_UST_CHAN_NOT_FOUND;
goto error;
}
}
/* If UST channel specified and event name, get UST event ref */
if (uchan && have_event) {
- uevent = trace_ust_find_event_by_name(uchan->events, event_name);
+ uevent = trace_ust_find_event_by_name(uchan->events, event->name);
if (uevent == NULL) {
- ret = LTTCOMM_UST_EVENT_NOT_FOUND;
+ ret = LTTNG_ERR_UST_EVENT_NOT_FOUND;
goto error;
}
}
bytecode);
} else if (uchan && !have_event) { /* Add filter to channel */
ERR("Cannot add filter to channel");
- ret = LTTCOMM_FATAL; /* not supported. */
+ ret = LTTNG_ERR_FATAL; /* not supported. */
goto error;
} else if (!uchan && have_event) { /* Add filter to event */
/* Add context to event without having the channel name */
cds_lfht_for_each_entry(chan_ht->ht, &iter.iter, uchan, node.node) {
- uevent = trace_ust_find_event_by_name(uchan->events, event_name);
+ uevent = trace_ust_find_event_by_name(uchan->events, event->name);
if (uevent != NULL) {
ret = add_ufilter_to_event(usess, domain, uchan, uevent, bytecode);
/*
goto end;
}
}
- ret = LTTCOMM_UST_EVENT_NOT_FOUND;
+ ret = LTTNG_ERR_UST_EVENT_NOT_FOUND;
goto error;
} else if (!uchan && !have_event) { /* Add filter all events, all channels */
ERR("Cannot add filter to channel");
- ret = LTTCOMM_FATAL; /* not supported. */
+ ret = LTTNG_ERR_FATAL; /* not supported. */
goto error;
}
end:
+ /* Must handle both local internal error and UST code. */
switch (ret) {
case -EEXIST:
- ret = LTTCOMM_FILTER_EXIST;
+ case -LTTNG_UST_ERR_EXIST:
+ ret = LTTNG_ERR_FILTER_EXIST;
break;
case -ENOMEM:
- ret = LTTCOMM_FATAL;
+ ret = LTTNG_ERR_FATAL;
break;
case -EINVAL:
- ret = LTTCOMM_FILTER_INVAL;
+ case -LTTNG_UST_ERR_INVAL:
+ ret = LTTNG_ERR_FILTER_INVAL;
break;
case -ENOSYS:
- ret = LTTCOMM_UNKNOWN_DOMAIN;
+ case -LTTNG_UST_ERR_NOSYS:
+ ret = LTTNG_ERR_UNKNOWN_DOMAIN;
break;
default:
- ret = LTTCOMM_OK;
+ ret = LTTNG_OK;
break;
}