From: Lennart Poettering Date: Fri, 13 Aug 2010 00:08:34 +0000 (+0200) Subject: cgroup: try harder to find a unit a PID belongs to by traversing through parent cgroups X-Git-Tag: v8~103 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4455bcd0e646eda1a952671734045bf1b2e9b69f;p=systemd cgroup: try harder to find a unit a PID belongs to by traversing through parent cgroups --- diff --git a/src/cgroup.c b/src/cgroup.c index 23ba5d86..fff00d01 100644 --- a/src/cgroup.c +++ b/src/cgroup.c @@ -335,6 +335,21 @@ Unit* cgroup_unit_by_pid(Manager *m, pid_t pid) { return NULL; l = hashmap_get(m->cgroup_bondings, group); + + if (!l) { + char *slash; + + while ((slash = strrchr(group, '/'))) { + if (slash == group) + break; + + *slash = 0; + + if ((l = hashmap_get(m->cgroup_bondings, group))) + break; + } + } + free(group); LIST_FOREACH(by_path, b, l) {