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>
  15 
  16 \fB\fR\fBioctl\fR(\fBint\fR \fIfildes\fR, \fBint\fR \fIrequest\fR, \fBstruct termio *\fR\fIarg\fR);
  17 .fi
  18 
  19 .LP
  20 .nf
  21 \fB\fR\fBioctl\fR(\fBint\fR \fIfildes\fR, \fBint\fR \fIrequest\fR, \fBint\fR \fIarg\fR);
  22 .fi
  23 
  24 .LP
  25 .nf
  26 #include <termios.h>
  27 
  28 \fB\fR\fBioctl\fR(\fBint\fR \fIfildes\fR, \fBint\fR \fIrequest\fR, \fBstruct termios *\fR\fIarg\fR);
  29 .fi
  30 
  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.
 102 .sp
 103 .LP
 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"
 114 .LP
 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.
 122 .sp
 123 .LP
 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.
 139 .sp
 140 .LP
 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"
 146 .LP
 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.
 150 .sp
 151 .LP
 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.
 157 .sp
 158 .ne 2
 159 .na
 160 \fBCase A: MIN > 0, TIME > 0\fR
 161 .ad
 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.
 178 .RE
 179 
 180 .sp
 181 .ne 2
 182 .na
 183 \fBCase B: MIN > 0, TIME = 0\fR
 184 .ad
 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.
 191 .RE
 192 
 193 .sp
 194 .ne 2
 195 .na
 196 \fBCase C: MIN = 0, TIME > 0\fR
 197 .ad
 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.
 208 .RE
 209 
 210 .sp
 211 .ne 2
 212 .na
 213 \fBCase D: MIN = 0, TIME = 0\fR
 214 .ad
 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.
 219 .RE
 220 
 221 .SS "Comparing Different Cases of MIN, TIME Interaction"
 222 .LP
 223 Some points to note about  \fBMIN\fR and  \fBTIME\fR :
 224 .RS +4
 225 .TP
 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.
 233 .RE
 234 .RS +4
 235 .TP
 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.
 241 .RE
 242 .sp
 243 .LP
 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.
 249 .sp
 250 .LP
 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.
 255 .sp
 256 .LP
 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"
 262 .LP
 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"
 270 .LP
 271 Certain characters have special functions on input. These functions and their
 272 default character values are summarized as follows:
 273 .sp
 274 .ne 2
 275 .na
 276 \fB\fBINTR\fR\fR
 277 .ad
 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)).
 284 .RE
 285 
 286 .sp
 287 .ne 2
 288 .na
 289 \fB\fBQUIT\fR\fR
 290 .ad
 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.
 296 .RE
 297 
 298 .sp
 299 .ne 2
 300 .na
 301 \fB\fBERASE\fR\fR
 302 .ad
 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.
 307 .RE
 308 
 309 .sp
 310 .ne 2
 311 .na
 312 \fB\fBERASE2\fR\fR
 313 .ad
 314 .RS 11n
 315 (Control-h or \fBASCII BS\fR) erases the preceding character, with behaviour
 316 identical to that of ERASE.
 317 .RE
 318 
 319 .sp
 320 .ne 2
 321 .na
 322 \fB\fBWERASE\fR\fR
 323 .ad
 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.
 328 .RE
 329 
 330 .sp
 331 .ne 2
 332 .na
 333 \fB\fBKILL\fR\fR
 334 .ad
 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.
 338 .RE
 339 
 340 .sp
 341 .ne 2
 342 .na
 343 \fB\fBREPRINT\fR\fR
 344 .ad
 345 .RS 11n
 346 (Control-r or \fBASCII DC2\fR) reprints all characters, preceded by a newline,
 347 that have not been read.
 348 .RE
 349 
 350 .sp
 351 .ne 2
 352 .na
 353 \fB\fBEOF\fR\fR
 354 .ad
 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.
 364 .RE
 365 
 366 .sp
 367 .ne 2
 368 .na
 369 \fB\fBNL\fR\fR
 370 .ad
 371 .RS 11n
 372 (ASCII LF) is the normal line delimiter. It cannot be changed or escaped.
 373 .RE
 374 
 375 .sp
 376 .ne 2
 377 .na
 378 \fB\fBEOL\fR\fR
 379 .ad
 380 .RS 11n
 381 (ASCII NULL) is an additional line delimiter, like \fBNL\fR . It is not
 382 normally used.
 383 .RE
 384 
 385 .sp
 386 .ne 2
 387 .na
 388 \fB\fBEOL2\fR\fR
 389 .ad
 390 .RS 11n
 391 is another additional line delimiter.
 392 .RE
 393 
 394 .sp
 395 .ne 2
 396 .na
 397 \fB\fBSWTCH\fR\fR
 398 .ad
 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).
 403 .RE
 404 
 405 .sp
 406 .ne 2
 407 .na
 408 \fB\fBSUSP\fR\fR
 409 .ad
 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.
 413 .RE
 414 
 415 .sp
 416 .ne 2
 417 .na
 418 \fB\fBDSUSP\fR\fR
 419 .ad
 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.
 425 .RE
 426 
 427 .sp
 428 .ne 2
 429 .na
 430 \fB\fBSTOP\fR\fR
 431 .ad
 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.
 437 .RE
 438 
 439 .sp
 440 .ne 2
 441 .na
 442 \fB\fBSTART\fR\fR
 443 .ad
 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.
 448 .RE
 449 
 450 .sp
 451 .ne 2
 452 .na
 453 \fB\fBDISCARD\fR\fR
 454 .ad
 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.
 459 .RE
 460 
 461 .sp
 462 .ne 2
 463 .na
 464 \fB\fBSTATUS\fR\fR
 465 .ad
 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\fR(1M). If a process does not have a \fBSIGINFO\fR handler, the
 470 signal will be ignored.
 471 .RE
 472 
 473 .sp
 474 .ne 2
 475 .na
 476 \fB\fBLNEXT\fR\fR
 477 .ad
 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.
 494 .RE
 495 
 496 .SS "Modem Disconnect"
 497 .LP
 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.
 503 .sp
 504 .LP
 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.
 509 .sp
 510 .LP
 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.
 516 .sp
 517 .LP
 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"
 522 .LP
 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:
 527 .sp
 528 .in +2
 529 .nf
 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 */
 535 .fi
 536 .in -2
 537 
 538 .sp
 539 .LP
 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:
 544 .sp
 545 
 546 .sp
 547 .TS
 548 box;
 549 c | c | c
 550 l | l | l .
 551 Relative Position       Subscript Name  Typical Default Value
 552 _
 553 0       VINTR   ETX
 554 _
 555 1       VQUIT   FS
 556 _
 557 2       VERASE  DEL
 558 _
 559 3       VKILL   NAK
 560 _
 561 4       VEOF    EOT
 562 _
 563 5       VEOL    NUL
 564 _
 565 6       VEOL2   NUL
 566 _
 567 7       VWSTCH  NUL
 568 _
 569 8       VSTART  NUL
 570 _
 571 9       VSTOP   DC3
 572 _
 573 10      VSUSP   SUB
 574 _
 575 11      VDSUSP  EM
 576 _
 577 12      VREPRINT        DC2
 578 _
 579 13      VDISCARD        SI
 580 _
 581 14      VWERASE ETB
 582 _
 583 15      VLNEXT  SYN
 584 _
 585 16      VSTATUS DC4
 586 _
 587 17      VERASE2 BS
 588 _
 589 18-19   Reserved
 590 .TE
 591 
 592 .SS "Input Modes"
 593 .LP
 594 The \fBc_iflag\fR field describes the basic terminal input control:
 595 .sp
 596 .ne 2
 597 .na
 598 \fB\fBIGNBRK\fR\fR
 599 .ad
 600 .RS 11n
 601  Ignore break condition.
 602 .RE
 603 
 604 .sp
 605 .ne 2
 606 .na
 607 \fB\fBBRKINT\fR\fR
 608 .ad
 609 .RS 11n
 610 Signal interrupt on break.
 611 .RE
 612 
 613 .sp
 614 .ne 2
 615 .na
 616 \fB\fBIGNPAR\fR\fR
 617 .ad
 618 .RS 11n
 619 Ignore characters with parity errors.
 620 .RE
 621 
 622 .sp
 623 .ne 2
 624 .na
 625 \fB\fBPARMRK\fR\fR
 626 .ad
 627 .RS 11n
 628 Mark parity errors.
 629 .RE
 630 
 631 .sp
 632 .ne 2
 633 .na
 634 \fB\fBINPCK\fR\fR
 635 .ad
 636 .RS 11n
 637 Enable input parity check.
 638 .RE
 639 
 640 .sp
 641 .ne 2
 642 .na
 643 \fB\fBISTRIP\fR\fR
 644 .ad
 645 .RS 11n
 646 Strip character.
 647 .RE
 648 
 649 .sp
 650 .ne 2
 651 .na
 652 \fB\fBINLCR\fR\fR
 653 .ad
 654 .RS 11n
 655 Map NL to CR on input.
 656 .RE
 657 
 658 .sp
 659 .ne 2
 660 .na
 661 \fB\fBIGNCR\fR\fR
 662 .ad
 663 .RS 11n
 664 Ignore CR.
 665 .RE
 666 
 667 .sp
 668 .ne 2
 669 .na
 670 \fB\fBICRNL\fR\fR
 671 .ad
 672 .RS 11n
 673 Map CR to NL on input.
 674 .RE
 675 
 676 .sp
 677 .ne 2
 678 .na
 679 \fB\fBIUCLC\fR\fR
 680 .ad
 681 .RS 11n
 682 Map upper-case to lower-case on input.
 683 .RE
 684 
 685 .sp
 686 .ne 2
 687 .na
 688 \fB\fBIXON\fR\fR
 689 .ad
 690 .RS 11n
 691 Enable start/stop output control.
 692 .RE
 693 
 694 .sp
 695 .ne 2
 696 .na
 697 \fB\fBIXANY\fR\fR
 698 .ad
 699 .RS 11n
 700 Enable any character to restart output.
 701 .RE
 702 
 703 .sp
 704 .ne 2
 705 .na
 706 \fB\fBIXOFF\fR\fR
 707 .ad
 708 .RS 11n
 709 Enable start/stop input control.
 710 .RE
 711 
 712 .sp
 713 .ne 2
 714 .na
 715 \fB\fBIMAXBEL\fR\fR
 716 .ad
 717 .RS 11n
 718 Echo  \fBBEL\fR on input line too long.
 719 .RE
 720 
 721 .sp
 722 .LP
 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.
 734 .sp
 735 .LP
 736 If  \fBIGNPAR\fR is set, a byte with framing or parity errors (other than
 737 break)  is ignored.
 738 .sp
 739 .LP
 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.
 749 .sp
 750 .LP
 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.
 759 .sp
 760 .LP
 761 If \fBISTRIP\fR is set, valid input characters are first stripped to seven
 762 bits, otherwise all eight bits are processed.
 763 .sp
 764 .LP
 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.
 769 .sp
 770 .LP
 771 If \fBIUCLC\fR is set, a received upper case, alphabetic character is
 772 translated into the corresponding lower case character.
 773 .sp
 774 .LP
 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.
 780 .sp
 781 .LP
 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.
 785 .sp
 786 .LP
 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"
 793 .LP
 794 The  \fBc_oflag\fR field specifies the  system treatment of output:
 795 .sp
 796 .ne 2
 797 .na
 798 \fB\fBOPOST\fR\fR
 799 .ad
 800 .RS 10n
 801 Post-process output.
 802 .RE
 803 
 804 .sp
 805 .ne 2
 806 .na
 807 \fB\fBOLCUC\fR\fR
 808 .ad
 809 .RS 10n
 810 Map lower case to upper on output.
 811 .RE
 812 
 813 .sp
 814 .ne 2
 815 .na
 816 \fB\fBONLCR\fR\fR
 817 .ad
 818 .RS 10n
 819 Map NL to CR-NL on output.
 820 .RE
 821 
 822 .sp
 823 .ne 2
 824 .na
 825 \fB\fBOCRNL\fR\fR
 826 .ad
 827 .RS 10n
 828 Map CR to NL on output.
 829 .RE
 830 
 831 .sp
 832 .ne 2
 833 .na
 834 \fB\fBONOCR\fR\fR
 835 .ad
 836 .RS 10n
 837 No \fBCR\fR output at column 0.
 838 .RE
 839 
 840 .sp
 841 .ne 2
 842 .na
 843 \fB\fBONLRET\fR\fR
 844 .ad
 845 .RS 10n
 846 \fBNL\fR performs \fBCR\fR function.
 847 .RE
 848 
 849 .sp
 850 .ne 2
 851 .na
 852 \fB\fBOFILL\fR\fR
 853 .ad
 854 .RS 10n
 855 Use fill characters for delay.
 856 .RE
 857 
 858 .sp
 859 .ne 2
 860 .na
 861 \fB\fBOFDEL\fR\fR
 862 .ad
 863 .RS 10n
 864 Fill is \fBDEL\fR, else \fINULL\fR.
 865 .RE
 866 
 867 .sp
 868 .ne 2
 869 .na
 870 \fB\fBNLDLY\fR\fR
 871 .ad
 872 .RS 10n
 873 Select newline delays:
 874 .br
 875 .in +2
 876 \fBNL0\fR
 877 .in -2
 878 .br
 879 .in +2
 880 \fBNL1\fR
 881 .in -2
 882 .RE
 883 
 884 .sp
 885 .ne 2
 886 .na
 887 \fB\fBCRDLY\fR\fR
 888 .ad
 889 .RS 10n
 890 Select carriage-return delays:
 891 .br
 892 .in +2
 893 \fBCR0\fR
 894 .in -2
 895 .br
 896 .in +2
 897 \fBCR1\fR
 898 .in -2
 899 .br
 900 .in +2
 901 \fBCR2\fR
 902 .in -2
 903 .br
 904 .in +2
 905 \fBCR3\fR
 906 .in -2
 907 .RE
 908 
 909 .sp
 910 .ne 2
 911 .na
 912 \fB\fBTABDLY\fR\fR
 913 .ad
 914 .RS 10n
 915 Select horizontal tab delays or tab expansion:
 916 .sp
 917 .ne 2
 918 .na
 919 \fB\fBTAB0\fR\fR
 920 .ad
 921 .RS 9n
 922 
 923 .RE
 924 
 925 .sp
 926 .ne 2
 927 .na
 928 \fB\fBTAB1\fR\fR
 929 .ad
 930 .RS 9n
 931 
 932 .RE
 933 
 934 .sp
 935 .ne 2
 936 .na
 937 \fB\fBTAB2\fR\fR
 938 .ad
 939 .RS 9n
 940 
 941 .RE
 942 
 943 .sp
 944 .ne 2
 945 .na
 946 \fB\fBTAB3\fR\fR
 947 .ad
 948 .RS 9n
 949 Expand tabs to spaces
 950 .RE
 951 
 952 .sp
 953 .ne 2
 954 .na
 955 \fB\fBXTABS\fR\fR
 956 .ad
 957 .RS 9n
 958 Expand tabs to spaces
 959 .RE
 960 
 961 .RE
 962 
 963 .sp
 964 .ne 2
 965 .na
 966 \fB\fBBSDLY\fR\fR
 967 .ad
 968 .RS 10n
 969 Select backspace delays:
 970 .br
 971 .in +2
 972 \fBBS0\fR
 973 .in -2
 974 .br
 975 .in +2
 976 \fBBS1\fR
 977 .in -2
 978 .RE
 979 
 980 .sp
 981 .ne 2
 982 .na
 983 \fB\fBVTDLY\fR\fR
 984 .ad
 985 .RS 10n
 986 Select vertical tab delays:
 987 .br
 988 .in +2
 989 \fBVT0\fR
 990 .in -2
 991 .br
 992 .in +2
 993 \fBVT1\fR
 994 .in -2
 995 .RE
 996 
 997 .sp
 998 .ne 2
 999 .na
