+ discarded_events_total);
+ } else if (print_lost_packets) {
+ ret = asprintf(&stats_str,
+ "Warning: %" PRIu64
+ " packets were lost, please refer to "
+ "the documentation on channel configuration.",
+ lost_packets_total);
+ } else {
+ ret = 0;
+ }
+
+ if (ret < 0) {
+ ERR("Failed to format lost packet and discarded events statistics");
+ } else {
+ *out_str = stats_str;
+ ret = 0;
+ }
+end:
+ free(sessions);
+ return ret;
+}
+
+int show_cmd_help(const char *cmd_name, const char *help_msg)
+{
+ int ret;
+ char page_name[32];
+
+ ret = sprintf(page_name, "lttng-%s", cmd_name);
+ assert(ret > 0 && ret < 32);
+ ret = utils_show_help(1, page_name, help_msg);
+ if (ret && !help_msg) {
+ ERR("Cannot view man page `lttng-%s(1)`", cmd_name);
+ perror("exec");
+ }
+
+ return ret;
+}
+
+int print_trace_archive_location(
+ const struct lttng_trace_archive_location *location,
+ const char *session_name)
+{
+ int ret = 0;
+ enum lttng_trace_archive_location_type location_type;
+ enum lttng_trace_archive_location_status status;
+ bool printed_location = false;
+
+ location_type = lttng_trace_archive_location_get_type(location);
+
+ _MSG("Trace chunk archive for session %s is now readable",
+ session_name);
+ switch (location_type) {
+ case LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL:
+ {
+ const char *absolute_path;
+
+ status = lttng_trace_archive_location_local_get_absolute_path(
+ location, &absolute_path);
+ if (status != LTTNG_TRACE_ARCHIVE_LOCATION_STATUS_OK) {
+ ret = -1;
+ goto end;
+ }
+ MSG(" at %s", absolute_path);
+ printed_location = true;
+ break;