| 1 |
.\" Copyright 2002, Walter Harms <[email protected]> |
| 2 |
.\" Copyright 2002, Andries E. Brouwer <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: GPL-1.0-or-later |
| 6 |
.\" |
| 7 |
.TH FIONREAD 2const 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
FIONREAD, |
| 10 |
TIOCINQ, |
| 11 |
TIOCOUTQ, |
| 12 |
TCFLSH, |
| 13 |
TIOCSERGETLSR |
| 14 |
\- |
| 15 |
buffer count and flushing |
| 16 |
.SH LIBRARY |
| 17 |
Standard C library |
| 18 |
.RI ( libc ,\~ \-lc ) |
| 19 |
.SH SYNOPSIS |
| 20 |
.nf |
| 21 |
.BR "#include <asm/termbits.h>" " /* Definition of constants */" |
| 22 |
.B #include <sys/ioctl.h> |
| 23 |
.P |
| 24 |
.BI "int ioctl(int " fd ", FIONREAD, int *" argp ); |
| 25 |
.BI "int ioctl(int " fd ", TIOCINQ, int *" argp ); |
| 26 |
.BI "int ioctl(int " fd ", TIOCOUTQ, int *" argp ); |
| 27 |
.BI "int ioctl(int " fd ", TCFLSH, int " arg ); |
| 28 |
.BI "int ioctl(int " fd ", TIOCSERGETLSR, int *" argp ); |
| 29 |
.fi |
| 30 |
.SH DESCRIPTION |
| 31 |
.TP |
| 32 |
.B FIONREAD |
| 33 |
Get the number of bytes in the input buffer. |
| 34 |
.TP |
| 35 |
.B TIOCINQ |
| 36 |
Same as |
| 37 |
.BR FIONREAD . |
| 38 |
.TP |
| 39 |
.B TIOCOUTQ |
| 40 |
Get the number of bytes in the output buffer. |
| 41 |
.TP |
| 42 |
.B TCFLSH |
| 43 |
Equivalent to |
| 44 |
.IR "tcflush(fd, arg)" . |
| 45 |
.IP |
| 46 |
See |
| 47 |
.BR tcflush (3) |
| 48 |
for the argument values |
| 49 |
.BR TCIFLUSH , |
| 50 |
.BR TCOFLUSH , |
| 51 |
.BR TCIOFLUSH . |
| 52 |
.TP |
| 53 |
.B TIOCSERGETLSR |
| 54 |
Get line status register. |
| 55 |
Status register has |
| 56 |
.B TIOCSER_TEMT |
| 57 |
bit set when |
| 58 |
output buffer is empty and also hardware transmitter is physically empty. |
| 59 |
.IP |
| 60 |
Does not have to be supported by all serial tty drivers. |
| 61 |
.IP |
| 62 |
.BR tcdrain (3) |
| 63 |
does not wait and returns immediately when |
| 64 |
.B TIOCSER_TEMT |
| 65 |
bit is set. |
| 66 |
.SH RETURN VALUE |
| 67 |
On success, |
| 68 |
0 is returned. |
| 69 |
On error, |
| 70 |
\-1 is returned, and |
| 71 |
.I errno |
| 72 |
is set to indicate the error. |
| 73 |
.SH SEE ALSO |
| 74 |
.BR ioctl (2), |
| 75 |
.BR ioctl_tty (2), |
| 76 |
.BR tcflush (3), |
| 77 |
.BR termios (3) |