Module Name:    src
Committed By:   jmcneill
Date:           Sun Jan 15 10:45:03 UTC 2012

Modified Files:
        src/sys/arch/usermode/dev: cpu.c

Log Message:
sync disks and unmount at shutdown, and run shutdownhooks + pmf shutdown
handlers


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/usermode/dev/cpu.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/arch/usermode/dev/cpu.c
diff -u src/sys/arch/usermode/dev/cpu.c:1.66 src/sys/arch/usermode/dev/cpu.c:1.67
--- src/sys/arch/usermode/dev/cpu.c:1.66	Sun Jan 15 10:18:58 2012
+++ src/sys/arch/usermode/dev/cpu.c	Sun Jan 15 10:45:03 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.66 2012/01/15 10:18:58 jmcneill Exp $ */
+/* $NetBSD: cpu.c,v 1.67 2012/01/15 10:45:03 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <[email protected]>
@@ -30,7 +30,7 @@
 #include "opt_hz.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.66 2012/01/15 10:18:58 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.67 2012/01/15 10:45:03 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.66
 #include <sys/msgbuf.h>
 #include <sys/kmem.h>
 #include <sys/kernel.h>
+#include <sys/mount.h>
 
 #include <dev/cons.h>
 
@@ -127,11 +128,22 @@ cpu_reboot(int howto, char *bootstr)
 {
 	extern void usermode_reboot(void);
 
-	splhigh();
+	if (cold)
+		howto |= RB_HALT;
+
+	if ((howto & RB_NOSYNC) == 0)
+		vfs_shutdown();
+	else
+		suspendsched();
+
+	doshutdownhooks();
+	pmf_system_shutdown(boothowto);
 
 	if ((howto & RB_POWERDOWN) == RB_POWERDOWN)
 		thunk_exit(0);
 
+	splhigh();
+
 	if (howto & RB_DUMP)
 		thunk_abort();
 

Reply via email to