.\" Copyright 2002, Walter Harms .\" Copyright 2002, Andries Brouwer .\" Copyright 2024, Alejandro Colomar .\" .\" SPDX-License-Identifier: GPL-1.0-or-later .\" .TH FIONREAD 2const 2024-07-23 "Linux man-pages 6.10" .SH NAME FIONREAD, TIOCINQ, TIOCOUTQ, TCFLSH, TIOCSERGETLSR \- buffer count and flushing .SH LIBRARY Standard C library .RI ( libc ,\~ \-lc ) .SH SYNOPSIS .nf .BR "#include " " /* Definition of constants */" .B #include .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)