X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-app.c;h=f3e0209014974f54cf547a91162dcb1c40a246e6;hp=58308dec801f0bef53dedada426ba7bd574e51e8;hb=5da88b0f58d7f838068037ea449ddfb25d3e85ad;hpb=a9dde553270b4e8f3f280706e3f19f8f3ac41e1b diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index 58308dec8..f3e020901 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -1901,12 +1901,12 @@ static void shadow_copy_session(struct ust_app_session *ua_sess, switch (ua_sess->buffer_type) { case LTTNG_BUFFER_PER_PID: ret = snprintf(tmp_shm_path, sizeof(tmp_shm_path), - DEFAULT_UST_TRACE_PID_PATH "/%s-%d-%s", + "/" DEFAULT_UST_TRACE_PID_PATH "/%s-%d-%s", app->name, app->pid, datetime); break; case LTTNG_BUFFER_PER_UID: ret = snprintf(tmp_shm_path, sizeof(tmp_shm_path), - DEFAULT_UST_TRACE_UID_PATH, + "/" DEFAULT_UST_TRACE_UID_PATH, app->uid, app->bits_per_long); break; default: @@ -5921,6 +5921,7 @@ enum lttng_error_code ust_app_snapshot_record( struct buffer_reg_channel *reg_chan; struct consumer_socket *socket; char pathname[PATH_MAX]; + size_t consumer_path_offset = 0; if (!reg->registry->reg.ust->metadata_key) { /* Skip since no metadata is present */ @@ -5936,12 +5937,8 @@ enum lttng_error_code ust_app_snapshot_record( } memset(pathname, 0, sizeof(pathname)); - /* - * DEFAULT_UST_TRACE_UID_PATH already contains a path - * separator. - */ ret = snprintf(pathname, sizeof(pathname), - DEFAULT_UST_TRACE_DIR DEFAULT_UST_TRACE_UID_PATH, + DEFAULT_UST_TRACE_DIR "/" DEFAULT_UST_TRACE_UID_PATH, reg->uid, reg->bits_per_long); if (ret < 0) { PERROR("snprintf snapshot path"); @@ -5950,7 +5947,8 @@ enum lttng_error_code ust_app_snapshot_record( } /* Free path allowed on previous iteration. */ free(trace_path); - trace_path = setup_channel_trace_path(usess->consumer, pathname); + trace_path = setup_channel_trace_path(usess->consumer, pathname, + &consumer_path_offset); if (!trace_path) { status = LTTNG_ERR_INVALID; goto error; @@ -5961,7 +5959,7 @@ enum lttng_error_code ust_app_snapshot_record( status = consumer_snapshot_channel(socket, reg_chan->consumer_key, output, 0, usess->uid, - usess->gid, trace_path, wait, + usess->gid, &trace_path[consumer_path_offset], wait, nb_packets_per_stream); if (status != LTTNG_OK) { goto error; @@ -5969,7 +5967,8 @@ enum lttng_error_code ust_app_snapshot_record( } status = consumer_snapshot_channel(socket, reg->registry->reg.ust->metadata_key, output, 1, - usess->uid, usess->gid, trace_path, wait, 0); + usess->uid, usess->gid, &trace_path[consumer_path_offset], + wait, 0); if (status != LTTNG_OK) { goto error; } @@ -5985,6 +5984,7 @@ enum lttng_error_code ust_app_snapshot_record( struct ust_app_session *ua_sess; struct ust_registry_session *registry; char pathname[PATH_MAX]; + size_t consumer_path_offset = 0; ua_sess = lookup_session_by_app(usess, app); if (!ua_sess) { @@ -6002,7 +6002,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), DEFAULT_UST_TRACE_DIR "/%s", ua_sess->path); if (ret < 0) { status = LTTNG_ERR_INVALID; @@ -6011,7 +6011,8 @@ enum lttng_error_code ust_app_snapshot_record( } /* Free path allowed on previous iteration. */ free(trace_path); - trace_path = setup_channel_trace_path(usess->consumer, pathname); + trace_path = setup_channel_trace_path(usess->consumer, pathname, + &consumer_path_offset); if (!trace_path) { status = LTTNG_ERR_INVALID; goto error; @@ -6024,7 +6025,7 @@ enum lttng_error_code ust_app_snapshot_record( .uid, ua_sess->effective_credentials .gid, - trace_path, wait, + &trace_path[consumer_path_offset], wait, nb_packets_per_stream); switch (status) { case LTTNG_OK: @@ -6045,7 +6046,7 @@ enum lttng_error_code ust_app_snapshot_record( registry->metadata_key, output, 1, ua_sess->effective_credentials.uid, ua_sess->effective_credentials.gid, - trace_path, wait, 0); + &trace_path[consumer_path_offset], wait, 0); switch (status) { case LTTNG_OK: break; @@ -6459,7 +6460,7 @@ enum lttng_error_code ust_app_create_channel_subdirectories( cds_list_for_each_entry(reg, &usess->buffer_reg_uid_list, lnode) { fmt_ret = asprintf(&pathname_index, - DEFAULT_UST_TRACE_DIR DEFAULT_UST_TRACE_UID_PATH "/" DEFAULT_INDEX_DIR, + DEFAULT_UST_TRACE_DIR "/" DEFAULT_UST_TRACE_UID_PATH "/" DEFAULT_INDEX_DIR, reg->uid, reg->bits_per_long); if (fmt_ret < 0) { ERR("Failed to format channel index directory"); @@ -6515,7 +6516,7 @@ enum lttng_error_code ust_app_create_channel_subdirectories( } fmt_ret = asprintf(&pathname_index, - DEFAULT_UST_TRACE_DIR "%s/" DEFAULT_INDEX_DIR, + DEFAULT_UST_TRACE_DIR "/%s/" DEFAULT_INDEX_DIR, ua_sess->path); if (fmt_ret < 0) { ERR("Failed to format channel index directory");