// SPDX-License-Identifier: GPL-2.0/* * Copyright (C) 1992 obz under the linux copyright * * Dynamic diacritical handling - aeb@cwi.nl - Dec 1993 * Dynamic keymap and string allocation - aeb@cwi.nl - May 1994 * Restrict VT switching via ioctl() - grif@cs.ucr.edu - Dec 1995 * Some code moved for less code duplication - Andi Kleen - Mar 1997 * Check put/get_user, cleanups - acme@conectiva.com.br - Jun 2001 */#include<linux/types.h>#include<linux/errno.h>#include<linux/sched/signal.h>#include<linux/tty.h>#include<linux/timer.h>#include<linux/kernel.h>#include<linux/compat.h>#include<linux/module.h>#include<linux/kd.h>#include<linux/vt.h>#include<linux/string.h>#include<linux/slab.h>#include<linux/major.h>#include<linux/fs.h>#include<linux/console.h>#include<linux/consolemap.h>#include<linux/signal.h>#include<linux/suspend.h>#include<linux/timex.h>#include<asm/io.h>#include<linux/uaccess.h>#include<linux/nospec.h>#include<linux/kbd_kern.h>#include<linux/vt_kern.h>#include<linux/kbd_diacr.h>#include<linux/selection.h>boolvt_dont_switch;staticinlineboolvt_in_use(unsignedinti){conststructvc_data*vc=vc_cons[i].d;/* * console_lock must be held to prevent the vc from being deallocated * while we're checking whether it's in-use. */WARN_CONSOLE_UNLOCKED();returnvc&&kref_read(&vc->port.kref)>1;}staticinlineboolvt_busy(inti){if(vt_in_use(i))returntrue;if(i==fg_console)returntrue;if(vc_is_sel(vc_cons[i].d))return