ioctl_vt(2)
β¨ ioctl_vt β bestie's guide to console + virtual console ioctls β¨
okay so this is a page from the System Calls Manual (section 2, the real ones π
), and it's literally all about ioctl_vt β the ioctls that let you talk to console terminals and virtual consoles on Linux. no cap, this is Linux-specific stuff only. let's get into it π
π NAME π
ioctl_vt β ioctls for console terminal and virtual consoles
πΈ SYNOPSIS πΈ
#include <linux/vt.h> /* Definition of VT_* constants */
#include <sys/ioctl.h>
int ioctl(int fd, unsigned long op, void *argp);
π¦ DESCRIPTION π¦
The following Linux-specific ioctl(2) operations are supported for console terminals and virtual consoles. slay, let's go one by one π«Ά
VT_OPENQRYβ hands you the first available (aka non-opened) console.argppoints to anintwhich gets set to the number of the vt (1 <= *argp <= MAX_NR_CONSOLES). it's giving "who's free rn" energy.VT_GETMODEβ get the mode of the active vt.argppoints to a
struct vt_mode {
char mode; /* vt mode */
char waitv; /* if set, hang on writes if not active */
short relsig; /* signal to raise on release op */
short acqsig; /* signal to raise on acquisition */
short frsig; /* unused (set to 0) */
};
which gets set to the mode of the active vt. and mode gets set to one of these values, periodt:
VT_AUTOβ auto vt switchingVT_PROCESSβ process controls switchingVT_ACKACQβ acknowledge switch
VT_SETMODEβ set the mode of the active vt.argppoints to astruct vt_mode. iconic.VT_GETSTATEβ get global vt state info.argppoints to a
struct vt_stat {
unsigned short v_active; /* active vt */
unsigned short v_signal; /* signal to send */
unsigned short v_state; /* vt bit mask */
};
for each vt that's in use, the corresponding bit in the v_state member gets set. (Linux 1.0 through Linux 1.1.92.) π°οΈ
VT_RELDISPβ release a display. bye bestie πVT_ACTIVATEβ switch to vtargp(1 <= argp <= MAX_NR_CONSOLES).VT_WAITACTIVEβ wait until vtargphas been activated. the way it just... sits there until the switch happens πVT_DISALLOCATEβ deallocate the memory associated with vtargp. (Since Linux 1.1.54.)VT_RESIZEβ set the kernel's idea of screensize.argppoints to a
struct vt_sizes {
unsigned short v_rows; /* # rows */
unsigned short v_cols; /* # columns */
unsigned short v_scrollsize; /* no longer used */
};
heads up bestie: this does not change the videomode. See resizecons(8). (Since Linux 1.1.54.)
VT_RESIZEXβ set the kernel's idea of various screen parameters.argppoints to a
struct vt_consize {
unsigned short v_rows; /* number of rows */
unsigned short v_cols; /* number of columns */
unsigned short v_vlin; /* number of pixel rows
on screen */
unsigned short v_clin; /* number of pixel rows
per character */
unsigned short v_vcol; /* number of pixel columns
on screen */
unsigned short v_ccol; /* number of pixel columns
per character */
};
any parameter may be set to zero, which means "no change" β but if multiple parameters get set, they must be self-consistent. no chaotic mismatched vibes allowed π
also: this does not change the videomode. See resizecons(8). (Since Linux 1.3.3.)
VT_GETCONSIZECSRPOSβ get console size and cursor position.argppoints to a
struct vt_consizecsrpos {
__u16 con_rows; /* number of console rows */
__u16 con_cols; /* number of console columns */
__u16 csr_row; /* current cursor's row */
__u16 csr_col; /* current cursor's column */
};
(Since Linux 6.16.) brand new, fresh off the press β¨
π RETURN VALUE π
On success, 0 is returned (except where indicated). On failure, -1 is returned, and errno is set to indicate the error. so like, check errno, bestie, don't just assume π
π ERRORS π
EINVALβargpis invalid.
π STANDARDS π
Linux. (we're not doing POSIX today, this is Linux-specific, iykyk π§)
π₯ SEE ALSO π₯
so that's the whole thing, no notes π§
source/version situation: this page is from Linux man-pages 6.20, dated 2026-02-08. go off, man-pages team ππ
bye bestie, go resize some consoles responsibly π
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: GPL-2.0-or-later
- Copyright 1995, James R. Van Zandt <jrv@vanzandt.mv.com>
- Copyright 1995, Andries E. Brouwer <aeb@cwi.nl>
- Copyright 1995, Rickard E. Faith <faith@cs.unc.edu>
- Copyright 1995, H. Peter Anvin <hpa@storm.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms