--- linux/kernel/chr_drv/vt.c 2018/04/24 18:08:17 1.1.1.1 +++ linux/kernel/chr_drv/vt.c 2018/04/24 18:10:13 1.1.1.2 @@ -15,6 +15,7 @@ #include #include +#include #include #include "vt_kern.h" @@ -23,9 +24,8 @@ * console (vt and kd) routines, as defined by usl svr4 manual */ -struct vt_cons vt_cons[MAX_CONSOLES]; +struct vt_cons vt_cons[NR_CONSOLES]; -extern int NR_CONSOLES; extern unsigned char kleds; extern unsigned char kraw; extern unsigned char ke0; @@ -121,7 +121,17 @@ vt_ioctl(struct tty_struct *tty, int dev default: return -EINVAL; } - vt_cons[console].vt_mode = arg; + if (vt_cons[console].vt_mode == (unsigned char) arg) + return 0; + vt_cons[console].vt_mode = (unsigned char) arg; + if (console != fg_console) + return 0; + if (arg == KD_TEXT) + unblank_screen(); + else { + timer_active &= 1<read_q); - flush(tty->secondary); + flush_input(tty); return 0; case KDGKBMODE: verify_area((void *) arg, sizeof(unsigned long));