ioctl_tty(2)
π ioctl_tty β bestie edition π
okay so this is page ioctl_tty from section 2 (System Calls Manual) of the Linux man-pages, and it's literally the master list of terminal/serial ioctls. buckle up π
β¨ NAME β¨
ioctl_tty β ioctls for terminals and serial lines. that's it, that's the whole vibe. π
π LIBRARY π
Standard C library (libc, -lc). the classic. the icon. π«Ά
πΈ SYNOPSIS πΈ
#include <asm/termbits.h> /* Definition of constants */
#include <sys/ioctl.h>
int ioctl(int fd, int op, ...);
π¦ DESCRIPTION π¦
so the ioctl(2) call, when you point it at terminals and serial ports, will accept a truly unhinged number of possible operation arguments. like, so many. the menu is huge.
Most of them want a third argument, and the type of that argument varies depending on which op you picked β this page calls it argp or arg because naming things is hard. π
bestie, real talk: use ofioctl()makes for nonportable programs. Use the POSIX interface described intermios(7) whenever possible. not me being dramatic, that's just the truth of it. π
Get and set terminal attributes
the "get the settings / set the settings" crew. all of these have their own pages:
TCGETS(2const)TCSETS(2const)TCSETSW(2const)TCSETSF(2const)
the twos, which are the same energy but different:
TCGETS2(2const)TCSETS2(2const)TCSETSW2(2const)TCSETSF2(2const)
and the A-squad, the legacy little guys:
TCGETA(2const)TCSETA(2const)TCSETAW(2const)TCSETAF(2const)
Locking the termios structure
keep your hands off my settings, periodt. π
TIOCGLCKTRMIOS(2const)TIOCSLCKTRMIOS(2const)
Get and set window size
because how big is the window, truly. π
TIOCGWINSZ(2const)TIOCSWINSZ(2const)
Sending a break
sent a break, hope they text back. π
TCSBRK(2const)TCSBRKP(2const)TIOCSBRK(2const)TIOCCBRK(2const)
Software flow control
TCXONC(2const)
Buffer count and flushing
how much is in the buffer, and also get rid of it. two completely different moods, both iconic.
FIONREAD(2const)TIOCINQ(2const)TIOCOUTQ(2const)TCFLSH(2const)TIOCSERGETLSR(2const)
Faking input
she's lying but make it syscall π
TIOCSTI(2const)
Redirecting console output
TIOCCONS(2const)
Controlling terminal
who's your controlling terminal? main character energy only. π
TIOCSCTTY(2const)TIOCNOTTY(2const)
Process group and session ID
TIOCGPGRP(2const)TIOCSPGRP(2const)TIOCGSID(2const)
Exclusive mode
no sharing. none. it's giving only child. π
TIOCEXCL(2const)TIOCGEXCL(2const)TIOCNXCL(2const)
Line discipline
TIOCGETD(2const)TIOCSETD(2const)
Pseudoterminal ioctls
the pty girlies know β¨
TIOCPKT(2const)TIOCGPKT(2const)TIOCSPTLCK(2const)TIOCGPTLCK(2const)TIOCGPTPEER(2const)
Modem control
TIOCMGET(2const)TIOCMSET(2const)TIOCMBIC(2const)TIOCMBIS(2const)TIOCMIWAIT(2const)TIOCGICOUNT(2const)
Marking a line as local
TIOCGSOFTCAR(2const)TIOCSSOFTCAR(2const)
Linux-specific
For the TIOCLINUX(2const) ioctl, see ioctl_console(2). it lives over there, go say hi π§
Kernel debugging
TIOCTTYGSTRUCT(2const)
π RETURN VALUE π
- on glow-up (success): 0 is returned β¨
- on flop (error): -1 is returned, and
errnois set to indicate the error π
π SEE ALSO π
ioctl(2), ldattach(8), ioctl_console(2), termios(7), pty(7)
and that's the whole page, bestie, no cap π«Ά this was Linux man-pages 6.20, dated 2026-07-02, and honestly? she ate. mwah π
π¦ 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-1.0-or-later
- Copyright 2002, Walter Harms <walter.harms@informatik.uni-oldenburg.de>
- Copyright 2002, Andries Brouwer <aeb@cwi.nl>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms