From: JP Ikaheimonen Date: Tue, 5 Nov 2013 06:23:06 +0000 (+0200) Subject: Set event exclusions in the target when event is created X-Git-Tag: v2.4.0-rc1~24 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=7cc9a73c638bff0a86d7ea802ebd7fa3b4716ca9 Set event exclusions in the target when event is created Add a new function set_ust_event_exclusion() that calls the target-side function that sets the exclusions to an event and reports possible errors. Call set_ust_event_exclusion() in create_ust_event(). --- diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index 255a41b0d..d8adccde2 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -1136,6 +1136,47 @@ error: return ret; } +/* + * Set event exclusions on the tracer. + */ +static +int set_ust_event_exclusion(struct ust_app_event *ua_event, + struct ust_app *app) +{ + int ret; + + health_code_update(); + + if (!ua_event->exclusion || !ua_event->exclusion->count) { + ret = 0; + goto error; + } + + ret = ustctl_set_exclusion(app->sock, ua_event->exclusion, + ua_event->obj); + if (ret < 0) { + if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) { + ERR("UST app event %s exclusions failed for app (pid: %d) " + "with ret %d", ua_event->attr.name, app->pid, ret); + } else { + /* + * This is normal behavior, an application can die during the + * creation process. Don't report an error so the execution can + * continue normally. + */ + ret = 0; + DBG3("UST app event exclusion failed. Application is dead."); + } + goto error; + } + + DBG2("UST exclusion set successfully for event %s", ua_event->name); + +error: + health_code_update(); + return ret; +} + /* * Disable the specified event on to UST tracer for the UST session. */ @@ -1375,6 +1416,14 @@ int create_ust_event(struct ust_app *app, struct ust_app_session *ua_sess, } } + /* Set exclusions for the event */ + if (ua_event->exclusion) { + ret = set_ust_event_exclusion(ua_event, app); + if (ret < 0) { + goto error; + } + } + /* If event not enabled, disable it on the tracer */ if (ua_event->enabled == 0) { ret = disable_ust_event(app, ua_sess, ua_event);