TTY fixes:
- reenable code to restore screen/cursor at shutdown - add proper signal checking logic - lock to first console during shutdown
This commit is contained in:
parent
1f5841c8ed
commit
492d663444
@ -103,6 +103,8 @@ PRIVATE int nr_cons= 1; /* actual number of consoles */
|
||||
PRIVATE console_t cons_table[NR_CONS];
|
||||
PRIVATE console_t *curcons = NULL; /* currently visible */
|
||||
|
||||
PRIVATE int shutting_down = FALSE; /* don't allow console switches */
|
||||
|
||||
/* Color if using a color controller. */
|
||||
#define color (vid_port == C_6845)
|
||||
|
||||
@ -1228,12 +1230,11 @@ PUBLIC void toggle_scroll()
|
||||
PUBLIC void cons_stop()
|
||||
{
|
||||
/* Prepare for halt or reboot. */
|
||||
select_console(0);
|
||||
#if 0
|
||||
cons_org0();
|
||||
softscroll = 1;
|
||||
select_console(0);
|
||||
cons_table[0].c_attr = cons_table[0].c_blank = BLANK_COLOR;
|
||||
#endif
|
||||
shutting_down = TRUE;
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
@ -1298,6 +1299,8 @@ PUBLIC void select_console(int cons_line)
|
||||
{
|
||||
/* Set the current console to console number 'cons_line'. */
|
||||
|
||||
if (shutting_down) return;
|
||||
|
||||
if (cons_line < 0 || cons_line >= nr_cons) return;
|
||||
|
||||
ccurrent = cons_line;
|
||||
|
@ -102,6 +102,7 @@ unsigned long rs_irq_set = 0;
|
||||
|
||||
struct kmessages kmess;
|
||||
|
||||
FORWARD _PROTOTYPE( void got_signal, (void) );
|
||||
FORWARD _PROTOTYPE( void tty_timed_out, (timer_t *tp) );
|
||||
FORWARD _PROTOTYPE( void expire_timers, (void) );
|
||||
FORWARD _PROTOTYPE( void settimer, (tty_t *tty_ptr, int enable) );
|
||||
@ -219,8 +220,8 @@ PUBLIC int main(void)
|
||||
expire_timers();
|
||||
break;
|
||||
case PM_PROC_NR:
|
||||
/* switch to primary console */
|
||||
cons_stop();
|
||||
/* signal */
|
||||
got_signal();
|
||||
break;
|
||||
case SYSTEM:
|
||||
/* system signal */
|
||||
@ -343,6 +344,24 @@ PRIVATE void sef_local_startup()
|
||||
sef_startup();
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* got_signal *
|
||||
*===========================================================================*/
|
||||
PRIVATE void got_signal()
|
||||
{
|
||||
/* PM notified us that we have received a signal. If it is a SIGTERM, assume
|
||||
* that the system is shutting down.
|
||||
*/
|
||||
sigset_t set;
|
||||
|
||||
if (getsigset(&set) != 0) return;
|
||||
|
||||
if (!sigismember(&set, SIGTERM)) return;
|
||||
|
||||
/* switch to primary console */
|
||||
cons_stop();
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_status *
|
||||
*===========================================================================*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user