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