*unit = NULL, *user_unit = NULL, *session = NULL,
*boot_id = NULL, *machine_id = NULL, *hostname = NULL,
*coredump = NULL, *slice = NULL, *cgroup = NULL,
- *owner_uid = NULL, *message = NULL;
+ *owner_uid = NULL, *message = NULL, *timestamp = NULL;
const void *d;
size_t l;
+ int r;
assert(file);
assert(j);
retrieve(d, l, "COREDUMP_OWNER_UID", &owner_uid);
retrieve(d, l, "COREDUMP_SLICE", &slice);
retrieve(d, l, "COREDUMP_CGROUP", &cgroup);
+ retrieve(d, l, "COREDUMP_TIMESTAMP", ×tamp);
retrieve(d, l, "_BOOT_ID", &boot_id);
retrieve(d, l, "_MACHINE_ID", &machine_id);
retrieve(d, l, "_HOSTNAME", &hostname);
if (need_space)
fputs("\n", file);
- fprintf(file,
- " PID: %s%s%s\n",
- ansi_highlight(), strna(pid), ansi_highlight_off());
+ if (comm)
+ fprintf(file,
+ " PID: %s%s%s (%s)\n",
+ ansi_highlight(), strna(pid), ansi_highlight_off(), comm);
+ else
+ fprintf(file,
+ " PID: %s%s%s\n",
+ ansi_highlight(), strna(pid), ansi_highlight_off());
if (uid) {
uid_t n;
fprintf(file, " Signal: %s\n", sgnl);
}
- if (exe)
- fprintf(file, " Executable: %s%s%s\n", ansi_highlight(), exe, ansi_highlight_off());
- if (comm)
- fprintf(file, " Comm: %s\n", comm);
+ if (timestamp) {
+ usec_t u;
+
+ r = safe_atou64(timestamp, &u);
+ if (r >= 0) {
+ char absolute[FORMAT_TIMESTAMP_MAX], relative[FORMAT_TIMESPAN_MAX];
+
+ fprintf(file,
+ " Timestamp: %s (%s)\n",
+ format_timestamp(absolute, sizeof(absolute), u),
+ format_timestamp_relative(relative, sizeof(relative), u));
+
+ } else
+ fprintf(file, " Timestamp: %s\n", timestamp);
+ }
+
if (cmdline)
fprintf(file, " Command Line: %s\n", cmdline);
+ if (exe)
+ fprintf(file, " Executable: %s%s%s\n", ansi_highlight(), exe, ansi_highlight_off());
if (cgroup)
fprintf(file, " Control Group: %s\n", cgroup);
if (unit)
return -errno;
}
- r = copy_bytes(fd, output ? fileno(output) : STDOUT_FILENO);
+ r = copy_bytes(fd, output ? fileno(output) : STDOUT_FILENO, (off_t) -1);
if (r < 0) {
log_error("Failed to stream coredump: %s", strerror(-r));
return r;