Bug 68317 - [kernel] [patch] on soft (clean) reboots clean dmesg output
Summary: [kernel] [patch] on soft (clean) reboots clean dmesg output
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2004-06-25 12:00 UTC by Rene de Vries
Modified: 2022-10-17 12:34 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rene de Vries 2004-06-25 12:00:35 UTC
	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 */
Comment 1 Volker 2008-02-15 16:02:33 UTC
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!
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2008-02-15 17:18:00 UTC
State Changed
From-To: open->feedback

Note that submitter has been asked for feedback.
Comment 3 Volker Werth freebsd_committer freebsd_triage 2008-05-07 23:01:34 UTC
State Changed
From-To: feedback->suspended


Mark suspended awaiting more recent patches.
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2018-05-20 23:50:42 UTC
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017

Do
- Set Status to "Open"
Comment 5 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:34:08 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>