X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fbin%2Flttng-sessiond%2Fmain.c;h=6c890f1e22424e9da9d75077ac3db5818a26ab7a;hb=8ff7624a471a53c1461e6c327ab62ef703feb174;hp=125a18769107269322813923d438e51f062694ae;hpb=6fa7f7c2613087074ae68cafce9a024d57720a51;p=deliverable%2Flttng-tools.git diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 125a18769..6c890f1e2 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -90,6 +90,7 @@ static pid_t ppid; /* Parent PID for --sig-parent option */ static pid_t child_ppid; /* Internal parent PID use with daemonize. */ static char *rundir; static int lockfile_fd = -1; +static int opt_print_version; /* Set to 1 when a SIGUSR1 signal is received. */ static int recv_child_signal; @@ -4760,8 +4761,7 @@ static int set_option(int opt, const char *arg, const char *optname) } exit(ret ? EXIT_FAILURE : EXIT_SUCCESS); } else if (string_match(optname, "version") || opt == 'V') { - fprintf(stdout, "%s\n", VERSION); - exit(EXIT_SUCCESS); + opt_print_version = 1; } else if (string_match(optname, "sig-parent") || opt == 'S') { opt_sig_parent = 1; } else if (string_match(optname, "kconsumerd-err-sock")) { @@ -5101,6 +5101,20 @@ end: return ret; } +static void sessiond_config_log(void) +{ + DBG("LTTng-sessiond " 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-sessiond extra version description:\n\t" EXTRA_VERSION_DESCRIPTION "\n"); + } +} + +static void print_version(void) { + fprintf(stdout, "%s\n", VERSION); +} + /* * daemon configuration loading and argument parsing */ @@ -5675,6 +5689,14 @@ int main(int argc, char **argv) goto exit_options; } + sessiond_config_log(); + + if (opt_print_version) { + print_version(); + retval = 0; + goto exit_options; + } + ret = set_clock_plugin_env(); if (ret) { retval = -1;