ldterm(7) ldterm(7)
NAME
ldterm - standard STREAMS terminal line discipline module
DESCRIPTION
ldterm is a STREAMS module that provides most of the termio(7) termi-
nal interface. This module does not perform the low-level device con-
trol functions specified by flags in the ccflag word of the
termio/termios structure or by the IGNBRK, IGNPAR, PARMRK, or INPCK
flags in the ciflag word of the termio/termios structure; those func-
tions must be performed by the driver or by modules pushed below the
ldterm module. All other termio/termios functions are performed by
ldterm; some of them, however, require the cooperation of the driver
or modules pushed below ldterm and may not be performed in some cases.
These include the IXOFF flag in the ciflag word and the delays speci-
fied in the coflag word.
ldterm also handles EUC and multi-byte characters and mapchan tables.
The remainder of this section describes the processing of various
STREAMS messages on the read and write side.
Read side behavior
Various types of STREAMS messages are processed as follows:
MBREAK When this message is received, either an interrupt signal
is generated or the message is treated as if it were an
MDATA message containing a single ASCII NUL character,
depending on the state of the BRKINT flag.
MDATA This message is normally processed using the standard
termio input processing. If the ICANON flag is set, a sin-
gle input record ("line") is accumulated in an internal
buffer and sent upstream when a line-terminating character
is received. If the ICANON flag is not set, other input
processing is performed and the processed data are passed
upstream.
If output is to be stopped or started as a result of the
arrival of characters (usually <CNTRL-Q> and <CNTRL-S>),
MSTOP and MSTART messages are sent downstream. If the
IXOFF flag is set and input is to be stopped or started as
a result of flow control considerations, MSTOPI and
MSTARTI messages are sent downstream.
MDATA messages are sent downstream, as necessary, to per-
form echoing.
If a signal is to be generated, an MFLUSH message with a
flag byte of FLUSHR is placed on the read queue. If the
signal is also to flush output, an MFLUSH message with a
flag byte of FLUSHW is sent downstream.
Page 1 Reliant UNIX 5.44 Printed 11/98
ldterm(7) ldterm(7)
MCTL If the size of the data buffer associated with the message is
the size of struct iocblk, ldterm will perform functional
negotiation to determine where the termio(7) processing is
to be done. If the command field of the iocblk structure
(ioccmd) is set to MCNOCANON, the input canonical pro-
cessing normally performed on MDATA messages is disabled
and those messages are passed upstream unmodified; this is
for the use of modules or drivers that perform their own
input processing, such as a pseudo-terminal in TIOCREMOTE
mode connected to a program that performs this processing.
If the command is MCDOCANON, all input processing is
enabled. If the command is MCPARTCANON, then an MDATA
message containing a termios structure is expected to be
attached to the original MCTL message. The ldterm module
will examine the iflag, oflag, and lflag fields of the
termios structure and from then on will process only those
flags which have not been turned ON. If none of the above
commands are found, the message is ignored; in any case,
the message is passed upstream.
MFLUSH The read queue of the module is flushed of all its data
messages and all data in the record being accumulated are
also flushed. The message is passed upstream.
MIOCACK The data contained within the message, which is to be
returned to the process, are augmented if necessary, and
the message is passed upstream.
All other messages are passed upstream unchanged.
Write side behavior
Various types of STREAMS messages are processed as follows:
MFLUSH The write queue of the module is flushed of all its data
messages and the message is passed downstream.
MIOCTL The function of this ioctl is performed and the message is
passed downstream in most cases. The TCFLSH and TCXONC
ioctls can be performed entirely in the ldterm module, so
the reply is sent upstream and the message is not passed
downstream.
MDATA If the OPOST flag is set, or both the XCASE and ICANON
flags are set, output processing is performed and the pro-
cessed message is passed downstream along with any MDELAY
messages generated. Otherwise, the message is passed down-
stream without change.
All other messages are passed downstream unchanged.
Page 2 Reliant UNIX 5.44 Printed 11/98
ldterm(7) ldterm(7)
IOCTLS
The following ioctls are processed by the ldterm module. All others
are passed downstream. EUCWSET and EUCWGET are ISTR ioctl calls
whereas other ioctls listed here are TRANPARENT ioctls.
TCGETS/TCGETA
The message is passed downstream; if an acknowledgment is
seen, the data provided by the driver and modules down-
stream are augmented and the acknowledgement is passed
upstream.
TCSETS/TCSETSW/TCSETSF/TCSETA/TCSETAW/TCSETAF
The parameters that control the behavior of the ldterm
module are changed. If a mode change requires options at
the stream head to be changed, an MSETOPTS message is sent
upstream. If the ICANON flag is turned on or off, the read
mode at the stream head is changed to message-nondiscard or
byte-stream mode, respectively. If the TOSTOP flag is
turned on or off, the tostop mode at the stream head is
turned on or off, respectively.
TCFLSH If the argument is 0, an MFLUSH message with a flag byte
of FLUSHR is sent downstream and placed on the read queue.
If the argument is 1, the write queue is flushed of all its
data messages and an MFLUSH message with a flag byte of
FLUSHW is sent upstream and downstream. If the argument is
2, the write queue is flushed of all its data messages and
an MFLUSH message with a flag byte of FLUSHRW is sent
downstream and placed on the read queue.
TCXONC If the argument is 0 and output is not already stopped, an
MSTOP message is sent downstream. If the argument is 1 and
output is stopped, an MSTART message is sent downstream.
If the argument is 2 and input is not already stopped, an
MSTOPI message is sent downstream. If the argument is 3
and input is stopped, an MSTARTI message is sent down-
stream.
TCSBRK The message is passed downstream, so the driver has a
chance to drain the data and then send and an MIOCACK mes-
sage upstream.
EUCWSET This call takes a pointer to an eucioc structure, and uses
it to set the EUC line discipline's local definition for
the code set widths to be used for subsequent operations.
Within the stream, the line discipline may optionally
notify other modules of this setting via MCTL messages.
EUCWGET This call takes a pointer to an eucioc structure, and
returns in it the EUC code set widths currently in use by
the EUC line discipline.
Page 3 Reliant UNIX 5.44 Printed 11/98
ldterm(7) ldterm(7)
LSDMAP/LDGMAP/LDNMAP
These calls are used to load, read or delete a mapchan
table. LSDMAP and LDGMAP require a pointer to an emtab
structure of the size ETABSZ, which contains the table to
be loaded or to which the table being loaded is written.
These calls are used by the mapchan(1M) command.
SEE ALSO
mapchan(1M), termios(3C), mapchan(4), console(7), ports(7), termio(7).
Programmer's Guide: STREAMS
Page 4 Reliant UNIX 5.44 Printed 11/98