X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-app.c;h=c00dd2877fd08d1aed942ac1fce52ab4ff25d3c8;hp=d249762a4299ea8123e13240c786b243928c66d4;hb=783db3166036b959e842c9238eb67d338823ab40;hpb=b623cb6a788d9e666d9a93658ab04b06458863ef diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index d249762a4..c00dd2877 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -4006,6 +4006,16 @@ int ust_app_version(struct ust_app *app) return ret; } +bool ust_app_supports_notifiers(const struct ust_app *app) +{ + return app->v_major >= 9; +} + +bool ust_app_supports_counters(const struct ust_app *app) +{ + return app->v_major >= 9; +} + /* * Setup the base event notifier group. * @@ -4022,6 +4032,11 @@ int ust_app_setup_event_notifier_group(struct ust_app *app) assert(app); + if (!ust_app_supports_notifiers(app)) { + ret = -ENOSYS; + goto error; + } + /* Get the write side of the pipe. */ event_pipe_write_fd = lttng_pipe_get_writefd( app->event_notifier_group.event_pipe); @@ -4071,14 +4086,20 @@ int ust_app_setup_event_notifier_group(struct ust_app *app) event_notifier_error_accounting_status = event_notifier_error_accounting_register_app(app); - if (event_notifier_error_accounting_status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) { - if (event_notifier_error_accounting_status == EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_APP_DEAD) { - DBG3("Failed to setup event notifier error accounting (application is dead): app socket fd = %d", - app->sock); - ret = 0; - goto error_accounting; - } - + switch (event_notifier_error_accounting_status) { + case EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK: + break; + case EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_UNSUPPORTED: + DBG3("Failed to setup event notifier error accounting (application does not support notifier error accounting): app socket fd = %d, app name = '%s', app ppid = %d", + app->sock, app->name, (int) app->ppid); + ret = 0; + goto error_accounting; + case EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_APP_DEAD: + DBG3("Failed to setup event notifier error accounting (application is dead): app socket fd = %d, app name = '%s', app ppid = %d", + app->sock, app->name, (int) app->ppid); + ret = 0; + goto error_accounting; + default: ERR("Failed to setup event notifier error accounting for app"); ret = -1; goto error_accounting; @@ -5655,6 +5676,10 @@ void ust_app_synchronize_event_notifier_rules(struct ust_app *app) struct ust_app_event_notifier_rule *event_notifier_rule; unsigned int count, i; + if (!ust_app_supports_notifiers(app)) { + goto end; + } + /* * Currrently, registering or unregistering a trigger with an * event rule condition causes a full synchronization of the event @@ -5974,7 +5999,7 @@ void ust_app_global_update_event_notifier_rules(struct ust_app *app) DBG2("UST application global event notifier rules update: app = '%s' (ppid: %d)", app->name, app->ppid); - if (!app->compatible) { + if (!app->compatible || !ust_app_supports_notifiers(app)) { return; } @@ -6742,7 +6767,7 @@ enum lttng_error_code ust_app_snapshot_record( memset(pathname, 0, sizeof(pathname)); ret = snprintf(pathname, sizeof(pathname), - DEFAULT_UST_TRACE_DIR "/" DEFAULT_UST_TRACE_UID_PATH, + DEFAULT_UST_TRACE_UID_PATH, reg->uid, reg->bits_per_long); if (ret < 0) { PERROR("snprintf snapshot path"); @@ -6806,7 +6831,7 @@ enum lttng_error_code ust_app_snapshot_record( /* Add the UST default trace dir to path. */ memset(pathname, 0, sizeof(pathname)); - ret = snprintf(pathname, sizeof(pathname), DEFAULT_UST_TRACE_DIR "/%s", + ret = snprintf(pathname, sizeof(pathname), "%s", ua_sess->path); if (ret < 0) { status = LTTNG_ERR_INVALID;