summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-04-13 20:50:21 +0200
committerLennart Poettering <lennart@poettering.net>2021-05-25 16:03:03 +0200
commit629b2a6f7be7b5b7ec2c35aceeeb82cedc08bef3 (patch)
treef33add7a561f39df90d6b3f10b48155ea8ee1e79 /src/core
parent39628fedac5b35fe9d3c7a674c68a99f2cba4d28 (diff)
downloadsystemd-629b2a6f7be7b5b7ec2c35aceeeb82cedc08bef3.tar.gz
core: add a reverse dep for OnFailure=
Let's add an implicit reverse dep OnFailureOf=. This is exposed via the bus to make things more debuggable: you can now ask systemd for which units a specific unit is the failure handler. OnFailure= was the only dependency type that had no inverse, this fixes that. Now that deps are a bit cheaper, it should be OK to add deps that only serve debug purposes.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/dbus-unit.c1
-rw-r--r--src/core/unit-dependency-atom.c1
-rw-r--r--src/core/unit.c3
3 files changed, 4 insertions, 1 deletions
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c
index a1278dd6e9..6ca16262ab 100644
--- a/src/core/dbus-unit.c
+++ b/src/core/dbus-unit.c
@@ -865,6 +865,7 @@ const sd_bus_vtable bus_unit_vtable[] = {
SD_BUS_PROPERTY("Before", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("After", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("OnFailure", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
+ SD_BUS_PROPERTY("OnFailureOf", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("Triggers", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("TriggeredBy", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("PropagatesReloadTo", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
diff --git a/src/core/unit-dependency-atom.c b/src/core/unit-dependency-atom.c
index cfd5acd33b..c4fbfee015 100644
--- a/src/core/unit-dependency-atom.c
+++ b/src/core/unit-dependency-atom.c
@@ -85,6 +85,7 @@ static const UnitDependencyAtom atom_map[_UNIT_DEPENDENCY_MAX] = {
* things discoverable/debuggable as they are the inverse dependencies to some of the above. As they
* have no effect of their own, they all map to no atoms at all, i.e. the value 0. */
[UNIT_RELOAD_PROPAGATED_FROM] = 0,
+ [UNIT_ON_FAILURE_OF] = 0,
};
UnitDependencyAtom unit_dependency_to_atom(UnitDependency d) {
diff --git a/src/core/unit.c b/src/core/unit.c
index c94f4e7523..708c725b49 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2871,7 +2871,8 @@ int unit_add_dependency(
[UNIT_CONFLICTED_BY] = UNIT_CONFLICTS,
[UNIT_BEFORE] = UNIT_AFTER,
[UNIT_AFTER] = UNIT_BEFORE,
- [UNIT_ON_FAILURE] = _UNIT_DEPENDENCY_INVALID,
+ [UNIT_ON_FAILURE] = UNIT_ON_FAILURE_OF,
+ [UNIT_ON_FAILURE_OF] = UNIT_ON_FAILURE,
[UNIT_REFERENCES] = UNIT_REFERENCED_BY,
[UNIT_REFERENCED_BY] = UNIT_REFERENCES,
[UNIT_TRIGGERS] = UNIT_TRIGGERED_BY,