1: #include <sys/ioctl.h>
   2: #include <sgtty.h>
   3: 
   4: /*
   5:  * A clist structure is the head
   6:  * of a linked queue of characters.
   7:  * The characters are stored in
   8:  * blocks containing a link and CBSIZE (param.h)
   9:  * characters.  The routines getc, putc, ... in prim.c
  10:  * manipulate these structures.
  11:  */
  12: struct clist
  13: {
  14:     short   c_cc;       /* character count */
  15:     char    *c_cf;      /* pointer to first char */
  16:     char    *c_cl;      /* pointer to last char */
  17: };
  18: 
  19: struct cblock {
  20:     struct  cblock  *c_next;
  21:     char    c_info[CBSIZE];
  22: };
  23: 
  24: #if defined(UCB_NTTY) && !defined(UCB_CLIST)
  25: #define lookc(cp)   (*(cp))
  26: #endif
  27: 
  28: /*
  29:  * A tty structure is needed for
  30:  * each UNIX character device that
  31:  * is used for normal terminal I/O.
  32:  * The routines in tty.c handle the
  33:  * common code associated with
  34:  * these structures.  The definition
  35:  * and device dependent code is in
  36:  * each driver (e.g. dh.c, dz.c, kl.c).
  37:  */
  38: struct tty
  39: {
  40:     union {
  41:         struct {
  42:             struct  clist   T_rawq;
  43:             struct  clist   T_canq;
  44:         } t_t;
  45: #define t_rawq  t_nu.t_t.T_rawq     /* raw characters or partial line */
  46: #define t_canq  t_nu.t_t.T_canq     /* complete input lines */
  47: #if NBK > 0
  48:         struct {
  49:             struct  buf *T_bufp;
  50:             char    *T_cp;
  51:             short   T_inbuf;
  52:             short   T_rec;
  53:         } t_n;
  54: #define t_bufp  t_nu.t_n.T_bufp     /* buffer allocated to protocol */
  55: #define t_cp    t_nu.t_n.T_cp       /* pointer into the ripped off buffer */
  56: #define t_inbuf t_nu.t_n.T_inbuf    /* number chars in the buffer */
  57: #define t_rec   t_nu.t_n.T_rec      /* have a complete record */
  58: #endif	NBK
  59:     } t_nu;
  60:     struct  clist   t_outq;     /* output list to device */
  61:     short   (*t_oproc)();   /* routine to start output */
  62:     short   (*t_iproc)();   /* routine to start input */
  63: #ifdef  UCB_NET
  64:     struct proc *t_rsel;
  65:     struct proc *t_wsel;
  66: #endif
  67: #ifdef  MPX_FILS
  68:     struct  chan    *t_chan;/* destination channel */
  69: #endif
  70:     caddr_t t_addr;     /* device address */
  71:     dev_t   t_dev;      /* device number */
  72:     short   t_flags;    /* mode, settable by ioctl call */
  73:     short   t_state;    /* internal state, not visible externally */
  74:     short   t_pgrp;     /* process group name */
  75:     char    t_delct;    /* number of delimiters in raw q */
  76:     char    t_line;     /* line discipline */
  77:     char    t_col;      /* printing column of device */
  78:     char    t_erase;    /* erase character */
  79:     char    t_kill;     /* kill character */
  80:     char    t_char;     /* character temporary */
  81:     char    t_ispeed;   /* input speed */
  82:     char    t_ospeed;   /* output speed */
  83: #ifdef  UCB_NTTY
  84:     char    t_rocount;  /* chars input since a ttwrite() */
  85:     char    t_rocol;    /* t_col of first input char on this line */
  86:     struct  ltchars t_lchr; /* local special characters */
  87:     short   t_local;    /* local mode word */
  88:     char    t_lstate;   /* local state bits */
  89: #endif
  90: #ifdef  TEXAS_AUTOBAUD
  91:     char    t_xflags;   /* extension of t_local */
  92: #endif
  93:     union {
  94:         struct  tchars  t_chr;
  95:         struct  clist   t_ctlq;
  96:     } t_un;
  97:     struct  buf *t_ibp, *t_obp;
  98: };
  99: 
 100: #define tun tp->t_un.t_chr
 101: #ifdef  UCB_NTTY
 102: #define tlun    tp->t_lchr
 103: #endif
 104: 
 105: #define TTIPRI  28
 106: #define TTOPRI  29
 107: 
 108: #define CTRL(c) ('c'&037)
 109: 
 110: /* default special characters */
 111: #define CERASE  '#'
 112: #define CEOT    CTRL(d)
 113: #define CKILL   '@'
 114: #define CQUIT   034     /* FS, cntl shift L */
 115: #define CINTR   0177        /* DEL */
 116: #define CSTOP   CTRL(s)
 117: #define CSTART  CTRL(q)
 118: #define CBRK    0377
 119: 
 120: /* limits */
 121: #define NSPEEDS 16
 122: #define TTMASK  15
 123: #ifdef  KERNEL
 124: short   tthiwat[NSPEEDS], ttlowat[NSPEEDS];
 125: #define TTHIWAT(tp) tthiwat[(tp)->t_ospeed&TTMASK]
 126: #define TTLOWAT(tp) ttlowat[(tp)->t_ospeed&TTMASK]
 127: #endif
 128: #define TTYHOG  256
 129: 
 130: /* internal state bits */
 131: #define TIMEOUT 01      /* delay timeout in progress */
 132: #define WOPEN   02      /* waiting for open to complete */
 133: #define ISOPEN  04      /* device is open */
 134: #define FLUSH   010     /* outq has been flushed during DMA */
 135: #define CARR_ON 020     /* software copy of carrier-present */
 136: #define BUSY    040     /* output in progress */
 137: #define ASLEEP  0100        /* wakeup when output done */
 138: #define XCLUDE  0200        /* exclusive-use flag against open */
 139: #define TTSTOP  0400        /* output stopped by ctl-s */
 140: #define HUPCLS  01000       /* hang up upon last close */
 141: #define TBLOCK  02000       /* tandem queue blocked */
 142: #define SPEEDS  04000       /* t_ispeed and t_ospeed used by driver */
 143: #ifdef  UCB_NET
 144: #define TS_RCOLL    010000  /* collision in read select */
 145: #define TS_WCOLL    020000  /* collision in write select */
 146: #define TS_NBIO     040000  /* tty in non-blocking mode */
 147: #define TS_ASYNC    0100000 /* tty in async i/o mode */
 148: #endif
 149: 
 150: #ifdef  notdef
 151: #define NDQB    010000
 152: #define EXTPROC 020000      /* external processor (kmc) */
 153: #define FSLEEP  040000      /* Wakeup on input framing */
 154: #define BEXT    0100000     /* use (external) system buffers */
 155: #endif
 156: 
 157: /* define partab character types */
 158: #define ORDINARY    0
 159: #define CONTROL     1
 160: #define BACKSPACE   2
 161: #define NEWLINE     3
 162: #define TAB     4
 163: #define VTAB        5
 164: #define RETURN      6
 165: 
 166: #ifdef  TEXAS_AUTOBAUD
 167: #define image_mode(tp)  ((tp)->t_xflags & LIMAGE)
 168: #endif

