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)
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;
}
/*===========================================================================*
{
/* 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;
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) );
expire_timers();
break;
case PM_PROC_NR:
- /* switch to primary console */
- cons_stop();
+ /* signal */
+ got_signal();
break;
case SYSTEM:
/* system signal */
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 *
*===========================================================================*/