Backport:
For sessiond add the sessiond_config_log function for verbose
Printing of the version since config-sessiond does not exist in 2.9.
===
Add detailed version information to the debug log of lttng-relayd and
lttng-sessiond.
Append the extra version information at the end of the "version" command
of the lttng binary.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
static void version(FILE *ofp)
{
fprintf(ofp, "%s (LTTng Crash Trace Viewer) " VERSION " - " VERSION_NAME
static void version(FILE *ofp)
{
fprintf(ofp, "%s (LTTng Crash Trace Viewer) " VERSION " - " VERSION_NAME
- 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 <common/buffer-view.h>
#include <urcu/rculist.h>
#include "cmd.h"
#include "ctf-trace.h"
#include "index.h"
#include "cmd.h"
#include "ctf-trace.h"
#include "index.h"
/* command line options */
char *opt_output_path, *opt_working_directory;
/* 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;
int opt_group_output_by_session;
int opt_group_output_by_host;
static const char *config_ignore_options[] = { "help", "config", "version" };
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.
/*
* Take an option from the getopt output and set it in the right variable to be
* used later.
}
exit(EXIT_FAILURE);
case 'V':
}
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.",
case 'o':
if (lttng_is_setuid_setgid()) {
WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
+ 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 != '/') {
/* 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 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;
/* 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') {
}
exit(ret ? EXIT_FAILURE : EXIT_SUCCESS);
} else if (string_match(optname, "version") || opt == 'V') {
- fprintf(stdout, "%s\n", VERSION);
- exit(EXIT_SUCCESS);
} else if (string_match(optname, "sig-parent") || opt == 'S') {
opt_sig_parent = 1;
} else if (string_match(optname, "kconsumerd-err-sock")) {
} else if (string_match(optname, "sig-parent") || opt == 'S') {
opt_sig_parent = 1;
} else if (string_match(optname, "kconsumerd-err-sock")) {
+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
*/
/*
* daemon configuration loading and argument parsing
*/
+ sessiond_config_log();
+
+ if (opt_print_version) {
+ print_version();
+ retval = 0;
+ goto exit_options;
+ }
+
ret = set_clock_plugin_env();
if (ret) {
retval = -1;
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);
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);
+ }
static void version(FILE *ofp)
{
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",
- GIT_VERSION[0] == '\0' ? "" : " - " GIT_VERSION);
+ GIT_VERSION[0] == '\0' ? "" : " - " GIT_VERSION,
+ EXTRA_VERSION_NAME[0] == '\0' ? "" : " - " EXTRA_VERSION_NAME);