


LDTERM(4M)       DEVICES AND NETWORK INTERFACES        LDTERM(4M)



NAME
     ldterm - standard terminal STREAMS module

CONFIG
     None; included by default.

SYNOPSIS
     #include <sys/types.h>
     #include <sys/stream.h>
     #include <sys/stropts.h>

     ioctl(fd, I_PUSH, "ldterm");

DESCRIPTION
     ldterm is a STREAMS module that provides most  of  the  ter-
     mio(4) terminal interface.  This module does not perform the
     low-level device control functions specified by flags in the
     c_cflag  word  of  the  termios  structure or by the IGNBRK,
     IGNPAR, PARMRK, or INPCK flags in the c_iflag  word  of  the
     termios  structure; those functions must be performed by the
     driver or by modules pushed below the  ldterm  module.   All
     other  termio  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  c_iflag
     word and the delays specified in the c_oflag word.

  Read-side Behavior
     Various types of STREAMS messages are processed as follows:

     M_BREAK   When this message is received, either an interrupt
               signal  is generated, or the message is treated as
               if it were an M_DATA message containing  a  single
               ASCII NUL character, depending on the state of the
               BRKINT flag.

     M_DATA    These messages are normally  processed  using  the
               standard  termio  input processing.  If the ICANON
               flag is set, a single  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 is passed upstream.

               If output is to be stopped or started as a  result
               of  the  arrival of characters, M_STOP and M_START
               messages are sent  downstream,  respectively.   If
               the  IXOFF flag is set, and input is to be stopped
               or started as a result of flow-control  considera-
               tions,  M_STOPI  and  M_STARTI  messages  are sent
               downstream, respectively.



Sun Release 4.1   Last change: 24 January 1990                  1






LDTERM(4M)       DEVICES AND NETWORK INTERFACES        LDTERM(4M)



               M_DATA messages are sent downstream, as necessary,
               to perform echoing.

               If a signal is to be generated, a M_FLUSH  message
               with  a  flag byte of FLUSHR is placed on the read
               queue, and if the signal is also to flush output a
               M_FLUSH message with a flag byte of FLUSHW is sent
               downstream.

     M_CTL     If the first byte of the  message  is  MC_NOCANON,
               the  input processing normally performed on M_DATA
               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  per-
               forms  this  processing.  If the first byte of the
               message is MC_DOCANON,  the  input  processing  is
               enabled.   Otherwise,  the  message is ignored; in
               any case, the message is passed upstream.

     M_FLUSH   The read queue of the module is flushed of all its
               data  messages,  and  all data in the record being
               accumulated  is  also  flushed.   The  message  is
               passed upstream.

     M_HANGUP  Data is flushed as it is for  a  M_FLUSH  message,
               and  M_FLUSH  messages with a flag byte of FLUSHRW
               are sent upstream and downstream.  Then an M_PCSIG
               message is sent upstream with a signal of SIGCONT,
               followed by the M_HANGUP message.

     M_IOCACK  The data contained within the message, which is to
               be returned to the process, is augmented if neces-
               sary, 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:

     M_FLUSH   The write queue of the module is  flushed  of  all
               its data messages, and the message is passed down-
               stream.

     M_IOCTL   The function to  be  performed  for  this  ioctl()
               request by the ldterm module is performed, and the
               message is passed downstream in most  cases.   The
               TCFLSH  and  TCXONC  ioctl()  requests can be per-
               formed entirely in this module, so  the  reply  is
               sent  upstream and the message is not passed down-
               stream.



Sun Release 4.1   Last change: 24 January 1990                  2






LDTERM(4M)       DEVICES AND NETWORK INTERFACES        LDTERM(4M)



     M_DATA    If the OPOST flag is set, or both  the  XCASE  and
               ICANON  flags  are  set, output processing is per-
               formed and the processed message is  passed  down-
               stream, along with any M_DELAY messages generated.
               Otherwise,  the  message  is   passed   downstream
               without change.

     All other messages are passed downstream unchanged.

IOCTLS
     The following ioctl() requests are processed by  the  ldterm
     module.  All others are passed downstream.

     TCGETS
     TCGETA         The message is passed downstream; if an  ack-
                    nowledgment is seen, the data provided by the
                    driver and modules  downstream  is  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,  a  M_SETOPT  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 it is turned on, the
                    vmin and vtime values at the stream head  are
                    set to 1 and 0, respectively; if it is turned
                    on, they are set to the values  specified  by
                    the  ioctl()  request.   The  vmin  and vtime
                    values are also set if ICANON is off and  the
                    values  are  changed  by the ioctl() request.
                    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 M_FLUSH 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 a M_FLUSH message  with  a  flag
                    byte  of  FLUSHW  is  sent upstream and down-
                    stream.  If the  argument  is  2,  the  write
                    queue is flushed of all its data messages and
                    a M_FLUSH message with a flag byte of FLUSHRW
                    is  sent  downstream  and  placed on the read



Sun Release 4.1   Last change: 24 January 1990                  3






LDTERM(4M)       DEVICES AND NETWORK INTERFACES        LDTERM(4M)



                    queue.

     TCXONC         If the argument  is  0,  and  output  is  not
                    already  stopped,  an  M_STOP message is sent
                    downstream.  If the argument is 1, and output
                    is  stopped, an M_START message is sent down-
                    stream.  If the argument is 2, and  input  is
                    not  already  stopped,  an M_STOPI message is
                    sent downstream.  If the argument is  3,  and
                    input is stopped, an M_STARTI message is sent
                    downstream.

SEE ALSO
     console(4S),   mcp(4S),    mti(4S),    pty(4),    termio(4),
     ttcompat(4M), zs(4S)








































Sun Release 4.1   Last change: 24 January 1990                  4



