share/mk/: build-html: Don't build mbind.2 and set_mempolicy.2
[man-pages.git] / man2 / ioctl_tty.2
blobc458933a25d16869e162fd78f6bf5b37f7a104c0
1 '\" t
2 .\" Copyright 2002 Walter Harms <walter.harms@informatik.uni-oldenburg.de>
3 .\" and Andries Brouwer <aeb@cwi.nl>.
4 .\"
5 .\" SPDX-License-Identifier: GPL-1.0-or-later
6 .\"
7 .TH ioctl_tty 2 (date) "Linux man-pages (unreleased)"
8 .SH NAME
9 ioctl_tty \- ioctls for terminals and serial lines
10 .SH LIBRARY
11 Standard C library
12 .RI ( libc ", " \-lc )
13 .SH SYNOPSIS
14 .nf
15 .B #include <sys/ioctl.h>
16 .BR "#include <asm/termbits.h>" "   /* Definition of " "struct termios" ,
17 .BR    "                               struct termios2" ", and"
18 .BR    "                               Bnnn" ", " BOTHER ", " CBAUD ", " CLOCAL ,
19 .BR    "                               TC*" { FLUSH , ON , OFF "} and other constants */"
21 .BI "int ioctl(int " fd ", int " op ", ...);"
22 .fi
23 .SH DESCRIPTION
24 The
25 .BR ioctl (2)
26 call for terminals and serial ports accepts many possible operation arguments.
27 Most require a third argument, of varying type, here called
28 .I argp
30 .IR arg .
32 Use of
33 .BR ioctl ()
34 makes for nonportable programs.
35 Use the POSIX interface described in
36 .BR termios (3)
37 whenever possible.
39 Please note that
40 .B struct termios
41 from
42 .I <asm/termbits.h>
43 is different and incompatible with
44 .B struct termios
45 from
46 .IR <termios.h> .
47 These ioctl calls require
48 .B struct termios
49 from
50 .IR <asm/termbits.h> .
51 .SS Get and set terminal attributes
52 .TP
53 .B TCGETS
54 Argument:
55 .BI "struct termios\~*" argp
56 .IP
57 Equivalent to
58 .IR "tcgetattr(fd, argp)" .
59 .IP
60 Get the current serial port settings.
61 .TP
62 .B TCSETS
63 Argument:
64 .BI "const struct termios\~*" argp
65 .IP
66 Equivalent to
67 .IR "tcsetattr(fd, TCSANOW, argp)" .
68 .IP
69 Set the current serial port settings.
70 .TP
71 .B TCSETSW
72 Argument:
73 .BI "const struct termios\~*" argp
74 .IP
75 Equivalent to
76 .IR "tcsetattr(fd, TCSADRAIN, argp)" .
77 .IP
78 Allow the output buffer to drain, and
79 set the current serial port settings.
80 .TP
81 .B TCSETSF
82 Argument:
83 .BI "const struct termios\~*" argp
84 .IP
85 Equivalent to
86 .IR "tcsetattr(fd, TCSAFLUSH, argp)" .
87 .IP
88 Allow the output buffer to drain, discard pending input, and
89 set the current serial port settings.
91 The following four ioctls, added in Linux 2.6.20,
92 .\" commit 64bb6c5e1ddcd47c951740485026ef08975ee2e6
93 .\" commit 592ee3a5e5e2a981ef2829a0380093006d045661
94 are just like
95 .BR TCGETS ,
96 .BR TCSETS ,
97 .BR TCSETSW ,
98 .BR TCSETSF ,
99 except that they take a
100 .I "struct termios2\~*"
101 instead of a
102 .IR "struct termios\~*" .
103 If the structure member
104 .B c_cflag
105 contains the flag
106 .BR BOTHER ,
107 then the baud rate is stored in the structure members
108 .B c_ispeed
110 .B c_ospeed
111 as integer values.
112 These ioctls are not supported on all architectures.
115 lb l.
116 TCGETS2 \fBstruct termios2 *\fPargp
117 TCSETS2 \fBconst struct termios2 *\fPargp
118 TCSETSW2        \fBconst struct termios2 *\fPargp
119 TCSETSF2        \fBconst struct termios2 *\fPargp
123 The following four ioctls are just like
124 .BR TCGETS ,
125 .BR TCSETS ,
126 .BR TCSETSW ,
127 .BR TCSETSF ,
128 except that they take a
129 .I "struct termio\~*"
130 instead of a
131 .IR "struct termios\~*" .
134 lb l.
135 TCGETA  \fBstruct termio *\fPargp
136 TCSETA  \fBconst struct termio *\fPargp
137 TCSETAW \fBconst struct termio *\fPargp
138 TCSETAF \fBconst struct termio *\fPargp
141 .SS Locking the termios structure
143 .I termios
144 structure of a terminal can be locked.
145 The lock is itself a
146 .I termios
147 structure, with nonzero bits or fields indicating a
148 locked value.
150 .B TIOCGLCKTRMIOS
151 Argument:
152 .BI "struct termios\~*" argp
154 Gets the locking status of the
155 .I termios
156 structure of the terminal.
158 .B TIOCSLCKTRMIOS
159 Argument:
160 .BI "const struct termios\~*" argp
162 Sets the locking status of the
163 .I termios
164 structure of the terminal.
165 Only a process with the
166 .B CAP_SYS_ADMIN
167 capability can do this.
168 .SS Get and set window size
169 Window sizes are kept in the kernel, but not used by the kernel
170 (except in the case of virtual consoles, where the kernel will
171 update the window size when the size of the virtual console changes,
172 for example, by loading a new font).
174 .B TIOCGWINSZ
175 Argument:
176 .BI "struct winsize\~*" argp
178 Get window size.
180 .B TIOCSWINSZ
181 Argument:
182 .BI "const struct winsize\~*" argp
184 Set window size.
186 The struct used by these ioctls is defined as
188 .in +4n
190 struct winsize {
191     unsigned short ws_row;
192     unsigned short ws_col;
193     unsigned short ws_xpixel;   /* unused */
194     unsigned short ws_ypixel;   /* unused */
199 When the window size changes, a
200 .B SIGWINCH
201 signal is sent to the
202 foreground process group.
203 .SS Sending a break
205 .B TCSBRK
206 Argument:
207 .BI "int " arg
209 Equivalent to
210 .IR "tcsendbreak(fd, arg)" .
212 If the terminal is using asynchronous serial data transmission, and
213 .I arg
214 is zero, then send a break (a stream of zero bits) for between
215 0.25 and 0.5 seconds.
216 If the terminal is not using asynchronous
217 serial data transmission, then either a break is sent, or the function
218 returns without doing anything.
219 When
220 .I arg
221 is nonzero, nobody knows what will happen.
223 (SVr4, UnixWare, Solaris, and Linux treat
224 .I "tcsendbreak(fd,arg)"
225 with nonzero
226 .I arg
227 like
228 .IR "tcdrain(fd)" .
229 SunOS treats
230 .I arg
231 as a multiplier, and sends a stream of bits
232 .I arg
233 times as long as done for zero
234 .IR arg .
235 DG/UX and AIX treat
236 .I arg
237 (when nonzero) as a time interval measured in milliseconds.
238 HP-UX ignores
239 .IR arg .)
241 .B TCSBRKP
242 Argument:
243 .BI "int " arg
245 So-called "POSIX version" of
246 .BR TCSBRK .
247 It treats nonzero
248 .I arg
249 as a time interval measured in deciseconds, and does nothing
250 when the driver does not support breaks.
252 .B TIOCSBRK
253 Argument:
254 .B void
256 Turn break on, that is, start sending zero bits.
258 .B TIOCCBRK
259 Argument:
260 .B void
262 Turn break off, that is, stop sending zero bits.
263 .SS Software flow control
265 .B TCXONC
266 Argument:
267 .BI "int " arg
269 Equivalent to
270 .IR "tcflow(fd, arg)" .
273 .BR tcflow (3)
274 for the argument values
275 .BR TCOOFF ,
276 .BR TCOON ,
277 .BR TCIOFF ,
278 .BR TCION .
279 .SS Buffer count and flushing
281 .B FIONREAD
282 Argument:
283 .BI "int\~*" argp
285 Get the number of bytes in the input buffer.
287 .B TIOCINQ
288 Argument:
289 .BI "int\~*" argp
291 Same as
292 .BR FIONREAD .
294 .B TIOCOUTQ
295 Argument:
296 .BI "int\~*" argp
298 Get the number of bytes in the output buffer.
300 .B TCFLSH
301 Argument:
302 .BI "int " arg
304 Equivalent to
305 .IR "tcflush(fd, arg)" .
308 .BR tcflush (3)
309 for the argument values
310 .BR TCIFLUSH ,
311 .BR TCOFLUSH ,
312 .BR TCIOFLUSH .
314 .B TIOCSERGETLSR
315 Argument:
316 .BI "int\~*" argp
318 Get line status register.
319 Status register has
320 .B TIOCSER_TEMT
321 bit set when
322 output buffer is empty and also hardware transmitter is physically empty.
324 Does not have to be supported by all serial tty drivers.
326 .BR tcdrain (3)
327 does not wait and returns immediately when
328 .B TIOCSER_TEMT
329 bit is set.
330 .SS Faking input
332 .B TIOCSTI
333 Argument:
334 .BI "const char\~*" argp
336 Insert the given byte in the input queue.
338 Since Linux 6.2,
339 .\" commit 690c8b804ad2eafbd35da5d3c95ad325ca7d5061
340 .\" commit 83efeeeb3d04b22aaed1df99bc70a48fe9d22c4d
341 this operation may require the
342 .B CAP_SYS_ADMIN
343 capability (if the
344 .I dev.tty.legacy_tiocsti
345 sysctl variable is set to false).
346 .SS Redirecting console output
348 .B TIOCCONS
349 Argument:
350 .B void
352 Redirect output that would have gone to
353 .I /dev/console
355 .I /dev/tty0
356 to the given terminal.
357 If that was a pseudoterminal master, send it to the slave.
358 Before Linux 2.6.10,
359 anybody can do this as long as the output was not redirected yet;
360 since Linux 2.6.10, only a process with the
361 .B CAP_SYS_ADMIN
362 capability may do this.
363 If output was redirected already, then
364 .B EBUSY
365 is returned,
366 but redirection can be stopped by using this ioctl with
367 .I fd
368 pointing at
369 .I /dev/console
371 .IR /dev/tty0 .
372 .SS Controlling terminal
374 .B TIOCSCTTY
375 Argument:
376 .BI "int " arg
378 Make the given terminal the controlling terminal of the calling process.
379 The calling process must be a session leader and not have a
380 controlling terminal already.
381 For this case,
382 .I arg
383 should be specified as zero.
385 If this terminal is already the controlling terminal
386 of a different session group, then the ioctl fails with
387 .BR EPERM ,
388 unless the caller has the
389 .B CAP_SYS_ADMIN
390 capability and
391 .I arg
392 equals 1, in which case the terminal is stolen, and all processes that had
393 it as controlling terminal lose it.
395 .B TIOCNOTTY
396 Argument:
397 .B void
399 If the given terminal was the controlling terminal of the calling process,
400 give up this controlling terminal.
401 If the process was session leader,
402 then send
403 .B SIGHUP
405 .B SIGCONT
406 to the foreground process group
407 and all processes in the current session lose their controlling terminal.
408 .SS Process group and session ID
410 .B TIOCGPGRP
411 Argument:
412 .BI "pid_t\~*" argp
414 When successful, equivalent to
415 .IR "*argp = tcgetpgrp(fd)" .
417 Get the process group ID of the foreground process group on this terminal.
419 .B TIOCSPGRP
420 Argument:
421 .BI "const pid_t\~*" argp
423 Equivalent to
424 .IR "tcsetpgrp(fd, *argp)" .
426 Set the foreground process group ID of this terminal.
428 .B TIOCGSID
429 Argument:
430 .BI "pid_t\~*" argp
432 When successful, equivalent to
433 .IR "*argp = tcgetsid(fd)" .
435 Get the session ID of the given terminal.
436 This fails with the error
437 .B ENOTTY
438 if the terminal is not a master pseudoterminal
439 and not our controlling terminal.
440 Strange.
441 .SS Exclusive mode
443 .B TIOCEXCL
444 Argument:
445 .B void
447 Put the terminal into exclusive mode.
448 No further
449 .BR open (2)
450 operations on the terminal are permitted.
451 (They fail with
452 .BR EBUSY ,
453 except for a process with the
454 .B CAP_SYS_ADMIN
455 capability.)
457 .B TIOCGEXCL
458 Argument:
459 .BI "int\~*" argp
461 (since Linux 3.8)
462 If the terminal is currently in exclusive mode,
463 place a nonzero value in the location pointed to by
464 .IR argp ;
465 otherwise, place zero in
466 .IR *argp .
468 .B TIOCNXCL
469 Argument:
470 .B void
472 Disable exclusive mode.
473 .SS Line discipline
475 .B TIOCGETD
476 Argument:
477 .BI "int\~*" argp
479 Get the line discipline of the terminal.
481 .B TIOCSETD
482 Argument:
483 .BI "const int\~*" argp
485 Set the line discipline of the terminal.
486 .SS Pseudoterminal ioctls
488 .B TIOCPKT
489 Argument:
490 .BI "const int\~*" argp
492 Enable (when
493 .RI * argp
494 is nonzero) or disable packet mode.
495 Can be applied to the master side of a pseudoterminal only (and will return
496 .B ENOTTY
497 otherwise).
498 In packet mode, each subsequent
499 .BR read (2)
500 will return a packet that either contains a single nonzero control byte,
501 or has a single byte containing zero (\[aq]\e0\[aq]) followed by data
502 written on the slave side of the pseudoterminal.
503 If the first byte is not
504 .B TIOCPKT_DATA
505 (0), it is an OR of one
506 or more of the following bits:
508 .ad l
510 lb l.
511 TIOCPKT_FLUSHREAD       T{
512 The read queue for the terminal is flushed.
514 TIOCPKT_FLUSHWRITE      T{
515 The write queue for the terminal is flushed.
517 TIOCPKT_STOP    T{
518 Output to the terminal is stopped.
520 TIOCPKT_START   T{
521 Output to the terminal is restarted.
523 TIOCPKT_DOSTOP  T{
524 The start and stop characters are \fB\[ha]S\fP/\fB\[ha]Q\fP.
526 TIOCPKT_NOSTOP  T{
527 The start and stop characters are not \fB\[ha]S\fP/\fB\[ha]Q\fP.
532 While packet mode is in use, the presence
533 of control status information to be read
534 from the master side may be detected by a
535 .BR select (2)
536 for exceptional conditions or a
537 .BR poll (2)
538 for the
539 .B POLLPRI
540 event.
542 This mode is used by
543 .BR rlogin (1)
545 .BR rlogind (8)
546 to implement a remote-echoed,
547 locally \fB\[ha]S\fP/\fB\[ha]Q\fP flow-controlled remote login.
549 .B TIOCGPKT
550 Argument:
551 .BI "const int\~*" argp
553 (since Linux 3.8)
554 Return the current packet mode setting in the integer pointed to by
555 .IR argp .
557 .B TIOCSPTLCK
558 Argument:
559 .BI "int\~*" argp
561 Set (if
562 .I *argp
563 is nonzero) or remove (if
564 .I *argp
565 is zero) the lock on the pseudoterminal slave device.
566 (See also
567 .BR unlockpt (3).)
569 .B TIOCGPTLCK
570 Argument:
571 .BI "int\~*" argp
573 (since Linux 3.8)
574 Place the current lock state of the pseudoterminal slave device
575 in the location pointed to by
576 .IR argp .
578 .B TIOCGPTPEER
579 Argument:
580 .BI "int " flags
582 .\" commit 54ebbfb1603415d9953c150535850d30609ef077
583 (since Linux 4.13)
584 Given a file descriptor in
585 .I fd
586 that refers to a pseudoterminal master,
587 open (with the given
588 .BR open (2)-style
589 .IR flags )
590 and return a new file descriptor that refers to the peer
591 pseudoterminal slave device.
592 This operation can be performed
593 regardless of whether the pathname of the slave device
594 is accessible through the calling process's mount namespace.
596 Security-conscious programs interacting with namespaces may wish to use this
597 operation rather than
598 .BR open (2)
599 with the pathname returned by
600 .BR ptsname (3),
601 and similar library functions that have insecure APIs.
602 (For example, confusion can occur in some cases using
603 .BR ptsname (3)
604 with a pathname where a devpts filesystem
605 has been mounted in a different mount namespace.)
607 The BSD ioctls
608 .BR TIOCSTOP ,
609 .BR TIOCSTART ,
610 .BR TIOCUCNTL ,
612 .B TIOCREMOTE
613 have not been implemented under Linux.
614 .SS Modem control
616 .B TIOCMGET
617 Argument:
618 .BI "int\~*" argp
620 Get the status of modem bits.
622 .B TIOCMSET
623 Argument:
624 .BI "const int\~*" argp
626 Set the status of modem bits.
628 .B TIOCMBIC
629 Argument:
630 .BI "const int\~*" argp
632 Clear the indicated modem bits.
634 .B TIOCMBIS
635 Argument:
636 .BI "const int\~*" argp
638 Set the indicated modem bits.
640 The following bits are used by the above ioctls:
643 lb l.
644 TIOCM_LE        DSR (data set ready/line enable)
645 TIOCM_DTR       DTR (data terminal ready)
646 TIOCM_RTS       RTS (request to send)
647 TIOCM_ST        Secondary TXD (transmit)
648 TIOCM_SR        Secondary RXD (receive)
649 TIOCM_CTS       CTS (clear to send)
650 TIOCM_CAR       DCD (data carrier detect)
651 TIOCM_CD        see TIOCM_CAR
652 TIOCM_RNG       RNG (ring)
653 TIOCM_RI        see TIOCM_RNG
654 TIOCM_DSR       DSR (data set ready)
657 .B TIOCMIWAIT
658 Argument:
659 .BI "int " arg
661 Wait for any of the 4 modem bits (DCD, RI, DSR, CTS) to change.
662 The bits of interest are specified as a bit mask in
663 .IR arg ,
664 by ORing together any of the bit values,
665 .BR TIOCM_RNG ,
666 .BR TIOCM_DSR ,
667 .BR TIOCM_CD ,
669 .BR TIOCM_CTS .
670 The caller should use
671 .B TIOCGICOUNT
672 to see which bit has changed.
674 .B TIOCGICOUNT
675 Argument:
676 .BI "struct serial_icounter_struct\~*" argp
678 Get counts of input serial line interrupts (DCD, RI, DSR, CTS).
679 The counts are written to the
680 .I serial_icounter_struct
681 structure pointed to by
682 .IR argp .
684 Note: both 1->0 and 0->1 transitions are counted, except for
685 RI, where only 0->1 transitions are counted.
686 .SS Marking a line as local
688 .B TIOCGSOFTCAR
689 Argument:
690 .BI "int\~*" argp
692 ("Get software carrier flag")
693 Get the status of the CLOCAL flag in the c_cflag field of the
694 .I termios
695 structure.
697 .B TIOCSSOFTCAR
698 Argument:
699 .BI "const int\~*" argp
701 ("Set software carrier flag")
702 Set the CLOCAL flag in the
703 .I termios
704 structure when
705 .RI * argp
706 is nonzero, and clear it otherwise.
708 If the
709 .B CLOCAL
710 flag for a line is off, the hardware carrier detect (DCD)
711 signal is significant, and an
712 .BR open (2)
713 of the corresponding terminal will block until DCD is asserted,
714 unless the
715 .B O_NONBLOCK
716 flag is given.
718 .B CLOCAL
719 is set, the line behaves as if DCD is always asserted.
720 The software carrier flag is usually turned on for local devices,
721 and is off for lines with modems.
722 .SS Linux-specific
723 For the
724 .B TIOCLINUX
725 ioctl, see
726 .BR ioctl_console (2).
727 .SS Kernel debugging
728 .B "#include <linux/tty.h>"
730 .B TIOCTTYGSTRUCT
731 Argument:
732 .BI "struct tty_struct\~*" argp
734 Get the
735 .I tty_struct
736 corresponding to
737 .IR fd .
738 This operation was removed in Linux 2.5.67.
739 .\"     commit b3506a09d15dc5aee6d4bb88d759b157016e1864
740 .\"     Author: Andries E. Brouwer <andries.brouwer@cwi.nl>
741 .\"     Date:   Tue Apr 1 04:42:46 2003 -0800
743 .\"     [PATCH] kill TIOCTTYGSTRUCT
745 .\"     Only used for (dubious) debugging purposes, and exposes
746 .\"     internal kernel state.
748 .\" .SS Serial info
749 .\" .BR "#include <linux/serial.h>"
750 .\" .P
751 .\" .TP
752 .\" .BI "TIOCGSERIAL    struct serial_struct *" argp
753 .\" Get serial info.
754 .\" .TP
755 .\" .BI "TIOCSSERIAL    const struct serial_struct *" argp
756 .\" Set serial info.
757 .SH RETURN VALUE
759 .BR ioctl (2)
760 system call returns 0 on success.
761 On error, it returns \-1 and sets
762 .I errno
763 to indicate the error.
764 .SH ERRORS
766 .B EINVAL
767 Invalid operation parameter.
769 .B ENOIOCTLCMD
770 Unknown operation.
772 .B ENOTTY
773 Inappropriate
774 .IR fd .
776 .B EPERM
777 Insufficient permission.
778 .SH EXAMPLES
779 Check the condition of DTR on the serial port.
781 .\" SRC BEGIN (tiocmget.c)
783 #include <fcntl.h>
784 #include <stdio.h>
785 #include <sys/ioctl.h>
786 #include <unistd.h>
789 main(void)
791     int fd, serial;
793     fd = open("/dev/ttyS0", O_RDONLY);
794     ioctl(fd, TIOCMGET, &serial);
795     if (serial & TIOCM_DTR)
796         puts("TIOCM_DTR is set");
797     else
798         puts("TIOCM_DTR is not set");
799     close(fd);
802 .\" SRC END
804 Get or set arbitrary baudrate on the serial port.
806 .\" SRC BEGIN (tcgets.c)
808 /* SPDX-License-Identifier: GPL-2.0-or-later */
810 #include <asm/termbits.h>
811 #include <fcntl.h>
812 #include <stdio.h>
813 #include <stdlib.h>
814 #include <sys/ioctl.h>
815 #include <unistd.h>
818 main(int argc, char *argv[])
820 #if !defined BOTHER
821     fprintf(stderr, "BOTHER is unsupported\en");
822     /* Program may fallback to TCGETS/TCSETS with Bnnn constants */
823     exit(EXIT_FAILURE);
824 #else
825     /* Declare tio structure, its type depends on supported ioctl */
826 # if defined TCGETS2
827     struct termios2 tio;
828 # else
829     struct termios tio;
830 # endif
831     int fd, rc;
833     if (argc != 2 && argc != 3 && argc != 4) {
834         fprintf(stderr, "Usage: %s device [output [input] ]\en", argv[0]);
835         exit(EXIT_FAILURE);
836     }
838     fd = open(argv[1], O_RDWR | O_NONBLOCK | O_NOCTTY);
839     if (fd < 0) {
840         perror("open");
841         exit(EXIT_FAILURE);
842     }
844     /* Get the current serial port settings via supported ioctl */
845 # if defined TCGETS2
846     rc = ioctl(fd, TCGETS2, &tio);
847 # else
848     rc = ioctl(fd, TCGETS, &tio);
849 # endif
850     if (rc) {
851         perror("TCGETS");
852         close(fd);
853         exit(EXIT_FAILURE);
854     }
856     /* Change baud rate when more arguments were provided */
857     if (argc == 3 || argc == 4) {
858         /* Clear the current output baud rate and fill a new value */
859         tio.c_cflag &= \[ti]CBAUD;
860         tio.c_cflag |= BOTHER;
861         tio.c_ospeed = atoi(argv[2]);
863         /* Clear the current input baud rate and fill a new value */
864         tio.c_cflag &= \[ti](CBAUD << IBSHIFT);
865         tio.c_cflag |= BOTHER << IBSHIFT;
866         /* When 4th argument is not provided reuse output baud rate */
867         tio.c_ispeed = (argc == 4) ? atoi(argv[3]) : atoi(argv[2]);
869         /* Set new serial port settings via supported ioctl */
870 # if defined TCSETS2
871         rc = ioctl(fd, TCSETS2, &tio);
872 # else
873         rc = ioctl(fd, TCSETS, &tio);
874 # endif
875         if (rc) {
876             perror("TCSETS");
877             close(fd);
878             exit(EXIT_FAILURE);
879         }
881         /* And get new values which were really configured */
882 # if defined TCGETS2
883         rc = ioctl(fd, TCGETS2, &tio);
884 # else
885         rc = ioctl(fd, TCGETS, &tio);
886 # endif
887         if (rc) {
888             perror("TCGETS");
889             close(fd);
890             exit(EXIT_FAILURE);
891         }
892     }
894     close(fd);
896     printf("output baud rate: %u\en", tio.c_ospeed);
897     printf("input baud rate: %u\en", tio.c_ispeed);
899     exit(EXIT_SUCCESS);
900 #endif
903 .\" SRC END
904 .SH SEE ALSO
905 .BR ldattach (8),
906 .BR ioctl (2),
907 .BR ioctl_console (2),
908 .BR termios (3),
909 .BR pty (7)
911 .\" FIONBIO                     const int *
912 .\" FIONCLEX                    void
913 .\" FIOCLEX                     void
914 .\" FIOASYNC                    const int *
915 .\" from serial.c:
916 .\" TIOCSERCONFIG               void
917 .\" TIOCSERGWILD                int *
918 .\" TIOCSERSWILD                const int *
919 .\" TIOCSERGSTRUCT              struct async_struct *
920 .\" TIOCSERGETMULTI             struct serial_multiport_struct *
921 .\" TIOCSERSETMULTI             const struct serial_multiport_struct *
922 .\" TIOCGSERIAL, TIOCSSERIAL (see above)