Content-type: text/html Man page of termios

termios

Section: Devices and Network Interfaces (4)
Index Return to Main Contents
 

NAME

termios, termios.h - Defines the structure of the termios file, which provides the terminal interface for POSIX compatibility.  

DESCRIPTION

The /usr/include/termios.h header file is used to obtain and modify attributes required by the terminal driver. These attributes control input and output processing. The definition values and structure in the /usr/include/termios.h file are required for P1003.1 POSIX compliance.

The primary mechanism for obtaining and setting terminal driver parameters is through the following POSIX functions: tcgetattr() tcsetattr() cfgetispeed() cfgetospeed() cfsetospeed() cfsetispeed()

Optionally the termios values can be obtained or set using the termios ioctls. See the tty(7) reference page. For compatibility the system supports BSD and System V ioctls, but they are internally translated into termios ioctls.

The termios structure in the <termios.h> header file contains the following fields: Describes the basic terminal input control. The possible input modes are: Ignores the break condition. If set, the break condition is not put on the input queue and is therefore not read by any process. Interrupts signal on the break condition. If set, the break condition generates an interrupt signal and flushes both the input and output queues. Ignores characters with parity errors. If set, characters with other framing and parity errors are ignored. Marks parity errors. If set, a character with a framing or parity error that is not ignored is read as the 3-character sequence: 0377, 0, x, where the x variable is the data of the character received in error. If the ISTRIP mode is not set, then a valid character of 0377 is read as 0377, 0377 to avoid ambiguity. If the PARMRK mode is clear, a framing or parity error that is not ignored is read as the null character. Enables input parity checking. If set, input parity checking is enabled. If clear, input parity checking is disabled. This allows for output parity generation without input parity errors. Strips characters. If set, valid input characters are first stripped to 7 bits; otherwise all 8 bits are processed. Maps new-line character (NL) to carriage return (CR) on input. If set, a received NL character is translated into a CR character. Ignores CR character. If set, a received CR character is ignored (not read). Maps CR character to NL character on input. If set, a received CR character is translated into a NL character. Maps uppercase to lowercase on input. If set, a received uppercase, alphabetic character is translated into the corresponding lowercase character. Enables start and stop output control. If set, a received STOP character suspends output, and a received START character restarts output. The START and STOP characters perform flow control functions but are not read. Enables any character to restart output. If set, any input character restarts output that was suspended. Enables start and stop input control. If set, the system transmits a STOP character when the input queue is nearly full and a START character when enough input has been read that the queue is nearly empty again. Echoes the ASCII BEL character if the input stream overflows. Further input is not stored, but any input received prior to the overflow condition is retained. If clear, the BEL character is not echoed, and the input in the input queue is discarded if the input stream overflows. Specifies how the system treats output. The possible output modes are: Postprocesses output. If set, output characters are processed as indicated by the remaining flags; otherwise, characters are transmitted without change. Maps lowercase to uppercase on output. If set, a lowercase alphabetic character is transmitted as the corresponding uppercase character. This function is often used in conjunction with the IUCLC input mode. Maps NL to CR-NL on output. If set, the NL character is transmitted as the CR-NL character pair. Maps CR to NL on output. If set, the CR character is transmitted as the NL character. Indicates no CR output at column 0. If set, no CR character is transmitted at column 0 (first position). NL performs CR function. If set, the NL character is assumed to do the carriage return function. The column pointer is set to a value of 0 and the delay specified for carriage return is used. Otherwise the NL character is assumed to do the line feed function only; the column pointer remains unchanged. The column pointer is also set to a value of 0 if the CR character is actually transmitted.

