]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man2/ioctl_tty.2
Many pages: Use \[ti] instead of \(ti
[thirdparty/man-pages.git] / man2 / ioctl_tty.2
index 893ed861f9ce0a0974ed5c21b3fc0b53c1fa3bb6..8d2f08242f0d1b700b44b8de4a8a3f795c275652 100644 (file)
@@ -1,9 +1,10 @@
+'\" 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
@@ -250,13 +251,13 @@ when the driver does not support breaks.
 .TP
 .B TIOCSBRK
 Argument:
-.BI "void"
+.B void
 .IP
 Turn break on, that is, start sending zero bits.
 .TP
 .B TIOCCBRK
 Argument:
-.BI "void"
+.B void
 .IP
 Turn break off, that is, stop sending zero bits.
 .SS Software flow control
@@ -277,7 +278,7 @@ for the argument values
 .BR TCION .
 .SS Buffer count and flushing
 .TP
-.BI FIONREAD
+.B FIONREAD
 Argument:
 .BI "int\~*" argp
 .IP
@@ -309,6 +310,23 @@ for the argument values
 .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
@@ -320,7 +338,7 @@ Insert the given byte in the input queue.
 .TP
 .B TIOCCONS
 Argument:
-.BI "void"
+.B void
 .IP
 Redirect output that would have gone to
 .I /dev/console
@@ -328,10 +346,10 @@ or
 .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
-.BR CAP_SYS_ADMIN
+since Linux 2.6.10, only a process with the
+.B CAP_SYS_ADMIN
 capability may do this.
 If output was redirected already, then
 .B EBUSY
@@ -359,7 +377,7 @@ If this terminal is already the controlling terminal
 of a different session group, then the ioctl fails with
 .BR EPERM ,
 unless the caller has the
-.BR CAP_SYS_ADMIN
+.B CAP_SYS_ADMIN
 capability and
 .I arg
 equals 1, in which case the terminal is stolen, and all processes that had
@@ -367,7 +385,7 @@ it as controlling terminal lose it.
 .TP
 .B TIOCNOTTY
 Argument:
-.BI "void"
+.B void
 .IP
 If the given terminal was the controlling terminal of the calling process,
 give up this controlling terminal.
@@ -415,7 +433,7 @@ Strange.
 .TP
 .B TIOCEXCL
 Argument:
-.BI "void"
+.B void
 .IP
 Put the terminal into exclusive mode.
 No further
@@ -424,7 +442,7 @@ operations on the terminal are permitted.
 (They fail with
 .BR EBUSY ,
 except for a process with the
-.BR CAP_SYS_ADMIN
+.B CAP_SYS_ADMIN
 capability.)
 .TP
 .B TIOCGEXCL
@@ -440,7 +458,7 @@ otherwise, place zero in
 .TP
 .B TIOCNXCL
 Argument:
-.BI "void"
+.B void
 .IP
 Disable exclusive mode.
 .SS Line discipline
@@ -471,7 +489,7 @@ otherwise).
 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
@@ -532,9 +550,9 @@ Argument:
 .BI "int\~*" argp
 .IP
 Set (if
-.IR *argp
+.I *argp
 is nonzero) or remove (if
-.IR *argp
+.I *argp
 is zero) the lock on the pseudoterminal slave device.
 (See also
 .BR unlockpt (3).)
@@ -751,11 +769,12 @@ Insufficient permission.
 .SH EXAMPLES
 Check the condition of DTR on the serial port.
 .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)
@@ -771,9 +790,11 @@ main(void)
     close(fd);
 }
 .EE
+.\" SRC END
 .PP
 Get or set arbitrary baudrate on the serial port.
 .PP
+.\" SRC BEGIN (tcgets.c)
 .EX
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
@@ -782,7 +803,6 @@ Get or set arbitrary baudrate on the serial port.
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/ioctl.h>
-#include <sys/types.h>
 #include <unistd.h>
 
 int
@@ -827,12 +847,12 @@ main(int argc, char *argv[])
     /* 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]);
@@ -871,6 +891,7 @@ main(int argc, char *argv[])
 #endif
 }
 .EE
+.\" SRC END
 .SH SEE ALSO
 .BR ldattach (8),
 .BR ioctl (2),
@@ -887,7 +908,6 @@ main(int argc, char *argv[])
 .\" 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)