- }
- }
-
- MSG("Kernel traces:");
- for (;i < ret; i++) {
- if (traces[i].type == KERNEL) {
- MSG("\t%d) %s", i, traces[i].name);
- }
- }
-
- free(traces);
-
-error:
- return ret;
-}
-
-/*
- * process_opt_create_session
- *
- * Create a new session using the name pass
- * to the command line.
- */
-static int process_opt_create_session(void)
-{
- int ret;
- uuid_t session_id;
- char str_uuid[37];
-
- ret = lttng_create_session(opt_create_session, &session_id);
- if (ret < 0) {
- goto error;
- }
-
- uuid_unparse(session_id, str_uuid);
-
- MSG("Session created:");
- MSG(" %s (%s)", opt_create_session, str_uuid);
-
-error:
- return ret;
-}
-
-/*
- * extract_short_uuid
- *
- * Extract shorten uuid and copy it to out.
- * Shorten uuid format : '<name>.<short_uuid>'
- */
-static int extract_short_uuid(char *in, char *out)
-{
- char *tok;
-
- tok = strchr(in, '.');
- if (strlen(tok+1) == 8) {
- memcpy(out, tok+1, 8);
- out[9] = '\0';
- return 0;
- }
-
- return -1;
-}
-
-/*
- * shorten_uuid
- *
- * Small function to shorten the 37 bytes long uuid_t
- * string representation to 8 characters.
- */
-static void shorten_uuid(char *in, char *out)
-{
- memcpy(out, in, 8);
- out[8] = '\0';
-}
-
-/*
- * process_opt_list_sessions
- *
- * Get the list of available sessions from
- * the session daemon and print it to user.
- */
-static int process_opt_list_sessions(void)
-{
- int ret, count, i;
- char tmp_short_uuid[9];
- struct lttng_session *sess;
-
- count = lttng_list_sessions(&sess);
- DBG("Session count %d", count);
- if (count < 0) {
- ret = count;
- goto error;
- }
-
- MSG("Available sessions (UUIDs):");
- for (i = 0; i < count; i++) {
- shorten_uuid(sess[i].uuid, tmp_short_uuid);
- MSG(" %d) %s.%s", i+1, sess[i].name, tmp_short_uuid);