summaryrefslogtreecommitdiff
path: root/src/core/unit.c
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-09-13 20:44:30 +0200
committerDaniel Mack <github@zonque.org>2015-09-13 20:44:30 +0200
commit5669ef3644e3044036eeaaf6bb4b1a6a7e63130c (patch)
tree1f2f6f436e6070aeea41960ed91fee8705d2aac3 /src/core/unit.c
parent2d0fd6e1c5bbaddef56ecf0fc8c59478fb9ba822 (diff)
parente7ab4d1ac9f8d99eecd5e2d22eb482a1fb0fbf23 (diff)
Merge pull request #1251 from poettering/cgroups-cleanup
cgroups cleanup + other fixes
Diffstat (limited to 'src/core/unit.c')
-rw-r--r--src/core/unit.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index 2ebfb09a7a..3bfc2460bc 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -528,7 +528,7 @@ void unit_free(Unit *u) {
unit_release_cgroup(u);
- manager_update_failed_units(u->manager, u, false);
+ (void) manager_update_failed_units(u->manager, u, false);
set_remove(u->manager->startup_units, u);
free(u->description);
@@ -1172,15 +1172,20 @@ static int unit_add_mount_dependencies(Unit *u) {
static int unit_add_startup_units(Unit *u) {
CGroupContext *c;
+ int r;
c = unit_get_cgroup_context(u);
if (!c)
return 0;
- if (c->startup_cpu_shares == (unsigned long) -1 &&
- c->startup_blockio_weight == (unsigned long) -1)
+ if (c->startup_cpu_shares == CGROUP_CPU_SHARES_INVALID &&
+ c->startup_blockio_weight == CGROUP_BLKIO_WEIGHT_INVALID)
return 0;
+ r = set_ensure_allocated(&u->manager->startup_units, NULL);
+ if (r < 0)
+ return r;
+
return set_put(u->manager->startup_units, u);
}
@@ -1807,7 +1812,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
}
/* Keep track of failed units */
- manager_update_failed_units(u->manager, u, ns == UNIT_FAILED);
+ (void) manager_update_failed_units(u->manager, u, ns == UNIT_FAILED);
/* Make sure the cgroup is always removed when we become inactive */
if (UNIT_IS_INACTIVE_OR_FAILED(ns))