The delay bits specify how long a transmission stops to allow for mechanical or other movement when certain characters are sent to the terminal. The actual delays depend on line speed and system load. Uses fill characters for delay. If set, fill characters are transmitted for a delay instead of a timed delay. This is useful for high baud rate terminals that need only a minimal delay. Sets fill characters to the DEL value. If set, the fill character is DEL. If this flag is clear, the fill character is null. Selects the newline character delays. This is a mask to use before comparing to NL0 and NL1. Specifies no delay. Specifies one delay of approximately 0.10 seconds. If ONLRET is set, the carriage return delays are used instead of the newline delays. If OFILL is set, two fill characters are transmitted. Selects the carriage return delays. This is a mask to use before comparing to CR0, CR1, CR2, and CR3. Specifies no delay. Specifies that the delay is dependent on the current column position. If OFILL is set, this delay transmits two fill characters. Specifies one delay of approximately 0.10 seconds. If OFILL is set, this delay transmits four fill characters. Specifies one delay of approximately 0.15 seconds. Selects the horizontal tab delays. This is a mask to use before comparing to TAB0, TAB1, TAB2, and TAB3. If OFILL is set, any of these delays transmit two fill characters. Specifies no delay. Specifies that the delay is dependent on the current column position. If OFILL is set, two fill characters are transmitted. Specifies one delay of approximately 0.10 seconds. Specifies that tabs are to be expanded into spaces. Selects the backspace delays. This is a mask to use before comparing to BS0 and BS1. Specifies no delay. Specifies one delay of approximately 0.05 seconds. If OFILL is set, this delay transmits one fill character. Selects the vertical-tab delays. This is a mask to use before comparing to VT0 and VT1. Specifies no delay. Specifies one delay of approximately 2 seconds. Selects the formfeed delays. This is a mask to use before comparing to FF0 and FF1. Specifies no delay. Specifies one delay of approximately 2 seconds. Describes the hardware control of the terminal. In addition to the basic control modes, this field uses the following control characters: Enables hardware flow control using the Request to Sent (RTS) and Clear to Send (CTS) signals. Specifies the character size. These bits specify the character size in bits for both transmit and receive operations. This size does not include the parity bit, if any. 5 bits. 6 bits. 7 bits. 8 bits. Specifies number of stop bits. If set, 2 stop bits are sent; otherwise, only 1 stop bit is sent. Higher baud rates require 2 stop bits. (At 110 baud, for example, 2 stop bits are required.) Enables receiver. If set, the receiver is enabled. Otherwise, characters are not received. Enables parity. If set, parity generation and detection is enabled and a parity bit is added to each character. Specifies odd parity. If parity is enabled, this specifies odd parity. If clear, even parity is used. Hangs up on last close. If set, the line is disconnected when the last process closes the line or when the process terminates (when the `data terminal ready' signal drops). Specifies a local line. If set, the line is assumed to have a local, direct connection with no modem control. If clear, modem control (dialup) is assumed. The initial hardware control value after an open is CS8 and CREAD. Controls various terminal functions. In addition to the basic modes, this field uses the following mask name symbols: Enables signals. If set, each input character is checked against the INTR and QUIT special control characters. If a character matches one of these control characters, the function associated with that character is performed. If the ISIG function is clear, checking is not done. Enables canonical input. If set, turns on canonical processing, which enables the erase and kill edit functions as well as the assembly of input characters into lines delimited by NL, EOF, and EOL.
If the ICANON function is clear, read requests are satisfied directly from the input queue. In this case, a read request is not satisfied until one of the following conditions is met: a) the minimum number of characters specified by MIN are received; or b) the timeout value specified by TIME has expired since the last character was received. This allows bursts of input to be read, while still allowing single character input. The MIN and TIME values are stored in the VMIN and VTIME positions, respectively. The time value represents tenths of seconds. Enables canonical uppercase and lowercase presentation. If set along with the ICANON function, an uppercase letter (or the uppercase letter translated to lowercase by the IUCLC input mode) is accepted on input by preceding it with a \ (backslash) character. The output is then preceded by a backslash character. Enables echo. If set, characters are displayed on the terminal screen as they are received. Echoes erase character as BS-SP-BS. If the ECHO and ECHOE functions are both set and ECHOPRT is clear, the erase character is implemented as a backspace, a space, and then another backspace (ASCII BS-SP-BS). This clears the last character from the screen. If ECHOE is set, but ECHO is clear, the erase character is implemented as ASCII SP-BS. Echoes NL after kill. If ECHOK is set and ECHOKE is clear, a newline function is performed to clear the line after a KILL character is received. This emphasizes that the line is deleted. Note that an escape character preceding the ERASE or KILL character removes any special function. Echoes NL. If ECHONL is set, the line is cleared when a newline function is performed whether or not the ECHO function is set. This is useful for terminals that are set to local echo (also referred to as half-duplex). Unless an escape character precedes an EOF, the EOF character is not displayed. Because the ASCII EOT character is the default end-of-file character, this prevents terminals that respond to the EOT character from hanging up. Disables queue flushing. If set, the normal flushing of the input and output queues associated with the quit and interrupt characters is not done.
The ICANON, XCASE, ECHO, ECHOE, ECHOK, ECHONL, and NOFLSH special input functions are possible only if the ISIG function is set. These functions can be disabled individually by changing the value of the control character to an unlikely or impossible value (for example, 0377 octal or 0xFF) Echoes control characters as ^X, where the X variable is the character given by adding 100 octal to the code of the control character. The ASCII DEL character is echoed as ^? and the ASCII TAB, NL, and START characters are not echoed.
Unless an escape character precedes an EOF, the EOF character is not displayed. Because the ASCII EOT character is the default End-of-File character, this mask prevents terminals that respond to the EOT character from hanging up. Echoes the first ERASE and WERASE character in a sequence as a \ (backslash), and then erases the characters. Subsequent ERASE and WERASE characters echo the characters being erased (in reverse order). Echoes the kill character by erasing from the screen each character on the line. Flushes the output. When this bit is set by typing the FLUSH character, data written to the terminal is discarded. A terminal can cancel the effect of typing the FLUSH character by clearing this bit. Reprints any input that has not yet been read when the next character arrives as input. Enables extended (implementation-defined) functions to be recognized from the input data. If this bit is clear, implementation-defined functions are not recognized, and the corresponding input characters are processed as described for ICANON, ISIG, IXON, and IXOFF. Sends a SIGTTOU signal when a process in a background process group tries to write to its controlling terminal. The SIGTTOU signal stops the members of the process group. If job control is not supported, this symbol is ignored. Specifies an array that defines the special control characters. The relative positions and initial values for each function are: Indexes the INTR control character (Ctrl-Backspace), which sends a SIGINT signal to stop all processes controlled by this terminal. Indexes the QUIT control character (Ctrl-v or Ctrl-|), which sends a SIGQUIT signal to stop all processes controlled by this terminal and writes a core image file into the current working directory. Indexes the ERASE control character (Backspace), which erases the preceding character. The ERASE character does not erase beyond the beginning of the line (delimited by a NL, EOL, EOF, or EOL2 character). Indexes the KILL control character (Ctrl-u), which deletes the entire line (delimited by a NL, EOL, EOF, or EOL2 character). Indexes the EOF control character (Ctrl-d), which can be used at the terminal to generate an end-of-file. When this character is received, all characters waiting to be read are immediately passed to the program without waiting for a new line, and the EOF is discarded. If the EOF is at the beginning of a line (no characters are waiting), zero characters are passed back, which is the standard End-of-File. Indexes the EOL control character (Ctrl-@ or ASCII null), which is an additional line delimiter that is not normally used. Indexes the EOL2 control character (Ctrl-@ or ASCII null), which is an additional line delimiter that is not normally used. Indexes the START control character (Ctrl-q), which resumes output that has been suspended by a STOP character. START characters are ignored if the output is not suspended. Indexes the SUSP control character (Ctrl-z), which causes a SIGTSTP signal to be sent to all foreground processes controlled by this terminal. This character is recognized during input if the ISIG flag is enabled. If job control is not supported, this character is ignored. Indexes the DSUSP control character (Ctrl-y), which causes a SIGTSTP signal to be sent to all foreground processes controlled by this terminal. This character is recognized when the process attempts to read the DSUSP character. If job control is not supported, this character is ignored. Indexes the STOP control character (Ctrl-s), which can be used to temporarily suspend output. This character is recognized during both input and output if the IXOFF (input control) or IXON (output control) flag is set. Indexes the REPRINT control character (Ctrl-r), which reprints all characters that are preceded by a NL character and that have not been read. Indexes the DISCARD control character (Ctrl-o), which causes all output to be discarded until another DISCARD character is typed, more input is received, or the condition is cleared by a program. Indexes the WERASE control character (Ctrl-w), which erases the preceding word. The WERASE character does not erase beyond the beginning of the line (delimited by a NL, EOL, EOF, or EOL2 character). Indexes the LNEXT (literal next) control character (Ctrl-v), which causes the special meaning of the next character to be ignored, so that characters can be input without being interpreted by the system.
The character values for INTR, QUIT, SWTCH, ERASE, KILL, EOF, and EOL can be changed. The ERASE, KILL, and EOF characters can also be escaped (preceded with a backslash) so that no special processing is done. Indexes the minimum read value. This value is used for noncanonical processing. See the previous description of the ICANON flag. Indexes the time value. This value is used for noncanonical processing. See the previous description of the ICANON flag. Specifies the input baud rate.

The default input baud rate is 9600. However, the input baud rate can be specified to be one of the following: Hangs up. The zero baud rate is used to hang up the connection. If B0 is specified, the `data terminal ready' signal is not asserted. Normally, this disconnects the line. 50 baud. 75 baud. 110 baud. 134.5 baud. 150 baud. 200 baud. 300 baud. 600 baud. 600 baud. 1200 baud. 1800 baud. 2400 baud. 4800 baud. 9600 baud. 19200 baud. 38400 baud. 57600 baud. 115200 baud. External A. External B. Specifies the output baud rate.

The default output baud rate is 9600. However, the possible output baud rate values are the same as for the input baud rate values listed above.

The following values for the optional-actions parameter of the tcsetattr() function are also defined in the termios.h header file: Immediately sets the parameters associated with the terminal from the referenced termios structure. Waits until all output written to the object file has been transmitted before setting the terminal parameters from the termios structure.
Waits until all output written to the object file has been transmitted and all input received but not read has been discarded before setting the terminal parameters from the termios structure.

The following values for the queue-selector parameter of the tcflush() function are also defined in this header file: Flushes data that is received but not read. Flushes data that is written but not transmitted. Flushes both data that is received but not read and data that is written but not transmitted.

The following values for the action parameter of the tcflow() system call are also defined in the termios.h header file: Suspends the output of data by the object file named in the tcflow() function. Restarts data output that was suspended by the TCOOFF parameter. Transmits a stop character to stop data transmission by the terminal device. Transmits a start character to start or restart data transmission by the terminal device.  

FILES

The path to the termios.h header file.  

RELATED INFORMATION

Files: ace(7), scc(7), tty(7).

Functions: ioctl(2), cfgetispeed(3), cfgetospeed(3), cfsetispeed(3), cfsetospeed(3), tcsetattr(3), tcgetattr(3), tcflow(3), tcflush(3).

Commands: csh(1), sh(1), stty(1), tset(1), getty(8). delim off


 

Index

NAME
DESCRIPTION
FILES
RELATED INFORMATION

This document was created by man2html, using the manual pages.
Time: 02:40:03 GMT, October 02, 2010