Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ttiocom(K) — OpenDesktop Software Development System 1.0.0d

Media Vault

Software Library

Restoration Projects

Artifacts Sought



     TTIOCOM(K)                UNIX System V                TTIOCOM(K)



     Name
          ttiocom - interpret tty driver I/O control commands

     Syntax
          #include "sys/types.h"
          #include "sys/file.h"
          #include "sys/tty.h"

          int ttiocom(tp, cmd, arg, mode)
          struct tty *tp;
          int cmd, arg, mode;

     Description
          ttiocom sends an I/O control command to the tty device.
          Valid commands (the cmd argument to ttiocom) are:

           +   IOC_SELECT - determine if a character can be read from
               or written to a tty device without blocking (going to
               sleep in the process).  mode can be SELREAD or
               SELWRITE.  NOTE:  IOC_SELECT must not be called from an
               interrupt routine and sleep must not be called just
               prior to calling this I/O control command.  IOC_SELECT
               calls ttselect.

           +   IOCTYPE - return the name of the last I/O control
               command called.  u.u_rval1 is set to the value of TIOC.
               IOCTYPE must not be called from an interrupt routine.

           +   TCSETAF, TCSETAW, TCSETA, TCGETA, TCSBRK, TCXONC,
               TCFLSH - explained on the termio(M) manual page.
               TCSETAW and TCSETAF call ttywait. TCSETAF calls
               ttyflush.  TCSETA calls ttioctl when opening a new line
               discipline and when changing the value of the line
               discipline flag, t_lflag.  TCSBRK calls ttywait. TCXONC
               calls the driver xxproc routine with varying arguments
               depending on the arg argument to ttiocom. TCFLSH calls
               ttyflush.
               xxproc is called by TCXONC as follows:

                               _______________________
                              | arg     |  xxproc    |
                              | value   |  argument  |
                              |_________|____________|
                              | 0 (zero)|  T_SUSPEND |
                              | 1       |  T_RESUME  |
                              | 2       |  T_BLOCK   |
                              | 3       |  T_UNBLOCK |
                              |_________|____________|

                      TCGETA sets u.u_error to EFAULT if a paging error
                      occurs while trying to return the requested tty
                      structure.  TCXONC sets u.u_error to EINVAL if
                      arg is not 0, 1, 2, or 3.  TCFLSH sets u.u_error
                      to EINVAL if arg is not 0, 1, or 2.  TCSETA sets
                      u.u_error to EFAULT if the tty structure cannot
                      be set, or to EINVAL if the requested line
                      discipline is less than zero or greater than the
                      maximum.

           +   FIORDCHK - check to see if characters are waiting to be
               read.  1 is returned if characters are waiting in
               t_canq.  If ICANON is set, it is also possible for 1 to
               be returned when characters are not in t_canq, but
               there are characters in t_delct.  If there are no
               characters in t_canq and ICANON is not set, and if
               there are characters in t_rawq, 1 is returned.  If none
               of the queues have characters, 0 (zero) is returned.
               FIORDCHK causes ttrdchk to be  called.

           +   XCSETAW - wait for the universal asynchronous
               receiver/transmitter (UART) to empty (waits 11 bit
               times depending on the terminal's baud rate). XCSETAW
               is a POSIX termio extension.

           +   XCSETAF - wait until the UART empties and then flush
               all read and write buffers (calls ttyflush).  XCSETAF
               is a POSIX termio extension.

           +   XCSETA - set terminal parameters from the tty structure
               specified by the arg argument to ttiocom.  XCSETA is a
               POSIX termio extension.

           +   XCGETA - get terminal parameters from a terminal's tty
               structure and put into the tty structure specified by
               the arg argument to ttiocom.

     Parameters
               tp        Pointer to an instance of the tty structure
                         for a tty device

               cmd       I/O control command passed through from the
                         user program

               arg       Argument to the I/O control command, also
                         passed through from the user program

               mode      Indicates the mode by which the file was
                         opened.  The modes are assigned by the kernel
                         and are interpreted into flag values that are
                         defined in sys/file.h.  Possible values are
                         FNDELAY, FREAD, FSTOPIO, FWRITE.

     See Also
          termio(M), canon(K), tty(K)  (All other tt routines are
          described on the tty(K) manual page.)

                                                      (printed 7/6/89)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026