1591 lines
57 KiB
HTML
1591 lines
57 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
|
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
|
<title>General Terminal Interface</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3"> <!--header start-->
|
|
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
|
IEEE Std 1003.1-2001<br>
|
|
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
|
|
|
<!--header end-->
|
|
<hr size="2" noshade>
|
|
<h2><a name="tag_11"></a>General Terminal Interface</h2>
|
|
|
|
<p>This chapter describes a general terminal interface that shall be provided. It shall be supported on any asynchronous
|
|
communications ports if the implementation provides them. It is implementation-defined whether it supports network connections or
|
|
synchronous ports, or both.</p>
|
|
|
|
<h3><a name="tag_11_01"></a>Interface Characteristics</h3>
|
|
|
|
<h4><a name="tag_11_01_01"></a>Opening a Terminal Device File</h4>
|
|
|
|
<p>When a terminal device file is opened, it normally causes the thread to wait until a connection is established. In practice,
|
|
application programs seldom open these files; they are opened by special programs and become an application's standard input,
|
|
output, and error files.</p>
|
|
|
|
<p>As described in <a href="../functions/open.html"><i>open</i>()</a>, opening a terminal device file with the O_NONBLOCK flag
|
|
clear shall cause the thread to block until the terminal device is ready and available. If CLOCAL mode is not set, this means
|
|
blocking until a connection is established. If CLOCAL mode is set in the terminal, or the O_NONBLOCK flag is specified in the <a
|
|
href="../functions/open.html"><i>open</i>()</a>, the <a href="../functions/open.html"><i>open</i>()</a> function shall return a
|
|
file descriptor without waiting for a connection to be established.</p>
|
|
|
|
<h4><a name="tag_11_01_02"></a>Process Groups</h4>
|
|
|
|
<p>A terminal may have a foreground process group associated with it. This foreground process group plays a special role in
|
|
handling signal-generating input characters, as discussed in <a href="#tag_11_01_09">Special Characters</a> .</p>
|
|
|
|
<p>A command interpreter process supporting job control can allocate the terminal to different jobs, or process groups, by placing
|
|
related processes in a single process group and associating this process group with the terminal. A terminal's foreground process
|
|
group may be set or examined by a process, assuming the permission requirements are met; see <a href=
|
|
"../functions/tcgetpgrp.html"><i>tcgetpgrp</i>()</a> and <a href="../functions/tcsetpgrp.html"><i>tcsetpgrp</i>()</a>. The terminal
|
|
interface aids in this allocation by restricting access to the terminal by processes that are not in the current process group; see
|
|
<a href="#tag_11_01_04">Terminal Access Control</a> .</p>
|
|
|
|
<p>When there is no longer any process whose process ID or process group ID matches the foreground process group ID, the terminal
|
|
shall have no foreground process group. It is unspecified whether the terminal has a foreground process group when there is a
|
|
process whose process ID matches the foreground process group ID, but whose process group ID does not. No actions defined in
|
|
IEEE Std 1003.1-2001, other than allocation of a controlling terminal or a successful call to <a href=
|
|
"../functions/tcsetpgrp.html"><i>tcsetpgrp</i>()</a>, shall cause a process group to become the foreground process group of the
|
|
terminal.</p>
|
|
|
|
<h4><a name="tag_11_01_03"></a>The Controlling Terminal</h4>
|
|
|
|
<p>A terminal may belong to a process as its controlling terminal. Each process of a session that has a controlling terminal has
|
|
the same controlling terminal. A terminal may be the controlling terminal for at most one session. The controlling terminal for a
|
|
session is allocated by the session leader in an implementation-defined manner. If a session leader has no controlling terminal,
|
|
and opens a terminal device file that is not already associated with a session without using the O_NOCTTY option (see <a href=
|
|
"../functions/open.html"><i>open</i>()</a>), it is implementation-defined whether the terminal becomes the controlling terminal of
|
|
the session leader. If a process which is not a session leader opens a terminal file, or the O_NOCTTY option is used on <a href=
|
|
"../functions/open.html"><i>open</i>()</a>, then that terminal shall not become the controlling terminal of the calling process.
|
|
When a controlling terminal becomes associated with a session, its foreground process group shall be set to the process group of
|
|
the session leader.</p>
|
|
|
|
<p>The controlling terminal is inherited by a child process during a <a href="../functions/fork.html"><i>fork</i>()</a> function
|
|
call. A process relinquishes its controlling terminal when it creates a new session with the <a href=
|
|
"../functions/setsid.html"><i>setsid</i>()</a> function; other processes remaining in the old session that had this terminal as
|
|
their controlling terminal continue to have it. Upon the close of the last file descriptor in the system (whether or not it is in
|
|
the current session) associated with the controlling terminal, it is unspecified whether all processes that had that terminal as
|
|
their controlling terminal cease to have any controlling terminal. Whether and how a session leader can reacquire a controlling
|
|
terminal after the controlling terminal has been relinquished in this fashion is unspecified. A process does not relinquish its
|
|
controlling terminal simply by closing all of its file descriptors associated with the controlling terminal if other processes
|
|
continue to have it open.</p>
|
|
|
|
<p>When a controlling process terminates, the controlling terminal is dissociated from the current session, allowing it to be
|
|
acquired by a new session leader. Subsequent access to the terminal by other processes in the earlier session may be denied, with
|
|
attempts to access the terminal treated as if a modem disconnect had been sensed.</p>
|
|
|
|
<h4><a name="tag_11_01_04"></a>Terminal Access Control</h4>
|
|
|
|
<p>If a process is in the foreground process group of its controlling terminal, read operations shall be allowed, as described in
|
|
<a href="#tag_11_01_05">Input Processing and Reading Data</a> . Any attempts by a process in a background process group to read
|
|
from its controlling terminal cause its process group to be sent a SIGTTIN signal unless one of the following special cases
|
|
applies: if the reading process is ignoring or blocking the SIGTTIN signal, or if the process group of the reading process is
|
|
orphaned, the <a href="../functions/read.html"><i>read</i>()</a> shall return -1, with <i>errno</i> set to [EIO] and no signal
|
|
shall be sent. The default action of the SIGTTIN signal shall be to stop the process to which it is sent. See <a href=
|
|
"signal.h.html"><i><signal.h></i></a> .</p>
|
|
|
|
<p>If a process is in the foreground process group of its controlling terminal, write operations shall be allowed as described in
|
|
<a href="#tag_11_01_08">Writing Data and Output Processing</a> . Attempts by a process in a background process group to write to
|
|
its controlling terminal shall cause the process group to be sent a SIGTTOU signal unless one of the following special cases
|
|
applies: if TOSTOP is not set, or if TOSTOP is set and the process is ignoring or blocking the SIGTTOU signal, the process is
|
|
allowed to write to the terminal and the SIGTTOU signal is not sent. If TOSTOP is set, and the process group of the writing process
|
|
is orphaned, and the writing process is not ignoring or blocking the SIGTTOU signal, the <a href=
|
|
"../functions/write.html"><i>write</i>()</a> shall return -1, with <i>errno</i> set to [EIO] and no signal shall be sent.</p>
|
|
|
|
<p>Certain calls that set terminal parameters are treated in the same fashion as <a href=
|
|
"../functions/write.html"><i>write</i>()</a>, except that TOSTOP is ignored; that is, the effect is identical to that of terminal
|
|
writes when TOSTOP is set (see <a href="#tag_11_02_05">Local Modes</a> , <a href="../functions/tcdrain.html"><i>tcdrain</i>()</a>,
|
|
<a href="../functions/tcflow.html"><i>tcflow</i>()</a>, <a href="../functions/tcflush.html"><i>tcflush</i>()</a>, <a href=
|
|
"../functions/tcsendbreak.html"><i>tcsendbreak</i>()</a>, <a href="../functions/tcsetattr.html"><i>tcsetattr</i>()</a>, and <a
|
|
href="../functions/tcsetpgrp.html"><i>tcsetpgrp</i>()</a>).</p>
|
|
|
|
<h4><a name="tag_11_01_05"></a>Input Processing and Reading Data</h4>
|
|
|
|
<p>A terminal device associated with a terminal device file may operate in full-duplex mode, so that data may arrive even while
|
|
output is occurring. Each terminal device file has an input queue associated with it, into which incoming data is stored by the
|
|
system before being read by a process. The system may impose a limit, {MAX_INPUT}, on the number of bytes that may be stored in the
|
|
input queue. The behavior of the system when this limit is exceeded is implementation-defined.</p>
|
|
|
|
<p>Two general kinds of input processing are available, determined by whether the terminal device file is in canonical mode or
|
|
non-canonical mode. These modes are described in <a href="#tag_11_01_06">Canonical Mode Input Processing</a> and <a href=
|
|
"#tag_11_01_07">Non-Canonical Mode Input Processing</a> . Additionally, input characters are processed according to the
|
|
<i>c_iflag</i> (see <a href="#tag_11_02_02">Input Modes</a> ) and <i>c_lflag</i> (see <a href="#tag_11_02_05">Local Modes</a> )
|
|
fields. Such processing can include ``echoing'', which in general means transmitting input characters immediately back to the
|
|
terminal when they are received from the terminal. This is useful for terminals that can operate in full-duplex mode.</p>
|
|
|
|
<p>The manner in which data is provided to a process reading from a terminal device file is dependent on whether the terminal file
|
|
is in canonical or non-canonical mode, and on whether or not the O_NONBLOCK flag is set by <a href=
|
|
"../functions/open.html"><i>open</i>()</a> or <a href="../functions/fcntl.html"><i>fcntl</i>()</a>.</p>
|
|
|
|
<p>If the O_NONBLOCK flag is clear, then the read request shall be blocked until data is available or a signal has been received.
|
|
If the O_NONBLOCK flag is set, then the read request shall be completed, without blocking, in one of three ways:</p>
|
|
|
|
<ol>
|
|
<li>
|
|
<p>If there is enough data available to satisfy the entire request, the <a href="../functions/read.html"><i>read</i>()</a> shall
|
|
complete successfully and shall return the number of bytes read.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>If there is not enough data available to satisfy the entire request, the <a href="../functions/read.html"><i>read</i>()</a>
|
|
shall complete successfully, having read as much data as possible, and shall return the number of bytes it was able to read.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>If there is no data available, the <a href="../functions/read.html"><i>read</i>()</a> shall return -1, with <i>errno</i> set to
|
|
[EAGAIN].</p>
|
|
</li>
|
|
</ol>
|
|
|
|
<p>When data is available depends on whether the input processing mode is canonical or non-canonical. <a href=
|
|
"#tag_11_01_06">Canonical Mode Input Processing</a> and <a href="#tag_11_01_07">Non-Canonical Mode Input Processing</a> describe
|
|
each of these input processing modes.</p>
|
|
|
|
<h4><a name="tag_11_01_06"></a>Canonical Mode Input Processing</h4>
|
|
|
|
<p>In canonical mode input processing, terminal input is processed in units of lines. A line is delimited by a newline character
|
|
(NL), an end-of-file character (EOF), or an end-of-line (EOL) character. See <a href="#tag_11_01_09">Special Characters</a> for
|
|
more information on EOF and EOL. This means that a read request shall not return until an entire line has been typed or a signal
|
|
has been received. Also, no matter how many bytes are requested in the <a href="../functions/read.html"><i>read</i>()</a> call, at
|
|
most one line shall be returned. It is not, however, necessary to read a whole line at once; any number of bytes, even one, may be
|
|
requested in a <a href="../functions/read.html"><i>read</i>()</a> without losing information.</p>
|
|
|
|
<p>If {MAX_CANON} is defined for this terminal device, it shall be a limit on the number of bytes in a line. The behavior of the
|
|
system when this limit is exceeded is implementation-defined. If {MAX_CANON} is not defined, there shall be no such limit; see <a
|
|
href="../functions/pathconf.html"><i>pathconf</i>()</a>.</p>
|
|
|
|
<p>Erase and kill processing occur when either of two special characters, the ERASE and KILL characters (see <a href=
|
|
"#tag_11_01_09">Special Characters</a> ), is received. This processing shall affect data in the input queue that has not yet been
|
|
delimited by an NL, EOF, or EOL character. This un-delimited data makes up the current line. The ERASE character shall delete the
|
|
last character in the current line, if there is one. The KILL character shall delete all data in the current line, if there is any.
|
|
The ERASE and KILL characters shall have no effect if there is no data in the current line. The ERASE and KILL characters
|
|
themselves shall not be placed in the input queue.</p>
|
|
|
|
<h4><a name="tag_11_01_07"></a>Non-Canonical Mode Input Processing</h4>
|
|
|
|
<p>In non-canonical mode input processing, input bytes are not assembled into lines, and erase and kill processing shall not occur.
|
|
The values of the MIN and TIME members of the <i>c_cc</i> array are used to determine how to process the bytes received.
|
|
IEEE Std 1003.1-2001 does not specify whether the setting of O_NONBLOCK takes precedence over MIN or TIME settings.
|
|
Therefore, if O_NONBLOCK is set, <a href="../functions/read.html"><i>read</i>()</a> may return immediately, regardless of the
|
|
setting of MIN or TIME. Also, if no data is available, <a href="../functions/read.html"><i>read</i>()</a> may either return 0, or
|
|
return -1 with <i>errno</i> set to [EAGAIN].</p>
|
|
|
|
<p>MIN represents the minimum number of bytes that should be received when the <a href="../functions/read.html"><i>read</i>()</a>
|
|
function returns successfully. TIME is a timer of 0.1 second granularity that is used to time out bursty and short-term data
|
|
transmissions. If MIN is greater than {MAX_INPUT}, the response to the request is undefined. The four possible values for MIN and
|
|
TIME and their interactions are described below.</p>
|
|
|
|
<h5><a name="tag_11_01_07_01"></a>Case A: MIN>0, TIME>0</h5>
|
|
|
|
<p>In case A, TIME serves as an inter-byte timer which shall be activated after the first byte is received. Since it is an
|
|
inter-byte timer, it shall be reset after a byte is received. The interaction between MIN and TIME is as follows. As soon as one
|
|
byte is received, the inter-byte timer shall be started. If MIN bytes are received before the inter-byte timer expires (remember
|
|
that the timer is reset upon receipt of each byte), the read shall be satisfied. If the timer expires before MIN bytes are
|
|
received, the characters received to that point shall be returned to the user. Note that if TIME expires at least one byte shall be
|
|
returned because the timer would not have been enabled unless a byte was received. In this case (MIN>0, TIME>0) the read
|
|
shall block until the MIN and TIME mechanisms are activated by the receipt of the first byte, or a signal is received. If data is
|
|
in the buffer at the time of the <a href="../functions/read.html"><i>read</i>()</a>, the result shall be as if data has been
|
|
received immediately after the <a href="../functions/read.html"><i>read</i>()</a>.</p>
|
|
|
|
<h5><a name="tag_11_01_07_02"></a>Case B: MIN>0, TIME=0</h5>
|
|
|
|
<p>In case B, since the value of TIME is zero, the timer plays no role and only MIN is significant. A pending read shall not be
|
|
satisfied until MIN bytes are received (that is, the pending read shall block until MIN bytes are received), or a signal is
|
|
received. A program that uses case B to read record-based terminal I/O may block indefinitely in the read operation.</p>
|
|
|
|
<h5><a name="tag_11_01_07_03"></a>Case C: MIN=0, TIME>0</h5>
|
|
|
|
<p>In case C, since MIN=0, TIME no longer represents an inter-byte timer. It now serves as a read timer that shall be activated as
|
|
soon as the <a href="../functions/read.html"><i>read</i>()</a> function is processed. A read shall be satisfied as soon as a single
|
|
byte is received or the read timer expires. Note that in case C if the timer expires, no bytes shall be returned. If the timer does
|
|
not expire, the only way the read can be satisfied is if a byte is received. If bytes are not received, the read shall not block
|
|
indefinitely waiting for a byte; if no byte is received within TIME*0.1 seconds after the read is initiated, the <a href=
|
|
"../functions/read.html"><i>read</i>()</a> shall return a value of zero, having read no data. If data is in the buffer at the time
|
|
of the <a href="../functions/read.html"><i>read</i>()</a>, the timer shall be started as if data has been received immediately
|
|
after the <a href="../functions/read.html"><i>read</i>()</a>.</p>
|
|
|
|
<h5><a name="tag_11_01_07_04"></a>Case D: MIN=0, TIME=0</h5>
|
|
|
|
<p>The minimum of either the number of bytes requested or the number of bytes currently available shall be returned without waiting
|
|
for more bytes to be input. If no characters are available, <a href="../functions/read.html"><i>read</i>()</a> shall return a value
|
|
of zero, having read no data.</p>
|
|
|
|
<h4><a name="tag_11_01_08"></a>Writing Data and Output Processing</h4>
|
|
|
|
<p>When a process writes one or more bytes to a terminal device file, they are processed according to the <i>c_oflag</i> field (see
|
|
<a href="#tag_11_02_03">Output Modes</a> ). The implementation may provide a buffering mechanism; as such, when a call to <a href=
|
|
"../functions/write.html"><i>write</i>()</a> completes, all of the bytes written have been scheduled for transmission to the
|
|
device, but the transmission has not necessarily completed. See <a href="../functions/write.html"><i>write</i>()</a> for the
|
|
effects of O_NONBLOCK on <a href="../functions/write.html"><i>write</i>()</a>.</p>
|
|
|
|
<h4><a name="tag_11_01_09"></a>Special Characters</h4>
|
|
|
|
<p>Certain characters have special functions on input or output or both. These functions are summarized as follows:</p>
|
|
|
|
<dl compact>
|
|
<dt>INTR</dt>
|
|
|
|
<dd>Special character on input, which is recognized if the ISIG flag is set. Generates a SIGINT signal which is sent to all
|
|
processes in the foreground process group for which the terminal is the controlling terminal. If ISIG is set, the INTR character
|
|
shall be discarded when processed.</dd>
|
|
|
|
<dt>QUIT</dt>
|
|
|
|
<dd>Special character on input, which is recognized if the ISIG flag is set. Generates a SIGQUIT signal which is sent to all
|
|
processes in the foreground process group for which the terminal is the controlling terminal. If ISIG is set, the QUIT character
|
|
shall be discarded when processed.</dd>
|
|
|
|
<dt>ERASE</dt>
|
|
|
|
<dd>Special character on input, which is recognized if the ICANON flag is set. Erases the last character in the current line; see
|
|
<a href="#tag_11_01_06">Canonical Mode Input Processing</a> . It shall not erase beyond the start of a line, as delimited by an NL,
|
|
EOF, or EOL character. If ICANON is set, the ERASE character shall be discarded when processed.</dd>
|
|
|
|
<dt>KILL</dt>
|
|
|
|
<dd>Special character on input, which is recognized if the ICANON flag is set. Deletes the entire line, as delimited by an NL, EOF,
|
|
or EOL character. If ICANON is set, the KILL character shall be discarded when processed.</dd>
|
|
|
|
<dt>EOF</dt>
|
|
|
|
<dd>Special character on input, which is recognized if the ICANON flag is set. When received, all the bytes waiting to be read are
|
|
immediately passed to the process without waiting for a newline, and the EOF is discarded. Thus, if there are no bytes waiting
|
|
(that is, the EOF occurred at the beginning of a line), a byte count of zero shall be returned from the <a href=
|
|
"../functions/read.html"><i>read</i>()</a>, representing an end-of-file indication. If ICANON is set, the EOF character shall be
|
|
discarded when processed.</dd>
|
|
|
|
<dt>NL</dt>
|
|
|
|
<dd>Special character on input, which is recognized if the ICANON flag is set. It is the line delimiter newline. It cannot be
|
|
changed.</dd>
|
|
|
|
<dt>EOL</dt>
|
|
|
|
<dd>Special character on input, which is recognized if the ICANON flag is set. It is an additional line delimiter, like NL.</dd>
|
|
|
|
<dt>SUSP</dt>
|
|
|
|
<dd>If the ISIG flag is set, receipt of the SUSP character shall cause a SIGTSTP signal to be sent to all processes in the
|
|
foreground process group for which the terminal is the controlling terminal, and the SUSP character shall be discarded when
|
|
processed.</dd>
|
|
|
|
<dt>STOP</dt>
|
|
|
|
<dd>Special character on both input and output, which is recognized if the IXON (output control) or IXOFF (input control) flag is
|
|
set. Can be used to suspend output temporarily. It is useful with CRT terminals to prevent output from disappearing before it can
|
|
be read. If IXON is set, the STOP character shall be discarded when processed.</dd>
|
|
|
|
<dt>START</dt>
|
|
|
|
<dd>Special character on both input and output, which is recognized if the IXON (output control) or IXOFF (input control) flag is
|
|
set. Can be used to resume output that has been suspended by a STOP character. If IXON is set, the START character shall be
|
|
discarded when processed.</dd>
|
|
|
|
<dt>CR</dt>
|
|
|
|
<dd>Special character on input, which is recognized if the ICANON flag is set; it is the carriage-return character. When ICANON and
|
|
ICRNL are set and IGNCR is not set, this character shall be translated into an NL, and shall have the same effect as an NL
|
|
character.</dd>
|
|
</dl>
|
|
|
|
<p>The NL and CR characters cannot be changed. It is implementation-defined whether the START and STOP characters can be changed.
|
|
The values for INTR, QUIT, ERASE, KILL, EOF, EOL, and SUSP shall be changeable to suit individual tastes. Special character
|
|
functions associated with changeable special control characters can be disabled individually.</p>
|
|
|
|
<p>If two or more special characters have the same value, the function performed when that character is received is undefined.</p>
|
|
|
|
<p>A special character is recognized not only by its value, but also by its context; for example, an implementation may support
|
|
multi-byte sequences that have a meaning different from the meaning of the bytes when considered individually. Implementations may
|
|
also support additional single-byte functions. These implementation-defined multi-byte or single-byte functions shall be recognized
|
|
only if the IEXTEN flag is set; otherwise, data is received without interpretation, except as required to recognize the special
|
|
characters defined in this section.</p>
|
|
|
|
<p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
If IEXTEN is set, the ERASE, KILL, and EOF characters can be escaped by a preceding <tt>'\'</tt> character, in which case no
|
|
special function shall occur. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
|
|
|
|
<h4><a name="tag_11_01_10"></a>Modem Disconnect</h4>
|
|
|
|
<p>If a modem disconnect is detected by the terminal interface for a controlling terminal, and if CLOCAL is not set in the
|
|
<i>c_cflag</i> field for the terminal (see <a href="#tag_11_02_04">Control Modes</a> ), the SIGHUP signal shall be sent to the
|
|
controlling process for which the terminal is the controlling terminal. Unless other arrangements have been made, this shall cause
|
|
the controlling process to terminate (see <a href="../functions/exit.html"><i>exit</i>()</a>). Any subsequent read from the
|
|
terminal device shall return the value of zero, indicating end-of-file; see <a href="../functions/read.html"><i>read</i>()</a>.
|
|
Thus, processes that read a terminal file and test for end-of-file can terminate appropriately after a disconnect. If the EIO
|
|
condition as specified in <a href="../functions/read.html"><i>read</i>()</a> also exists, it is unspecified whether on EOF
|
|
condition or [EIO] is returned. Any subsequent <a href="../functions/write.html"><i>write</i>()</a> to the terminal device shall
|
|
return -1, with <i>errno</i> set to [EIO], until the device is closed.</p>
|
|
|
|
<h4><a name="tag_11_01_11"></a>Closing a Terminal Device File</h4>
|
|
|
|
<p>The last process to close a terminal device file shall cause any output to be sent to the device and any input to be discarded.
|
|
If HUPCL is set in the control modes and the communications port supports a disconnect function, the terminal device shall perform
|
|
a disconnect.</p>
|
|
|
|
<h3><a name="tag_11_02"></a>Parameters that Can be Set</h3>
|
|
|
|
<h4><a name="tag_11_02_01"></a>The termios Structure</h4>
|
|
|
|
<p>Routines that need to control certain terminal I/O characteristics shall do so by using the <b>termios</b> structure as defined
|
|
in the <a href="termios.h.html"><i><termios.h></i></a> header. The members of this structure include (but are not limited
|
|
to):</p>
|
|
|
|
<center>
|
|
<table border="1" cellpadding="3" align="center">
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b>Member</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Array</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Member</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b> </b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b>Type</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Size</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Name</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Description</b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>tcflag_t</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"> </p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>c_iflag</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Input modes.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>tcflag_t</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"> </p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>c_oflag</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Output modes.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>tcflag_t</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"> </p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>c_cflag</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Control modes.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>tcflag_t</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"> </p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>c_lflag</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Local modes.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>cc_t</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">NCCS</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>c_cc[]</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Control characters.</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
|
|
<p>The types <b>tcflag_t</b> and <b>cc_t</b> are defined in the <a href="termios.h.html"><i><termios.h></i></a> header. They
|
|
shall be unsigned integer types.</p>
|
|
|
|
<h4><a name="tag_11_02_02"></a>Input Modes</h4>
|
|
|
|
<p>Values of the <i>c_iflag</i> field describe the basic terminal input control, and are composed of the bitwise-inclusive OR of
|
|
the masks shown, which shall be bitwise-distinct. The mask name symbols in this table are defined in <a href=
|
|
"termios.h.html"><i><termios.h></i></a> :</p>
|
|
|
|
<center>
|
|
<table border="1" cellpadding="3" align="center">
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b>Mask Name</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Description</b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">BRKINT</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Signal interrupt on break.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">ICRNL</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Map CR to NL on input.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">IGNBRK</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Ignore break condition.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">IGNCR</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Ignore CR.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">IGNPAR</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Ignore characters with parity errors.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">INLCR</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Map NL to CR on input.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">INPCK</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Enable input parity check.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">ISTRIP</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Strip character.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"
|
|
border="0"> IXANY</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Enable any character to restart output. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">IXOFF</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Enable start/stop input control.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">IXON</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Enable start/stop output control.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">PARMRK</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Mark parity errors.</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
|
|
<p>In the context of asynchronous serial data transmission, a break condition shall be defined as a sequence of zero-valued bits
|
|
that continues for more than the time to send one byte. The entire sequence of zero-valued bits is interpreted as a single break
|
|
condition, even if it continues for a time equivalent to more than one byte. In contexts other than asynchronous serial data
|
|
transmission, the definition of a break condition is implementation-defined.</p>
|
|
|
|
<p>If IGNBRK is set, a break condition detected on input shall be ignored; that is, not put on the input queue and therefore not
|
|
read by any process. If IGNBRK is not set and BRKINT is set, the break condition shall flush the input and output queues, and if
|
|
the terminal is the controlling terminal of a foreground process group, the break condition shall generate a single SIGINT signal
|
|
to that foreground process group. If neither IGNBRK nor BRKINT is set, a break condition shall be read as a single 0x00, or if
|
|
PARMRK is set, as 0xff 0x00 0x00.</p>
|
|
|
|
<p>If IGNPAR is set, a byte with a framing or parity error (other than break) shall be ignored.</p>
|
|
|
|
<p>If PARMRK is set, and IGNPAR is not set, a byte with a framing or parity error (other than break) shall be given to the
|
|
application as the three-byte sequence 0xff 0x00 X, where 0xff 0x00 is a two-byte flag preceding each sequence and X is the data of
|
|
the byte received in error. To avoid ambiguity in this case, if ISTRIP is not set, a valid byte of 0xff is given to the application
|
|
as 0xff 0xff. If neither PARMRK nor IGNPAR is set, a framing or parity error (other than break) shall be given to the application
|
|
as a single byte 0x00.</p>
|
|
|
|
<p>If INPCK is set, input parity checking shall be enabled. If INPCK is not set, input parity checking shall be disabled, allowing
|
|
output parity generation without input parity errors. Note that whether input parity checking is enabled or disabled is independent
|
|
of whether parity detection is enabled or disabled (see <a href="#tag_11_02_04">Control Modes</a> ). If parity detection is enabled
|
|
but input parity checking is disabled, the hardware to which the terminal is connected shall recognize the parity bit, but the
|
|
terminal special file shall not check whether or not this bit is correctly set.</p>
|
|
|
|
<p>If ISTRIP is set, valid input bytes shall first be stripped to seven bits; otherwise, all eight bits shall be processed.</p>
|
|
|
|
<p>If INLCR is set, a received NL character shall be translated into a CR character. If IGNCR is set, a received CR character shall
|
|
be ignored (not read). If IGNCR is not set and ICRNL is set, a received CR character shall be translated into an NL character.</p>
|
|
|
|
<p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
If IXANY is set, any input character shall restart output that has been suspended. <img src="../images/opt-end.gif" alt=
|
|
"[Option End]" border="0"></p>
|
|
|
|
<p>If IXON is set, start/stop output control shall be enabled. A received STOP character shall suspend output and a received START
|
|
character shall restart output. When IXON is set, START and STOP characters are not read, but merely perform flow control
|
|
functions. When IXON is not set, the START and STOP characters shall be read.</p>
|
|
|
|
<p>If IXOFF is set, start/stop input control shall be enabled. The system shall transmit STOP characters, which are intended to
|
|
cause the terminal device to stop transmitting data, as needed to prevent the input queue from overflowing and causing
|
|
implementation-defined behavior, and shall transmit START characters, which are intended to cause the terminal device to resume
|
|
transmitting data, as soon as the device can continue transmitting data without risk of overflowing the input queue. The precise
|
|
conditions under which STOP and START characters are transmitted are implementation-defined.</p>
|
|
|
|
<p>The initial input control value after <a href="../functions/open.html"><i>open</i>()</a> is implementation-defined.</p>
|
|
|
|
<h4><a name="tag_11_02_03"></a>Output Modes</h4>
|
|
|
|
<p>The <i>c_oflag</i> field specifies the terminal interface's treatment of output, and is composed of the bitwise-inclusive OR of
|
|
the masks shown, which shall be bitwise-distinct. The mask name symbols in the following table are defined in <a href=
|
|
"termios.h.html"><i><termios.h></i></a> :</p>
|
|
|
|
<center>
|
|
<table border="1" cellpadding="3" align="center">
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b>Mask Name</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Description</b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">OPOST</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Perform output processing.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"
|
|
border="0"> ONLCR</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Map NL to CR-NL on output.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">OCRNL</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Map CR to NL on output.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">ONOCR</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">No CR output at column 0.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">ONLRET</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">NL performs CR function.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">OFILL</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Use fill characters for delay.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">OFDEL</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Fill is DEL, else NUL.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">NLDLY</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Select newline delays:</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">NL0</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Newline character type 0.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">NL1</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Newline character type 1.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">CRDLY</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Select carriage-return delays:</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">CR0</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Carriage-return delay type 0.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">CR1</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Carriage-return delay type 1.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">CR2</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Carriage-return delay type 2.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">CR3</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Carriage-return delay type 3.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">TABDLY</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Select horizontal-tab delays:</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">TAB0</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Horizontal-tab delay type 0.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">TAB1</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Horizontal-tab delay type 1.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">TAB2</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Horizontal-tab delay type 2.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">TAB3</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Expand tabs to spaces.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">BSDLY</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Select backspace delays:</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">BS0</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Backspace-delay type 0.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">BS1</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Backspace-delay type 1.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">VTDLY</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Select vertical-tab delays:</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">VT0</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Vertical-tab delay type 0.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">VT1</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Vertical-tab delay type 1.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">FFDLY</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Select form-feed delays:</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">FF0</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Form-feed delay type 0.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">FF1</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Form-feed delay type 1. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
|
|
<p>If OPOST is set, output data shall be post-processed as described below, so that lines of text are modified to appear
|
|
appropriately on the terminal device; otherwise, characters shall be transmitted without change.</p>
|
|
|
|
<p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
If ONLCR is set, the NL character shall be transmitted as the CR-NL character pair. If OCRNL is set, the CR character shall be
|
|
transmitted as the NL character. If ONOCR is set, no CR character shall be transmitted when at column 0 (first position). If ONLRET
|
|
is set, the NL character is assumed to do the carriage-return function; the column pointer shall be set to 0 and the delays
|
|
specified for CR shall be used. Otherwise, the NL character is assumed to do just the line-feed function; the column pointer
|
|
remains unchanged. The column pointer shall also be set to 0 if the CR character is actually transmitted.</p>
|
|
|
|
<p>The delay bits specify how long transmission stops to allow for mechanical or other movement when certain characters are sent to
|
|
the terminal. In all cases a value of 0 shall indicate no delay. If OFILL is set, fill characters shall be transmitted for delay
|
|
instead of a timed delay. This is useful for high baud rate terminals which need only a minimal delay. If OFDEL is set, the fill
|
|
character shall be DEL; otherwise, NUL.</p>
|
|
|
|
<p>If a form-feed or vertical-tab delay is specified, it shall last for about 2 seconds.</p>
|
|
|
|
<p>Newline delay shall last about 0.10 seconds. If ONLRET is set, the carriage-return delays shall be used instead of the newline
|
|
delays. If OFILL is set, two fill characters shall be transmitted.</p>
|
|
|
|
<p>Carriage-return delay type 1 shall be dependent on the current column position, type 2 shall be about 0.10 seconds, and type 3
|
|
shall be about 0.15 seconds. If OFILL is set, delay type 1 shall transmit two fill characters, and type 2 four fill characters.</p>
|
|
|
|
<p>Horizontal-tab delay type 1 shall be dependent on the current column position. Type 2 shall be about 0.10 seconds. Type 3
|
|
specifies that tabs shall be expanded into spaces. If OFILL is set, two fill characters shall be transmitted for any delay.</p>
|
|
|
|
<p>Backspace delay shall last about 0.05 seconds. If OFILL is set, one fill character shall be transmitted.</p>
|
|
|
|
<p>The actual delays depend on line speed and system load. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
|
|
|
|
<p>The initial output control value after <a href="../functions/open.html"><i>open</i>()</a> is implementation-defined.</p>
|
|
|
|
<h4><a name="tag_11_02_04"></a>Control Modes</h4>
|
|
|
|
<p>The <i>c_cflag</i> field describes the hardware control of the terminal, and is composed of the bitwise-inclusive OR of the
|
|
masks shown, which shall be bitwise-distinct. The mask name symbols in this table are defined in <a href=
|
|
"termios.h.html"><i><termios.h></i></a> ; not all values specified are required to be supported by the underlying
|
|
hardware:</p>
|
|
|
|
<center>
|
|
<table border="1" cellpadding="3" align="center">
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b>Mask Name</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Description</b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">CLOCAL</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Ignore modem status lines.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">CREAD</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Enable receiver.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">CSIZE</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Number of bits transmitted or received per byte:</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"> CS5</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"> 5 bits</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"> CS6</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"> 6 bits</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"> CS7</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"> 7 bits</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"> CS8</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"> 8 bits.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">CSTOPB</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Send two stop bits, else one.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">HUPCL</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Hang up on last close.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">PARENB</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Parity enable.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">PARODD</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Odd parity, else even.</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
|
|
<p>In addition, the input and output baud rates are stored in the <b>termios</b> structure. The symbols in the following table are
|
|
defined in <a href="termios.h.html"><i><termios.h></i></a> . Not all values specified are required to be supported by the
|
|
underlying hardware.</p>
|
|
|
|
<center>
|
|
<table border="1" cellpadding="3" align="center">
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b>Name</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Description</b></p>
|
|
</th>
|
|
<th align="left">
|
|
<p class="tent">Name</p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Description</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b> </b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">B0</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Hang up</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">B600</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">600 baud</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">B50</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">50 baud</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">B1200</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">1200 baud</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">B75</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">75 baud</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">B1800</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">1800 baud</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">B110</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">110 baud</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">B2400</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">2400 baud</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">B134</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">134.5 baud</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">B4800</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">4800 baud</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">B150</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">150 baud</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">B9600</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">9600 baud</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">B200</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">200 baud</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">B19200</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">19200 baud</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">B300</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">300 baud</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">B38400</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">38400 baud</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
|
|
<p>The following functions are provided for getting and setting the values of the input and output baud rates in the <b>termios</b>
|
|
structure: <a href="../functions/cfgetispeed.html"><i>cfgetispeed</i>()</a>, <a href=
|
|
"../functions/cfgetospeed.html"><i>cfgetospeed</i>()</a>, <a href="../functions/cfsetispeed.html"><i>cfsetispeed</i>()</a>, and <a
|
|
href="../functions/cfsetospeed.html"><i>cfsetospeed</i>()</a>. The effects on the terminal device shall not become effective and
|
|
not all errors need be detected until the <a href="../functions/tcsetattr.html"><i>tcsetattr</i>()</a> function is successfully
|
|
called.</p>
|
|
|
|
<p>The CSIZE bits shall specify the number of transmitted or received bits per byte. If ISTRIP is not set, the value of all the
|
|
other bits is unspecified. If ISTRIP is set, the value of all but the 7 low-order bits shall be zero, but the value of any other
|
|
bits beyond CSIZE is unspecified when read. CSIZE shall not include the parity bit, if any. If CSTOPB is set, two stop bits shall
|
|
be used; otherwise, one stop bit. For example, at 110 baud, two stop bits are normally used.</p>
|
|
|
|
<p>If CREAD is set, the receiver shall be enabled; otherwise, no characters shall be received.</p>
|
|
|
|
<p>If PARENB is set, parity generation and detection shall be enabled and a parity bit is added to each byte. If parity is enabled,
|
|
PARODD shall specify odd parity if set; otherwise, even parity shall be used.</p>
|
|
|
|
<p>If HUPCL is set, the modem control lines for the port shall be lowered when the last process with the port open closes the port
|
|
or the process terminates. The modem connection shall be broken.</p>
|
|
|
|
<p>If CLOCAL is set, a connection shall not depend on the state of the modem status lines. If CLOCAL is clear, the modem status
|
|
lines shall be monitored.</p>
|
|
|
|
<p>Under normal circumstances, a call to the <a href="../functions/open.html"><i>open</i>()</a> function shall wait for the modem
|
|
connection to complete. However, if the O_NONBLOCK flag is set (see <a href="../functions/open.html"><i>open</i>()</a>) or if
|
|
CLOCAL has been set, the <a href="../functions/open.html"><i>open</i>()</a> function shall return immediately without waiting for
|
|
the connection.</p>
|
|
|
|
<p>If the object for which the control modes are set is not an asynchronous serial connection, some of the modes may be ignored;
|
|
for example, if an attempt is made to set the baud rate on a network connection to a terminal on another host, the baud rate need
|
|
not be set on the connection between that terminal and the machine to which it is directly connected.</p>
|
|
|
|
<p>The initial hardware control value after <a href="../functions/open.html"><i>open</i>()</a> is implementation-defined.</p>
|
|
|
|
<h4><a name="tag_11_02_05"></a>Local Modes</h4>
|
|
|
|
<p>The <i>c_lflag</i> field of the argument structure is used to control various functions. It is composed of the bitwise-inclusive
|
|
OR of the masks shown, which shall be bitwise-distinct. The mask name symbols in this table are defined in <a href=
|
|
"termios.h.html"><i><termios.h></i></a> ; not all values specified are required to be supported by the underlying
|
|
hardware:</p>
|
|
|
|
<center>
|
|
<table border="1" cellpadding="3" align="center">
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b>Mask Name</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Description</b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">ECHO</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Enable echo.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">ECHOE</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Echo ERASE as an error correcting backspace.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">ECHOK</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Echo KILL.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">ECHONL</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Echo <newline>.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">ICANON</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Canonical input (erase and kill processing).</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">IEXTEN</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Enable extended (implementation-defined) functions.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">ISIG</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Enable signals.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">NOFLSH</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Disable flush after interrupt, quit, or suspend.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">TOSTOP</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Send SIGTTOU for background output.</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
|
|
<p>If ECHO is set, input characters shall be echoed back to the terminal. If ECHO is clear, input characters shall not be
|
|
echoed.</p>
|
|
|
|
<p>If ECHOE and ICANON are set, the ERASE character shall cause the terminal to erase, if possible, the last character in the
|
|
current line from the display. If there is no character to erase, an implementation may echo an indication that this was the case,
|
|
or do nothing.</p>
|
|
|
|
<p>If ECHOK and ICANON are set, the KILL character shall either cause the terminal to erase the line from the display or shall echo
|
|
the newline character after the KILL character.</p>
|
|
|
|
<p>If ECHONL and ICANON are set, the newline character shall be echoed even if ECHO is not set.</p>
|
|
|
|
<p>If ICANON is set, canonical processing shall be enabled. This enables the erase and kill edit functions, and the assembly of
|
|
input characters into lines delimited by NL, EOF, and EOL, as described in <a href="#tag_11_01_06">Canonical Mode Input
|
|
Processing</a> .</p>
|
|
|
|
<p>If ICANON is not set, read requests shall be satisfied directly from the input queue. A read shall not be satisfied until at
|
|
least MIN bytes have been received or the timeout value TIME expired between bytes. The time value represents tenths of a second.
|
|
See <a href="#tag_11_01_07">Non-Canonical Mode Input Processing</a> for more details.</p>
|
|
|
|
<p>If IEXTEN is set, implementation-defined functions shall be recognized from the input data. It is implementation-defined how
|
|
IEXTEN being set interacts with ICANON, ISIG, IXON, or IXOFF. If IEXTEN is not set, implementation-defined functions shall not be
|
|
recognized and the corresponding input characters are processed as described for ICANON, ISIG, IXON, and IXOFF.</p>
|
|
|
|
<p>If ISIG is set, each input character shall be checked against the special control characters INTR, QUIT, and SUSP. If an input
|
|
character matches one of these control characters, the function associated with that character shall be performed. If ISIG is not
|
|
set, no checking shall be done. Thus these special input functions are possible only if ISIG is set.</p>
|
|
|
|
<p>If NOFLSH is set, the normal flush of the input and output queues associated with the INTR, QUIT, and SUSP characters shall not
|
|
be done.</p>
|
|
|
|
<p>If TOSTOP is set, the signal SIGTTOU shall be sent to the process group of a process that tries to write to its controlling
|
|
terminal if it is not in the foreground process group for that terminal. This signal, by default, stops the members of the process
|
|
group. Otherwise, the output generated by that process shall be output to the current output stream. Processes that are blocking or
|
|
ignoring SIGTTOU signals are excepted and allowed to produce output, and the SIGTTOU signal shall not be sent.</p>
|
|
|
|
<p>The initial local control value after <a href="../functions/open.html"><i>open</i>()</a> is implementation-defined.</p>
|
|
|
|
<h4><a name="tag_11_02_06"></a>Special Control Characters</h4>
|
|
|
|
<p>The special control character values shall be defined by the array <i>c_cc</i>. The subscript name and description for each
|
|
element in both canonical and non-canonical modes are as follows:</p>
|
|
|
|
<center>
|
|
<table border="1" cellpadding="3" align="center">
|
|
<tr valign="top">
|
|
<th colspan="2" align="center">
|
|
<p class="tent"><b>Subscript Usage</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b> </b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b>_</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>_</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b> </b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b>Canonical</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Non-Canonical</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b> </b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b>Mode</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Mode</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Description</b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">VEOF</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"> </p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">EOF character</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">VEOL</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"> </p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">EOL character</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">VERASE</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"> </p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">ERASE character</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">VINTR</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">VINTR</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">INTR character</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">VKILL</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"> </p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">KILL character</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"> </p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">VMIN</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">MIN value</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">VQUIT</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">VQUIT</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">QUIT character</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">VSUSP</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">VSUSP</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">SUSP character</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"> </p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">VTIME</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">TIME value</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">VSTART</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">VSTART</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">START character</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">VSTOP</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">VSTOP</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">STOP character</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
|
|
<p>The subscript values are unique, except that the VMIN and VTIME subscripts may have the same values as the VEOF and VEOL
|
|
subscripts, respectively.</p>
|
|
|
|
<p>Implementations that do not support changing the START and STOP characters may ignore the character values in the <i>c_cc</i>
|
|
array indexed by the VSTART and VSTOP subscripts when <a href="../functions/tcsetattr.html"><i>tcsetattr</i>()</a> is called, but
|
|
shall return the value in use when <a href="../functions/tcgetattr.html"><i>tcgetattr</i>()</a> is called.</p>
|
|
|
|
<p>The initial values of all control characters are implementation-defined.</p>
|
|
|
|
<p>If the value of one of the changeable special control characters (see <a href="#tag_11_01_09">Special Characters</a> ) is
|
|
_POSIX_VDISABLE, that function shall be disabled; that is, no input data is recognized as the disabled special character. If ICANON
|
|
is not set, the value of _POSIX_VDISABLE has no special meaning for the VMIN and VTIME entries of the <i>c_cc</i> array.</p>
|
|
|
|
<hr size="2" noshade>
|
|
<center><font size="2"><!--footer start-->
|
|
UNIX ® is a registered Trademark of The Open Group.<br>
|
|
POSIX ® is a registered Trademark of The IEEE.<br>
|
|
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
|
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
|
]</font></center>
|
|
|
|
<!--footer end-->
|
|
<hr size="2" noshade>
|
|
</body>
|
|
</html>
|
|
|