FIONREAD(2const)

FIONREAD2const

Buffer count and flushing

Usage

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

int ioctl(int fd, FIONREAD, int *argp); int ioctl(int fd, TIOCINQ, int *argp); int ioctl(int fd, TIOCOUTQ, int *argp); int ioctl(int fd, TCFLSH, int arg); int ioctl(int fd, TIOCSERGETLSR, int *argp);

Library

Standard C library (libc, -lc)

Overview

FIONREAD

Get the number of bytes in the input buffer.

TIOCINQ

Same as FIONREAD.

TIOCOUTQ

Get the number of bytes in the output buffer.

TCFLSH

Equivalent to tcflush(fd, arg).

See tcflush(3) for the argument values TCIFLUSH, TCOFLUSH, TCIOFLUSH.

TIOCSERGETLSR

Get line status register. Status register has TIOCSER_TEMT bit set when output buffer is empty and also hardware transmitter is physically empty.

Does not have to be supported by all serial tty drivers.

tcdrain(3) does not wait and returns immediately when TIOCSER_TEMT bit is set.

Return value

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

Releases

2 releases since Debian 13 (Trixie); the text changed 1 time.

  1. 13
  2. Arch

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