summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2003-02-14 12:44:48 +0000
committeralfred <alfred@FreeBSD.org>2003-02-14 12:44:48 +0000
commit6c48c14c4929b75deeaa10e0726ebea8d04c85ef (patch)
tree2ca82bde4343338cb473c313d0262b0db8565caa
parent952ec160dd185037ab55a2db9b985478dd769808 (diff)
downloadFreeBSD-src-6c48c14c4929b75deeaa10e0726ebea8d04c85ef.zip
FreeBSD-src-6c48c14c4929b75deeaa10e0726ebea8d04c85ef.tar.gz
style.
-rw-r--r--sys/kern/kern_shutdown.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index 3bd138b..1ab072c 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -139,13 +139,18 @@ static void shutdown_panic(void *junk, int howto);
static void shutdown_reset(void *junk, int howto);
/* register various local shutdown events */
-static void
+static void
shutdown_conf(void *unused)
{
- EVENTHANDLER_REGISTER(shutdown_final, poweroff_wait, NULL, SHUTDOWN_PRI_FIRST);
- EVENTHANDLER_REGISTER(shutdown_final, shutdown_halt, NULL, SHUTDOWN_PRI_LAST + 100);
- EVENTHANDLER_REGISTER(shutdown_final, shutdown_panic, NULL, SHUTDOWN_PRI_LAST + 100);
- EVENTHANDLER_REGISTER(shutdown_final, shutdown_reset, NULL, SHUTDOWN_PRI_LAST + 200);
+
+ EVENTHANDLER_REGISTER(shutdown_final, poweroff_wait, NULL,
+ SHUTDOWN_PRI_FIRST);
+ EVENTHANDLER_REGISTER(shutdown_final, shutdown_halt, NULL,
+ SHUTDOWN_PRI_LAST + 100);
+ EVENTHANDLER_REGISTER(shutdown_final, shutdown_panic, NULL,
+ SHUTDOWN_PRI_LAST + 100);
+ EVENTHANDLER_REGISTER(shutdown_final, shutdown_reset, NULL,
+ SHUTDOWN_PRI_LAST + 200);
}
SYSINIT(shutdown_conf, SI_SUB_INTRINSIC, SI_ORDER_ANY, shutdown_conf, NULL)
@@ -183,8 +188,9 @@ static int shutdown_howto = 0;
void
shutdown_nice(int howto)
{
+
shutdown_howto = howto;
-
+
/* Send a signal to init(8) and have it shutdown the world */
if (initproc != NULL) {
PROC_LOCK(initproc);
@@ -228,6 +234,7 @@ print_uptime(void)
static void
doadump(void)
{
+
savectx(&dumppcb);
dumping++;
dumpsys(&dumper);
@@ -376,6 +383,7 @@ boot(int howto)
static void
shutdown_halt(void *junk, int howto)
{
+
if (howto & RB_HALT) {
printf("\n");
printf("The operating system has halted.\n");
@@ -431,6 +439,7 @@ shutdown_panic(void *junk, int howto)
static void
shutdown_reset(void *junk, int howto)
{
+
printf("Rebooting...\n");
DELAY(1000000); /* wait 1 sec for printf's to complete and be read */
/* cpu_boot(howto); */ /* doesn't do anything at the moment */
@@ -445,6 +454,7 @@ shutdown_reset(void *junk, int howto)
void
backtrace(void)
{
+
#ifdef DDB
printf("Stack backtrace:\n");
db_print_backtrace();
@@ -543,10 +553,11 @@ static int poweroff_delay = POWEROFF_DELAY;
SYSCTL_INT(_kern_shutdown, OID_AUTO, poweroff_delay, CTLFLAG_RW,
&poweroff_delay, 0, "");
-static void
+static void
poweroff_wait(void *junk, int howto)
{
- if(!(howto & RB_POWEROFF) || poweroff_delay <= 0)
+
+ if (!(howto & RB_POWEROFF) || poweroff_delay <= 0)
return;
DELAY(poweroff_delay * 1000);
}
@@ -586,6 +597,7 @@ kproc_shutdown(void *arg, int howto)
int
set_dumper(struct dumperinfo *di)
{
+
if (di == NULL) {
bzero(&dumper, sizeof dumper);
return (0);
OpenPOWER on IntegriCloud