X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbin%2Flttng-relayd%2Fmain.c;h=c3c9a4fa667bd38c7ec0d866c402d5bf736d39f3;hb=4d27e2b42ffbca109299388099b03e65b54c1ab3;hp=c171dfdfe41de54b126d8928a680c496e5890e18;hpb=e0884220df0a1e9b64fe353666216cfceb28cd22;p=lttng-tools.git diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index c171dfdfe..c3c9a4fa6 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -85,6 +85,8 @@ enum relay_connection_status { /* command line options */ char *opt_output_path, *opt_working_directory; static int opt_daemon, opt_background; +int opt_group_output_by_session; +int opt_group_output_by_host; /* * We need to wait for listener and live listener threads, as well as @@ -170,6 +172,8 @@ static struct option long_options[] = { { "config", 1, 0, 'f' }, { "version", 0, 0, 'V' }, { "working-directory", 1, 0, 'w', }, + { "group-output-by-session", 0, 0, 's', }, + { "group-output-by-host", 0, 0, 'p', }, { NULL, 0, 0, 0, }, }; @@ -305,6 +309,20 @@ static int set_option(int opt, const char *arg, const char *optname) } } break; + case 's': + if (opt_group_output_by_host) { + ERR("Cannot set --group-output-by-session, --group-output-by-host already defined"); + exit(EXIT_FAILURE); + } + opt_group_output_by_session = 1; + break; + case 'p': + if (opt_group_output_by_session) { + ERR("Cannot set --group-output-by-host, --group-output-by-session already defined"); + exit(EXIT_FAILURE); + } + opt_group_output_by_host = 1; + break; default: /* Unknown option or other error. * Error is printed by getopt, just return */ @@ -502,6 +520,11 @@ static int set_options(int argc, char **argv) } } + if (!opt_group_output_by_session && !opt_group_output_by_host) { + /* Group by host by default */ + opt_group_output_by_host = 1; + } + exit: free(optstring); return retval; @@ -1219,12 +1242,13 @@ static int relay_add_stream(const struct lttcomm_relayd_hdr *recv_hdr, switch (session->minor) { case 1: /* LTTng sessiond 2.1. Allocates path_name and channel_name. */ ret = cmd_recv_stream_2_1(payload, &path_name, - &channel_name); + &channel_name, session); break; case 2: /* LTTng sessiond 2.2. Allocates path_name and channel_name. */ default: ret = cmd_recv_stream_2_2(payload, &path_name, - &channel_name, &tracefile_size, &tracefile_count); + &channel_name, &tracefile_size, &tracefile_count, + session); break; } if (ret < 0) {