1: /*
2: * A clist structure is the head
3: * of a linked list queue of characters.
4: * The characters are stored in 4-word
5: * blocks containing a link and several characters.
6: * The routines getc and putc
7: * manipulate these structures.
8: */
9: struct clist
10: {
11: int c_cc; /* character count */
12: char *c_cf; /* pointer to first char */
13: char *c_cl; /* pointer to last char */
14: };
15:
16: /*
17: * A tty structure is needed for
18: * each UNIX character device that
19: * is used for normal terminal IO.
20: * The routines in tty.c handle the
21: * common code associated with
22: * these structures.
23: * The definition and device dependent
24: * code is in each driver. (kl.c dc.c dh.c)
25: */
26:
27: struct tc {
28: char t_intrc; /* interrupt */
29: char t_quitc; /* quit */
30: char t_startc; /* start output */
31: char t_stopc; /* stop output */
32: char t_eofc; /* end-of-file */
33: char t_brkc; /* input delimiter (like nl) */
34: };
35:
36: struct tty
37: {
38: struct clist t_rawq; /* input chars right off device */
39: struct clist t_canq; /* input chars after erase and kill */
40: struct clist t_outq; /* output list to device */
41: int (* t_oproc)(); /* routine to start output */
42: int (* t_iproc)(); /* routine to start input */
43: struct chan *t_chan; /* destination channel */
44: caddr_t t_linep; /* aux line discipline pointer */
45: caddr_t t_addr; /* device address */
46: dev_t t_dev; /* device number */
47: short t_flags; /* mode, settable by ioctl call */
48: short t_state; /* internal state, not visible externally */
49: short t_pgrp; /* process group name */
50: char t_delct; /* number of delimiters in raw q */
51: char t_line; /* line discipline */
52: char t_col; /* printing column of device */
53: char t_erase; /* erase character */
54: char t_kill; /* kill character */
55: char t_char; /* character temporary */
56: char t_ispeed; /* input speed */
57: char t_ospeed; /* output speed */
58: union {
59: struct tc;
60: struct clist t_ctlq;
61: } t_un;
62: };
63:
64: #define tun tp->t_un
65:
66: /*
67: * structure of arg for ioctl
68: */
69: struct ttiocb {
70: char ioc_ispeed;
71: char ioc_ospeed;
72: char ioc_erase;
73: char ioc_kill;
74: int ioc_flags;
75: };
76:
77: #define TTIPRI 28
78: #define TTOPRI 29
79:
80: #define CERASE '#' /* default special characters */
81: #define CEOT 004
82: #define CKILL '@'
83: #define CQUIT 034 /* FS, cntl shift L */
84: #define CINTR 0177 /* DEL */
85: #define CSTOP 023 /* Stop output: ctl-s */
86: #define CSTART 021 /* Start output: ctl-q */
87: #define CBRK 0377
88:
89: /* limits */
90: #define TTHIWAT 100
91: #define TTLOWAT 50
92: #define TTYHOG 256
93:
94: /* modes */
95: #define TANDEM 01
96: #define CBREAK 02
97: #define LCASE 04
98: #define ECHO 010
99: #define CRMOD 020
100: #define RAW 040
101: #define ODDP 0100
102: #define EVENP 0200
103: #define NLDELAY 001400
104: #define TBDELAY 006000
105: #define XTABS 006000
106: #define CRDELAY 030000
107: #define VTDELAY 040000
108:
109: /* Hardware bits */
110: #define DONE 0200
111: #define IENABLE 0100
112:
113: /* Internal state bits */
114: #define TIMEOUT 01 /* Delay timeout in progress */
115: #define WOPEN 02 /* Waiting for open to complete */
116: #define ISOPEN 04 /* Device is open */
117: #define FLUSH 010 /* outq has been flushed during DMA */
118: #define CARR_ON 020 /* Software copy of carrier-present */
119: #define BUSY 040 /* Output in progress */
120: #define ASLEEP 0100 /* Wakeup when output done */
121: #define XCLUDE 0200 /* exclusive-use flag against open */
122: #define TTSTOP 0400 /* Output stopped by ctl-s */
123: #define HUPCLS 01000 /* Hang up upon last close */
124: #define TBLOCK 02000 /* tandem queue blocked */
125: #define DKCMD 04000 /* datakit command channel */
126: #define DKMPX 010000 /* datakit user-multiplexed mode */
127: #define DKCALL 020000 /* datakit dial mode */
128: #define DKLINGR 040000 /* datakit lingering close mode */
129: #define CNTLQ 0100000 /* interpret t_un as clist */
130:
131: /*
132: * tty ioctl commands
133: */
134: #define TIOCGETD (('t'<<8)|0)
135: #define TIOCSETD (('t'<<8)|1)
136: #define TIOCHPCL (('t'<<8)|2)
137: #define TIOCMODG (('t'<<8)|3)
138: #define TIOCMODS (('t'<<8)|4)
139: #define TIOCGETP (('t'<<8)|8)
140: #define TIOCSETP (('t'<<8)|9)
141: #define TIOCSETN (('t'<<8)|10)
142: #define TIOCEXCL (('t'<<8)|13)
143: #define TIOCNXCL (('t'<<8)|14)
144: #define TIOCFLUSH (('t'<<8)|16)
145: #define TIOCSETC (('t'<<8)|17)
146: #define TIOCGETC (('t'<<8)|18)
147: #define DIOCLSTN (('d'<<8)|1)
148: #define DIOCNTRL (('d'<<8)|2)
149: #define DIOCMPX (('d'<<8)|3)
150: #define DIOCNMPX (('d'<<8)|4)
151: #define DIOCSCALL (('d'<<8)|5)
152: #define DIOCRCALL (('d'<<8)|6)
153: #define DIOCPGRP (('d'<<8)|7)
154: #define DIOCGETP (('d'<<8)|8)
155: #define DIOCSETP (('d'<<8)|9)
156: #define DIOCLOSE (('d'<<8)|10)
157: #define DIOCTIME (('d'<<8)|11)
158: #define DIOCRESET (('d'<<8)|12)
159: #define FIOCLEX (('f'<<8)|1)
160: #define FIONCLEX (('f'<<8)|2)
161: #define MXLSTN (('x'<<8)|1)
162: #define MXNBLK (('x'<<8)|2)
Defined struct's
clist
defined in line
9; used 48 times
- in line 38-40(6),
60(2)
- in /usr/sys/dev/cat.c line
21(2)
- in /usr/sys/dev/mx2.c line
397(2),
423(2),
450(2),
485(2),
527(2),
548(2),
718(2),
728(2),
752(2)
- in /usr/sys/dev/vs.c line
26-28(4)
- in /usr/sys/sys/prim.c line
20(2),
56(2),
103(2),
144(2),
192(2),
233(2),
302(2),
313(2)
tc
defined in line
27; used 6 times
tty
defined in line
36; used 148 times
- in /usr/src/cmd/pstat.c line
238-240(4),
261-263(4)
- in /usr/sys/dev/dc.c line
33(2),
100(2),
138(2),
170(2),
184(2),
223(2)
- in /usr/sys/dev/dh.c line
19(2),
80(2),
127(2),
143(2),
154(2),
165(2),
199(2),
215(2),
254(2),
291(2),
360(2)
- in /usr/sys/dev/dhdm.c line
10(2),
39(2),
90(2)
- in /usr/sys/dev/dhfdm.c line
8-12(4)
- in /usr/sys/dev/dz.c line
13(2),
47(2),
79(2),
104(2),
118(2),
147(2),
175(2),
188(2),
243(2)
- in /usr/sys/dev/kl.c line
27(2),
43(2),
79(2),
100(2),
116(2),
134(2)
- in /usr/sys/dev/mx1.c line
146(2),
344(2)
- in /usr/sys/dev/mx2.c line
89(2),
345(2),
664(2),
886-891(4)
- in /usr/sys/dev/pk1.c line
17(2),
122(2),
147(2),
166(2),
193(2)
- in /usr/sys/dev/pk2.c line
35(2),
56(2),
153(2),
203(2),
246(2)
- in /usr/sys/dev/tty.c line
63(2),
85(2),
101(2),
168(2),
289(2),
306(2),
334(2),
402(2),
432(2),
502(2),
528(2),
659(2),
673(2),
688(2),
705(2)
- in /usr/sys/sys/fakemx.c line
19(2)
Defined macros
BUSY
defined in line
119; used 11 times
CBRK
defined in line
87; used 1 times
CEOT
defined in line
81; used 2 times
CINTR
defined in line
84; used 1 times
CKILL
defined in line
82; used 2 times
CQUIT
defined in line
83; used 1 times
CRMOD
defined in line
99; used 3 times
CSTOP
defined in line
85; used 1 times
DONE
defined in line
110; used 4 times
ECHO
defined in line
98; used 5 times
EVENP
defined in line
102; used 13 times
LCASE
defined in line
97; used 4 times
ODDP
defined in line
101; used 10 times
RAW
defined in line
100; used 16 times
- in /usr/sys/dev/dh.c line
185,
235,
327
- in /usr/sys/dev/dz.c line
134,
161,
209
- in /usr/sys/dev/kl.c line
143
- in /usr/sys/dev/tty.c line
342-343(2),
353,
408,
442,
482-483(2),
491,
540
WOPEN
defined in line
115; used 10 times
tun
defined in line
64; used 20 times
Usage of this include