summaryrefslogtreecommitdiff
path: root/src/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-06-30 02:41:01 +0200
committerLennart Poettering <lennart@poettering.net>2011-06-30 02:41:01 +0200
commite025b4c306d4b0895786839ebbb934188edc6e61 (patch)
tree388957f8b1b4391fe0fbbe698416d29ac6ecaf4b /src/unit.c
parentf284f69a7b0ed1eb4aa812251902e055b0e530b1 (diff)
unit: consider all cgroups in the name=systemd hierarchy, even when the user has specified an explicit path in it
Diffstat (limited to 'src/unit.c')
-rw-r--r--src/unit.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/unit.c b/src/unit.c
index 87b7edf145..e3687d473f 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -1741,10 +1741,13 @@ int unit_add_cgroup(Unit *u, CGroupBonding *b) {
assert(b->path);
- if (!b->controller)
+ if (!b->controller) {
if (!(b->controller = strdup(SYSTEMD_CGROUP_CONTROLLER)))
return -ENOMEM;
+ b->ours = true;
+ }
+
/* Ensure this hasn't been added yet */
assert(!b->unit);
@@ -1789,6 +1792,7 @@ static char *default_cgroup_path(Unit *u) {
int unit_add_cgroup_from_text(Unit *u, const char *name) {
char *controller = NULL, *path = NULL;
CGroupBonding *b = NULL;
+ bool ours = false;
int r;
assert(u);
@@ -1797,11 +1801,15 @@ int unit_add_cgroup_from_text(Unit *u, const char *name) {
if ((r = cg_split_spec(name, &controller, &path)) < 0)
return r;
- if (!path)
+ if (!path) {
path = default_cgroup_path(u);
+ ours = true;
+ }
- if (!controller)
+ if (!controller) {
controller = strdup(SYSTEMD_CGROUP_CONTROLLER);
+ ours = true;
+ }
if (!path || !controller) {
free(path);
@@ -1822,7 +1830,8 @@ int unit_add_cgroup_from_text(Unit *u, const char *name) {
b->controller = controller;
b->path = path;
- b->ours = false;
+ b->ours = ours;
+ b->essential = streq(controller, SYSTEMD_CGROUP_CONTROLLER);
if ((r = unit_add_cgroup(u, b)) < 0)
goto fail;