NAME |LIBRARY |SYNOPSIS |DESCRIPTION |RETURN VALUE |SEE ALSO |COLOPHON | |
ioctl_tty(2) System Calls Manualioctl_tty(2)ioctl_tty - ioctls for terminals and serial lines
Standard C library (libc,-lc)
#include <asm/termbits.h>/* Definition of constants */#include <sys/ioctl.h>int ioctl(intfd, intop, ...);
Theioctl(2) call for terminals and serial ports accepts many possible operation arguments. Most require a third argument, of varying type, here calledargp orarg. Use ofioctl() makes for nonportable programs. Use the POSIX interface described intermios(3) whenever possible.Get and set terminal attributesTCGETS(2const)TCSETS(2const)TCSETSW(2const)TCSETSF(2const)TCGETS(2const)TCSETS(2const)TCSETSW(2const)TCSETSF(2const)TCGETS(2const)TCSETS(2const)TCSETSW(2const)TCSETSF(2const)Locking the termios structureTIOCGLCKTRMIOS(2const)TIOCSLCKTRMIOS(2const)Get and set window sizeTIOCGWINSZ(2const)TIOCSWINSZ(2const)Sending a breakTCSBRK(2const)TCSBRKP(2const)TIOCSBRK(2const)TIOCCBRK(2const)Software flow controlTCXONC(2const)Buffer count and flushingFIONREAD(2const)TIOCINQ(2const)TIOCOUTQ(2const)TCFLSH(2const)TIOCSERGETLSR(2const)Faking inputTIOCSTI(2const)Redirecting console outputTIOCCONS(2const)Controlling terminalTIOCSCTTY(2const)TIOCNOTTY(2const)Process group and session IDTIOCGPGRP(2const)TIOCSPGRP(2const)TIOCGSID(2const)Exclusive modeTIOCEXCL(2const)TIOCGEXCL(2const)TIOCNXCL(2const)Line disciplineTIOCGETD(2const)TIOCSETD(2const)Pseudoterminal ioctlsTIOCPKT(2const)TIOCGPKT(2const)TIOCSPTLCK(2const)TIOCGPTLCK(2const)TIOCGPTPEER(2const)Modem controlTIOCMGET(2const)TIOCMSET(2const)TIOCMBIC(2const)TIOCMBIS(2const)TIOCMIWAIT(2const)TIOCGICOUNT(2const)Marking a line as localTIOCGSOFTCAR(2const)TIOCSSOFTCAR(2const)Linux-specific For theTIOCLINUX(2const) ioctl, seeioctl_console(2).Kernel debuggingTIOCTTYGSTRUCT(2const)
On success, 0 is returned. On error, -1 is returned, anderrno is set to indicate the error.
ioctl(2),ldattach(8),ioctl_console(2),termios(3),pty(7)
This page is part of theman-pages (Linux kernel and C library user-space interface documentation) project. Information about the project can be found at ⟨https://www.kernel.org/doc/man-pages/⟩. If you have a bug report for this manual page, see ⟨https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING⟩. This page was obtained from the tarball man-pages-6.15.tar.gz fetched from ⟨https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/⟩ on 2025-08-11. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up- to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which isnot part of the original manual page), send a mail to man-pages@man7.orgLinux man-pages 6.15 2025-05-17ioctl_tty(2)Pages that refer to this page:FIONREAD(2const), ioctl(2), ioctl_console(2), poll(2), TCSBRK(2const), TCSETS(2const), TCXONC(2const), TIOCCONS(2const), TIOCEXCL(2const), TIOCMSET(2const), TIOCPKT(2const), TIOCSCTTY(2const), TIOCSETD(2const), TIOCSLCKTRMIOS(2const), TIOCSPGRP(2const), TIOCSSOFTCAR(2const), TIOCSTI(2const), TIOCTTYGSTRUCT(2const), termios(3), tty(4), pty(7), termio(7)
HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface. For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere. Hosting byjambit GmbH. | ![]() |