* [PATCH] vmcore-dmesg: Collect full dmesg regardless of logged_chars
@ 2015-10-28 7:46 Dangyi Liu
0 siblings, 0 replies; only message in thread
From: Dangyi Liu @ 2015-10-28 7:46 UTC (permalink / raw)
To: kexec; +Cc: Dangyi Liu
logged_chars would be set to 0 by `dmesg -c`, but full dmesg is useful
for debugging. So instead of using logged_chars directly, we calculate
it by ourselves.
Now logged_chars is set to the minimum of log_end and log_buf_len, as
the same logic as crash utility is using.
Signed-off-by: Dangyi Liu <dliu@redhat.com>
---
vmcore-dmesg/vmcore-dmesg.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c
index f47ee11..134a4ef 100644
--- a/vmcore-dmesg/vmcore-dmesg.c
+++ b/vmcore-dmesg/vmcore-dmesg.c
@@ -540,6 +540,12 @@ static void dump_dmesg_legacy(int fd)
exit(53);
}
+ /*
+ * To collect full dmesg including the part before `dmesg -c` is useful for
+ * later debugging. Use same logic as what crash utility is using.
+ */
+ logged_chars = log_end < log_buf_len ? log_end : log_buf_len;
+
write_to_stdout(buf + (log_buf_len - logged_chars), logged_chars);
}
--
2.4.3
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-10-28 7:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-28 7:46 [PATCH] vmcore-dmesg: Collect full dmesg regardless of logged_chars Dangyi Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox