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
Defined struct's
cblock
defined in line
19; used 80 times
- in line 20(2)
- in /usr/src/sys/GENERIC/checksys.c line
201(2)
- in /usr/src/sys/GENERIC/param.c line
81-83(4)
- in /usr/src/sys/conf/checksys.c line
201(2)
- in /usr/src/sys/conf/param.c line
81-83(4)
- in /usr/src/sys/dev/dh.c line
22-24(4)
- in /usr/src/sys/sys/machdep.c line
32(2),
238(2)
- in /usr/src/sys/sys/prim.c line
24-30(6),
39(2),
57-58(4),
65(2),
88(2),
114-115(4),
122(2),
222(2),
228(2),
240(2),
246(2),
262(2),
287(2),
322(2),
348(2),
375(2),
384(2),
453(2),
490-492(4),
507-508(4),
515-517(6)
clist
defined in line
12; used 62 times
- in line 42-43(4),
60(2),
95(2)
- in /usr/src/sys/dev/Others/dc.c line
155(2)
- in /usr/src/sys/dev/Others/mx2.c line
403(2),
428(2),
454(2),
493(2),
536(2),
557(2),
750(2),
760(2),
780(2),
799(2)
- in /usr/src/sys/dev/cat.c line
26(2)
- in /usr/src/sys/dev/lp.c line
32(2)
- in /usr/src/sys/dev/tty.c line
256(2)
- in /usr/src/sys/dev/ttynew.c line
78(2),
452(2)
- in /usr/src/sys/sys/prim.c line
37(2),
85(2),
145(2),
195(2),
260(2),
318(2),
399(2),
412(2),
440(2),
488(2),
539(2)
tty
defined in line
38; used 230 times
- in /usr/src/cmd/pstat.c line
344-346(4),
358(2),
368(2),
378(2),
387-389(4)
- in /usr/src/sys/GENERIC/c.c line
40(2),
68(2),
338(2)
- in /usr/src/sys/conf/c.c line
40(2),
68(2),
338(2)
- in /usr/src/sys/dev/Others/bk.c line
54(2),
82(2),
110(2),
151(2),
171(2)
- in /usr/src/sys/dev/Others/dc.c line
15(2),
77(2),
116(2),
130(2),
142(2),
154(2),
170(2),
216(2)
- in /usr/src/sys/dev/Others/dj.c line
14(2),
22(2),
53(2),
62(2),
71(2),
81(2),
90-93(4),
120(2),
134(2)
- in /usr/src/sys/dev/Others/mx1.c line
127(2),
367(2)
- in /usr/src/sys/dev/Others/mx2.c line
82(2),
350(2),
695(2)
- in /usr/src/sys/dev/dh.c line
39(2),
78(2),
137(2),
156(2),
167(2),
179-182(4),
235(2),
274(2),
322(2),
379(2),
476(2),
548(2),
623(2)
- in /usr/src/sys/dev/dhdm.c line
15(2),
46(2),
103(2)
- in /usr/src/sys/dev/dhfdm.c line
13-17(4)
- in /usr/src/sys/dev/dz.c line
27(2),
58(2),
119(2),
139(2),
148(2),
161(2),
200(2),
242-245(4),
294(2),
313(2),
328(2),
444(2),
478(2)
- in /usr/src/sys/dev/kl.c line
26(2),
47(2),
84(2),
93(2),
102(2),
120(2),
144(2),
191(2)
- in /usr/src/sys/dev/tty.c line
68(2),
90(2),
101(2),
128(2),
145(2),
184(2),
211(2),
231(2),
250(2),
624(2),
642(2)
- in /usr/src/sys/dev/ttynew.c line
56(2),
66(2),
76(2),
100(2),
311(2),
450(2),
592(2),
715(2),
795(2),
808(2),
833(2),
867(2),
878(2),
888(2),
899(2)
- in /usr/src/sys/dev/ttyold.c line
39(2),
116(2),
198(2),
325(2),
360(2)
- in /usr/src/sys/sys/fakemx.c line
24(2)
- in /usr/src/sys/sys/ioctl.c line
118(2)
Defined macros
BEXT
defined in line
154;
never used
BUSY
defined in line
136; used 17 times
- in /usr/src/cmd/pstat.c line
404
- in /usr/src/sys/dev/Others/dj.c line
128,
145,
162
- in /usr/src/sys/dev/dh.c line
342,
397,
464,
487
- in /usr/src/sys/dev/dz.c line
299,
305,
321,
340,
377,
395,
413,
451
- in /usr/src/sys/dev/tty.c line
236
CARR_ON
defined in line
135; used 40 times
- in /usr/src/cmd/pstat.c line
403
- in /usr/src/sys/dev/Others/bk.c line
115
- in /usr/src/sys/dev/Others/dc.c line
103-105(2),
184-193(3)
- in /usr/src/sys/dev/Others/dj.c line
38
- in /usr/src/sys/dev/dh.c line
124,
561,
571-573(2),
658-660(2)
- in /usr/src/sys/dev/dhdm.c line
53,
62-65(2),
122-124(2)
- in /usr/src/sys/dev/dhfdm.c line
20
- in /usr/src/sys/dev/dz.c line
101-106(2),
487-493(3),
507
- in /usr/src/sys/dev/kl.c line
60,
192
- in /usr/src/sys/dev/tty.c line
132,
274
- in /usr/src/sys/dev/ttynew.c line
455,
476-478(2),
508-510(2),
604
- in /usr/src/sys/dev/ttyold.c line
329-334(3),
368
CBRK
defined in line
118; used 1 times
CEOT
defined in line
112; used 3 times
CTRL
defined in line
108; used 11 times
NDQB
defined in line
151;
never used
TAB
defined in line
162;
never used
TTOPRI
defined in line
106; used 14 times
- in /usr/src/sys/dev/Others/mx2.c line
379,
512,
614,
768,
809,
819
- in /usr/src/sys/dev/tty.c line
135,
307
- in /usr/src/sys/dev/ttynew.c line
634,
653,
671,
704
- in /usr/src/sys/dev/ttyold.c line
395,
434
VTAB
defined in line
163;
never used
WOPEN
defined in line
132; used 12 times
lookc
defined in line
25; used 3 times
t_canq
defined in line
46; used 22 times
- in /usr/src/cmd/pstat.c line
394
- in /usr/src/sys/dev/tty.c line
156,
187,
385-392(4),
531,
630
- in /usr/src/sys/dev/ttynew.c line
46,
145,
216,
228,
504,
583,
818(2)
- in /usr/src/sys/dev/ttyold.c line
87,
332,
349-351(3)
t_cp
defined in line
55; used 4 times
t_rawq
defined in line
45; used 74 times
- in /usr/src/cmd/pstat.c line
393
- in /usr/src/sys/dev/Others/bk.c line
88,
119,
159
- in /usr/src/sys/dev/Others/dc.c line
106
- in /usr/src/sys/dev/Others/mx2.c line
418
- in /usr/src/sys/dev/dh.c line
574,
632
- in /usr/src/sys/dev/dhdm.c line
66,
114
- in /usr/src/sys/dev/dz.c line
108,
261,
488
- in /usr/src/sys/dev/tty.c line
158,
168,
187-188(2),
385-387(3),
400,
533,
632
- in /usr/src/sys/dev/ttynew.c line
28,
45,
83-85(4),
145,
176-190(7),
196-216(7),
222,
228,
258-261(2),
275-278(2),
474,
496-504(4),
528,
575,
583,
751,
760(2),
820-824(3),
895
- in /usr/src/sys/dev/ttyold.c line
48,
54,
95,
164,
170-172(2),
179,
345,
351
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
- in /usr/src/sys/dev/dh.c line
223
- in /usr/src/sys/dev/dz.c line
272
- in /usr/src/sys/dev/tty.c line
104-109(6),
197,
481-486(2)
- in /usr/src/sys/dev/ttynew.c line
125,
131-133(2),
152-164(7),
249,
558,
577,
869(2)
- in /usr/src/sys/dev/ttyold.c line
68,
97,
131-152(7),
171(2)
Usage of this include