static void version(FILE *ofp)
{
fprintf(ofp, "%s (LTTng Crash Trace Viewer) " VERSION " - " VERSION_NAME
-"%s\n",
+"%s%s\n",
progname,
- GIT_VERSION[0] == '\0' ? "" : " - " GIT_VERSION);
+ GIT_VERSION[0] == '\0' ? "" : " - " GIT_VERSION,
+ EXTRA_VERSION_NAME[0] == '\0' ? "" : " - " EXTRA_VERSION_NAME);
}
/*
#include <common/buffer-view.h>
#include <urcu/rculist.h>
+#include "version.h"
#include "cmd.h"
#include "ctf-trace.h"
#include "index.h"
/* command line options */
char *opt_output_path, *opt_working_directory;
-static int opt_daemon, opt_background;
+static int opt_daemon, opt_background, opt_print_version;
int opt_group_output_by_session;
int opt_group_output_by_host;
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.
}
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.",
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 != '/') {
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;
}
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")) {
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
*/
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;
MSG("\n" VERSION_DESCRIPTION "\n");
MSG("Web site: http://lttng.org");
MSG("\n%s", lttng_license);
+ if (EXTRA_VERSION_NAME[0] != '\0') {
+ MSG("\nExtra version name: " EXTRA_VERSION_NAME);
+ }
+ if (EXTRA_VERSION_DESCRIPTION[0] != '\0') {
+ MSG("\nExtra version description:\n\t" EXTRA_VERSION_DESCRIPTION);
+ }
}
end:
static void version(FILE *ofp)
{
- fprintf(ofp, "%s (LTTng Trace Control) " VERSION" - " VERSION_NAME "%s\n",
+ fprintf(ofp, "%s (LTTng Trace Control) " VERSION" - " VERSION_NAME "%s%s\n",
progname,
- GIT_VERSION[0] == '\0' ? "" : " - " GIT_VERSION);
+ GIT_VERSION[0] == '\0' ? "" : " - " GIT_VERSION,
+ EXTRA_VERSION_NAME[0] == '\0' ? "" : " - " EXTRA_VERSION_NAME);
}
/*