 |
Index for Section 4 |
|
 |
Alphabetical listing for T |
|
 |
Bottom of page |
|
termios(4)
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:
c_iflag
Describes the basic terminal input control. The possible input modes
are:
IGNBRK Ignores the break condition. If set, the break condition is not
put on the input queue and is therefore not read by any
process.
BRKINT Interrupts signal on the break condition. If set, the break
condition generates an interrupt signal and flushes both the
input and output queues.
IGNPAR Ignores characters with parity errors. If set, characters with
other framing and parity errors are ignored.
PARMRK 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.
INPCK 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.
ISTRIP Strips characters. If set, valid input characters are first
stripped to 7 bits; otherwise all 8 bits are processed.
INLCR Maps new-line character (NL) to carriage return (CR) on input.
If set, a received NL character is translated into a CR
character.
IGNCR Ignores CR character. If set, a received CR character is
ignored (not read).
ICRNL Maps CR character to NL character on input. If set, a received
CR character is translated into a NL character.
IUCLC Maps uppercase to lowercase on input. If set, a received
uppercase, alphabetic character is translated into the
corresponding lowercase character.
IXON 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.
IXANY Enables any character to restart output. If set, any input
character restarts output that was suspended.
IXOFF 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.
IMAXBEL 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.
c_oflag
Specifies how the system treats output. The possible output modes are:
OPOST Postprocesses output. If set, output characters are processed
as indicated by the remaining flags; otherwise, characters are
transmitted without change.
OLCUC 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.
ONLCR Maps NL to CR-NL on output. If set, the NL character is
transmitted as the CR-NL character pair.
OCRNL Maps CR to NL on output. If set, the CR character is
transmitted as the NL character.
ONOCR Indicates no CR output at column 0. If set, no CR character is
transmitted at column 0 (first position).
ONLRET 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.
OFILL 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.
OFDEL Sets fill characters to the DEL value. If set, the fill
character is DEL. If this flag is clear, the fill character is
null.
NLDLY Selects the newline character delays. This is a mask to use
before comparing to NL0 and NL1.
ONL0 Specifies no delay.
NL1 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.
CRDLY Selects the carriage return delays. This is a mask to use
before comparing to CR0, CR1, CR2, and CR3.
CR0 Specifies no delay.
CR1 Specifies that the delay is dependent on the current
column position. If OFILL is set, this delay transmits
two fill characters.
CR2 Specifies one delay of approximately 0.10 seconds. If
OFILL is set, this delay transmits four fill
characters.
CR3 Specifies one delay of approximately 0.15 seconds.
TABDLY 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.
TAB0 Specifies no delay.
TAB1 Specifies that the delay is dependent on the current
column position. If OFILL is set, two fill characters
are transmitted.
TAB2 Specifies one delay of approximately 0.10 seconds.
TAB3 Specifies that tabs are to be expanded into spaces.
BSDLY Selects the backspace delays. This is a mask to use before
comparing to BS0 and BS1.
BS0 Specifies no delay.
BS1 Specifies one delay of approximately 0.05 seconds. If
OFILL is set, this delay transmits one fill character.
VTDLY Selects the vertical-tab delays. This is a mask to use before
comparing to VT0 and VT1.
VT0 Specifies no delay.
VT1 Specifies one delay of approximately 2 seconds.
FFDLY Selects the formfeed delays. This is a mask to use before
comparing to FF0 and FF1.
FF0 Specifies no delay.
FF1 Specifies one delay of approximately 2 seconds.
c_cflag
Describes the hardware control of the terminal. In addition to the
basic control modes, this field uses the following control characters:
CRTSCTS Enables hardware flow control using the Request to Sent (RTS)
and Clear to Send (CTS) signals.
CSIZE 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.
CS5 5 bits.
CS6 6 bits.
CS7 7 bits.
CS8 8 bits.
CSTOPB 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.)
CREAD Enables receiver. If set, the receiver is enabled. Otherwise,
characters are not received.
PARENB Enables parity. If set, parity generation and detection is
enabled and a parity bit is added to each character.
PARODD Specifies odd parity. If parity is enabled, this specifies odd
parity. If clear, even parity is used.
HUPCL 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).
CLOCAL 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.
c_lflag
Controls various terminal functions. In addition to the basic modes,
this field uses the following mask name symbols:
ISIG 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.
ICANON 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.
XCASE 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.
ECHO Enables echo. If set, characters are displayed on the terminal
screen as they are received.
ECHOE 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.
ECHOK 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.
ECHONL 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.
NOFLSH 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)
ECHOCTL 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.
ECHOPRT 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).
ECHOKE Echoes the kill character by erasing from the screen each
character on the line.
FLUSHO 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.
PENDIN Reprints any input that has not yet been read when the next
character arrives as input.
IEXTEN 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.
TOSTOP 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.
c_cc
Specifies an array that defines the special control characters. The
relative positions and initial values for each function are:
VINTR Indexes the INTR control character (Ctrl-Backspace), which
sends a SIGINT signal to stop all processes controlled by this
terminal.
VQUIT 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.
VERASE 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).
VKILL Indexes the KILL control character (Ctrl-u), which deletes the
entire line (delimited by a NL, EOL, EOF, or EOL2 character).
VEOF 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.
VEOL Indexes the EOL control character (Ctrl-@ or ASCII null), which
is an additional line delimiter that is not normally used.
VEOL2 Indexes the EOL2 control character (Ctrl-@ or ASCII null),
which is an additional line delimiter that is not normally
used.
VSTART 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.
VSUSP 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.
VDSUSP 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.
VSTOP 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.
VREPRINT
Indexes the REPRINT control character (Ctrl-r), which reprints
all characters that are preceded by a NL character and that
have not been read.
VDISCARD
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.
VWERASE 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).
VLNEXT 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.
VMIN Indexes the minimum read value. This value is used for
noncanonical processing. See the previous description of the
ICANON flag.
VTIME Indexes the time value. This value is used for noncanonical
processing. See the previous description of the ICANON flag.
c_ispeed
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:
B0 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.
B50 50 baud.
B75 75 baud.
B110 110 baud.
B134 134.5 baud.
B150 150 baud.
B200 200 baud.
B300 300 baud.
B600 600 baud.
B600 600 baud.
B1200 1200 baud.
B1800 1800 baud.
B2400 2400 baud.
B4800 4800 baud.
B9600 9600 baud.
B19200 19200 baud.
B38400 38400 baud.
B57600 57600 baud.
B115200 115200 baud.
EXTA External A.
EXTB External B.
c_ospeed
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:
TCSANOW
Immediately sets the parameters associated with the terminal from the
referenced termios structure.
TCSADRAIN
Waits until all output written to the object file has been transmitted
before setting the terminal parameters from the termios structure.
TCSAFLUSH
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:
TCIFLUSH
Flushes data that is received but not read.
TCOFLUSH
Flushes data that is written but not transmitted.
TCIOFLUSH
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:
TCOOFF
Suspends the output of data by the object file named in the tcflow()
function.
TCOON
Restarts data output that was suspended by the TCOOFF parameter.
TCIOFF
Transmits a stop character to stop data transmission by the terminal
device.
TCION
Transmits a start character to start or restart data transmission by
the terminal device.
FILES
/usr/include/sys/termios.h
The path to the termios.h header file.
SEE ALSO
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)
 |
Index for Section 4 |
|
 |
Alphabetical listing for T |
|
 |
Top of page |
|