---
name: "TIOCOUTQ"
section: "2const"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/FIONREAD"
---

# TIOCOUTQ(2const)

buffer count and flushing

Part of [FIONREAD(2const)](/FIONREAD/2const.md).

## NAME

FIONREAD, TIOCINQ, TIOCOUTQ, TCFLSH, TIOCSERGETLSR - buffer count and flushing

## LIBRARY

Standard C library (*libc*, *-lc*)

## SYNOPSIS

```
#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***);**

## DESCRIPTION

- **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)](/tcflush/3.md) 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)](/tcdrain/3.md) 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.

## SEE ALSO

[**ioctl**(2)](/ioctl/2.md), [**ioctl\_tty**(2)](/ioctl_tty/2.md), [**tcflush**(3)](/tcflush/3.md), [**termios**(7)](/termios/7.md)
