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@xxxxxxxxxx> http://karelzak.blogspot.com -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html