/share/man/man4/termios.4

https://bitbucket.org/freebsd/freebsd-head/ · Forth · 1587 lines · 1585 code · 0 blank · 2 comment · 68 complexity · 7ed67254a40b8d7bba8161aed5cae6f7 MD5 · raw file

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