X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-app.c;h=4912ca6c6193f0b01bb1363cd04e3e0f8d7d910b;hp=255a41b0d7ca46bd0ec7da805065f33c1d399c35;hb=5f8df26c87554736946f4e8f163bb070ee68c2cd;hpb=b4ffad324a026cc7bc66a98c5c163f1a3b100e95 diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index 255a41b0d..4912ca6c6 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); @@ -1431,8 +1480,11 @@ static void shadow_copy_event(struct ust_app_event *ua_event, exclusion_alloc_size = sizeof(struct lttng_ust_event_exclusion) + LTTNG_UST_SYM_NAME_LEN * uevent->exclusion->count; ua_event->exclusion = zmalloc(exclusion_alloc_size); - if (ua_event->exclusion) { - memcpy(ua_event->exclusion, uevent->exclusion, exclusion_alloc_size); + if (ua_event->exclusion == NULL) { + PERROR("malloc"); + } else { + memcpy(ua_event->exclusion, uevent->exclusion, + exclusion_alloc_size); } } }