From rene@tunix.nl  Fri Jun 25 10:54:10 2004
Return-Path: <rene@tunix.nl>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 688C816A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 25 Jun 2004 10:54:10 +0000 (GMT)
Received: from bastix.tunix.nl (bastix.tunix.nl [193.79.201.39])
	by mx1.FreeBSD.org (Postfix) with ESMTP id C371043D54
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 25 Jun 2004 10:54:08 +0000 (GMT)
	(envelope-from rene@tunix.nl)
Received: (from root@localhost) by bastix.tunix.nl (8.9.3c/8.6.12) id MAA00658 for <FreeBSD-gnats-submit@freebsd.org>; Fri, 25 Jun 2004 12:53:47 +0200 (CEST)
Received: by bastix.tunix.nl (TUNIX txp2/smap)
	for <FreeBSD-gnats-submit@freebsd.org> id sma000396; Fri, 25 Jun 04 12:53:06 +0200
Received: from upsilix.tunix.nl (upsilix.tunix.nl [172.16.2.22])
	by fix.tunix.nl (8.10.2+Sun/8.10.2) with ESMTP id i5PAr6o29809
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 25 Jun 2004 12:53:06 +0200 (MEST)
Received: from upsilix.tunix.nl (localhost.tunix.nl [127.0.0.1])
	by upsilix.tunix.nl (8.12.8p2/8.12.6) with ESMTP id i5PAr6D2063447
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 25 Jun 2004 12:53:06 +0200 (CEST)
	(envelope-from rene@upsilix.tunix.nl)
Received: (from rene@localhost)
	by upsilix.tunix.nl (8.12.8p2/8.12.6/Submit) id i5PAr6QX063446;
	Fri, 25 Jun 2004 12:53:06 +0200 (CEST)
	(envelope-from rene)
Message-Id: <200406251053.i5PAr6QX063446@upsilix.tunix.nl>
Date: Fri, 25 Jun 2004 12:53:06 +0200 (CEST)
From: Rene de Vries <rene@tunix.nl>
Reply-To: Rene de Vries <rene@tunix.nl>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: on soft (clean) reboots clean dmesg output
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         68317
>Category:       kern
>Synopsis:       [kernel] [patch] on soft (clean) reboots clean dmesg output
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          suspended
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 25 11:00:35 GMT 2004
>Closed-Date:    
>Last-Modified:  Wed May 07 22:02:18 UTC 2008
>Originator:     Rene de Vries
>Release:        FreeBSD 4.8 i386
>Organization:
Tunix Internet Security & Training
>Environment:
System: FreeBSD upsilix.tunix.nl 4.8 FreeBSD 4.8-RELEASE-p16 #7: Wed Mar 3 15:00:31 CET 2004 rene@upsilix.tunix.nl:/usr/obj/usr/src/sys/UPSILIX i386

>Description:
	On clean reboots wipe the dmesg output. For all other reboots
	try to keep as much as possible (no change there).

Index: sys/kern/kern_shutdown.c
===================================================================
RCS file: sys/kern/kern_shutdown.c,v
retrieving revision 1.1.1.4
retrieving revision 1.2
diff -u -r1.1.1.4 -r1.2
--- sys/kern/kern_shutdown.c	2002/08/28 08:58:58	1.1.1.4
+++ sys/kern/kern_shutdown.c	2004/03/02 13:51:36	1.2
@@ -61,6 +61,7 @@
 #include <sys/conf.h>
 #include <sys/sysproto.h>
 #include <sys/cons.h>
+#include <sys/msgbuf.h>
 
 #include <machine/pcb.h>
 #include <machine/clock.h>
@@ -332,6 +333,10 @@
 		printf("\n");
 		printf("The operating system has halted.\n");
 		printf("Please press any key to reboot.\n\n");
+		if (msgbufp != (struct msgbuf *) 0) {
+			/* fix dmesg buffer on soft reboot */
+			msgbufp->msg_magic = 0;
+		}
 		switch (cngetc()) {
 		case -1:		/* No console, just die */
 			cpu_halt();
@@ -385,6 +390,10 @@
 {
 	printf("Rebooting...\n");
 	DELAY(1000000);	/* wait 1 sec for printf's to complete and be read */
+	if (msgbufp != (struct msgbuf *) 0) {
+		/* fix dmesg buffer on soft reboot */
+		msgbufp->msg_magic = 0;
+	}
 	/* cpu_boot(howto); */ /* doesn't do anything at the moment */
 	cpu_reset();
 	/* NOTREACHED */ /* assuming reset worked */
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:

From: Volker <volker@vwsoft.com>
To: bug-followup@FreeBSD.org, rene@tunix.nl
Cc:  
Subject: Re: kern/68317: [kernel] [patch] on soft (clean) reboots clean dmesg
 output
Date: Fri, 15 Feb 2008 17:02:33 +0100

 Rene,
 
 I found your patch hocking in GNATS for quite some time. I'm sorry your
 patch hasn't committed yet.
 
 I'm wondering if you're able to bring your patch up to date against a
 recent RELENG_7 or CURRENT and send us the updated patch? Also I think
 that functionality should be enabled by a sysctl.
 
 Thanks for your work!
State-Changed-From-To: open->feedback 
State-Changed-By: linimon 
State-Changed-When: Fri Feb 15 17:18:00 UTC 2008 
State-Changed-Why:  
Note that submitter has been asked for feedback. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=68317 
State-Changed-From-To: feedback->suspended 
State-Changed-By: vwe 
State-Changed-When: Wed May 7 22:01:34 UTC 2008 
State-Changed-Why:  

Mark suspended awaiting more recent patches. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=68317 
>Unformatted:
