Re: [PATCH] report size of printk buffer

From: Andries Brouwer
Date: Thu May 06 2004 - 08:45:25 EST


On Wed, May 05, 2004 at 10:42:10PM +0200, Roman Zippel wrote:

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

No, that is buggy.

If one asks for count bytes, one gets the last count bytes of output,
not the first.

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