summaryrefslogtreecommitdiff
path: root/src/core/dbus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-07-10 21:10:53 +0200
committerLennart Poettering <lennart@poettering.net>2013-07-10 23:41:03 +0200
commit71445ae75b0e9954d141e5f0ee97803b406ea332 (patch)
treef1f00a625f725d72429c51d61eb24b3842bd2648 /src/core/dbus.c
parentd0ede8f1c555500dceebd3cc8a8e877ed1d89de6 (diff)
core: send out "Reloading" signal before and after doing a full reload/reexec of PID 1
Since we'll unload all units/job during a reload, and then readd them it is really useful for clients to be aware of this phase hence sent a signal out before and after. This signal is called "Reloading" (despite the fact that it is also sent out during reexecution, which we consider a special case in this context) and has one boolean parameter which is true for the signal sent before the reload, and false for the signal after the reload. The UnitRemoved/JobRremoved and UnitNew/JobNew due to the reloading are guranteed to be between the pair of Reloading messages.
Diffstat (limited to 'src/core/dbus.c')
-rw-r--r--src/core/dbus.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/core/dbus.c b/src/core/dbus.c
index c1bf25c69b..aa3d93bf06 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -1451,7 +1451,7 @@ void bus_broadcast_finished(
usec_t userspace_usec,
usec_t total_usec) {
- DBusMessage *message;
+ _cleanup_dbus_message_unref_ DBusMessage *message = NULL;
assert(m);
@@ -1471,18 +1471,42 @@ void bus_broadcast_finished(
DBUS_TYPE_UINT64, &total_usec,
DBUS_TYPE_INVALID)) {
log_oom();
- goto finish;
+ return;
}
if (bus_broadcast(m, message) < 0) {
log_oom();
- goto finish;
+ return;
}
+}
-finish:
- if (message)
- dbus_message_unref(message);
+void bus_broadcast_reloading(Manager *m, bool active) {
+
+ _cleanup_dbus_message_unref_ DBusMessage *message = NULL;
+ dbus_bool_t b = active;
+
+ assert(m);
+
+ message = dbus_message_new_signal("/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "Reloading");
+ if (!message) {
+ log_oom();
+ return;
+ }
+
+ assert_cc(sizeof(usec_t) == sizeof(uint64_t));
+ if (!dbus_message_append_args(message,
+ DBUS_TYPE_BOOLEAN, &b,
+ DBUS_TYPE_INVALID)) {
+ log_oom();
+ return;
+ }
+
+
+ if (bus_broadcast(m, message) < 0) {
+ log_oom();
+ return;
+ }
}
Set *bus_acquire_subscribed(Manager *m, DBusConnection *c) {