6396 remove SVM
[unleashed.git] / usr / src / man / man7i / termio.7i
blobf7fa1bdc44e14e092fd03771debe382550fb68e1
1 '\" te
2 .\" Copyright (c) 2005, Sun Microsystems, Inc.  All Rights Reserved.
3 .\" Copyright (c) 2014, Joyent, Inc.  All Rights Reserved.
4 .\" Copyright 1989 AT&T
5 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
6 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
7 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
8 .TH TERMIO 7I "Dec 30, 2016"
9 .SH NAME
10 termio \- general terminal interface
11 .SH SYNOPSIS
12 .LP
13 .nf
14 #include <termio.h>
16 \fB\fR\fBioctl\fR(\fBint\fR \fIfildes\fR, \fBint\fR \fIrequest\fR, \fBstruct termio *\fR\fIarg\fR);
17 .fi
19 .LP
20 .nf
21 \fB\fR\fBioctl\fR(\fBint\fR \fIfildes\fR, \fBint\fR \fIrequest\fR, \fBint\fR \fIarg\fR);
22 .fi
24 .LP
25 .nf
26 #include <termios.h>
28 \fB\fR\fBioctl\fR(\fBint\fR \fIfildes\fR, \fBint\fR \fIrequest\fR, \fBstruct termios *\fR\fIarg\fR);
29 .fi
31 .SH DESCRIPTION
32 .LP
33 This release supports a general interface for asynchronous communications ports
34 that is hardware-independent. The user interface to this functionality is using
35 function calls (the preferred interface) described in \fBtermios\fR(3C) or
36 \fBioctl\fR commands described in this section. This section also discusses the
37 common features of the  terminal subsystem which are relevant with both user
38 interfaces.
39 .sp
40 .LP
41 When a terminal file is opened, it normally causes the process to wait until a
42 connection is established. In practice, user programs seldom open terminal
43 files; they are opened by the system and become a user's standard input,
44 output, and error files. The first terminal file opened by the session leader
45 that is not already associated with a session becomes the controlling terminal
46 for that session. The controlling terminal plays a special role in handling
47 quit and interrupt signals, as discussed below. The controlling terminal is
48 inherited by a child process during a \fBfork\fR(2). A process can break this
49 association by changing its session using \fBsetsid()\fR (see \fBsetsid\fR(2)).
50 .sp
51 .LP
52 A terminal associated with one of these files ordinarily operates in
53 full-duplex mode. Characters may be typed at any time, even while output is
54 occurring, and are only lost when the character input buffers of the system
55 become completely full, which is rare. For example, the number of characters in
56 the line discipline buffer may exceed {\fBMAX_CANON\fR}  and  \fBIMAXBEL\fR
57 (see below) is not set, or the user may accumulate { \fBMAX_INPUT\fR} number of
58 input characters that have not yet been read by some program. When the input
59 limit is reached, all the characters saved in the buffer up to that point are
60 thrown away without notice.
61 .SS "Session Management (Job Control)"
62 .LP
63 A control terminal will distinguish one of the process groups in the session
64 associated with it to be the  foreground process group. All other process
65 groups in the session are designated as background process groups. This
66 foreground process group plays a special role in handling signal-generating
67 input characters, as discussed below. By default, when a controlling terminal
68 is allocated, the controlling process's process group is assigned  as
69 foreground process group.
70 .sp
71 .LP
72 Background process groups in the controlling process's session are subject to a
73 job control line discipline when they attempt to access their controlling
74 terminal. Process groups can be sent signals that will cause them to stop,
75 unless they have made other arrangements. An exception is made for members of
76 orphaned process groups.
77 .sp
78 .LP
79 An orphaned process group is one where the process group (see \fBgetpgid\fR(2))
80 has no members with a parent in a different process group but sharing the same
81 controlling terminal. When a member of an orphaned process group attempts to
82 access its controlling terminal, EIO is returned because there would be no way
83 to restart the process if it were stopped on one of these signals.
84 .sp
85 .LP
86 If a member of a background process group attempts to read its controlling
87 terminal, its process group will be sent a  \fBSIGTTIN\fR signal, which will
88 normally cause the members of that process group to stop. If, however, the
89 process is ignoring or holding \fBSIGTTIN\fR, or is a member of an orphaned
90 process group, the read will fail with \fBerrno\fR set to  \fBEIO\fR, and no
91 signal is sent.
92 .sp
93 .LP
94 If a member of a background process group attempts to write its controlling
95 terminal and the \fBTOSTOP\fR bit is set in the \fBc_lflag\fR field, its
96 process group is sent a \fBSIGTTOU\fR signal, which will normally cause the
97 members of that process group to stop. If, however, the process is ignoring or
98 holding \fBSIGTTOU\fR, the write will succeed. If the process is not ignoring
99 or holding \fBSIGTTOU\fR and is a member of an orphaned process group, the
100 write will fail with  \fBerrno\fR set to  \fBEIO\fR, and no signal will be
101 sent.
104 If \fBTOSTOP\fR is set and a member of a background process group attempts  to
105 \fBioctl\fR its controlling terminal, and that \fBioctl\fR will modify terminal
106 parameters (for example, \fBTCSETA\fR, \fBTCSETAW\fR, \fBTCSETAF\fR, or
107 \fBTIOCSPGRP)\fR, its process group will be sent a \fBSIGTTOU\fR signal, which
108 will normally cause the members of that process group to stop. If, however, the
109 process is ignoring or holding \fBSIGTTOU\fR, the ioctl will succeed. If the
110 process is not ignoring or holding \fBSIGTTOU\fR and is a member of an orphaned
111 process group, the write will fail with  \fBerrno\fR set to \fBEIO\fR, and no
112 signal will be sent.
113 .SS "Canonical Mode Input Processing"
115 Normally, terminal input is processed in units of lines. A line is delimited by
116 a newline (\fBASCII LF\fR) character, an end-of-file (\fBASCII EOT\fR)
117 character, or an end-of-line character. This means that a program attempting to
118 read will block until an entire line has been typed. Also, no matter how many
119 characters are requested in the read call, at most one line will be returned.
120 It is not necessary, however, to read a whole line at once; any number of
121 characters may be requested in a read, even one, without losing information.
124 During input, erase, erase2, and kill processing is normally done. The
125 \fBERASE\fR and \fBERASE2\fR character (by default, the character \fBDEL\fR for \fBERASE\fR and \fBControl-h\fR for \fBERASE2\fR) erases the last character
126 typed. The \fBWERASE\fR character (the character  \fBControl-w\fR) erases the
127 last "word" typed in the current input line (but not any preceding spaces or
128 tabs). A "word" is defined as a sequence of non-blank characters, with tabs
129 counted as blanks. None of \fBERASE\fR or \fBERASE2\fR or \fBWERASE\fR will
130 erase beyond the beginning of the line.  The \fBKILL\fR character (by default,
131 the character \fBNAK\fR) kills (deletes) the entire input line, and optionally
132 outputs a newline character. All these characters operate on a key stroke basis,
133 independent of any backspacing or tabbing that may have been done. The
134 \fBREPRINT\fR character (the character Control-r) prints a newline followed by
135 all characters that have not been read. Reprinting also occurs automatically if
136 characters that would normally be erased from the screen are fouled by program
137 output. The characters are reprinted as if they were being echoed;
138 consequencely, if \fBECHO\fR is not set, they are not printed.
141 The \fBERASE\fR, \fBERASE2\fR, and \fBKILL\fR characters may be entered
142 literally by preceding them with the escape character. In this case, the
143 escape character is not read.  The erase, erase2, and kill characters may be
144 changed.
145 .SS "Non-canonical Mode Input Processing"
147 In non-canonical mode input processing, input characters are not assembled into
148 lines, and erase and kill processing does not occur. The \fBMIN\fR and
149 \fBTIME\fR values are used to determine how to process the characters received.
152 \fBMIN\fR represents the minimum number of characters that should be received
153 when the read is satisfied (that is, when the characters are returned to the
154 user). \fBTIME\fR is a timer of 0.10-second granularity that is used to timeout
155 bursty and short-term data transmissions. The four possible values for
156 \fBMIN\fR and \fBTIME\fR and their interactions are described below.
158 .ne 2
160 \fBCase A: MIN > 0, TIME > 0\fR
162 .RS 29n
163 In this case, \fBTIME\fR serves as an intercharacter timer and is activated
164 after the first character is received.  Since it is an intercharacter timer, it
165 is reset after a character is received. The interaction between \fBMIN\fR and
166 \fBTIME\fR is as follows: as soon as one character is received, the
167 intercharacter timer is started. If  \fBMIN\fR characters are received before
168 the intercharacter timer expires (note that the timer is reset upon receipt of
169 each character), the read is satisfied.  If the timer expires before \fBMIN\fR
170 characters are received, the characters received to that point are returned to
171 the user. Note that if  \fBTIME\fR expires, at least one character will be
172 returned because  the timer would not have been enabled unless a character was
173 received. In this case (MIN > 0, TIME > 0), the read sleeps until the \fBMIN\fR
174 and \fBTIME\fR mechanisms are activated by the receipt of the first character.
175 If the number of characters read is less than the number of characters
176 available, the timer is not reactivated and the subsequent read is satisfied
177 immediately.
181 .ne 2
183 \fBCase B: MIN > 0, TIME = 0\fR
185 .RS 29n
186 In this case, since the value of \fBTIME\fR is zero, the timer plays no role
187 and only \fBMIN\fR is significant.  A pending read is not satisfied until
188 \fBMIN\fR characters are received (the pending read sleeps until  \fBMIN\fR
189 characters are received). A program that uses this case to read record based
190 terminal \fBI/O\fR may block indefinitely in the read operation.
194 .ne 2
196 \fBCase C: MIN = 0, TIME > 0\fR
198 .RS 29n
199 In this case, since \fBMIN\fR = 0,  \fBTIME\fR no longer represents an
200 intercharacter timer: it now serves as a read timer that is activated as soon
201 as a \fBread\fR is done.  A read is satisfied as soon as a single character is
202 received or the read timer expires. Note that, in this case, if the timer
203 expires, no character is returned. If the timer does not expire, the only way
204 the read can be satisfied is if a  character is received. In this case, the
205 read will not block indefinitely waiting for a character; if no character is
206 received within \fBTIME\fR *.10 seconds after the read is initiated, the read
207 returns with zero characters.
211 .ne 2
213 \fBCase D: MIN = 0, TIME = 0\fR
215 .RS 29n
216 In this case, return is immediate. The minimum of either the number of
217 characters requested or the number of characters currently available is
218 returned without waiting for more characters to be input.
221 .SS "Comparing Different Cases of MIN, TIME Interaction"
223 Some points to note about  \fBMIN\fR and  \fBTIME\fR :
224 .RS +4
226 .ie t \(bu
227 .el o
228 In the following explanations, note that the interactions of \fBMIN\fR and
229 \fBTIME\fR are not symmetric.  For example, when  \fBMIN\fR > 0 and  \fBTIME\fR
230 = 0,  \fBTIME\fR has no effect. However, in the opposite case, where  \fBMIN\fR
231 = 0 and \fBTIME\fR > 0, both  \fBMIN\fR and  \fBTIME\fR play a role in that
232 \fBMIN\fR is satisfied with the receipt of a single character.
234 .RS +4
236 .ie t \(bu
237 .el o
238 Also note that in case A (\fBMIN\fR > 0, \fBTIME\fR > 0), \fBTIME\fR represents
239 an intercharacter timer,  whereas in case C ( \fBMIN\fR = 0, \fBTIME\fR > 0),
240 \fBTIME\fR represents a read timer.
244 These two points highlight the dual purpose of the  \fBMIN/TIME\fR feature.
245 Cases A and B, where  \fBMIN\fR > 0, exist to handle burst mode activity (for
246 example, file transfer programs), where a program would like to process at
247 least \fBMIN\fR characters at a time. In case A, the intercharacter timer is
248 activated by a user as a safety measure; in case B, the timer is turned off.
251 Cases C and D exist to handle single character, timed transfers. These cases
252 are readily adaptable to screen-based applications that need to know if a
253 character is present in the input queue before refreshing the screen. In case
254 C, the read is timed, whereas in case D, it is not.
257 Another important note is that \fBMIN\fR is always just a minimum.  It does not
258 denote a record length. For example, if a program does a read of 20 bytes,
259 \fBMIN\fR is 10, and 25 characters are present, then 20 characters will be
260 returned to the user.
261 .SS "Writing Characters"
263 When one or more characters are written, they are transmitted to the terminal
264 as soon as previously written characters have finished typing. Input characters
265 are echoed as they are typed if echoing has been enabled. If a process produces
266 characters more rapidly than they can be typed, it will be suspended when its
267 output queue exceeds some limit. When the queue is drained down to some
268 threshold, the program is resumed.
269 .SS "Special Characters"
271 Certain characters have special functions on input. These functions and their
272 default character values are summarized as follows:
274 .ne 2
276 \fB\fBINTR\fR\fR
278 .RS 11n
279 (Control-c or \fBASCII ETX\fR) generates a \fBSIGINT\fR signal. \fBSIGINT\fR is
280 sent to all foreground processes associated with the controlling terminal.
281 Normally, each such process is forced to terminate, but arrangements may be
282 made either to ignore the signal or to receive a trap to an agreed upon
283 location. (See  \fBsignal.h\fR(3HEAD)).
287 .ne 2
289 \fB\fBQUIT\fR\fR
291 .RS 11n
292 (Control-| or \fBASCII FS\fR) generates a \fBSIGQUIT\fR signal.  Its treatment
293 is identical to the interrupt signal except that, unless a receiving process
294 has made other arrangements, it will not only be terminated but a core image
295 file (called  \fBcore\fR) will be created in the current working directory.
299 .ne 2
301 \fB\fBERASE\fR\fR
303 .RS 11n
304 (DEL) erases the preceding character. It does not erase beyond
305 the start of a line, as delimited by a \fBNL\fR, \fBEOF\fR, \fBEOL\fR, or
306 \fBEOL2\fR character.
310 .ne 2
312 \fB\fBERASE2\fR\fR
314 .RS 11n
315 (Control-h or \fBASCII BS\fR) erases the preceding character, with behaviour
316 identical to that of ERASE.
320 .ne 2
322 \fB\fBWERASE\fR\fR
324 .RS 11n
325 (Control-w or \fBASCII ETX\fR) erases the preceding "word". It does not erase
326 beyond the start of a line, as delimited by a \fBNL\fR, \fBEOF\fR, \fBEOL\fR,
327 or \fBEOL2\fR character.
331 .ne 2
333 \fB\fBKILL\fR\fR
335 .RS 11n
336 (Control-u or \fBASCII NAK\fR) deletes the entire line, as delimited by a
337 \fBNL\fR, \fBEOF\fR, \fBEOL\fR, or \fBEOL2\fR character.
341 .ne 2
343 \fB\fBREPRINT\fR\fR
345 .RS 11n
346 (Control-r or \fBASCII DC2\fR) reprints all characters, preceded by a newline,
347 that have not been read.
351 .ne 2
353 \fB\fBEOF\fR\fR
355 .RS 11n
356 (Control-d or \fBASCII EOT\fR) may be used to generate an end-of-file  from a
357 terminal. When received, all the characters waiting to be read are immediately
358 passed to the program, without waiting for a newline, and the \fBEOF\fR is
359 discarded.  Thus, if no characters are waiting (that is, the \fBEOF\fR occurred
360 at the beginning of a line) zero characters are passed back, which is the
361 standard end-of-file indication. Unless escaped, the \fBEOF\fR character is not
362 echoed. Because \fBEOT\fR is the default \fBEOF\fR character, this prevents
363 terminals that respond to \fBEOT\fR from hanging up.
367 .ne 2
369 \fB\fBNL\fR\fR
371 .RS 11n
372 (ASCII LF) is the normal line delimiter. It cannot be changed or escaped.
376 .ne 2
378 \fB\fBEOL\fR\fR
380 .RS 11n
381 (ASCII NULL) is an additional line delimiter, like \fBNL\fR . It is not
382 normally used.
386 .ne 2
388 \fB\fBEOL2\fR\fR
390 .RS 11n
391 is another additional line delimiter.
395 .ne 2
397 \fB\fBSWTCH\fR\fR
399 .RS 11n
400 (Control-z or \fBASCII EM\fR) Header file symbols related to this special
401 character are present for compatibility purposes only and the kernel takes no
402 special action on matching SWTCH (except to discard the character).
406 .ne 2
408 \fB\fBSUSP\fR\fR
410 .RS 11n
411 (Control-z or \fBASCII SUB\fR) generates a  \fBSIGTSTP\fR signal. \fBSIGTSTP\fR
412 stops all processes in the foreground process group for that terminal.
416 .ne 2
418 \fB\fBDSUSP\fR\fR
420 .RS 11n
421 (Control-y or \fBASCII EM\fR). It generates a \fBSIGTSTP\fR signal as
422 \fBSUSP\fR does, but the signal is sent when a process in the foreground
423 process group attempts to read the \fBDSUSP\fR character, rather than when it
424 is typed.
428 .ne 2
430 \fB\fBSTOP\fR\fR
432 .RS 11n
433 (Control-s or \fBASCII DC3\fR) can be used to suspend output temporarily. It is
434 useful with \fBCRT\fR terminals to prevent output from disappearing before it
435 can be read. While output is suspended, \fBSTOP\fR characters are ignored and
436 not read.
440 .ne 2
442 \fB\fBSTART\fR\fR
444 .RS 11n
445 (Control-q or \fBASCII DC1\fR) is used to resume output. Output has been
446 suspended by a \fBSTOP\fR character.  While output is not suspended,
447 \fBSTART\fR characters are ignored and not read.
451 .ne 2
453 \fB\fBDISCARD\fR\fR
455 .RS 11n
456 (Control-o or \fBASCII SI\fR) causes subsequent output to be discarded. Output
457 is discarded until another \fBDISCARD\fR character is typed, more input
458 arrives, or the condition is cleared by a program.
462 .ne 2
464 \fB\fBSTATUS\fR\fR
466 .RS 11n
467 (Control-t or \fBASCII DC4\fR) generates a \fBSIGINFO\fR signal. Processes with
468 a handler will output status information when they receive \fBSIGINFO\fR, for
469 example, \fBdd(1)\fR. If a process does not have a \fBSIGINFO\fR handler, the
470 signal will be ignored.
474 .ne 2
476 \fB\fBLNEXT\fR\fR
478 .RS 11n
479 (Control-v or \fBASCII SYN\fR) causes the special meaning of the next character
480 to be ignored.  This works for all the special characters mentioned above. It
481 allows characters to be input that would otherwise be interpreted by the system
482 (for example \fBKILL, QUIT\fR).  The character values for \fBINTR\fR,
483 \fBQUIT\fR, \fBERASE\fR, \fBERASE2\fR, \fBWERASE\fR, \fBKILL\fR, \fBREPRINT\fR,
484 \fBEOF\fR, \fBEOL\fR, \fBEOL2\fR, \fBSWTCH\fR, \fBSUSP\fR, \fBDSUSP\fR,
485 \fBSTOP\fR, \fBSTART\fR, \fBDISCARD\fR, \fBSTATUS\fR, and \fBLNEXT\fR may be
486 changed to suit individual tastes. If the value of a special control character
487 is _POSIX_VDISABLE (0), the function of that special control character is
488 disabled.
489 The \fBERASE\fR, \fBERASE2\fR, \fBKILL\fR, and \fBEOF\fR characters may be
490 escaped by a preceding backslash (\e) character, in which case no special
491 function is done.
492 Any of the special characters may be preceded by the \fBLNEXT\fR character, in
493 which case no special function is done.
496 .SS "Modem Disconnect"
498 When a modem disconnect is detected, a \fBSIGHUP\fR signal is sent to the
499 terminal's controlling process. Unless other arrangements have been made, these
500 signals cause the process to terminate. If  \fBSIGHUP\fR is ignored or caught,
501 any subsequent read returns with an end-of-file indication until the terminal
502 is closed.
505 If the controlling process is not in the  foreground process group of the
506 terminal, a \fBSIGTSTP\fR is sent to the terminal's foreground process group.
507 Unless other arrangements have been made, these signals cause the processes to
508 stop.
511 Processes in background process groups that attempt to access the controlling
512 terminal after modem disconnect while the terminal is still allocated to the
513 session will receive  appropriate \fBSIGTTOU\fR and  \fBSIGTTIN\fR signals.
514 Unless other arrangements have  been made, this signal causes the processes to
515 stop.
518 The controlling terminal will remain in this state until it is  reinitialized
519 with a successful open by the controlling process, or deallocated by the
520 controlling process.
521 .SS "Terminal Parameters"
523 The parameters that control the behavior of devices and modules providing the
524 \fBtermios\fR interface are specified by the \fBtermios\fR structure defined by
525 \fBtermios.h\fR. Several  \fBioctl\fR(2) system calls that fetch or change
526 these parameters use this structure that contains the following members:
528 .in +2
530  tcflag_t c_iflag;  /* input modes */
531         tcflag_t        c_oflag;  /* output modes */
532         tcflag_t        c_cflag;  /* control modes */
533         tcflag_t        c_lflag;  /* local modes */
534         cc_t  c_cc[NCCS];  /* control chars */
536 .in -2
540 The special control characters are defined by the array \fBc_cc\fR. The
541 symbolic name \fBNCCS\fR is the size of the Control-character array and is also
542 defined by \fB<termios.h>\fR\&. The relative positions, subscript names, and
543 typical default values  for each function are as follows:
548 box;
549 c | c | c
550 l | l | l .
551 Relative Position       Subscript Name  Typical Default Value
553 0       VINTR   ETX
555 1       VQUIT   FS
557 2       VERASE  DEL
559 3       VKILL   NAK
561 4       VEOF    EOT
563 5       VEOL    NUL
565 6       VEOL2   NUL
567 7       VWSTCH  NUL
569 8       VSTART  NUL
571 9       VSTOP   DC3
573 10      VSUSP   SUB
575 11      VDSUSP  EM
577 12      VREPRINT        DC2
579 13      VDISCARD        SI
581 14      VWERASE ETB
583 15      VLNEXT  SYN
585 16      VSTATUS DC4
587 17      VERASE2 BS
589 18-19   Reserved
592 .SS "Input Modes"
594 The \fBc_iflag\fR field describes the basic terminal input control:
596 .ne 2
598 \fB\fBIGNBRK\fR\fR
600 .RS 11n
601  Ignore break condition.
605 .ne 2
607 \fB\fBBRKINT\fR\fR
609 .RS 11n
610 Signal interrupt on break.
614 .ne 2
616 \fB\fBIGNPAR\fR\fR
618 .RS 11n
619 Ignore characters with parity errors.
623 .ne 2
625 \fB\fBPARMRK\fR\fR
627 .RS 11n
628 Mark parity errors.
632 .ne 2
634 \fB\fBINPCK\fR\fR
636 .RS 11n
637 Enable input parity check.
641 .ne 2
643 \fB\fBISTRIP\fR\fR
645 .RS 11n
646 Strip character.
650 .ne 2
652 \fB\fBINLCR\fR\fR
654 .RS 11n
655 Map NL to CR on input.
659 .ne 2
661 \fB\fBIGNCR\fR\fR
663 .RS 11n
664 Ignore CR.
668 .ne 2
670 \fB\fBICRNL\fR\fR
672 .RS 11n
673 Map CR to NL on input.
677 .ne 2
679 \fB\fBIUCLC\fR\fR
681 .RS 11n
682 Map upper-case to lower-case on input.
686 .ne 2
688 \fB\fBIXON\fR\fR
690 .RS 11n
691 Enable start/stop output control.
695 .ne 2
697 \fB\fBIXANY\fR\fR
699 .RS 11n
700 Enable any character to restart output.
704 .ne 2
706 \fB\fBIXOFF\fR\fR
708 .RS 11n
709 Enable start/stop input control.
713 .ne 2
715 \fB\fBIMAXBEL\fR\fR
717 .RS 11n
718 Echo  \fBBEL\fR on input line too long.
723 If \fBIGNBRK\fR is set, a break condition (a character framing error with data
724 all zeros) detected on input is ignored, that is, not put on the input queue
725 and therefore not read by any process. If \fBIGNBRK\fR is not set and
726 \fBBRKINT\fR is set, the break condition shall flush the input and output
727 queues and if the terminal is the controlling terminal of a foreground process
728 group, the break condition generates a single \fBSIGINT\fR signal to that
729 foreground process group. If neither \fBIGNBRK\fR nor \fBBRKINT\fR is set, a
730 break condition is read as a single '\e0' (\fBASCII NULL\fR) character, or if
731 \fBPARMRK\fR is set, as '\e377', '\e0', c, where '\e377' is a single character
732 with value 377 octal (0xff hex, 255 decimal), '\e0' is a single character with
733 value 0, and c is the errored character received.
736 If  \fBIGNPAR\fR is set, a byte with framing or parity errors (other than
737 break)  is ignored.
740 If \fBPARMRK\fR is set, and \fBIGNPAR\fR is not set, a byte with a framing or
741 parity error (other than break) is given to the application as the
742 three-character sequence: '\e377', '\e0', c, where '\e377' is a single
743 character with value 377 octal (0xff hex, 255 decimal), '\e0' is a single
744 character with value 0, and c is the errored character received. To avoid
745 ambiguity in this case, if \fBISTRIP\fR is not set, a valid character
746 of '\e377' is given to the  application as `\e377.' If neither \fBIGNPAR\fR nor
747 \fBPARMRK\fR is set, a framing or parity error (other than break) is given to
748 the application as a single '\e0' (\fBASCII NULL\fR) character.
751 If \fBINPCK\fR is set, input parity checking is enabled. If \fBINPCK\fR is not
752 set, input parity checking is disabled. This allows output parity generation
753 without input parity errors.  Note that whether input parity checking is
754 enabled or disabled is independent of whether parity detection is enabled or
755 disabled.  If parity detection is enabled but input parity checking is
756 disabled, the hardware to which the terminal is connected will recognize the
757 parity bit, but the terminal special file will not check whether this is set
758 correctly or not.
761 If \fBISTRIP\fR is set, valid input characters are first stripped to seven
762 bits, otherwise all eight bits are processed.
765 If \fBINLCR\fR is set, a received \fBNL\fR character is translated into a
766 \fBCR\fR character.  If  \fBIGNCR\fR is set, a received \fBCR\fR character is
767 ignored (not read).  Otherwise, if \fBICRNL\fR is set, a received \fBCR\fR
768 character is translated into a \fBNL\fR character.
771 If \fBIUCLC\fR is set, a received upper case, alphabetic character is
772 translated into the corresponding lower case character.
775 If \fBIXON\fR is set, start/stop output control is enabled. A received
776 \fBSTOP\fR character suspends output and a received \fBSTART\fR character
777 restarts output. The \fBSTOP\fR and \fBSTART\fR characters will not be read,
778 but will merely perform  flow control functions. If \fBIXANY\fR is set, any
779 input character restarts output that has been suspended.
782 If \fBIXOFF\fR is set, the system transmits a \fBSTOP\fR character when the
783 input queue is nearly full, and a \fBSTART\fR character when enough input has
784 been read so that the input queue is nearly empty again.
787 If \fBIMAXBEL\fR is set, the \fBASCII BEL\fR character is echoed if the input
788 stream overflows. Further input is not stored, but any input already present in
789 the input stream is not disturbed.  If  \fBIMAXBEL\fR is not set, no \fBBEL\fR
790 character is echoed, and all input present in the input queue is discarded if
791 the input stream overflows.
792 .SS "Output Modes"
794 The  \fBc_oflag\fR field specifies the  system treatment of output:
796 .ne 2
798 \fB\fBOPOST\fR\fR
800 .RS 10n
801 Post-process output.
805 .ne 2
807 \fB\fBOLCUC\fR\fR
809 .RS 10n
810 Map lower case to upper on output.
814 .ne 2
816 \fB\fBONLCR\fR\fR
818 .RS 10n
819 Map NL to CR-NL on output.
823 .ne 2
825 \fB\fBOCRNL\fR\fR
827 .RS 10n
828 Map CR to NL on output.
832 .ne 2
834 \fB\fBONOCR\fR\fR
836 .RS 10n
837 No \fBCR\fR output at column 0.
841 .ne 2
843 \fB\fBONLRET\fR\fR
845 .RS 10n
846 \fBNL\fR performs \fBCR\fR function.
850 .ne 2
852 \fB\fBOFILL\fR\fR
854 .RS 10n
855 Use fill characters for delay.
859 .ne 2
861 \fB\fBOFDEL\fR\fR
863 .RS 10n
864 Fill is \fBDEL\fR, else \fINULL\fR.
868 .ne 2
870 \fB\fBNLDLY\fR\fR
872 .RS 10n
873 Select newline delays:
875 .in +2
876 \fBNL0\fR
877 .in -2
879 .in +2
880 \fBNL1\fR
881 .in -2
885 .ne 2
887 \fB\fBCRDLY\fR\fR
889 .RS 10n
890 Select carriage-return delays:
892 .in +2
893 \fBCR0\fR
894 .in -2
896 .in +2
897 \fBCR1\fR
898 .in -2
900 .in +2
901 \fBCR2\fR
902 .in -2
904 .in +2
905 \fBCR3\fR
906 .in -2
910 .ne 2
912 \fB\fBTABDLY\fR\fR
914 .RS 10n
915 Select horizontal tab delays or tab expansion:
917 .ne 2
919 \fB\fBTAB0\fR\fR
921 .RS 9n
926 .ne 2
928 \fB\fBTAB1\fR\fR
930 .RS 9n
935 .ne 2
937 \fB\fBTAB2\fR\fR
939 .RS 9n
944 .ne 2
946 \fB\fBTAB3\fR\fR
948 .RS 9n
949 Expand tabs to spaces
953 .ne 2
955 \fB\fBXTABS\fR\fR
957 .RS 9n
958 Expand tabs to spaces
964 .ne 2
966 \fB\fBBSDLY\fR\fR
968 .RS 10n
969 Select backspace delays:
971 .in +2
972 \fBBS0\fR
973 .in -2
975 .in +2
976 \fBBS1\fR
977 .in -2
981 .ne 2
983 \fB\fBVTDLY\fR\fR
985 .RS 10n
986 Select vertical tab delays:
988 .in +2
989 \fBVT0\fR
990 .in -2
992 .in +2
993 \fBVT1\fR
994 .in -2
998 .ne 2
1000 \fB\fBFFDLY\fR\fR
1002 .RS 10n
1003 Select form feed delays:
1005 .in +2
1006 \fBFF0\fR
1007 .in -2
1009 .in +2
1010 \fBFF1\fR
1011 .in -2
1016 If \fBOPOST\fR is set, output characters are post-processed as indicated by the
1017 remaining flags; otherwise, characters are transmitted without change.
1020 If \fBOLCUC\fR is set, a lower case alphabetic character is transmitted as the
1021 corresponding upper case character. This function is often used in conjunction
1022 with \fBIUCLC.\fR
1025 If \fBONLCR\fR is set, the \fBNL\fR character is transmitted as the \fBCR-NL\fR
1026 character pair.  If  \fBOCRNL\fR is set, the \fBCR\fR character is transmitted
1027 as the \fBNL\fR character.  If \fBONOCR\fR is set, no \fBCR\fR character is
1028 transmitted when at column 0 (first position). If  \fBONRET\fR is set, the
1029 \fBNL\fR character is assumed to do the carriage-return function; the column
1030 pointer is set to 0 and the delays specified for \fBCR\fR are used.  Otherwise,
1031 the \fBNL\fR character is assumed to do just the line-feed function; the column
1032 pointer remains unchanged. The column pointer is also set to 0 if the \fBCR\fR
1033 character is actually transmitted.
1036 The delay bits specify how long transmission stops to allow for mechanical or
1037 other movement when certain characters are sent to the terminal. In all cases,
1038 a value of 0 indicates no delay. If  \fBOFILL\fR is set, fill characters are
1039 transmitted for delay instead of a timed delay. This is useful for high baud
1040 rate terminals that need only a minimal delay.  If  \fBOFDEL\fR is set, the
1041 fill character is \fBDEL\fR ; otherwise it is  \fINULL\fR.
1044 If a form-feed or vertical-tab delay is specified, it lasts for about 2
1045 seconds.
1048 Newline delay lasts about 0.10 seconds. If \fBONLRET\fR is set, the
1049 carriage-return delays are used instead of the newline delays. If \fBOFILL\fR
1050 is set, two fill characters are transmitted.
1053 Carriage-return delay type 1 is dependent on the current column position, type
1054 2 is about 0.10 seconds, and type 3 is about 0.15 seconds. If  \fBOFILL\fR is
1055 set, delay type 1 transmits two fill characters, and type 2 transmits four fill
1056 characters.
1059 Horizontal-tab delay type 1 is dependent on the current column position. Type 2
1060 is about 0.10 seconds. Type 3 specifies that tabs are to be expanded into
1061 spaces. If \fBOFILL\fR is set, two fill characters are transmitted for any
1062 delay.
1065 Backspace delay lasts about 0.05 seconds. If  \fBOFILL\fR is set, one fill
1066 character is transmitted.
1069 The actual delays depend on line speed and system load.
1070 .SS "Control Modes"
1072 The \fBc_cflag\fR field describes the hardware control of the terminal:
1074 .ne 2
1076 \fB\fBCBAUD\fR\fR
1078 .RS 13n
1079 Baud rate:
1083 .ne 2
1085 \fB\fBB0\fR\fR
1087 .RS 13n
1088 Hang up
1092 .ne 2
1094 \fB\fBB50\fR\fR
1096 .RS 13n
1097 50 baud
1101 .ne 2
1103 \fB\fBB75\fR\fR
1105 .RS 13n
1106 75 baud
1110 .ne 2
1112 \fB\fBB110\fR\fR
1114 .RS 13n
1115 110 baud
1119 .ne 2
1121 \fB\fBB134\fR\fR
1123 .RS 13n
1124 134 baud
1128 .ne 2
1130 \fB\fBB150\fR\fR
1132 .RS 13n
1133 150 baud
1137 .ne 2
1139 \fB\fBB200\fR\fR
1141 .RS 13n
1142 200 baud
1146 .ne 2
1148 \fB\fBB300\fR\fR
1150 .RS 13n
1151 300 baud
1155 .ne 2
1157 \fB\fBB600\fR\fR
1159 .RS 13n
1160 600 baud
1164 .ne 2
1166 \fB\fBB1200\fR\fR
1168 .RS 13n
1169 1200 baud
1173 .ne 2
1175 \fB\fBB1800\fR\fR
1177 .RS 13n
1178 1800 baud
1182 .ne 2
1184 \fB\fBB2400\fR\fR
1186 .RS 13n
1187 2400 baud
1191 .ne 2
1193 \fB\fBB4800\fR\fR
1195 .RS 13n
1196 4800 baud
1200 .ne 2
1202 \fB\fBB9600\fR\fR
1204 .RS 13n
1205 9600 baud
1209 .ne 2
1211 \fB\fBB19200\fR\fR
1213 .RS 13n
1214 19200 baud
1218 .ne 2
1220 \fB\fBEXTA\fR\fR
1222 .RS 13n
1223 External A
1227 .ne 2
1229 \fB\fBB38400\fR\fR
1231 .RS 13n
1232 38400 baud
1236 .ne 2
1238 \fB\fBEXTB\fR\fR
1240 .RS 13n
1241 External B
1245 .ne 2
1247 \fB\fBB57600\fR\fR
1249 .RS 13n
1250 57600 baud
1254 .ne 2
1256 \fB\fBB76800\fR\fR
1258 .RS 13n
1259 76800 baud
1263 .ne 2
1265 \fB\fBB115200\fR\fR
1267 .RS 13n
1268 115200 baud
1272 .ne 2
1274 \fB\fBB153600\fR\fR
1276 .RS 13n
1277 153600 baud
1281 .ne 2
1283 \fB\fBB230400\fR\fR
1285 .RS 13n
1286 230400 baud
1290 .ne 2
1292 \fB\fBB307200\fR\fR
1294 .RS 13n
1295 307200 baud
1299 .ne 2
1301 \fB\fBB460800\fR\fR
1303 .RS 13n
1304 460800 baud
1308 .ne 2
1310 \fB\fBCSIZE\fR\fR
1312 .RS 13n
1313 Character size:
1317 .ne 2
1319 \fB\fBCS5\fR\fR
1321 .RS 13n
1322 5 bits
1326 .ne 2
1328 \fB\fBCS6\fR\fR
1330 .RS 13n
1331 6 bits
1335 .ne 2
1337 \fB\fBCS7\fR\fR
1339 .RS 13n
1340 7 bits
1344 .ne 2
1346 \fB\fBCS8\fR\fR
1348 .RS 13n
1349 8 bits
1353 .ne 2
1355 \fB\fBCSTOPB\fR\fR
1357 .RS 13n
1358 Send two stop bits, else one
1362 .ne 2
1364 \fB\fBCREAD\fR\fR
1366 .RS 13n
1367 Enable receiver
1371 .ne 2
1373 \fB\fBPARENB\fR\fR
1375 .RS 13n
1376 Parity enable
1380 .ne 2
1382 \fB\fBPARODD\fR\fR
1384 .RS 13n
1385 Odd parity, else even
1389 .ne 2
1391 \fB\fBHUPCL\fR\fR
1393 .RS 13n
1394 Hang up on last close
1398 .ne 2
1400 \fB\fBCLOCAL\fR\fR
1402 .RS 13n
1403 Local line, else dial-up
1407 .ne 2
1409 \fB\fBCIBAUD\fR\fR
1411 .RS 13n
1412 Input baud rate, if different from output rate
1416 .ne 2
1418 \fB\fBPAREXT\fR\fR
1420 .RS 13n
1421 Extended parity for mark and space parity
1425 .ne 2
1427 \fB\fBCRTSXOFF\fR\fR
1429 .RS 13n
1430 Enable inbound hardware flow control
1434 .ne 2
1436 \fB\fBCRTSCTS\fR\fR
1438 .RS 13n
1439 Enable outbound hardware flow control
1443 .ne 2
1445 \fB\fBCBAUDEXT\fR\fR
1447 .RS 13n
1448 Bit to indicate output speed > B38400
1452 .ne 2
1454 \fB\fBCIBAUDEXT\fR\fR
1456 .RS 13n
1457 Bit to indicate input speed > B38400
1462 The \fBCBAUD\fR bits together with the \fBCBAUDEXT\fR bit specify the output
1463 baud rate. To retrieve the output speed from the \fBtermios\fR structure
1464 pointed to by \fBtermios_p\fR see the following code segment.
1466 .in +2
1468 speed_t ospeed;
1469 if (termios_p->c_cflag & CBAUDEXT)
1470    ospeed = (termios_p->c_cflag & CBAUD) + CBAUD + 1;
1471 else
1472    ospeed = termios_p->c_cflag & CBAUD;
1474 .in -2
1478 To store the output speed in the termios structure pointed to by
1479 \fBtermios_p\fR see the following code segment.
1481 .in +2
1483 speed_t ospeed;
1484 if (ospeed > CBAUD) {
1485    termios_p->c_cflag |= CBAUDEXT;
1486    ospeed -= (CBAUD + 1);
1487 } else
1488    termios_p->c_cflag &= ~CBAUDEXT;
1489  termios_p->c_cflag =
1490         (termios_p->c_cflag & ~CBAUD) | (ospeed & CBAUD);
1492 .in -2
1496 The zero baud rate, B0, is used to hang up the connection. If B0 is specified,
1497 the data-terminal-ready signal is not asserted. Normally, this disconnects the
1498 line.
1501 If the \fBCIBAUDEXT\fR or \fBCIBAUD\fR bits are not zero, they specify the
1502 input baud rate, with the \fBCBAUDEXT\fR and \fBCBAUD\fR bits specifying the
1503 output baud rate; otherwise, the output and input baud rates are both specified
1504 by the \fBCBAUDEXT\fR and  \fBCBAUD\fR bits.  The values for the \fBCIBAUD\fR
1505 bits are the same as the values for the \fBCBAUD\fR bits, shifted left
1506 \fBIBSHIFT\fR bits. For any particular hardware, impossible speed changes are
1507 ignored. To retrieve the input speed in the  \fBtermios\fR structure pointed to
1508 by  \fBtermios_p\fR see the following code segment.
1510 .in +2
1512 speed_t ispeed;
1513 if (termios_p->c_cflag & CIBAUDEXT)
1514    ispeed = ((termios_p->c_cflag & CIBAUD) >> IBSHIFT)
1515    + (CIBAUD >> IBSHIFT) + 1;
1516 else
1517    ispeed = (termios_p->c_cflag & CIBAUD) >> IBSHIFT;
1519 .in -2
1523 To store the input speed in the  \fBtermios\fR structure pointed to by
1524 \fBtermios_p\fR see the following code segment.
1526 .in +2
1528 speed_t ispeed;
1529 if (ispeed == 0) {
1530    ispeed = termios_p->c_cflag & CBAUD;
1531 if (termios_p->c_cflag & CBAUDEXT)
1532    ispeed += (CBAUD + 1);
1534  if ((ispeed << IBSHIFT) > CIBAUD) {
1535     termios_p->c_cflag |= CIBAUDEXT;
1536     ispeed -= ((CIBAUD >> IBSHIFT) + 1);
1537 } else
1538     termios_p->c_cflag &= ~CIBAUDEXT;
1539     termios_p->c_cflag =
1540     (termios_p->c_cflag & ~CIBAUD) |
1541            ((ispeed << IBSHIFT) & CIBAUD);
1543 .in -2
1547 The \fBCSIZE\fR bits specify the character size in bits for both transmission
1548 and reception. This size does not include the parity bit, if any. If
1549 \fBCSTOPB\fR is set, two stop bits are used; otherwise, one stop bit is used.
1550 For example, at 110 baud, two stops bits are required.
1553 If \fBPARENB\fR is set, parity generation and detection is enabled, and a
1554 parity bit is added to each character. If parity is enabled, the \fBPARODD\fR
1555 flag specifies odd parity if set; otherwise, even parity is used.
1558 If \fBCREAD\fR is set, the receiver is enabled. Otherwise, no characters are
1559 received.
1562 If \fBHUPCL\fR is set, the line is disconnected when the last process with the
1563 line open closes it or terminates. That is, the data-terminal-ready signal is
1564 not asserted.
1567 If \fBCLOCAL\fR is set, the line is assumed to be a local, direct connection
1568 with no modem control; otherwise, modem control is assumed.
1571 If \fBCRTSXOFF\fR is set, inbound hardware flow control is enabled.
1574 If  \fBCRTSCTS\fR is set, outbound hardware flow control is enabled.
1577 The four possible combinations for the state of \fBCRTSCTS\fR and
1578 \fBCRTSXOFF\fR bits and their interactions are described below.
1580 .ne 2
1582 \fBCase A:\fR
1584 .RS 11n
1585 \fBCRTSCTS\fR off, \fBCRTSXOFF\fR off. In this case the hardware flow control
1586 is disabled.
1590 .ne 2
1592 \fBCase B:\fR
1594 .RS 11n
1595 \fBCRTSCTS\fR on, \fBCRTSXOFF\fR off. In this case only outbound hardware flow
1596 control is enabled. The state of CTS signal is used to do outbound flow
1597 control. It is expected that output will be suspended if CTS is low and resumed
1598 when CTS is high.
1602 .ne 2
1604 \fBCase C:\fR
1606 .RS 11n
1607 \fBCRTSCTS\fR off, \fBCRTSXOFF\fR on. In this case only inbound hardware flow
1608 control is enabled. The state of RTS signal is used to do inbound flow control.
1609 It is expected that input will be suspended if RTS is low and resumed when RTS
1610 is high.
1614 .ne 2
1616 \fBCase D:\fR
1618 .RS 11n
1619 \fBCRTSCTS\fR on, \fBCRTSXOFF\fR on. In this case both inbound and outbound
1620 hardware flow control are enabled. Uses the state of CTS signal to do outbound
1621 flow control and RTS signal to do inbound flow control.
1624 .SS "Local Modes"
1626 The \fBc_lflag\fR field of the argument structure is used by the line
1627 discipline to control terminal functions. The basic line discipline provides
1628 the following:
1630 .ne 2
1632 \fB\fBISIG\fR\fR
1634 .RS 11n
1635  Enable signals.
1639 .ne 2
1641 \fB\fBICANON\fR\fR
1643 .RS 11n
1644 Canonical input (erase and kill processing).
1648 .ne 2
1650 \fB\fBXCASE\fR\fR
1652 .RS 11n
1653 Canonical upper/lower presentation.
1657 .ne 2
1659 \fB\fBECHO\fR\fR
1661 .RS 11n
1662 Enable echo.
1666 .ne 2
1668 \fB\fBECHOE\fR\fR
1670 .RS 11n
1671 Echo erase character as \fBBS-SP-BS\fR &.
1675 .ne 2
1677 \fB\fBECHOK\fR\fR
1679 .RS 11n
1680 Echo  \fBNL\fR after kill character.
1684 .ne 2
1686 \fB\fBECHONL\fR\fR
1688 .RS 11n
1689 Echo  \fBNL\fR .
1693 .ne 2
1695 \fB\fBNOFLSH\fR\fR
1697 .RS 11n
1698 Disable flush after interrupt or quit.
1702 .ne 2
1704 \fB\fBTOSTOP\fR\fR
1706 .RS 11n
1707 Send  \fBSIGTTOU\fR for background output.
1711 .ne 2
1713 \fB\fBECHOCTL\fR\fR
1715 .RS 11n
1716 Echo control characters as  \fIchar,\fR delete as ^?.
1720 .ne 2
1722 \fB\fBECHOPRT\fR\fR
1724 .RS 11n
1725 Echo erase character as character erased.
1729 .ne 2
1731 \fB\fBECHOKE\fR\fR
1733 .RS 11n
1734 \fBBS-SP-BS\fR erase entire line on line kill.
1738 .ne 2
1740 \fB\fBFLUSHO\fR\fR
1742 .RS 11n
1743 Output is being flushed.
1747 .ne 2
1749 \fB\fBPENDIN\fR\fR
1751 .RS 11n
1752 Retype pending input at next read or  input character.
1756 .ne 2
1758 \fB\fBIEXTEN\fR\fR
1760 .RS 11n
1761 Enable extended (implementation-defined) functions.
1766 If \fBISIG\fR is set, each input character is checked against the special
1767 control characters INTR, QUIT, SWTCH,  SUSP, STATUS, and \fBDSUSP\fR. If an
1768 input character matches one of these control characters, the function
1769 associated with that character is performed. (Note: If SWTCH is set and the
1770 character matches, the character is simply discarded. No other action is
1771 taken.) If \fBISIG\fR is not set, no checking is done.  Thus, these special
1772 input functions are possible only if \fBISIG\fR is set.
1775 If \fBICANON\fR is set, canonical processing is enabled. This enables the erase
1776 and kill edit functions, and the assembly of input characters into lines
1777 delimited by \fBNL-c\fR, \fBEOF\fR, \fBEOL\fR, and \fBEOL\fR . If  \fBICANON\fR
1778 is not set, read requests are satisfied directly from the input queue. A read
1779 is not satisfied until at least \fBMIN\fR characters have been  received or the
1780 timeout value \fBTIME\fR has expired between characters. This allows fast
1781 bursts of input to be read efficiently while still allowing single character
1782 input. The time value represents tenths of seconds.
1785 If  \fBXCASE\fR is set and \fBICANON\fR is set, an upper case letter is
1786 accepted on input if preceded by a backslash \fB(\e)\fR character, and is
1787 output preceded by a  backslash \fB(\e)\fR character. In this mode, the
1788 following escape sequences are generated on output and accepted on input:
1793 box;
1794 c | c
1795 l | l .
1796 FOR:    USE:
1798 `       \e'
1800 |       \e!
1802 \(ap    \e^
1804 {       \e(
1806 }       \e)
1808 \e      \e\e
1813 For example, input A as \ea, \en as \e\en, and \eN as \e\e\en.
1816 If \fBECHO\fR is set, characters are echoed as received.
1819 When \fBICANON\fR is set, the following echo functions are possible.
1820 .RS +4
1822 .ie t \(bu
1823 .el o
1824 If \fBECHO\fR and \fBECHOE\fR are set, and  \fBECHOPRT\fR is not set,  the
1825 \fBERASE\fR, \fBERASE2\fR, and \fBWERASE\fR characters are echoed as one or
1826 more ASCII BS SP BS, which clears the last character(s) from a \fBCRT\fR screen.
1828 .RS +4
1830 .ie t \(bu
1831 .el o
1832 If \fBECHO\fR, \fBECHOPRT\fR, and \fBIEXTEN\fR are set, the first \fBERASE\fR,
1833 \fBERASE2\fR, and \fBWERASE\fR character in a sequence echoes as a backslash
1834 (\fB\e\fR), followed by the characters being erased.  Subsequent \fBERASE\fR and
1835 \fBWERASE\fR characters echo the characters being erased, in reverse order. The
1836 next non-erase character causes a `/' (slash) to be typed before it is echoed.
1837 \fBECHOPRT\fR should be used for hard copy terminals.
1839 .RS +4
1841 .ie t \(bu
1842 .el o
1843 If  \fBECHOKE\fR and \fBIEXTEN\fR are set, the kill character is echoed by
1844 erasing each  character on the line from the screen (using the mechanism
1845 selected by \fBECHOE\fR and \fBECHOPR\fRa).
1847 .RS +4
1849 .ie t \(bu
1850 .el o
1851 If  \fBECHOK\fR is set, and \fBECHOKE\fR is not set, the \fBNL\fR character is
1852 echoed after the kill character to emphasize that the line is deleted. Note
1853 that a `\' (escape) character or an \fBLNEXT\fR character preceding the erase
1854 or kill character removes any special function.
1856 .RS +4
1858 .ie t \(bu
1859 .el o
1860 If  \fBECHONL\fR is set, the \fBNL\fR character is echoed even if  \fBECHO\fR
1861 is not set.  This is useful for terminals set to local echo (so called
1862 half-duplex).
1866 If \fBECHOCTL\fR and \fBIEXTEN\fR are set, all control characters (characters
1867 with codes between 0 and 37 octal) other than  \fBASCII TAB\fR, \fBASCII NL\fR,
1868 the \fBSTART\fR character, and the \fBSTOP\fR character,  \fBASCII CR\fR, and
1869 \fBASCII BS\fR are echoed as ^ \fBX,\fR where \fBX\fR is the character given by
1870 adding 100 octal to the code of the  control character (so that the character
1871 with octal code 1 is echoed as ^ \fBA),\fR and the \fBASCII DEL\fR character,
1872 with code 177 octal, is echoed as ^ \fB?\fR.
1875 If  \fBNOFLSH\fR is set, the normal flush of the input and output queues
1876 associated with the \fBINTR\fR, \fBQUIT\fR, \fBSTATUS\fR, and \fBSUSP\fR
1877 characters is not done.  This bit should be set when restarting system calls
1878 that read from or write to a terminal (see  \fBsigaction\fR(2)\|).
1881 If  \fBTOSTOP\fR and \fBIEXTEN\fR are set, the signal  \fBSIGTTOU\fR is sent to
1882 a process that tries to write to its controlling terminal if it is not in the
1883 foreground process group for that terminal. This signal normally stops the
1884 process. Otherwise, the output generated by that process is output to the
1885 current output stream. Processes that are blocking or ignoring  \fBSIGTTOU\fR
1886 signals are excepted and allowed to produce output, if any.
1889 If \fBFLUSHO\fR and \fBIEXTEN\fR are set, data written to the terminal is
1890 discarded. This bit is set when the \fBFLUSH\fR character is typed. A program
1891 can cancel the effect of typing the \fBFLUSH\fR character by clearing
1892 \fBFLUSHO\fR.
1895 If \fBPENDIN\fR and  \fBIEXTEN\fR are set, any input that has not yet been read
1896 is reprinted when the next character arrives as input. \fBPENDIN\fR is then
1897 automatically cleared.
1900 If \fBIEXTEN\fR is set, the following implementation-defined functions are
1901 enabled:  special characters ( \fBWERASE\fR, \fBREPRINT\fR, \fBDISCARD\fR, and
1902 \fBLNEXT\fR) and local flags ( \fBTOSTOP\fR, \fBECHOCTL\fR, \fBECHOPRT\fR,
1903 \fBECHOKE\fR, \fBFLUSHO\fR, and \fBPENDIN\fR).
1904 .SS "Minimum and Timeout"
1906 The \fBMIN\fR and \fBTIME\fR values were described previously, in the
1907 subsection, \fBNon-canonical Mode Input Processing\fR. The initial value of
1908 \fBMIN\fR is 1, and the initial value of \fBTIME\fR is 0.
1909 .SS "Terminal Size"
1911 The number of lines and columns on the terminal's display is specified in the
1912 \fBwinsize\fR structure defined by  \fBsys/termios.h\fR and includes the
1913 following members:
1915 .in +2
1917 unsigned        short ws_row;  /* rows, in characters */
1918 unsigned short  ws_col;    /* columns, in characters */
1919 unsigned short  ws_xpixel; /* horizontal size, in pixels */
1920 unsigned short  ws_ypixel; /* vertical size, in pixels */
1922 .in -2
1924 .SS "Termio Structure"
1926 The SunOS/SVR4 \fBtermio\fR structure is used by some \fBioctl\fRs; it is
1927 defined by \fBsys/termio.h\fR and includes the following members:
1929 .in +2
1931 unsigned         short  c_iflag;  /* input modes */
1932 unsigned         short  c_oflag;  /* output modes */
1933 unsigned         short  c_cflag;  /* control modes */
1934 unsigned         short c_lflag; /* local modes */
1935 char c_line;                      /* line discipline */
1936 unsigned         char  c_cc[NCC];  /* control chars */
1938 .in -2
1942 The special control characters are defined by the array \fBc_cc\fR. The
1943 symbolic name \fBNCC\fR is the size of the Control-character array and is also
1944 defined by \fBtermio.h\fR. The relative positions, subscript names, and typical
1945 default values  for each function are as follows:
1950 box;
1951 c | c | c
1952 l | l | l .
1953 Relative Positions      Subscript Names Typical Default Values
1955 0       VINTR   EXT
1957 1       VQUIT   FS
1959 2       VERASE  DEL
1961 3       VKILL   NAK
1963 4       VEOF    EOT
1965 5       VEOL    NUL
1967 6       VEOL2   NUL
1969 7       Reserved        
1974 The \fBMIN\fR values is stored in the \fBVMIN\fR element of the \fBc_cc\fR
1975 array; the \fBTIME\fR value is stored in the  \fBVTIME\fR element of the
1976 \fBc_cc\fR array. The  \fBVMIN\fR element is the same element as the
1977 \fBVEOF\fR element; the \fBVTIME\fR element is the same element as the
1978 \fBVEOL\fR element.
1981 The calls that use the \fBtermio\fR structure only affect the flags and control
1982 characters that can be stored in the \fBtermio\fR structure; all other flags
1983 and control characters are unaffected.
1984 .SS "Modem Lines"
1986 On special files representing serial ports, modem control lines can be read.
1987 Control lines  (if the underlying hardware supports it) may also be changed.
1988 Status lines are read-only. The following modem control and status lines may be
1989 supported by a device; they are defined by \fBsys/termios.h\fR:
1991 .ne 2
1993 \fB\fBTIOCM_LE\fR\fR
1995 .RS 13n
1996  line enable
2000 .ne 2
2002 \fB\fBTIOCM_DTR\fR\fR
2004 .RS 13n
2005 data terminal ready
2009 .ne 2
2011 \fB\fBTIOCM_RTS\fR\fR
2013 .RS 13n
2014 request to send
2018 .ne 2
2020 \fB\fBTIOCM_ST\fR\fR
2022 .RS 13n
2023 secondary transmit
2027 .ne 2
2029 \fB\fBTIOCM_SR\fR\fR
2031 .RS 13n
2032 secondary receive
2036 .ne 2
2038 \fB\fBTIOCM_CTS\fR\fR
2040 .RS 13n
2041 clear to send
2045 .ne 2
2047 \fB\fBTIOCM_CAR\fR\fR
2049 .RS 13n
2050 carrier detect
2054 .ne 2
2056 \fB\fBTIOCM_RNG\fR\fR
2058 .RS 13n
2059 ring
2063 .ne 2
2065 \fB\fBTIOCM_DSR\fR\fR
2067 .RS 13n
2068 data set ready
2073 \fBTIOCM_CD\fR is a synonym for \fBTIOCM_CAR\fR, and \fBTIOCM_RI\fR is a
2074 synonym for \fBTIOCM_RNG\fR. Not all of these are necessarily supported by any
2075 particular device; check the manual page for the device in question.
2078 The software carrier mode can be enabled or disabled using the
2079 \fBTIOCSSOFTCAR\fR \fBioctl\fR. If the software carrier flag for a line is off,
2080 the line pays attention to the hardware carrier detect (DCD) signal. The
2081 \fBtty\fR device associated with the line cannot be opened until \fBDCD\fR is
2082 asserted. If the software carrier flag is on, the line behaves as if \fBDCD\fR
2083 is always asserted.
2086 The software carrier flag is usually turned on for locally connected terminals
2087 or other devices, and is off for lines with modems.
2090 To be able to issue the \fBTIOCGSOFTCAR\fR and \fBTIOCSSOFTCAR\fR \fBioctl\fR
2091 calls, the \fBtty\fR line should be opened with \fBO_NDELAY\fR so that the
2092 \fBopen\fR(2) will not wait for the carrier.
2093 .SS "Default Values"
2095 The initial  \fBtermios\fR values upon driver open is configurable. This is
2096 accomplished by setting the "ttymodes" property in the file
2097 \fB/kernel/drv/options.conf\fR. Since this property is assigned during system
2098 initialization,  any change to the "ttymodes" property will not take effect
2099 until the next reboot.  The string value assigned to this property should be in
2100 the same format as the output of the \fBstty\fR(1) command with the -g option.
2103 If this property is undefined, the following  \fBtermios\fR modes are in
2104 effect.  The initial input control value is \fBBRKINT\fR, \fBICRNL\fR,
2105 \fBIXON\fR, \fBIMAXBEL\fR. The initial output control value is \fBOPOST\fR,
2106 \fBONLCR\fR, \fBTAB3\fR. The initial hardware control value is \fBB9600\fR,
2107 \fBCS8\fR, \fBCREAD\fR. The initial line-discipline control value is
2108 \fBISIG\fR, \fBICANON\fR, \fBIEXTEN\fR, \fBECHO\fR, \fBECHOK\fR, \fBECHOE\fR,
2109 \fBECHOKE\fR, \fBECHOCTL\fR.
2110 .SH IOCTLS
2112 The \fBioctl\fRs supported by devices and \fBSTREAMS\fR modules providing the
2113 \fBtermios\fR(3C) interface are listed below. Some calls may not be supported
2114 by all devices or modules.  The functionality provided by these calls is also
2115 available through the preferred function call interface specified on
2116 \fBtermios\fR.
2118 .ne 2
2120 \fB\fBTCGETS\fR\fR
2122 .RS 16n
2123 The argument is a pointer to a \fBtermios\fR structure. The current terminal
2124 parameters are fetched and stored into that structure.
2128 .ne 2
2130 \fB\fBTCSETS\fR\fR
2132 .RS 16n
2133 The argument is a pointer to a \fBtermios\fR structure. The current terminal
2134 parameters are set from the values stored in that structure. The change is
2135 immediate.
2139 .ne 2
2141 \fB\fBTCSETSW\fR\fR
2143 .RS 16n
2144 The argument is a pointer to a \fBtermios\fR structure. The current terminal
2145 parameters are set from the values stored in that structure. The change occurs
2146 after all characters queued for output have been transmitted. This form should
2147 be used when changing parameters that affect output.
2151 .ne 2
2153 \fB\fBTCSETSF\fR\fR
2155 .RS 16n
2156 The argument is a pointer to a \fBtermios\fR structure. The current terminal
2157 parameters are set from the values stored in that structure. The change occurs
2158 after all characters queued for output have been transmitted; all characters
2159 queued for input are discarded and then the change occurs.
2163 .ne 2
2165 \fB\fBTCGETA\fR\fR
2167 .RS 16n
2168 The argument is a pointer to a \fBtermio\fR structure. The current terminal
2169 parameters are fetched, and those parameters that can be stored in a
2170 \fBtermio\fR structure are stored into that structure.
2174 .ne 2
2176 \fB\fBTCSETA\fR\fR
2178 .RS 16n
2179 The argument is a pointer to a  \fBtermio\fR structure. Those terminal
2180 parameters that can be stored in a \fBtermio\fR structure are set from the
2181 values stored in that structure. The change is immediate.
2185 .ne 2
2187 \fB\fBTCSETAW\fR\fR
2189 .RS 16n
2190 The argument is a pointer to a \fBtermio\fR structure. Those terminal
2191 parameters that can be stored in a \fBtermio\fR structure are set from the
2192 values stored in that structure. The change occurs after all characters queued
2193 for output have been transmitted. This form should be used when changing
2194 parameters that affect output.
2198 .ne 2
2200 \fB\fBTCSETAF\fR\fR
2202 .RS 16n
2203 The argument is a pointer to a \fBtermio\fR structure.  Those terminal
2204 parameters that can be stored in a \fBtermio\fR structure are set from the
2205 values stored in that structure. The change occurs after all characters queued
2206 for output have been transmitted; all characters queued for input are discarded
2207 and then the change occurs.
2211 .ne 2
2213 \fB\fBTCSBRK\fR\fR
2215 .RS 16n
2216 The argument is an \fBint\fR value. Wait for the output to drain. If the
2217 argument is \fB0\fR, then send a break (zero valued bits for 0.25 seconds).
2221 .ne 2
2223 \fB\fBTCXONC\fR\fR
2225 .RS 16n
2226 Start/stop control. The argument is an \fBint\fR value. If the argument is
2227 \fB0\fR, suspend output; if \fB1\fR, restart suspended output; if \fB2\fR,
2228 suspend input; if \fB3\fR, restart suspended input.
2232 .ne 2
2234 \fB\fBTCFLSH\fR\fR
2236 .RS 16n
2237 The argument is an \fBint\fR value. If the argument is \fB0\fR, flush the input
2238 queue; if \fB1\fR, flush the output queue; if \fB2\fR, flush both the input and
2239 output queues.
2243 .ne 2
2245 \fB\fBTIOCGPGRP\fR\fR
2247 .RS 16n
2248 The argument is a pointer to a \fBpid_t\fR. Set the value of that  \fBpid_t\fR
2249 to the process group \fBID\fR of the foreground process group associated with
2250 the terminal. See  \fBtermios\fR(3C) for a description of  \fBTCGETPGRP\fR.
2254 .ne 2
2256 \fB\fBTIOCSPGRP\fR\fR
2258 .RS 16n
2259 The argument is a pointer to a \fBpid_t\fR. Associate the process group whose
2260 process group \fBID\fR is specified by the value of that  \fBpid_t\fR with the
2261 terminal. The new process group value must be in the range of valid process
2262 group \fBID\fR values.  Otherwise, the error  \fBEPERM\fR is returned.
2266 .ne 2
2268 \fB\fBTIOCGSID\fR\fR
2270 .RS 16n
2271 The argument is a pointer to a \fBpid_t\fR. The session ID of the terminal is
2272 fetched  and stored in the  \fBpid_t\fR.
2276 .ne 2
2278 \fB\fBTIOCGWINSZ\fR\fR
2280 .RS 16n
2281 The argument is a pointer to a \fBwinsize\fR structure. The terminal driver's
2282 notion of the terminal size is stored into that structure.
2286 .ne 2
2288 \fB\fBTIOCSWINSZ\fR\fR
2290 .RS 16n
2291 The argument is a pointer to a \fBwinsize\fR structure. The terminal driver's
2292 notion of the terminal size is set from the values specified in that structure.
2293 If the new sizes are different from the old sizes, a \fBSIGWINCH\fR signal is
2294 set to the process group of the terminal.
2298 .ne 2
2300 \fB\fBTIOCMBIS\fR\fR
2302 .RS 16n
2303 The argument is a pointer to an \fBint\fR whose value is a mask containing
2304 modem control lines to be turned on. The control lines whose bits are set in
2305 the argument are turned on; no other control lines are affected.
2309 .ne 2
2311 \fB\fBTIOCMBIC\fR\fR
2313 .RS 16n
2314 The argument is a pointer to an \fBint\fR whose value is a mask containing
2315 modem control lines to be turned off. The control lines whose bits are set in
2316 the argument are turned off; no other control lines are affected.
2320 .ne 2
2322 \fB\fBTIOCMGET\fR\fR
2324 .RS 16n
2325 The argument is a pointer to an  \fBint\fR. The current state of the modem
2326 status lines is fetched and stored in the  \fBint\fR pointed to by the
2327 argument.
2331 .ne 2
2333 \fB\fBTIOCMSET\fR\fR
2335 .RS 16n
2336 The argument is a pointer to an  \fBint\fR containing a new set of modem
2337 control lines. The modem control lines are turned on or off, depending on
2338 whether the bit for that mode is set or clear.
2342 .ne 2
2344 \fB\fBTIOCSPPS\fR\fR
2346 .RS 16n
2347 The argument is a pointer to an \fBint\fR that determines whether
2348 pulse-per-second event handling is to be enabled (non-zero) or disabled (zero).
2349 If a one-pulse-per-second reference clock is attached to the serial line's data
2350 carrier detect input, the local system clock will be calibrated to it. A clock
2351 with a high error, that is, a deviation of more than 25 microseconds per tick,
2352 is ignored.
2356 .ne 2
2358 \fB\fBTIOCGPPS\fR\fR
2360 .RS 16n
2361 The argument is a pointer to an \fBint\fR, in which the state of the even
2362 handling is returned. The \fBint\fR is set to a non-zero value if
2363 pulse-per-second (PPS) handling has been enabled. Otherwise, it is set to zero.
2367 .ne 2
2369 \fB\fBTIOCGSOFTCAR\fR\fR
2371 .RS 16n
2372 The argument is a pointer to an \fBint\fR whose value is \fB1\fR or \fB0\fR,
2373 depending on whether the software carrier detect is turned on or off.
2377 .ne 2
2379 \fB\fBTIOCSSOFTCAR\fR\fR
2381 .RS 16n
2382 The argument is a pointer to an \fBint\fR whose value is \fB1\fR or \fB0\fR.
2383 The value of the integer should be \fB0\fR to turn off software carrier, or
2384 \fB1\fR to turn it on.
2388 .ne 2
2390 \fB\fBTIOCGPPSEV\fR\fR
2392 .RS 16n
2393 The argument is a pointer to a \fBstruct\fR \fBppsclockev\fR. This structure
2394 contains the following members:
2396 .in +2
2398 struct timeval tv;
2399 uint32_t serial;
2401 .in -2
2403 "tv" is the system clock timestamp when the event (pulse on the \fBDCD\fR pin)
2404 occurred. "serial" is the ordinal of the event, which each consecutive event
2405 being assigned the next ordinal. The first event registered gets a "serial"
2406 value of \fB1\fR. The \fBTIOCGPPSEV\fR returns the last event registered;
2407 multiple calls will persistently return the same event until a new one is
2408 registered. In addition to time stamping and saving the event, if it is of
2409 one-second period and of consistently high accuracy, the local system clock
2410 will automatically calibrate to it.
2413 .SH FILES
2415 Files in or under /\fBdev\fR
2416 .SH SEE ALSO
2418 \fBstty\fR(1), \fBfork\fR(2), \fBgetpgid\fR(2), \fBgetsid\fR(2),
2419 \fBioctl\fR(2), \fBsetsid\fR(2), \fBsigaction\fR(2), \fBsignal\fR(3C),
2420 \fBtcsetpgrp\fR(3C), \fBtermios\fR(3C), \fBsignal.h\fR(3HEAD),
2421 \fBstreamio\fR(7I)