ioctl_tty - Man Page

ioctls for terminals and serial lines

Library

Standard C library (libc, -lc)

Synopsis

#include <asm/termbits.h>  /* Definition of constants */
#include <sys/ioctl.h>

int ioctl(int fd, int op, ...);

Description

The ioctl(2) call for terminals and serial ports accepts many possible operation arguments. Most require a third argument, of varying type, here called argp or arg.

Use of ioctl() makes for nonportable programs. Use the POSIX interface described in termios(3) whenever possible.

Get and set terminal attributes

TCGETS(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 structure

TIOCGLCKTRMIOS(2const)

TIOCSLCKTRMIOS(2const)

Get and set window size

TIOCGWINSZ(2const)

TIOCSWINSZ(2const)

Sending a break

TCSBRK(2const)

TCSBRKP(2const)

TIOCSBRK(2const)

TIOCCBRK(2const)

Software flow control

TCXONC(2const)

Buffer count and flushing

FIONREAD(2const)

TIOCINQ(2const)

TIOCOUTQ(2const)

TCFLSH(2const)

TIOCSERGETLSR(2const)

Faking input

TIOCSTI(2const)

Redirecting console output

TIOCCONS(2const)

Controlling terminal

TIOCSCTTY(2const)

TIOCNOTTY(2const)

Process group and session ID

TIOCGPGRP(2const)

TIOCSPGRP(2const)

TIOCGSID(2const)

Exclusive mode

TIOCEXCL(2const)

TIOCGEXCL(2const)

TIOCNXCL(2const)

Line discipline

TIOCGETD(2const)

TIOCSETD(2const)

Pseudoterminal ioctls

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).

Kernel debugging

TIOCTTYGSTRUCT(2const)

Return Value

On success, 0 is returned. On error, -1 is returned, and errno is set to indicate the error.

See Also

ioctl(2), ldattach(8), ioctl_console(2), termios(3), pty(7)

Referenced By

ioctl(2), ioctl_console(2), notcurses_init(3), poll(2), procenv(1), pty(7), termio(7), termios(3), tty(4).

The man page tty_ioctl(4) is an alias of ioctl_tty(2).

2024-06-14 Linux man-pages 6.9.1