summaryrefslogtreecommitdiff
path: root/src/shared/cgroup-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-07-11 18:47:20 +0200
committerLennart Poettering <lennart@poettering.net>2013-07-11 18:49:53 +0200
commitd7bd3de0654669e65b9642c248c5fa6d1d9a9f61 (patch)
treefdc089ab250d033b3636f19e6dfb14d83e2d5d8e /src/shared/cgroup-util.c
parent8a84192905a9845fda31b65cc433127f9c2f95ae (diff)
cgroup: simplify how instantiated units are mapped to cgroups
Previously for an instantiated unit foo@bar.service we created a cgroup foo@.service/foo@bar.service, in order to place all instances of the same template inside the same subtree. As we now implicitly add all instantiated units into one per-template slice we don't need this complexity anymore, and instance units can map directly to the cgroups of their full name.
Diffstat (limited to 'src/shared/cgroup-util.c')
-rw-r--r--src/shared/cgroup-util.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
index 8f3c64fdc5..1d545e0466 100644
--- a/src/shared/cgroup-util.c
+++ b/src/shared/cgroup-util.c
@@ -1126,7 +1126,7 @@ int cg_pid_get_path_shifted(pid_t pid, char **root, char **cgroup) {
}
int cg_path_decode_unit(const char *cgroup, char **unit){
- char *p, *e, *c, *s, *k;
+ char *e, *c, *s;
assert(cgroup);
assert(unit);
@@ -1135,28 +1135,10 @@ int cg_path_decode_unit(const char *cgroup, char **unit){
c = strndupa(cgroup, e - cgroup);
c = cg_unescape(c);
- /* Could this be a valid unit name? */
- if (!unit_name_is_valid(c, true))
+ if (!unit_name_is_valid(c, false))
return -EINVAL;
- if (!unit_name_is_template(c))
- s = strdup(c);
- else {
- if (*e != '/')
- return -EINVAL;
-
- e += strspn(e, "/");
-
- p = strchrnul(e, '/');
- k = strndupa(e, p - e);
- k = cg_unescape(k);
-
- if (!unit_name_is_valid(k, false))
- return -EINVAL;
-
- s = strdup(k);
- }
-
+ s = strdup(c);
if (!s)
return -ENOMEM;