xref: /freebsd/share/man/man4/termios.4 (revision afe61c15161c324a7af299a9b8457aba5afc92db)
1afe61c15SRodney W. Grimes.\" Copyright (c) 1991, 1992, 1993
2afe61c15SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
3afe61c15SRodney W. Grimes.\"
4afe61c15SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
5afe61c15SRodney W. Grimes.\" modification, are permitted provided that the following conditions
6afe61c15SRodney W. Grimes.\" are met:
7afe61c15SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
8afe61c15SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
9afe61c15SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
10afe61c15SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
11afe61c15SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
12afe61c15SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software
13afe61c15SRodney W. Grimes.\"    must display the following acknowledgement:
14afe61c15SRodney W. Grimes.\"	This product includes software developed by the University of
15afe61c15SRodney W. Grimes.\"	California, Berkeley and its contributors.
16afe61c15SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
17afe61c15SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
18afe61c15SRodney W. Grimes.\"    without specific prior written permission.
19afe61c15SRodney W. Grimes.\"
20afe61c15SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21afe61c15SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22afe61c15SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23afe61c15SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24afe61c15SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25afe61c15SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26afe61c15SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27afe61c15SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28afe61c15SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29afe61c15SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30afe61c15SRodney W. Grimes.\" SUCH DAMAGE.
31afe61c15SRodney W. Grimes.\"
32afe61c15SRodney W. Grimes.\"	@(#)termios.4	8.4 (Berkeley) 4/19/94
33afe61c15SRodney W. Grimes.\"
34afe61c15SRodney W. Grimes.Dd April 19, 1994
35afe61c15SRodney W. Grimes.Dt TERMIOS 4
36afe61c15SRodney W. Grimes.Os BSD 4
37afe61c15SRodney W. Grimes.Sh NAME
38afe61c15SRodney W. Grimes.Nm termios
39afe61c15SRodney W. Grimes.Nd general terminal line discipline
40afe61c15SRodney W. Grimes.Sh SYNOPSIS
41afe61c15SRodney W. Grimes.Fd #include <termios.h>
42afe61c15SRodney W. Grimes.Sh DESCRIPTION
43afe61c15SRodney W. GrimesThis describes a general terminal line discipline that is
44afe61c15SRodney W. Grimessupported on tty asynchronous communication ports.
45afe61c15SRodney W. Grimes.Ss Opening a Terminal Device File
46afe61c15SRodney W. GrimesWhen a terminal file is opened, it normally causes the process to wait
47afe61c15SRodney W. Grimesuntil a connection is established.  For most hardware, the presence
48afe61c15SRodney W. Grimesof a connection is indicated by the assertion of the hardware
49afe61c15SRodney W. Grimes.Dv CARRIER line.
50afe61c15SRodney W. GrimesIf the termios structure associated with the terminal file has the
51afe61c15SRodney W. Grimes.Dv CLOCAL
52afe61c15SRodney W. Grimesflag set in the cflag, or if the
53afe61c15SRodney W. Grimes.Dv O_NONBLOCK
54afe61c15SRodney W. Grimesflag is set
55afe61c15SRodney W. Grimesin the
56afe61c15SRodney W. Grimes.Xr open 2
57afe61c15SRodney W. Grimescall, then the open will succeed even without
58afe61c15SRodney W. Grimesa connection being present.
59afe61c15SRodney W. GrimesIn practice, applications
60afe61c15SRodney W. Grimesseldom open these files; they are opened by special programs, such
61afe61c15SRodney W. Grimesas
62afe61c15SRodney W. Grimes.Xr getty 2
63afe61c15SRodney W. Grimesor
64afe61c15SRodney W. Grimes.Xr rlogind 2 ,
65afe61c15SRodney W. Grimesand become
66afe61c15SRodney W. Grimesan application's standard input, output, and error files.
67afe61c15SRodney W. Grimes.Ss Job Control in a Nutshell
68afe61c15SRodney W. GrimesEvery process is associated with a particular process group and session.
69afe61c15SRodney W. GrimesThe grouping is hierarchical: every member of a particular process group is a
70afe61c15SRodney W. Grimesmember of the same session.  This structuring is used in managing groups
71afe61c15SRodney W. Grimesof related processes for purposes of
72afe61c15SRodney W. Grimes.\" .Gw "job control" ;
73afe61c15SRodney W. Grimes.Em "job control" ;
74afe61c15SRodney W. Grimesthat is, the
75afe61c15SRodney W. Grimesability from the keyboard (or from program control) to simultaneously
76afe61c15SRodney W. Grimesstop or restart
77afe61c15SRodney W. Grimesa complex command (a command composed of one or more related
78afe61c15SRodney W. Grimesprocesses).  The grouping into process groups allows delivering
79afe61c15SRodney W. Grimesof signals that stop or start the group as a whole, along with
80afe61c15SRodney W. Grimesarbitrating which process group has access to the single controlling
81afe61c15SRodney W. Grimesterminal.  The grouping at a higher layer into sessions is to restrict
82afe61c15SRodney W. Grimesthe job control related signals and system calls to within processes
83afe61c15SRodney W. Grimesresulting from a particular instance of a "login".  Typically, a session
84afe61c15SRodney W. Grimesis created when a user logs in, and the login terminal is setup
85afe61c15SRodney W. Grimesto be the controlling terminal; all processes spawned from that
86afe61c15SRodney W. Grimeslogin shell are in the same session, and inherit the controlling
87afe61c15SRodney W. Grimesterminal.
88afe61c15SRodney W. GrimesA job control shell
89afe61c15SRodney W. Grimesoperating interactively (that is, reading commands from a terminal)
90afe61c15SRodney W. Grimesnormally groups related processes together by placing them into the
91afe61c15SRodney W. Grimessame process group.  A set of processes in the same process group
92afe61c15SRodney W. Grimesis collectively referred to as a "job". When the foreground process
93afe61c15SRodney W. Grimesgroup of the terminal is the same as the process group of a particular
94afe61c15SRodney W. Grimesjob, that job is said to be in the "foreground".  When the process
95afe61c15SRodney W. Grimesgroup of the terminal is different than the process group of
96afe61c15SRodney W. Grimesa job (but is still the controlling terminal), that job is said
97afe61c15SRodney W. Grimesto be in the "background".  Normally the
98afe61c15SRodney W. Grimesshell reads a command and starts the job that implements that
99afe61c15SRodney W. Grimescommand.  If the command is to be started in the foreground (typical), it
100afe61c15SRodney W. Grimessets the process group of the terminal to the process group
101afe61c15SRodney W. Grimesof the started job, waits for the job to complete, and then
102afe61c15SRodney W. Grimessets the process group of the terminal back to its own process
103afe61c15SRodney W. Grimesgroup (it puts itself into the foreground).  If the job is to
104afe61c15SRodney W. Grimesbe started in the background (as denoted by the shell operator "&"),
105afe61c15SRodney W. Grimesit never changes the process group of the terminal and doesn't
106afe61c15SRodney W. Grimeswait for the job to complete (that is, it immediately attempts to read the next
107afe61c15SRodney W. Grimescommand).  If the job is started in the foreground, the user may
108afe61c15SRodney W. Grimestype a key (usually
109afe61c15SRodney W. Grimes.Ql \&^Z )
110afe61c15SRodney W. Grimeswhich generates the terminal stop signal
111afe61c15SRodney W. Grimes.Pq Dv SIGTSTP
112afe61c15SRodney W. Grimesand has the affect of stopping the entire job.
113afe61c15SRodney W. GrimesThe shell will notice that the job stopped, and will resume running after
114afe61c15SRodney W. Grimesplacing itself in the foreground.
115afe61c15SRodney W. GrimesThe shell also has commands for placing stopped jobs in the background,
116afe61c15SRodney W. Grimesand for placing stopped or background jobs into the foreground.
117afe61c15SRodney W. Grimes.Ss Orphaned Process Groups
118afe61c15SRodney W. GrimesAn orphaned process group is a process group that has no process
119afe61c15SRodney W. Grimeswhose parent is in a different process group, yet is in the same
120afe61c15SRodney W. Grimessession.  Conceptually it means a process group that doesn't have
121afe61c15SRodney W. Grimesa parent that could do anything if it were to be stopped.  For example,
122afe61c15SRodney W. Grimesthe initial login shell is typically in an orphaned process group.
123afe61c15SRodney W. GrimesOrphaned process groups are immune to keyboard generated stop
124afe61c15SRodney W. Grimessignals and job control signals resulting from reads or writes to the
125afe61c15SRodney W. Grimescontrolling terminal.
126afe61c15SRodney W. Grimes.Ss The Controlling Terminal
127afe61c15SRodney W. GrimesA terminal may belong to a process as its controlling terminal.  Each
128afe61c15SRodney W. Grimesprocess of a session that has a controlling terminal has the same
129afe61c15SRodney W. Grimescontrolling terminal.  A terminal may be the controlling terminal for at
130afe61c15SRodney W. Grimesmost one session.  The controlling terminal for a session is allocated by
131afe61c15SRodney W. Grimesthe session leader by issuing the
132afe61c15SRodney W. Grimes.Dv TIOCSCTTY
133afe61c15SRodney W. Grimesioctl.  A controlling terminal
134afe61c15SRodney W. Grimesis never acquired by merely opening a terminal device file.
135afe61c15SRodney W. GrimesWhen a controlling terminal becomes
136afe61c15SRodney W. Grimesassociated with a session, its foreground process group is set to
137afe61c15SRodney W. Grimesthe process group of the session leader.
138afe61c15SRodney W. Grimes.Pp
139afe61c15SRodney W. GrimesThe controlling terminal is inherited by a child process during a
140afe61c15SRodney W. Grimes.Xr fork 2
141afe61c15SRodney W. Grimesfunction call.  A process relinquishes its controlling terminal when it
142afe61c15SRodney W. Grimescreates a new session with the
143afe61c15SRodney W. Grimes.Xd setsid 2
144afe61c15SRodney W. Grimesfunction; other processes
145afe61c15SRodney W. Grimesremaining in the old session that had this terminal as their controlling
146afe61c15SRodney W. Grimesterminal continue to have it.
147afe61c15SRodney W. GrimesA process does not relinquish its
148afe61c15SRodney W. Grimescontrolling terminal simply by closing all of its file descriptors
149afe61c15SRodney W. Grimesassociated with the controlling terminal if other processes continue to
150afe61c15SRodney W. Grimeshave it open.
151afe61c15SRodney W. Grimes.Pp
152afe61c15SRodney W. GrimesWhen a controlling process terminates, the controlling terminal is
153afe61c15SRodney W. Grimesdisassociated from the current session, allowing it to be acquired by a
154afe61c15SRodney W. Grimesnew session leader.  Subsequent access to the terminal by other processes
155afe61c15SRodney W. Grimesin the earlier session will be denied, with attempts to access the
156afe61c15SRodney W. Grimesterminal treated as if modem disconnect had been sensed.
157afe61c15SRodney W. Grimes.Ss Terminal Access Control
158afe61c15SRodney W. GrimesIf a process is in the foreground process group of its controlling
159afe61c15SRodney W. Grimesterminal, read operations are allowed.
160afe61c15SRodney W. GrimesAny attempts by a process
161afe61c15SRodney W. Grimesin a background process group to read from its controlling terminal
162afe61c15SRodney W. Grimescauses a
163afe61c15SRodney W. Grimes.Dv SIGTTIN
164afe61c15SRodney W. Grimessignal to be sent to
165afe61c15SRodney W. Grimesthe process's group
166afe61c15SRodney W. Grimesunless one of the
167afe61c15SRodney W. Grimesfollowing special cases apply:  If the reading process is ignoring or
168afe61c15SRodney W. Grimesblocking the
169afe61c15SRodney W. Grimes.Dv SIGTTIN signal, or if the process group of the reading
170afe61c15SRodney W. Grimesprocess is orphaned, the
171afe61c15SRodney W. Grimes.Xr read 2
172afe61c15SRodney W. Grimesreturns -1 with
173afe61c15SRodney W. Grimes.Va errno set to
174afe61c15SRodney W. Grimes.Er Dv EIO
175afe61c15SRodney W. Grimesand no
176afe61c15SRodney W. Grimessignal is sent.  The default action of the
177afe61c15SRodney W. Grimes.Dv SIGTTIN
178afe61c15SRodney W. Grimessignal is to stop the
179afe61c15SRodney W. Grimesprocess to which it is sent.
180afe61c15SRodney W. Grimes.Pp
181afe61c15SRodney W. GrimesIf a process is in the foreground process group of its controlling
182afe61c15SRodney W. Grimesterminal, write operations are allowed.
183afe61c15SRodney W. GrimesAttempts by a process in a background process group to write to its
184afe61c15SRodney W. Grimescontrolling terminal will cause the process group to be sent a
185afe61c15SRodney W. Grimes.Dv SIGTTOU
186afe61c15SRodney W. Grimessignal unless one of the following special cases apply:  If
187afe61c15SRodney W. Grimes.Dv TOSTOP
188afe61c15SRodney W. Grimesis not
189afe61c15SRodney W. Grimesset, or if
190afe61c15SRodney W. Grimes.Dv TOSTOP
191afe61c15SRodney W. Grimesis set and the process is ignoring or blocking the
192afe61c15SRodney W. Grimes.Dv SIGTTOU
193afe61c15SRodney W. Grimessignal, the process is allowed to write to the terminal and the
194afe61c15SRodney W. Grimes.Dv SIGTTOU
195afe61c15SRodney W. Grimessignal is not sent.  If
196afe61c15SRodney W. Grimes.Dv TOSTOP
197afe61c15SRodney W. Grimesis set, and the process group of
198afe61c15SRodney W. Grimesthe writing process is orphaned, and the writing process is not ignoring
199afe61c15SRodney W. Grimesor blocking
200afe61c15SRodney W. Grimes.Dv SIGTTOU ,
201afe61c15SRodney W. Grimesthe
202afe61c15SRodney W. Grimes.Xr write
203afe61c15SRodney W. Grimesreturns -1 with
204afe61c15SRodney W. Grimeserrno set to
205afe61c15SRodney W. Grimes.Er Dv EIO
206afe61c15SRodney W. Grimesand no signal is sent.
207afe61c15SRodney W. Grimes.Pp
208afe61c15SRodney W. GrimesCertain calls that set terminal parameters are treated in the same
209afe61c15SRodney W. Grimesfashion as write, except that
210afe61c15SRodney W. Grimes.Dv TOSTOP
211afe61c15SRodney W. Grimesis ignored; that is, the effect is
212afe61c15SRodney W. Grimesidentical to that of terminal writes when
213afe61c15SRodney W. Grimes.Dv TOSTOP
214afe61c15SRodney W. Grimesis set.
215afe61c15SRodney W. Grimes.Ss Input Processing and Reading Data
216afe61c15SRodney W. GrimesA terminal device associated with a terminal device file may operate in
217afe61c15SRodney W. Grimesfull-duplex mode, so that data may arrive even while output is occurring.
218afe61c15SRodney W. GrimesEach terminal device file has associated with it an input queue, into
219afe61c15SRodney W. Grimeswhich incoming data is stored by the system before being read by a
220afe61c15SRodney W. Grimesprocess.  The system imposes a limit,
221afe61c15SRodney W. Grimes.Pf \&{ Dv MAX_INPUT Ns \&} ,
222afe61c15SRodney W. Grimeson the number of
223afe61c15SRodney W. Grimesbytes that may be stored in the input queue.  The behavior of the system
224afe61c15SRodney W. Grimeswhen this limit is exceeded depends on the setting of the
225afe61c15SRodney W. Grimes.Dv IMAXBEL
226afe61c15SRodney W. Grimesflag in the termios
227afe61c15SRodney W. Grimes.Fa c_iflag .
228afe61c15SRodney W. GrimesIf this flag is set, the terminal
229afe61c15SRodney W. Grimesis sent an
230afe61c15SRodney W. Grimes.Tn ASCII
231afe61c15SRodney W. Grimes.Dv BEL
232afe61c15SRodney W. Grimescharacter each time a character is received
233afe61c15SRodney W. Grimeswhile the input queue is full.  Otherwise, the input queue is flushed
234afe61c15SRodney W. Grimesupon receiving the character.
235afe61c15SRodney W. Grimes.Pp
236afe61c15SRodney W. GrimesTwo general kinds of input processing are available, determined by
237afe61c15SRodney W. Grimeswhether the terminal device file is in canonical mode or noncanonical
238afe61c15SRodney W. Grimesmode. Additionally,
239afe61c15SRodney W. Grimesinput characters are processed according to the
240afe61c15SRodney W. Grimes.Fa c_iflag
241afe61c15SRodney W. Grimesand
242afe61c15SRodney W. Grimes.Fa c_lflag
243afe61c15SRodney W. Grimesfields.  Such processing can include echoing, which
244afe61c15SRodney W. Grimesin general means transmitting input characters immediately back to the
245afe61c15SRodney W. Grimesterminal when they are received from the terminal.  This is useful for
246afe61c15SRodney W. Grimesterminals that can operate in full-duplex mode.
247afe61c15SRodney W. Grimes.Pp
248afe61c15SRodney W. GrimesThe manner in which data is provided to a process reading from a terminal
249afe61c15SRodney W. Grimesdevice file is dependent on whether the terminal device file is in
250afe61c15SRodney W. Grimescanonical or noncanonical mode.
251afe61c15SRodney W. Grimes.Pp
252afe61c15SRodney W. GrimesAnother dependency is whether the
253afe61c15SRodney W. Grimes.Dv O_NONBLOCK
254afe61c15SRodney W. Grimesflag is set by
255afe61c15SRodney W. Grimes.Xr open()
256afe61c15SRodney W. Grimesor
257afe61c15SRodney W. Grimes.Xr fcntl() .
258afe61c15SRodney W. GrimesIf the
259afe61c15SRodney W. Grimes.Dv O_NONBLOCK
260afe61c15SRodney W. Grimesflag is clear, then the read request is
261afe61c15SRodney W. Grimesblocked until data is available or a signal has been received.  If the
262afe61c15SRodney W. Grimes.Dv O_NONBLOCK
263afe61c15SRodney W. Grimesflag is set, then the read request is completed, without
264afe61c15SRodney W. Grimesblocking, in one of three ways:
265afe61c15SRodney W. Grimes.Bl -enum -offset indent
266afe61c15SRodney W. Grimes.It
267afe61c15SRodney W. GrimesIf there is enough data available to satisfy the entire request,
268afe61c15SRodney W. Grimesand the read completes successfully the number of
269afe61c15SRodney W. Grimesbytes read is returned.
270afe61c15SRodney W. Grimes.It
271afe61c15SRodney W. GrimesIf there is not enough data available to satisfy the entire
272afe61c15SRodney W. Grimesrequest, and the read completes successfully, having read as
273afe61c15SRodney W. Grimesmuch data as possible, the number of bytes read is returned.
274afe61c15SRodney W. Grimes.It
275afe61c15SRodney W. GrimesIf there is no data available, the read returns -1, with
276afe61c15SRodney W. Grimeserrno set to
277afe61c15SRodney W. Grimes.Er EAGAIN .
278afe61c15SRodney W. Grimes.El
279afe61c15SRodney W. Grimes.Pp
280afe61c15SRodney W. GrimesWhen data is available depends on whether the input processing mode is
281afe61c15SRodney W. Grimescanonical or noncanonical.
282afe61c15SRodney W. Grimes.Ss Canonical Mode Input Processing
283afe61c15SRodney W. GrimesIn canonical mode input processing, terminal input is processed in units
284afe61c15SRodney W. Grimesof lines.  A line is delimited by a newline
285afe61c15SRodney W. Grimes.Ql \&\en
286afe61c15SRodney W. Grimescharacter, an end-of-file
287afe61c15SRodney W. Grimes.Pq Dv EOF
288afe61c15SRodney W. Grimescharacter, or an end-of-line
289afe61c15SRodney W. Grimes.Pq Dv EOL
290afe61c15SRodney W. Grimescharacter.  See the
291afe61c15SRodney W. Grimes.Sx "Special Characters"
292afe61c15SRodney W. Grimessection for
293afe61c15SRodney W. Grimesmore information on
294afe61c15SRodney W. Grimes.Dv EOF
295afe61c15SRodney W. Grimesand
296afe61c15SRodney W. Grimes.Dv EOL .
297afe61c15SRodney W. GrimesThis means that a read request will
298afe61c15SRodney W. Grimesnot return until an entire line has been typed, or a signal has been
299afe61c15SRodney W. Grimesreceived.  Also, no matter how many bytes are requested in the read call,
300afe61c15SRodney W. Grimesat most one line is returned.  It is not, however, necessary to
301afe61c15SRodney W. Grimesread a whole line at once; any number of bytes, even one, may be
302afe61c15SRodney W. Grimesrequested in a read without losing information.
303afe61c15SRodney W. Grimes.Pp
304afe61c15SRodney W. Grimes.Pf \&{ Dv MAX_CANON Ns \&}
305afe61c15SRodney W. Grimesis a limit on the
306afe61c15SRodney W. Grimesnumber of bytes in a line.
307afe61c15SRodney W. GrimesThe behavior of the system when this limit is
308afe61c15SRodney W. Grimesexceeded is the same as when the input queue limit
309afe61c15SRodney W. Grimes.Pf \&{ Dv MAX_INPUT Ns \&} ,
310afe61c15SRodney W. Grimesis exceeded.
311afe61c15SRodney W. Grimes.Pp
312afe61c15SRodney W. GrimesErase and kill processing occur when either of two special characters,
313afe61c15SRodney W. Grimesthe
314afe61c15SRodney W. Grimes.Dv ERASE
315afe61c15SRodney W. Grimesand
316afe61c15SRodney W. Grimes.Dv KILL
317afe61c15SRodney W. Grimescharacters (see the
318afe61c15SRodney W. Grimes.Sx "Special Characters section" ) ,
319afe61c15SRodney W. Grimesis received.
320afe61c15SRodney W. GrimesThis processing affects data in the input queue that has not yet been
321afe61c15SRodney W. Grimesdelimited by a newline
322afe61c15SRodney W. Grimes.Dv NL,
323afe61c15SRodney W. Grimes.Dv EOF ,
324afe61c15SRodney W. Grimesor
325afe61c15SRodney W. Grimes.Dv EOL
326afe61c15SRodney W. Grimescharacter.  This un-delimited
327afe61c15SRodney W. Grimesdata makes up the current line.  The
328afe61c15SRodney W. Grimes.Dv ERASE
329afe61c15SRodney W. Grimescharacter deletes the last
330afe61c15SRodney W. Grimescharacter in the current line, if there is any.  The
331afe61c15SRodney W. Grimes.Dv KILL
332afe61c15SRodney W. Grimescharacter
333afe61c15SRodney W. Grimesdeletes all data in the current line, if there is any.  The
334afe61c15SRodney W. Grimes.Dv ERASE
335afe61c15SRodney W. Grimesand
336afe61c15SRodney W. Grimes.Dv KILL
337afe61c15SRodney W. Grimescharacters have no effect if there is no data in the current line.
338afe61c15SRodney W. GrimesThe
339afe61c15SRodney W. Grimes.Dv ERASE
340afe61c15SRodney W. Grimesand
341afe61c15SRodney W. Grimes.Dv KILL
342afe61c15SRodney W. Grimescharacters themselves are not placed in the input
343afe61c15SRodney W. Grimesqueue.
344afe61c15SRodney W. Grimes.Ss Noncanonical Mode Input Processing
345afe61c15SRodney W. GrimesIn noncanonical mode input processing, input bytes are not assembled into
346afe61c15SRodney W. Grimeslines, and erase and kill processing does not occur.  The values of the
347afe61c15SRodney W. Grimes.Dv MIN
348afe61c15SRodney W. Grimesand
349afe61c15SRodney W. Grimes.Dv TIME
350afe61c15SRodney W. Grimesmembers of the
351afe61c15SRodney W. Grimes.Fa c_cc
352afe61c15SRodney W. Grimesarray are used to determine how to
353afe61c15SRodney W. Grimesprocess the bytes received.
354afe61c15SRodney W. Grimes.Pp
355afe61c15SRodney W. Grimes.Dv MIN
356afe61c15SRodney W. Grimesrepresents the minimum number of bytes that should be received when
357afe61c15SRodney W. Grimesthe
358afe61c15SRodney W. Grimes.Xr read
359afe61c15SRodney W. Grimesfunction successfully returns.
360afe61c15SRodney W. Grimes.Dv TIME
361afe61c15SRodney W. Grimesis a timer of 0.1 second
362afe61c15SRodney W. Grimesgranularity that is used to time out bursty and short term data
363afe61c15SRodney W. Grimestransmissions.  If
364afe61c15SRodney W. Grimes.Dv MIN
365afe61c15SRodney W. Grimesis greater than
366afe61c15SRodney W. Grimes.Dv \&{ Dv MAX_INPUT Ns \&} ,
367afe61c15SRodney W. Grimesthe response to the
368afe61c15SRodney W. Grimesrequest is undefined.  The four possible values for
369afe61c15SRodney W. Grimes.Dv MIN
370afe61c15SRodney W. Grimesand
371afe61c15SRodney W. Grimes.Dv TIME
372afe61c15SRodney W. Grimesand
373afe61c15SRodney W. Grimestheir interactions are described below.
374afe61c15SRodney W. Grimes.Ss "Case A: MIN > 0, TIME > 0"
375afe61c15SRodney W. GrimesIn this case
376afe61c15SRodney W. Grimes.Dv TIME
377afe61c15SRodney W. Grimesserves as an inter-byte timer and is activated after
378afe61c15SRodney W. Grimesthe first byte is received.  Since it is an inter-byte timer, it is reset
379afe61c15SRodney W. Grimesafter a byte is received.  The interaction between
380afe61c15SRodney W. Grimes.Dv MIN
381afe61c15SRodney W. Grimesand
382afe61c15SRodney W. Grimes.Dv TIME
383afe61c15SRodney W. Grimesis as
384afe61c15SRodney W. Grimesfollows:  as soon as one byte is received, the inter-byte timer is
385afe61c15SRodney W. Grimesstarted.  If
386afe61c15SRodney W. Grimes.Dv MIN
387afe61c15SRodney W. Grimesbytes are received before the inter-byte timer expires
388afe61c15SRodney W. Grimes(remember that the timer is reset upon receipt of each byte), the read is
389afe61c15SRodney W. Grimessatisfied.  If the timer expires before
390afe61c15SRodney W. Grimes.Dv MIN
391afe61c15SRodney W. Grimesbytes are received, the
392afe61c15SRodney W. Grimescharacters received to that point are returned to the user.  Note that if
393afe61c15SRodney W. Grimes.Dv TIME
394afe61c15SRodney W. Grimesexpires at least one byte is returned because the timer would
395afe61c15SRodney W. Grimesnot have been enabled unless a byte was received.  In this case
396afe61c15SRodney W. Grimes.Pf \&( Dv MIN
397afe61c15SRodney W. Grimes> 0,
398afe61c15SRodney W. Grimes.Dv TIME
399afe61c15SRodney W. Grimes> 0) the read blocks until the
400afe61c15SRodney W. Grimes.Dv MIN
401afe61c15SRodney W. Grimesand
402afe61c15SRodney W. Grimes.Dv TIME
403afe61c15SRodney W. Grimesmechanisms are
404afe61c15SRodney W. Grimesactivated by the receipt of the first byte, or a signal is received.  If
405afe61c15SRodney W. Grimesdata is in the buffer at the time of the read(), the result is as
406afe61c15SRodney W. Grimesif data had been received immediately after the read().
407afe61c15SRodney W. Grimes.Ss "Case B: MIN > 0, TIME = 0"
408afe61c15SRodney W. GrimesIn this case, since the value of
409afe61c15SRodney W. Grimes.Dv TIME
410afe61c15SRodney W. Grimesis zero, the timer plays no role
411afe61c15SRodney W. Grimesand only
412afe61c15SRodney W. Grimes.Dv MIN
413afe61c15SRodney W. Grimesis significant.  A pending read is not satisfied until
414afe61c15SRodney W. Grimes.Dv MIN
415afe61c15SRodney W. Grimesbytes are received (i.e., the pending read blocks until
416afe61c15SRodney W. Grimes.Dv MIN
417afe61c15SRodney W. Grimesbytes
418afe61c15SRodney W. Grimesare received), or a signal is received.  A program that uses this case to
419afe61c15SRodney W. Grimesread record-based terminal
420afe61c15SRodney W. Grimes.Dv I/O
421afe61c15SRodney W. Grimesmay block indefinitely in the read
422afe61c15SRodney W. Grimesoperation.
423afe61c15SRodney W. Grimes.Ss "Case C: MIN = 0, TIME > 0"
424afe61c15SRodney W. GrimesIn this case, since
425afe61c15SRodney W. Grimes.Dv MIN
426afe61c15SRodney W. Grimes= 0,
427afe61c15SRodney W. Grimes.Dv TIME
428afe61c15SRodney W. Grimesno longer represents an inter-byte
429afe61c15SRodney W. Grimestimer.  It now serves as a read timer that is activated as soon as the
430afe61c15SRodney W. Grimesread function is processed.  A read is satisfied as soon as a single
431afe61c15SRodney W. Grimesbyte is received or the read timer expires.  Note that in this case if
432afe61c15SRodney W. Grimesthe timer expires, no bytes are returned.  If the timer does not
433afe61c15SRodney W. Grimesexpire, the only way the read can be satisfied is if a byte is received.
434afe61c15SRodney W. GrimesIn this case the read will not block indefinitely waiting for a byte; if
435afe61c15SRodney W. Grimesno byte is received within
436afe61c15SRodney W. Grimes.Dv TIME Ns *0.1
437afe61c15SRodney W. Grimesseconds after the read is initiated,
438afe61c15SRodney W. Grimesthe read returns a value of zero, having read no data.  If data is
439afe61c15SRodney W. Grimesin the buffer at the time of the read, the timer is started as if
440afe61c15SRodney W. Grimesdata had been received immediately after the read.
441afe61c15SRodney W. Grimes.Ss Case D: MIN = 0, TIME = 0
442afe61c15SRodney W. GrimesThe minimum of either the number of bytes requested or the number of
443afe61c15SRodney W. Grimesbytes currently available is returned without waiting for more
444afe61c15SRodney W. Grimesbytes to be input.  If no characters are available, read returns a
445afe61c15SRodney W. Grimesvalue of zero, having read no data.
446afe61c15SRodney W. Grimes.Ss Writing Data and Output Processing
447afe61c15SRodney W. GrimesWhen a process writes one or more bytes to a terminal device file, they
448afe61c15SRodney W. Grimesare processed according to the
449afe61c15SRodney W. Grimes.Fa c_oflag
450afe61c15SRodney W. Grimesfield (see the
451afe61c15SRodney W. Grimes.Sx "Output Modes
452afe61c15SRodney W. Grimessection).  The
453afe61c15SRodney W. Grimesimplementation may provide a buffering mechanism; as such, when a call to
454afe61c15SRodney W. Grimeswrite() completes, all of the bytes written have been scheduled for
455afe61c15SRodney W. Grimestransmission to the device, but the transmission will not necessarily
456afe61c15SRodney W. Grimeshave been completed.
457afe61c15SRodney W. Grimes.\" See also .Sx "6.4.2" for the effects of
458afe61c15SRodney W. Grimes.\" .Dv O_NONBLOCK
459afe61c15SRodney W. Grimes.\" on write.
460afe61c15SRodney W. Grimes.Ss Special Characters
461afe61c15SRodney W. GrimesCertain characters have special functions on input or output or both.
462afe61c15SRodney W. GrimesThese functions are summarized as follows:
463afe61c15SRodney W. Grimes.Bl -tag -width indent
464afe61c15SRodney W. Grimes.It Dv INTR
465afe61c15SRodney W. GrimesSpecial character on input and is recognized if the
466afe61c15SRodney W. Grimes.Dv ISIG
467afe61c15SRodney W. Grimesflag (see the
468afe61c15SRodney W. Grimes.Sx "Local Modes"
469afe61c15SRodney W. Grimessection) is enabled.  Generates a
470afe61c15SRodney W. Grimes.Dv SIGINT
471afe61c15SRodney W. Grimessignal which is sent to all processes in the foreground
472afe61c15SRodney W. Grimesprocess group for which the terminal is the controlling
473afe61c15SRodney W. Grimesterminal.  If
474afe61c15SRodney W. Grimes.Dv ISIG
475afe61c15SRodney W. Grimesis set, the
476afe61c15SRodney W. Grimes.Dv INTR
477afe61c15SRodney W. Grimescharacter is
478afe61c15SRodney W. Grimesdiscarded when processed.
479afe61c15SRodney W. Grimes.It Dv QUIT
480afe61c15SRodney W. GrimesSpecial character on input and is recognized if the
481afe61c15SRodney W. Grimes.Dv ISIG
482afe61c15SRodney W. Grimesflag is enabled.  Generates a
483afe61c15SRodney W. Grimes.Dv SIGQUIT
484afe61c15SRodney W. Grimessignal which is
485afe61c15SRodney W. Grimessent to all processes in the foreground process group
486afe61c15SRodney W. Grimesfor which the terminal is the controlling terminal.  If
487afe61c15SRodney W. Grimes.Dv ISIG
488afe61c15SRodney W. Grimesis set, the
489afe61c15SRodney W. Grimes.Dv QUIT
490afe61c15SRodney W. Grimescharacter is discarded when
491afe61c15SRodney W. Grimesprocessed.
492afe61c15SRodney W. Grimes.It Dv ERASE
493afe61c15SRodney W. GrimesSpecial character on input and is recognized if the
494afe61c15SRodney W. Grimes.Dv ICANON
495afe61c15SRodney W. Grimesflag is set.  Erases the last character in the
496afe61c15SRodney W. Grimescurrent line; see
497afe61c15SRodney W. Grimes.Sx "Canonical Mode Input Processing" .
498afe61c15SRodney W. GrimesIt does not erase beyond
499afe61c15SRodney W. Grimesthe start of a line, as delimited by an
500afe61c15SRodney W. Grimes.Dv NL ,
501afe61c15SRodney W. Grimes.Dv EOF ,
502afe61c15SRodney W. Grimesor
503afe61c15SRodney W. Grimes.Dv EOL
504afe61c15SRodney W. Grimescharacter.  If
505afe61c15SRodney W. Grimes.Dv ICANON
506afe61c15SRodney W. Grimesis set, the
507afe61c15SRodney W. Grimes.Dv ERASE
508afe61c15SRodney W. Grimescharacter is
509afe61c15SRodney W. Grimesdiscarded when processed.
510afe61c15SRodney W. Grimes.It Dv KILL
511afe61c15SRodney W. GrimesSpecial character on input and is recognized if the
512afe61c15SRodney W. Grimes.Dv ICANON
513afe61c15SRodney W. Grimesflag is set.  Deletes the entire line, as
514afe61c15SRodney W. Grimesdelimited by a
515afe61c15SRodney W. Grimes.Dv NL ,
516afe61c15SRodney W. Grimes.Dv EOF ,
517afe61c15SRodney W. Grimesor
518afe61c15SRodney W. Grimes.Dv EOL
519afe61c15SRodney W. Grimescharacter.  If
520afe61c15SRodney W. Grimes.Dv ICANON
521afe61c15SRodney W. Grimesis set, the
522afe61c15SRodney W. Grimes.Dv KILL
523afe61c15SRodney W. Grimescharacter is discarded when processed.
524afe61c15SRodney W. Grimes.It Dv EOF
525afe61c15SRodney W. GrimesSpecial character on input and is recognized if the
526afe61c15SRodney W. Grimes.Dv ICANON
527afe61c15SRodney W. Grimesflag is set.  When received, all the bytes
528afe61c15SRodney W. Grimeswaiting to be read are immediately passed to the
529afe61c15SRodney W. Grimesprocess, without waiting for a newline, and the
530afe61c15SRodney W. Grimes.Dv EOF
531afe61c15SRodney W. Grimesis discarded.  Thus, if there are no bytes waiting (that
532afe61c15SRodney W. Grimesis, the
533afe61c15SRodney W. Grimes.Dv EOF
534afe61c15SRodney W. Grimesoccurred at the beginning of a line), a byte
535afe61c15SRodney W. Grimescount of zero is returned from the read(),
536afe61c15SRodney W. Grimesrepresenting an end-of-file indication.  If
537afe61c15SRodney W. Grimes.Dv ICANON
538afe61c15SRodney W. Grimesis
539afe61c15SRodney W. Grimesset, the
540afe61c15SRodney W. Grimes.Dv EOF
541afe61c15SRodney W. Grimescharacter is discarded when processed.
542afe61c15SRodney W. Grimes.Dv NL
543afe61c15SRodney W. GrimesSpecial character on input and is recognized if the
544afe61c15SRodney W. Grimes.Dv ICANON
545afe61c15SRodney W. Grimesflag is set.  It is the line delimiter
546afe61c15SRodney W. Grimes.Ql \&\en .
547afe61c15SRodney W. Grimes.It Dv EOL
548afe61c15SRodney W. GrimesSpecial character on input and is recognized if the
549afe61c15SRodney W. Grimes.Dv ICANON
550afe61c15SRodney W. Grimesflag is set.  Is an additional line delimiter,
551afe61c15SRodney W. Grimeslike
552afe61c15SRodney W. Grimes.Dv NL .
553afe61c15SRodney W. Grimes.It Dv SUSP
554afe61c15SRodney W. GrimesIf the
555afe61c15SRodney W. Grimes.Dv ISIG
556afe61c15SRodney W. Grimesflag is enabled, receipt of the
557afe61c15SRodney W. Grimes.Dv SUSP
558afe61c15SRodney W. Grimescharacter causes a
559afe61c15SRodney W. Grimes.Dv SIGTSTP
560afe61c15SRodney W. Grimessignal to be sent to all processes in the
561afe61c15SRodney W. Grimesforeground process group for which the terminal is the
562afe61c15SRodney W. Grimescontrolling terminal, and the
563afe61c15SRodney W. Grimes.Dv SUSP
564afe61c15SRodney W. Grimescharacter is
565afe61c15SRodney W. Grimesdiscarded when processed.
566afe61c15SRodney W. Grimes.It Dv STOP
567afe61c15SRodney W. GrimesSpecial character on both input and output and is
568afe61c15SRodney W. Grimesrecognized if the
569afe61c15SRodney W. Grimes.Dv IXON
570afe61c15SRodney W. Grimes(output control) or
571afe61c15SRodney W. Grimes.Dv IXOFF
572afe61c15SRodney W. Grimes(input
573afe61c15SRodney W. Grimescontrol) flag is set.  Can be used to temporarily
574afe61c15SRodney W. Grimessuspend output.  It is useful with fast terminals to
575afe61c15SRodney W. Grimesprevent output from disappearing before it can be read.
576afe61c15SRodney W. GrimesIf
577afe61c15SRodney W. Grimes.Dv IXON
578afe61c15SRodney W. Grimesis set, the
579afe61c15SRodney W. Grimes.Dv STOP
580afe61c15SRodney W. Grimescharacter is discarded when
581afe61c15SRodney W. Grimesprocessed.
582afe61c15SRodney W. Grimes.It Dv START
583afe61c15SRodney W. GrimesSpecial character on both input and output and is
584afe61c15SRodney W. Grimesrecognized if the
585afe61c15SRodney W. Grimes.Dv IXON
586afe61c15SRodney W. Grimes(output control) or
587afe61c15SRodney W. Grimes.Dv IXOFF
588afe61c15SRodney W. Grimes(input
589afe61c15SRodney W. Grimescontrol) flag is set.  Can be used to resume output that
590afe61c15SRodney W. Grimeshas been suspended by a
591afe61c15SRodney W. Grimes.Dv STOP
592afe61c15SRodney W. Grimescharacter.  If
593afe61c15SRodney W. Grimes.Dv IXON
594afe61c15SRodney W. Grimesis set, the
595afe61c15SRodney W. Grimes.Dv START
596afe61c15SRodney W. Grimescharacter is discarded when processed.
597afe61c15SRodney W. Grimes.Dv CR
598afe61c15SRodney W. GrimesSpecial character on input and is recognized if the
599afe61c15SRodney W. Grimes.Dv ICANON
600afe61c15SRodney W. Grimesflag is set; it is the
601afe61c15SRodney W. Grimes.Ql \&\er ,
602afe61c15SRodney W. Grimesas denoted in the
603afe61c15SRodney W. Grimes.Tn \&C
604afe61c15SRodney W. GrimesStandard {2}.  When
605afe61c15SRodney W. Grimes.Dv ICANON
606afe61c15SRodney W. Grimesand
607afe61c15SRodney W. Grimes.Dv ICRNL
608afe61c15SRodney W. Grimesare set and
609afe61c15SRodney W. Grimes.Dv IGNCR
610afe61c15SRodney W. Grimesis not set, this character is translated into a
611afe61c15SRodney W. Grimes.Dv NL ,
612afe61c15SRodney W. Grimesand
613afe61c15SRodney W. Grimeshas the same effect as a
614afe61c15SRodney W. Grimes.Dv NL
615afe61c15SRodney W. Grimescharacter.
616afe61c15SRodney W. Grimes.El
617afe61c15SRodney W. Grimes.Pp
618afe61c15SRodney W. GrimesThe following special characters are extensions defined by this
619afe61c15SRodney W. Grimessystem and are not a part of 1003.1 termios.
620afe61c15SRodney W. Grimes.Bl -tag -width indent
621afe61c15SRodney W. Grimes.It Dv EOL2
622afe61c15SRodney W. GrimesSecondary
623afe61c15SRodney W. Grimes.Dv EOL
624afe61c15SRodney W. Grimescharacter.  Same function as
625afe61c15SRodney W. Grimes.Dv EOL.
626afe61c15SRodney W. Grimes.It Dv WERASE
627afe61c15SRodney W. GrimesSpecial character on input and is recognized if the
628afe61c15SRodney W. Grimes.Dv ICANON
629afe61c15SRodney W. Grimesflag is set.  Erases the last word in the current
630afe61c15SRodney W. Grimesline according to one of two algorithms.  If the
631afe61c15SRodney W. Grimes.Dv ALTWERASE
632afe61c15SRodney W. Grimesflag is not set, first any preceding whitespace is
633afe61c15SRodney W. Grimeserased, and then the maximal sequence of non-whitespace
634afe61c15SRodney W. Grimescharacters.  If
635afe61c15SRodney W. Grimes.Dv ALTWERASE
636afe61c15SRodney W. Grimesis set, first any preceding
637afe61c15SRodney W. Grimeswhitespace is erased, and then the maximal sequence
638afe61c15SRodney W. Grimesof alphabetic/underscores or non alphabetic/underscores.
639afe61c15SRodney W. GrimesAs a special case in this second algorithm, the first previous
640afe61c15SRodney W. Grimesnon-whitespace character is skipped in determining
641afe61c15SRodney W. Grimeswhether the preceding word is a sequence of
642afe61c15SRodney W. Grimesalphabetic/undercores.  This sounds confusing but turns
643afe61c15SRodney W. Grimesout to be quite practical.
644afe61c15SRodney W. Grimes.It Dv REPRINT
645afe61c15SRodney W. GrimesSpecial character on input and is recognized if the
646afe61c15SRodney W. Grimes.Dv ICANON
647afe61c15SRodney W. Grimesflag is set.  Causes the current input edit line
648afe61c15SRodney W. Grimesto be retyped.
649afe61c15SRodney W. Grimes.It Dv DSUSP
650afe61c15SRodney W. GrimesHas similar actions to the
651afe61c15SRodney W. Grimes.Dv SUSP
652afe61c15SRodney W. Grimescharacter, except that
653afe61c15SRodney W. Grimesthe
654afe61c15SRodney W. Grimes.Dv SIGTSTP
655afe61c15SRodney W. Grimessignal is delivered when one of the processes
656afe61c15SRodney W. Grimesin the foreground process group issues a read() to the
657afe61c15SRodney W. Grimescontrolling terminal.
658afe61c15SRodney W. Grimes.It Dv LNEXT
659afe61c15SRodney W. GrimesSpecial character on input and is recognized if the
660afe61c15SRodney W. Grimes.Dv IEXTEN
661afe61c15SRodney W. Grimesflag is set.  Receipt of this character causes the next
662afe61c15SRodney W. Grimescharacter to be taken literally.
663afe61c15SRodney W. Grimes.It Dv DISCARD
664afe61c15SRodney W. GrimesSpecial character on input and is recognized if the
665afe61c15SRodney W. Grimes.Dv IEXTEN
666afe61c15SRodney W. Grimesflag is set.  Receipt of this character toggles the flushing
667afe61c15SRodney W. Grimesof terminal output.
668afe61c15SRodney W. Grimes.It Dv STATUS
669afe61c15SRodney W. GrimesSpecial character on input and is recognized if the
670afe61c15SRodney W. Grimes.Dv ICANON
671afe61c15SRodney W. Grimesflag is set.  Receipt of this character causes a
672afe61c15SRodney W. Grimes.Dv SIGINFO
673afe61c15SRodney W. Grimessignal to be sent to the foreground process group of the
674afe61c15SRodney W. Grimesterminal.  Also, if the
675afe61c15SRodney W. Grimes.Dv NOKERNINFO
676afe61c15SRodney W. Grimesflag is not set, it
677afe61c15SRodney W. Grimescauses the kernel to write a status message to the terminal
678afe61c15SRodney W. Grimesthat displays the current load average, the name of the
679afe61c15SRodney W. Grimescommand in the foreground, its process ID, the symbolic
680afe61c15SRodney W. Grimeswait channel, the number of user and system seconds used,
681afe61c15SRodney W. Grimesthe percentage of cpu the process is getting, and the resident
682afe61c15SRodney W. Grimesset size of the process.
683afe61c15SRodney W. Grimes.El
684afe61c15SRodney W. Grimes.Pp
685afe61c15SRodney W. GrimesThe
686afe61c15SRodney W. Grimes.Dv NL
687afe61c15SRodney W. Grimesand
688afe61c15SRodney W. Grimes.Dv CR
689afe61c15SRodney W. Grimescharacters cannot be changed.
690afe61c15SRodney W. GrimesThe values for all the remaining characters can be set and are
691afe61c15SRodney W. Grimesdescribed later in the document under
692afe61c15SRodney W. GrimesSpecial Control Characters.
693afe61c15SRodney W. Grimes.Pp
694afe61c15SRodney W. GrimesSpecial
695afe61c15SRodney W. Grimescharacter functions associated with changeable special control characters
696afe61c15SRodney W. Grimescan be disabled individually by setting their value to
697afe61c15SRodney W. Grimes.Dv {_POSIX_VDISABLE};
698afe61c15SRodney W. Grimessee
699afe61c15SRodney W. Grimes.Sx "Special Control Characters" .
700afe61c15SRodney W. Grimes.Pp
701afe61c15SRodney W. GrimesIf two or more special characters have the same value, the function
702afe61c15SRodney W. Grimesperformed when that character is received is undefined.
703afe61c15SRodney W. Grimes.Ss Modem Disconnect
704afe61c15SRodney W. GrimesIf a modem disconnect is detected by the terminal interface for a
705afe61c15SRodney W. Grimescontrolling terminal, and if
706afe61c15SRodney W. Grimes.Dv CLOCAL
707afe61c15SRodney W. Grimesis not set in the
708afe61c15SRodney W. Grimes.Fa c_cflag
709afe61c15SRodney W. Grimesfield for
710afe61c15SRodney W. Grimesthe terminal, the
711afe61c15SRodney W. Grimes.Dv SIGHUP
712afe61c15SRodney W. Grimessignal is sent to the controlling
713afe61c15SRodney W. Grimesprocess associated with the terminal.  Unless other arrangements have
714afe61c15SRodney W. Grimesbeen made, this causes the controlling process to terminate.
715afe61c15SRodney W. GrimesAny subsequent call to the read() function returns the value zero,
716afe61c15SRodney W. Grimesindicating end of file.  Thus, processes that read a terminal
717afe61c15SRodney W. Grimesfile and test for end-of-file can terminate appropriately after a
718afe61c15SRodney W. Grimesdisconnect.
719afe61c15SRodney W. Grimes.\" If the
720afe61c15SRodney W. Grimes.\" .Er EIO
721afe61c15SRodney W. Grimes.\" condition specified in 6.1.1.4 that applies
722afe61c15SRodney W. Grimes.\" when the implementation supports job control also exists, it is
723afe61c15SRodney W. Grimes.\" unspecified whether the
724afe61c15SRodney W. Grimes.\" .Dv EOF
725afe61c15SRodney W. Grimes.\" condition or the
726afe61c15SRodney W. Grimes.\" .Pf [ Dv EIO
727afe61c15SRodney W. Grimes.\" ] is returned.
728afe61c15SRodney W. GrimesAny
729afe61c15SRodney W. Grimessubsequent write() to the terminal device returns -1, with
730afe61c15SRodney W. Grimes.Va errno
731afe61c15SRodney W. Grimesset to
732afe61c15SRodney W. Grimes.Er EIO ,
733afe61c15SRodney W. Grimesuntil the device is closed.
734afe61c15SRodney W. Grimes.Sh General Terminal Interface
735afe61c15SRodney W. Grimes.Pp
736afe61c15SRodney W. Grimes.Ss Closing a Terminal Device File
737afe61c15SRodney W. GrimesThe last process to close a terminal device file causes any output
738afe61c15SRodney W. Grimesto be sent to the device and any input to be discarded.  Then, if
739afe61c15SRodney W. Grimes.Dv HUPCL
740afe61c15SRodney W. Grimesis set in the control modes, and the communications port supports a
741afe61c15SRodney W. Grimesdisconnect function, the terminal device performs a disconnect.
742afe61c15SRodney W. Grimes.Ss Parameters That Can Be Set
743afe61c15SRodney W. GrimesRoutines that need to control certain terminal
744afe61c15SRodney W. Grimes.Tn I/O
745afe61c15SRodney W. Grimescharacteristics
746afe61c15SRodney W. Grimesdo so by using the termios structure as defined in the header
747afe61c15SRodney W. Grimes.Aq Pa termios.h .
748afe61c15SRodney W. GrimesThis structure contains minimally four scalar elements of bit flags
749afe61c15SRodney W. Grimesand one array of special characters.  The scalar flag elements are
750afe61c15SRodney W. Grimesnamed:
751afe61c15SRodney W. Grimes.Fa c_iflag ,
752afe61c15SRodney W. Grimes.Fa c_oflag ,
753afe61c15SRodney W. Grimes.Fa c_cflag ,
754afe61c15SRodney W. Grimesand
755afe61c15SRodney W. Grimes.Fa c_lflag .
756afe61c15SRodney W. GrimesThe character array is named
757afe61c15SRodney W. Grimes.Fa c_cc ,
758afe61c15SRodney W. Grimesand its maximum index is
759afe61c15SRodney W. Grimes.Dv NCCS .
760afe61c15SRodney W. Grimes.Ss Input Modes
761afe61c15SRodney W. GrimesValues of the
762afe61c15SRodney W. Grimes.Fa c_iflag
763afe61c15SRodney W. Grimesfield describe the basic
764afe61c15SRodney W. Grimesterminal input control, and are composed of
765afe61c15SRodney W. Grimesfollowing masks:
766afe61c15SRodney W. Grimes.Pp
767afe61c15SRodney W. Grimes.Bl -tag -width IMAXBEL -offset indent -compact
768afe61c15SRodney W. Grimes.It Dv IGNBRK
769afe61c15SRodney W. Grimes/* ignore BREAK condition */
770afe61c15SRodney W. Grimes.It Dv BRKINT
771afe61c15SRodney W. Grimes/* map BREAK to SIGINTR */
772afe61c15SRodney W. Grimes.It Dv IGNPAR
773afe61c15SRodney W. Grimes/* ignore (discard) parity errors */
774afe61c15SRodney W. Grimes.It Dv PARMRK
775afe61c15SRodney W. Grimes/* mark parity and framing errors */
776afe61c15SRodney W. Grimes.It Dv INPCK
777afe61c15SRodney W. Grimes/* enable checking of parity errors */
778afe61c15SRodney W. Grimes.It Dv ISTRIP
779afe61c15SRodney W. Grimes/* strip 8th bit off chars */
780afe61c15SRodney W. Grimes.It Dv INLCR
781afe61c15SRodney W. Grimes/* map NL into CR */
782afe61c15SRodney W. Grimes.It Dv IGNCR
783afe61c15SRodney W. Grimes/* ignore CR */
784afe61c15SRodney W. Grimes.It Dv ICRNL
785afe61c15SRodney W. Grimes/* map CR to NL (ala CRMOD) */
786afe61c15SRodney W. Grimes.It Dv IXON
787afe61c15SRodney W. Grimes/* enable output flow control */
788afe61c15SRodney W. Grimes.It Dv IXOFF
789afe61c15SRodney W. Grimes/* enable input flow control */
790afe61c15SRodney W. Grimes.It Dv IXANY
791afe61c15SRodney W. Grimes/* any char will restart after stop */
792afe61c15SRodney W. Grimes.It Dv IMAXBEL
793afe61c15SRodney W. Grimes/* ring bell on input queue full */
794afe61c15SRodney W. Grimes.El
795afe61c15SRodney W. Grimes.Pp
796afe61c15SRodney W. GrimesIn the context of asynchronous serial data transmission, a break
797afe61c15SRodney W. Grimescondition is defined as a sequence of zero-valued bits that continues for
798afe61c15SRodney W. Grimesmore than the time to send one byte.  The entire sequence of zero-valued
799afe61c15SRodney W. Grimesbits is interpreted as a single break condition, even if it continues for
800afe61c15SRodney W. Grimesa time equivalent to more than one byte.  In contexts other than
801afe61c15SRodney W. Grimesasynchronous serial data transmission the definition of a break condition
802afe61c15SRodney W. Grimesis implementation defined.
803afe61c15SRodney W. Grimes.Pp
804afe61c15SRodney W. GrimesIf
805afe61c15SRodney W. Grimes.Dv IGNBRK
806afe61c15SRodney W. Grimesis set, a break condition detected on input is ignored, that
807afe61c15SRodney W. Grimesis, not put on the input queue and therefore not read by any process.  If
808afe61c15SRodney W. Grimes.Dv IGNBRK
809afe61c15SRodney W. Grimesis not set and
810afe61c15SRodney W. Grimes.Dv BRKINT
811afe61c15SRodney W. Grimesis set, the break condition flushes the
812afe61c15SRodney W. Grimesinput and output queues and if the terminal is the controlling terminal
813afe61c15SRodney W. Grimesof a foreground process group, the break condition generates a
814afe61c15SRodney W. Grimessingle
815afe61c15SRodney W. Grimes.Dv SIGINT
816afe61c15SRodney W. Grimessignal to that foreground process group.  If neither
817afe61c15SRodney W. Grimes.Dv IGNBRK
818afe61c15SRodney W. Grimesnor
819afe61c15SRodney W. Grimes.Dv BRKINT
820afe61c15SRodney W. Grimesis set, a break condition is read as a single
821afe61c15SRodney W. Grimes.Ql \&\e0 ,
822afe61c15SRodney W. Grimesor if
823afe61c15SRodney W. Grimes.Dv PARMRK
824afe61c15SRodney W. Grimesis set, as
825afe61c15SRodney W. Grimes.Ql \&\e377 ,
826afe61c15SRodney W. Grimes.Ql \&\e0 ,
827afe61c15SRodney W. Grimes.Ql \&\e0 .
828afe61c15SRodney W. Grimes.Pp
829afe61c15SRodney W. GrimesIf
830afe61c15SRodney W. Grimes.Dv IGNPAR
831afe61c15SRodney W. Grimesis set, a byte with a framing or parity error (other than
832afe61c15SRodney W. Grimesbreak) is ignored.
833afe61c15SRodney W. Grimes.Pp
834afe61c15SRodney W. GrimesIf
835afe61c15SRodney W. Grimes.Dv PARMRK
836afe61c15SRodney W. Grimesis set, and
837afe61c15SRodney W. Grimes.Dv IGNPAR
838afe61c15SRodney W. Grimesis not set, a byte with a framing or parity
839afe61c15SRodney W. Grimeserror (other than break) is given to the application as the
840afe61c15SRodney W. Grimesthree-character sequence
841afe61c15SRodney W. Grimes.Ql \&\e377 ,
842afe61c15SRodney W. Grimes.Ql \&\e0 ,
843afe61c15SRodney W. GrimesX, where
844afe61c15SRodney W. Grimes.Ql \&\e377 ,
845afe61c15SRodney W. Grimes.Ql \&\e0
846afe61c15SRodney W. Grimesis a two-character
847afe61c15SRodney W. Grimesflag preceding each sequence and X is the data of the character received
848afe61c15SRodney W. Grimesin error.  To avoid ambiguity in this case, if
849afe61c15SRodney W. Grimes.Dv ISTRIP
850afe61c15SRodney W. Grimesis not set, a valid
851afe61c15SRodney W. Grimescharacter of
852afe61c15SRodney W. Grimes.Ql \&\e377
853afe61c15SRodney W. Grimesis given to the application as
854afe61c15SRodney W. Grimes.Ql \&\e377 ,
855afe61c15SRodney W. Grimes.Ql \&\e377 .
856afe61c15SRodney W. GrimesIf
857afe61c15SRodney W. Grimesneither
858afe61c15SRodney W. Grimes.Dv PARMRK
859afe61c15SRodney W. Grimesnor
860afe61c15SRodney W. Grimes.Dv IGNPAR
861afe61c15SRodney W. Grimesis set, a framing or parity error (other than
862afe61c15SRodney W. Grimesbreak) is given to the application as a single character
863afe61c15SRodney W. Grimes.Ql \&\e0 .
864afe61c15SRodney W. Grimes.Pp
865afe61c15SRodney W. GrimesIf
866afe61c15SRodney W. Grimes.Dv INPCK
867afe61c15SRodney W. Grimesis set, input parity checking is enabled.  If
868afe61c15SRodney W. Grimes.Dv INPCK
869afe61c15SRodney W. Grimesis not set,
870afe61c15SRodney W. Grimesinput parity checking is disabled, allowing output parity generation
871afe61c15SRodney W. Grimeswithout input parity errors.  Note that whether input parity checking is
872afe61c15SRodney W. Grimesenabled or disabled is independent of whether parity detection is enabled
873afe61c15SRodney W. Grimesor disabled (see
874afe61c15SRodney W. Grimes.Sx "Control Modes" ) .
875afe61c15SRodney W. GrimesIf parity detection is enabled but input
876afe61c15SRodney W. Grimesparity checking is disabled, the hardware to which the terminal is
877afe61c15SRodney W. Grimesconnected recognizes the parity bit, but the terminal special file
878afe61c15SRodney W. Grimesdoes not check whether this bit is set correctly or not.
879afe61c15SRodney W. Grimes.Pp
880afe61c15SRodney W. GrimesIf
881afe61c15SRodney W. Grimes.Dv ISTRIP
882afe61c15SRodney W. Grimesis set, valid input bytes are first stripped to seven bits,
883afe61c15SRodney W. Grimesotherwise all eight bits are processed.
884afe61c15SRodney W. Grimes.Pp
885afe61c15SRodney W. GrimesIf
886afe61c15SRodney W. Grimes.Dv INLCR
887afe61c15SRodney W. Grimesis set, a received
888afe61c15SRodney W. Grimes.Dv NL
889afe61c15SRodney W. Grimescharacter is translated into a
890afe61c15SRodney W. Grimes.Dv CR
891afe61c15SRodney W. Grimescharacter.  If
892afe61c15SRodney W. Grimes.Dv IGNCR
893afe61c15SRodney W. Grimesis set, a received
894afe61c15SRodney W. Grimes.Dv CR
895afe61c15SRodney W. Grimescharacter is ignored (not
896afe61c15SRodney W. Grimesread).  If
897afe61c15SRodney W. Grimes.Dv IGNCR
898afe61c15SRodney W. Grimesis not set and
899afe61c15SRodney W. Grimes.Dv ICRNL
900afe61c15SRodney W. Grimesis set, a received
901afe61c15SRodney W. Grimes.Dv CR
902afe61c15SRodney W. Grimescharacter is
903afe61c15SRodney W. Grimestranslated into a
904afe61c15SRodney W. Grimes.Dv NL
905afe61c15SRodney W. Grimescharacter.
906afe61c15SRodney W. Grimes.Pp
907afe61c15SRodney W. GrimesIf
908afe61c15SRodney W. Grimes.Dv IXON
909afe61c15SRodney W. Grimesis set, start/stop output control is enabled.  A received
910afe61c15SRodney W. Grimes.Dv STOP
911afe61c15SRodney W. Grimescharacter suspends output and a received
912afe61c15SRodney W. Grimes.Dv START
913afe61c15SRodney W. Grimescharacter
914afe61c15SRodney W. Grimesrestarts output. If
915afe61c15SRodney W. Grimes.Dv IXANY
916afe61c15SRodney W. Grimesis also set, then any character may
917afe61c15SRodney W. Grimesrestart output. When
918afe61c15SRodney W. Grimes.Dv IXON
919afe61c15SRodney W. Grimesis set,
920afe61c15SRodney W. Grimes.Dv START
921afe61c15SRodney W. Grimesand
922afe61c15SRodney W. Grimes.Dv STOP
923afe61c15SRodney W. Grimescharacters are not
924afe61c15SRodney W. Grimesread, but merely perform flow control functions.  When
925afe61c15SRodney W. Grimes.Dv IXON
926afe61c15SRodney W. Grimesis not set,
927afe61c15SRodney W. Grimesthe
928afe61c15SRodney W. Grimes.Dv START
929afe61c15SRodney W. Grimesand
930afe61c15SRodney W. Grimes.Dv STOP
931afe61c15SRodney W. Grimescharacters are read.
932afe61c15SRodney W. Grimes.Pp
933afe61c15SRodney W. GrimesIf
934afe61c15SRodney W. Grimes.Dv IXOFF
935afe61c15SRodney W. Grimesis set, start/stop input control is enabled.  The system shall
936afe61c15SRodney W. Grimestransmit one or more
937afe61c15SRodney W. Grimes.Dv STOP
938afe61c15SRodney W. Grimescharacters, which are intended to cause the
939afe61c15SRodney W. Grimesterminal device to stop transmitting data, as needed to prevent the input
940afe61c15SRodney W. Grimesqueue from overflowing and causing the undefined behavior described in
941afe61c15SRodney W. Grimes.Sx "Input Processing and Reading Data" ,
942afe61c15SRodney W. Grimesand shall transmit one or more
943afe61c15SRodney W. Grimes.Dv START
944afe61c15SRodney W. Grimescharacters, which are
945afe61c15SRodney W. Grimesintended to cause the terminal device to resume transmitting data, as
946afe61c15SRodney W. Grimessoon as the device can continue transmitting data without risk of
947afe61c15SRodney W. Grimesoverflowing the input queue.  The precise conditions under which
948afe61c15SRodney W. Grimes.Dv STOP
949afe61c15SRodney W. Grimesand
950afe61c15SRodney W. GrimesSTART
951afe61c15SRodney W. Grimescharacters are transmitted are implementation defined.
952afe61c15SRodney W. Grimes.Pp
953afe61c15SRodney W. GrimesIf
954afe61c15SRodney W. Grimes.Dv IMAXBEL
955afe61c15SRodney W. Grimesis set and the input queue is full, subsequent input shall cause an
956afe61c15SRodney W. Grimes.Tn ASCII
957afe61c15SRodney W. Grimes.Dv BEL
958afe61c15SRodney W. Grimescharacter to be transmitted to the
959afe61c15SRodney W. Grimesthe output queue.
960afe61c15SRodney W. Grimes.Pp
961afe61c15SRodney W. GrimesThe initial input control value after open() is implementation defined.
962afe61c15SRodney W. Grimes.Ss Output Modes
963afe61c15SRodney W. GrimesValues of the
964afe61c15SRodney W. Grimes.Fa c_oflag
965afe61c15SRodney W. Grimesfield describe the basic terminal output control,
966afe61c15SRodney W. Grimesand are composed of the following masks:
967afe61c15SRodney W. Grimes.Pp
968afe61c15SRodney W. Grimes.Bl -tag -width OXTABS -offset indent -compact
969afe61c15SRodney W. Grimes.It Dv OPOST
970afe61c15SRodney W. Grimes/* enable following output processing */
971afe61c15SRodney W. Grimes.It Dv ONLCR
972afe61c15SRodney W. Grimes/* map NL to CR-NL (ala
973afe61c15SRodney W. Grimes.Dv CRMOD)
974afe61c15SRodney W. Grimes*/
975afe61c15SRodney W. Grimes.It Dv OXTABS
976afe61c15SRodney W. Grimes/* expand tabs to spaces */
977afe61c15SRodney W. Grimes.It Dv ONOEOT
978afe61c15SRodney W. Grimes/* discard
979afe61c15SRodney W. Grimes.Dv EOT Ns 's
980afe61c15SRodney W. Grimes.Ql \&^D
981afe61c15SRodney W. Grimeson output) */
982afe61c15SRodney W. Grimes.El
983afe61c15SRodney W. Grimes.Pp
984afe61c15SRodney W. GrimesIf
985afe61c15SRodney W. Grimes.Dv OPOST
986afe61c15SRodney W. Grimesis set, the remaining flag masks are interpreted as follows;
987afe61c15SRodney W. Grimesotherwise characters are transmitted without change.
988afe61c15SRodney W. Grimes.Pp
989afe61c15SRodney W. GrimesIf
990afe61c15SRodney W. Grimes.Dv ONLCR
991afe61c15SRodney W. Grimesis set, newlines are translated to carriage return, linefeeds.
992afe61c15SRodney W. Grimes.Pp
993afe61c15SRodney W. GrimesIf
994afe61c15SRodney W. Grimes.Dv OXTABS
995afe61c15SRodney W. Grimesis set, tabs are expanded to the appropriate number of
996afe61c15SRodney W. Grimesspaces (assuming 8 column tab stops).
997afe61c15SRodney W. Grimes.Pp
998afe61c15SRodney W. GrimesIf
999afe61c15SRodney W. Grimes.Dv ONOEOT
1000afe61c15SRodney W. Grimesis set,
1001afe61c15SRodney W. Grimes.Tn ASCII
1002afe61c15SRodney W. Grimes.Dv EOT NS 's
1003afe61c15SRodney W. Grimesare discarded on output.
1004afe61c15SRodney W. Grimes.Ss Control Modes
1005afe61c15SRodney W. GrimesValues of the
1006afe61c15SRodney W. Grimes.Fa c_cflag
1007afe61c15SRodney W. Grimesfield describe the basic
1008afe61c15SRodney W. Grimesterminal hardware control, and are composed of the
1009afe61c15SRodney W. Grimesfollowing masks.
1010afe61c15SRodney W. GrimesNot all values
1011afe61c15SRodney W. Grimesspecified are supported by all hardware.
1012afe61c15SRodney W. Grimes.Pp
1013afe61c15SRodney W. Grimes.Bl -tag -width CRTSXIFLOW -offset indent -compact
1014afe61c15SRodney W. Grimes.It Dv CSIZE
1015afe61c15SRodney W. Grimes/* character size mask */
1016afe61c15SRodney W. Grimes.It Dv CS5
1017afe61c15SRodney W. Grimes/* 5 bits (pseudo) */
1018afe61c15SRodney W. Grimes.It Dv CS6
1019afe61c15SRodney W. Grimes/* 6 bits */
1020afe61c15SRodney W. Grimes.It Dv CS7
1021afe61c15SRodney W. Grimes/* 7 bits */
1022afe61c15SRodney W. Grimes.It Dv CS8
1023afe61c15SRodney W. Grimes/* 8 bits */
1024afe61c15SRodney W. Grimes.It Dv CSTOPB
1025afe61c15SRodney W. Grimes/* send 2 stop bits */
1026afe61c15SRodney W. Grimes.It Dv CREAD
1027afe61c15SRodney W. Grimes/* enable receiver */
1028afe61c15SRodney W. Grimes.It Dv PARENB
1029afe61c15SRodney W. Grimes/* parity enable */
1030afe61c15SRodney W. Grimes.It Dv PARODD
1031afe61c15SRodney W. Grimes/* odd parity, else even */
1032afe61c15SRodney W. Grimes.It Dv HUPCL
1033afe61c15SRodney W. Grimes/* hang up on last close */
1034afe61c15SRodney W. Grimes.It Dv CLOCAL
1035afe61c15SRodney W. Grimes/* ignore modem status lines */
1036afe61c15SRodney W. Grimes.It Dv CCTS_OFLOW
1037afe61c15SRodney W. Grimes/*
1038afe61c15SRodney W. Grimes.Dv CTS
1039afe61c15SRodney W. Grimesflow control of output */
1040afe61c15SRodney W. Grimes.It Dv CRTSCTS
1041afe61c15SRodney W. Grimes/* same as
1042afe61c15SRodney W. Grimes.Dv CCTS_OFLOW
1043afe61c15SRodney W. Grimes*/
1044afe61c15SRodney W. Grimes.It Dv CRTS_IFLOW
1045afe61c15SRodney W. Grimes/* RTS flow control of input */
1046afe61c15SRodney W. Grimes.It Dv MDMBUF
1047afe61c15SRodney W. Grimes/* flow control output via Carrier */
1048afe61c15SRodney W. Grimes.El
1049afe61c15SRodney W. Grimes.Pp
1050afe61c15SRodney W. GrimesThe
1051afe61c15SRodney W. Grimes.Dv CSIZE
1052afe61c15SRodney W. Grimesbits specify the byte size in bits for both transmission and
1053afe61c15SRodney W. Grimesreception.  The
1054afe61c15SRodney W. Grimes.Fa c_cflag
1055afe61c15SRodney W. Grimesis masked with
1056afe61c15SRodney W. Grimes.Dv CSIZE
1057afe61c15SRodney W. Grimesand compared with the
1058afe61c15SRodney W. Grimesvalues
1059afe61c15SRodney W. Grimes.Dv CS5 ,
1060afe61c15SRodney W. Grimes.Dv CS6 ,
1061afe61c15SRodney W. Grimes.Dv CS7 ,
1062afe61c15SRodney W. Grimesor
1063afe61c15SRodney W. Grimes.Dv CS8 .
1064afe61c15SRodney W. GrimesThis size does not include the parity bit, if any.  If
1065afe61c15SRodney W. Grimes.Dv CSTOPB
1066afe61c15SRodney W. Grimesis set, two stop bits are used, otherwise one stop bit.  For example, at
1067afe61c15SRodney W. Grimes110 baud, two stop bits are normally used.
1068afe61c15SRodney W. Grimes.Pp
1069afe61c15SRodney W. GrimesIf
1070afe61c15SRodney W. Grimes.Dv CREAD
1071afe61c15SRodney W. Grimesis set, the receiver is enabled.  Otherwise, no character is
1072afe61c15SRodney W. Grimesreceived.
1073afe61c15SRodney W. GrimesNot all hardware supports this bit.  In fact, this flag
1074afe61c15SRodney W. Grimesis pretty silly and if it were not part of the
1075afe61c15SRodney W. Grimes.Nm termios
1076afe61c15SRodney W. Grimesspecification
1077afe61c15SRodney W. Grimesit would be omitted.
1078afe61c15SRodney W. Grimes.Pp
1079afe61c15SRodney W. GrimesIf
1080afe61c15SRodney W. Grimes.Dv PARENB
1081afe61c15SRodney W. Grimesis set, parity generation and detection are enabled and a parity
1082afe61c15SRodney W. Grimesbit is added to each character.  If parity is enabled,
1083afe61c15SRodney W. Grimes.Dv PARODD
1084afe61c15SRodney W. Grimesspecifies
1085afe61c15SRodney W. Grimesodd parity if set, otherwise even parity is used.
1086afe61c15SRodney W. Grimes.Pp
1087afe61c15SRodney W. GrimesIf
1088afe61c15SRodney W. Grimes.Dv HUPCL
1089afe61c15SRodney W. Grimesis set, the modem control lines for the port are lowered
1090afe61c15SRodney W. Grimeswhen the last process with the port open closes the port or the process
1091afe61c15SRodney W. Grimesterminates.  The modem connection is broken.
1092afe61c15SRodney W. Grimes.Pp
1093afe61c15SRodney W. GrimesIf
1094afe61c15SRodney W. Grimes.Dv CLOCAL
1095afe61c15SRodney W. Grimesis set, a connection does not depend on the state of the modem
1096afe61c15SRodney W. Grimesstatus lines.  If
1097afe61c15SRodney W. Grimes.Dv CLOCAL
1098afe61c15SRodney W. Grimesis clear, the modem status lines are
1099afe61c15SRodney W. Grimesmonitored.
1100afe61c15SRodney W. Grimes.Pp
1101afe61c15SRodney W. GrimesUnder normal circumstances, a call to the open() function waits for
1102afe61c15SRodney W. Grimesthe modem connection to complete.  However, if the
1103afe61c15SRodney W. Grimes.Dv O_NONBLOCK
1104afe61c15SRodney W. Grimesflag is set
1105afe61c15SRodney W. Grimesor if
1106afe61c15SRodney W. Grimes.Dv CLOCAL
1107afe61c15SRodney W. Grimeshas been set, the open() function returns
1108afe61c15SRodney W. Grimesimmediately without waiting for the connection.
1109afe61c15SRodney W. Grimes.Pp
1110afe61c15SRodney W. GrimesThe
1111afe61c15SRodney W. Grimes.Dv CCTS_OFLOW
1112afe61c15SRodney W. Grimes.Pf ( Dv CRTSCTS )
1113afe61c15SRodney W. Grimesflag is currently unused.
1114afe61c15SRodney W. Grimes.Pp
1115afe61c15SRodney W. GrimesIf
1116afe61c15SRodney W. Grimes.Dv MDMBUF
1117afe61c15SRodney W. Grimesis set then output flow control is controlled by the state
1118afe61c15SRodney W. Grimesof Carrier Detect.
1119afe61c15SRodney W. Grimes.Pp
1120afe61c15SRodney W. GrimesIf the object for which the control modes are set is not an asynchronous
1121afe61c15SRodney W. Grimesserial connection, some of the modes may be ignored; for example, if an
1122afe61c15SRodney W. Grimesattempt is made to set the baud rate on a network connection to a
1123afe61c15SRodney W. Grimesterminal on another host, the baud rate may or may not be set on the
1124afe61c15SRodney W. Grimesconnection between that terminal and the machine it is directly connected
1125afe61c15SRodney W. Grimesto.
1126afe61c15SRodney W. Grimes.Ss Local Modes
1127afe61c15SRodney W. GrimesValues of the
1128afe61c15SRodney W. Grimes.Fa c_lflag
1129afe61c15SRodney W. Grimesfield describe the control of
1130afe61c15SRodney W. Grimesvarious functions, and are composed of the following
1131afe61c15SRodney W. Grimesmasks.
1132afe61c15SRodney W. Grimes.Pp
1133afe61c15SRodney W. Grimes.Bl -tag -width NOKERNINFO -offset indent -compact
1134afe61c15SRodney W. Grimes.It Dv ECHOKE
1135afe61c15SRodney W. Grimes/* visual erase for line kill */
1136afe61c15SRodney W. Grimes.It Dv ECHOE
1137afe61c15SRodney W. Grimes/* visually erase chars */
1138afe61c15SRodney W. Grimes.It Dv ECHO
1139afe61c15SRodney W. Grimes/* enable echoing */
1140afe61c15SRodney W. Grimes.It Dv ECHONL
1141afe61c15SRodney W. Grimes/* echo
1142afe61c15SRodney W. Grimes.Dv NL
1143afe61c15SRodney W. Grimeseven if
1144afe61c15SRodney W. Grimes.Dv ECHO
1145afe61c15SRodney W. Grimesis off */
1146afe61c15SRodney W. Grimes.It Dv ECHOPRT
1147afe61c15SRodney W. Grimes/* visual erase mode for hardcopy */
1148afe61c15SRodney W. Grimes.It Dv ECHOCTL
1149afe61c15SRodney W. Grimes/* echo control chars as ^(Char) */
1150afe61c15SRodney W. Grimes.It Dv ISIG
1151afe61c15SRodney W. Grimes/* enable signals
1152afe61c15SRodney W. Grimes.Dv INTR ,
1153afe61c15SRodney W. Grimes.Dv QUIT ,
1154afe61c15SRodney W. Grimes.Dv [D]SUSP
1155afe61c15SRodney W. Grimes*/
1156afe61c15SRodney W. Grimes.It Dv ICANON
1157afe61c15SRodney W. Grimes/* canonicalize input lines */
1158afe61c15SRodney W. Grimes.It Dv ALTWERASE
1159afe61c15SRodney W. Grimes/* use alternate
1160afe61c15SRodney W. Grimes.Dv WERASE
1161afe61c15SRodney W. Grimesalgorithm */
1162afe61c15SRodney W. Grimes.It Dv IEXTEN
1163afe61c15SRodney W. Grimes/* enable
1164afe61c15SRodney W. Grimes.Dv DISCARD
1165afe61c15SRodney W. Grimesand
1166afe61c15SRodney W. Grimes.Dv LNEXT
1167afe61c15SRodney W. Grimes*/
1168afe61c15SRodney W. Grimes.It Dv EXTPROC
1169afe61c15SRodney W. Grimes/* external processing */
1170afe61c15SRodney W. Grimes.It Dv TOSTOP
1171afe61c15SRodney W. Grimes/* stop background jobs from output */
1172afe61c15SRodney W. Grimes.It Dv FLUSHO
1173afe61c15SRodney W. Grimes/* output being flushed (state) */
1174afe61c15SRodney W. Grimes.It Dv NOKERNINFO
1175afe61c15SRodney W. Grimes/* no kernel output from
1176afe61c15SRodney W. Grimes.Dv VSTATUS
1177afe61c15SRodney W. Grimes*/
1178afe61c15SRodney W. Grimes.It Dv PENDIN
1179afe61c15SRodney W. Grimes/* XXX retype pending input (state) */
1180afe61c15SRodney W. Grimes.It Dv NOFLSH
1181afe61c15SRodney W. Grimes/* don't flush after interrupt */
1182afe61c15SRodney W. Grimes.El
1183afe61c15SRodney W. Grimes.Pp
1184afe61c15SRodney W. GrimesIf
1185afe61c15SRodney W. Grimes.Dv ECHO
1186afe61c15SRodney W. Grimesis set, input characters are echoed back to the terminal.  If
1187afe61c15SRodney W. Grimes.Dv ECHO
1188afe61c15SRodney W. Grimesis not set, input characters are not echoed.
1189afe61c15SRodney W. Grimes.Pp
1190afe61c15SRodney W. GrimesIf
1191afe61c15SRodney W. Grimes.Dv ECHOE
1192afe61c15SRodney W. Grimesand
1193afe61c15SRodney W. Grimes.Dv ICANON
1194afe61c15SRodney W. Grimesare set, the
1195afe61c15SRodney W. Grimes.Dv ERASE
1196afe61c15SRodney W. Grimescharacter causes the terminal
1197afe61c15SRodney W. Grimesto erase the last character in the current line from the display, if
1198afe61c15SRodney W. Grimespossible.  If there is no character to erase, an implementation may echo
1199afe61c15SRodney W. Grimesan indication that this was the case or do nothing.
1200afe61c15SRodney W. Grimes.Pp
1201afe61c15SRodney W. GrimesIf
1202afe61c15SRodney W. Grimes.Dv ECHOK
1203afe61c15SRodney W. Grimesand
1204afe61c15SRodney W. Grimes.Dv ICANON
1205afe61c15SRodney W. Grimesare set, the
1206afe61c15SRodney W. Grimes.Dv KILL
1207afe61c15SRodney W. Grimescharacter causes
1208afe61c15SRodney W. Grimesthe current line to be discarded and the system echoes the
1209afe61c15SRodney W. Grimes.Ql \&\en
1210afe61c15SRodney W. Grimescharacter after the
1211afe61c15SRodney W. Grimes.Dv KILL
1212afe61c15SRodney W. Grimescharacter.
1213afe61c15SRodney W. Grimes.Pp
1214afe61c15SRodney W. GrimesIf
1215afe61c15SRodney W. Grimes.Dv ECHOKE
1216afe61c15SRodney W. Grimesand
1217afe61c15SRodney W. Grimes.Dv ICANON
1218afe61c15SRodney W. Grimesare set, the
1219afe61c15SRodney W. Grimes.Dv KILL
1220afe61c15SRodney W. Grimescharacter causes
1221afe61c15SRodney W. Grimesthe current line to be discarded and the system causes
1222afe61c15SRodney W. Grimesthe terminal
1223afe61c15SRodney W. Grimesto erase the line from the display.
1224afe61c15SRodney W. Grimes.Pp
1225afe61c15SRodney W. GrimesIf
1226afe61c15SRodney W. Grimes.Dv ECHOPRT
1227afe61c15SRodney W. Grimesand
1228afe61c15SRodney W. Grimes.Dv ICANON
1229afe61c15SRodney W. Grimesare set, the system assumes
1230afe61c15SRodney W. Grimesthat the display is a printing device and prints a
1231afe61c15SRodney W. Grimesbackslash and the erased characters when processing
1232afe61c15SRodney W. Grimes.Dv ERASE
1233afe61c15SRodney W. Grimescharacters, followed by a forward slash.
1234afe61c15SRodney W. Grimes.Pp
1235afe61c15SRodney W. GrimesIf
1236afe61c15SRodney W. Grimes.Dv ECHOCTL
1237afe61c15SRodney W. Grimesis set, the system echoes control characters
1238afe61c15SRodney W. Grimesin a visible fashion using a caret followed by the control character.
1239afe61c15SRodney W. Grimes.Pp
1240afe61c15SRodney W. GrimesIf
1241afe61c15SRodney W. Grimes.Dv ALTWERASE
1242afe61c15SRodney W. Grimesis set, the system uses an alternative algorithm
1243afe61c15SRodney W. Grimesfor determining what constitutes a word when processing
1244afe61c15SRodney W. Grimes.Dv WERASE
1245afe61c15SRodney W. Grimescharacters (see
1246afe61c15SRodney W. Grimes.Dv WERASE ) .
1247afe61c15SRodney W. Grimes.Pp
1248afe61c15SRodney W. GrimesIf
1249afe61c15SRodney W. Grimes.Dv ECHONL
1250afe61c15SRodney W. Grimesand
1251afe61c15SRodney W. Grimes.Dv ICANON
1252afe61c15SRodney W. Grimesare set, the
1253afe61c15SRodney W. Grimes.Ql \&\en
1254afe61c15SRodney W. Grimescharacter echoes even if
1255afe61c15SRodney W. Grimes.Dv ECHO
1256afe61c15SRodney W. Grimesis not set.
1257afe61c15SRodney W. Grimes.Pp
1258afe61c15SRodney W. GrimesIf
1259afe61c15SRodney W. Grimes.Dv ICANON
1260afe61c15SRodney W. Grimesis set, canonical processing is enabled.  This enables the
1261afe61c15SRodney W. Grimeserase and kill edit functions, and the assembly of input characters into
1262afe61c15SRodney W. Grimeslines delimited by
1263afe61c15SRodney W. Grimes.Dv NL,
1264afe61c15SRodney W. Grimes.Dv EOF ,
1265afe61c15SRodney W. Grimesand
1266afe61c15SRodney W. Grimes.Dv EOL,
1267afe61c15SRodney W. Grimesas described in
1268afe61c15SRodney W. Grimes.Sx "Canonical Mode Input Processing" .
1269afe61c15SRodney W. Grimes.Pp
1270afe61c15SRodney W. GrimesIf
1271afe61c15SRodney W. Grimes.Dv ICANON
1272afe61c15SRodney W. Grimesis not set, read requests are satisfied directly from the input
1273afe61c15SRodney W. Grimesqueue.  A read is not satisfied until at least
1274afe61c15SRodney W. Grimes.Dv MIN
1275afe61c15SRodney W. Grimesbytes have been
1276afe61c15SRodney W. Grimesreceived or the timeout value
1277afe61c15SRodney W. Grimes.Dv TIME
1278afe61c15SRodney W. Grimesexpired between bytes.  The time value
1279afe61c15SRodney W. Grimesrepresents tenths of seconds.  See
1280afe61c15SRodney W. Grimes.Sx "Noncanonical Mode Input Processing"
1281afe61c15SRodney W. Grimesfor more details.
1282afe61c15SRodney W. Grimes.Pp
1283afe61c15SRodney W. GrimesIf
1284afe61c15SRodney W. Grimes.Dv ISIG
1285afe61c15SRodney W. Grimesis set, each input character is checked against the special
1286afe61c15SRodney W. Grimescontrol characters
1287afe61c15SRodney W. Grimes.Dv INTR ,
1288afe61c15SRodney W. Grimes.Dv QUIT ,
1289afe61c15SRodney W. Grimesand
1290afe61c15SRodney W. Grimes.Dv SUSP
1291afe61c15SRodney W. Grimes(job control only).  If an input
1292afe61c15SRodney W. Grimescharacter matches one of these control characters, the function
1293afe61c15SRodney W. Grimesassociated with that character is performed.  If
1294afe61c15SRodney W. Grimes.Dv ISIG
1295afe61c15SRodney W. Grimesis not set, no
1296afe61c15SRodney W. Grimeschecking is done.  Thus these special input functions are possible only
1297afe61c15SRodney W. Grimesif
1298afe61c15SRodney W. Grimes.Dv ISIG
1299afe61c15SRodney W. Grimesis set.
1300afe61c15SRodney W. Grimes.Pp
1301afe61c15SRodney W. GrimesIf
1302afe61c15SRodney W. Grimes.Dv IEXTEN
1303afe61c15SRodney W. Grimesis set, implementation-defined functions are recognized
1304afe61c15SRodney W. Grimesfrom the input data.  How
1305afe61c15SRodney W. Grimes.Dv IEXTEN
1306afe61c15SRodney W. Grimesbeing set
1307afe61c15SRodney W. Grimesinteracts with
1308afe61c15SRodney W. Grimes.Dv ICANON ,
1309afe61c15SRodney W. Grimes.Dv ISIG ,
1310afe61c15SRodney W. Grimes.Dv IXON ,
1311afe61c15SRodney W. Grimesor
1312afe61c15SRodney W. Grimes.Dv IXOFF
1313afe61c15SRodney W. Grimesis implementation defined.
1314afe61c15SRodney W. GrimesIf
1315afe61c15SRodney W. Grimes.Dv IEXTEN
1316afe61c15SRodney W. Grimesis not set, then
1317afe61c15SRodney W. Grimesimplementation-defined functions are not recognized, and the
1318afe61c15SRodney W. Grimescorresponding input characters are not processed as described for
1319afe61c15SRodney W. Grimes.Dv ICANON ,
1320afe61c15SRodney W. Grimes.Dv ISIG ,
1321afe61c15SRodney W. Grimes.Dv IXON ,
1322afe61c15SRodney W. Grimesand
1323afe61c15SRodney W. Grimes.Dv IXOFF .
1324afe61c15SRodney W. Grimes.Pp
1325afe61c15SRodney W. GrimesIf
1326afe61c15SRodney W. Grimes.Dv NOFLSH
1327afe61c15SRodney W. Grimesis set, the normal flush of the input and output queues
1328afe61c15SRodney W. Grimesassociated with the
1329afe61c15SRodney W. Grimes.Dv INTR ,
1330afe61c15SRodney W. Grimes.Dv QUIT ,
1331afe61c15SRodney W. Grimesand
1332afe61c15SRodney W. Grimes.Dv SUSP
1333afe61c15SRodney W. Grimescharacters
1334afe61c15SRodney W. Grimesare not be done.
1335afe61c15SRodney W. Grimes.Pp
1336afe61c15SRodney W. GrimesIf
1337afe61c15SRodney W. Grimes.Dv TOSTOP
1338afe61c15SRodney W. Grimesis set, the signal
1339afe61c15SRodney W. Grimes.Dv SIGTTOU
1340afe61c15SRodney W. Grimesis sent to the process group of a process that tries to write to
1341afe61c15SRodney W. Grimesits controlling terminal if it is not in the foreground process group for
1342afe61c15SRodney W. Grimesthat terminal.  This signal, by default, stops the members of the process
1343afe61c15SRodney W. Grimesgroup.  Otherwise, the output generated by that process is output to the
1344afe61c15SRodney W. Grimescurrent output stream.  Processes that are blocking or ignoring
1345afe61c15SRodney W. Grimes.Dv SIGTTOU
1346afe61c15SRodney W. Grimessignals are excepted and allowed to produce output and the
1347afe61c15SRodney W. Grimes.Dv SIGTTOU
1348afe61c15SRodney W. Grimessignal
1349afe61c15SRodney W. Grimesis not sent.
1350afe61c15SRodney W. Grimes.Pp
1351afe61c15SRodney W. GrimesIf
1352afe61c15SRodney W. Grimes.Dv NOKERNINFO
1353afe61c15SRodney W. Grimesis set, the kernel does not produce a status message
1354afe61c15SRodney W. Grimeswhen processing
1355afe61c15SRodney W. Grimes.Dv STATUS
1356afe61c15SRodney W. Grimescharacters (see
1357afe61c15SRodney W. Grimes.Dv STATUS ) .
1358afe61c15SRodney W. Grimes.Ss Special Control Characters
1359afe61c15SRodney W. GrimesThe special control characters values are defined by the array
1360afe61c15SRodney W. Grimes.Fa c_cc .
1361afe61c15SRodney W. GrimesThis table lists the array index, the corresponding special character,
1362afe61c15SRodney W. Grimesand the system default value.  For an accurate list of
1363afe61c15SRodney W. Grimesthe system defaults, consult the header file
1364afe61c15SRodney W. Grimes.Aq Pa ttydefaults.h .
1365afe61c15SRodney W. Grimes.Pp
1366afe61c15SRodney W. Grimes.Bl -column "Index Name" "Special Character" -offset indent -compact
1367afe61c15SRodney W. Grimes.It Em "Index Name	Special Character	Default Value"
1368afe61c15SRodney W. Grimes.It Dv VEOF Ta EOF Ta \&^D
1369afe61c15SRodney W. Grimes.It Dv VEOL Ta EOL Ta _POSIX_VDISABLE
1370afe61c15SRodney W. Grimes.It Dv VEOL2 Ta EOL2 Ta _POSIX_VDISABLE
1371afe61c15SRodney W. Grimes.It Dv VERASE Ta ERASE Ta \&^? Ql \&\e177
1372afe61c15SRodney W. Grimes.It Dv VWERASE  Ta WERASE Ta \&^W
1373afe61c15SRodney W. Grimes.It Dv VKILL Ta KILL Ta \&^U
1374afe61c15SRodney W. Grimes.It Dv VREPRINT Ta REPRINT Ta \&^R
1375afe61c15SRodney W. Grimes.It Dv VINTR Ta INTR Ta \&^C
1376afe61c15SRodney W. Grimes.It Dv VQUIT Ta QUIT Ta \&^\e\e Ql \&\e34
1377afe61c15SRodney W. Grimes.It Dv VSUSP Ta SUSP Ta \&^Z
1378afe61c15SRodney W. Grimes.It Dv VDSUSP Ta DSUSP Ta \&^Y
1379afe61c15SRodney W. Grimes.It Dv VSTART Ta START Ta \&^Q
1380afe61c15SRodney W. Grimes.It Dv VSTOP Ta STOP Ta \&^S
1381afe61c15SRodney W. Grimes.It Dv VLNEXT Ta LNEXT Ta \&^V
1382afe61c15SRodney W. Grimes.It Dv VDISCARD Ta DISCARD Ta \&^O
1383afe61c15SRodney W. Grimes.It Dv VMIN Ta --- Ta \&1
1384afe61c15SRodney W. Grimes.It Dv VTIME Ta --- Ta \&0
1385afe61c15SRodney W. Grimes.It Dv VSTATUS Ta STATUS Ta \&^T
1386afe61c15SRodney W. Grimes.El
1387afe61c15SRodney W. Grimes.Pp
1388afe61c15SRodney W. GrimesIf the
1389afe61c15SRodney W. Grimesvalue of one of the changeable special control characters (see
1390afe61c15SRodney W. Grimes.Sx "Special Characters" )
1391afe61c15SRodney W. Grimesis
1392afe61c15SRodney W. Grimes.Dv {_POSIX_VDISABLE} ,
1393afe61c15SRodney W. Grimesthat function is disabled; that is, no input
1394afe61c15SRodney W. Grimesdata is recognized as the disabled special character.
1395afe61c15SRodney W. GrimesIf
1396afe61c15SRodney W. Grimes.Dv ICANON
1397afe61c15SRodney W. Grimesis
1398afe61c15SRodney W. Grimesnot set, the value of
1399afe61c15SRodney W. Grimes.Dv {_POSIX_VDISABLE}
1400afe61c15SRodney W. Grimeshas no special meaning for the
1401afe61c15SRodney W. Grimes.Dv VMIN
1402afe61c15SRodney W. Grimesand
1403afe61c15SRodney W. Grimes.Dv VTIME
1404afe61c15SRodney W. Grimesentries of the
1405afe61c15SRodney W. Grimes.Fa c_cc
1406afe61c15SRodney W. Grimesarray.
1407afe61c15SRodney W. Grimes.Pp
1408afe61c15SRodney W. GrimesThe initial values of the flags and control characters
1409afe61c15SRodney W. Grimesafter open() is set according to
1410afe61c15SRodney W. Grimesthe values in the header
1411afe61c15SRodney W. Grimes.Aq Pa sys/ttydefaults.h .
1412