Cleanup: consumerd: lines over 80 columns
[lttng-tools.git] / src / bin / lttng-consumerd / lttng-consumerd.c
index 5d5703064a110cac4dd8ea389430b878dd8ff302..d0d83988c7beceb6d3196d523260b55feb0a30a9 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #define _GNU_SOURCE
+#define _LGPL_SOURCE
 #include <fcntl.h>
 #include <getopt.h>
 #include <grp.h>
@@ -52,8 +53,6 @@
 #include "lttng-consumerd.h"
 #include "health-consumerd.h"
 
-/* TODO : support UST (all direct kernel-ctl accesses). */
-
 /* threads (channel handling, poll, metadata, sessiond) */
 
 static pthread_t channel_thread, data_thread, metadata_thread,
@@ -123,7 +122,7 @@ static int set_signal_handler(void)
        sigset_t sigset;
 
        if ((ret = sigemptyset(&sigset)) < 0) {
-               perror("sigemptyset");
+               PERROR("sigemptyset");
                return ret;
        }
 
@@ -131,17 +130,17 @@ static int set_signal_handler(void)
        sa.sa_mask = sigset;
        sa.sa_flags = 0;
        if ((ret = sigaction(SIGTERM, &sa, NULL)) < 0) {
-               perror("sigaction");
+               PERROR("sigaction");
                return ret;
        }
 
        if ((ret = sigaction(SIGINT, &sa, NULL)) < 0) {
-               perror("sigaction");
+               PERROR("sigaction");
                return ret;
        }
 
        if ((ret = sigaction(SIGPIPE, &sa, NULL)) < 0) {
-               perror("sigaction");
+               PERROR("sigaction");
                return ret;
        }
 
@@ -185,9 +184,9 @@ static void usage(FILE *fp)
 /*
  * daemon argument parsing
  */
-static void parse_args(int argc, char **argv)
+static int parse_args(int argc, char **argv)
 {
-       int c;
+       int c, ret = 0;
 
        static struct option long_options[] = {
                { "consumerd-cmd-sock", 1, 0, 'c' },
@@ -207,16 +206,20 @@ static void parse_args(int argc, char **argv)
 
        while (1) {
                int option_index = 0;
-               c = getopt_long(argc, argv, "dhqvVku" "c:e:g:", long_options, &option_index);
+               c = getopt_long(argc, argv, "dhqvVku" "c:e:g:",
+                               long_options, &option_index);
                if (c == -1) {
                        break;
                }
 
                switch (c) {
                case 0:
-                       fprintf(stderr, "option %s", long_options[option_index].name);
+                       fprintf(stderr, "option %s",
+                               long_options[option_index].name);
                        if (optarg) {
                                fprintf(stderr, " with arg %s\n", optarg);
+                               ret = -1;
+                               goto end;
                        }
                        break;
                case 'c':
@@ -259,9 +262,12 @@ static void parse_args(int argc, char **argv)
 #endif
                default:
                        usage(stderr);
-                       exit(EXIT_FAILURE);
+                       ret = -1;
+                       goto end;
                }
        }
+end:
+       return ret;
 }
 
 /*
This page took 0.024123 seconds and 4 git commands to generate.