if (UNIT_DEREF(m->slice) != u)
continue;
- /* The cgroup for this unit might not actually be fully
- * realised yet, in which case it isn't holding any controllers
- * open anyway. */
+ /* The cgroup for this unit might not actually be fully realised yet, in which case it isn't
+ * holding any controllers open anyway. */
if (!m->cgroup_realized)
continue;
- /* We must disable those below us first in order to release the
- * controller. */
+ /* We must disable those below us first in order to release the controller. */
if (m->type == UNIT_SLICE)
(void) unit_realize_cgroup_now_disable(m, state);
target_mask = unit_get_target_mask(m);
enable_mask = unit_get_enable_mask(m);
- /* We can only disable in this direction, don't try to enable
- * anything. */
+ /* We can only disable in this direction, don't try to enable anything. */
if (unit_has_mask_disables_realized(m, target_mask, enable_mask))
continue;
if (!m->cgroup_realized)
continue;
- /* If the unit doesn't need any new controllers and has current ones realized, it
- * doesn't need any changes. */
+ /* If the unit doesn't need any new controllers and has current ones
+ * realized, it doesn't need any changes. */
if (unit_has_mask_realized(m,
unit_get_target_mask(m),
unit_get_enable_mask(m)))
job_fail_dependencies(u, UNIT_ATOM_PROPAGATE_STOP_FAILURE);
}
- /* A special check to make sure we take down anything RequisiteOf if we
- * aren't active. This is when the verify-active job merges with a
- * satisfying job type, and then loses it's invalidation effect, as the
- * result there is JOB_DONE for the start job we merged into, while we
- * should be failing the depending job if the said unit isn't in fact
- * active. Oneshots are an example of this, where going directly from
- * activating to inactive is success.
+ /* A special check to make sure we take down anything RequisiteOf= if we aren't active. This is when
+ * the verify-active job merges with a satisfying job type, and then loses it's invalidation effect,
+ * as the result there is JOB_DONE for the start job we merged into, while we should be failing the
+ * depending job if the said unit isn't in fact active. Oneshots are an example of this, where going
+ * directly from activating to inactive is success.
*
- * This happens when you use ConditionXYZ= in a unit too, since in that
- * case the job completes with the JOB_DONE result, but the unit never
- * really becomes active. Note that such a case still involves merging:
+ * This happens when you use ConditionXYZ= in a unit too, since in that case the job completes with
+ * the JOB_DONE result, but the unit never really becomes active. Note that such a case still
+ * involves merging:
*
- * A start job waits for something else, and a verify-active comes in
- * and merges in the installed job. Then, later, when it becomes
- * runnable, it finishes with JOB_DONE result as execution on conditions
- * not being met is skipped, breaking our dependency semantics.
+ * A start job waits for something else, and a verify-active comes in and merges in the installed
+ * job. Then, later, when it becomes runnable, it finishes with JOB_DONE result as execution on
+ * conditions not being met is skipped, breaking our dependency semantics.
*
- * Also, depending on if start job waits or not, the merging may or may
- * not happen (the verify-active job may trigger after it finishes), so
- * you get undeterministic results without this check.
+ * Also, depending on if start job waits or not, the merging may or may not happen (the verify-active
+ * job may trigger after it finishes), so you get undeterministic results without this check.
*/
if (result == JOB_DONE && recursive &&
IN_SET(t, JOB_START, JOB_RELOAD) &&
* stop a + start b → 1st step stop a, 2nd step start b
* stop a + stop b → 1st step stop b, 2nd step stop a
*
- * This has the side effect that restarts are properly
- * synchronized too.
+ * This has the side effect that restarts are properly synchronized too.
*/
int job_compare(Job *a, Job *b, UnitDependencyAtom assume_dep) {
assert(a);
if (assume_dep == UNIT_ATOM_AFTER)
return -job_compare(b, a, UNIT_ATOM_BEFORE);
- /* Let's make it simple, JOB_STOP goes always first (in case both ua and ub stop,
- * then ub's stop goes first anyway).
- * JOB_RESTART is JOB_STOP in disguise (before it is patched to JOB_START). */
+ /* Let's make it simple, JOB_STOP goes always first (in case both ua and ub stop, then ub's stop goes
+ * first anyway). JOB_RESTART is JOB_STOP in disguise (before it is patched to JOB_START). */
if (IN_SET(b->type, JOB_STOP, JOB_RESTART))
return 1;
else
assert(j);
assert(!j->transaction_prev);
- /* Does a recursive sweep through the ordering graph, looking
- * for a cycle. If we find a cycle we try to break it. */
+ /* Does a recursive sweep through the ordering graph, looking for a cycle. If we find a cycle we try
+ * to break it. */
/* Have we seen this before? */
if (j->generation == generation) {
_cleanup_free_ char **array = NULL, *unit_ids = NULL;
char **unit_id, **job_type;
- /* If the marker is NULL we have been here already and
- * decided the job was loop-free from here. Hence
- * shortcut things and return right-away. */
+ /* If the marker is NULL we have been here already and decided the job was loop-free from
+ * here. Hence shortcut things and return right-away. */
if (!j->marker)
return 0;
- /* So, the marker is not NULL and we already have been here. We have
- * a cycle. Let's try to break it. We go backwards in our path and
- * try to find a suitable job to remove. We use the marker to find
- * our way back, since smart how we are we stored our way back in
- * there. */
-
+ /* So, the marker is not NULL and we already have been here. We have a cycle. Let's try to
+ * break it. We go backwards in our path and try to find a suitable job to remove. We use the
+ * marker to find our way back, since smart how we are we stored our way back in there. */
for (k = from; k; k = ((k->generation == generation && k->marker != k) ? k->marker : NULL)) {
/* For logging below */
/* Is there a job for this unit? */
o = hashmap_get(tr->jobs, u);
if (!o) {
- /* Ok, there is no job for this in the
- * transaction, but maybe there is already one
- * running? */
+ /* Ok, there is no job for this in the transaction, but maybe there is
+ * already one running? */
o = u->job;
if (!o)
continue;
assert(u);
- /* Checks whether all BindsTo= dependencies of this unit are fulfilled — if they are also combined with
- * After=. We do not check Requires= or Requisite= here as they only should have an effect on the job
- * processing, but do not have any effect afterwards. We don't check BindsTo= dependencies that are not used in
- * conjunction with After= as for them any such check would make things entirely racy. */
+ /* Checks whether all BindsTo= dependencies of this unit are fulfilled — if they are also combined
+ * with After=. We do not check Requires= or Requisite= here as they only should have an effect on
+ * the job processing, but do not have any effect afterwards. We don't check BindsTo= dependencies
+ * that are not used in conjunction with After= as for them any such check would make things entirely
+ * racy. */
UNIT_FOREACH_DEPENDENCY(other, u, UNIT_ATOM_CANNOT_BE_ACTIVE_WITHOUT) {
[UNIT_TRIGGERED_BY] = UNIT_TRIGGERS,
[UNIT_PROPAGATES_RELOAD_TO] = UNIT_RELOAD_PROPAGATED_FROM,
[UNIT_RELOAD_PROPAGATED_FROM] = UNIT_PROPAGATES_RELOAD_TO,
- [UNIT_JOINS_NAMESPACE_OF] = UNIT_JOINS_NAMESPACE_OF,
+ [UNIT_JOINS_NAMESPACE_OF] = UNIT_JOINS_NAMESPACE_OF, /* symmetric! 👓 */
};
Unit *original_u = u, *original_other = other;
UnitDependencyAtom a;
di.origin_mask &= ~mask;
unit_update_dependency_mask(deps, other, di);
- /* We updated the dependency from our unit to the other unit now. But most dependencies
- * imply a reverse dependency. Hence, let's delete that one too. For that we go through
- * all dependency types on the other unit and delete all those which point to us and
- * have the right mask set. */
+ /* We updated the dependency from our unit to the other unit now. But most
+ * dependencies imply a reverse dependency. Hence, let's delete that one
+ * too. For that we go through all dependency types on the other unit and
+ * delete all those which point to us and have the right mask set. */
HASHMAP_FOREACH(other_deps, other->dependencies) {
UnitDependencyInfo dj;