1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-12 13:18:14 +03:00

coredump: save /proc/[pid]/mountinfo

The file contains information one can use to debug processes running
within a container.
This commit is contained in:
Jakub Filak 2016-04-26 09:54:39 +02:00
parent a912ab0474
commit d7032b1fcd

View File

@ -933,11 +933,12 @@ static int process_kernel(int argc, char* argv[]) {
/* The larger ones we allocate on the heap */ /* The larger ones we allocate on the heap */
_cleanup_free_ char _cleanup_free_ char
*core_owner_uid = NULL, *core_open_fds = NULL, *core_proc_status = NULL, *core_owner_uid = NULL, *core_open_fds = NULL, *core_proc_status = NULL,
*core_proc_maps = NULL, *core_proc_limits = NULL, *core_proc_cgroup = NULL, *core_environ = NULL; *core_proc_maps = NULL, *core_proc_limits = NULL, *core_proc_cgroup = NULL, *core_environ = NULL,
*core_proc_mountinfo = NULL;
_cleanup_free_ char *exe = NULL, *comm = NULL; _cleanup_free_ char *exe = NULL, *comm = NULL;
const char *context[_CONTEXT_MAX]; const char *context[_CONTEXT_MAX];
struct iovec iovec[25]; struct iovec iovec[26];
size_t n_iovec = 0; size_t n_iovec = 0;
uid_t owner_uid; uid_t owner_uid;
const char *p; const char *p;
@ -1110,6 +1111,15 @@ static int process_kernel(int argc, char* argv[]) {
IOVEC_SET_STRING(iovec[n_iovec++], core_proc_cgroup); IOVEC_SET_STRING(iovec[n_iovec++], core_proc_cgroup);
} }
p = procfs_file_alloca(pid, "mountinfo");
if (read_full_file(p, &t, NULL) >=0) {
core_proc_mountinfo = strappend("COREDUMP_PROC_MOUNTINFO=", t);
free(t);
if (core_proc_mountinfo)
IOVEC_SET_STRING(iovec[n_iovec++], core_proc_mountinfo);
}
if (get_process_cwd(pid, &t) >= 0) { if (get_process_cwd(pid, &t) >= 0) {
core_cwd = strjoina("COREDUMP_CWD=", t); core_cwd = strjoina("COREDUMP_CWD=", t);
free(t); free(t);