]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/core/unit-dependency-atom.h
Revert "core: add IgnoreOnSoftReboot= unit option"
[thirdparty/systemd.git] / src / core / unit-dependency-atom.h
CommitLineData
15ed3c3a
LP
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2#pragma once
3
4#include <errno.h>
5
6#include "unit-def.h"
7
8/* Flags that identify the various "atomic" behaviours a specific dependency type implies. Each dependency is
9 * a combination of one or more of these flags that define what they actually entail. */
10typedef enum UnitDependencyAtom {
11
12 /* This unit pulls in the other unit as JOB_START job into the transaction, and if that doesn't work
13 * the transaction fails. */
14 UNIT_ATOM_PULL_IN_START = UINT64_C(1) << 0,
15 /* Similar, but if it doesn't work, ignore. */
16 UNIT_ATOM_PULL_IN_START_IGNORED = UINT64_C(1) << 1,
17 /* Pull in a JOB_VERIFY job into the transaction, i.e. pull in JOB_VERIFY rather than
18 * JOB_START. i.e. check the unit is started but don't pull it in. */
19 UNIT_ATOM_PULL_IN_VERIFY = UINT64_C(1) << 2,
20
21 /* Pull in a JOB_STOP job for the other job into transactions, and fail if that doesn't work. */
22 UNIT_ATOM_PULL_IN_STOP = UINT64_C(1) << 3,
23 /* Same, but don't fail, ignore it. */
24 UNIT_ATOM_PULL_IN_STOP_IGNORED = UINT64_C(1) << 4,
25
26 /* If our enters inactive state, add the other unit to the StopWhenUneeded= queue */
27 UNIT_ATOM_ADD_STOP_WHEN_UNNEEDED_QUEUE = UINT64_C(1) << 5,
28 /* Pin the other unit i.e. ensure StopWhenUneeded= won't trigger for the other unit as long as we are
29 * not in inactive state */
30 UNIT_ATOM_PINS_STOP_WHEN_UNNEEDED = UINT64_C(1) << 6,
31
32 /* Stop our unit if the other unit happens to inactive */
33 UNIT_ATOM_CANNOT_BE_ACTIVE_WITHOUT = UINT64_C(1) << 7,
56c59592
LP
34 /* If our unit enters inactive state, add the other unit to the BoundBy= queue */
35 UNIT_ATOM_ADD_CANNOT_BE_ACTIVE_WITHOUT_QUEUE = UINT64_C(1) << 8,
15ed3c3a 36
0bc488c9
LP
37 /* Start this unit whenever we find it inactive and the other unit active */
38 UNIT_ATOM_START_STEADILY = UINT64_C(1) << 9,
39 /* Whenever our unit becomes active, add other unit to start_when_upheld_queue */
40 UNIT_ATOM_ADD_START_WHEN_UPHELD_QUEUE = UINT64_C(1) << 10,
41
15ed3c3a
LP
42 /* If our unit unexpectedly becomes active, retroactively start the other unit too, in "replace" job
43 * mode */
44 UNIT_ATOM_RETROACTIVE_START_REPLACE = UINT64_C(1) << 11,
45 /* Similar, but in "fail" job mode */
46 UNIT_ATOM_RETROACTIVE_START_FAIL = UINT64_C(1) << 12,
47 /* If our unit unexpectedly becomes active, retroactively stop the other unit too */
48 UNIT_ATOM_RETROACTIVE_STOP_ON_START = UINT64_C(1) << 13,
49 /* If our unit unexpectedly becomes inactive, retroactively stop the other unit too */
50 UNIT_ATOM_RETROACTIVE_STOP_ON_STOP = UINT64_C(1) << 14,
51
52 /* If a start job for this unit fails, propagate the failure to start job of other unit too */
53 UNIT_ATOM_PROPAGATE_START_FAILURE = UINT64_C(1) << 15,
54 /* If a stop job for this unit fails, propagate the failure to any stop job of the other unit too */
55 UNIT_ATOM_PROPAGATE_STOP_FAILURE = UINT64_C(1) << 16,
56 /* If our start job succeeded but the unit is inactive then (think: oneshot units), propagate this as
57 * failure to the other unit. */
58 UNIT_ATOM_PROPAGATE_INACTIVE_START_AS_FAILURE = UINT64_C(1) << 17,
59 /* When putting together a transaction, propagate JOB_STOP from our unit to the other. */
60 UNIT_ATOM_PROPAGATE_STOP = UINT64_C(1) << 18,
48cb073d
MY
61 /* Like UNIT_ATOM_PROPAGATE_STOP, but enqueues a restart job if there's already a start job (avoids
62 * job type conflict). */
63 UNIT_ATOM_PROPAGATE_STOP_GRACEFUL = UINT64_C(1) << 19,
15ed3c3a 64 /* When putting together a transaction, propagate JOB_RESTART from our unit to the other. */
48cb073d 65 UNIT_ATOM_PROPAGATE_RESTART = UINT64_C(1) << 20,
15ed3c3a
LP
66
67 /* Add the other unit to the default target dependency queue */
48cb073d 68 UNIT_ATOM_ADD_DEFAULT_TARGET_DEPENDENCY_QUEUE = UINT64_C(1) << 21,
15ed3c3a 69 /* Recheck default target deps on other units (which are target units) */
48cb073d 70 UNIT_ATOM_DEFAULT_TARGET_DEPENDENCIES = UINT64_C(1) << 22,
15ed3c3a
LP
71
72 /* The remaining atoms map 1:1 to the equally named high-level deps */
48cb073d
MY
73 UNIT_ATOM_ON_FAILURE = UINT64_C(1) << 23,
74 UNIT_ATOM_ON_SUCCESS = UINT64_C(1) << 24,
75 UNIT_ATOM_ON_FAILURE_OF = UINT64_C(1) << 25,
76 UNIT_ATOM_ON_SUCCESS_OF = UINT64_C(1) << 26,
77 UNIT_ATOM_BEFORE = UINT64_C(1) << 27,
78 UNIT_ATOM_AFTER = UINT64_C(1) << 28,
79 UNIT_ATOM_TRIGGERS = UINT64_C(1) << 29,
80 UNIT_ATOM_TRIGGERED_BY = UINT64_C(1) << 30,
81 UNIT_ATOM_PROPAGATES_RELOAD_TO = UINT64_C(1) << 31,
82 UNIT_ATOM_JOINS_NAMESPACE_OF = UINT64_C(1) << 32,
83 UNIT_ATOM_REFERENCES = UINT64_C(1) << 33,
84 UNIT_ATOM_REFERENCED_BY = UINT64_C(1) << 34,
85 UNIT_ATOM_IN_SLICE = UINT64_C(1) << 35,
86 UNIT_ATOM_SLICE_OF = UINT64_C(1) << 36,
87 _UNIT_DEPENDENCY_ATOM_MAX = (UINT64_C(1) << 37) - 1,
15ed3c3a
LP
88 _UNIT_DEPENDENCY_ATOM_INVALID = -EINVAL,
89} UnitDependencyAtom;
90
91UnitDependencyAtom unit_dependency_to_atom(UnitDependency d);
92UnitDependency unit_dependency_from_unique_atom(UnitDependencyAtom atom);