Daemonize sessiond on `lttng create`
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 27 Aug 2015 15:52:33 +0000 (11:52 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 6 Sep 2015 03:16:38 +0000 (23:16 -0400)
commitbbd44cae042d871887fb7207c5144f68d47cb3a8
tree34969d9f19b704a61c613f606e8172d884ccec1d
parent6a0caa9baf6913eacea486ac84f14ee65c62108b
Daemonize sessiond on `lttng create`

Since the session daemon forked by `lttng create` shares its
standard output/error FDs when not using `--daemonize`, redirecting
the standard output/error of this command to another program "hangs"
because the session daemon never terminates.

Example that's not working (when sessiond is not running):

    lttng create | wc

or:

    lttng 2>&1 | wc

Using sessiond's `--daemonize` option makes it close its FDs. This
option also ensures that when the sessiond process exits, it has forked
itself as a daemon and is ready to accept commands. Therefore we don't
need to catch SIGCHLD and SIGUSR1; just waitpid() on sessiond's PID and
make sure it exited normally and with an exit status of 0 to continue.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng/commands/create.c
src/bin/lttng/lttng.c
src/bin/lttng/utils.h
This page took 0.024987 seconds and 4 git commands to generate.