[PATCH] printk: detect incomplete lines

From: Vegard Nossum
Date: Mon May 12 2008 - 07:17:19 EST


This patch makes printk() remember the previous caller, and if changed,
output a newline to make the next message start in the right place.

Signed-off-by: Vegard Nossum <vegard.nossum@xxxxxxxxx>
---
kernel/printk.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/kernel/printk.c b/kernel/printk.c
index 8fb01c3..6080e66 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -672,6 +672,7 @@ static int printk_recursion_bug;

asmlinkage int vprintk(const char *fmt, va_list args)
{
+ static void *prev_caller;
static int log_level_unknown = 1;
static char printk_buf[1024];

@@ -718,6 +719,16 @@ asmlinkage int vprintk(const char *fmt, va_list args)
printed_len += vscnprintf(printk_buf + printed_len,
sizeof(printk_buf) - printed_len, fmt, args);

+ if (prev_caller != __builtin_frame_address(0) && !log_level_unknown) {
+ emit_log_char('.');
+ emit_log_char('.');
+ emit_log_char('.');
+ emit_log_char('\n');
+ log_level_unknown = 1;
+ }
+
+ prev_caller = __builtin_frame_address(0);
+
/*
* Copy the output into log_buf. If the caller didn't provide
* appropriate log level tags, we insert them here
--
1.5.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/