Module Name:    src
Committed By:   christos
Date:           Sat Jan 11 17:07:45 UTC 2014

Modified Files:
        src/sys/kern: subr_prf.c

Log Message:
Sleep 10 seconds before rebooting due to panic()
To give an opportunity to screencap a panic(), or pause a VM to attach
a debugger.  (Richard Hansen)


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/sys/kern/subr_prf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_prf.c
diff -u src/sys/kern/subr_prf.c:1.150 src/sys/kern/subr_prf.c:1.151
--- src/sys/kern/subr_prf.c:1.150	Sun Feb 10 06:04:19 2013
+++ src/sys/kern/subr_prf.c	Sat Jan 11 12:07:45 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_prf.c,v 1.150 2013/02/10 11:04:19 apb Exp $	*/
+/*	$NetBSD: subr_prf.c,v 1.151 2014/01/11 17:07:45 christos Exp $	*/
 
 /*-
  * Copyright (c) 1986, 1988, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.150 2013/02/10 11:04:19 apb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.151 2014/01/11 17:07:45 christos Exp $");
 
 #include "opt_ddb.h"
 #include "opt_ipkdb.h"
@@ -281,6 +281,19 @@ vpanic(const char *fmt, va_list ap)
 #ifdef DDB
 	db_panic();
 #endif
+	printf("rebooting in");
+	for (int i = 10; i >= 0; --i) {
+		printf(" %u", i);
+		/*
+		 * sleep 10ms 100 times instead of 1s once to give a
+		 * VM hypervisor an opportunity to redraw part of the
+		 * screen during each call
+		 */
+		for (int j=0; i && j < 100; ++j) {
+			DELAY(10000);
+		}
+	}
+	printf("\n");
 	cpu_reboot(bootopt, NULL);
 }
 

Reply via email to