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. argp points to an int which 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. argp points 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 switching
  • VT_PROCESS β€” process controls switching
  • VT_ACKACQ β€” acknowledge switch
  • VT_SETMODE β€” set the mode of the active vt. argp points to a struct vt_mode. iconic.
  • VT_GETSTATE β€” get global vt state info. argp points 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 vt argp (1 <= argp <= MAX_NR_CONSOLES).
  • VT_WAITACTIVE β€” wait until vt argp has been activated. the way it just... sits there until the switch happens 😭
  • VT_DISALLOCATE β€” deallocate the memory associated with vt argp. (Since Linux 1.1.54.)
  • VT_RESIZE β€” set the kernel's idea of screensize. argp points 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. argp points 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. argp points 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 β€” argp is 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms