kern/68317: on soft (clean) reboots clean dmesg output

Rene de Vries rene at tunix.nl
Fri Jun 25 11:00:44 GMT 2004


>Number:         68317
>Category:       kern
>Synopsis:       on soft (clean) reboots clean dmesg output
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>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:
>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 at 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:
>Unformatted:


More information about the freebsd-bugs mailing list