]> git.lttng.org Git - lttng-tools.git/commitdiff
lttng-relayd: Add `--sig-parent` parameter
authorKienan Stewart <kstewart@efficios.com>
Fri, 15 Nov 2024 15:55:39 +0000 (10:55 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 18 Dec 2024 15:55:25 +0000 (15:55 +0000)
Change-Id: I3a456f43de7ba2e557c1ca1c98466421e78e2f2e
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
doc/man/lttng-relayd.8.txt
src/bin/lttng-relayd/main.cpp

index 3f38b2fe0658e04020b68fff68b5a540cea1b12d..f551497329c448664e47c06ef56537c8cb791137 100644 (file)
@@ -18,7 +18,7 @@ SYNOPSIS
              [option:--live-port='URL'] [option:--output='DIR'] [option:--group='GROUP']
              [option:--verbose]... [option:--working-directory='DIR']
              [option:--group-output-by-host | option:--group-output-by-session] [option:--disallow-clear]
-            [option:--dynamic-port-allocation] [option:--pid-file='FILE']
+            [option:--dynamic-port-allocation] [option:--pid-file='FILE'] [option:--sig-parent]
 
 
 DESCRIPTION
@@ -241,6 +241,13 @@ option:-P, option:--pid-file::
 +
 This file is not otherwise used by lttng-relayd and is removed at shutdown.
 
+option:-S, option:--sig-parent::
+    Send the `USR1` signal to the parent process to notify readiness.
++
+You can also use the option:--daemonize or option:--background option,
+in which case `lttng-relayd` ensures the daemon is ready to receive
+client commands before it exits.
+
 Output
 ~~~~~~
 See the ``<<output-directory,Output directory>>'' section above to learn
index c5485dfa1e218f79f8d4684a306d54da2201b1b7..e4c12153868f102787024bdc4c4006ee51c27bbf 100644 (file)
@@ -99,7 +99,7 @@ enum relay_connection_status {
 /* command line options */
 char *opt_output_path, *opt_working_directory, *opt_pid_file = nullptr;
 static int opt_daemon, opt_background, opt_print_version,
-       opt_allow_clear = 1, opt_dynamic_port_allocation = 0;
+       opt_allow_clear = 1, opt_dynamic_port_allocation = 0, opt_sig_parent = 0;
 enum relay_group_output_by opt_group_output_by = RELAYD_GROUP_OUTPUT_BY_UNKNOWN;
 
 /* Argument variables */
@@ -272,6 +272,12 @@ static struct option long_options[] = {
        },
        { "disallow-clear", 0, nullptr, 'x' },
        { "dynamic-port-allocation", 0, nullptr, '\0' },
+       {
+               "sig-parent",
+               0,
+               nullptr,
+               'S'
+       },
        {
                nullptr,
                0,
@@ -478,6 +484,9 @@ static int set_option(int opt, const char *arg, const char *optname)
                /* Disallow clear */
                opt_allow_clear = 0;
                break;
+       case 'S':
+               opt_sig_parent = getppid();
+               break;
        default:
                /* Unknown option or other error.
                 * Error is printed by getopt, just return */
@@ -4620,6 +4629,11 @@ int main(int argc, char **argv)
         * signal that asks threads to teardown).
         */
 
+       /* Initialization complete, signal parent PID if necessary. */
+       if (opt_sig_parent != 0) {
+               kill(opt_sig_parent, SIGUSR1);
+       }
+
        ret = relayd_live_join();
        if (ret) {
                retval = -1;
This page took 0.031453 seconds and 4 git commands to generate.