cgroup: properly determine cgroups zombie processes belong to

When a process becomes a zombie its cgroup might be deleted. Let's add
some minimal code to detect cases like this, so that we can still
attribute this back to the original cgroup.
This commit is contained in:
Lennart Poettering 2017-11-17 19:24:06 +01:00
parent 77fa610b22
commit 5e20b0a452
1 changed files with 5 additions and 0 deletions

View File

@ -1104,6 +1104,11 @@ int cg_pid_get_path(const char *controller, pid_t pid, char **path) {
if (!p)
return -ENOMEM;
/* Truncate suffix indicating the process is a zombie */
e = endswith(p, " (deleted)");
if (e)
*e = 0;
*path = p;
return 0;
}