ioctl_console(2) System Calls Manual ioctl_console(2) ioctl_console - - (ioctl) Linux- ioctl(2), . argp. KDGETLED . argp char. *argp : LED_CAP 0x04 caps lock LED_NUM 0x02 num lock LED_SCR 0x01 scroll lock KDSETLED . argp. , , : caps lock, num lock scroll lock. Linux 1.1.54 KDGETLED/KDSETLED . Linux 1.1.54 , . ioctl . KDGKBLED : CapsLock, NumLock, ScrollLock ( ). argp char, . ( 0x7) , ( 0x70) ( Linux 1.1.54). KDSKBLED : CapsLock, NumLock, ScrollLock ( ). argp . ( 0x7) , ( 0x70) ( Linux 1.1.54). KDGKBTYPE . KB_101 0x02. KDADDIO / (I/O) . ioperm(arg,1,1). KDDELIO / (I/O) . ioperm(arg,1,0). KDENABIO / . ioperm(0x3b4, 0x3df-0x3b4+1, 1). KDDISABIO / . ioperm(0x3b4, 0x3df-0x3b4+1, 0). KDSETMODE / . argp : KD_TEXT 0x00 KD_GRAPHICS 0x01 KDGETMODE (/). argp int, KDSETMODE. KDMKTONE . 16 argp ( ), 16 . , . . , argp = (125<<16) + 0x637 , ctrl-G ( Linux 0.99pl1; Linux 2.1.49-50). KIOCSOUND . 16 argp ( argp = 1193180/). argp = 0 . . GIO_CMAP . argp 48 ( Linux 1.3.3). PIO_CMAP . argp 48 , , , , 16- : 0 -- , 255 -- . , : , -, -, , -, -, -, -, -, -, -, , -, -, - ( Linux 1.3.3). GIO_FONT (256 ) . argp 8192 . EINVAL, 512 . GIO_FONTX . argp struct consolefontdesc (. PIO_FONTX). charcount , , chardata. charcount charheight , chardata , charcount ; errno ENOMEM ( Linux 1.3.1). PIO_FONT 256 . EGA/VGA. argp 8192 (32 ). N 8xN (0 < N <= 32). . PIO_FONTX . argp : struct consolefontdesc { unsigned short charcount; /* (256 512) */ unsigned short charheight; /* (1-32) */ char *chardata; /* */ }; , SIGWINCH. ( Linux 1.3.1). PIO_FONTRESET , , . argp , NULL, Linux. ( Linux 1.3.28). GIO_SCRNMAP . argp E_TABSZ, , . , 256 . GIO_UNISCRNMAP . argp E_TABSZ*sizeof(unsigned short), . , U+F000, << >> ( Linux 1.3.1). PIO_SCRNMAP << >> () , . argp E_TABSZ. PIO_UNISCRNMAP << >> () , , . , U+F000, ( Linux 1.3.1). GIO_UNIMAP . argp struct unimapdesc { unsigned short entry_ct; struct unipair *entries; }; entries struct unipair { unsigned short unicode; unsigned short fontpos; }; ( Linux 1.1.92) PIO_UNIMAP . argp struct unimapdesc ( Linux 1.1.92). PIO_UNIMAPCLR , . argp struct unimapinit { unsigned short advised_hashsize; /* 0, */ unsigned short advised_hashstep; /* 0, */ unsigned short advised_hashlevel; /* 0, */ }; ( Linux 1.1.92) KDGKBMODE . argp long, : K_RAW 0x00 /* (-) */ K_XLATE 0x01 /* keymap */ K_MEDIUMRAW 0x02 /* (-) */ K_UNICODE 0x03 /* */ K_OFF 0x04 /* ; Linux 2.6.39 */ KDSKBMODE . argp long, KDGKBMODE. KDGKBMETA . argp long, : K_METABIT 0x03 K_ESCPREFIX 0x04 KDSKBMETA . argp long, KDGKBMETA. KDGKBENT ( ). argp struct kbentry { unsigned char kb_table; unsigned char kb_index; unsigned short kb_value; }; : kb_table -- (0 <= kb_table < MAX_NR_KEYMAPS) kb_index -- (0 <= kb_index < NR_KEYS). kb_value K_HOLE, , K_NOSUCHMAP, kb_table . KDSKBENT . argp struct kbentry. KDGKBSENT . argp struct kbsentry { unsigned char kb_func; unsigned char kb_string[512]; }; kb_string ( null) , kb_func. KDSKBSENT . argp struct kbsentry. KDGKBDIACR . argp struct kbdiacrs { unsigned int kb_cnt; struct kbdiacr kbdiacr[256]; }; kb_cnt -- , struct kbdiacr { unsigned char diacr; unsigned char base; unsigned char result; }; KDGETKEYCODE ( ). argp struct kbkeycode { unsigned int scancode; unsigned int keycode; }; keycode scancode ( 89 <= scancode <= 255. 1 <= scancode <= 88, keycode==scancode; Linux 1.1.63). KDSETKEYCODE . argp struct kbkeycode ( Linux 1.1.63). KDSIGACCEPT argp, (1 <= argp <= NSIG). spawn_console() linux/drivers/char/keyboard.c. VT_OPENQRY ( ) . argp int, vt (1 <= *argp <= MAX_NR_CONSOLES). VT_GETMODE vt. argp struct vt_mode { char mode; /* vt */ char waitv; /* ; , */ short relsig; /* req */ short acqsig; /* */ short frsig; /* ( 0) */ }; vt. mode : VT_AUTO vt VT_PROCESS VT_ACKACQ VT_SETMODE vt. argp struct vt_mode. VT_GETSTATE vt. argp struct vt_stat { unsigned short v_active; /* vt */ unsigned short v_signal; /* */ unsigned short v_state; /* vt */ }; For each vt in use, the corresponding bit in the v_state member is set. (Linux 1.0 through Linux 1.1.92.) VT_RELDISP . VT_ACTIVATE argp (1 <= argp <= MAX_NR_CONSOLES). VT_WAITACTIVE , argp . VT_DISALLOCATE , argp ( Linux 1.1.54). VT_RESIZE . argp struct vt_sizes { unsigned short v_rows; /* */ unsigned short v_cols; /* */ unsigned short v_scrollsize; /* */ }; , . resizecons(8) ( Linux 1.1.54). VT_RESIZEX . argp struct vt_consize { unsigned short v_rows; /* */ unsigned short v_cols; /* */ unsigned short v_vlin; /* */ unsigned short v_clin; /* */ unsigned short v_vcol; /* */ unsigned short v_ccol; /* */ }; , " ", , , . . resizecons(8) ( Linux 1.3.3). The action of the following ioctls depends on the first byte in the struct pointed to by argp, referred to here as the subcode. These are legal only for the superuser or the owner of the current terminal. Symbolic subcodes are available in since Linux 2.5.71. TIOCLINUX, subcode=0 Dump the screen. Disappeared in Linux 1.1.92. (With Linux 1.1.92 or later, read from /dev/vcsN or /dev/vcsaN instead.) TIOCLINUX, subcode=1 . Linux 1.1.92. TIOCLINUX, subcode=TIOCL_SETSEL . argp struct { char subcode; short xs, ys, xe, ye; short sel_mode; }; xs and ys are the starting column and row. xe and ye are the ending column and row. (Upper left corner is row=column=1.) sel_mode is 0 for character-by-character selection, 1 for word-by-word selection, or 2 for line-by-line selection. The indicated screen characters are highlighted and saved in a kernel buffer. Since Linux 6.7, using this subcode requires the CAP_SYS_ADMIN capability. TIOCLINUX, subcode=TIOCL_PASTESEL . fd. Since Linux 6.7, using this subcode requires the CAP_SYS_ADMIN capability. TIOCLINUX, subcode=TIOCL_UNBLANKSCREEN (blank screen) TIOCLINUX, subcode=TIOCL_SELLOADLUT 256- <> << >> ( Linux 1.1.32). Since Linux 6.7, using this subcode requires the CAP_SYS_ADMIN capability. TIOCLINUX, subcode=TIOCL_GETSHIFTSTATE argp char, shift_state ( Linux 1.1.32). TIOCLINUX, subcode=TIOCL_GETMOUSEREPORTING argp char, report_mouse ( Linux 1.1.33). TIOCLINUX, subcode=8 Dump screen width and height, cursor position, and all the character-attribute pairs. (Linux 1.1.67 through Linux 1.1.91 only. With Linux 1.1.92 or later, read from /dev/vcsa* instead.) TIOCLINUX, subcode=9 Restore screen width and height, cursor position, and all the character-attribute pairs. (Linux 1.1.67 through Linux 1.1.91 only. With Linux 1.1.92 or later, write to /dev/vcsa* instead.) TIOCLINUX, subcode=TIOCL_SETVESABLANK . (blanking) VESA argp[1], : 0 . 1 , . <<>> (standby). Off_Mode, . 2 , . <<>> (off). Off_Mode blank_timer, . : ( Linux 1.1.76). TIOCLINUX, subcode=TIOCL_SETKMSGREDIRECT Change target of kernel messages ("console"): by default, and if this is set to 0, messages are written to the currently active VT. The VT to write to is a single byte following subcode. (Since Linux 2.5.36.) TIOCLINUX, subcode=TIOCL_GETFGCONSOLE Returns the number of VT currently in foreground. (Since Linux 2.5.36.) TIOCLINUX, subcode=TIOCL_SCROLLCONSOLE Scroll the foreground VT by the specified amount of lines down, or half the screen if 0. lines is *(((int32_t *)&subcode) + 1). (Since Linux 2.5.67.) TIOCLINUX, subcode=TIOCL_BLANKSCREEN Blank the foreground VT, ignoring "pokes" (typing): can only be unblanked explicitly (by switching VTs, to text mode, etc.). (Since Linux 2.5.71.) TIOCLINUX, subcode=TIOCL_BLANKEDSCREEN Returns the number of VT currently blanked, 0 if none. (Since Linux 2.5.71.) TIOCLINUX, subcode=16 Never used. TIOCLINUX, subcode=TIOCL_GETKMSGREDIRECT Returns target of kernel messages. (Since Linux 2.6.17.) On success, 0 is returned (except where indicated). On failure, -1 is returned, and errno is set to indicate the error. EBADF . EINVAL argp. ENOTTY , . EPERM . : ioctl Linux , . Ioctl -- Linux, . ( , 1.1.94; .) ioctl - (fdisk, hdparm, setserial, tunelp, loadkeys, selection, setfont ..), . , ioctl, UNIX, Linux Linux. POSIX. . dumpkeys(1), kbd_mode(1), loadkeys(1), mknod(1), setleds(1), setmetamode(1), execve(2), fcntl(2), ioctl_tty(2), ioperm(2), termios(3), console_codes(4), mt(4), sd(4), tty(4), ttyS(4), vcs(4), vcsa(4), charsets(7), mapscrn(8), resizecons(8), setfont(8) /usr/include/linux/kd.h, /usr/include/linux/vt.h Azamat Hackimov , Dmitriy S. Seregin , Yuri Kozlov ; GNU 3 , . . , , . Linux man-pages 6.06 21 2023 . ioctl_console(2)