1: /*
2: * Copyright (c) 1982, 1986 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: *
6: * @(#)tty.h 7.1 (Berkeley) 6/4/86
7: */
8:
9: #ifdef KERNEL
10: #include "ttychars.h"
11: #include "ttydev.h"
12: #else
13: #include <sys/ttychars.h>
14: #include <sys/ttydev.h>
15: #endif
16:
17: /*
18: * A clist structure is the head of a linked list queue
19: * of characters. The characters are stored in blocks
20: * containing a link and CBSIZE (param.h) characters.
21: * The routines in tty_subr.c manipulate these structures.
22: */
23: struct clist {
24: int c_cc; /* character count */
25: char *c_cf; /* pointer to first char */
26: char *c_cl; /* pointer to last char */
27: };
28:
29: /*
30: * Per-tty structure.
31: *
32: * Should be split in two, into device and tty drivers.
33: * Glue could be masks of what to echo and circular buffer
34: * (low, high, timeout).
35: */
36: struct tty {
37: union {
38: struct {
39: struct clist T_rawq;
40: struct clist T_canq;
41: } t_t;
42: #define t_rawq t_nu.t_t.T_rawq /* raw characters or partial line */
43: #define t_canq t_nu.t_t.T_canq /* raw characters or partial line */
44: struct {
45: struct buf *T_bufp;
46: char *T_cp;
47: int T_inbuf;
48: int T_rec;
49: } t_n;
50: #define t_bufp t_nu.t_n.T_bufp /* buffer allocated to protocol */
51: #define t_cp t_nu.t_n.T_cp /* pointer into the ripped off buffer */
52: #define t_inbuf t_nu.t_n.T_inbuf /* number chars in the buffer */
53: #define t_rec t_nu.t_n.T_rec /* have a complete record */
54: } t_nu;
55: struct clist t_outq; /* device */
56: int (*t_oproc)(); /* device */
57: struct proc *t_rsel; /* tty */
58: struct proc *t_wsel;
59: caddr_t T_LINEP; /* ### */
60: caddr_t t_addr; /* ??? */
61: dev_t t_dev; /* device */
62: int t_flags; /* some of both */
63: int t_state; /* some of both */
64: short t_pgrp; /* tty */
65: char t_delct; /* tty */
66: char t_line; /* glue */
67: char t_col; /* tty */
68: char t_ispeed, t_ospeed; /* device */
69: char t_rocount, t_rocol; /* tty */
70: struct ttychars t_chars; /* tty */
71: struct winsize t_winsize; /* window size */
72: /* be careful of tchars & co. */
73: #define t_erase t_chars.tc_erase
74: #define t_kill t_chars.tc_kill
75: #define t_intrc t_chars.tc_intrc
76: #define t_quitc t_chars.tc_quitc
77: #define t_startc t_chars.tc_startc
78: #define t_stopc t_chars.tc_stopc
79: #define t_eofc t_chars.tc_eofc
80: #define t_brkc t_chars.tc_brkc
81: #define t_suspc t_chars.tc_suspc
82: #define t_dsuspc t_chars.tc_dsuspc
83: #define t_rprntc t_chars.tc_rprntc
84: #define t_flushc t_chars.tc_flushc
85: #define t_werasc t_chars.tc_werasc
86: #define t_lnextc t_chars.tc_lnextc
87: };
88:
89: #define TTIPRI 28
90: #define TTOPRI 29
91:
92: /* limits */
93: #define NSPEEDS 16
94: #define TTMASK 15
95: #define OBUFSIZ 100
96: #define TTYHOG 255
97: #ifdef KERNEL
98: short tthiwat[NSPEEDS], ttlowat[NSPEEDS];
99: #define TTHIWAT(tp) tthiwat[(tp)->t_ospeed&TTMASK]
100: #define TTLOWAT(tp) ttlowat[(tp)->t_ospeed&TTMASK]
101: extern struct ttychars ttydefaults;
102: #endif
103:
104: /* internal state bits */
105: #define TS_TIMEOUT 0x000001 /* delay timeout in progress */
106: #define TS_WOPEN 0x000002 /* waiting for open to complete */
107: #define TS_ISOPEN 0x000004 /* device is open */
108: #define TS_FLUSH 0x000008 /* outq has been flushed during DMA */
109: #define TS_CARR_ON 0x000010 /* software copy of carrier-present */
110: #define TS_BUSY 0x000020 /* output in progress */
111: #define TS_ASLEEP 0x000040 /* wakeup when output done */
112: #define TS_XCLUDE 0x000080 /* exclusive-use flag against open */
113: #define TS_TTSTOP 0x000100 /* output stopped by ctl-s */
114: #define TS_HUPCLS 0x000200 /* hang up upon last close */
115: #define TS_TBLOCK 0x000400 /* tandem queue blocked */
116: #define TS_RCOLL 0x000800 /* collision in read select */
117: #define TS_WCOLL 0x001000 /* collision in write select */
118: #define TS_NBIO 0x002000 /* tty in non-blocking mode */
119: #define TS_ASYNC 0x004000 /* tty in async i/o mode */
120: /* state for intra-line fancy editing work */
121: #define TS_BKSL 0x010000 /* state for lowercase \ work */
122: #define TS_QUOT 0x020000 /* last character input was \ */
123: #define TS_ERASE 0x040000 /* within a \.../ for PRTRUB */
124: #define TS_LNCH 0x080000 /* next character is literal */
125: #define TS_TYPEN 0x100000 /* retyping suspended input (PENDIN) */
126: #define TS_CNTTB 0x200000 /* counting tab width; leave FLUSHO alone */
127:
128: #define TS_LOCAL (TS_BKSL|TS_QUOT|TS_ERASE|TS_LNCH|TS_TYPEN|TS_CNTTB)
129:
130: /* define partab character types */
131: #define ORDINARY 0
132: #define CONTROL 1
133: #define BACKSPACE 2
134: #define NEWLINE 3
135: #define TAB 4
136: #define VTAB 5
137: #define RETURN 6
Defined variables
Defined struct's
clist
defined in line
23; used 38 times
- in line 39-40(4),
55(2)
- in /usr/src/sys/sys/tty.c line
387(2),
681(2),
1124(2)
- in /usr/src/sys/sys/tty_subr.c line
22(2),
68(2),
132(2),
170(2),
224(2),
265(2),
320(2),
336(2),
378(2),
407(2),
459(2)
- in /usr/src/sys/vaxuba/ct.c line
43(2)
- in /usr/src/sys/vaxuba/lp.c line
51(2)
tty
defined in line
36; used 334 times
- in /usr/src/sys/net/if_sl.c line
65(2),
110(2),
141(2),
166(2),
231(2),
438(2)
- in /usr/src/sys/sys/subr_prf.c line
63(2),
81(2),
102-110(6),
132-135(4),
143-145(6),
151(2),
229(2),
299(2)
- in /usr/src/sys/sys/tty.c line
112(2),
122(2),
130(2),
147(2),
178(2),
207(2),
223(2),
239(2),
514(2),
530(2),
569(2),
596(2),
607(2),
621(2),
663(2),
679(2),
703(2),
966(2),
1121(2),
1261(2),
1287(2),
1475(2),
1559(2),
1573(2),
1598(2),
1632(2),
1643(2),
1652(2)
- in /usr/src/sys/sys/tty_bk.c line
46(2),
66(2),
93(2),
128(2),
148(2)
- in /usr/src/sys/sys/tty_conf.c line
74(2)
- in /usr/src/sys/sys/tty_pty.c line
39(2),
61(2),
90(2),
102(2),
147(2),
160(2),
174(2),
201(2),
222(2),
233(2),
292(2),
318(2),
379(2),
477(2)
- in /usr/src/sys/sys/tty_tb.c line
79(2),
104(2),
125(2),
150(2),
279(2)
- in /usr/src/sys/vax/Locore.c line
174(2)
- in /usr/src/sys/vax/conf.c line
260(2),
290(2),
305(2),
338(2),
386(2),
462(2),
488(2)
- in /usr/src/sys/vax/cons.c line
26(2),
35(2),
54(2),
65(2),
75(2),
90(2),
109(2),
132(2),
147(2)
- in /usr/src/sys/vaxmba/ht.c line
74(2)
- in /usr/src/sys/vaxmba/mt.c line
91(2)
- in /usr/src/sys/vaxuba/dh.c line
73(2),
176(2),
247(2),
263(2),
272(2),
283-286(4),
344(2),
390(2),
432(2),
479(2),
563(2),
598(2),
678(2),
752(2)
- in /usr/src/sys/vaxuba/dhu.c line
100(2),
177(2),
253(2),
280(2),
289(2),
300-303(4),
380(2),
468(2),
510-512(4),
554(2),
632(2),
714(2)
- in /usr/src/sys/vaxuba/dmf.c line
88(2),
226(2),
305(2),
326(2),
338(2),
353-355(4),
429(2),
517(2),
564-565(4),
603(2),
707(2),
802(2)
- in /usr/src/sys/vaxuba/dmz.c line
61(2),
161(2),
247(2),
291(2),
312(2),
362(2),
374(2),
404-407(4),
488(2),
530(2),
641(2),
673(2)
- in /usr/src/sys/vaxuba/dz.c line
55(2),
104(2),
122(2),
144(2),
183(2),
206(2),
216(2),
226-229(4),
294(2),
388(2),
416(2),
443(2),
497(2),
574(2),
643(2)
- in /usr/src/sys/vaxuba/tm.c line
113(2)
- in /usr/src/sys/vaxuba/tmscp.c line
195(2)
- in /usr/src/sys/vaxuba/ts.c line
100(2)
- in /usr/src/sys/vaxuba/ut.c line
78(2)
Defined macros
TAB
defined in line
135;
never used
TS_BUSY
defined in line
110; used 39 times
- in /usr/src/sys/sys/tty.c line
134,
228
- in /usr/src/sys/vax/cons.c line
135,
141,
152,
180
- in /usr/src/sys/vaxuba/dh.c line
454,
498,
552,
573,
621
- in /usr/src/sys/vaxuba/dhu.c line
526,
573,
621,
642,
738
- in /usr/src/sys/vaxuba/dmf.c line
579,
623,
633,
683,
696,
729-732(2),
741,
826
- in /usr/src/sys/vaxuba/dmz.c line
349,
502,
546,
564,
604,
656-661(3)
- in /usr/src/sys/vaxuba/dz.c line
422,
435,
453,
479,
504,
656
TS_CARR_ON
defined in line
109; used 34 times
- in /usr/src/sys/net/if_sl.c line
204
- in /usr/src/sys/sys/subr_prf.c line
305-306(2)
- in /usr/src/sys/sys/tty.c line
135,
538,
639,
652,
668-670(2),
1137,
1162,
1189,
1299
- in /usr/src/sys/sys/tty_bk.c line
99
- in /usr/src/sys/sys/tty_pty.c line
77-78(2),
211,
263,
323,
457
- in /usr/src/sys/sys/tty_tb.c line
132
- in /usr/src/sys/vax/cons.c line
40
- in /usr/src/sys/vaxuba/dh.c line
690,
701-703(2)
- in /usr/src/sys/vaxuba/dhu.c line
236-237(2)
- in /usr/src/sys/vaxuba/dmf.c line
287-288(2)
- in /usr/src/sys/vaxuba/dmz.c line
233-235(2)
- in /usr/src/sys/vaxuba/dz.c line
171,
596-598(2)
TS_ISOPEN
defined in line
107; used 36 times
- in /usr/src/sys/sys/subr_prf.c line
305-306(2)
- in /usr/src/sys/sys/sys_inode.c line
523
- in /usr/src/sys/sys/tty.c line
583-584(2),
640
- in /usr/src/sys/sys/tty_pty.c line
70,
245,
332,
341,
353,
389,
409,
435
- in /usr/src/sys/vax/cons.c line
38-40(2)
- in /usr/src/sys/vaxuba/dh.c line
217,
254,
302,
618
- in /usr/src/sys/vaxuba/dhu.c line
214,
260,
338,
735
- in /usr/src/sys/vaxuba/dmf.c line
265,
317,
384,
823
- in /usr/src/sys/vaxuba/dmz.c line
211,
302,
346,
434
- in /usr/src/sys/vaxuba/dz.c line
153,
197,
259,
653
TS_TTSTOP
defined in line
113; used 27 times
- in /usr/src/sys/sys/tty.c line
159,
228,
344-345(2),
353-354(2),
401,
629-632(3),
790-791(2),
945-949(2)
- in /usr/src/sys/sys/tty_pty.c line
164,
260,
333
- in /usr/src/sys/vax/cons.c line
152
- in /usr/src/sys/vaxuba/dh.c line
498,
582
- in /usr/src/sys/vaxuba/dhu.c line
573,
655
- in /usr/src/sys/vaxuba/dmf.c line
623
- in /usr/src/sys/vaxuba/dmz.c line
546,
655
- in /usr/src/sys/vaxuba/dz.c line
453,
506
TS_WOPEN
defined in line
106; used 21 times
- in /usr/src/sys/sys/tty.c line
582,
624
- in /usr/src/sys/sys/tty_pty.c line
79
- in /usr/src/sys/vaxuba/dh.c line
192,
305,
618
- in /usr/src/sys/vaxuba/dhu.c line
238,
260,
341,
735
- in /usr/src/sys/vaxuba/dmf.c line
244,
290,
387,
823
- in /usr/src/sys/vaxuba/dmz.c line
236,
346,
437
- in /usr/src/sys/vaxuba/dz.c line
172,
197,
262,
653
TTIPRI
defined in line
89; used 15 times
TTYHOG
defined in line
96; used 10 times
VTAB
defined in line
136;
never used
t_canq
defined in line
43; used 32 times
- in /usr/src/sys/sys/tty.c line
153,
182,
192,
389-392(3),
520,
771,
906,
919,
1181,
1583(2)
- in /usr/src/sys/sys/tty_pty.c line
116-129(7),
355-360(3),
392-394(2),
403,
413-418(3),
439-440(2)
- in /usr/src/sys/sys/tty_tb.c line
115
t_cp
defined in line
51; used 8 times
t_rawq
defined in line
42; used 69 times
- in /usr/src/sys/sys/tty.c line
155,
165,
182-183(2),
389-391(3),
522,
653,
686-688(4),
727-730(2),
771,
815,
831-835(2),
848-864(7),
878-894(6),
906,
916-919(2),
1161,
1167-1173(3),
1181,
1194,
1246,
1514,
1523-1524(2),
1585-1589(3),
1662
- in /usr/src/sys/sys/tty_bk.c line
71,
103,
136
- in /usr/src/sys/sys/tty_pty.c line
80,
192,
358,
439-442(2),
468
- in /usr/src/sys/sys/tty_tb.c line
114
- in /usr/src/sys/vaxuba/dh.c line
303,
704
- in /usr/src/sys/vaxuba/dhu.c line
239,
339
- in /usr/src/sys/vaxuba/dmf.c line
291,
385
- in /usr/src/sys/vaxuba/dmz.c line
237,
435
- in /usr/src/sys/vaxuba/dz.c line
173,
260
t_rec
defined in line
53; used 6 times
Usage of this include