summaryrefslogtreecommitdiff
path: root/src/core/unit-dependency-atom.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-04-14 14:36:15 +0200
committerLennart Poettering <lennart@poettering.net>2021-05-25 16:03:03 +0200
commit294446dcb98eaa1ced5839da674c2065b1367a3a (patch)
tree2b74a1cb3ce8a0d8c8f30c4b45d2f72c0d5dc5a1 /src/core/unit-dependency-atom.c
parent47cd17ead4bd773691708f3e81a7d047b5692e51 (diff)
downloadsystemd-294446dcb98eaa1ced5839da674c2065b1367a3a.tar.gz
core: add new OnSuccess= dependency type
This is similar to OnFailure= but is activated whenever a unit returns into inactive state successfully. I was always afraid of adding this, since it effectively allows building loops and makes our engine Turing complete, but it pretty much already was it was just hidden. Given that we have per-unit ratelimits as well as an event loop global ratelimit I feel safe to add this finally, given it actually is useful. Fixes: #13386
Diffstat (limited to 'src/core/unit-dependency-atom.c')
-rw-r--r--src/core/unit-dependency-atom.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core/unit-dependency-atom.c b/src/core/unit-dependency-atom.c
index eaeb1d389e..6bd961e92b 100644
--- a/src/core/unit-dependency-atom.c
+++ b/src/core/unit-dependency-atom.c
@@ -74,6 +74,7 @@ static const UnitDependencyAtom atom_map[_UNIT_DEPENDENCY_MAX] = {
/* These are simple dependency types: they consist of a single atom only */
[UNIT_BEFORE] = UNIT_ATOM_BEFORE,
[UNIT_AFTER] = UNIT_ATOM_AFTER,
+ [UNIT_ON_SUCCESS] = UNIT_ATOM_ON_SUCCESS,
[UNIT_ON_FAILURE] = UNIT_ATOM_ON_FAILURE,
[UNIT_TRIGGERS] = UNIT_ATOM_TRIGGERS,
[UNIT_TRIGGERED_BY] = UNIT_ATOM_TRIGGERED_BY,
@@ -88,6 +89,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_SUCCESS_OF] = 0,
[UNIT_ON_FAILURE_OF] = 0,
[UNIT_STOP_PROPAGATED_FROM] = 0,
};
@@ -175,6 +177,9 @@ UnitDependency unit_dependency_from_unique_atom(UnitDependencyAtom atom) {
case UNIT_ATOM_AFTER:
return UNIT_AFTER;
+ case UNIT_ATOM_ON_SUCCESS:
+ return UNIT_ON_SUCCESS;
+
case UNIT_ATOM_ON_FAILURE:
return UNIT_ON_FAILURE;