Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Feb 2008 11:22:24 +0100
From:      Rink Springer <rink@freebsd.org>
To:        Jeremy Chadwick <koitsu@freebsd.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: cool feature of dmesg.boot file
Message-ID:  <20080222102224.GA87406@rink.nu>
In-Reply-To: <20080222100924.GA26637@eos.sc1.parodius.com>
References:  <20080222092506.GA25704@eos.sc1.parodius.com> <200802220952.m1M9qskE001105@lurza.secnetix.de> <20080222100924.GA26637@eos.sc1.parodius.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Feb 22, 2008 at 02:09:24AM -0800, Jeremy Chadwick wrote:
> Maybe I should look into writing a patch that does in fact clear the
> buffer immediately before reboot, and tie it to a sysctl.

I suggest just making a loader tunable to do this. I think the following
should do it (untested):

--- subr_prf.c  2007-03-08 07:44:34.000000000 +0100
+++ subr_prf.new.c      2008-02-22 11:21:53.000000000 +0100
@@ -913,14 +913,20 @@
 msgbufinit(void *ptr, int size)
 {
        char *cp;
+       char *rv;
        static struct msgbuf *oldp = NULL;

        size -= sizeof(*msgbufp);
        cp = (char *)ptr;
        msgbufp = (struct msgbuf *)(cp + size);
-       msgbuf_reinit(msgbufp, cp, size);
-       if (msgbufmapped && oldp != msgbufp)
-               msgbuf_copy(oldp, msgbufp);
+       rv = getenv("kern.ignore_old_msgbuf");
+       if (rv != NULL && strncmp(rv, "1", 1) != 0) {
+                msgbuf_clear(mbp);
+       } else {
+               msgbuf_reinit(msgbufp, cp, size);
+               if (msgbufmapped && oldp != msgbufp)
+                       msgbuf_copy(oldp, msgbufp);
+       }
        msgbufmapped = 1;
        oldp = msgbufp;
 }

Regards,

-- 
Rink P.W. Springer                                - http://rink.nu
"Anyway boys, this is America. Just because you get more votes doesn't
 mean you win." - Fox Mulder



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080222102224.GA87406>