mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: <Andries.Brouwer@cwi.nl>
To: akpm@osdl.org, torvalds@osdl.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] report size of printk buffer
Date: Tue, 4 May 2004 18:09:12 +0200 (MEST)	[thread overview]
Message-ID: <UTC200405041609.i44G9CH29412.aeb@smtp.cwi.nl> (raw)

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".
The patch below adds a syslog subfuntion that reports the buffer size.

Andries

diff -uprN -X /linux/dontdiff a/kernel/printk.c b/kernel/printk.c
--- a/kernel/printk.c	2004-03-28 17:11:55.000000000 +0200
+++ b/kernel/printk.c	2004-05-04 18:00:27.000000000 +0200
@@ -240,6 +240,7 @@ __setup("log_buf_len=", log_buf_len_setu
  * 	7 -- Enable printk's to console
  *	8 -- Set level of messages printed to console
  *	9 -- Return number of unread characters in the log buffer
+ *     10 -- Return size of the log buffer
  */
 int do_syslog(int type, char __user * buf, int len)
 {
@@ -359,6 +360,9 @@ int do_syslog(int type, char __user * bu
 	case 9:		/* Number of chars in the log buffer */
 		error = log_end - log_start;
 		break;
+	case 10:	/* Size of the log buffer */
+		error = log_buf_len;
+		break;
 	default:
 		error = -EINVAL;
 		break;

             reply	other threads:[~2004-05-04 16:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-04 16:09 Andries.Brouwer [this message]
2004-05-05 13:12 ` Olaf Dabrunz
2004-05-05 20:42 ` Roman Zippel
2004-05-06 13:36   ` Andries Brouwer
2004-05-06 15:11     ` Roman Zippel
2004-05-06 15:23       ` Andries Brouwer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=UTC200405041609.i44G9CH29412.aeb@smtp.cwi.nl \
    --to=andries.brouwer@cwi.nl \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®