1000 \fB\fBFFDLY\fR\fR
1001 .ad
1002 .RS 10n
1003 Select form feed delays:
1004 .br
1005 .in +2
1006 \fBFF0\fR
1007 .in -2
1008 .br
1009 .in +2
1010 \fBFF1\fR
1011 .in -2
1012 .RE
1013 
1014 .sp
1015 .LP
1016 If \fBOPOST\fR is set, output characters are post-processed as indicated by the
1017 remaining flags; otherwise, characters are transmitted without change.
1018 .sp
1019 .LP
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
1023 .sp
1024 .LP
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.
1034 .sp
1035 .LP
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.
1042 .sp
1043 .LP
1044 If a form-feed or vertical-tab delay is specified, it lasts for about 2
1045 seconds.
1046 .sp
1047 .LP
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.
1051 .sp
1052 .LP
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.
1057 .sp
1058 .LP
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.
1063 .sp
1064 .LP
1065 Backspace delay lasts about 0.05 seconds. If  \fBOFILL\fR is set, one fill
1066 character is transmitted.
1067 .sp
1068 .LP
1069 The actual delays depend on line speed and system load.
1070 .SS "Control Modes"
1071 .LP
1072 The \fBc_cflag\fR field describes the hardware control of the terminal:
1073 .sp
1074 .ne 2
1075 .na
1076 \fB\fBCBAUD\fR\fR
1077 .ad
1078 .RS 13n
1079 Baud rate:
1080 .RE
1081 
1082 .sp
1083 .ne 2
1084 .na
1085 \fB\fBB0\fR\fR
1086 .ad
1087 .RS 13n
1088 Hang up
1089 .RE
1090 
1091 .sp
1092 .ne 2
1093 .na
1094 \fB\fBB50\fR\fR
1095 .ad
1096 .RS 13n
1097 50 baud
1098 .RE
1099 
1100 .sp
1101 .ne 2
1102 .na
1103 \fB\fBB75\fR\fR
1104 .ad
1105 .RS 13n
1106 75 baud
1107 .RE
1108 
1109 .sp
1110 .ne 2
1111 .na
1112 \fB\fBB110\fR\fR
1113 .ad
1114 .RS 13n
1115 110 baud
1116 .RE
1117 
1118 .sp
1119 .ne 2
1120 .na
1121 \fB\fBB134\fR\fR
1122 .ad
1123 .RS 13n
1124 134 baud
1125 .RE
1126 
1127 .sp
1128 .ne 2
1129 .na
1130 \fB\fBB150\fR\fR
1131 .ad
1132 .RS 13n
1133 150 baud
1134 .RE
1135 
1136 .sp
1137 .ne 2
1138 .na
1139 \fB\fBB200\fR\fR
1140 .ad
1141 .RS 13n
1142 200 baud
1143 .RE
1144 
1145 .sp
1146 .ne 2
1147 .na
1148 \fB\fBB300\fR\fR
1149 .ad
1150 .RS 13n
1151 300 baud
1152 .RE
1153 
1154 .sp
1155 .ne 2
1156 .na
1157 \fB\fBB600\fR\fR
1158 .ad
1159 .RS 13n
1160 600 baud
1161 .RE
1162 
1163 .sp
1164 .ne 2
1165 .na
1166 \fB\fBB1200\fR\fR
1167 .ad
1168 .RS 13n
1169 1200 baud
1170 .RE
1171 
1172 .sp
1173 .ne 2
1174 .na
1175 \fB\fBB1800\fR\fR
1176 .ad
1177 .RS 13n
1178 1800 baud
1179 .RE
1180 
1181 .sp
1182 .ne 2
1183 .na
1184 \fB\fBB2400\fR\fR
1185 .ad
1186 .RS 13n
1187 2400 baud
1188 .RE
1189 
1190 .sp
1191 .ne 2
1192 .na
1193 \fB\fBB4800\fR\fR
1194 .ad
1195 .RS 13n
1196 4800 baud
1197 .RE
1198 
1199 .sp
1200 .ne 2
1201 .na
1202 \fB\fBB9600\fR\fR
1203 .ad
1204 .RS 13n
1205 9600 baud
1206 .RE
1207 
1208 .sp
1209 .ne 2
1210 .na
1211 \fB\fBB19200\fR\fR
1212 .ad
1213 .RS 13n
1214 19200 baud
1215 .RE
1216 
1217 .sp
1218 .ne 2
1219 .na
1220 \fB\fBEXTA\fR\fR
1221 .ad
1222 .RS 13n
1223 External A
1224 .RE
1225 
1226 .sp
1227 .ne 2
1228 .na
1229 \fB\fBB38400\fR\fR
1230 .ad
1231 .RS 13n
1232 38400 baud
1233 .RE
1234 
1235 .sp
1236 .ne 2
1237 .na
1238 \fB\fBEXTB\fR\fR
1239 .ad
1240 .RS 13n
1241 External B
1242 .RE
1243 
1244 .sp
1245 .ne 2
1246 .na
1247 \fB\fBB57600\fR\fR
1248 .ad
1249 .RS 13n
1250 57600 baud
1251 .RE
1252 
1253 .sp
1254 .ne 2
1255 .na
1256 \fB\fBB76800\fR\fR
1257 .ad
1258 .RS 13n
1259 76800 baud
1260 .RE
1261 
1262 .sp
1263 .ne 2
1264 .na
1265 \fB\fBB115200\fR\fR
1266 .ad
1267 .RS 13n
1268 115200 baud
1269 .RE
1270 
1271 .sp
1272 .ne 2
1273 .na
1274 \fB\fBB153600\fR\fR
1275 .ad
1276 .RS 13n
1277 153600 baud
1278 .RE
1279 
1280 .sp
1281 .ne 2
1282 .na
1283 \fB\fBB230400\fR\fR
1284 .ad
1285 .RS 13n
1286 230400 baud
1287 .RE
1288 
1289 .sp
1290 .ne 2
1291 .na
1292 \fB\fBB307200\fR\fR
1293 .ad
1294 .RS 13n
1295 307200 baud
1296 .RE
1297 
1298 .sp
1299 .ne 2
1300 .na
1301 \fB\fBB460800\fR\fR
1302 .ad
1303 .RS 13n
1304 460800 baud
1305 .RE
1306 
1307 .sp
1308 .ne 2
1309 .na
1310 \fB\fBCSIZE\fR\fR
1311 .ad
1312 .RS 13n
1313 Character size:
1314 .RE
1315 
1316 .sp
1317 .ne 2
1318 .na
1319 \fB\fBCS5\fR\fR
1320 .ad
1321 .RS 13n
1322 5 bits
1323 .RE
1324 
1325 .sp
1326 .ne 2
1327 .na
1328 \fB\fBCS6\fR\fR
1329 .ad
1330 .RS 13n
1331 6 bits
1332 .RE
1333 
1334 .sp
1335 .ne 2
1336 .na
1337 \fB\fBCS7\fR\fR
1338 .ad
1339 .RS 13n
1340 7 bits
1341 .RE
1342 
1343 .sp
1344 .ne 2
1345 .na
1346 \fB\fBCS8\fR\fR
1347 .ad
1348 .RS 13n
1349 8 bits
1350 .RE
1351 
1352 .sp
1353 .ne 2
1354 .na
1355 \fB\fBCSTOPB\fR\fR
1356 .ad
1357 .RS 13n
1358 Send two stop bits, else one
1359 .RE
1360 
1361 .sp
1362 .ne 2
1363 .na
1364 \fB\fBCREAD\fR\fR
1365 .ad
1366 .RS 13n
1367 Enable receiver
1368 .RE
1369 
1370 .sp
1371 .ne 2
1372 .na
1373 \fB\fBPARENB\fR\fR
1374 .ad
1375 .RS 13n
1376 Parity enable
1377 .RE
1378 
1379 .sp
1380 .ne 2
1381 .na
1382 \fB\fBPARODD\fR\fR
1383 .ad
1384 .RS 13n
1385 Odd parity, else even
1386 .RE
1387 
1388 .sp
1389 .ne 2
1390 .na
1391 \fB\fBHUPCL\fR\fR
1392 .ad
1393 .RS 13n
1394 Hang up on last close
1395 .RE
1396 
1397 .sp
1398 .ne 2
1399 .na
1400 \fB\fBCLOCAL\fR\fR
1401 .ad
1402 .RS 13n
1403 Local line, else dial-up
1404 .RE
1405 
1406 .sp
1407 .ne 2
1408 .na
1409 \fB\fBCIBAUD\fR\fR
1410 .ad
1411 .RS 13n
1412 Input baud rate, if different from output rate
1413 .RE
1414 
1415 .sp
1416 .ne 2
1417 .na
1418 \fB\fBPAREXT\fR\fR
1419 .ad
1420 .RS 13n
1421 Extended parity for mark and space parity
1422 .RE
1423 
1424 .sp
1425 .ne 2
1426 .na
1427 \fB\fBCRTSXOFF\fR\fR
1428 .ad
1429 .RS 13n
1430 Enable inbound hardware flow control
1431 .RE
1432 
1433 .sp
1434 .ne 2
1435 .na
1436 \fB\fBCRTSCTS\fR\fR
1437 .ad
1438 .RS 13n
1439 Enable outbound hardware flow control
1440 .RE
1441 
1442 .sp
1443 .ne 2
1444 .na
1445 \fB\fBCBAUDEXT\fR\fR
1446 .ad
1447 .RS 13n
1448 Bit to indicate output speed > B38400
1449 .RE
1450 
1451 .sp
1452 .ne 2
1453 .na
1454 \fB\fBCIBAUDEXT\fR\fR
1455 .ad
1456 .RS 13n
1457 Bit to indicate input speed > B38400
1458 .RE
1459 
1460 .sp
1461 .LP
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.
1465 .sp
1466 .in +2
1467 .nf
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;
1473 .fi
1474 .in -2
1475 
1476 .sp
1477 .LP
1478 To store the output speed in the termios structure pointed to by
1479 \fBtermios_p\fR see the following code segment.
1480 .sp
1481 .in +2
1482 .nf
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);
1491 .fi
1492 .in -2
1493 
1494 .sp
1495 .LP
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.
1499 .sp
1500 .LP
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.
1509 .sp
1510 .in +2
1511 .nf
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;
1518 .fi
1519 .in -2
1520 
1521 .sp
1522 .LP
1523 To store the input speed in the  \fBtermios\fR structure pointed to by
1524 \fBtermios_p\fR see the following code segment.
1525 .sp
1526 .in +2
1527 .nf
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);
1533 }
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);
1542 .fi
1543 .in -2
1544 
1545 .sp
1546 .LP
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.
1551 .sp
1552 .LP
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.
1556 .sp
1557 .LP
1558 If \fBCREAD\fR is set, the receiver is enabled. Otherwise, no characters are
1559 received.
1560 .sp
1561 .LP
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.
1565 .sp
1566 .LP
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.
1569 .sp
1570 .LP
1571 If \fBCRTSXOFF\fR is set, inbound hardware flow control is enabled.
1572 .sp
1573 .LP
1574 If  \fBCRTSCTS\fR is set, outbound hardware flow control is enabled.
1575 .sp
1576 .LP
1577 The four possible combinations for the state of \fBCRTSCTS\fR and
1578 \fBCRTSXOFF\fR bits and their interactions are described below.
1579 .sp
1580 .ne 2
1581 .na
1582 \fBCase A:\fR
1583 .ad
1584 .RS 11n
1585 \fBCRTSCTS\fR off, \fBCRTSXOFF\fR off. In this case the hardware flow control
1586 is disabled.
1587 .RE
1588 
1589 .sp
1590 .ne 2
1591 .na
1592 \fBCase B:\fR
1593 .ad
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.
1599 .RE
1600 
1601 .sp
1602 .ne 2
1603 .na
1604 \fBCase C:\fR
1605 .ad
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.
1611 .RE
1612 
1613 .sp
1614 .ne 2
1615 .na
1616 \fBCase D:\fR
1617 .ad
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.
1622 .RE
1623 
1624 .SS "Local Modes"
1625 .LP
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:
1629 .sp
1630 .ne 2
1631 .na
1632 \fB\fBISIG\fR\fR
1633 .ad
1634 .RS 11n
1635  Enable signals.
1636 .RE
1637 
1638 .sp
1639 .ne 2
1640 .na
1641 \fB\fBICANON\fR\fR
1642 .ad
1643 .RS 11n
1644 Canonical input (erase and kill processing).
1645 .RE
1646 
1647 .sp
1648 .ne 2
1649 .na
1650 \fB\fBXCASE\fR\fR
1651 .ad
1652 .RS 11n
1653 Canonical upper/lower presentation.
1654 .RE
1655 
1656 .sp
1657 .ne 2
1658 .na
1659 \fB\fBECHO\fR\fR
1660 .ad
1661 .RS 11n
1662 Enable echo.
1663 .RE
1664 
1665 .sp
1666 .ne 2
1667 .na
1668 \fB\fBECHOE\fR\fR
1669 .ad
1670 .RS 11n
1671 Echo erase character as \fBBS-SP-BS\fR &.
1672 .RE
1673 
1674 .sp
1675 .ne 2
1676 .na
1677 \fB\fBECHOK\fR\fR
1678 .ad
1679 .RS 11n
1680 Echo  \fBNL\fR after kill character.
1681 .RE
1682 
1683 .sp
1684 .ne 2
1685 .na
1686 \fB\fBECHONL\fR\fR
1687 .ad
1688 .RS 11n
1689 Echo  \fBNL\fR .
1690 .RE
1691 
1692 .sp
1693 .ne 2
1694 .na
1695 \fB\fBNOFLSH\fR\fR
1696 .ad
1697 .RS 11n
1698 Disable flush after interrupt or quit.
1699 .RE
1700 
1701 .sp
1702 .ne 2
1703 .na
1704 \fB\fBTOSTOP\fR\fR
1705 .ad
1706 .RS 11n
1707 Send  \fBSIGTTOU\fR for background output.
1708 .RE
1709 
1710 .sp
1711 .ne 2
1712 .na
1713 \fB\fBECHOCTL\fR\fR
1714 .ad
1715 .RS 11n
1716 Echo control characters as  \fIchar,\fR delete as ^?.
1717 .RE
1718 
1719 .sp
1720 .ne 2
1721 .na
1722 \fB\fBECHOPRT\fR\fR
1723 .ad
1724 .RS 11n
1725 Echo erase character as character erased.
1726 .RE
1727 
1728 .sp
1729 .ne 2
1730 .na
1731 \fB\fBECHOKE\fR\fR
1732 .ad
1733 .RS 11n
1734 \fBBS-SP-BS\fR erase entire line on line kill.
1735 .RE
1736 
1737 .sp
1738 .ne 2
1739 .na
1740 \fB\fBFLUSHO\fR\fR
1741 .ad
1742 .RS 11n
1743 Output is being flushed.
1744 .RE
1745 
1746 .sp
1747 .ne 2
1748 .na
1749 \fB\fBPENDIN\fR\fR
1750 .ad
1751 .RS 11n
1752 Retype pending input at next read or  input character.
1753 .RE
1754 
1755 .sp
1756 .ne 2
1757 .na
1758 \fB\fBIEXTEN\fR\fR
1759 .ad
1760 .RS 11n
1761 Enable extended (implementation-defined) functions.
1762 .RE
1763 
1764 .sp
1765 .LP
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.
1773 .sp
1774 .LP
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.
1783 .sp
1784 .LP
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:
1789 .sp
1790 
1791 .sp
1792 .TS
1793 box;
1794 c | c
1795 l | l .
1796 FOR:    USE:
1797 _
1798 `       \e'
1799 _
1800 |       \e!
1801 _
1802 \(ap    \e^
1803 _
1804 {       \e(
1805 _
1806 }       \e)
1807 _
1808 \e      \e\e
1809 .TE
1810 
1811 .sp
1812 .LP
1813 For example, input A as \ea, \en as \e\en, and \eN as \e\e\en.
1814 .sp
1815 .LP
1816 If \fBECHO\fR is set, characters are echoed as received.
1817 .sp
1818 .LP
1819 When \fBICANON\fR is set, the following echo functions are possible.
1820 .RS +4
1821 .TP
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.
1827 .RE
1828 .RS +4
1829 .TP
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.
1838 .RE
1839 .RS +4
1840 .TP
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).
1846 .RE
1847 .RS +4
1848 .TP
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.
1855 .RE
1856 .RS +4
1857 .TP
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).
1863 .RE
1864 .sp
1865 .LP
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.
1873 .sp
1874 .LP
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)\|).
1879 .sp
1880 .LP
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.
1887 .sp
1888 .LP
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.
1893 .sp
1894 .LP
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.
1898 .sp
1899 .LP
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"
1905 .LP
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"
1910 .LP
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:
1914 .sp
1915 .in +2
1916 .nf
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 */
1921 .fi
1922 .in -2
1923 
1924 .SS "Termio Structure"
1925 .LP
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:
1928 .sp
1929 .in +2
1930 .nf
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 */
1937 .fi
1938 .in -2
1939 
1940 .sp
1941 .LP
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:
1946 .sp
1947 
1948 .sp
1949 .TS
1950 box;
1951 c | c | c
1952 l | l | l .
1953 Relative Positions      Subscript Names Typical Default Values
1954 _
1955 0       VINTR   EXT
1956 _
1957 1       VQUIT   FS
1958 _
1959 2       VERASE  DEL
1960 _
1961 3       VKILL   NAK
1962 _
1963 4       VEOF    EOT
1964 _
1965 5       VEOL    NUL
1966 _
1967 6       VEOL2   NUL
1968 _
1969 7       Reserved        
1970 .TE
1971 
1972 .sp
1973 .LP
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.
1979 .sp
1980 .LP
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"
1985 .LP
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:
1990 .sp
1991 .ne 2
1992 .na
1993 \fB\fBTIOCM_LE\fR\fR
1994 .ad
1995 .RS 13n
1996  line enable
1997 .RE
1998 
1999 .sp
2000 .ne 2
2001 .na
2002 \fB\fBTIOCM_DTR\fR\fR
2003 .ad
2004 .RS 13n
2005 data terminal ready
2006 .RE
2007 
2008 .sp
2009 .ne 2
2010 .na
2011 \fB\fBTIOCM_RTS\fR\fR
2012 .ad
2013 .RS 13n
2014 request to send
2015 .RE
2016 
2017 .sp
2018 .ne 2
2019 .na
2020 \fB\fBTIOCM_ST\fR\fR
2021 .ad
2022 .RS 13n
2023 secondary transmit
2024 .RE
2025 
2026 .sp
2027 .ne 2
2028 .na
2029 \fB\fBTIOCM_SR\fR\fR
2030 .ad
2031 .RS 13n
2032 secondary receive
2033 .RE
2034 
2035 .sp
2036 .ne 2
2037 .na
2038 \fB\fBTIOCM_CTS\fR\fR
2039 .ad
2040 .RS 13n
2041 clear to send
2042 .RE
2043 
2044 .sp
2045 .ne 2
2046 .na
2047 \fB\fBTIOCM_CAR\fR\fR
2048 .ad
2049 .RS 13n
2050 carrier detect
2051 .RE
2052 
2053 .sp
2054 .ne 2
2055 .na
2056 \fB\fBTIOCM_RNG\fR\fR
2057 .ad
2058 .RS 13n
2059 ring
2060 .RE
2061 
2062 .sp
2063 .ne 2
2064 .na
2065 \fB\fBTIOCM_DSR\fR\fR
2066 .ad
2067 .RS 13n
2068 data set ready
2069 .RE
2070 
2071 .sp
2072 .LP
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.
2076 .sp
2077 .LP
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.
2084 .sp
2085 .LP
2086 The software carrier flag is usually turned on for locally connected terminals
2087 or other devices, and is off for lines with modems.
2088 .sp
2089 .LP
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"
2094 .LP
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.
2101 .sp
2102 .LP
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
2111 .LP
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.
2117 .sp
2118 .ne 2
2119 .na
2120 \fB\fBTCGETS\fR\fR
2121 .ad
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.
2125 .RE
2126 
2127 .sp
2128 .ne 2
2129 .na
2130 \fB\fBTCSETS\fR\fR
2131 .ad
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.
2136 .RE
2137 
2138 .sp
2139 .ne 2
2140 .na
2141 \fB\fBTCSETSW\fR\fR
2142 .ad
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.
2148 .RE
2149 
2150 .sp
2151 .ne 2
2152 .na
2153 \fB\fBTCSETSF\fR\fR
2154 .ad
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.
2160 .RE
2161 
2162 .sp
2163 .ne 2
2164 .na
2165 \fB\fBTCGETA\fR\fR
2166 .ad
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.
2171 .RE
2172 
2173 .sp
2174 .ne 2
2175 .na
2176 \fB\fBTCSETA\fR\fR
2177 .ad
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.
2182 .RE
2183 
2184 .sp
2185 .ne 2
2186 .na
2187 \fB\fBTCSETAW\fR\fR
2188 .ad
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.
2195 .RE
2196 
2197 .sp
2198 .ne 2
2199 .na
2200 \fB\fBTCSETAF\fR\fR
2201 .ad
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.
2208 .RE
2209 
2210 .sp
2211 .ne 2
2212 .na
2213 \fB\fBTCSBRK\fR\fR
2214 .ad
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).
2218 .RE
2219 
2220 .sp
2221 .ne 2
2222 .na
2223 \fB\fBTCXONC\fR\fR
2224 .ad
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.
2229 .RE
2230 
2231 .sp
2232 .ne 2
2233 .na
2234 \fB\fBTCFLSH\fR\fR
2235 .ad
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.
2240 .RE
2241 
2242 .sp
2243 .ne 2
2244 .na
2245 \fB\fBTIOCGPGRP\fR\fR
2246 .ad
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.
2251 .RE
2252 
2253 .sp
2254 .ne 2
2255 .na
2256 \fB\fBTIOCSPGRP\fR\fR
2257 .ad
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.
2263 .RE
2264 
2265 .sp
2266 .ne 2
2267 .na
2268 \fB\fBTIOCGSID\fR\fR
2269 .ad
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.
2273 .RE
2274 
2275 .sp
2276 .ne 2
2277 .na
2278 \fB\fBTIOCGWINSZ\fR\fR
2279 .ad
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.
2283 .RE
2284 
2285 .sp
2286 .ne 2
2287 .na
2288 \fB\fBTIOCSWINSZ\fR\fR
2289 .ad
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.
2295 .RE
2296 
2297 .sp
2298 .ne 2
2299 .na
2300 \fB\fBTIOCMBIS\fR\fR
2301 .ad
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.
2306 .RE
2307 
2308 .sp
2309 .ne 2
2310 .na
2311 \fB\fBTIOCMBIC\fR\fR
2312 .ad
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.
2317 .RE
2318 
2319 .sp
2320 .ne 2
2321 .na
2322 \fB\fBTIOCMGET\fR\fR
2323 .ad
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.
2328 .RE
2329 
2330 .sp
2331 .ne 2
2332 .na
2333 \fB\fBTIOCMSET\fR\fR
2334 .ad
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.
2339 .RE
2340 
2341 .sp
2342 .ne 2
2343 .na
2344 \fB\fBTIOCSPPS\fR\fR
2345 .ad
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.
2353 .RE
2354 
2355 .sp
2356 .ne 2
2357 .na
2358 \fB\fBTIOCGPPS\fR\fR
2359 .ad
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.
2364 .RE
2365 
2366 .sp
2367 .ne 2
2368 .na
2369 \fB\fBTIOCGSOFTCAR\fR\fR
2370 .ad
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.
2374 .RE
2375 
2376 .sp
2377 .ne 2
2378 .na
2379 \fB\fBTIOCSSOFTCAR\fR\fR
2380 .ad
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.
2385 .RE
2386 
2387 .sp
2388 .ne 2
2389 .na
2390 \fB\fBTIOCGPPSEV\fR\fR
2391 .ad
2392 .RS 16n
2393 The argument is a pointer to a \fBstruct\fR \fBppsclockev\fR. This structure
2394 contains the following members:
2395 .sp
2396 .in +2
2397 .nf
2398 struct timeval tv;
2399 uint32_t serial;
2400 .fi
2401 .in -2
2402 
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.
2411 .RE
2412 
2413 .SH FILES
2414 .LP
2415 Files in or under /\fBdev\fR
2416 .SH SEE ALSO
2417 .LP
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)