sunos_ioctl.c revision 1.17 1 1.17 pk /* $NetBSD: sunos_ioctl.c,v 1.17 1995/04/02 10:43:29 pk Exp $ */
2 1.11 cgd
3 1.1 deraadt /*
4 1.2 deraadt * Copyright (c) 1993 Markus Wild.
5 1.2 deraadt * All rights reserved.
6 1.1 deraadt *
7 1.1 deraadt * Redistribution and use in source and binary forms, with or without
8 1.1 deraadt * modification, are permitted provided that the following conditions
9 1.1 deraadt * are met:
10 1.1 deraadt * 1. Redistributions of source code must retain the above copyright
11 1.1 deraadt * notice, this list of conditions and the following disclaimer.
12 1.2 deraadt * 2. The name of the author may not be used to endorse or promote products
13 1.8 jtc * derived from this software without specific prior written permission
14 1.1 deraadt *
15 1.2 deraadt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 1.2 deraadt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 1.2 deraadt * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 1.2 deraadt * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 1.2 deraadt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 1.2 deraadt * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 1.2 deraadt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 1.2 deraadt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 1.2 deraadt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 1.2 deraadt * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 1.1 deraadt *
26 1.13 deraadt * loosely from: Header: sunos_ioctl.c,v 1.7 93/05/28 04:40:43 torek Exp
27 1.1 deraadt */
28 1.1 deraadt
29 1.1 deraadt #include <sys/param.h>
30 1.1 deraadt #include <sys/proc.h>
31 1.13 deraadt #include <sys/systm.h>
32 1.1 deraadt #include <sys/file.h>
33 1.1 deraadt #include <sys/filedesc.h>
34 1.1 deraadt #include <sys/ioctl.h>
35 1.1 deraadt #include <sys/termios.h>
36 1.1 deraadt #include <sys/tty.h>
37 1.6 deraadt #include <sys/socket.h>
38 1.16 pk #include <sys/audioio.h>
39 1.6 deraadt #include <net/if.h>
40 1.1 deraadt
41 1.13 deraadt #include <sys/mount.h>
42 1.13 deraadt
43 1.13 deraadt #include <sys/syscallargs.h>
44 1.13 deraadt #include <compat/sunos/sunos.h>
45 1.13 deraadt #include <compat/sunos/sunos_syscallargs.h>
46 1.13 deraadt
47 1.1 deraadt /*
48 1.1 deraadt * SunOS ioctl calls.
49 1.1 deraadt * This file is something of a hodge-podge.
50 1.1 deraadt * Support gets added as things turn up....
51 1.1 deraadt */
52 1.1 deraadt
53 1.2 deraadt static struct speedtab sptab[] = {
54 1.2 deraadt { 0, 0 },
55 1.2 deraadt { 50, 1 },
56 1.2 deraadt { 75, 2 },
57 1.2 deraadt { 110, 3 },
58 1.2 deraadt { 134, 4 },
59 1.2 deraadt { 135, 4 },
60 1.2 deraadt { 150, 5 },
61 1.2 deraadt { 200, 6 },
62 1.2 deraadt { 300, 7 },
63 1.2 deraadt { 600, 8 },
64 1.2 deraadt { 1200, 9 },
65 1.2 deraadt { 1800, 10 },
66 1.2 deraadt { 2400, 11 },
67 1.2 deraadt { 4800, 12 },
68 1.2 deraadt { 9600, 13 },
69 1.2 deraadt { 19200, 14 },
70 1.2 deraadt { 38400, 15 },
71 1.2 deraadt { -1, -1 }
72 1.2 deraadt };
73 1.2 deraadt
74 1.2 deraadt static u_long s2btab[] = {
75 1.2 deraadt 0,
76 1.2 deraadt 50,
77 1.2 deraadt 75,
78 1.2 deraadt 110,
79 1.2 deraadt 134,
80 1.2 deraadt 150,
81 1.2 deraadt 200,
82 1.2 deraadt 300,
83 1.2 deraadt 600,
84 1.2 deraadt 1200,
85 1.2 deraadt 1800,
86 1.2 deraadt 2400,
87 1.2 deraadt 4800,
88 1.2 deraadt 9600,
89 1.2 deraadt 19200,
90 1.2 deraadt 38400,
91 1.2 deraadt };
92 1.2 deraadt
93 1.2 deraadt /*
94 1.2 deraadt * these two conversion functions have mostly been done
95 1.2 deraadt * with some perl cut&paste, then handedited to comment
96 1.2 deraadt * out what doesn't exist under NetBSD.
97 1.2 deraadt * A note from Markus's code:
98 1.2 deraadt * (l & BITMASK1) / BITMASK1 * BITMASK2 is translated
99 1.2 deraadt * optimally by gcc m68k, much better than any ?: stuff.
100 1.2 deraadt * Code may vary with different architectures of course.
101 1.2 deraadt *
102 1.2 deraadt * I don't know what optimizer you used, but seeing divu's and
103 1.2 deraadt * bfextu's in the m68k assembly output did not encourage me...
104 1.2 deraadt * as well, gcc on the sparc definately generates much better
105 1.2 deraadt * code with ?:.
106 1.2 deraadt */
107 1.2 deraadt
108 1.2 deraadt static void
109 1.2 deraadt stios2btios(st, bt)
110 1.13 deraadt struct sunos_termios *st;
111 1.2 deraadt struct termios *bt;
112 1.2 deraadt {
113 1.2 deraadt register u_long l, r;
114 1.2 deraadt
115 1.2 deraadt l = st->c_iflag;
116 1.3 deraadt r = ((l & 0x00000001) ? IGNBRK : 0);
117 1.3 deraadt r |= ((l & 0x00000002) ? BRKINT : 0);
118 1.3 deraadt r |= ((l & 0x00000004) ? IGNPAR : 0);
119 1.3 deraadt r |= ((l & 0x00000008) ? PARMRK : 0);
120 1.3 deraadt r |= ((l & 0x00000010) ? INPCK : 0);
121 1.3 deraadt r |= ((l & 0x00000020) ? ISTRIP : 0);
122 1.3 deraadt r |= ((l & 0x00000040) ? INLCR : 0);
123 1.3 deraadt r |= ((l & 0x00000080) ? IGNCR : 0);
124 1.3 deraadt r |= ((l & 0x00000100) ? ICRNL : 0);
125 1.3 deraadt /* ((l & 0x00000200) ? IUCLC : 0) */
126 1.3 deraadt r |= ((l & 0x00000400) ? IXON : 0);
127 1.3 deraadt r |= ((l & 0x00000800) ? IXANY : 0);
128 1.3 deraadt r |= ((l & 0x00001000) ? IXOFF : 0);
129 1.3 deraadt r |= ((l & 0x00002000) ? IMAXBEL : 0);
130 1.2 deraadt bt->c_iflag = r;
131 1.2 deraadt
132 1.2 deraadt l = st->c_oflag;
133 1.3 deraadt r = ((l & 0x00000001) ? OPOST : 0);
134 1.3 deraadt /* ((l & 0x00000002) ? OLCUC : 0) */
135 1.3 deraadt r |= ((l & 0x00000004) ? ONLCR : 0);
136 1.3 deraadt /* ((l & 0x00000008) ? OCRNL : 0) */
137 1.3 deraadt /* ((l & 0x00000010) ? ONOCR : 0) */
138 1.3 deraadt /* ((l & 0x00000020) ? ONLRET : 0) */
139 1.3 deraadt /* ((l & 0x00000040) ? OFILL : 0) */
140 1.3 deraadt /* ((l & 0x00000080) ? OFDEL : 0) */
141 1.3 deraadt /* ((l & 0x00000100) ? NLDLY : 0) */
142 1.3 deraadt /* ((l & 0x00000100) ? NL1 : 0) */
143 1.3 deraadt /* ((l & 0x00000600) ? CRDLY : 0) */
144 1.3 deraadt /* ((l & 0x00000200) ? CR1 : 0) */
145 1.3 deraadt /* ((l & 0x00000400) ? CR2 : 0) */
146 1.3 deraadt /* ((l & 0x00000600) ? CR3 : 0) */
147 1.3 deraadt /* ((l & 0x00001800) ? TABDLY : 0) */
148 1.3 deraadt /* ((l & 0x00000800) ? TAB1 : 0) */
149 1.3 deraadt /* ((l & 0x00001000) ? TAB2 : 0) */
150 1.3 deraadt r |= ((l & 0x00001800) ? OXTABS : 0);
151 1.3 deraadt /* ((l & 0x00002000) ? BSDLY : 0) */
152 1.3 deraadt /* ((l & 0x00002000) ? BS1 : 0) */
153 1.3 deraadt /* ((l & 0x00004000) ? VTDLY : 0) */
154 1.3 deraadt /* ((l & 0x00004000) ? VT1 : 0) */
155 1.3 deraadt /* ((l & 0x00008000) ? FFDLY : 0) */
156 1.3 deraadt /* ((l & 0x00008000) ? FF1 : 0) */
157 1.3 deraadt /* ((l & 0x00010000) ? PAGEOUT : 0) */
158 1.3 deraadt /* ((l & 0x00020000) ? WRAP : 0) */
159 1.2 deraadt bt->c_oflag = r;
160 1.2 deraadt
161 1.2 deraadt l = st->c_cflag;
162 1.14 deraadt switch (l & 0x00000030) {
163 1.14 deraadt case 0:
164 1.14 deraadt r = CS5;
165 1.14 deraadt break;
166 1.14 deraadt case 0x00000010:
167 1.14 deraadt r = CS6;
168 1.14 deraadt break;
169 1.14 deraadt case 0x00000020:
170 1.14 deraadt r = CS7;
171 1.14 deraadt break;
172 1.14 deraadt case 0x00000030:
173 1.14 deraadt r = CS8;
174 1.14 deraadt break;
175 1.14 deraadt }
176 1.3 deraadt r |= ((l & 0x00000040) ? CSTOPB : 0);
177 1.3 deraadt r |= ((l & 0x00000080) ? CREAD : 0);
178 1.3 deraadt r |= ((l & 0x00000100) ? PARENB : 0);
179 1.3 deraadt r |= ((l & 0x00000200) ? PARODD : 0);
180 1.3 deraadt r |= ((l & 0x00000400) ? HUPCL : 0);
181 1.3 deraadt r |= ((l & 0x00000800) ? CLOCAL : 0);
182 1.3 deraadt /* ((l & 0x00001000) ? LOBLK : 0) */
183 1.3 deraadt r |= ((l & 0x80000000) ? (CRTS_IFLOW|CCTS_OFLOW) : 0);
184 1.2 deraadt bt->c_cflag = r;
185 1.2 deraadt
186 1.2 deraadt bt->c_ispeed = bt->c_ospeed = s2btab[l & 0x0000000f];
187 1.2 deraadt
188 1.2 deraadt l = st->c_lflag;
189 1.3 deraadt r = ((l & 0x00000001) ? ISIG : 0);
190 1.3 deraadt r |= ((l & 0x00000002) ? ICANON : 0);
191 1.3 deraadt /* ((l & 0x00000004) ? XCASE : 0) */
192 1.3 deraadt r |= ((l & 0x00000008) ? ECHO : 0);
193 1.3 deraadt r |= ((l & 0x00000010) ? ECHOE : 0);
194 1.3 deraadt r |= ((l & 0x00000020) ? ECHOK : 0);
195 1.3 deraadt r |= ((l & 0x00000040) ? ECHONL : 0);
196 1.3 deraadt r |= ((l & 0x00000080) ? NOFLSH : 0);
197 1.3 deraadt r |= ((l & 0x00000100) ? TOSTOP : 0);
198 1.3 deraadt r |= ((l & 0x00000200) ? ECHOCTL : 0);
199 1.3 deraadt r |= ((l & 0x00000400) ? ECHOPRT : 0);
200 1.3 deraadt r |= ((l & 0x00000800) ? ECHOKE : 0);
201 1.3 deraadt /* ((l & 0x00001000) ? DEFECHO : 0) */
202 1.3 deraadt r |= ((l & 0x00002000) ? FLUSHO : 0);
203 1.3 deraadt r |= ((l & 0x00004000) ? PENDIN : 0);
204 1.2 deraadt bt->c_lflag = r;
205 1.2 deraadt
206 1.2 deraadt bt->c_cc[VINTR] = st->c_cc[0] ? st->c_cc[0] : _POSIX_VDISABLE;
207 1.2 deraadt bt->c_cc[VQUIT] = st->c_cc[1] ? st->c_cc[1] : _POSIX_VDISABLE;
208 1.2 deraadt bt->c_cc[VERASE] = st->c_cc[2] ? st->c_cc[2] : _POSIX_VDISABLE;
209 1.2 deraadt bt->c_cc[VKILL] = st->c_cc[3] ? st->c_cc[3] : _POSIX_VDISABLE;
210 1.2 deraadt bt->c_cc[VEOF] = st->c_cc[4] ? st->c_cc[4] : _POSIX_VDISABLE;
211 1.2 deraadt bt->c_cc[VEOL] = st->c_cc[5] ? st->c_cc[5] : _POSIX_VDISABLE;
212 1.2 deraadt bt->c_cc[VEOL2] = st->c_cc[6] ? st->c_cc[6] : _POSIX_VDISABLE;
213 1.2 deraadt /* bt->c_cc[VSWTCH] = st->c_cc[7] ? st->c_cc[7] : _POSIX_VDISABLE; */
214 1.2 deraadt bt->c_cc[VSTART] = st->c_cc[8] ? st->c_cc[8] : _POSIX_VDISABLE;
215 1.2 deraadt bt->c_cc[VSTOP] = st->c_cc[9] ? st->c_cc[9] : _POSIX_VDISABLE;
216 1.2 deraadt bt->c_cc[VSUSP] = st->c_cc[10] ? st->c_cc[10] : _POSIX_VDISABLE;
217 1.2 deraadt bt->c_cc[VDSUSP] = st->c_cc[11] ? st->c_cc[11] : _POSIX_VDISABLE;
218 1.2 deraadt bt->c_cc[VREPRINT] = st->c_cc[12] ? st->c_cc[12] : _POSIX_VDISABLE;
219 1.2 deraadt bt->c_cc[VDISCARD] = st->c_cc[13] ? st->c_cc[13] : _POSIX_VDISABLE;
220 1.2 deraadt bt->c_cc[VWERASE] = st->c_cc[14] ? st->c_cc[14] : _POSIX_VDISABLE;
221 1.2 deraadt bt->c_cc[VLNEXT] = st->c_cc[15] ? st->c_cc[15] : _POSIX_VDISABLE;
222 1.2 deraadt bt->c_cc[VSTATUS] = st->c_cc[16] ? st->c_cc[16] : _POSIX_VDISABLE;
223 1.15 deraadt
224 1.15 deraadt /* if `raw mode', create native VMIN/VTIME from SunOS VEOF/VEOL */
225 1.15 deraadt bt->c_cc[VMIN] = (bt->c_lflag & ICANON) ? 1 : bt->c_cc[VEOF];
226 1.15 deraadt bt->c_cc[VTIME] = (bt->c_lflag & ICANON) ? 1 : bt->c_cc[VEOL];
227 1.2 deraadt }
228 1.2 deraadt
229 1.2 deraadt
230 1.2 deraadt static void
231 1.2 deraadt btios2stios(bt, st)
232 1.2 deraadt struct termios *bt;
233 1.13 deraadt struct sunos_termios *st;
234 1.2 deraadt {
235 1.2 deraadt register u_long l, r;
236 1.2 deraadt
237 1.2 deraadt l = bt->c_iflag;
238 1.3 deraadt r = ((l & IGNBRK) ? 0x00000001 : 0);
239 1.3 deraadt r |= ((l & BRKINT) ? 0x00000002 : 0);
240 1.3 deraadt r |= ((l & IGNPAR) ? 0x00000004 : 0);
241 1.3 deraadt r |= ((l & PARMRK) ? 0x00000008 : 0);
242 1.3 deraadt r |= ((l & INPCK) ? 0x00000010 : 0);
243 1.3 deraadt r |= ((l & ISTRIP) ? 0x00000020 : 0);
244 1.3 deraadt r |= ((l & INLCR) ? 0x00000040 : 0);
245 1.3 deraadt r |= ((l & IGNCR) ? 0x00000080 : 0);
246 1.3 deraadt r |= ((l & ICRNL) ? 0x00000100 : 0);
247 1.3 deraadt /* ((l & IUCLC) ? 0x00000200 : 0) */
248 1.3 deraadt r |= ((l & IXON) ? 0x00000400 : 0);
249 1.3 deraadt r |= ((l & IXANY) ? 0x00000800 : 0);
250 1.3 deraadt r |= ((l & IXOFF) ? 0x00001000 : 0);
251 1.3 deraadt r |= ((l & IMAXBEL) ? 0x00002000 : 0);
252 1.2 deraadt st->c_iflag = r;
253 1.2 deraadt
254 1.2 deraadt l = bt->c_oflag;
255 1.3 deraadt r = ((l & OPOST) ? 0x00000001 : 0);
256 1.3 deraadt /* ((l & OLCUC) ? 0x00000002 : 0) */
257 1.3 deraadt r |= ((l & ONLCR) ? 0x00000004 : 0);
258 1.3 deraadt /* ((l & OCRNL) ? 0x00000008 : 0) */
259 1.3 deraadt /* ((l & ONOCR) ? 0x00000010 : 0) */
260 1.3 deraadt /* ((l & ONLRET) ? 0x00000020 : 0) */
261 1.3 deraadt /* ((l & OFILL) ? 0x00000040 : 0) */
262 1.3 deraadt /* ((l & OFDEL) ? 0x00000080 : 0) */
263 1.3 deraadt /* ((l & NLDLY) ? 0x00000100 : 0) */
264 1.3 deraadt /* ((l & NL1) ? 0x00000100 : 0) */
265 1.3 deraadt /* ((l & CRDLY) ? 0x00000600 : 0) */
266 1.3 deraadt /* ((l & CR1) ? 0x00000200 : 0) */
267 1.3 deraadt /* ((l & CR2) ? 0x00000400 : 0) */
268 1.3 deraadt /* ((l & CR3) ? 0x00000600 : 0) */
269 1.3 deraadt /* ((l & TABDLY) ? 0x00001800 : 0) */
270 1.3 deraadt /* ((l & TAB1) ? 0x00000800 : 0) */
271 1.3 deraadt /* ((l & TAB2) ? 0x00001000 : 0) */
272 1.3 deraadt r |= ((l & OXTABS) ? 0x00001800 : 0);
273 1.3 deraadt /* ((l & BSDLY) ? 0x00002000 : 0) */
274 1.3 deraadt /* ((l & BS1) ? 0x00002000 : 0) */
275 1.3 deraadt /* ((l & VTDLY) ? 0x00004000 : 0) */
276 1.3 deraadt /* ((l & VT1) ? 0x00004000 : 0) */
277 1.3 deraadt /* ((l & FFDLY) ? 0x00008000 : 0) */
278 1.3 deraadt /* ((l & FF1) ? 0x00008000 : 0) */
279 1.3 deraadt /* ((l & PAGEOUT) ? 0x00010000 : 0) */
280 1.3 deraadt /* ((l & WRAP) ? 0x00020000 : 0) */
281 1.2 deraadt st->c_oflag = r;
282 1.2 deraadt
283 1.2 deraadt l = bt->c_cflag;
284 1.14 deraadt switch (l & CSIZE) {
285 1.14 deraadt case CS5:
286 1.14 deraadt r = 0;
287 1.14 deraadt break;
288 1.14 deraadt case CS6:
289 1.14 deraadt r = 0x00000010;
290 1.14 deraadt break;
291 1.14 deraadt case CS7:
292 1.14 deraadt r = 0x00000020;
293 1.14 deraadt break;
294 1.14 deraadt case CS8:
295 1.14 deraadt r = 0x00000030;
296 1.14 deraadt break;
297 1.14 deraadt }
298 1.3 deraadt r |= ((l & CSTOPB) ? 0x00000040 : 0);
299 1.3 deraadt r |= ((l & CREAD) ? 0x00000080 : 0);
300 1.3 deraadt r |= ((l & PARENB) ? 0x00000100 : 0);
301 1.3 deraadt r |= ((l & PARODD) ? 0x00000200 : 0);
302 1.3 deraadt r |= ((l & HUPCL) ? 0x00000400 : 0);
303 1.3 deraadt r |= ((l & CLOCAL) ? 0x00000800 : 0);
304 1.3 deraadt /* ((l & LOBLK) ? 0x00001000 : 0) */
305 1.3 deraadt r |= ((l & (CRTS_IFLOW|CCTS_OFLOW)) ? 0x80000000 : 0);
306 1.2 deraadt st->c_cflag = r;
307 1.2 deraadt
308 1.2 deraadt l = bt->c_lflag;
309 1.3 deraadt r = ((l & ISIG) ? 0x00000001 : 0);
310 1.3 deraadt r |= ((l & ICANON) ? 0x00000002 : 0);
311 1.3 deraadt /* ((l & XCASE) ? 0x00000004 : 0) */
312 1.3 deraadt r |= ((l & ECHO) ? 0x00000008 : 0);
313 1.3 deraadt r |= ((l & ECHOE) ? 0x00000010 : 0);
314 1.3 deraadt r |= ((l & ECHOK) ? 0x00000020 : 0);
315 1.3 deraadt r |= ((l & ECHONL) ? 0x00000040 : 0);
316 1.3 deraadt r |= ((l & NOFLSH) ? 0x00000080 : 0);
317 1.3 deraadt r |= ((l & TOSTOP) ? 0x00000100 : 0);
318 1.3 deraadt r |= ((l & ECHOCTL) ? 0x00000200 : 0);
319 1.3 deraadt r |= ((l & ECHOPRT) ? 0x00000400 : 0);
320 1.3 deraadt r |= ((l & ECHOKE) ? 0x00000800 : 0);
321 1.3 deraadt /* ((l & DEFECHO) ? 0x00001000 : 0) */
322 1.3 deraadt r |= ((l & FLUSHO) ? 0x00002000 : 0);
323 1.3 deraadt r |= ((l & PENDIN) ? 0x00004000 : 0);
324 1.2 deraadt st->c_lflag = r;
325 1.2 deraadt
326 1.2 deraadt l = ttspeedtab(bt->c_ospeed, sptab);
327 1.2 deraadt if (l >= 0)
328 1.2 deraadt st->c_cflag |= l;
329 1.2 deraadt
330 1.2 deraadt st->c_cc[0] = bt->c_cc[VINTR] != _POSIX_VDISABLE? bt->c_cc[VINTR]:0;
331 1.2 deraadt st->c_cc[1] = bt->c_cc[VQUIT] != _POSIX_VDISABLE? bt->c_cc[VQUIT]:0;
332 1.2 deraadt st->c_cc[2] = bt->c_cc[VERASE] != _POSIX_VDISABLE? bt->c_cc[VERASE]:0;
333 1.2 deraadt st->c_cc[3] = bt->c_cc[VKILL] != _POSIX_VDISABLE? bt->c_cc[VKILL]:0;
334 1.2 deraadt st->c_cc[4] = bt->c_cc[VEOF] != _POSIX_VDISABLE? bt->c_cc[VEOF]:0;
335 1.2 deraadt st->c_cc[5] = bt->c_cc[VEOL] != _POSIX_VDISABLE? bt->c_cc[VEOL]:0;
336 1.2 deraadt st->c_cc[6] = bt->c_cc[VEOL2] != _POSIX_VDISABLE? bt->c_cc[VEOL2]:0;
337 1.2 deraadt st->c_cc[7] = 0;
338 1.2 deraadt /* bt->c_cc[VSWTCH] != _POSIX_VDISABLE? bt->c_cc[VSWTCH]: */
339 1.2 deraadt st->c_cc[8] = bt->c_cc[VSTART] != _POSIX_VDISABLE? bt->c_cc[VSTART]:0;
340 1.2 deraadt st->c_cc[9] = bt->c_cc[VSTOP] != _POSIX_VDISABLE? bt->c_cc[VSTOP]:0;
341 1.2 deraadt st->c_cc[10]= bt->c_cc[VSUSP] != _POSIX_VDISABLE? bt->c_cc[VSUSP]:0;
342 1.2 deraadt st->c_cc[11]= bt->c_cc[VDSUSP] != _POSIX_VDISABLE? bt->c_cc[VDSUSP]:0;
343 1.2 deraadt st->c_cc[12]= bt->c_cc[VREPRINT]!= _POSIX_VDISABLE? bt->c_cc[VREPRINT]:0;
344 1.2 deraadt st->c_cc[13]= bt->c_cc[VDISCARD]!= _POSIX_VDISABLE? bt->c_cc[VDISCARD]:0;
345 1.2 deraadt st->c_cc[14]= bt->c_cc[VWERASE] != _POSIX_VDISABLE? bt->c_cc[VWERASE]:0;
346 1.2 deraadt st->c_cc[15]= bt->c_cc[VLNEXT] != _POSIX_VDISABLE? bt->c_cc[VLNEXT]:0;
347 1.2 deraadt st->c_cc[16]= bt->c_cc[VSTATUS] != _POSIX_VDISABLE? bt->c_cc[VSTATUS]:0;
348 1.2 deraadt
349 1.17 pk if (!(bt->c_lflag & ICANON)) {
350 1.17 pk /* SunOS stores VMIN/VTIME in VEOF/VEOL (if ICANON is off) */
351 1.17 pk st->c_cc[4] = bt->c_cc[VMIN];
352 1.17 pk st->c_cc[5] = bt->c_cc[VTIME];
353 1.17 pk }
354 1.17 pk
355 1.2 deraadt st->c_line = 0;
356 1.2 deraadt }
357 1.2 deraadt
358 1.2 deraadt static void
359 1.2 deraadt stios2stio(ts, t)
360 1.13 deraadt struct sunos_termios *ts;
361 1.13 deraadt struct sunos_termio *t;
362 1.2 deraadt {
363 1.2 deraadt t->c_iflag = ts->c_iflag;
364 1.2 deraadt t->c_oflag = ts->c_oflag;
365 1.2 deraadt t->c_cflag = ts->c_cflag;
366 1.2 deraadt t->c_lflag = ts->c_lflag;
367 1.2 deraadt t->c_line = ts->c_line;
368 1.2 deraadt bcopy(ts->c_cc, t->c_cc, 8);
369 1.2 deraadt }
370 1.2 deraadt
371 1.2 deraadt static void
372 1.2 deraadt stio2stios(t, ts)
373 1.13 deraadt struct sunos_termio *t;
374 1.13 deraadt struct sunos_termios *ts;
375 1.2 deraadt {
376 1.2 deraadt ts->c_iflag = t->c_iflag;
377 1.2 deraadt ts->c_oflag = t->c_oflag;
378 1.2 deraadt ts->c_cflag = t->c_cflag;
379 1.2 deraadt ts->c_lflag = t->c_lflag;
380 1.2 deraadt ts->c_line = t->c_line;
381 1.2 deraadt bcopy(t->c_cc, ts->c_cc, 8); /* don't touch the upper fields! */
382 1.2 deraadt }
383 1.1 deraadt
384 1.2 deraadt int
385 1.13 deraadt sunos_ioctl(p, uap, retval)
386 1.1 deraadt register struct proc *p;
387 1.13 deraadt struct sunos_ioctl_args *uap;
388 1.12 cgd register_t *retval;
389 1.1 deraadt {
390 1.1 deraadt register struct filedesc *fdp = p->p_fd;
391 1.1 deraadt register struct file *fp;
392 1.1 deraadt register int (*ctl)();
393 1.1 deraadt int error;
394 1.1 deraadt
395 1.13 deraadt if ( (unsigned)SCARG(uap, fd) >= fdp->fd_nfiles ||
396 1.13 deraadt (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL)
397 1.2 deraadt return EBADF;
398 1.2 deraadt
399 1.1 deraadt if ((fp->f_flag & (FREAD|FWRITE)) == 0)
400 1.2 deraadt return EBADF;
401 1.2 deraadt
402 1.1 deraadt ctl = fp->f_ops->fo_ioctl;
403 1.1 deraadt
404 1.13 deraadt switch (SCARG(uap, com)) {
405 1.1 deraadt case _IOR('t', 0, int):
406 1.13 deraadt SCARG(uap, com) = TIOCGETD;
407 1.1 deraadt break;
408 1.2 deraadt case _IOW('t', 1, int):
409 1.2 deraadt {
410 1.2 deraadt int disc;
411 1.1 deraadt
412 1.13 deraadt if ((error = copyin(SCARG(uap, data), (caddr_t)&disc,
413 1.2 deraadt sizeof disc)) != 0)
414 1.2 deraadt return error;
415 1.2 deraadt
416 1.2 deraadt /* map SunOS NTTYDISC into our termios discipline */
417 1.2 deraadt if (disc == 2)
418 1.2 deraadt disc = 0;
419 1.2 deraadt /* all other disciplines are not supported by NetBSD */
420 1.2 deraadt if (disc)
421 1.2 deraadt return ENXIO;
422 1.1 deraadt
423 1.2 deraadt return (*ctl)(fp, TIOCSETD, (caddr_t)&disc, p);
424 1.4 deraadt }
425 1.13 deraadt case _IOW('t', 101, int): /* sun SUNOS_TIOCSSOFTCAR */
426 1.4 deraadt {
427 1.4 deraadt int x; /* unused */
428 1.4 deraadt
429 1.13 deraadt return copyin((caddr_t)&x, SCARG(uap, data), sizeof x);
430 1.4 deraadt }
431 1.13 deraadt case _IOR('t', 100, int): /* sun SUNOS_TIOCSSOFTCAR */
432 1.4 deraadt {
433 1.4 deraadt int x = 0;
434 1.4 deraadt
435 1.13 deraadt return copyout((caddr_t)&x, SCARG(uap, data), sizeof x);
436 1.2 deraadt }
437 1.2 deraadt case _IO('t', 36): /* sun TIOCCONS, no parameters */
438 1.2 deraadt {
439 1.1 deraadt int on = 1;
440 1.2 deraadt return (*ctl)(fp, TIOCCONS, (caddr_t)&on, p);
441 1.1 deraadt }
442 1.13 deraadt case _IOW('t', 37, struct sunos_ttysize):
443 1.2 deraadt {
444 1.2 deraadt struct winsize ws;
445 1.13 deraadt struct sunos_ttysize ss;
446 1.1 deraadt
447 1.1 deraadt if ((error = (*ctl)(fp, TIOCGWINSZ, (caddr_t)&ws, p)) != 0)
448 1.1 deraadt return (error);
449 1.2 deraadt
450 1.13 deraadt if ((error = copyin (SCARG(uap, data), &ss, sizeof (ss))) != 0)
451 1.2 deraadt return error;
452 1.2 deraadt
453 1.2 deraadt ws.ws_row = ss.ts_row;
454 1.2 deraadt ws.ws_col = ss.ts_col;
455 1.2 deraadt
456 1.1 deraadt return ((*ctl)(fp, TIOCSWINSZ, (caddr_t)&ws, p));
457 1.1 deraadt }
458 1.13 deraadt case _IOW('t', 38, struct sunos_ttysize):
459 1.2 deraadt {
460 1.2 deraadt struct winsize ws;
461 1.13 deraadt struct sunos_ttysize ss;
462 1.1 deraadt
463 1.1 deraadt if ((error = (*ctl)(fp, TIOCGWINSZ, (caddr_t)&ws, p)) != 0)
464 1.1 deraadt return (error);
465 1.2 deraadt
466 1.2 deraadt ss.ts_row = ws.ws_row;
467 1.2 deraadt ss.ts_col = ws.ws_col;
468 1.2 deraadt
469 1.13 deraadt return copyout ((caddr_t)&ss, SCARG(uap, data), sizeof (ss));
470 1.1 deraadt }
471 1.9 pk case _IOW('t', 130, int):
472 1.13 deraadt SCARG(uap, com) = TIOCSPGRP;
473 1.1 deraadt break;
474 1.1 deraadt case _IOR('t', 131, int):
475 1.13 deraadt SCARG(uap, com) = TIOCGPGRP;
476 1.1 deraadt break;
477 1.1 deraadt case _IO('t', 132):
478 1.13 deraadt SCARG(uap, com) = TIOCSCTTY;
479 1.1 deraadt break;
480 1.13 deraadt case SUNOS_TCGETA:
481 1.13 deraadt case SUNOS_TCGETS:
482 1.2 deraadt {
483 1.2 deraadt struct termios bts;
484 1.13 deraadt struct sunos_termios sts;
485 1.13 deraadt struct sunos_termio st;
486 1.2 deraadt
487 1.2 deraadt if ((error = (*ctl)(fp, TIOCGETA, (caddr_t)&bts, p)) != 0)
488 1.2 deraadt return error;
489 1.2 deraadt
490 1.2 deraadt btios2stios (&bts, &sts);
491 1.13 deraadt if (SCARG(uap, com) == SUNOS_TCGETA) {
492 1.2 deraadt stios2stio (&sts, &st);
493 1.13 deraadt return copyout((caddr_t)&st, SCARG(uap, data),
494 1.13 deraadt sizeof (st));
495 1.2 deraadt } else
496 1.13 deraadt return copyout((caddr_t)&sts, SCARG(uap, data),
497 1.13 deraadt sizeof (sts));
498 1.2 deraadt /*NOTREACHED*/
499 1.2 deraadt }
500 1.13 deraadt case SUNOS_TCSETA:
501 1.13 deraadt case SUNOS_TCSETAW:
502 1.13 deraadt case SUNOS_TCSETAF:
503 1.2 deraadt {
504 1.2 deraadt struct termios bts;
505 1.13 deraadt struct sunos_termios sts;
506 1.13 deraadt struct sunos_termio st;
507 1.1 deraadt
508 1.13 deraadt if ((error = copyin(SCARG(uap, data), (caddr_t)&st,
509 1.2 deraadt sizeof (st))) != 0)
510 1.2 deraadt return error;
511 1.2 deraadt
512 1.2 deraadt /* get full BSD termios so we don't lose information */
513 1.2 deraadt if ((error = (*ctl)(fp, TIOCGETA, (caddr_t)&bts, p)) != 0)
514 1.2 deraadt return error;
515 1.2 deraadt
516 1.2 deraadt /*
517 1.2 deraadt * convert to sun termios, copy in information from
518 1.2 deraadt * termio, and convert back, then set new values.
519 1.2 deraadt */
520 1.2 deraadt btios2stios(&bts, &sts);
521 1.2 deraadt stio2stios(&st, &sts);
522 1.2 deraadt stios2btios(&sts, &bts);
523 1.1 deraadt
524 1.13 deraadt return (*ctl)(fp, SCARG(uap, com) - SUNOS_TCSETA + TIOCSETA,
525 1.2 deraadt (caddr_t)&bts, p);
526 1.2 deraadt }
527 1.13 deraadt case SUNOS_TCSETS:
528 1.13 deraadt case SUNOS_TCSETSW:
529 1.13 deraadt case SUNOS_TCSETSF:
530 1.2 deraadt {
531 1.2 deraadt struct termios bts;
532 1.13 deraadt struct sunos_termios sts;
533 1.2 deraadt
534 1.13 deraadt if ((error = copyin (SCARG(uap, data), (caddr_t)&sts,
535 1.2 deraadt sizeof (sts))) != 0)
536 1.2 deraadt return error;
537 1.2 deraadt stios2btios (&sts, &bts);
538 1.13 deraadt return (*ctl)(fp, SCARG(uap, com) - SUNOS_TCSETS + TIOCSETA,
539 1.2 deraadt (caddr_t)&bts, p);
540 1.6 deraadt }
541 1.6 deraadt /*
542 1.6 deraadt * Pseudo-tty ioctl translations.
543 1.6 deraadt */
544 1.9 pk case _IOW('t', 32, int): { /* TIOCTCNTL */
545 1.9 pk int error, on;
546 1.9 pk
547 1.13 deraadt if (error = copyin (SCARG(uap, data), (caddr_t)&on, sizeof (on)))
548 1.9 pk return error;
549 1.9 pk return (*ctl)(fp, TIOCUCNTL, (caddr_t)&on, p);
550 1.9 pk }
551 1.6 deraadt case _IOW('t', 33, int): { /* TIOCSIGNAL */
552 1.6 deraadt int error, sig;
553 1.6 deraadt
554 1.13 deraadt if (error = copyin (SCARG(uap, data), (caddr_t)&sig, sizeof (sig)))
555 1.6 deraadt return error;
556 1.7 deraadt return (*ctl)(fp, TIOCSIG, (caddr_t)&sig, p);
557 1.6 deraadt }
558 1.6 deraadt
559 1.6 deraadt /*
560 1.6 deraadt * Socket ioctl translations.
561 1.6 deraadt */
562 1.6 deraadt #define IFREQ_IN(a) { \
563 1.6 deraadt struct ifreq ifreq; \
564 1.13 deraadt if (error = copyin (SCARG(uap, data), (caddr_t)&ifreq, sizeof (ifreq))) \
565 1.6 deraadt return error; \
566 1.6 deraadt return (*ctl)(fp, a, (caddr_t)&ifreq, p); \
567 1.6 deraadt }
568 1.6 deraadt #define IFREQ_INOUT(a) { \
569 1.6 deraadt struct ifreq ifreq; \
570 1.13 deraadt if (error = copyin (SCARG(uap, data), (caddr_t)&ifreq, sizeof (ifreq))) \
571 1.6 deraadt return error; \
572 1.6 deraadt if (error = (*ctl)(fp, a, (caddr_t)&ifreq, p)) \
573 1.6 deraadt return error; \
574 1.13 deraadt return copyout ((caddr_t)&ifreq, SCARG(uap, data), sizeof (ifreq)); \
575 1.6 deraadt }
576 1.6 deraadt
577 1.6 deraadt case _IOW('i', 12, struct ifreq):
578 1.6 deraadt /* SIOCSIFADDR */
579 1.6 deraadt break;
580 1.6 deraadt
581 1.6 deraadt case _IOWR('i', 13, struct ifreq):
582 1.6 deraadt IFREQ_INOUT(OSIOCGIFADDR);
583 1.6 deraadt
584 1.6 deraadt case _IOW('i', 14, struct ifreq):
585 1.6 deraadt /* SIOCSIFDSTADDR */
586 1.6 deraadt break;
587 1.6 deraadt
588 1.6 deraadt case _IOWR('i', 15, struct ifreq):
589 1.6 deraadt IFREQ_INOUT(OSIOCGIFDSTADDR);
590 1.6 deraadt
591 1.6 deraadt case _IOW('i', 16, struct ifreq):
592 1.6 deraadt /* SIOCSIFFLAGS */
593 1.6 deraadt break;
594 1.6 deraadt
595 1.6 deraadt case _IOWR('i', 17, struct ifreq):
596 1.6 deraadt /* SIOCGIFFLAGS */
597 1.6 deraadt break;
598 1.6 deraadt
599 1.6 deraadt case _IOW('i', 21, struct ifreq):
600 1.6 deraadt IFREQ_IN(SIOCSIFMTU);
601 1.6 deraadt
602 1.6 deraadt case _IOWR('i', 22, struct ifreq):
603 1.6 deraadt IFREQ_INOUT(SIOCGIFMTU);
604 1.6 deraadt
605 1.6 deraadt case _IOWR('i', 23, struct ifreq):
606 1.6 deraadt IFREQ_INOUT(SIOCGIFBRDADDR);
607 1.6 deraadt
608 1.6 deraadt case _IOW('i', 24, struct ifreq):
609 1.6 deraadt IFREQ_IN(SIOCSIFBRDADDR);
610 1.6 deraadt
611 1.6 deraadt case _IOWR('i', 25, struct ifreq):
612 1.6 deraadt IFREQ_INOUT(OSIOCGIFNETMASK);
613 1.6 deraadt
614 1.6 deraadt case _IOW('i', 26, struct ifreq):
615 1.6 deraadt IFREQ_IN(SIOCSIFNETMASK);
616 1.6 deraadt
617 1.6 deraadt case _IOWR('i', 27, struct ifreq):
618 1.6 deraadt IFREQ_INOUT(SIOCGIFMETRIC);
619 1.6 deraadt
620 1.6 deraadt case _IOWR('i', 28, struct ifreq):
621 1.6 deraadt IFREQ_IN(SIOCSIFMETRIC);
622 1.6 deraadt
623 1.6 deraadt case _IOW('i', 30, struct arpreq):
624 1.6 deraadt /* SIOCSARP */
625 1.6 deraadt break;
626 1.6 deraadt
627 1.6 deraadt case _IOWR('i', 31, struct arpreq):
628 1.10 deraadt /* SIOCGARP */
629 1.10 deraadt break;
630 1.6 deraadt
631 1.6 deraadt case _IOW('i', 32, struct arpreq):
632 1.6 deraadt /* SIOCDARP */
633 1.6 deraadt break;
634 1.6 deraadt
635 1.6 deraadt case _IOW('i', 18, struct ifreq): /* SIOCSIFMEM */
636 1.6 deraadt case _IOWR('i', 19, struct ifreq): /* SIOCGIFMEM */
637 1.6 deraadt case _IOW('i', 40, struct ifreq): /* SIOCUPPER */
638 1.6 deraadt case _IOW('i', 41, struct ifreq): /* SIOCLOWER */
639 1.6 deraadt case _IOW('i', 44, struct ifreq): /* SIOCSETSYNC */
640 1.6 deraadt case _IOWR('i', 45, struct ifreq): /* SIOCGETSYNC */
641 1.6 deraadt case _IOWR('i', 46, struct ifreq): /* SIOCSDSTATS */
642 1.6 deraadt case _IOWR('i', 47, struct ifreq): /* SIOCSESTATS */
643 1.6 deraadt case _IOW('i', 48, int): /* SIOCSPROMISC */
644 1.6 deraadt case _IOW('i', 49, struct ifreq): /* SIOCADDMULTI */
645 1.6 deraadt case _IOW('i', 50, struct ifreq): /* SIOCDELMULTI */
646 1.6 deraadt return EOPNOTSUPP;
647 1.6 deraadt
648 1.6 deraadt case _IOWR('i', 20, struct ifconf): /* SIOCGIFCONF */
649 1.6 deraadt {
650 1.6 deraadt struct ifconf ifconf;
651 1.6 deraadt
652 1.6 deraadt /*
653 1.6 deraadt * XXX: two more problems
654 1.6 deraadt * 1. our sockaddr's are variable length, not always sizeof(sockaddr)
655 1.6 deraadt * 2. this returns a name per protocol, ie. it returns two "lo0"'s
656 1.6 deraadt */
657 1.13 deraadt if (error = copyin (SCARG(uap, data), (caddr_t)&ifconf,
658 1.13 deraadt sizeof (ifconf)))
659 1.6 deraadt return error;
660 1.6 deraadt if (error = (*ctl)(fp, OSIOCGIFCONF, (caddr_t)&ifconf, p))
661 1.6 deraadt return error;
662 1.13 deraadt return copyout ((caddr_t)&ifconf, SCARG(uap, data),
663 1.13 deraadt sizeof (ifconf));
664 1.16 pk }
665 1.16 pk
666 1.16 pk /*
667 1.16 pk * Audio ioctl translations.
668 1.16 pk */
669 1.16 pk case _IOR('A', 1, struct sunos_audio_info): /* AUDIO_GETINFO */
670 1.17 pk sunos_au_getinfo:
671 1.16 pk {
672 1.16 pk struct audio_info aui;
673 1.16 pk struct sunos_audio_info sunos_aui;
674 1.16 pk
675 1.16 pk if (error = (*ctl)(fp, AUDIO_GETINFO, (caddr_t)&aui, p))
676 1.16 pk return error;
677 1.16 pk
678 1.16 pk sunos_aui.play = *(struct sunos_audio_prinfo *)&aui.play;
679 1.16 pk sunos_aui.record = *(struct sunos_audio_prinfo *)&aui.record;
680 1.16 pk sunos_aui.monitor_gain = aui.__spare; /* XXX */
681 1.16 pk
682 1.16 pk /* `avail_ports' is `seek' in BSD */
683 1.16 pk #define AUDIO_SPEAKER 1
684 1.16 pk #define AUDIO_HEADPHONE 2
685 1.16 pk sunos_aui.play.avail_ports = AUDIO_SPEAKER | AUDIO_HEADPHONE;
686 1.16 pk sunos_aui.record.avail_ports = AUDIO_SPEAKER | AUDIO_HEADPHONE;
687 1.16 pk
688 1.16 pk sunos_aui.play.waiting = 0;
689 1.16 pk sunos_aui.record.waiting = 0;
690 1.16 pk sunos_aui.play.eof = 0;
691 1.16 pk sunos_aui.record.eof = 0;
692 1.16 pk
693 1.16 pk return copyout ((caddr_t)&sunos_aui, SCARG(uap, data),
694 1.16 pk sizeof (sunos_aui));
695 1.16 pk }
696 1.16 pk
697 1.16 pk case _IOWR('A', 2, struct sunos_audio_info): /* AUDIO_SETINFO */
698 1.16 pk {
699 1.16 pk struct audio_info aui;
700 1.16 pk struct sunos_audio_info sunos_aui;
701 1.16 pk
702 1.16 pk if (error = copyin (SCARG(uap, data), (caddr_t)&sunos_aui,
703 1.16 pk sizeof (sunos_aui)))
704 1.16 pk return error;
705 1.16 pk
706 1.16 pk aui.play = *(struct audio_prinfo *)&sunos_aui.play;
707 1.16 pk aui.record = *(struct audio_prinfo *)&sunos_aui.record;
708 1.16 pk aui.__spare = sunos_aui.monitor_gain;
709 1.16 pk aui.blocksize = ~0;
710 1.16 pk aui.hiwat = ~0;
711 1.16 pk aui.lowat = ~0;
712 1.16 pk aui.backlog = ~0;
713 1.16 pk /*
714 1.16 pk * The bsd driver does not distinguish between paused and
715 1.16 pk * active. (In the sun driver, not active means samples are
716 1.16 pk * not ouput at all, but paused means the last streams buffer
717 1.16 pk * is drained and then output stops.) If either are 0, then
718 1.16 pk * when stop output. Otherwise, if either are non-zero,
719 1.16 pk * we resume.
720 1.16 pk */
721 1.16 pk if (sunos_aui.play.pause == 0 || sunos_aui.play.active == 0)
722 1.16 pk aui.play.pause = 0;
723 1.16 pk else if (sunos_aui.play.pause != (u_char)~0 ||
724 1.16 pk sunos_aui.play.active != (u_char)~0)
725 1.16 pk aui.play.pause = 1;
726 1.16 pk if (sunos_aui.record.pause == 0 || sunos_aui.record.active == 0)
727 1.16 pk aui.record.pause = 0;
728 1.16 pk else if (sunos_aui.record.pause != (u_char)~0 ||
729 1.16 pk sunos_aui.record.active != (u_char)~0)
730 1.16 pk aui.record.pause = 1;
731 1.16 pk
732 1.17 pk if (error = (*ctl)(fp, AUDIO_SETINFO, (caddr_t)&aui, p))
733 1.17 pk return error;
734 1.17 pk /* Return new state */
735 1.17 pk goto sunos_au_getinfo;
736 1.16 pk }
737 1.16 pk case _IO('A', 3): /* AUDIO_DRAIN */
738 1.16 pk return (*ctl)(fp, AUDIO_DRAIN, (void *)0, p);
739 1.16 pk case _IOR('A', 4, int): /* AUDIO_GETDEV */
740 1.16 pk {
741 1.16 pk int devtype = SUNOS_AUDIO_DEV_AMD;
742 1.16 pk return copyout ((caddr_t)&devtype, SCARG(uap, data),
743 1.16 pk sizeof (devtype));
744 1.17 pk }
745 1.17 pk
746 1.17 pk /*
747 1.17 pk * Selected streams ioctls.
748 1.17 pk */
749 1.17 pk #define SUNOS_S_FLUSHR 1
750 1.17 pk #define SUNOS_S_FLUSHW 2
751 1.17 pk #define SUNOS_S_FLUSHRW 3
752 1.17 pk
753 1.17 pk #define SUNOS_S_INPUT 1
754 1.17 pk #define SUNOS_S_HIPRI 2
755 1.17 pk #define SUNOS_S_OUTPUT 4
756 1.17 pk #define SUNOS_S_MSG 8
757 1.17 pk
758 1.17 pk case _IO('S', 5): /* I_FLUSH */
759 1.17 pk {
760 1.17 pk int tmp = 0;
761 1.17 pk switch ((int)SCARG(uap, data)) {
762 1.17 pk case SUNOS_S_FLUSHR: tmp = FREAD;
763 1.17 pk case SUNOS_S_FLUSHW: tmp = FWRITE;
764 1.17 pk case SUNOS_S_FLUSHRW: tmp = FREAD|FWRITE;
765 1.17 pk }
766 1.17 pk return (*ctl)(fp, TIOCFLUSH, (caddr_t)&tmp, p);
767 1.17 pk }
768 1.17 pk case _IO('S', 9): /* I_SIGSET */
769 1.17 pk {
770 1.17 pk int on = 1;
771 1.17 pk if (((int)SCARG(uap, data) & (SUNOS_S_HIPRI|SUNOS_S_INPUT)) ==
772 1.17 pk SUNOS_S_HIPRI)
773 1.17 pk return EOPNOTSUPP;
774 1.17 pk return (*ctl)(fp, FIOASYNC, (caddr_t)&on, p);
775 1.1 deraadt }
776 1.1 deraadt }
777 1.1 deraadt return (ioctl(p, uap, retval));
778 1.1 deraadt }
779