mirror of
https://github.com/systemd/systemd.git
synced 2025-03-31 14:50:15 +03:00
cgroup: try harder to find a unit a PID belongs to by traversing through parent cgroups
This commit is contained in:
parent
598b557bf0
commit
4455bcd0e6
15
src/cgroup.c
15
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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user