X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-relayd%2Fmain.c;h=1c272c392cd5cdc135d79ec442ea42e7a4653257;hp=6720eca9687f6d9633dc9c5928eb904a2ab36d89;hb=a3bc3918a3e9f219cc54adcc41dd6b37381b30ff;hpb=2ebe596e3e57e57220afae2b4499aff6348ce3a7 diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index 6720eca96..1c272c392 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -62,6 +62,7 @@ #include #include +#include "version.h" #include "cmd.h" #include "ctf-trace.h" #include "index.h" @@ -96,7 +97,7 @@ enum relay_connection_status { /* command line options */ char *opt_output_path; -static int opt_daemon, opt_background; +static int opt_daemon, opt_background, opt_print_version; /* * We need to wait for listener and live listener threads, as well as @@ -188,6 +189,20 @@ static struct option long_options[] = { static const char *config_ignore_options[] = { "help", "config", "version" }; +static void print_version(void) { + fprintf(stdout, "%s\n", VERSION); +} + +static void relayd_config_log(void) +{ + DBG("LTTng-relayd " VERSION " - " VERSION_NAME "%s%s", + GIT_VERSION[0] == '\0' ? "" : " - " GIT_VERSION, + EXTRA_VERSION_NAME[0] == '\0' ? "" : " - " EXTRA_VERSION_NAME); + if (EXTRA_VERSION_DESCRIPTION[0] != '\0') { + DBG("LTTng-relayd extra version description:\n\t" EXTRA_VERSION_DESCRIPTION "\n"); + } +} + /* * Take an option from the getopt output and set it in the right variable to be * used later. @@ -278,8 +293,8 @@ static int set_option(int opt, const char *arg, const char *optname) } exit(EXIT_FAILURE); case 'V': - fprintf(stdout, "%s\n", VERSION); - exit(EXIT_SUCCESS); + opt_print_version = 1; + break; case 'o': if (lttng_is_setuid_setgid()) { WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.", @@ -3665,6 +3680,14 @@ int main(int argc, char **argv) goto exit_options; } + relayd_config_log(); + + if (opt_print_version) { + print_version(); + retval = 0; + goto exit_options; + } + /* Try to create directory if -o, --output is specified. */ if (opt_output_path) { if (*opt_output_path != '/') {