From 8d5c808ee207d6da2e82f225ee014faa8eee0f87 Mon Sep 17 00:00:00 2001 From: Anik Mishra Date: Tue, 7 Jan 2014 16:11:28 -0500 Subject: [PATCH] Fix: relayd cmd line option for live port Signed-off-by: David Goulet --- doc/man/lttng-relayd.8 | 3 +++ src/bin/lttng-relayd/main.c | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/man/lttng-relayd.8 b/doc/man/lttng-relayd.8 index 1d1802a4c..76d8ee357 100644 --- a/doc/man/lttng-relayd.8 +++ b/doc/man/lttng-relayd.8 @@ -56,6 +56,9 @@ Control port URL (tcp://0.0.0.0:5342 is the default) .BR "-D, --data-port" Data port URL (tcp://0.0.0.0:5343 is the default) .TP +.BR "-L, --live-port URL" +Live view port URL (tcp://0.0.0.0:5344 is the default). +.TP .BR "-o, --output" Output base directory. Must use an absolute path (~/lttng-traces is the default) .TP diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index 71d11ebdf..b46c16280 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -129,6 +129,7 @@ struct health_app *health_relayd; static struct option long_options[] = { { "control-port", 1, 0, 'C', }, { "data-port", 1, 0, 'D', }, + { "live-port", 1, 0, 'L', }, { "daemonize", 0, 0, 'd', }, { "group", 1, 0, 'g', }, { "help", 0, 0, 'h', }, @@ -151,6 +152,7 @@ void usage(void) fprintf(stderr, " -d, --daemonize Start as a daemon.\n"); fprintf(stderr, " -C, --control-port URL Control port listening.\n"); fprintf(stderr, " -D, --data-port URL Data port listening.\n"); + fprintf(stderr, " -L, --live-port URL Live view port listening.\n"); fprintf(stderr, " -o, --output PATH Output path for traces. Must use an absolute path.\n"); fprintf(stderr, " -v, --verbose Verbose mode. Activate DBG() macro.\n"); fprintf(stderr, " -g, --group NAME Specify the tracing group name. (default: tracing)\n"); @@ -195,6 +197,16 @@ int set_option(int opt, const char *arg, const char *optname) data_uri->port = DEFAULT_NETWORK_DATA_PORT; } break; + case 'L': + ret = uri_parse(arg, &live_uri); + if (ret < 0) { + ERR("Invalid live URI specified"); + goto end; + } + if (live_uri->port == 0) { + live_uri->port = DEFAULT_NETWORK_VIEWER_PORT; + } + break; case 'd': opt_daemon = 1; break; @@ -416,6 +428,7 @@ void cleanup(void) uri_free(control_uri); uri_free(data_uri); + /* Live URI is freed in the live thread. */ if (tracing_group_name_override) { free((void *) tracing_group_name); @@ -2727,7 +2740,7 @@ int main(int argc, char **argv) /* Check if daemon is UID = 0 */ if (relayd_uid == 0) { - if (control_uri->port < 1024 || data_uri->port < 1024) { + if (control_uri->port < 1024 || data_uri->port < 1024 || live_uri->port < 1024) { ERR("Need to be root to use ports < 1024"); ret = -1; goto exit; -- 2.34.1