xref: /xnu-8792.81.2/bsd/man/man4/tty.4 (revision 19c3b8c28c31cb8130e034cfb5df6bf9ba342d90)
1*19c3b8c2SApple OSS Distributions.\" Copyright (c) 1991, 1992, 1993
2*19c3b8c2SApple OSS Distributions.\"	The Regents of the University of California.  All rights reserved.
3*19c3b8c2SApple OSS Distributions.\"
4*19c3b8c2SApple OSS Distributions.\" Redistribution and use in source and binary forms, with or without
5*19c3b8c2SApple OSS Distributions.\" modification, are permitted provided that the following conditions
6*19c3b8c2SApple OSS Distributions.\" are met:
7*19c3b8c2SApple OSS Distributions.\" 1. Redistributions of source code must retain the above copyright
8*19c3b8c2SApple OSS Distributions.\"    notice, this list of conditions and the following disclaimer.
9*19c3b8c2SApple OSS Distributions.\" 2. Redistributions in binary form must reproduce the above copyright
10*19c3b8c2SApple OSS Distributions.\"    notice, this list of conditions and the following disclaimer in the
11*19c3b8c2SApple OSS Distributions.\"    documentation and/or other materials provided with the distribution.
12*19c3b8c2SApple OSS Distributions.\" 3. All advertising materials mentioning features or use of this software
13*19c3b8c2SApple OSS Distributions.\"    must display the following acknowledgement:
14*19c3b8c2SApple OSS Distributions.\"	This product includes software developed by the University of
15*19c3b8c2SApple OSS Distributions.\"	California, Berkeley and its contributors.
16*19c3b8c2SApple OSS Distributions.\" 4. Neither the name of the University nor the names of its contributors
17*19c3b8c2SApple OSS Distributions.\"    may be used to endorse or promote products derived from this software
18*19c3b8c2SApple OSS Distributions.\"    without specific prior written permission.
19*19c3b8c2SApple OSS Distributions.\"
20*19c3b8c2SApple OSS Distributions.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21*19c3b8c2SApple OSS Distributions.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22*19c3b8c2SApple OSS Distributions.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23*19c3b8c2SApple OSS Distributions.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24*19c3b8c2SApple OSS Distributions.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25*19c3b8c2SApple OSS Distributions.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26*19c3b8c2SApple OSS Distributions.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27*19c3b8c2SApple OSS Distributions.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28*19c3b8c2SApple OSS Distributions.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29*19c3b8c2SApple OSS Distributions.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30*19c3b8c2SApple OSS Distributions.\" SUCH DAMAGE.
31*19c3b8c2SApple OSS Distributions.\"
32*19c3b8c2SApple OSS Distributions.\"     @(#)tty.4	8.3 (Berkeley) 4/19/94
33*19c3b8c2SApple OSS Distributions.\"	$FreeBSD$
34*19c3b8c2SApple OSS Distributions.\"
35*19c3b8c2SApple OSS Distributions.Dd August 14, 1992
36*19c3b8c2SApple OSS Distributions.Dt TTY 4
37*19c3b8c2SApple OSS Distributions.Os BSD 4
38*19c3b8c2SApple OSS Distributions.Sh NAME
39*19c3b8c2SApple OSS Distributions.Nm tty
40*19c3b8c2SApple OSS Distributions.Nd general terminal interface
41*19c3b8c2SApple OSS Distributions.Sh SYNOPSIS
42*19c3b8c2SApple OSS Distributions.Fd #include <sys/ioctl.h>
43*19c3b8c2SApple OSS Distributions.Sh DESCRIPTION
44*19c3b8c2SApple OSS DistributionsThis section describes the interface to the terminal drivers
45*19c3b8c2SApple OSS Distributionsin the system.
46*19c3b8c2SApple OSS Distributions.Ss Terminal Special Files
47*19c3b8c2SApple OSS DistributionsEach hardware terminal port on the system usually has a terminal special device
48*19c3b8c2SApple OSS Distributionsfile associated with it in the directory ``/dev/'' (for
49*19c3b8c2SApple OSS Distributionsexample, ``/dev/tty03'').
50*19c3b8c2SApple OSS DistributionsWhen a user logs into
51*19c3b8c2SApple OSS Distributionsthe system on one of these hardware terminal ports, the system has already
52*19c3b8c2SApple OSS Distributionsopened the associated device and prepared the line for normal interactive
53*19c3b8c2SApple OSS Distributionsuse (see
54*19c3b8c2SApple OSS Distributions.Xr getty 8 .)
55*19c3b8c2SApple OSS DistributionsThere is also a special case of a terminal file that connects not to
56*19c3b8c2SApple OSS Distributionsa hardware terminal port, but to another program on the other side.
57*19c3b8c2SApple OSS DistributionsThese special terminal devices are called
58*19c3b8c2SApple OSS Distributions.Em ptys
59*19c3b8c2SApple OSS Distributionsand provide the mechanism necessary to give users the same interface to the
60*19c3b8c2SApple OSS Distributionssystem when logging in over a network (using
61*19c3b8c2SApple OSS Distributions.Xr rlogin 1 ,
62*19c3b8c2SApple OSS Distributionsor
63*19c3b8c2SApple OSS Distributions.Xr telnet 1
64*19c3b8c2SApple OSS Distributionsfor example).  Even in these cases the details of how the terminal
65*19c3b8c2SApple OSS Distributionsfile was opened and set up is already handled by special software
66*19c3b8c2SApple OSS Distributionsin the system.
67*19c3b8c2SApple OSS DistributionsThus, users do not normally need to worry about the details of
68*19c3b8c2SApple OSS Distributionshow these lines are opened or used.  Also, these lines are often used
69*19c3b8c2SApple OSS Distributionsfor dialing out of a system (through an out-calling modem), but again
70*19c3b8c2SApple OSS Distributionsthe system provides programs that hide the details of accessing
71*19c3b8c2SApple OSS Distributionsthese terminal special files (see
72*19c3b8c2SApple OSS Distributions.Xr tip 1 ).
73*19c3b8c2SApple OSS Distributions.Pp
74*19c3b8c2SApple OSS DistributionsWhen an interactive user logs in, the system prepares the line to
75*19c3b8c2SApple OSS Distributionsbehave in a certain way (called a
76*19c3b8c2SApple OSS Distributions.Em "line discipline" ) ,
77*19c3b8c2SApple OSS Distributionsthe particular details of which is described in
78*19c3b8c2SApple OSS Distributions.Xr stty 1
79*19c3b8c2SApple OSS Distributionsat the command level, and in
80*19c3b8c2SApple OSS Distributions.Xr termios 4
81*19c3b8c2SApple OSS Distributionsat the programming level.  A user may be concerned with changing
82*19c3b8c2SApple OSS Distributionssettings associated with his particular login terminal and should refer
83*19c3b8c2SApple OSS Distributionsto the preceding man pages for the common cases.  The remainder of
84*19c3b8c2SApple OSS Distributionsthis man page is concerned
85*19c3b8c2SApple OSS Distributionswith describing details of using and controlling terminal devices
86*19c3b8c2SApple OSS Distributionsat a low level, such as that possibly required by a program wishing
87*19c3b8c2SApple OSS Distributionsto provide features similar to those provided by the system.
88*19c3b8c2SApple OSS Distributions.Ss Line disciplines
89*19c3b8c2SApple OSS DistributionsA terminal file is used like any other file in the system in that
90*19c3b8c2SApple OSS Distributionsit can be opened, read, and written to using standard system
91*19c3b8c2SApple OSS Distributionscalls.  For each existing terminal file, there is a software processing module
92*19c3b8c2SApple OSS Distributionscalled a
93*19c3b8c2SApple OSS Distributions.Em "line discipline"
94*19c3b8c2SApple OSS Distributionsis associated with it.  The
95*19c3b8c2SApple OSS Distributions.Em "line discipline"
96*19c3b8c2SApple OSS Distributionsessentially glues the low level device driver code with the high
97*19c3b8c2SApple OSS Distributionslevel generic interface routines (such as
98*19c3b8c2SApple OSS Distributions.Xr read 2
99*19c3b8c2SApple OSS Distributionsand
100*19c3b8c2SApple OSS Distributions.Xr write 2 ),
101*19c3b8c2SApple OSS Distributionsand is responsible for implementing the semantics associated
102*19c3b8c2SApple OSS Distributionswith the device.  When a terminal file is first opened by a program,
103*19c3b8c2SApple OSS Distributionsthe default
104*19c3b8c2SApple OSS Distributions.Em "line discipline"
105*19c3b8c2SApple OSS Distributionscalled the
106*19c3b8c2SApple OSS Distributions.Dv termios
107*19c3b8c2SApple OSS Distributionsline discipline is associated with the file.  This is the primary
108*19c3b8c2SApple OSS Distributionsline discipline that is used in most cases and provides the semantics
109*19c3b8c2SApple OSS Distributionsthat users normally associate with a terminal.  When the
110*19c3b8c2SApple OSS Distributions.Dv termios
111*19c3b8c2SApple OSS Distributionsline discipline is in effect, the terminal file behaves and is
112*19c3b8c2SApple OSS Distributionsoperated according to the rules described in
113*19c3b8c2SApple OSS Distributions.Xr termios 4 .
114*19c3b8c2SApple OSS DistributionsPlease refer to that man page for a full description of the terminal
115*19c3b8c2SApple OSS Distributionssemantics.
116*19c3b8c2SApple OSS DistributionsThe operations described here
117*19c3b8c2SApple OSS Distributionsgenerally represent features common
118*19c3b8c2SApple OSS Distributionsacross all
119*19c3b8c2SApple OSS Distributions.Em "line disciplines" ,
120*19c3b8c2SApple OSS Distributionshowever some of these calls may not
121*19c3b8c2SApple OSS Distributionsmake sense in conjunction with a line discipline other than
122*19c3b8c2SApple OSS Distributions.Dv termios ,
123*19c3b8c2SApple OSS Distributionsand some may not be supported by the underlying
124*19c3b8c2SApple OSS Distributionshardware (or lack thereof, as in the case of ptys).
125*19c3b8c2SApple OSS Distributions.Ss Terminal File Operations
126*19c3b8c2SApple OSS DistributionsAll of the following operations are invoked using the
127*19c3b8c2SApple OSS Distributions.Xr ioctl 2
128*19c3b8c2SApple OSS Distributionssystem call.  Refer to that man page for a description of
129*19c3b8c2SApple OSS Distributionsthe
130*19c3b8c2SApple OSS Distributions.Em request
131*19c3b8c2SApple OSS Distributionsand
132*19c3b8c2SApple OSS Distributions.Em argp
133*19c3b8c2SApple OSS Distributionsparameters.
134*19c3b8c2SApple OSS DistributionsIn addition to the ioctl
135*19c3b8c2SApple OSS Distributions.Em requests
136*19c3b8c2SApple OSS Distributionsdefined here, the specific line discipline
137*19c3b8c2SApple OSS Distributionsin effect will define other
138*19c3b8c2SApple OSS Distributions.Em requests
139*19c3b8c2SApple OSS Distributionsspecific to it (actually
140*19c3b8c2SApple OSS Distributions.Xr termios 4
141*19c3b8c2SApple OSS Distributionsdefines them as function calls, not ioctl
142*19c3b8c2SApple OSS Distributions.Em requests . )
143*19c3b8c2SApple OSS DistributionsThe following section lists the available ioctl requests.  The
144*19c3b8c2SApple OSS Distributionsname of the request, a description of its purpose, and the typed
145*19c3b8c2SApple OSS Distributions.Em argp
146*19c3b8c2SApple OSS Distributionsparameter (if any)
147*19c3b8c2SApple OSS Distributionsare listed.  For example, the first entry says
148*19c3b8c2SApple OSS Distributions.Pp
149*19c3b8c2SApple OSS Distributions.D1 Em "TIOCSETD int *ldisc"
150*19c3b8c2SApple OSS Distributions.Pp
151*19c3b8c2SApple OSS Distributionsand would be called on the terminal associated with
152*19c3b8c2SApple OSS Distributionsfile descriptor zero by the following code fragment:
153*19c3b8c2SApple OSS Distributions.Bd -literal
154*19c3b8c2SApple OSS Distributions	int ldisc;
155*19c3b8c2SApple OSS Distributions
156*19c3b8c2SApple OSS Distributions	ldisc = TTYDISC;
157*19c3b8c2SApple OSS Distributions	ioctl(0, TIOCSETD, &ldisc);
158*19c3b8c2SApple OSS Distributions.Ed
159*19c3b8c2SApple OSS Distributions.Ss Terminal File Request Descriptions
160*19c3b8c2SApple OSS Distributions.Bl -tag -width TIOCGWINSZ
161*19c3b8c2SApple OSS Distributions.It Dv TIOCSETD Fa int *ldisc
162*19c3b8c2SApple OSS DistributionsChange to the new line discipline pointed to by
163*19c3b8c2SApple OSS Distributions.Fa ldisc .
164*19c3b8c2SApple OSS DistributionsThe available line disciplines are listed in
165*19c3b8c2SApple OSS Distributions.Pa Aq sys/ttycom.h
166*19c3b8c2SApple OSS Distributionsand currently are:
167*19c3b8c2SApple OSS Distributions.Pp
168*19c3b8c2SApple OSS Distributions.Bl -tag -width TIOCGWINSZ -compact
169*19c3b8c2SApple OSS Distributions.It TTYDISC
170*19c3b8c2SApple OSS DistributionsTermios interactive line discipline.
171*19c3b8c2SApple OSS Distributions.It TABLDISC
172*19c3b8c2SApple OSS DistributionsTablet line discipline.
173*19c3b8c2SApple OSS Distributions.It SLIPDISC
174*19c3b8c2SApple OSS DistributionsSerial IP line discipline.
175*19c3b8c2SApple OSS Distributions.It PPPDISC
176*19c3b8c2SApple OSS DistributionsPPP line discipline.
177*19c3b8c2SApple OSS Distributions.El
178*19c3b8c2SApple OSS Distributions.Pp
179*19c3b8c2SApple OSS Distributions.It Dv TIOCGETD Fa int *ldisc
180*19c3b8c2SApple OSS DistributionsReturn the current line discipline in the integer pointed to by
181*19c3b8c2SApple OSS Distributions.Fa ldisc .
182*19c3b8c2SApple OSS Distributions.It Dv TIOCSBRK Fa void
183*19c3b8c2SApple OSS DistributionsSet the terminal hardware into BREAK condition.
184*19c3b8c2SApple OSS Distributions.It Dv TIOCCBRK Fa void
185*19c3b8c2SApple OSS DistributionsClear the terminal hardware BREAK condition.
186*19c3b8c2SApple OSS Distributions.It Dv TIOCSDTR Fa void
187*19c3b8c2SApple OSS DistributionsAssert data terminal ready (DTR).
188*19c3b8c2SApple OSS Distributions.It Dv TIOCCDTR Fa void
189*19c3b8c2SApple OSS DistributionsClear data terminal ready (DTR).
190*19c3b8c2SApple OSS Distributions.It Dv TIOCGPGRP Fa int *tpgrp
191*19c3b8c2SApple OSS DistributionsReturn the current process group the terminal is associated
192*19c3b8c2SApple OSS Distributionswith in the integer pointed to by
193*19c3b8c2SApple OSS Distributions.Fa tpgrp .
194*19c3b8c2SApple OSS DistributionsThis is the underlying call that implements the
195*19c3b8c2SApple OSS Distributions.Xr termios 4
196*19c3b8c2SApple OSS Distributions.Fn tcgetattr
197*19c3b8c2SApple OSS Distributionscall.
198*19c3b8c2SApple OSS Distributions.It Dv TIOCSPGRP Fa int *tpgrp
199*19c3b8c2SApple OSS DistributionsAssociate the terminal with the process group (as an integer) pointed to by
200*19c3b8c2SApple OSS Distributions.Fa tpgrp .
201*19c3b8c2SApple OSS DistributionsThis is the underlying call that implements the
202*19c3b8c2SApple OSS Distributions.Xr termios 4
203*19c3b8c2SApple OSS Distributions.Fn tcsetattr
204*19c3b8c2SApple OSS Distributionscall.
205*19c3b8c2SApple OSS Distributions.It Dv TIOCGETA Fa struct termios *term
206*19c3b8c2SApple OSS DistributionsPlace the current value of the termios state associated with the
207*19c3b8c2SApple OSS Distributionsdevice in the termios structure pointed to by
208*19c3b8c2SApple OSS Distributions.Fa term .
209*19c3b8c2SApple OSS DistributionsThis is the underlying call that implements the
210*19c3b8c2SApple OSS Distributions.Xr termios 4
211*19c3b8c2SApple OSS Distributions.Fn tcgetattr
212*19c3b8c2SApple OSS Distributionscall.
213*19c3b8c2SApple OSS Distributions.It Dv TIOCSETA Fa struct termios *term
214*19c3b8c2SApple OSS DistributionsSet the termios state associated with the device immediately.
215*19c3b8c2SApple OSS DistributionsThis is the underlying call that implements the
216*19c3b8c2SApple OSS Distributions.Xr termios 4
217*19c3b8c2SApple OSS Distributions.Fn tcsetattr
218*19c3b8c2SApple OSS Distributionscall with the
219*19c3b8c2SApple OSS Distributions.Dv TCSANOW
220*19c3b8c2SApple OSS Distributionsoption.
221*19c3b8c2SApple OSS Distributions.It Dv TIOCSETAW Fa struct termios *term
222*19c3b8c2SApple OSS DistributionsFirst wait for any output to complete, then set the termios state
223*19c3b8c2SApple OSS Distributionsassociated with the device.
224*19c3b8c2SApple OSS DistributionsThis is the underlying call that implements the
225*19c3b8c2SApple OSS Distributions.Xr termios 4
226*19c3b8c2SApple OSS Distributions.Fn tcsetattr
227*19c3b8c2SApple OSS Distributionscall with the
228*19c3b8c2SApple OSS Distributions.Dv TCSADRAIN
229*19c3b8c2SApple OSS Distributionsoption.
230*19c3b8c2SApple OSS Distributions.It Dv TIOCSETAF Fa struct termios *term
231*19c3b8c2SApple OSS DistributionsFirst wait for any output to complete, clear any pending input,
232*19c3b8c2SApple OSS Distributionsthen set the termios state associated with the device.
233*19c3b8c2SApple OSS DistributionsThis is the underlying call that implements the
234*19c3b8c2SApple OSS Distributions.Xr termios 4
235*19c3b8c2SApple OSS Distributions.Fn tcsetattr
236*19c3b8c2SApple OSS Distributionscall with the
237*19c3b8c2SApple OSS Distributions.Dv TCSAFLUSH
238*19c3b8c2SApple OSS Distributionsoption.
239*19c3b8c2SApple OSS Distributions.It Dv TIOCOUTQ Fa int *num
240*19c3b8c2SApple OSS DistributionsPlace the current number of characters in the output queue in the
241*19c3b8c2SApple OSS Distributionsinteger pointed to by
242*19c3b8c2SApple OSS Distributions.Fa num .
243*19c3b8c2SApple OSS Distributions.It Dv TIOCSTI Fa char *cp
244*19c3b8c2SApple OSS DistributionsSimulate typed input.  Pretend as if the terminal received the
245*19c3b8c2SApple OSS Distributionscharacter pointed to by
246*19c3b8c2SApple OSS Distributions.Fa cp .
247*19c3b8c2SApple OSS Distributions.It Dv TIOCNOTTY Fa void
248*19c3b8c2SApple OSS DistributionsThis call is obsolete but left for compatibility.  In the past, when
249*19c3b8c2SApple OSS Distributionsa process that didn't have a controlling terminal (see
250*19c3b8c2SApple OSS Distributions.Em The Controlling Terminal
251*19c3b8c2SApple OSS Distributionsin
252*19c3b8c2SApple OSS Distributions.Xr termios 4 )
253*19c3b8c2SApple OSS Distributionsfirst opened a terminal device, it acquired that terminal as its
254*19c3b8c2SApple OSS Distributionscontrolling terminal.  For some programs this was a hazard as they
255*19c3b8c2SApple OSS Distributionsdidn't want a controlling terminal in the first place, and this
256*19c3b8c2SApple OSS Distributionsprovided a mechanism to disassociate the controlling terminal from
257*19c3b8c2SApple OSS Distributionsthe calling process.  It
258*19c3b8c2SApple OSS Distributions.Em must
259*19c3b8c2SApple OSS Distributionsbe called by opening the file
260*19c3b8c2SApple OSS Distributions.Pa /dev/tty
261*19c3b8c2SApple OSS Distributionsand calling
262*19c3b8c2SApple OSS Distributions.Dv TIOCNOTTY
263*19c3b8c2SApple OSS Distributionson that file descriptor.
264*19c3b8c2SApple OSS Distributions.Pp
265*19c3b8c2SApple OSS DistributionsThe current system does not allocate a controlling terminal to
266*19c3b8c2SApple OSS Distributionsa process on an
267*19c3b8c2SApple OSS Distributions.Fn open
268*19c3b8c2SApple OSS Distributionscall: there is a specific ioctl called
269*19c3b8c2SApple OSS Distributions.Dv TIOSCTTY
270*19c3b8c2SApple OSS Distributionsto make a terminal the controlling
271*19c3b8c2SApple OSS Distributionsterminal.
272*19c3b8c2SApple OSS DistributionsIn addition, a program can
273*19c3b8c2SApple OSS Distributions.Fn fork
274*19c3b8c2SApple OSS Distributionsand call the
275*19c3b8c2SApple OSS Distributions.Fn setsid
276*19c3b8c2SApple OSS Distributionssystem call which will place the process into its own session - which
277*19c3b8c2SApple OSS Distributionshas the effect of disassociating it from the controlling terminal.  This
278*19c3b8c2SApple OSS Distributionsis the new and preferred method for programs to lose their controlling
279*19c3b8c2SApple OSS Distributionsterminal.
280*19c3b8c2SApple OSS Distributions.It Dv TIOCSTOP Fa void
281*19c3b8c2SApple OSS DistributionsStop output on the terminal (like typing ^S at the keyboard).
282*19c3b8c2SApple OSS Distributions.It Dv TIOCSTART Fa void
283*19c3b8c2SApple OSS DistributionsStart output on the terminal (like typing ^Q at the keyboard).
284*19c3b8c2SApple OSS Distributions.It Dv TIOCSCTTY Fa void
285*19c3b8c2SApple OSS DistributionsMake the terminal the controlling terminal for the process (the process
286*19c3b8c2SApple OSS Distributionsmust not currently have a controlling terminal).
287*19c3b8c2SApple OSS Distributions.It Dv TIOCDRAIN Fa void
288*19c3b8c2SApple OSS DistributionsWait until all output is drained.
289*19c3b8c2SApple OSS Distributions.It Dv TIOCEXCL Fa void
290*19c3b8c2SApple OSS DistributionsSet exclusive use on the terminal.  No further opens are permitted
291*19c3b8c2SApple OSS Distributionsexcept by root.  Of course, this means that programs that are run by
292*19c3b8c2SApple OSS Distributionsroot (or setuid) will not obey the exclusive setting - which limits
293*19c3b8c2SApple OSS Distributionsthe usefulness of this feature.
294*19c3b8c2SApple OSS Distributions.It Dv TIOCNXCL Fa void
295*19c3b8c2SApple OSS DistributionsClear exclusive use of the terminal.  Further opens are permitted.
296*19c3b8c2SApple OSS Distributions.It Dv TIOCFLUSH Fa int *what
297*19c3b8c2SApple OSS DistributionsIf the value of the int pointed to by
298*19c3b8c2SApple OSS Distributions.Fa what
299*19c3b8c2SApple OSS Distributionscontains the
300*19c3b8c2SApple OSS Distributions.Dv FREAD
301*19c3b8c2SApple OSS Distributionsbit as defined in
302*19c3b8c2SApple OSS Distributions.Pa Aq sys/file.h ,
303*19c3b8c2SApple OSS Distributionsthen all characters in the input queue are cleared.  If it contains
304*19c3b8c2SApple OSS Distributionsthe
305*19c3b8c2SApple OSS Distributions.Dv FWRITE
306*19c3b8c2SApple OSS Distributionsbit, then all characters in the output queue are cleared.  If the
307*19c3b8c2SApple OSS Distributionsvalue of the integer is zero, then it behaves as if both the
308*19c3b8c2SApple OSS Distributions.Dv FREAD
309*19c3b8c2SApple OSS Distributionsand
310*19c3b8c2SApple OSS Distributions.Dv FWRITE
311*19c3b8c2SApple OSS Distributionsbits were set (i.e. clears both queues).
312*19c3b8c2SApple OSS Distributions.It Dv TIOCGWINSZ Fa struct winsize *ws
313*19c3b8c2SApple OSS DistributionsPut the window size information associated with the terminal in the
314*19c3b8c2SApple OSS Distributions.Va winsize
315*19c3b8c2SApple OSS Distributionsstructure pointed to by
316*19c3b8c2SApple OSS Distributions.Fa ws .
317*19c3b8c2SApple OSS DistributionsThe window size structure contains the number of rows and columns (and pixels
318*19c3b8c2SApple OSS Distributionsif appropriate) of the devices attached to the terminal.  It is set by user software
319*19c3b8c2SApple OSS Distributionsand is the means by which most full\&-screen oriented programs determine the
320*19c3b8c2SApple OSS Distributionsscreen size.  The
321*19c3b8c2SApple OSS Distributions.Va winsize
322*19c3b8c2SApple OSS Distributionsstructure is defined in
323*19c3b8c2SApple OSS Distributions.Pa Aq sys/ioctl.h .
324*19c3b8c2SApple OSS Distributions.It Dv TIOCSWINSZ Fa struct winsize *ws
325*19c3b8c2SApple OSS DistributionsSet the window size associated with the terminal to be the value in
326*19c3b8c2SApple OSS Distributionsthe
327*19c3b8c2SApple OSS Distributions.Va winsize
328*19c3b8c2SApple OSS Distributionsstructure pointed to by
329*19c3b8c2SApple OSS Distributions.Fa ws
330*19c3b8c2SApple OSS Distributions(see above).
331*19c3b8c2SApple OSS Distributions.It Dv TIOCCONS Fa int *on
332*19c3b8c2SApple OSS DistributionsIf
333*19c3b8c2SApple OSS Distributions.Fa on
334*19c3b8c2SApple OSS Distributionspoints to a non-zero integer, redirect kernel console output (kernel printf's)
335*19c3b8c2SApple OSS Distributionsto this terminal.
336*19c3b8c2SApple OSS DistributionsIf
337*19c3b8c2SApple OSS Distributions.Fa on
338*19c3b8c2SApple OSS Distributionspoints to a zero integer, redirect kernel console output back to the normal
339*19c3b8c2SApple OSS Distributionsconsole.  This is usually used on workstations to redirect kernel messages
340*19c3b8c2SApple OSS Distributionsto a particular window.
341*19c3b8c2SApple OSS Distributions.It Dv TIOCMSET Fa int *state
342*19c3b8c2SApple OSS DistributionsThe integer pointed to by
343*19c3b8c2SApple OSS Distributions.Fa state
344*19c3b8c2SApple OSS Distributionscontains bits that correspond to modem state.  Following is a list
345*19c3b8c2SApple OSS Distributionsof defined variables and the modem state they represent:
346*19c3b8c2SApple OSS Distributions.Pp
347*19c3b8c2SApple OSS Distributions.Bl -tag -width TIOCMXCTS -compact
348*19c3b8c2SApple OSS Distributions.It TIOCM_LE
349*19c3b8c2SApple OSS DistributionsLine Enable.
350*19c3b8c2SApple OSS Distributions.It TIOCM_DTR
351*19c3b8c2SApple OSS DistributionsData Terminal Ready.
352*19c3b8c2SApple OSS Distributions.It TIOCM_RTS
353*19c3b8c2SApple OSS DistributionsRequest To Send.
354*19c3b8c2SApple OSS Distributions.It TIOCM_ST
355*19c3b8c2SApple OSS DistributionsSecondary Transmit.
356*19c3b8c2SApple OSS Distributions.It TIOCM_SR
357*19c3b8c2SApple OSS DistributionsSecondary Receive.
358*19c3b8c2SApple OSS Distributions.It TIOCM_CTS
359*19c3b8c2SApple OSS DistributionsClear To Send.
360*19c3b8c2SApple OSS Distributions.It TIOCM_CAR
361*19c3b8c2SApple OSS DistributionsCarrier Detect.
362*19c3b8c2SApple OSS Distributions.It TIOCM_CD
363*19c3b8c2SApple OSS DistributionsCarrier Detect (synonym).
364*19c3b8c2SApple OSS Distributions.It TIOCM_RNG
365*19c3b8c2SApple OSS DistributionsRing Indication.
366*19c3b8c2SApple OSS Distributions.It TIOCM_RI
367*19c3b8c2SApple OSS DistributionsRing Indication (synonym).
368*19c3b8c2SApple OSS Distributions.It TIOCM_DSR
369*19c3b8c2SApple OSS DistributionsData Set Ready.
370*19c3b8c2SApple OSS Distributions.El
371*19c3b8c2SApple OSS Distributions.Pp
372*19c3b8c2SApple OSS DistributionsThis call sets the terminal modem state to that represented by
373*19c3b8c2SApple OSS Distributions.Fa state .
374*19c3b8c2SApple OSS DistributionsNot all terminals may support this.
375*19c3b8c2SApple OSS Distributions.It Dv TIOCMGET Fa int *state
376*19c3b8c2SApple OSS DistributionsReturn the current state of the terminal modem lines as represented
377*19c3b8c2SApple OSS Distributionsabove in the integer pointed to by
378*19c3b8c2SApple OSS Distributions.Fa state .
379*19c3b8c2SApple OSS Distributions.It Dv TIOCMBIS Fa int *state
380*19c3b8c2SApple OSS DistributionsThe bits in the integer pointed to by
381*19c3b8c2SApple OSS Distributions.Fa state
382*19c3b8c2SApple OSS Distributionsrepresent modem state as described above, however the state is OR-ed
383*19c3b8c2SApple OSS Distributionsin with the current state.
384*19c3b8c2SApple OSS Distributions.It Dv TIOCMBIC Fa int *state
385*19c3b8c2SApple OSS DistributionsThe bits in the integer pointed to by
386*19c3b8c2SApple OSS Distributions.Fa state
387*19c3b8c2SApple OSS Distributionsrepresent modem state as described above, however each bit which is on
388*19c3b8c2SApple OSS Distributionsin
389*19c3b8c2SApple OSS Distributions.Fa state
390*19c3b8c2SApple OSS Distributionsis cleared in the terminal.
391*19c3b8c2SApple OSS Distributions.El
392*19c3b8c2SApple OSS Distributions.Sh SEE ALSO
393*19c3b8c2SApple OSS Distributions.Xr stty 1 ,
394*19c3b8c2SApple OSS Distributions.Xr ioctl 2 ,
395*19c3b8c2SApple OSS Distributions.Xr pty 4 ,
396*19c3b8c2SApple OSS Distributions.Xr termios 4 ,
397*19c3b8c2SApple OSS Distributions.Xr getty 8
398