summaryrefslogtreecommitdiffstats
path: root/sys-utils/dmesg.1
diff options
context:
space:
mode:
authorPrarit Bhargava2017-11-01 15:37:00 +0100
committerKarel Zak2017-11-01 15:37:00 +0100
commit5f538ac40c0d215b6c9a881effe4c3b214366715 (patch)
treed26eff1ef83356b9c7dbf6bf78c64c998e76c63e /sys-utils/dmesg.1
parentlib/mangle: return size of the decoded buffer (diff)
downloadkernel-qcow2-util-linux-5f538ac40c0d215b6c9a881effe4c3b214366715.tar.gz
kernel-qcow2-util-linux-5f538ac40c0d215b6c9a881effe4c3b214366715.tar.xz
kernel-qcow2-util-linux-5f538ac40c0d215b6c9a881effe4c3b214366715.zip
dmesg: Add --force-prefix option
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. [kzak@redhat.com: - 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] Signed-off-by: Prarit Bhargava <prarit@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/dmesg.1')
-rw-r--r--sys-utils/dmesg.12
1 files changed, 2 insertions, 0 deletions
diff --git a/sys-utils/dmesg.1 b/sys-utils/dmesg.1
index b87b2301b..1dc9994ec 100644
--- a/sys-utils/dmesg.1
+++ b/sys-utils/dmesg.1
@@ -115,6 +115,8 @@ will
print or clear the kernel ring buffer.
.IP "\fB\-P\fR, \fB\-\-nopager\fR"
Do not pipe output into a pager. A pager is enabled by default for \fB\-\-human\fR output.
+.IP "\fB\-p\fR, \fB\-\-force\-prefix\fR"
+Add facility, level or timestamp information to each line of a multi-line message.
.IP "\fB\-r\fR, \fB\-\-raw\fR"
Print the raw message buffer, i.e. do not strip the log-level prefixes.