util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Karel Zak <kzak@redhat.com>
To: Prarit Bhargava <prarit@redhat.com>
Cc: util-linux@vger.kernel.org, anderson@redhat.com
Subject: Re: [PATCH] dmesg: Add force-prefix option
Date: Wed, 1 Nov 2017 15:47:03 +0100	[thread overview]
Message-ID: <20171101144703.adnh6nnft2c3f5qv@ws.net.home> (raw)
In-Reply-To: <20171031120131.5837-1-prarit@redhat.com>

On Tue, Oct 31, 2017 at 08:01:31AM -0400, Prarit Bhargava wrote:
> The kernel outputs multi-line messages (kernel messages that contain
> the end-of-line character '\n').  These message are currently displayed by
> dmesg as
> 
> [965199.028940] runnable tasks:
>                            task   PID         tree-key  switches  prio
> wait-time             sum-exec        sum-sleep
>                 ----------------------------------------------------------------------------------------------------------
> 
> The kernel timestamps each of these lines with [965199.028940] and the
> dmesg utility should do the same.
> 
> Add the 'force-prefix'/'-p' dmesg option to add decode & timestamp information
> to each line of a multi-line message.
> 
> Notes: The new print_record() algorithm stores the decode & timestamp
> information in buffers.  If the force-prefix option is used, the message is
> split into separate lines and each line is prefixed with the stored decode &
> timestamp information.  The splitting of the message into separate lines is
> done using strtok() which requires write access to the message buffer (ie, the
> const message buffer is now copied into a writeable buffer).
> 
> Successfully tested by me by looking at sysrq-t and sysrq-w output.
> All known good /tests passed with these changes.

Merged with some changes:

     - use snprintf()
     - cleanup \n usage (don't count line break to the
       message text in the parsers  and always print \n after the text
     - add the option to the man page
     - use --force-prefix for kmsg only, old syslog(2) API splits messages itself
     - strdup() the message text only on force-prefix

Please, test it again :-)

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

  reply	other threads:[~2017-11-01 14:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-31 12:01 [PATCH] dmesg: Add force-prefix option Prarit Bhargava
2017-11-01 14:47 ` Karel Zak [this message]
2017-11-01 16:52   ` Prarit Bhargava

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=20171101144703.adnh6nnft2c3f5qv@ws.net.home \
    --to=kzak@redhat.com \
    --cc=anderson@redhat.com \
    --cc=prarit@redhat.com \
    --cc=util-linux@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).