Changeset View
Changeset View
Standalone View
Standalone View
sbin/init/init.c
Show First 20 Lines • Show All 299 Lines • ▼ Show 20 Lines | #endif | ||||
/* | /* | ||||
* We catch or block signals rather than ignore them, | * We catch or block signals rather than ignore them, | ||||
* so that they get reset on exec. | * so that they get reset on exec. | ||||
*/ | */ | ||||
handle(badsys, SIGSYS, 0); | handle(badsys, SIGSYS, 0); | ||||
handle(disaster, SIGABRT, SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGXCPU, | handle(disaster, SIGABRT, SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGXCPU, | ||||
SIGXFSZ, 0); | SIGXFSZ, 0); | ||||
handle(transition_handler, SIGHUP, SIGINT, SIGEMT, SIGTERM, SIGTSTP, | handle(transition_handler, SIGHUP, SIGINT, SIGEMT, SIGTERM, SIGTSTP, | ||||
SIGUSR1, SIGUSR2, 0); | SIGUSR1, SIGUSR2, SIGWINCH, 0); | ||||
handle(alrm_handler, SIGALRM, 0); | handle(alrm_handler, SIGALRM, 0); | ||||
sigfillset(&mask); | sigfillset(&mask); | ||||
delset(&mask, SIGABRT, SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGSYS, | delset(&mask, SIGABRT, SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGSYS, | ||||
SIGXCPU, SIGXFSZ, SIGHUP, SIGINT, SIGEMT, SIGTERM, SIGTSTP, | SIGXCPU, SIGXFSZ, SIGHUP, SIGINT, SIGEMT, SIGTERM, SIGTSTP, | ||||
SIGALRM, SIGUSR1, SIGUSR2, 0); | SIGALRM, SIGUSR1, SIGUSR2, SIGWINCH, 0); | ||||
sigprocmask(SIG_SETMASK, &mask, (sigset_t *) 0); | sigprocmask(SIG_SETMASK, &mask, (sigset_t *) 0); | ||||
sigemptyset(&sa.sa_mask); | sigemptyset(&sa.sa_mask); | ||||
sa.sa_flags = 0; | sa.sa_flags = 0; | ||||
sa.sa_handler = SIG_IGN; | sa.sa_handler = SIG_IGN; | ||||
sigaction(SIGTTIN, &sa, (struct sigaction *)0); | sigaction(SIGTTIN, &sa, (struct sigaction *)0); | ||||
sigaction(SIGTTOU, &sa, (struct sigaction *)0); | sigaction(SIGTTOU, &sa, (struct sigaction *)0); | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 1,230 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
switch (sig) { | switch (sig) { | ||||
case SIGHUP: | case SIGHUP: | ||||
if (current_state == read_ttys || current_state == multi_user || | if (current_state == read_ttys || current_state == multi_user || | ||||
current_state == clean_ttys || current_state == catatonia) | current_state == clean_ttys || current_state == catatonia) | ||||
requested_transition = clean_ttys; | requested_transition = clean_ttys; | ||||
break; | break; | ||||
case SIGWINCH: | |||||
case SIGUSR2: | case SIGUSR2: | ||||
howto = RB_POWEROFF; | howto = sig == SIGUSR2 ? RB_POWEROFF : RB_POWERCYCLE; | ||||
case SIGUSR1: | case SIGUSR1: | ||||
howto |= RB_HALT; | howto |= RB_HALT; | ||||
case SIGINT: | case SIGINT: | ||||
Reboot = TRUE; | Reboot = TRUE; | ||||
case SIGTERM: | case SIGTERM: | ||||
if (current_state == read_ttys || current_state == multi_user || | if (current_state == read_ttys || current_state == multi_user || | ||||
current_state == clean_ttys || current_state == catatonia) | current_state == clean_ttys || current_state == catatonia) | ||||
requested_transition = death; | requested_transition = death; | ||||
▲ Show 20 Lines • Show All 433 Lines • Show Last 20 Lines |