Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_shutdown.c
Show First 20 Lines • Show All 257 Lines • ▼ Show 20 Lines | |||||
shutdown_nice(int howto) | shutdown_nice(int howto) | ||||
{ | { | ||||
if (initproc != NULL) { | if (initproc != NULL) { | ||||
/* Send a signal to init(8) and have it shutdown the world. */ | /* Send a signal to init(8) and have it shutdown the world. */ | ||||
PROC_LOCK(initproc); | PROC_LOCK(initproc); | ||||
if (howto & RB_POWEROFF) | if (howto & RB_POWEROFF) | ||||
kern_psignal(initproc, SIGUSR2); | kern_psignal(initproc, SIGUSR2); | ||||
else if (howto & RB_POWERCYCLE) | |||||
kern_psignal(initproc, SIGWINCH); | |||||
jtl: SIGWINCH? | |||||
else if (howto & RB_HALT) | else if (howto & RB_HALT) | ||||
kern_psignal(initproc, SIGUSR1); | kern_psignal(initproc, SIGUSR1); | ||||
else | else | ||||
kern_psignal(initproc, SIGINT); | kern_psignal(initproc, SIGINT); | ||||
PROC_UNLOCK(initproc); | PROC_UNLOCK(initproc); | ||||
} else { | } else { | ||||
/* No init(8) running, so simply reboot. */ | /* No init(8) running, so simply reboot. */ | ||||
kern_reboot(howto | RB_NOSYNC); | kern_reboot(howto | RB_NOSYNC); | ||||
▲ Show 20 Lines • Show All 518 Lines • ▼ Show 20 Lines | |||||
SYSCTL_INT(_kern_shutdown, OID_AUTO, poweroff_delay, CTLFLAG_RW, | SYSCTL_INT(_kern_shutdown, OID_AUTO, poweroff_delay, CTLFLAG_RW, | ||||
&poweroff_delay, 0, "Delay before poweroff to write disk caches (msec)"); | &poweroff_delay, 0, "Delay before poweroff to write disk caches (msec)"); | ||||
static void | static void | ||||
poweroff_wait(void *junk, int howto) | poweroff_wait(void *junk, int howto) | ||||
{ | { | ||||
if (!(howto & RB_POWEROFF) || poweroff_delay <= 0) | if ((howto & (RB_POWEROFF | RB_POWERCYCLE)) == 0 || poweroff_delay <= 0) | ||||
return; | return; | ||||
DELAY(poweroff_delay * 1000); | DELAY(poweroff_delay * 1000); | ||||
} | } | ||||
/* | /* | ||||
* Some system processes (e.g. syncer) need to be stopped at appropriate | * Some system processes (e.g. syncer) need to be stopped at appropriate | ||||
* points in their main loops prior to a system shutdown, so that they | * points in their main loops prior to a system shutdown, so that they | ||||
* won't interfere with the shutdown process (e.g. by holding a disk buf | * won't interfere with the shutdown process (e.g. by holding a disk buf | ||||
▲ Show 20 Lines • Show All 454 Lines • Show Last 20 Lines |
SIGWINCH?