From a6a062a46f55ed7629ac718cf36c2e6b010e9eaf 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 Conflicts: src/bin/lttng-relayd/main.c --- doc/man/lttng-relayd.8 | 3 +++ src/bin/lttng-relayd/main.c | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) 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 a6b408a90..01111e2b2 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -132,6 +132,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"); @@ -157,7 +158,7 @@ int parse_args(int argc, char **argv) while (1) { int option_index = 0; - c = getopt_long(argc, argv, "dhv" "C:D:o:g:", + c = getopt_long(argc, argv, "dhv" "C:D:L:o:g:", long_options, &option_index); if (c == -1) { break; @@ -190,6 +191,16 @@ int parse_args(int argc, char **argv) data_uri->port = DEFAULT_NETWORK_DATA_PORT; } break; + case 'L': + ret = uri_parse(optarg, &live_uri); + if (ret < 0) { + ERR("Invalid live URI specified"); + goto exit; + } + if (live_uri->port == 0) { + live_uri->port = DEFAULT_NETWORK_VIEWER_PORT; + } + break; case 'd': opt_daemon = 1; break; @@ -285,6 +296,7 @@ void cleanup(void) uri_free(control_uri); uri_free(data_uri); + /* Live URI is freed in the live thread. */ } /* @@ -2592,7 +2604,8 @@ 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