TIOCEXCL(2const)
π TIOCEXCL(2const) π
okay bestie, gather round, because today we're talking about TIOCEXCL, TIOCGEXCL, and TIOCNXCL β the exclusive-mode trio, living their best lives in section 2const of the manual. no cap, this one's short and sweet and lowkey iconic.
π LIBRARY
the standard C library, aka libc, linked in with -lc. she's everywhere, you already know her π
β¨ SYNOPSIS β¨
#include <asm/termbits.h> /* Definition of TIOC*XCL constants */
#include <sys/ioctl.h>
int ioctl(int fd, TIOCEXCL);
int ioctl(int fd, TIOCGEXCL, int *argp);
int ioctl(int fd, TIOCNXCL);
see how neat that is? three little ioctl() calls, zero drama π
π¦ DESCRIPTION π¦
okay so each of these is a different flavour of the same vibe, so let me break it down one by one:
TIOCEXCLβ this one puts the terminal into exclusive mode. what does that mean fr fr? it means no furtheropen(2)operations on the terminal are permitted. like, door's closed, we're booked, go home. thoseopen(2)calls fail withEBUSYβ except for a process that's holding theCAP_SYS_ADMINcapability, because that one's got VIP access, obviously ππTIOCGEXCLβ this is the gossip check π. if the terminal is currently in exclusive mode, it drops a nonzero value into the location thatargppoints to. otherwise, it drops a zero into*argp. simple as that, bestie.TIOCNXCLβ and this one? this one disables exclusive mode. we're opening the doors back up, the party's over, everyone can come in π«Ά
πΈ RETURN VALUE πΈ
on success, 0 is returned. slay.
on error, -1 is returned, and errno is set to indicate the error. not slay, but at least you'll know why π
π HISTORY π
TIOCGEXCLβ Linux 3.8. so it's been around a minute, she's a seasoned queen β¨
π SEE ALSO π
and that's the whole page, no notes π this one came to you straight from Linux man-pages 6.20, dated 2026-02-08 β so go forth, lock your terminals, check your exclusive mode, and stan a well-behaved tty interface. periodt πππ§
π¦ 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 E. Brouwer <aeb@cwi.nl>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms