Skip to contentSkip to conversation

Add version info to lttng-relayd help

PATCH Jérémie Galarneau 2 participants 2 messages Oct 19, 2016 – Oct 20, 2016 2 messages not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 20 lines · Anders Wallin

lttng-relayd man pages states that the option
-V --version is available, but it it's missing in the code

---
 src/bin/lttng-relayd/main.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
src/bin/lttng-relayd/main.c +1 -0
index ea46ec7..34a9ba1 100644
@@ -161,10 +161,20 @@ static struct option long_options[] = {
        { "output", 1, 0, 'o', },
        { "verbose", 0, 0, 'v', },
        { "config", 1, 0, 'f' },
+       { "version", 0, 0, 'V' },
        { NULL, 0, 0, 0, },
 };
 

src/bin/lttng-relayd/main.c static struct option long_options[] = { · line 176

Quoted 10 lines
src/bin/lttng-relayd/main.c +9 -1
-static const char *config_ignore_options[] = { "help", "config" };
+static const char *config_ignore_options[] = { "help", "config", "version" };
+
+/*
+ * Version info on stderr
+ */
+static void version(void)
+{
+       fprintf(stderr, "%s (LTTng Trace Control) " VERSION" - " VERSION_NAME "\n",
+               progname);

Please use the short version printout, as done in the session daemon. Also, please output to stdout.

See:
https://github.com/lttng/lttng-tools/blob/master/src/bin/lttng-sessiond/main.c#L4686

src/bin/lttng-relayd/main.c static int set_option(int opt, const char *arg, const char *optname) · line 270

Quoted 11 lines
src/bin/lttng-relayd/main.c +4 -0
+}
 
 /*
  * Take an option from the getopt output and set it in the right variable to be
@@ -255,6 +265,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                        perror("exec");
                }
                exit(EXIT_FAILURE);
+       case 'V':
+               version();
+               exit(EXIT_FAILURE);

EXIT_FAILURE -> EXIT_SUCCESS

Thanks,
Jérémie

Quoted 10 lines
src/bin/lttng-relayd/main.c +0 -1
        case 'o':
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
--

2.10.0

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Signature · 7 lines
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
#3 lore raw
In reply to a message not in the archive

Ok, new patch on it's way

/Anders
Anders Wallin

Quoted 68 lines · Jérémie Galarneau
Quoted 20 lines · Anders Wallin

lttng-relayd man pages states that the option
-V --version is available, but it it's missing in the code

---
 src/bin/lttng-relayd/main.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
src/bin/lttng-relayd/main.c +1 -0
index ea46ec7..34a9ba1 100644
@@ -161,10 +161,20 @@ static struct option long_options[] = {
        { "output", 1, 0, 'o', },
        { "verbose", 0, 0, 'v', },
        { "config", 1, 0, 'f' },
+       { "version", 0, 0, 'V' },
        { NULL, 0, 0, 0, },
 };
 

src/bin/lttng-relayd/main.c static struct option long_options[] = { · line 176

Quoted 10 lines
src/bin/lttng-relayd/main.c +9 -1
-static const char *config_ignore_options[] = { "help", "config" };
+static const char *config_ignore_options[] = { "help", "config", "version" };
+
+/*
+ * Version info on stderr
+ */
+static void version(void)
+{
+       fprintf(stderr, "%s (LTTng Trace Control) " VERSION" - " VERSION_NAME "\n",
+               progname);

Please use the short version printout, as done in the session daemon. Also, please output to stdout.

See:
https://github.com/lttng/lttng-tools/blob/master/src/bin/lttng-sessiond/main.c#L4686

src/bin/lttng-relayd/main.c static int set_option(int opt, const char *arg, const char *optname) · line 270

Quoted 11 lines
src/bin/lttng-relayd/main.c +4 -0
+}
 
 /*
  * Take an option from the getopt output and set it in the right variable to be
@@ -255,6 +265,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                        perror("exec");
                }
                exit(EXIT_FAILURE);
+       case 'V':
+               version();
+               exit(EXIT_FAILURE);

EXIT_FAILURE -> EXIT_SUCCESS

Thanks,
Jérémie

Quoted 10 lines
src/bin/lttng-relayd/main.c +0 -1
        case 'o':
                if (lttng_is_setuid_setgid()) {
                        WARN("Getting '%s' argument from setuid/setgid binary refused for security reasons.",
--

2.10.0

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Quoted 4 lines

--
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev