summaryrefslogtreecommitdiff
path: root/src/core/manager.c
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2015-02-18 14:22:37 -0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-02-26 09:38:50 -0500
commit03455c2879699852b691903343e378c28992ff6a (patch)
treed7e7eaed8fc3ec9528e20d57f54c400b2dbb484a /src/core/manager.c
parente342b74468870f2e4f3e15f7277a0adea42183ca (diff)
core: emit changes for NFailedUnits property
By notifying the clients when this property is changed it's possible to allow "system health monitor" tools to get transitions like running<->degraded. This is an alternative to send changes on the SystemState property since the latter is more difficult to derive.
Diffstat (limited to 'src/core/manager.c')
-rw-r--r--src/core/manager.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index 79a9d54954..7966b387fc 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -3053,6 +3053,23 @@ const char *manager_get_runtime_prefix(Manager *m) {
getenv("XDG_RUNTIME_DIR");
}
+void manager_update_failed_units(Manager *m, Unit *u, bool failed) {
+ unsigned size;
+
+ assert(m);
+ assert(u->manager == m);
+
+ size = set_size(m->failed_units);
+
+ if (failed)
+ set_put(m->failed_units, u);
+ else
+ set_remove(m->failed_units, u);
+
+ if (set_size(m->failed_units) != size)
+ bus_manager_send_change_signal(m);
+}
+
ManagerState manager_state(Manager *m) {
Unit *u;