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 cons_table[NR_CONS];
 | 
				
			||||||
PRIVATE console_t *curcons = NULL;	/* currently visible */
 | 
					PRIVATE console_t *curcons = NULL;	/* currently visible */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PRIVATE int shutting_down = FALSE;	/* don't allow console switches */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Color if using a color controller. */
 | 
					/* Color if using a color controller. */
 | 
				
			||||||
#define color	(vid_port == C_6845)
 | 
					#define color	(vid_port == C_6845)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1228,12 +1230,11 @@ PUBLIC void toggle_scroll()
 | 
				
			|||||||
PUBLIC void cons_stop()
 | 
					PUBLIC void cons_stop()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
/* Prepare for halt or reboot. */
 | 
					/* Prepare for halt or reboot. */
 | 
				
			||||||
  select_console(0);
 | 
					 | 
				
			||||||
#if 0
 | 
					 | 
				
			||||||
  cons_org0();
 | 
					  cons_org0();
 | 
				
			||||||
  softscroll = 1;
 | 
					  softscroll = 1;
 | 
				
			||||||
 | 
					  select_console(0);
 | 
				
			||||||
  cons_table[0].c_attr = cons_table[0].c_blank = BLANK_COLOR;
 | 
					  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'. */
 | 
					/* Set the current console to console number 'cons_line'. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (shutting_down) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (cons_line < 0 || cons_line >= nr_cons) return;
 | 
					  if (cons_line < 0 || cons_line >= nr_cons) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ccurrent = cons_line;
 | 
					  ccurrent = cons_line;
 | 
				
			||||||
 | 
				
			|||||||
@ -102,6 +102,7 @@ unsigned long rs_irq_set = 0;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
struct kmessages kmess;
 | 
					struct kmessages kmess;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FORWARD _PROTOTYPE( void got_signal, (void)				);
 | 
				
			||||||
FORWARD _PROTOTYPE( void tty_timed_out, (timer_t *tp)			);
 | 
					FORWARD _PROTOTYPE( void tty_timed_out, (timer_t *tp)			);
 | 
				
			||||||
FORWARD _PROTOTYPE( void expire_timers, (void)				);
 | 
					FORWARD _PROTOTYPE( void expire_timers, (void)				);
 | 
				
			||||||
FORWARD _PROTOTYPE( void settimer, (tty_t *tty_ptr, int enable)		);
 | 
					FORWARD _PROTOTYPE( void settimer, (tty_t *tty_ptr, int enable)		);
 | 
				
			||||||
@ -219,8 +220,8 @@ PUBLIC int main(void)
 | 
				
			|||||||
				expire_timers();
 | 
									expire_timers();
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			case PM_PROC_NR:
 | 
								case PM_PROC_NR:
 | 
				
			||||||
				/* switch to primary console */
 | 
									/* signal */
 | 
				
			||||||
				cons_stop();
 | 
									got_signal();
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			case SYSTEM:
 | 
								case SYSTEM:
 | 
				
			||||||
				/* system signal */
 | 
									/* system signal */
 | 
				
			||||||
@ -343,6 +344,24 @@ PRIVATE void sef_local_startup()
 | 
				
			|||||||
  sef_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				     *
 | 
					 *				do_status				     *
 | 
				
			||||||
 *===========================================================================*/
 | 
					 *===========================================================================*/
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user