Merge pull request #29272 from enr0n/coredump-container

coredump: support forwarding coredumps to containers
This commit is contained in:
Lennart Poettering
2023-10-16 16:13:16 +02:00
committed by GitHub
19 changed files with 582 additions and 204 deletions
+27
View File
@@ -319,6 +319,33 @@ int container_get_leader(const char *machine, pid_t *pid) {
return 0;
}
int namespace_get_leader(pid_t pid, NamespaceType type, pid_t *ret) {
int r;
assert(ret);
for (;;) {
pid_t ppid;
r = get_process_ppid(pid, &ppid);
if (r < 0)
return r;
r = in_same_namespace(pid, ppid, type);
if (r < 0)
return r;
if (r == 0) {
/* If the parent and the child are not in the same
* namespace, then the child is the leader we are
* looking for. */
*ret = pid;
return 0;
}
pid = ppid;
}
}
int is_kernel_thread(pid_t pid) {
_cleanup_free_ char *line = NULL;
unsigned long long flags;