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.
This commit is contained in:
parent
dd7650a8bd
commit
3e755f76d1
@ -3098,7 +3098,7 @@ scgetc(sc_softc_t *sc, u_int flags)
|
||||
|
||||
case RBT:
|
||||
#ifndef SC_DISABLE_REBOOT
|
||||
shutdown_nice();
|
||||
shutdown_nice(0);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
@ -938,7 +938,7 @@ sgetc(int noblock)
|
||||
|
||||
#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 */
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user