📄 termios.4
字号:
process group for which the terminal is the controllingterminal. If.Dv ISIGis set, the.Dv INTRcharacter isdiscarded when processed..It Dv QUITSpecial character on input and is recognized if the.Dv ISIGflag is enabled. Generates a.Dv SIGQUITsignal which issent to all processes in the foreground process groupfor which the terminal is the controlling terminal. If.Dv ISIGis set, the.Dv QUITcharacter is discarded whenprocessed..It Dv ERASESpecial character on input and is recognized if the.Dv ICANONflag is set. Erases the last character in thecurrent line; see.Sx "Canonical Mode Input Processing" .It does not erase beyondthe start of a line, as delimited by an.Dv NL ,.Dv EOF ,or.Dv EOLcharacter. If.Dv ICANONis set, the.Dv ERASEcharacter isdiscarded when processed..It Dv KILLSpecial character on input and is recognized if the.Dv ICANONflag is set. Deletes the entire line, asdelimited by a.Dv NL ,.Dv EOF ,or.Dv EOLcharacter. If.Dv ICANONis set, the.Dv KILLcharacter is discarded when processed..It Dv EOFSpecial character on input and is recognized if the.Dv ICANONflag is set. When received, all the byteswaiting to be read are immediately passed to theprocess, without waiting for a newline, and the.Dv EOFis discarded. Thus, if there are no bytes waiting (thatis, the.Dv EOFoccurred at the beginning of a line), a bytecount of zero is returned from the read(),representing an end-of-file indication. If.Dv ICANONisset, the.Dv EOFcharacter is discarded when processed..Dv NLSpecial character on input and is recognized if the.Dv ICANONflag is set. It is the line delimiter.Ql \&\en ..It Dv EOLSpecial character on input and is recognized if the.Dv ICANONflag is set. Is an additional line delimiter,like.Dv NL ..It Dv SUSPIf the.Dv ISIGflag is enabled, receipt of the.Dv SUSPcharacter causes a.Dv SIGTSTPsignal to be sent to all processes in theforeground process group for which the terminal is thecontrolling terminal, and the.Dv SUSPcharacter isdiscarded when processed..It Dv STOPSpecial character on both input and output and isrecognized if the.Dv IXON(output control) or.Dv IXOFF(inputcontrol) flag is set. Can be used to temporarilysuspend output. It is useful with fast terminals toprevent output from disappearing before it can be read.If.Dv IXONis set, the.Dv STOPcharacter is discarded whenprocessed..It Dv STARTSpecial character on both input and output and isrecognized if the.Dv IXON(output control) or.Dv IXOFF(inputcontrol) flag is set. Can be used to resume output thathas been suspended by a.Dv STOPcharacter. If.Dv IXONis set, the.Dv STARTcharacter is discarded when processed..Dv CRSpecial character on input and is recognized if the.Dv ICANONflag is set; it is the.Ql \&\er ,as denoted in the.Tn \&CStandard {2}. When.Dv ICANONand.Dv ICRNLare set and.Dv IGNCRis not set, this character is translated into a.Dv NL ,andhas the same effect as a.Dv NLcharacter..El.PpThe following special characters are extensions defined by thissystem and are not a part of 1003.1 termios..Bl -tag -width indent.It Dv EOL2Secondary.Dv EOLcharacter. Same function as.Dv EOL..It Dv WERASESpecial character on input and is recognized if the.Dv ICANONflag is set. Erases the last word in the currentline according to one of two algorithms. If the.Dv ALTWERASEflag is not set, first any preceding whitespace iserased, and then the maximal sequence of non-whitespacecharacters. If.Dv ALTWERASEis set, first any precedingwhitespace is erased, and then the maximal sequenceof alphabetic/underscores or non alphabetic/underscores.As a special case in this second algorithm, the first previousnon-whitespace character is skipped in determiningwhether the preceding word is a sequence ofalphabetic/undercores. This sounds confusing but turnsout to be quite practical..It Dv REPRINTSpecial character on input and is recognized if the.Dv ICANONflag is set. Causes the current input edit lineto be retyped..It Dv DSUSPHas similar actions to the.Dv SUSPcharacter, except thatthe.Dv SIGTSTPsignal is delivered when one of the processesin the foreground process group issues a read() to thecontrolling terminal..It Dv LNEXTSpecial character on input and is recognized if the.Dv IEXTENflag is set. Receipt of this character causes the nextcharacter to be taken literally..It Dv DISCARDSpecial character on input and is recognized if the.Dv IEXTENflag is set. Receipt of this character toggles the flushingof terminal output..It Dv STATUSSpecial character on input and is recognized if the.Dv ICANONflag is set. Receipt of this character causes a.Dv SIGINFOsignal to be sent to the foreground process group of theterminal. Also, if the.Dv NOKERNINFOflag is not set, itcauses the kernel to write a status message to the terminalthat displays the current load average, the name of thecommand in the foreground, its process ID, the symbolicwait channel, the number of user and system seconds used,the percentage of cpu the process is getting, and the residentset size of the process..El.PpThe.Dv NLand.Dv CRcharacters cannot be changed.The values for all the remaining characters can be set and aredescribed later in the document underSpecial Control Characters..PpSpecialcharacter functions associated with changeable special control characterscan be disabled individually by setting their value to.Dv {_POSIX_VDISABLE};see.Sx "Special Control Characters" ..PpIf two or more special characters have the same value, the functionperformed when that character is received is undefined..Ss Modem DisconnectIf a modem disconnect is detected by the terminal interface for acontrolling terminal, and if.Dv CLOCALis not set in the.Fa c_cflagfield forthe terminal, the.Dv SIGHUPsignal is sent to the controllingprocess associated with the terminal. Unless other arrangements havebeen made, this causes the controlling process to terminate.Any subsequent call to the read() function returns the value zero,indicating end of file. Thus, processes that read a terminalfile and test for end-of-file can terminate appropriately after adisconnect..\" If the.\" .Er EIO.\" condition specified in 6.1.1.4 that applies.\" when the implementation supports job control also exists, it is.\" unspecified whether the.\" .Dv EOF.\" condition or the.\" .Pf [ Dv EIO.\" ] is returned.Anysubsequent write() to the terminal device returns -1, with.Va errnoset to.Er EIO ,until the device is closed..Sh General Terminal Interface.Pp.Ss Closing a Terminal Device FileThe last process to close a terminal device file causes any outputto be sent to the device and any input to be discarded. Then, if.Dv HUPCLis set in the control modes, and the communications port supports adisconnect function, the terminal device performs a disconnect..Ss Parameters That Can Be SetRoutines that need to control certain terminal.Tn I/Ocharacteristicsdo so by using the termios structure as defined in the header.Aq Pa termios.h .This structure contains minimally four scalar elements of bit flagsand one array of special characters. The scalar flag elements arenamed:.Fa c_iflag ,.Fa c_oflag ,.Fa c_cflag ,and.Fa c_lflag .The character array is named.Fa c_cc ,and its maximum index is.Dv NCCS ..Ss Input ModesValues of the.Fa c_iflagfield describe the basicterminal input control, and are composed offollowing masks:.Pp.Bl -tag -width IMAXBEL -offset indent -compact.It Dv IGNBRK/* ignore BREAK condition */.It Dv BRKINT/* map BREAK to SIGINTR */.It Dv IGNPAR/* ignore (discard) parity errors */.It Dv PARMRK/* mark parity and framing errors */.It Dv INPCK/* enable checking of parity errors */.It Dv ISTRIP/* strip 8th bit off chars */.It Dv INLCR/* map NL into CR */.It Dv IGNCR/* ignore CR */.It Dv ICRNL/* map CR to NL (ala CRMOD) */.It Dv IXON/* enable output flow control */.It Dv IXOFF/* enable input flow control */.It Dv IXANY/* any char will restart after stop */.It Dv IMAXBEL/* ring bell on input queue full */.El.PpIn the context of asynchronous serial data transmission, a breakcondition is defined as a sequence of zero-valued bits that continues formore than the time to send one byte. The entire sequence of zero-valuedbits is interpreted as a single break condition, even if it continues fora time equivalent to more than one byte. In contexts other thanasynchronous serial data transmission the definition of a break conditionis implementation defined..PpIf.Dv IGNBRKis set, a break condition detected on input is ignored, thatis, not put on the input queue and therefore not read by any process. If.Dv IGNBRKis not set and.Dv BRKINTis set, the break condition flushes theinput and output queues and if the terminal is the controlling terminalof a foreground process group, the break condition generates asingle.Dv SIGINTsignal to that foreground process group. If neither.Dv IGNBRKnor.Dv BRKINTis set, a break condition is read as a single.Ql \&\e0 ,or if.Dv PARMRKis set, as.Ql \&\e377 ,.Ql \&\e0 ,.Ql \&\e0 ..PpIf.Dv IGNPARis set, a byte with a framing or parity error (other thanbreak) is ignored..PpIf.Dv PARMRKis set, and.Dv IGNPARis not set, a byte with a framing or parityerror (other than break) is given to the application as thethree-character sequence.Ql \&\e377 ,.Ql \&\e0 ,X, where.Ql \&\e377 ,.Ql \&\e0is a two-characterflag preceding each sequence and X is the data of the character receivedin error. To avoid ambiguity in this case, if.Dv ISTRIPis not set, a validcharacter of.Ql \&\e377is given to the application as.Ql \&\e377 ,.Ql \&\e377 .Ifneither.Dv PARMRKnor.Dv IGNPARis set, a framing or parity error (other thanbreak) is given to the application as a single character.Ql \&\e0 ..PpIf.Dv INPCKis set, input parity checking is enabled. If.Dv INPCKis not set,input parity checking is disabled, allowing output parity generationwithout input parity errors. Note that whether input parity checking isenabled or disabled is independent of whether parity detection is enabledor disabled (see.Sx "Control Modes" ) .If parity detection is enabled but inputparity checking is disabled, the hardware to which the terminal isconnected recognizes the parity bit, but the terminal special filedoes not check whether this bit is set correctly or not..PpIf.Dv ISTRIPis set, valid input bytes are first stripped to seven bits,otherwise all eight bits are processed..PpIf.Dv INLCRis set, a received.Dv NLcharacter is translated into a.Dv CRcharacter. If.Dv IGNCRis set, a received.Dv CRcharacter is ignored (notread). If.Dv IGNCRis not set and.Dv ICRNLis set, a received.Dv CRcharacter istranslated into a.Dv NLcharacter..PpIf.Dv IXONis set, start/stop output control is enabled. A received.Dv STOPcharacter suspends output and a received.Dv STARTcharacterrestarts output. If.Dv IXANYis also set, then any character mayrestart output. When.Dv IXONis set,.Dv STARTand.Dv STOPcharacters are notread, but merely perform flow control functions. When.Dv IXONis not set,the.Dv STARTand.Dv STOPcharacters are read..PpIf.Dv IXOFFis set, start/stop input control is enabled. The system shalltransmit one or more.Dv STOPcharacters, which are intended to cause theterminal device to stop transmitting data, as needed to prevent the inputqueue from overflowing and causing the undefined behavior described in.Sx "Input Processing and Reading Data" ,and shall transmit one or more
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -