diff options
author | msmith <msmith@FreeBSD.org> | 2000-08-31 00:08:50 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 2000-08-31 00:08:50 +0000 |
commit | afc6787158045131a17b21bc5d97f5ab2e957025 (patch) | |
tree | bc8d4fc17933b763fe18328e6b570b77c7f77e9a | |
parent | 814369526cbe56d7630a8d9534b8d71cb7b12d64 (diff) | |
download | FreeBSD-src-afc6787158045131a17b21bc5d97f5ab2e957025.zip FreeBSD-src-afc6787158045131a17b21bc5d97f5ab2e957025.tar.gz |
Make it possible to pass boot()'s flags to shutdown_nice() so that the
kernel can instigate an orderly shutdown but still determine the form of
that shutdown. Make it possible eg. to cleanly shutdown and power off the
system under ACPI when the power button is pressed.
-rw-r--r-- | sys/dev/syscons/syscons.c | 2 | ||||
-rw-r--r-- | sys/i386/isa/pcvt/pcvt_kbd.c | 2 | ||||
-rw-r--r-- | sys/kern/kern_shutdown.c | 9 | ||||
-rw-r--r-- | sys/sys/systm.h | 2 |
4 files changed, 11 insertions, 4 deletions
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 2a447f7..49b8f6c 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -3098,7 +3098,7 @@ next_code: case RBT: #ifndef SC_DISABLE_REBOOT - shutdown_nice(); + shutdown_nice(0); #endif break; diff --git a/sys/i386/isa/pcvt/pcvt_kbd.c b/sys/i386/isa/pcvt/pcvt_kbd.c index 85296a1..f7f946d 100644 --- a/sys/i386/isa/pcvt/pcvt_kbd.c +++ b/sys/i386/isa/pcvt/pcvt_kbd.c @@ -938,7 +938,7 @@ scroll_reset: #if PCVT_CTRL_ALT_DEL /* Check for cntl-alt-del */ if((key == 76) && ctrl_down && (meta_down||altgr_down)) - shutdown_nice(); + shutdown_nice(0); #endif /* PCVT_CTRL_ALT_DEL */ #if defined(DDB) /* Check for cntl-alt-esc */ diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index cf8081f..258699e 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -150,9 +150,13 @@ reboot(p, uap) /* * Called by events that want to shut down.. e.g <CTL><ALT><DEL> on a PC */ +static int shutdown_howto = 0; + void -shutdown_nice() +shutdown_nice(int howto) { + shutdown_howto = howto; + /* Send a signal to init(8) and have it shutdown the world */ if (initproc != NULL) { psignal(initproc, SIGINT); @@ -202,6 +206,9 @@ boot(howto) int howto; { + /* collect extra flags that shutdown_nice might have set */ + howto |= shutdown_howto; + #ifdef SMP if (smp_active) { printf("boot() called on cpu#%d\n", cpuid); diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 3f900a8..0e8f9bb 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -184,7 +184,7 @@ void usrinfoinit __P((void)); void vntblinit __P((void)); /* Finalize the world. */ -void shutdown_nice __P((void)); +void shutdown_nice __P((int)); /* * Kernel to clock driver interface. |