Debian Codegraph @

upstream/debian-unstable/man2/ioctl_tty.2

raw
1 .\" Copyright 2002, Walter Harms <[email protected]>
2 .\" Copyright 2002, Andries Brouwer <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: GPL-1.0-or-later
6 .\"
7 .TH ioctl_tty 2 2026-02-08 "Linux man-pages 6.18"
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 .BR "#include <asm/termbits.h>" " /* Definition of constants */"
16 .B #include <sys/ioctl.h>
17 .P
18 .BI "int ioctl(int " fd ", int " op ", ...);"
19 .fi
20 .SH DESCRIPTION
21 The
22 .BR ioctl (2)
23 call for terminals and serial ports accepts many possible operation arguments.
24 Most require a third argument, of varying type, here called
25 .I argp
26 or
27 .IR arg .
28 .P
29 Use of
30 .BR ioctl ()
31 makes for nonportable programs.
32 Use the POSIX interface described in
33 .BR termios (3)
34 whenever possible.
35 .SS Get and set terminal attributes
36 .TP
37 .BR TCGETS (2const)
38 .TQ
39 .BR TCSETS (2const)
40 .TQ
41 .BR TCSETSW (2const)
42 .TQ
43 .BR TCSETSF (2const)
44 .TP
45 .BR TCGETS (2const)
46 .TQ
47 .BR TCSETS (2const)
48 .TQ
49 .BR TCSETSW (2const)
50 .TQ
51 .BR TCSETSF (2const)
52 .TP
53 .BR TCGETS (2const)
54 .TQ
55 .BR TCSETS (2const)
56 .TQ
57 .BR TCSETSW (2const)
58 .TQ
59 .BR TCSETSF (2const)
60 .SS Locking the termios structure
61 .TP
62 .BR TIOCGLCKTRMIOS (2const)
63 .TQ
64 .BR TIOCSLCKTRMIOS (2const)
65 .SS Get and set window size
66 .TP
67 .BR TIOCGWINSZ (2const)
68 .TQ
69 .BR TIOCSWINSZ (2const)
70 .SS Sending a break
71 .TP
72 .BR TCSBRK (2const)
73 .TQ
74 .BR TCSBRKP (2const)
75 .TQ
76 .BR TIOCSBRK (2const)
77 .TQ
78 .BR TIOCCBRK (2const)
79 .SS Software flow control
80 .TP
81 .BR TCXONC (2const)
82 .SS Buffer count and flushing
83 .TP
84 .BR FIONREAD (2const)
85 .TQ
86 .BR TIOCINQ (2const)
87 .TQ
88 .BR TIOCOUTQ (2const)
89 .TQ
90 .BR TCFLSH (2const)
91 .TQ
92 .BR TIOCSERGETLSR (2const)
93 .SS Faking input
94 .TP
95 .BR TIOCSTI (2const)
96 .SS Redirecting console output
97 .TP
98 .BR TIOCCONS (2const)
99 .SS Controlling terminal
100 .TP
101 .BR TIOCSCTTY (2const)
102 .TQ
103 .BR TIOCNOTTY (2const)
104 .SS Process group and session ID
105 .TP
106 .BR TIOCGPGRP (2const)
107 .TQ
108 .BR TIOCSPGRP (2const)
109 .TQ
110 .BR TIOCGSID (2const)
111 .SS Exclusive mode
112 .TP
113 .BR TIOCEXCL (2const)
114 .TQ
115 .BR TIOCGEXCL (2const)
116 .TQ
117 .BR TIOCNXCL (2const)
118 .SS Line discipline
119 .TP
120 .BR TIOCGETD (2const)
121 .TQ
122 .BR TIOCSETD (2const)
123 .SS Pseudoterminal ioctls
124 .TP
125 .BR TIOCPKT (2const)
126 .TQ
127 .BR TIOCGPKT (2const)
128 .TP
129 .BR TIOCSPTLCK (2const)
130 .TQ
131 .BR TIOCGPTLCK (2const)
132 .TP
133 .BR TIOCGPTPEER (2const)
134 .SS Modem control
135 .TP
136 .BR TIOCMGET (2const)
137 .TQ
138 .BR TIOCMSET (2const)
139 .TQ
140 .BR TIOCMBIC (2const)
141 .TQ
142 .BR TIOCMBIS (2const)
143 .TP
144 .BR TIOCMIWAIT (2const)
145 .TP
146 .BR TIOCGICOUNT (2const)
147 .SS Marking a line as local
148 .TP
149 .BR TIOCGSOFTCAR (2const)
150 .TQ
151 .BR TIOCSSOFTCAR (2const)
152 .SS Linux-specific
153 For the
154 .BR TIOCLINUX (2const)
155 ioctl, see
156 .BR ioctl_console (2).
157 .SS Kernel debugging
158 .TP
159 .BR TIOCTTYGSTRUCT (2const)
160 .\" .SS Serial info
161 .\" .BR "#include <linux/serial.h>"
162 .\" .P
163 .\" .TP
164 .\" .BI "TIOCGSERIAL struct serial_struct *" argp
165 .\" Get serial info.
166 .\" .TP
167 .\" .BI "TIOCSSERIAL const struct serial_struct *" argp
168 .\" Set serial info.
169 .SH RETURN VALUE
170 On success,
171 0 is returned.
172 On error,
173 \-1 is returned, and
174 .I errno
175 is set to indicate the error.
176 .SH SEE ALSO
177 .BR ioctl (2),
178 .BR ldattach (8),
179 .BR ioctl_console (2),
180 .BR termios (3),
181 .BR pty (7)
182 .\"
183 .\" FIONBIO const int *
184 .\" FIONCLEX void
185 .\" FIOCLEX void
186 .\" FIOASYNC const int *
187 .\" from serial.c:
188 .\" TIOCSERCONFIG void
189 .\" TIOCSERGWILD int *
190 .\" TIOCSERSWILD const int *
191 .\" TIOCSERGSTRUCT struct async_struct *
192 .\" TIOCSERGETMULTI struct serial_multiport_struct *
193 .\" TIOCSERSETMULTI const struct serial_multiport_struct *
194 .\" TIOCGSERIAL, TIOCSSERIAL (see above)