#define _LGPL_SOURCE
#include <algorithm>
+#include <exception>
#include <inttypes.h>
#include <stdio.h>
#include <sys/stat.h>
const char *session_name;
struct ltt_session *new_session = NULL;
enum lttng_session_descriptor_status descriptor_status;
+ const lttng_trace_format_descriptor *trace_format_descriptor = NULL;
+ lttng::trace_format_descriptor::uptr trace_format_descriptor_ptr;
session_lock_list();
if (home_path) {
goto end;
}
- ret_code = session_create(session_name, creds->uid, creds->gid,
+ descriptor_status = lttng_session_descriptor_get_trace_format_descriptor(
+ descriptor, &trace_format_descriptor);
+ if (descriptor_status != LTTNG_SESSION_DESCRIPTOR_STATUS_OK) {
+ ret_code = LTTNG_ERR_INVALID;
+ goto end;
+ }
+
+ try {
+ trace_format_descriptor_ptr =
+ reinterpret_cast<const lttng::trace_format_descriptor *>(
+ trace_format_descriptor)
+ ->clone();
+ } catch (std::exception& e) {
+ ERR("%s", e.what());
+ ret_code = LTTNG_ERR_UNK;
+ goto end;
+ }
+
+ ret_code = session_create(session_name, creds->uid, creds->gid, trace_format_descriptor_ptr,
&new_session);
if (ret_code != LTTNG_OK) {
goto end;