[PATCH] log: fix log level print in older kernels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In older kernels, the log level and the log priority are not
separated.  Since the log level is only the last three bits,
print only those last three bits when using 'log -m'.

Suggested-by: David Jeffery <djeffery@xxxxxxxxxx>
Signed-off-by: John Pittman <jpittman@xxxxxxxxxx>
---
 defs.h   | 1 +
 kernel.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/defs.h b/defs.h
index 35cdac2..35b983a 100644
--- a/defs.h
+++ b/defs.h
@@ -5627,6 +5627,7 @@ void clone_bt_info(struct bt_info *, struct bt_info *, struct task_context *);
 void dump_kernel_table(int);
 void dump_bt_info(struct bt_info *, char *where);
 void dump_log(int);
+#define LOG_LEVEL(v) ((v) & 0x07)
 #define SHOW_LOG_LEVEL (0x1)
 #define SHOW_LOG_DICT  (0x2)
 #define SHOW_LOG_TEXT  (0x4)
diff --git a/kernel.c b/kernel.c
index ac765e3..735263c 100644
--- a/kernel.c
+++ b/kernel.c
@@ -5262,6 +5262,8 @@ dump_log_entry(char *logptr, int msg_flags)
 		fprintf(fp, "%s", buf);
 	}
 
+	level = LOG_LEVEL(level);
+
 	if (msg_flags & SHOW_LOG_LEVEL) {
 		sprintf(buf, "<%x>", level);
 		ilen += strlen(buf);
-- 
2.17.2

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux