cool feature of dmesg.boot file

Rink Springer rink at freebsd.org
Fri Feb 22 10:22:37 UTC 2008


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


More information about the freebsd-hackers mailing list