X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=liblttngctl%2Fliblttngctl.c;h=bd7dcb0c5b6f87cd146a8ceb2c5e064892a621ee;hb=aaf975194bf54e911e7464b3723b2f247dbeb78b;hp=fda45ae10d2bc423dea61b94f3a2521c5c074b0c;hpb=e8f07c636c9943a0e2a48113bb8135a6c4f5ebd7;p=lttng-tools.git diff --git a/liblttngctl/liblttngctl.c b/liblttngctl/liblttngctl.c index fda45ae10..bd7dcb0c5 100644 --- a/liblttngctl/liblttngctl.c +++ b/liblttngctl/liblttngctl.c @@ -35,6 +35,7 @@ static char sessiond_sock_path[PATH_MAX]; /* Communication structure to ltt-sessiond */ static struct lttcomm_session_msg lsm; +static struct lttcomm_lttng_msg llm; /* Prototypes */ static int check_tracing_group(const char *grp_name); @@ -109,7 +110,6 @@ static int ask_sessiond(enum lttcomm_command_type lct, void **buf) int ret; size_t size; void *data = NULL; - struct lttcomm_lttng_msg llm; lsm.cmd_type = lct; @@ -188,6 +188,34 @@ int lttng_ust_list_apps(pid_t **pids) return ret / sizeof(pid_t); } +/* + * lttng_create_session + * + * Create a brand new session using name. Allocate + * the session_id param pointing to the UUID. + */ +int lttng_create_session(char *name, char **session_id) +{ + int ret; + char *uuid; + + strncpy(lsm.session_name, name, sizeof(lsm.session_name)); + + ret = ask_sessiond(LTTNG_CREATE_SESSION, NULL); + if (ret < 0) { + goto end; + } + + /* Allocate UUID string length */ + uuid = malloc(UUID_STR_LEN); + + strncpy(uuid, llm.session_id, UUID_STR_LEN); + *session_id = uuid; + +end: + return ret; +} + /* * lttng_list_sessions *