summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-08-13 02:08:34 +0200
committerLennart Poettering <lennart@poettering.net>2010-08-13 02:08:34 +0200
commit4455bcd0e646eda1a952671734045bf1b2e9b69f (patch)
treedc958ab64baaa018408cba6a5a123d68516dabe0 /src
parent598b557bf0dea33db2c13d383382efbd847ed5f0 (diff)
cgroup: try harder to find a unit a PID belongs to by traversing through parent cgroups
Diffstat (limited to 'src')
-rw-r--r--src/cgroup.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/cgroup.c b/src/cgroup.c
index 23ba5d86a9..fff00d017f 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) {