Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dangyi Liu <dliu@redhat.com>
To: kexec@lists.infradead.org
Cc: Dangyi Liu <dliu@redhat.com>
Subject: [PATCH] vmcore-dmesg: do not use logged_chars as dmesg length
Date: Wed, 28 Oct 2015 13:38:27 +0800	[thread overview]
Message-ID: <1446010707-7527-1-git-send-email-dliu@redhat.com> (raw)

logged_chars would be set to 0 by `dmesg -c`, but we want to get the
full dmesg after crash. 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, which
is coherent to how crash utility deals with dmesg length.

Signed-off-by: Dangyi Liu <dliu@redhat.com>
---
 vmcore-dmesg/vmcore-dmesg.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c
index f47ee11..ec2570f 100644
--- a/vmcore-dmesg/vmcore-dmesg.c
+++ b/vmcore-dmesg/vmcore-dmesg.c
@@ -540,6 +540,9 @@ static void dump_dmesg_legacy(int fd)
 		exit(53);
 	}
 
+	// `dmesg -c` would set logged_chars to 0, then we cannot get a full dmesg.
+	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

             reply	other threads:[~2015-10-28  5:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-28  5:38 Dangyi Liu [this message]
2015-10-28  7:06 ` [PATCH] vmcore-dmesg: do not use logged_chars as dmesg length Dave Young
2015-10-28  7:34   ` Dangyi Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1446010707-7527-1-git-send-email-dliu@redhat.com \
    --to=dliu@redhat.com \
    --cc=kexec@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox