Hi.
This patch adds SIGUSR1 handler which only try to connect to the system bus
without
reloading configuration. It prevents consuming events when we only need to
connect.
Petr
--
Petr Lautrbach, Red Hat, Inc.
diff --git a/init/main.c b/init/main.c
index 2836583..c5c04d1 100644
--- a/init/main.c
+++ b/init/main.c
@@ -66,6 +66,7 @@ static void cad_handler (void *data, NihSignal *signal);
static void kbd_handler (void *data, NihSignal *signal);
static void pwr_handler (void *data, NihSignal *signal);
static void hup_handler (void *data, NihSignal *signal);
+static void usr1_handler (void *data, NihSignal *signal);
#endif /* DEBUG */
@@ -234,6 +235,10 @@ main (int argc,
/* SIGHUP instructs us to re-load our configuration */
nih_signal_set_handler (SIGHUP, nih_signal_handler);
NIH_MUST (nih_signal_add_handler (NULL, SIGHUP, hup_handler, NULL));
+
+ /* SIGHUSR1 instructs us to connect to system bus */
+ nih_signal_set_handler (SIGUSR1, nih_signal_handler);
+ NIH_MUST (nih_signal_add_handler (NULL, SIGUSR1, usr1_handler, NULL));
#endif /* DEBUG */
@@ -465,4 +470,31 @@ hup_handler (void *data,
}
}
}
+
+/**
+ * usr1_handler:
+ * @data: unused,
+ * @signal: signal that called this handler.
+ *
+ * Handle having recieved the SIGHUSR1 signal, which we use to instruct us to
+ * connect to system bus.
+ **/
+static void
+usr1_handler (void *data,
+ NihSignal *signal)
+{
+
+ if (! control_bus) {
+ nih_info (_("Connecting to system bus"));
+
+ if (control_bus_open () < 0) {
+ NihError *err;
+
+ err = nih_error_get ();
+ nih_warn ("%s: %s", _("Unable to connect to the system
bus"),
+ err->message);
+ nih_free (err);
+ }
+ }
+}
#endif /* DEBUG */
--
upstart-devel mailing list
[email protected]
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/upstart-devel