ret = ustctl_create_event(app->sock, &ua_event->attr, ua_chan->obj,
&ua_event->obj);
if (ret < 0) {
- if (ret == -EEXIST || ret == -EPERM) {
- ret = 0;
- goto error;
- }
ERR("Error ustctl create event %s for app pid: %d with ret %d",
ua_event->attr.name, app->pid, ret);
goto error;
static int enable_events(char *session_name)
{
int err, ret = CMD_SUCCESS, warn = 0;
+ unsigned int event_enabled = 0;
char *event_name, *channel_name = NULL;
struct lttng_event ev;
struct lttng_domain dom;
}
}
+ /* Reset flag before enabling a new event. */
+ event_enabled = 0;
+
ret = lttng_enable_event(handle, &ev, channel_name);
if (ret < 0) {
switch (-ret) {
}
goto end;
}
+ event_enabled = 1;
switch (opt_event_type) {
case LTTNG_EVENT_TRACEPOINT:
*/
goto error;
}
- if (opt_filter) {
+ if (opt_filter && event_enabled) {
ret = lttng_set_event_filter(handle, ev.name, channel_name,
opt_filter);
if (ret < 0) {
+ fprintf(stderr, "Ret filter: %d\n", ret);
switch (-ret) {
case LTTNG_ERR_FILTER_EXIST:
WARN("Filter on events is already enabled"
goto error;
}
+ /* Reset flag before enabling a new event. */
+ event_enabled = 0;
+
ret = lttng_enable_event(handle, &ev, channel_name);
if (ret < 0) {
/* Turn ret to positive value to handle the positive error code */
} else {
MSG("%s event %s created in channel %s",
opt_kernel ? "kernel": "UST", event_name, channel_name);
+ event_enabled = 1;
}
- if (opt_filter) {
+ if (opt_filter && event_enabled) {
ret = lttng_set_event_filter(handle, ev.name, channel_name,
opt_filter);
if (ret < 0) {