Re: [PATCH] report size of printk buffer

From: Roman Zippel
Date: Wed May 05 2004 - 15:46:29 EST


Hi,

On Tue, 4 May 2004 Andries.Brouwer@xxxxxx wrote:

> In the old days the printk log buffer had a constant size,
> and dmesg asked for the 4096, later 8192, later 16384 bytes in there.
> These days the printk log buffer has variable size, and it is not
> easy for dmesg to do the right thing, especially when doing a
> "read and clear".

Why don't you simply change it into "read and clear read data"?
E.g. something like below.

bye, Roman

Index: kernel/printk.c
===================================================================
RCS file: /usr/src/cvsroot/linux-2.6/kernel/printk.c,v
retrieving revision 1.1.1.6
diff -u -p -r1.1.1.6 printk.c
--- a/kernel/printk.c 11 Mar 2004 18:34:55 -0000 1.1.1.6
+++ b/kernel/printk.c 5 May 2004 20:39:05 -0000
@@ -305,7 +305,7 @@ int do_syslog(int type, char __user * bu
if (count > logged_chars)
count = logged_chars;
if (do_clear)
- logged_chars = 0;
+ logged_chars -= count;
limit = log_end;
/*
* __put_user() could sleep, and while we sleep

-
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/