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 <common/string-utils/format.h>
+#include "version.h"
#include "cmd.h"
#include "ctf-trace.h"
#include "index.h"
/* 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
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 != '/') {
const char *progname;
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') {
config.sig_parent = true;
} else if (string_match(optname, "kconsumerd-err-sock")) {
return ret;
}
+static void print_version(void) {
+ fprintf(stdout, "%s\n", VERSION);
+}
+
/*
* daemon configuration loading and argument parsing
*/
sessiond_config_log(&config);
sessiond_uuid_log();
+ if (opt_print_version) {
+ print_version();
+ retval = 0;
+ goto exit_options;
+ }
+
if (create_lttng_rundir()) {
retval = -1;
goto exit_options;
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include "version.h"
#include "sessiond-config.h"
#include <assert.h>
#include "lttng-ust-ctl.h"
void sessiond_config_log(struct sessiond_config *config)
{
DBG_NO_LOC("[sessiond configuration]");
+ DBG_NO_LOC("\tversion %s", VERSION);
+ if (GIT_VERSION[0] != '\0') {
+ DBG_NO_LOC("\tgit version %s", GIT_VERSION);
+ }
+ if (EXTRA_VERSION_NAME[0] != '\0') {
+ DBG_NO_LOC("\textra version name %s", EXTRA_VERSION_NAME);
+ }
+ if (EXTRA_VERSION_DESCRIPTION[0] != '\0') {
+ DBG_NO_LOC("\textra version description:\n\t%s", EXTRA_VERSION_DESCRIPTION);
+ }
DBG_NO_LOC("\tverbose: %i", config->verbose);
DBG_NO_LOC("\tverbose consumer: %i", config->verbose_consumer);
DBG_NO_LOC("\tquiet mode: %s", config->quiet ? "True" : "False");
MSG("\n" VERSION_DESCRIPTION "\n");
MSG("Web site: https://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);
}
/*