summaryrefslogtreecommitdiff
path: root/manager.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-13 03:20:22 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-13 03:20:22 +0200
commit57ee42cefda6a3f3ea3252e0ab9190b709f0ce49 (patch)
treef49524f565b3a5e38864aa8879e9b8b1ab496a3f /manager.c
parent57c0c30e735ef2a2d44a9aa0032a22ea8d089ced (diff)
manager: start D-Bus on SIGUSR2
Diffstat (limited to 'manager.c')
-rw-r--r--manager.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/manager.c b/manager.c
index e7c66099a4..82dc9a676b 100644
--- a/manager.c
+++ b/manager.c
@@ -84,13 +84,13 @@ static int manager_setup_signals(Manager *m) {
assert_se(sigemptyset(&mask) == 0);
assert_se(sigaddset(&mask, SIGCHLD) == 0);
- assert_se(sigaddset(&mask, SIGINT) == 0); /* Kernel sends us this on control-alt-del */
- assert_se(sigaddset(&mask, SIGWINCH) == 0); /* Kernel sends us this on kbrequest (alt-arrowup) */
assert_se(sigaddset(&mask, SIGTERM) == 0);
assert_se(sigaddset(&mask, SIGHUP) == 0);
assert_se(sigaddset(&mask, SIGUSR1) == 0);
assert_se(sigaddset(&mask, SIGUSR2) == 0);
- assert_se(sigaddset(&mask, SIGPWR) == 0);
+ assert_se(sigaddset(&mask, SIGINT) == 0); /* Kernel sends us this on control-alt-del */
+ assert_se(sigaddset(&mask, SIGWINCH) == 0); /* Kernel sends us this on kbrequest (alt-arrowup) */
+ assert_se(sigaddset(&mask, SIGPWR) == 0); /* Some kernel drivers and upsd send us this on power failure */
assert_se(sigprocmask(SIG_SETMASK, &mask, NULL) == 0);
m->signal_watch.type = WATCH_SIGNAL;
@@ -1583,6 +1583,25 @@ static int manager_process_signal_fd(Manager *m, bool *quit) {
manager_dump_jobs(m, stdout, "\t");
break;
+ case SIGUSR2: {
+ Unit *u;
+
+ u = manager_get_unit(m, SPECIAL_DBUS_SERVICE);
+
+ if (!u || UNIT_IS_ACTIVE_OR_RELOADING(unit_active_state(u))) {
+ log_info("Trying to reconnect to bus...");
+ bus_init_system(m);
+ bus_init_api(m);
+ }
+
+ if (!u || !UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(u))) {
+ log_info("Loading D-Bus service...");
+ manager_start_target(m, SPECIAL_DBUS_SERVICE);
+ }
+
+ break;
+ }
+
default:
log_info("Got unhandled signal <%s>.", strsignal(sfsi.ssi_signo));
}