X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=lttng%2Flttng.c;h=095ebe5e1c898343b86d177bfd39a926115b3090;hp=907984370edf7831e4fdb5b0f8a135345d58b357;hb=5716705821202372fd16168f66f347ba293ef6b4;hpb=53094c051fe98f0d7288e463b2304e0139324f8c;ds=sidebyside diff --git a/lttng/lttng.c b/lttng/lttng.c index 907984370..095ebe5e1 100644 --- a/lttng/lttng.c +++ b/lttng/lttng.c @@ -41,6 +41,7 @@ static char *progname; /* Prototypes */ static int process_client_opt(void); static int process_opt_list_apps(void); +static int process_opt_list_sessions(void); static void sighandler(int sig); static int set_signal_handler(void); @@ -68,6 +69,13 @@ static int process_client_opt(void) } } + if (opt_list_session) { + ret = process_opt_list_sessions(); + if (ret < 0) { + goto end; + } + } + return 0; end: @@ -75,6 +83,37 @@ end: return ret; } +/* + * 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; + struct lttng_session *sess; + + count = lttng_list_sessions(&sess); + if (count < 0) { + ret = count; + goto error; + } + + MSG("Available sessions [Name (uuid)]:"); + for (i = 0; i < count; i++) { + MSG("\tName: %s (uuid: %s)", sess[i].name, sess[i].uuid); + } + + free(sess); + MSG("\nTo select a session, use --session UUID."); + + return 0; + +error: + return ret; +} + /* * process_opt_list_apps *