ioctl_tty(2)

ioctl_tty2

Ioctls for terminals and serial lines

Usage

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

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

Library

Standard C library (libc, -lc)

Overview

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(7) whenever possible.

Get and set terminal attributes

Locking the termios structure

Get and set window size

Sending a break

Software flow control

Buffer count and flushing

Faking input

Redirecting console output

Controlling terminal

Process group and session ID

Exclusive mode

Line discipline

Pseudoterminal ioctls

Modem control

Marking a line as local

Linux-specific

For the TIOCLINUX(2const) ioctl, see ioctl_console(2).

Kernel debugging

Return value

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

Releases

5 releases since Debian 10 (Buster); the text changed 4 times.

  1. 10
  2. 11
  3. 12
  4. 13
  5. Arch

From man-pages 6.19-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.