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