📄 termios.html
字号:
not all values specified are required to be supported by the underlying hardware:<pre><table bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Mask Name</b><th align=center><b>Description</b><tr valign=top><td align=left>CLOCAL<td align=left>Ignore modem status lines.<tr valign=top><td align=left>CREAD<td align=left>Enable receiver.<tr valign=top><td align=left>CSIZE<td align=left>Number of bits transmitted or received per byte:<tr valign=top><td align=left> CS5<td align=left> 5 bits<tr valign=top><td align=left> CS6<td align=left> 6 bits<tr valign=top><td align=left> CS7<td align=left> 7 bits<tr valign=top><td align=left> CS8<td align=left> 8 bits.<tr valign=top><td align=left>CSTOPB<td align=left>Send two stop bits, else one.<tr valign=top><td align=left>HUPCL<td align=left>Hang up on last close.<tr valign=top><td align=left>PARENB<td align=left>Parity enable.<tr valign=top><td align=left>PARODD<td align=left>Odd parity, else even.</table></pre><p>In addition, the input and outputbaud rates are stored in the<b>termios</b>structure.The following values are supported:<pre><table bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Name</b><th align=center><b>Description</b><th align=left>Name<th align=center><b>Description</b><tr valign=top><td align=left>B0<td align=left>Hang up<td align=left>B600<td align=left>600 baud<tr valign=top><td align=left>B50<td align=left>50 baud<td align=left>B1200<td align=left>1200 baud<tr valign=top><td align=left>B75<td align=left>75 baud<td align=left>B1800<td align=left>1800 baud<tr valign=top><td align=left>B110<td align=left>110 baud<td align=left>B2400<td align=left>2400 baud<tr valign=top><td align=left>B134<td align=left>134.5 baud<td align=left>B4800<td align=left>4800 baud<tr valign=top><td align=left>B150<td align=left>150 baud<td align=left>B9600<td align=left>9600 baud<tr valign=top><td align=left>B200<td align=left>200 baud<td align=left>B19200<td align=left>19200 baud<tr valign=top><td align=left>B300<td align=left>300 baud<td align=left>B38400<td align=left>38400 baud</table></pre><p>The following interfaces are provided forgetting and setting the values of the input andoutput baud rates in the <b>termios</b>structure:<i><a href="../xsh/cfgetispeed.html">cfgetispeed()</a></i>,<i><a href="../xsh/cfgetospeed.html">cfgetospeed()</a></i>,<i><a href="../xsh/cfsetispeed.html">cfsetispeed()</a></i>and<i><a href="../xsh/cfsetospeed.html">cfsetospeed()</a></i>.The effects on the terminal device do not become effective and not all errors are detected until the<i><a href="../xsh/tcsetattr.html">tcsetattr()</a></i>function is successfully called.<br><p>The CSIZE bits specify the number of transmitted or received bitsper byte.If ISTRIP is not set, the value of all the other bits isunspecified.If ISTRIP is set, the value ofall but the 7 low-order bits is zero,but the value of any other bits beyond CSIZE is unspecified when read.CSIZE does not include theparity bit, if any.If CSTOPB is set, two stop bits are used,otherwise one stop bit.For example,at 110 baud, two stop bits are normally used.<p>If CREAD is set, the receiveris enabled.Otherwise, no characters will be received.<p>If PARENB is set, parity generationand detection is enabled and a parity bit is added toeach byte.If parity is enabled,PARODD specifies odd parity if set, otherwise evenparity is used.<p>If HUPCL is set, the modemcontrol lines for the port are lowered when the lastprocess with the port open closesthe port or the process terminates.The modemconnection is broken.<p>If CLOCAL is set, a connectiondoes not depend on the state of the modem status lines.IfCLOCAL is clear, the modem statuslines are monitored.<p>Under normal circumstances, a call tothe<i><a href="../xsh/open.html">open()</a></i>function waits for the modem connection to complete.However, if the O_NONBLOCK flag is set (see<i><a href="../xsh/open.html">open()</a></i>)or if CLOCAL has been set, the<i><a href="../xsh/open.html">open()</a></i>function returns immediately without waiting for the connection.<p>If the object for which thecontrol modes are set is not an asynchronous serial connection,some of the modes may beignored; for example, if an attempt is made to set the baud rate on anetwork connection to a terminal onanother host, the baud rate may or may not be set onthe connection between that terminal andthe machine to which it is directly connected.<p>The initial hardware control value after<i><a href="../xsh/open.html">open()</a></i>is implementation-dependent.<br><h4><a name = "tag_008_002_005"> </a>Local Modes</h4><xref type="3" name="localmodes"></xref>The<b>c_lflag</b>field of the argumentstructure is used to control various functions.It is composed of thebitwise inclusive OR of the masks shown, which will bebitwise distinct.The mask name symbols in this table are definedin<i><a href="../xsh/termios.h.html"><termios.h></a></i>;not all values specifiedare required to be supported bythe underlying hardware:<p><table bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Mask Name</b><th align=center><b>Description</b><tr valign=top><td align=left>ECHO<td align=left>Enable echo.<tr valign=top><td align=left>ECHOE<td align=left>Echo ERASE as an error correcting backspace.<tr valign=top><td align=left>ECHOK<td align=left>Echo KILL.<tr valign=top><td align=left>ECHONL<td align=left>Echo <newline>.<tr valign=top><td align=left>ICANON<td align=left>Canonical input (erase and kill processing).<tr valign=top><td align=left>IEXTEN<td align=left>Enable extended (implementation-dependent) functions.<tr valign=top><td align=left>ISIG<td align=left>Enable signals.<tr valign=top><td align=left>NOFLSH<td align=left>Disable flush after interrupt, quit or suspend.<tr valign=top><td align=left>TOSTOP<td align=left>Send SIGTTOU for background output.<tr valign=top><td align=left>XCASE<td align=left> Canonical upper/lower presentation. (<b>LEGACY</b>) </table><p>If ECHO is set, input characters are echoed back to the terminal.If ECHO is clear, input characters are not echoed.<p>If ECHOE and ICANON are set,the ERASE character causes the terminal to erase, if possible, thelast character in the current line from the display.If there were no character to erase, an implementation mightecho an indication that this was the case, or do nothing.<p>If ECHOK and ICANON are set,the KILL character causes the terminal to erasethe line from the display or echoes the newlinecharacter after the KILL character.<p>If ECHONL and ICANON are set, the newlinecharacter is echoed even if ECHO is not set.<p>If ICANON is set, canonical processing is enabled.This enables the erase and kill editfunctions, and the assembly of inputcharacters into lines delimited by NL, EOF andEOL, as described in<xref href=canon><a href="#tag_008_001_006">Canonical Mode Input Processing</a></xref>.<p>If ICANON is not set, readrequests are satisfied directly from the input queue.A read is not satisfied until atleast MIN bytes have been received or the timeout valueTIME expired between bytes.The time value represents tenths of a second.See<xref href=noncanon><a href="#tag_008_001_007">Non-canonical Mode Input Processing</a></xref>for more details.<p>If IEXTEN is set, implementation-dependent functionsare recognised from the input data.It is implementation-dependent how IEXTENbeing set interacts with ICANON, ISIG, IXON or IXOFF.If IEXTEN is not set, implementation-dependent functions are notrecognised and the corresponding inputcharacters are processed as described forICANON, ISIG, IXON and IXOFF.<p>If ISIG is set, each input characteris checked against the special control characters INTR,QUIT and SUSP.If an input character matches one of these controlcharacters, the function associated with thatcharacter is performed.If ISIG is not set, no checking is done.Thus these special input functions are possible only if ISIG is set.<p>If NOFLSH is set, the normalflush of the input and output queues associated with theINTR, QUIT and SUSP characters is not done.<p>If TOSTOP is set, the signal SIGTTOU is sentto the process group of aprocess that tries to write to its controlling terminal if it is not inthe foreground process group for that terminal.This signal, by default, stops the members of the process group.Otherwise, the output generated by that process is outputto the current output stream.Processes that are blocking or ignoring SIGTTOU signalsare excepted and allowed to produceoutput, and the SIGTTOU signal is not sent.<p>If XCASE is set, canonical lower andcanonical upper presentation are performed.In locales other than the POSIX locale, the effect is unspecified.(<b>LEGACY</b>)<p>The initial local control value after<i><a href="../xsh/open.html">open()</a></i>is implementation-dependent.<br><h4><a name = "tag_008_002_006"> </a>Special Control Characters</h4>The special control characters values aredefined by the array<b>c_cc</b>.The subscript nameand description for each element inboth canonical and non-canonical modes are asfollows:<p><table bordercolor=#000000 border=1 align=center><tr valign=top><th colspan=2 align=center><b>Subscript Usage</b><th align=left> <tr valign=top><th align=center><b>Canonical</b><th align=center><b>Non-canonical</b><th align=left> <tr valign=top><th align=center><b>Mode</b><th align=center><b>Mode</b><th align=center><b>Description</b><tr valign=top><td align=left>VEOF<td align=left> <td align=left>EOF character<tr valign=top><td align=left>VEOL<td align=left> <td align=left>EOL character<tr valign=top><td align=left>VERASE<td align=left> <td align=left>ERASE character<tr valign=top><td align=left>VINTR<td align=left>VINTR<td align=left>INTR character<tr valign=top><td align=left>VKILL<td align=left> <td align=left>KILL character<tr valign=top><td align=left> <td align=left>VMIN<td align=left>MIN value<tr valign=top><td align=left>VQUIT<td align=left>VQUIT<td align=left>QUIT character<tr valign=top><td align=left>VSUSP<td align=left>VSUSP<td align=left>SUSP character<tr valign=top><td align=left> <td align=left>VTIME<td align=left>TIME value<tr valign=top><td align=left>VSTART<td align=left>VSTART<td align=left>START character<tr valign=top><td align=left>VSTOP<td align=left>VSTOP<td align=left>STOP character</table><p>The subscript values are unique,except that the VMIN and VTIME subscripts mayhave the same values as theVEOF and VEOL subscripts, respectively.<p>The number of elements in the<b>c_cc</b>array, NCCS, is unspecified.<p>Implementations that do not support changing the START and STOPcharacters may ignore the character values in the<b>c_cc</b>array indexed by the VSTART and VSTOP subscripts when<i><a href="../xsh/tcsetattr.html">tcsetattr()</a></i>is called, but will return the value in use when<i><a href="../xsh/tcgetattr.html">tcgetattr()</a></i>is called.<p>The initial values of all controlcharacters are implementation-dependent.<p>If the value of one ofthe changeable special control characters (see<xref href=specchar><a href="#tag_008_001_009">Special Characters</a></xref>)is {_POSIX_VDISABLE}, that function is disabled; that is, no input data will be recognised as the disabled special character.If ICANON is not set, the value of {_POSIX_VDISABLE} has no specialmeaning for the VMIN and VTIME entries of the<b>c_cc</b>array.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -