+'\" t
.\" Copyright 2002 Walter Harms <walter.harms@informatik.uni-oldenburg.de>
.\" and Andries Brouwer <aeb@cwi.nl>.
.\"
.\" SPDX-License-Identifier: GPL-1.0-or-later
.\"
-.TH IOCTL_TTY 2 2021-08-27 "Linux" "Linux Programmer's Manual"
+.TH ioctl_tty 2 (date) "Linux man-pages (unreleased)"
.SH NAME
ioctl_tty \- ioctls for terminals and serial lines
.SH LIBRARY
.BR TCIFLUSH ,
.BR TCOFLUSH ,
.BR TCIOFLUSH .
+.TP
+.B TIOCSERGETLSR
+Argument:
+.BI "int\~*" argp
+.IP
+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.
.SS Faking input
.TP
.B TIOCSTI
.I /dev/tty0
to the given terminal.
If that was a pseudoterminal master, send it to the slave.
-In Linux before version 2.6.10,
+Before Linux 2.6.10,
anybody can do this as long as the output was not redirected yet;
-since version 2.6.10, only a process with the
+since Linux 2.6.10, only a process with the
.B CAP_SYS_ADMIN
capability may do this.
If output was redirected already, then
In packet mode, each subsequent
.BR read (2)
will return a packet that either contains a single nonzero control byte,
-or has a single byte containing zero (\(aq\e0\(aq) followed by data
+or has a single byte containing zero (\[aq]\e0\[aq]) followed by data
written on the slave side of the pseudoterminal.
If the first byte is not
.B TIOCPKT_DATA
.PP
.\" SRC BEGIN (tiocmget.c)
.EX
-#include <stdio.h>
-#include <unistd.h>
#include <fcntl.h>
+#include <stdio.h>
#include <sys/ioctl.h>
+#include <unistd.h>
int
main(void)
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
-#include <sys/types.h>
#include <unistd.h>
int
/* Change baud rate when more arguments were provided */
if (argc == 3 || argc == 4) {
/* Clear the current output baud rate and fill a new value */
- tio.c_cflag &= ~CBAUD;
+ tio.c_cflag &= \[ti]CBAUD;
tio.c_cflag |= BOTHER;
tio.c_ospeed = atoi(argv[2]);
/* Clear the current input baud rate and fill a new value */
- tio.c_cflag &= ~(CBAUD << IBSHIFT);
+ tio.c_cflag &= \[ti](CBAUD << IBSHIFT);
tio.c_cflag |= BOTHER << IBSHIFT;
/* When 4th argument is not provided reuse output baud rate */
tio.c_ispeed = (argc == 4) ? atoi(argv[3]) : atoi(argv[2]);
.\" TIOCSERGWILD int *
.\" TIOCSERSWILD const int *
.\" TIOCSERGSTRUCT struct async_struct *
-.\" TIOCSERGETLSR int *
.\" TIOCSERGETMULTI struct serial_multiport_struct *
.\" TIOCSERSETMULTI const struct serial_multiport_struct *
.\" TIOCGSERIAL, TIOCSSERIAL (see above)