----- Original Message -----
Hi Dave,
Currently the log command does not print '\n' and '\t'. The reason
is that isprint() does not return true for those characters.
This patch adds the isspace() test in order to print these characters
properly.
Michael
---
kernel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/kernel.c
+++ b/kernel.c
@@ -4164,7 +4164,7 @@ dump_log_entry(char *logptr, int msg_fla
}
for (i = 0, p = msg; i < text_len; i++, p++)
- fputc(isprint(*p) ? *p : '.', fp);
+ fputc(isprint(*p) || isspace(*p) ? *p : '.', fp);
if (dict_len & (msg_flags & SHOW_LOG_DICT)) {
fprintf(fp, "\n");
Hmmm, that's OK, but it still looks a bit strange.
For example, without the patch, entries 003371 and 003695 show
the issue:
crash> log
...
[ 0.003371] ENERGY_PERF_BIAS: Set to 'normal', was
'performance'.ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)
[ 0.003678] mce: CPU supports 7 MCE banks
[ 0.003687] CPU0: Thermal monitoring enabled (TM1)
[ 0.003692] process: using mwait in idle threads
[ 0.003695] Last level iTLB entries: 4KB 512, 2MB 0, 4MB 0.Last level dTLB entries:
4KB 512, 2MB 32, 4MB 32.tlb_flushall_shift is 0x1
[ 0.004676] ACPI: Core revision 20120711
...
With your patch applied:
crash> log
...
[ 0.003371] ENERGY_PERF_BIAS: Set to 'normal', was 'performance'
ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)
[ 0.003678] mce: CPU supports 7 MCE banks
[ 0.003687] CPU0: Thermal monitoring enabled (TM1)
[ 0.003692] process: using mwait in idle threads
[ 0.003695] Last level iTLB entries: 4KB 512, 2MB 0, 4MB 0
Last level dTLB entries: 4KB 512, 2MB 32, 4MB 32
tlb_flushall_shift is 0x1
[ 0.004676] ACPI: Core revision 20120711
...
But, note that the dmesg(1) command repeats the timestamp for each line:
$ dmesg
...
[ 0.003371] ENERGY_PERF_BIAS: Set to 'normal', was 'performance'
[ 0.003371] ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)
[ 0.003678] mce: CPU supports 7 MCE banks
[ 0.003687] CPU0: Thermal monitoring enabled (TM1)
[ 0.003692] process: using mwait in idle threads
[ 0.003695] Last level iTLB entries: 4KB 512, 2MB 0, 4MB 0
[ 0.003695] Last level dTLB entries: 4KB 512, 2MB 32, 4MB 32
[ 0.003695] tlb_flushall_shift is 0x1
[ 0.004676] ACPI: Core revision 20120711
...
I think that the log command should either (1) repeat the timestamp as
dmesg(1) does, or (2) insert "ilen" number of spaces before printing the
extra message lines.
What do you think?
Dave