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.2 (2.11BSD GTE) 1997/4/10
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: long t_flags; /* some of both */
63: long 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:
97: #if defined(KERNEL) && !defined(SUPERVISOR)
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 0x000001L /* delay timeout in progress */
106: #define TS_WOPEN 0x000002L /* waiting for open to complete */
107: #define TS_ISOPEN 0x000004L /* device is open */
108: #define TS_FLUSH 0x000008L /* outq has been flushed during DMA */
109: #define TS_CARR_ON 0x000010L /* software copy of carrier-present */
110: #define TS_BUSY 0x000020L /* output in progress */
111: #define TS_ASLEEP 0x000040L /* wakeup when output done */
112: #define TS_XCLUDE 0x000080L /* exclusive-use flag against open */
113: #define TS_TTSTOP 0x000100L /* output stopped by ctl-s */
114: #define TS_HUPCLS 0x000200L /* hang up upon last close */
115: #define TS_TBLOCK 0x000400L /* tandem queue blocked */
116: #define TS_RCOLL 0x000800L /* collision in read select */
117: #define TS_WCOLL 0x001000L /* collision in write select */
118: #define TS_ASYNC 0x004000L /* tty in async i/o mode */
119: /* state for intra-line fancy editing work */
120: #define TS_ERASE 0x040000L /* within a \.../ for PRTRUB */
121: #define TS_LNCH 0x080000L /* next character is literal */
122: #define TS_TYPEN 0x100000L /* retyping suspended input (PENDIN) */
123: #define TS_CNTTB 0x200000L /* counting tab width; leave FLUSHO alone */
124:
125: #define TS_LOCAL (TS_ERASE|TS_LNCH|TS_TYPEN|TS_CNTTB)
126:
127: /* define partab character types */
128: #define ORDINARY 0
129: #define CONTROL 1
130: #define BACKSPACE 2
131: #define NEWLINE 3
132: #define TAB 4
133: #define VTAB 5
134: #define RETURN 6
Defined variables
Defined struct's
clist
defined in line
23; used 40 times
- in line 39-40(4),
55(2)
- in /usr/src/sys/pdpif/if_dmc.c line
73(2)
- in /usr/src/sys/pdpuba/lp.c line
46(2)
- in /usr/src/sys/sys/tty.c line
454(2),
771(2),
1140(2)
- in /usr/src/sys/sys/tty_subr.c line
30(2),
86(2),
163(2),
211(2),
274(2),
331(2),
397(2),
408(2),
451(2),
503(2),
533(2),
585(2)
tty
defined in line
36; used 402 times
- in /usr/src/new/crash/crash.c line
126-130(6),
232-250(38),
697-717(24),
965(2)
- in /usr/src/sys/h/user.h line
113(2)
- in /usr/src/sys/net/if_sl.c line
75(2),
119(2),
154(2),
181(2),
249(2),
458(2)
- in /usr/src/sys/pdp/conf.c line
218(2),
233(2),
249(2),
265(2),
295(2),
311(2)
- in /usr/src/sys/pdp/cons.c line
33(2),
52(2),
78(2),
91(2),
102(2),
113(2),
127(2),
142(2),
149(2)
- in /usr/src/sys/pdp/kern_pdp.c line
204(2)
- in /usr/src/sys/pdpuba/dh.c line
54(2),
124(2),
195(2),
226(2),
235(2),
246-249(4),
313(2),
396(2),
440(2),
501(2),
572(2),
647(2),
712(2)
- in /usr/src/sys/pdpuba/dhu.c line
67(2),
113(2),
191(2),
226(2),
235(2),
246-249(4),
350(2),
435(2),
479-481(4),
531(2),
601(2)
- in /usr/src/sys/pdpuba/dhv.c line
88(2),
130(2),
200(2),
223(2),
233(2),
243(2),
255-258(4),
369(2),
455(2),
518-520(4),
570(2),
644(2),
687(2)
- in /usr/src/sys/pdpuba/dz.c line
39(2),
100(2),
121(2),
170(2),
191(2),
202(2),
212-215(4),
269(2),
359(2),
387(2),
408(2),
457(2),
519(2)
- in /usr/src/sys/sys/kern_sysctl.c line
851(2),
944(2),
971(2),
977(2)
- in /usr/src/sys/sys/subr_prf.c line
56(2),
74(2),
91-99(6),
120-123(4),
131-133(6),
140(2),
243(2),
317(2)
- in /usr/src/sys/sys/sys_net.c line
509-510(4)
- in /usr/src/sys/sys/tty.c line
112(2),
124(2),
147(2),
155(2),
180(2),
216(2),
253(2),
277(2),
293(2),
305(2),
577(2),
601(2),
607(2),
648(2),
675(2),
696(2),
710(2),
753(2),
769(2),
793(2),
1050(2),
1137(2),
1288(2),
1316(2),
1482(2),
1577(2),
1591(2),
1630(2),
1664(2),
1675(2),
1684(2)
- in /usr/src/sys/sys/tty_conf.c line
76(2),
91(2),
99(2),
106(2),
113-117(4),
123-128(4),
134(2),
140(2),
146(2)
- in /usr/src/sys/sys/tty_pty.c line
41(2),
62(2),
92(2),
105(2),
151(2),
164(2),
178(2),
205(2),
226(2),
239(2),
298(2),
324(2),
386(2),
471(2)
- in /usr/src/sys/sys/tty_tb.c line
78(2),
103(2),
125(2),
150(2),
279(2)
- in /usr/src/usr.sbin/pstat/pstat.c line
419(2),
425(2),
446(2),
454(2),
460(2),
467-469(4)
Defined macros
TAB
defined in line
132;
never used
TS_BUSY
defined in line
110; used 23 times
- in /usr/src/sys/pdp/cons.c line
144,
155,
168
- in /usr/src/sys/pdpuba/dh.c line
462,
522,
560,
582
- in /usr/src/sys/pdpuba/dhu.c line
494,
545,
590,
611
- in /usr/src/sys/pdpuba/dhv.c line
533,
588,
633,
654
- in /usr/src/sys/pdpuba/dz.c line
392,
403,
418,
444,
464
- in /usr/src/sys/sys/tty.c line
159,
166
- in /usr/src/usr.sbin/pstat/pstat.c line
482
TS_CARR_ON
defined in line
109; used 32 times
- in /usr/src/sys/net/if_sl.c line
222
- in /usr/src/sys/pdp/cons.c line
64
- in /usr/src/sys/pdpuba/dh.c line
176-177(2),
657
- in /usr/src/sys/pdpuba/dhu.c line
169-170(2)
- in /usr/src/sys/pdpuba/dhv.c line
179-180(2)
- in /usr/src/sys/pdpuba/dz.c line
151,
157,
541-543(2)
- in /usr/src/sys/sys/subr_prf.c line
323-324(2)
- in /usr/src/sys/sys/tty.c line
160,
617,
729,
742,
758-760(2),
1176,
1209,
1330
- in /usr/src/sys/sys/tty_pty.c line
78-79(2),
230,
269,
329,
451
- in /usr/src/sys/sys/tty_tb.c line
132
- in /usr/src/usr.sbin/pstat/pstat.c line
481
TS_ISOPEN
defined in line
107; used 32 times
- in /usr/src/sys/pdp/cons.c line
62-64(2)
- in /usr/src/sys/pdpuba/dh.c line
151,
200,
264
- in /usr/src/sys/pdpuba/dhu.c line
139,
200,
297
- in /usr/src/sys/pdpuba/dhv.c line
153,
205,
306
- in /usr/src/sys/pdpuba/dz.c line
130,
181,
229
- in /usr/src/sys/sys/subr_prf.c line
323-324(2)
- in /usr/src/sys/sys/sys_inode.c line
714
- in /usr/src/sys/sys/tty.c line
662-663(2),
730,
1177,
1210,
1331
- in /usr/src/sys/sys/tty_pty.c line
71,
251,
338,
347,
359,
395,
409,
429
- in /usr/src/usr.sbin/pstat/pstat.c line
479
TS_TTSTOP
defined in line
113; used 34 times
- in /usr/src/sys/pdp/cons.c line
155
- in /usr/src/sys/pdpuba/dh.c line
522,
591,
736-741(2)
- in /usr/src/sys/pdpuba/dhu.c line
286-291(2),
545,
566,
625
- in /usr/src/sys/pdpuba/dhv.c line
295-300(2),
588,
609,
670
- in /usr/src/sys/pdpuba/dz.c line
418,
466
- in /usr/src/sys/sys/tty.c line
196,
411-412(2),
420-421(2),
468,
719-722(3),
896-897(2),
1030-1034(2)
- in /usr/src/sys/sys/tty_pty.c line
168,
266,
339
- in /usr/src/usr.sbin/pstat/pstat.c line
485
TTIPRI
defined in line
89; used 14 times
VTAB
defined in line
133;
never used
t_canq
defined in line
43; used 45 times
- in /usr/src/new/crash/crash.c line
248-250(3),
988-989(2),
1016-1017(2),
1045-1048(3)
- in /usr/src/sys/sys/tty.c line
186,
220,
226,
456-459(3),
583,
877,
994,
1007,
1201,
1604-1606(2),
1614(2)
- in /usr/src/sys/sys/tty_pty.c line
119-132(7),
361-366(3),
398-403(3),
413-418(3),
433-434(2)
- in /usr/src/sys/sys/tty_tb.c line
115
- in /usr/src/usr.sbin/pstat/pstat.c line
474
t_cp
defined in line
51; used 4 times
t_rawq
defined in line
42; used 74 times
- in /usr/src/new/crash/crash.c line
242-244(3),
978-979(2),
1006-1007(2),
1035-1036(2)
- in /usr/src/sys/pdpuba/dh.c line
180,
265
- in /usr/src/sys/pdpuba/dhu.c line
174,
299
- in /usr/src/sys/pdpuba/dhv.c line
184,
308
- in /usr/src/sys/pdpuba/dz.c line
159,
230
- in /usr/src/sys/sys/tty.c line
188,
220,
456-458(3),
585,
743,
776-778(4),
819-822(2),
877,
924-928(2),
940-952(6),
966-982(6),
994,
1004-1007(2),
1175,
1187-1193(3),
1201,
1220,
1273,
1340,
1521,
1530,
1537-1541(2),
1608-1610(2),
1616-1621(3),
1694
- in /usr/src/sys/sys/tty_pty.c line
81,
196,
364,
433-436(2),
460
- in /usr/src/sys/sys/tty_tb.c line
114
- in /usr/src/usr.sbin/pstat/pstat.c line
474
t_rec
defined in line
53;
never used
Usage of this include