]> err.no Git - systemd/commitdiff
cgroup: try harder to find a unit a PID belongs to by traversing through parent cgroups
authorLennart Poettering <lennart@poettering.net>
Fri, 13 Aug 2010 00:08:34 +0000 (02:08 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 13 Aug 2010 00:08:34 +0000 (02:08 +0200)
src/cgroup.c

index 23ba5d86a9eb84d1278eff582eaf6a4889315986..fff00d017f3be1d5ffc36189acc734b7abd16f71 100644 (file)
@@ -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) {