summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/journal/coredump.c31
-rw-r--r--src/journal/coredumpctl.c70
2 files changed, 89 insertions, 12 deletions
diff --git a/src/journal/coredump.c b/src/journal/coredump.c
index a396491a4b..3365f9f146 100644
--- a/src/journal/coredump.c
+++ b/src/journal/coredump.c
@@ -346,16 +346,16 @@ int main(int argc, char* argv[]) {
_cleanup_free_ char *core_pid = NULL, *core_uid = NULL, *core_gid = NULL, *core_signal = NULL,
*core_timestamp = NULL, *core_comm = NULL, *core_exe = NULL, *core_unit = NULL,
*core_session = NULL, *core_message = NULL, *core_cmdline = NULL, *coredump_data = NULL,
- *coredump_filename = NULL;
+ *coredump_filename = NULL, *core_slice = NULL, *core_cgroup = NULL, *core_owner_uid = NULL;
_cleanup_close_ int coredump_fd = -1;
- struct iovec iovec[14];
+ struct iovec iovec[17];
off_t coredump_size;
int r, j = 0;
- pid_t pid;
- uid_t uid;
+ uid_t uid, owner_uid;
gid_t gid;
+ pid_t pid;
char *t;
/* Make sure we never enter a loop */
@@ -459,6 +459,21 @@ int main(int argc, char* argv[]) {
IOVEC_SET_STRING(iovec[j++], core_session);
}
+ if (sd_pid_get_owner_uid(pid, &owner_uid) >= 0) {
+ asprintf(&core_owner_uid, "COREDUMP_OWNER_UID=" UID_FMT, owner_uid);
+
+ if (core_owner_uid)
+ IOVEC_SET_STRING(iovec[j++], core_owner_uid);
+ }
+
+ if (sd_pid_get_slice(pid, &t) >= 0) {
+ core_slice = strappend("COREDUMP_SLICE=", t);
+ free(t);
+
+ if (core_slice)
+ IOVEC_SET_STRING(iovec[j++], core_slice);
+ }
+
if (get_process_exe(pid, &t) >= 0) {
core_exe = strappend("COREDUMP_EXE=", t);
free(t);
@@ -475,6 +490,14 @@ int main(int argc, char* argv[]) {
IOVEC_SET_STRING(iovec[j++], core_cmdline);
}
+ if (cg_pid_get_path_shifted(pid, NULL, &t) >= 0) {
+ core_cgroup = strappend("COREDUMP_CGROUP=", t);
+ free(t);
+
+ if (core_cgroup)
+ IOVEC_SET_STRING(iovec[j++], core_cgroup);
+ }
+
core_timestamp = strjoin("COREDUMP_TIMESTAMP=", argv[ARG_TIMESTAMP], "000000", NULL);
if (core_timestamp)
IOVEC_SET_STRING(iovec[j++], core_timestamp);
diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c
index 8699716679..ea459469ee 100644
--- a/src/journal/coredumpctl.c
+++ b/src/journal/coredumpctl.c
@@ -402,7 +402,8 @@ static int print_info(FILE *file, sd_journal *j, bool need_space) {
*pid = NULL, *uid = NULL, *gid = NULL,
*sgnl = NULL, *exe = NULL, *comm = NULL, *cmdline = NULL,
*unit = NULL, *user_unit = NULL, *session = NULL,
- *boot_id = NULL, *machine_id = NULL, *hostname = NULL, *coredump = NULL;
+ *boot_id = NULL, *machine_id = NULL, *hostname = NULL,
+ *coredump = NULL, *slice = NULL, *cgroup = NULL, *owner_uid = NULL;
const void *d;
size_t l;
@@ -420,6 +421,9 @@ static int print_info(FILE *file, sd_journal *j, bool need_space) {
retrieve(d, l, "COREDUMP_UNIT", &unit);
retrieve(d, l, "COREDUMP_USER_UNIT", &user_unit);
retrieve(d, l, "COREDUMP_SESSION", &session);
+ retrieve(d, l, "COREDUMP_OWNER_UID", &owner_uid);
+ retrieve(d, l, "COREDUMP_SLICE", &slice);
+ retrieve(d, l, "COREDUMP_CGROUP", &cgroup);
retrieve(d, l, "_BOOT_ID", &boot_id);
retrieve(d, l, "_MACHINE_ID", &machine_id);
retrieve(d, l, "_HOSTNAME", &hostname);
@@ -429,12 +433,42 @@ static int print_info(FILE *file, sd_journal *j, bool need_space) {
fputs("\n", file);
fprintf(file,
- " PID: %s\n"
- " UID: %s\n"
- " GID: %s\n",
- strna(pid),
- strna(uid),
- strna(gid));
+ " PID: %s%s%s\n",
+ ansi_highlight(), strna(pid), ansi_highlight_off());
+
+ if (uid) {
+ uid_t n;
+
+ if (parse_uid(uid, &n) >= 0) {
+ _cleanup_free_ char *u = NULL;
+
+ u = uid_to_name(n);
+ fprintf(file,
+ " UID: %s (%s)\n",
+ uid, u);
+ } else {
+ fprintf(file,
+ " UID: %s\n",
+ uid);
+ }
+ }
+
+ if (gid) {
+ gid_t n;
+
+ if (parse_gid(gid, &n) >= 0) {
+ _cleanup_free_ char *g = NULL;
+
+ g = gid_to_name(n);
+ fprintf(file,
+ " GID: %s (%s)\n",
+ gid, g);
+ } else {
+ fprintf(file,
+ " GID: %s\n",
+ gid);
+ }
+ }
if (sgnl) {
int sig;
@@ -446,17 +480,37 @@ static int print_info(FILE *file, sd_journal *j, bool need_space) {
}
if (exe)
- fprintf(file, " Executable: %s\n", exe);
+ fprintf(file, " Executable: %s%s%s\n", ansi_highlight(), exe, ansi_highlight_off());
if (comm)
fprintf(file, " Comm: %s\n", comm);
if (cmdline)
fprintf(file, " Command Line: %s\n", cmdline);
+ if (cgroup)
+ fprintf(file, " Control Group: %s\n", cgroup);
if (unit)
fprintf(file, " Unit: %s\n", unit);
if (user_unit)
fprintf(file, " User Unit: %s\n", unit);
+ if (slice)
+ fprintf(file, " Slice: %s\n", slice);
if (session)
fprintf(file, " Session: %s\n", session);
+ if (owner_uid) {
+ uid_t n;
+
+ if (parse_uid(owner_uid, &n) >= 0) {
+ _cleanup_free_ char *u = NULL;
+
+ u = uid_to_name(n);
+ fprintf(file,
+ " Owner UID: %s (%s)\n",
+ owner_uid, u);
+ } else {
+ fprintf(file,
+ " Owner UID: %s\n",
+ owner_uid);
+ }
+ }
if (boot_id)
fprintf(file, " Boot ID: %s\n", boot_id);
if (machine_id)