Defined variables

tthiwat defined in line 124; used 1 times
ttlowat defined in line 124; used 1 times

Defined struct's

cblock defined in line 19; used 80 times
clist defined in line 12; used 62 times
tty defined in line 38; used 230 times

Defined macros

BACKSPACE defined in line 160; never used
BEXT defined in line 154; never used
CBRK defined in line 118; used 1 times
CEOT defined in line 112; used 3 times
CERASE defined in line 111; used 1 times
CINTR defined in line 115; used 1 times
CKILL defined in line 113; used 1 times
CONTROL defined in line 159; never used
CQUIT defined in line 114; used 1 times
CSTART defined in line 117; used 1 times
CSTOP defined in line 116; used 1 times
CTRL defined in line 108; used 11 times
EXTPROC defined in line 152; never used
FLUSH defined in line 134; used 6 times
FSLEEP defined in line 153; never used
NDQB defined in line 151; never used
NEWLINE defined in line 161; never used
NSPEEDS defined in line 121; used 2 times
  • in line 124(2)
ORDINARY defined in line 158; never used
RETURN defined in line 164; never used
SPEEDS defined in line 142; used 1 times
TAB defined in line 162; never used
TBLOCK defined in line 141; used 7 times
TS_ASYNC defined in line 147; used 2 times
TS_NBIO defined in line 146; used 8 times
TS_RCOLL defined in line 144; used 3 times
TS_WCOLL defined in line 145; used 7 times
TTHIWAT defined in line 125; used 4 times
TTMASK defined in line 122; used 2 times
TTYHOG defined in line 128; used 8 times
VTAB defined in line 163; never used
image_mode defined in line 167; used 2 times
lookc defined in line 25; used 3 times
t_bufp defined in line 54; used 6 times
t_canq defined in line 46; used 22 times
t_cp defined in line 55; used 4 times
t_inbuf defined in line 56; used 6 times
t_rec defined in line 57; used 7 times
tlun defined in line 102; used 17 times
tun defined in line 100; used 37 times

Usage of this include

Last modified: 1983-09-06
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1532
Valid CSS Valid XHTML 1.0 Strict