summaryrefslogtreecommitdiff
path: root/src/core/unit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/unit.c')
-rw-r--r--src/core/unit.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index 41651bab87..ea55c709b0 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1071,6 +1071,20 @@ static int unit_add_mount_dependencies(Unit *u) {
return 0;
}
+static int unit_add_startup_units(Unit *u) {
+ CGroupContext *c;
+ int r = 0;
+
+ c = unit_get_cgroup_context(u);
+ if (c != NULL && manager_state(u->manager) == MANAGER_STARTING &&
+ (c->startup_cpu_shares_set || c->startup_blockio_weight_set)) {
+ r = set_put(u->manager->startup_units, u);
+ if (r == -EEXIST)
+ r = 0;
+ }
+ return r;
+}
+
int unit_load(Unit *u) {
int r;
@@ -1112,6 +1126,10 @@ int unit_load(Unit *u) {
if (r < 0)
goto fail;
+ r = unit_add_startup_units(u);
+ if (r < 0)
+ goto fail;
+
if (u->on_failure_job_mode == JOB_ISOLATE && set_size(u->dependencies[UNIT_ON_FAILURE]) > 1) {
log_error_unit(u->id, "More than one OnFailure= dependencies specified for %s but OnFailureJobMode=isolate set. Refusing.", u->id);
r = -EINVAL;