lttng-relayd: implement background cmd line option
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 27 Jan 2014 04:09:41 +0000 (23:09 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 28 Jan 2014 21:20:45 +0000 (16:20 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Conflicts:
src/bin/lttng-relayd/main.c

doc/man/lttng-relayd.8
src/bin/lttng-relayd/main.c

index 045ac7a1095a42ac00b40877caebec2ad33002b0..4c9217a9c46e4871fa48a66de4341f5913c8e376 100644 (file)
@@ -50,6 +50,9 @@ There is three debugging level which will print on stderr. Maximum verbosity is
 .BR "-d, --daemonize"
 Start as a daemon
 .TP
+.BR "-b, --background"
+Start as a daemon, keeping console open
+.TP
 .BR "-C, --control-port"
 Control port URL (tcp://0.0.0.0:5342 is the default)
 .TP
index c9f9ab8aca92792e3154d3d6f4d31cef826921e1..f5d618abf0bc43ce9a1d2f105d88d46e41e1446d 100644 (file)
@@ -61,7 +61,7 @@
 
 /* command line options */
 char *opt_output_path;
-static int opt_daemon;
+static int opt_daemon, opt_background;
 static struct lttng_uri *control_uri;
 static struct lttng_uri *data_uri;
 static struct lttng_uri *live_uri;
@@ -130,6 +130,7 @@ void usage(void)
        fprintf(stderr, "Usage: %s OPTIONS\n\nOptions:\n", progname);
        fprintf(stderr, "  -h, --help                Display this usage.\n");
        fprintf(stderr, "  -d, --daemonize           Start as a daemon.\n");
+       fprintf(stderr, "  -b, --background          Start as a daemon, keeping console open.\n");
        fprintf(stderr, "  -C, --control-port URL    Control port listening.\n");
        fprintf(stderr, "  -D, --data-port URL       Data port listening.\n");
        fprintf(stderr, "  -L, --live-port URL       Live view port listening.\n");
@@ -2711,8 +2712,8 @@ int main(int argc, char **argv)
        }
 
        /* Daemonize */
-       if (opt_daemon) {
-               ret = daemon(0, 0);
+       if (opt_daemon || opt_background) {
+               ret = daemon(0, opt_background);
                if (ret < 0) {
                        PERROR("daemon");
                        goto exit;
This page took 0.02844 seconds and 4 git commands to generate.