Subject: Re: How do I change the size of msgbuf? (dmesg buffer)
To: None <>
From: Antti Kantee <>
List: tech-kern
Date: 12/10/2007 20:55:59
On Mon Dec 10 2007 at 10:51:36 -0800, wrote:
> Hello NetBSD kernel gurus,
> I am in the midst of porting a driver from FreeBSD to NetBSD.  It would
> be real helpful if I could increase the size of the DMESG buffer (msgbuf).
> I'm building/testing under the AMD64 platform.  I found 'msgbuf_p_cnt' in
> /usr/src/sys/arch/amd64/amd64/machdep.c which appears to be what controls
> the size of msgbuf, but it's initialized to 0 and I don't see it ever set
> or referenced anyplace else in the kernel!  Obviously, I'm missing something.

You can set MSGBUFSIZE in your kernel config, e.g.:
options         MSGBUFSIZE=262144

Then re{config,compile,boot}.

> I even tried adding the line 'kern.msgbufsize=131000' to /etc/sysctl.conf
> and rebooting, but the size always shows up at 16352.  What am I not seeing??

That value is read-only, see sysctl(7).

Antti Kantee <>                     Of course he runs NetBSD                
    "la qualité la plus indispensable du cuisinier est l'exactitude"