linux_ioctl.c revision 1.7 1 1.7 thorpej /* $NetBSD: linux_ioctl.c,v 1.7 1995/09/19 22:37:30 thorpej Exp $ */
2 1.1 fvdl
3 1.1 fvdl /*
4 1.1 fvdl * Copyright (c) 1995 Frank van der Linden
5 1.1 fvdl * All rights reserved.
6 1.1 fvdl *
7 1.1 fvdl * Redistribution and use in source and binary forms, with or without
8 1.1 fvdl * modification, are permitted provided that the following conditions
9 1.1 fvdl * are met:
10 1.1 fvdl * 1. Redistributions of source code must retain the above copyright
11 1.1 fvdl * notice, this list of conditions and the following disclaimer.
12 1.1 fvdl * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 fvdl * notice, this list of conditions and the following disclaimer in the
14 1.1 fvdl * documentation and/or other materials provided with the distribution.
15 1.1 fvdl * 3. All advertising materials mentioning features or use of this software
16 1.1 fvdl * must display the following acknowledgement:
17 1.1 fvdl * This product includes software developed for the NetBSD Project
18 1.1 fvdl * by Frank van der Linden
19 1.1 fvdl * 4. The name of the author may not be used to endorse or promote products
20 1.1 fvdl * derived from this software without specific prior written permission
21 1.1 fvdl *
22 1.1 fvdl * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 1.1 fvdl * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 1.1 fvdl * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 1.1 fvdl * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 1.1 fvdl * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 1.1 fvdl * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 1.1 fvdl * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 1.1 fvdl * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 1.1 fvdl * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 1.1 fvdl * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 1.1 fvdl */
33 1.1 fvdl
34 1.1 fvdl #include <sys/param.h>
35 1.1 fvdl #include <sys/proc.h>
36 1.1 fvdl #include <sys/systm.h>
37 1.1 fvdl #include <sys/file.h>
38 1.1 fvdl #include <sys/filedesc.h>
39 1.1 fvdl #include <sys/ioctl.h>
40 1.1 fvdl #include <sys/termios.h>
41 1.1 fvdl #include <sys/tty.h>
42 1.1 fvdl #include <sys/socket.h>
43 1.1 fvdl #include <sys/ioctl.h>
44 1.1 fvdl #include <sys/mount.h>
45 1.2 fvdl #include <net/if.h>
46 1.2 fvdl #include <sys/sockio.h>
47 1.1 fvdl
48 1.1 fvdl #include <sys/syscallargs.h>
49 1.4 mycroft
50 1.1 fvdl #include <compat/linux/linux_types.h>
51 1.1 fvdl #include <compat/linux/linux_ioctl.h>
52 1.2 fvdl #include <compat/linux/linux_sockio.h>
53 1.1 fvdl #include <compat/linux/linux_util.h>
54 1.4 mycroft #include <compat/linux/linux_signal.h>
55 1.1 fvdl #include <compat/linux/linux_syscallargs.h>
56 1.1 fvdl
57 1.1 fvdl static speed_t linux_speeds[] = {
58 1.1 fvdl 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
59 1.1 fvdl 9600, 19200, 38400, 57600, 115200
60 1.1 fvdl };
61 1.1 fvdl
62 1.1 fvdl static int linux_spmasks[] = {
63 1.1 fvdl LINUX_B0, LINUX_B50, LINUX_B75, LINUX_B110, LINUX_B134, LINUX_B150,
64 1.1 fvdl LINUX_B200, LINUX_B300, LINUX_B600, LINUX_B1200, LINUX_B1800,
65 1.1 fvdl LINUX_B2400, LINUX_B4800, LINUX_B9600, LINUX_B19200, LINUX_B38400,
66 1.5 mycroft LINUX_B57600, LINUX_B115200, LINUX_B230400
67 1.1 fvdl };
68 1.1 fvdl
69 1.1 fvdl /*
70 1.1 fvdl * Deal with termio ioctl cruft. This doesn't look very good..
71 1.1 fvdl * XXX too much code duplication, obviously..
72 1.1 fvdl *
73 1.1 fvdl * The conversion routines between Linux and BSD structures assume
74 1.1 fvdl * that the fields are already filled with the current values,
75 1.1 fvdl * so that fields present in BSD but not in Linux keep their current
76 1.1 fvdl * values.
77 1.1 fvdl */
78 1.1 fvdl
79 1.1 fvdl static int
80 1.1 fvdl linux_termio_to_bsd_termios(lt, bts)
81 1.1 fvdl register struct linux_termio *lt;
82 1.1 fvdl register struct termios *bts;
83 1.1 fvdl {
84 1.1 fvdl int index;
85 1.1 fvdl
86 1.1 fvdl bts->c_iflag = 0;
87 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_IGNBRK, IGNBRK);
88 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_BRKINT, BRKINT);
89 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_IGNPAR, IGNPAR);
90 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_INPCK, INPCK);
91 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_ISTRIP, ISTRIP);
92 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_INLCR, INLCR);
93 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_IGNCR, IGNCR);
94 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_ICRNL, ICRNL);
95 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_IXON, IXON);
96 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_IXANY, IXANY);
97 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_IXOFF, IXOFF);
98 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lt->c_iflag, LINUX_IMAXBEL, IMAXBEL);
99 1.1 fvdl
100 1.1 fvdl bts->c_oflag = 0;
101 1.1 fvdl bts->c_oflag |= cvtto_bsd_mask(lt->c_oflag, LINUX_OPOST, OPOST);
102 1.1 fvdl bts->c_oflag |= cvtto_bsd_mask(lt->c_oflag, LINUX_ONLCR, ONLCR);
103 1.1 fvdl bts->c_oflag |= cvtto_bsd_mask(lt->c_oflag, LINUX_XTABS, OXTABS);
104 1.1 fvdl
105 1.1 fvdl /*
106 1.1 fvdl * This could have been:
107 1.1 fvdl * bts->c_cflag = (lt->c_flag & LINUX_CSIZE) << 4
108 1.1 fvdl * But who knows, those values might perhaps change one day.
109 1.1 fvdl */
110 1.1 fvdl switch (lt->c_cflag & LINUX_CSIZE) {
111 1.1 fvdl case LINUX_CS5:
112 1.1 fvdl bts->c_cflag = CS5;
113 1.1 fvdl break;
114 1.1 fvdl case LINUX_CS6:
115 1.1 fvdl bts->c_cflag = CS6;
116 1.1 fvdl break;
117 1.1 fvdl case LINUX_CS7:
118 1.1 fvdl bts->c_cflag = CS7;
119 1.1 fvdl break;
120 1.1 fvdl case LINUX_CS8:
121 1.1 fvdl bts->c_cflag = CS8;
122 1.1 fvdl break;
123 1.1 fvdl }
124 1.1 fvdl
125 1.1 fvdl bts->c_cflag |= cvtto_bsd_mask(lt->c_cflag, LINUX_CSTOPB, CSTOPB);
126 1.1 fvdl bts->c_cflag |= cvtto_bsd_mask(lt->c_cflag, LINUX_CREAD, CREAD);
127 1.1 fvdl bts->c_cflag |= cvtto_bsd_mask(lt->c_cflag, LINUX_PARENB, PARENB);
128 1.1 fvdl bts->c_cflag |= cvtto_bsd_mask(lt->c_cflag, LINUX_PARODD, PARODD);
129 1.1 fvdl bts->c_cflag |= cvtto_bsd_mask(lt->c_cflag, LINUX_HUPCL, HUPCL);
130 1.1 fvdl bts->c_cflag |= cvtto_bsd_mask(lt->c_cflag, LINUX_CLOCAL, CLOCAL);
131 1.1 fvdl bts->c_cflag |= cvtto_bsd_mask(lt->c_cflag, LINUX_CRTSCTS, CRTSCTS);
132 1.1 fvdl
133 1.1 fvdl bts->c_lflag = 0;
134 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_ISIG, ISIG);
135 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_ICANON, ICANON);
136 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_ECHO, ECHO);
137 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_ECHOE, ECHOE);
138 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_ECHOK, ECHOK);
139 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_ECHONL, ECHONL);
140 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_NOFLSH, NOFLSH);
141 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_TOSTOP, TOSTOP);
142 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_ECHOCTL, ECHOCTL);
143 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_ECHOPRT, ECHOPRT);
144 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_ECHOKE, ECHOKE);
145 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_FLUSHO, FLUSHO);
146 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_PENDIN, PENDIN);
147 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lt->c_lflag, LINUX_IEXTEN, IEXTEN);
148 1.1 fvdl
149 1.1 fvdl index = lt->c_cflag & LINUX_CBAUD;
150 1.1 fvdl if (index & LINUX_CBAUDEX)
151 1.1 fvdl index = (index & ~LINUX_CBAUDEX) + LINUX_NSPEEDS - 1;
152 1.1 fvdl bts->c_ispeed = bts->c_ospeed = linux_speeds[index];
153 1.1 fvdl
154 1.1 fvdl bts->c_cc[VINTR] = lt->c_cc[LINUX_VINTR];
155 1.1 fvdl bts->c_cc[VQUIT] = lt->c_cc[LINUX_VQUIT];
156 1.1 fvdl bts->c_cc[VERASE] = lt->c_cc[LINUX_VERASE];
157 1.1 fvdl bts->c_cc[VKILL] = lt->c_cc[LINUX_VKILL];
158 1.1 fvdl bts->c_cc[VEOF] = lt->c_cc[LINUX_VEOF];
159 1.1 fvdl bts->c_cc[VTIME] = lt->c_cc[LINUX_VTIME];
160 1.1 fvdl bts->c_cc[VMIN] = lt->c_cc[LINUX_VMIN];
161 1.1 fvdl }
162 1.1 fvdl
163 1.1 fvdl static int
164 1.1 fvdl bsd_termios_to_linux_termio(bts, lt)
165 1.1 fvdl register struct termios *bts;
166 1.1 fvdl register struct linux_termio *lt;
167 1.1 fvdl {
168 1.1 fvdl int i, mask;
169 1.1 fvdl
170 1.1 fvdl lt->c_iflag = 0;
171 1.1 fvdl lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, IGNBRK, LINUX_IGNBRK);
172 1.1 fvdl lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, BRKINT, LINUX_BRKINT);
173 1.1 fvdl lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, IGNPAR, LINUX_IGNPAR);
174 1.1 fvdl lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, INPCK, LINUX_INPCK);
175 1.1 fvdl lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, ISTRIP, LINUX_ISTRIP);
176 1.1 fvdl lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, INLCR, LINUX_INLCR);
177 1.1 fvdl lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, IGNCR, LINUX_IGNCR);
178 1.1 fvdl lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, ICRNL, LINUX_ICRNL);
179 1.1 fvdl lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, IXON, LINUX_IXON);
180 1.1 fvdl lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, IXANY, LINUX_IXANY);
181 1.1 fvdl lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, IXOFF, LINUX_IXOFF);
182 1.1 fvdl lt->c_iflag |= cvtto_linux_mask(bts->c_iflag, IMAXBEL, LINUX_IMAXBEL);
183 1.1 fvdl
184 1.1 fvdl lt->c_oflag = 0;
185 1.1 fvdl lt->c_oflag |= cvtto_linux_mask(bts->c_oflag, OPOST, LINUX_OPOST);
186 1.1 fvdl lt->c_oflag |= cvtto_linux_mask(bts->c_oflag, ONLCR, LINUX_ONLCR);
187 1.1 fvdl lt->c_oflag |= cvtto_linux_mask(bts->c_oflag, OXTABS, LINUX_XTABS);
188 1.1 fvdl
189 1.1 fvdl switch (bts->c_cflag & CSIZE) {
190 1.1 fvdl case CS5:
191 1.1 fvdl lt->c_cflag = LINUX_CS5;
192 1.1 fvdl break;
193 1.1 fvdl case CS6:
194 1.1 fvdl lt->c_cflag = LINUX_CS6;
195 1.1 fvdl break;
196 1.1 fvdl case CS7:
197 1.1 fvdl lt->c_cflag = LINUX_CS7;
198 1.1 fvdl break;
199 1.1 fvdl case CS8:
200 1.1 fvdl lt->c_cflag = LINUX_CS8;
201 1.1 fvdl break;
202 1.1 fvdl }
203 1.1 fvdl lt->c_cflag |= cvtto_linux_mask(bts->c_cflag, CSTOPB, LINUX_CSTOPB);
204 1.1 fvdl lt->c_cflag |= cvtto_linux_mask(bts->c_cflag, CREAD, LINUX_CREAD);
205 1.1 fvdl lt->c_cflag |= cvtto_linux_mask(bts->c_cflag, PARENB, LINUX_PARENB);
206 1.1 fvdl lt->c_cflag |= cvtto_linux_mask(bts->c_cflag, PARODD, LINUX_PARODD);
207 1.1 fvdl lt->c_cflag |= cvtto_linux_mask(bts->c_cflag, HUPCL, LINUX_HUPCL);
208 1.1 fvdl lt->c_cflag |= cvtto_linux_mask(bts->c_cflag, CLOCAL, LINUX_CLOCAL);
209 1.1 fvdl lt->c_cflag |= cvtto_linux_mask(bts->c_cflag, CRTSCTS, LINUX_CRTSCTS);
210 1.1 fvdl
211 1.1 fvdl lt->c_lflag = 0;
212 1.1 fvdl lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, ISIG, LINUX_ISIG);
213 1.1 fvdl lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, ICANON, LINUX_ICANON);
214 1.1 fvdl lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHO, LINUX_ECHO);
215 1.1 fvdl lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHOE, LINUX_ECHOE);
216 1.1 fvdl lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHOK, LINUX_ECHOK);
217 1.1 fvdl lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHONL, LINUX_ECHONL);
218 1.1 fvdl lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, NOFLSH, LINUX_NOFLSH);
219 1.1 fvdl lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, TOSTOP, LINUX_TOSTOP);
220 1.1 fvdl lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHOCTL, LINUX_ECHOCTL);
221 1.1 fvdl lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHOPRT, LINUX_ECHOPRT);
222 1.1 fvdl lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHOKE, LINUX_ECHOKE);
223 1.1 fvdl lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, FLUSHO, LINUX_FLUSHO);
224 1.1 fvdl lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, PENDIN, LINUX_PENDIN);
225 1.1 fvdl lt->c_lflag |= cvtto_linux_mask(bts->c_lflag, IEXTEN, LINUX_IEXTEN);
226 1.1 fvdl
227 1.1 fvdl mask = LINUX_B9600; /* XXX default value should this be 0? */
228 1.1 fvdl for (i = 0; i < sizeof (linux_speeds) / sizeof (speed_t); i++) {
229 1.1 fvdl if (bts->c_ospeed == linux_speeds[i]) {
230 1.1 fvdl mask = linux_spmasks[i];
231 1.1 fvdl break;
232 1.1 fvdl }
233 1.1 fvdl }
234 1.1 fvdl lt->c_cflag |= mask;
235 1.1 fvdl
236 1.1 fvdl lt->c_cc[LINUX_VINTR] = bts->c_cc[VINTR];
237 1.1 fvdl lt->c_cc[LINUX_VQUIT] = bts->c_cc[VQUIT];
238 1.1 fvdl lt->c_cc[LINUX_VERASE] = bts->c_cc[VERASE];
239 1.1 fvdl lt->c_cc[LINUX_VKILL] = bts->c_cc[VKILL];
240 1.1 fvdl lt->c_cc[LINUX_VEOF] = bts->c_cc[VEOF];
241 1.1 fvdl lt->c_cc[LINUX_VTIME] = bts->c_cc[VTIME];
242 1.1 fvdl lt->c_cc[LINUX_VMIN] = bts->c_cc[VMIN];
243 1.1 fvdl lt->c_cc[LINUX_VSWTC] = 0;
244 1.1 fvdl
245 1.1 fvdl /* XXX should be fixed someday */
246 1.1 fvdl lt->c_line = 0;
247 1.1 fvdl }
248 1.1 fvdl
249 1.1 fvdl static int
250 1.1 fvdl linux_termios_to_bsd_termios(lts, bts)
251 1.1 fvdl register struct linux_termios *lts;
252 1.1 fvdl register struct termios *bts;
253 1.1 fvdl {
254 1.1 fvdl int index;
255 1.1 fvdl
256 1.1 fvdl bts->c_iflag = 0;
257 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_IGNBRK, IGNBRK);
258 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_BRKINT, BRKINT);
259 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_IGNPAR, IGNPAR);
260 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_INPCK, INPCK);
261 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_ISTRIP, ISTRIP);
262 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_INLCR, INLCR);
263 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_IGNCR, IGNCR);
264 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_ICRNL, ICRNL);
265 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_IXON, IXON);
266 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_IXANY, IXANY);
267 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_IXOFF, IXOFF);
268 1.1 fvdl bts->c_iflag |= cvtto_bsd_mask(lts->c_iflag, LINUX_IMAXBEL, IMAXBEL);
269 1.1 fvdl
270 1.1 fvdl bts->c_oflag = 0;
271 1.1 fvdl bts->c_oflag |= cvtto_bsd_mask(lts->c_oflag, LINUX_OPOST, OPOST);
272 1.1 fvdl bts->c_oflag |= cvtto_bsd_mask(lts->c_oflag, LINUX_ONLCR, ONLCR);
273 1.1 fvdl bts->c_oflag |= cvtto_bsd_mask(lts->c_oflag, LINUX_XTABS, OXTABS);
274 1.1 fvdl
275 1.1 fvdl bts->c_cflag = 0;
276 1.1 fvdl switch (lts->c_cflag & LINUX_CSIZE) {
277 1.1 fvdl case LINUX_CS5:
278 1.1 fvdl bts->c_cflag = CS5;
279 1.1 fvdl break;
280 1.1 fvdl case LINUX_CS6:
281 1.1 fvdl bts->c_cflag = CS6;
282 1.1 fvdl break;
283 1.1 fvdl case LINUX_CS7:
284 1.1 fvdl bts->c_cflag = CS7;
285 1.1 fvdl break;
286 1.1 fvdl case LINUX_CS8:
287 1.1 fvdl bts->c_cflag = CS8;
288 1.1 fvdl break;
289 1.1 fvdl }
290 1.1 fvdl bts->c_cflag |= cvtto_bsd_mask(lts->c_cflag, LINUX_CSTOPB, CSTOPB);
291 1.1 fvdl bts->c_cflag |= cvtto_bsd_mask(lts->c_cflag, LINUX_CREAD, CREAD);
292 1.1 fvdl bts->c_cflag |= cvtto_bsd_mask(lts->c_cflag, LINUX_PARENB, PARENB);
293 1.1 fvdl bts->c_cflag |= cvtto_bsd_mask(lts->c_cflag, LINUX_PARODD, PARODD);
294 1.1 fvdl bts->c_cflag |= cvtto_bsd_mask(lts->c_cflag, LINUX_HUPCL, HUPCL);
295 1.1 fvdl bts->c_cflag |= cvtto_bsd_mask(lts->c_cflag, LINUX_CLOCAL, CLOCAL);
296 1.1 fvdl bts->c_cflag |= cvtto_bsd_mask(lts->c_cflag, LINUX_CRTSCTS, CRTSCTS);
297 1.1 fvdl
298 1.1 fvdl bts->c_lflag = 0;
299 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_ISIG, ISIG);
300 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_ICANON, ICANON);
301 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_ECHO, ECHO);
302 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_ECHOE, ECHOE);
303 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_ECHOK, ECHOK);
304 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_ECHONL, ECHONL);
305 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_NOFLSH, NOFLSH);
306 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_TOSTOP, TOSTOP);
307 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_ECHOCTL, ECHOCTL);
308 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_ECHOPRT, ECHOPRT);
309 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_ECHOKE, ECHOKE);
310 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_FLUSHO, FLUSHO);
311 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_PENDIN, PENDIN);
312 1.1 fvdl bts->c_lflag |= cvtto_bsd_mask(lts->c_lflag, LINUX_IEXTEN, IEXTEN);
313 1.1 fvdl
314 1.1 fvdl index = lts->c_cflag & LINUX_CBAUD;
315 1.1 fvdl if (index & LINUX_CBAUDEX)
316 1.1 fvdl index = (index & ~LINUX_CBAUDEX) + LINUX_NSPEEDS - 1;
317 1.1 fvdl bts->c_ispeed = bts->c_ospeed = linux_speeds[index];
318 1.1 fvdl
319 1.1 fvdl bts->c_cc[VINTR] = lts->c_cc[LINUX_VINTR];
320 1.1 fvdl bts->c_cc[VQUIT] = lts->c_cc[LINUX_VQUIT];
321 1.1 fvdl bts->c_cc[VERASE] = lts->c_cc[LINUX_VERASE];
322 1.1 fvdl bts->c_cc[VKILL] = lts->c_cc[LINUX_VKILL];
323 1.1 fvdl bts->c_cc[VEOF] = lts->c_cc[LINUX_VEOF];
324 1.1 fvdl bts->c_cc[VTIME] = lts->c_cc[LINUX_VTIME];
325 1.1 fvdl bts->c_cc[VMIN] = lts->c_cc[LINUX_VMIN];
326 1.1 fvdl bts->c_cc[VEOL] = lts->c_cc[LINUX_VEOL];
327 1.1 fvdl bts->c_cc[VEOL2] = lts->c_cc[LINUX_VEOL2];
328 1.1 fvdl bts->c_cc[VWERASE] = lts->c_cc[LINUX_VWERASE];
329 1.1 fvdl bts->c_cc[VSUSP] = lts->c_cc[LINUX_VSUSP];
330 1.1 fvdl bts->c_cc[VSTART] = lts->c_cc[LINUX_VSTART];
331 1.1 fvdl bts->c_cc[VSTOP] = lts->c_cc[LINUX_VSTOP];
332 1.1 fvdl bts->c_cc[VLNEXT] = lts->c_cc[LINUX_VLNEXT];
333 1.1 fvdl bts->c_cc[VDISCARD] = lts->c_cc[LINUX_VDISCARD];
334 1.1 fvdl bts->c_cc[VREPRINT] = lts->c_cc[LINUX_VREPRINT];
335 1.1 fvdl }
336 1.1 fvdl
337 1.1 fvdl static int
338 1.1 fvdl bsd_termios_to_linux_termios(bts, lts)
339 1.1 fvdl register struct termios *bts;
340 1.1 fvdl register struct linux_termios *lts;
341 1.1 fvdl {
342 1.1 fvdl int i, mask;
343 1.1 fvdl
344 1.1 fvdl lts->c_iflag = 0;
345 1.1 fvdl lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, IGNBRK, LINUX_IGNBRK);
346 1.1 fvdl lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, BRKINT, LINUX_BRKINT);
347 1.1 fvdl lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, IGNPAR, LINUX_IGNPAR);
348 1.1 fvdl lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, INPCK, LINUX_INPCK);
349 1.1 fvdl lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, ISTRIP, LINUX_ISTRIP);
350 1.1 fvdl lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, INLCR, LINUX_INLCR);
351 1.1 fvdl lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, IGNCR, LINUX_IGNCR);
352 1.1 fvdl lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, ICRNL, LINUX_ICRNL);
353 1.1 fvdl lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, IXON, LINUX_IXON);
354 1.1 fvdl lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, IXANY, LINUX_IXANY);
355 1.1 fvdl lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, IXOFF, LINUX_IXOFF);
356 1.1 fvdl lts->c_iflag |= cvtto_linux_mask(bts->c_iflag, IMAXBEL, LINUX_IMAXBEL);
357 1.1 fvdl
358 1.1 fvdl lts->c_oflag = 0;
359 1.1 fvdl lts->c_oflag |= cvtto_linux_mask(bts->c_oflag, OPOST, LINUX_OPOST);
360 1.1 fvdl lts->c_oflag |= cvtto_linux_mask(bts->c_oflag, ONLCR, LINUX_ONLCR);
361 1.1 fvdl lts->c_oflag |= cvtto_linux_mask(bts->c_oflag, OXTABS, LINUX_XTABS);
362 1.1 fvdl
363 1.1 fvdl switch (bts->c_cflag & CSIZE) {
364 1.1 fvdl case CS5:
365 1.1 fvdl lts->c_cflag = LINUX_CS5;
366 1.1 fvdl break;
367 1.1 fvdl case CS6:
368 1.1 fvdl lts->c_cflag = LINUX_CS6;
369 1.1 fvdl break;
370 1.1 fvdl case CS7:
371 1.1 fvdl lts->c_cflag = LINUX_CS7;
372 1.1 fvdl break;
373 1.1 fvdl case CS8:
374 1.1 fvdl lts->c_cflag = LINUX_CS8;
375 1.1 fvdl break;
376 1.1 fvdl }
377 1.1 fvdl lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, CS5, LINUX_CS5);
378 1.1 fvdl lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, CS6, LINUX_CS6);
379 1.1 fvdl lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, CS7, LINUX_CS7);
380 1.1 fvdl lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, CS8, LINUX_CS8);
381 1.1 fvdl lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, CSTOPB, LINUX_CSTOPB);
382 1.1 fvdl lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, CREAD, LINUX_CREAD);
383 1.1 fvdl lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, PARENB, LINUX_PARENB);
384 1.1 fvdl lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, PARODD, LINUX_PARODD);
385 1.1 fvdl lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, HUPCL, LINUX_HUPCL);
386 1.1 fvdl lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, CLOCAL, LINUX_CLOCAL);
387 1.1 fvdl lts->c_cflag |= cvtto_linux_mask(bts->c_cflag, CRTSCTS, LINUX_CRTSCTS);
388 1.1 fvdl
389 1.1 fvdl lts->c_lflag = 0;
390 1.1 fvdl lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, ISIG, LINUX_ISIG);
391 1.1 fvdl lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, ICANON, LINUX_ICANON);
392 1.1 fvdl lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHO, LINUX_ECHO);
393 1.1 fvdl lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHOE, LINUX_ECHOE);
394 1.1 fvdl lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHOK, LINUX_ECHOK);
395 1.1 fvdl lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHONL, LINUX_ECHONL);
396 1.1 fvdl lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, NOFLSH, LINUX_NOFLSH);
397 1.1 fvdl lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, TOSTOP, LINUX_TOSTOP);
398 1.1 fvdl lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHOCTL, LINUX_ECHOCTL);
399 1.1 fvdl lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHOPRT, LINUX_ECHOPRT);
400 1.1 fvdl lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, ECHOKE, LINUX_ECHOKE);
401 1.1 fvdl lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, FLUSHO, LINUX_FLUSHO);
402 1.1 fvdl lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, PENDIN, LINUX_PENDIN);
403 1.1 fvdl lts->c_lflag |= cvtto_linux_mask(bts->c_lflag, IEXTEN, LINUX_IEXTEN);
404 1.1 fvdl
405 1.1 fvdl mask = LINUX_B9600; /* XXX default value */
406 1.1 fvdl for (i = 0; i < sizeof (linux_speeds) / sizeof (speed_t); i++) {
407 1.1 fvdl if (bts->c_ospeed == linux_speeds[i]) {
408 1.1 fvdl mask = linux_spmasks[i];
409 1.1 fvdl break;
410 1.1 fvdl }
411 1.1 fvdl }
412 1.1 fvdl lts->c_cflag |= mask;
413 1.1 fvdl
414 1.1 fvdl lts->c_cc[LINUX_VINTR] = bts->c_cc[VINTR];
415 1.1 fvdl lts->c_cc[LINUX_VQUIT] = bts->c_cc[VQUIT];
416 1.1 fvdl lts->c_cc[LINUX_VERASE] = bts->c_cc[VERASE];
417 1.1 fvdl lts->c_cc[LINUX_VKILL] = bts->c_cc[VKILL];
418 1.1 fvdl lts->c_cc[LINUX_VEOF] = bts->c_cc[VEOF];
419 1.1 fvdl lts->c_cc[LINUX_VTIME] = bts->c_cc[VTIME];
420 1.1 fvdl lts->c_cc[LINUX_VMIN] = bts->c_cc[VMIN];
421 1.1 fvdl lts->c_cc[LINUX_VEOL] = bts->c_cc[VEOL];
422 1.1 fvdl lts->c_cc[LINUX_VEOL2] = bts->c_cc[VEOL2];
423 1.1 fvdl lts->c_cc[LINUX_VWERASE] = bts->c_cc[VWERASE];
424 1.1 fvdl lts->c_cc[LINUX_VSUSP] = bts->c_cc[VSUSP];
425 1.1 fvdl lts->c_cc[LINUX_VSTART] = bts->c_cc[VSTART];
426 1.1 fvdl lts->c_cc[LINUX_VSTOP] = bts->c_cc[VSTOP];
427 1.1 fvdl lts->c_cc[LINUX_VLNEXT] = bts->c_cc[VLNEXT];
428 1.1 fvdl lts->c_cc[LINUX_VDISCARD] = bts->c_cc[VDISCARD];
429 1.1 fvdl lts->c_cc[LINUX_VREPRINT] = bts->c_cc[VREPRINT];
430 1.1 fvdl lts->c_cc[LINUX_VSWTC] = 0;
431 1.1 fvdl
432 1.1 fvdl /* XXX should be fixed someday */
433 1.1 fvdl lts->c_line = 0;
434 1.1 fvdl }
435 1.1 fvdl
436 1.1 fvdl /*
437 1.1 fvdl * Most ioctl command are just converted to their NetBSD values,
438 1.1 fvdl * and passed on. The ones that take structure pointers and (flag)
439 1.1 fvdl * values need some massaging. This is done the usual way by
440 1.1 fvdl * allocating stackgap memory, letting the actual ioctl call do its
441 1.1 fvdl * work their and converting back the data afterwards.
442 1.1 fvdl */
443 1.1 fvdl int
444 1.7 thorpej linux_ioctl(p, v, retval)
445 1.1 fvdl register struct proc *p;
446 1.7 thorpej void *v;
447 1.7 thorpej register_t *retval;
448 1.7 thorpej {
449 1.1 fvdl register struct linux_ioctl_args /* {
450 1.1 fvdl syscallarg(int) fd;
451 1.1 fvdl syscallarg(u_long) com;
452 1.1 fvdl syscallarg(caddr_t) data;
453 1.7 thorpej } */ *uap = v;
454 1.1 fvdl int fd;
455 1.1 fvdl unsigned long com;
456 1.1 fvdl caddr_t data, sg;
457 1.1 fvdl struct file *fp;
458 1.1 fvdl struct filedesc *fdp;
459 1.1 fvdl struct linux_termio tmplt, *alt;
460 1.1 fvdl struct linux_termios tmplts, *alts;
461 1.1 fvdl struct termios tmpbts, *abts;
462 1.1 fvdl struct ioctl_args ia;
463 1.1 fvdl int error, idat, *idatp;
464 1.1 fvdl
465 1.1 fvdl fd = SCARG(&ia, fd) = SCARG(uap, fd);
466 1.1 fvdl com = SCARG(uap, com);
467 1.1 fvdl data = SCARG(&ia, data) = SCARG(uap, data);
468 1.1 fvdl retval[0] = 0;
469 1.1 fvdl
470 1.1 fvdl fdp = p->p_fd;
471 1.1 fvdl if ((u_int)fd >= fdp->fd_nfiles ||
472 1.1 fvdl (fp = fdp->fd_ofiles[fd]) == NULL)
473 1.1 fvdl return (EBADF);
474 1.1 fvdl
475 1.1 fvdl if ((fp->f_flag & (FREAD | FWRITE)) == 0)
476 1.1 fvdl return (EBADF);
477 1.1 fvdl
478 1.3 christos sg = stackgap_init(p->p_emul);
479 1.1 fvdl
480 1.1 fvdl switch (com) {
481 1.1 fvdl case LINUX_TCGETS:
482 1.1 fvdl SCARG(&ia, com) = TIOCGETA;
483 1.1 fvdl abts = stackgap_alloc(&sg, sizeof (*abts));
484 1.1 fvdl SCARG(&ia, data) = (caddr_t) abts;
485 1.1 fvdl if ((error = ioctl(p, &ia, retval)) != 0)
486 1.1 fvdl return error;
487 1.1 fvdl if ((error = copyin(abts, &tmpbts, sizeof tmpbts)))
488 1.1 fvdl return error;
489 1.1 fvdl bsd_termios_to_linux_termios(&tmpbts, &tmplts);
490 1.1 fvdl return copyout(&tmplts, data, sizeof tmplts);
491 1.1 fvdl case LINUX_TCSETS:
492 1.1 fvdl case LINUX_TCSETSW:
493 1.1 fvdl case LINUX_TCSETSF:
494 1.1 fvdl switch (com) {
495 1.1 fvdl case LINUX_TCSETS:
496 1.1 fvdl SCARG(&ia, com) = TIOCSETA;
497 1.1 fvdl break;
498 1.1 fvdl case LINUX_TCSETSW:
499 1.1 fvdl SCARG(&ia, com) = TIOCSETAW;
500 1.1 fvdl break;
501 1.1 fvdl case LINUX_TCSETSF:
502 1.1 fvdl SCARG(&ia, com) = TIOCSETAF;
503 1.1 fvdl break;
504 1.1 fvdl }
505 1.1 fvdl if ((error = copyin(data, &tmplts, sizeof tmplts)))
506 1.1 fvdl return error;
507 1.1 fvdl abts = stackgap_alloc(&sg, sizeof tmpbts);
508 1.1 fvdl /*
509 1.1 fvdl * First fill in all fields, so that we keep the current
510 1.1 fvdl * values for fields that Linux doesn't know about.
511 1.1 fvdl */
512 1.1 fvdl if ((error = (*fp->f_ops->fo_ioctl)(fp, TIOCGETA,
513 1.1 fvdl (caddr_t) &tmpbts, p)))
514 1.1 fvdl return error;
515 1.1 fvdl linux_termios_to_bsd_termios(&tmplts, &tmpbts);
516 1.1 fvdl if ((error = copyout(&tmpbts, abts, sizeof tmpbts)))
517 1.1 fvdl return error;
518 1.1 fvdl SCARG(&ia, data) = (caddr_t) abts;
519 1.1 fvdl return ioctl(p, &ia, retval);
520 1.1 fvdl case LINUX_TCGETA:
521 1.1 fvdl SCARG(&ia, com) = TIOCGETA;
522 1.1 fvdl abts = stackgap_alloc(&sg, sizeof (*abts));
523 1.1 fvdl SCARG(&ia, data) = (caddr_t) abts;
524 1.1 fvdl if ((error = ioctl(p, &ia, retval)) != 0)
525 1.1 fvdl return error;
526 1.1 fvdl if ((error = copyin(abts, &tmpbts, sizeof tmpbts)))
527 1.1 fvdl return error;
528 1.1 fvdl bsd_termios_to_linux_termio(&tmpbts, &tmplt);
529 1.1 fvdl return copyout(&tmplt, data, sizeof tmplt);
530 1.1 fvdl case LINUX_TCSETA:
531 1.1 fvdl case LINUX_TCSETAW:
532 1.1 fvdl case LINUX_TCSETAF:
533 1.1 fvdl switch (com) {
534 1.1 fvdl case LINUX_TCSETA:
535 1.1 fvdl SCARG(&ia, com) = TIOCSETA;
536 1.1 fvdl break;
537 1.1 fvdl case LINUX_TCSETAW:
538 1.1 fvdl SCARG(&ia, com) = TIOCSETAW;
539 1.1 fvdl break;
540 1.1 fvdl case LINUX_TCSETAF:
541 1.1 fvdl SCARG(&ia, com) = TIOCSETAF;
542 1.1 fvdl break;
543 1.1 fvdl }
544 1.1 fvdl if ((error = copyin(&tmplt, data, sizeof tmplt)))
545 1.1 fvdl return error;
546 1.1 fvdl abts = stackgap_alloc(&sg, sizeof tmpbts);
547 1.1 fvdl /*
548 1.1 fvdl * First fill in all fields, so that we keep the current
549 1.1 fvdl * values for fields that Linux doesn't know about.
550 1.1 fvdl */
551 1.1 fvdl if ((error = (*fp->f_ops->fo_ioctl)(fp, TIOCGETA,
552 1.1 fvdl (caddr_t) &tmpbts, p)))
553 1.1 fvdl return error;
554 1.1 fvdl linux_termio_to_bsd_termios(&tmplt, &tmpbts);
555 1.1 fvdl if ((error = copyout(&tmpbts, abts, sizeof tmpbts)))
556 1.1 fvdl return error;
557 1.1 fvdl SCARG(&ia, data) = (caddr_t) abts;
558 1.1 fvdl return ioctl(p, &ia, retval);
559 1.1 fvdl case LINUX_TIOCSETD:
560 1.1 fvdl if ((error = copyin(data, (caddr_t) &idat, sizeof idat)))
561 1.1 fvdl return error;
562 1.1 fvdl switch (idat) {
563 1.1 fvdl case LINUX_N_TTY:
564 1.1 fvdl idat = TTYDISC;
565 1.1 fvdl break;
566 1.1 fvdl case LINUX_N_SLIP:
567 1.1 fvdl idat = SLIPDISC;
568 1.1 fvdl break;
569 1.1 fvdl case LINUX_N_PPP:
570 1.1 fvdl idat = PPPDISC;
571 1.1 fvdl break;
572 1.1 fvdl /*
573 1.1 fvdl * We can't handle the mouse line discipline Linux has.
574 1.1 fvdl */
575 1.1 fvdl case LINUX_N_MOUSE:
576 1.1 fvdl default:
577 1.1 fvdl return EINVAL;
578 1.1 fvdl }
579 1.1 fvdl
580 1.1 fvdl idatp = (int *) stackgap_alloc(&sg, sizeof (int));
581 1.1 fvdl if ((error = copyout(&idat, idatp, sizeof (int))))
582 1.1 fvdl return error;
583 1.1 fvdl SCARG(&ia, com) = TIOCSETD;
584 1.1 fvdl SCARG(&ia, data) = (caddr_t) idatp;
585 1.1 fvdl break;
586 1.1 fvdl case LINUX_TIOCGETD:
587 1.1 fvdl idatp = (int *) stackgap_alloc(&sg, sizeof (int));
588 1.1 fvdl SCARG(&ia, com) = TIOCGETD;
589 1.1 fvdl SCARG(&ia, data) = (caddr_t) idatp;
590 1.1 fvdl if ((error = ioctl(p, &ia, retval)))
591 1.1 fvdl return error;
592 1.1 fvdl if ((error = copyin(idatp, (caddr_t) &idat, sizeof (int))))
593 1.1 fvdl return error;
594 1.1 fvdl switch (idat) {
595 1.1 fvdl case TTYDISC:
596 1.1 fvdl idat = LINUX_N_TTY;
597 1.1 fvdl break;
598 1.1 fvdl case SLIPDISC:
599 1.1 fvdl idat = LINUX_N_SLIP;
600 1.1 fvdl break;
601 1.1 fvdl case PPPDISC:
602 1.1 fvdl idat = LINUX_N_PPP;
603 1.1 fvdl break;
604 1.1 fvdl /*
605 1.1 fvdl * Linux does not have the tablet line discipline.
606 1.1 fvdl */
607 1.1 fvdl case TABLDISC:
608 1.1 fvdl default:
609 1.1 fvdl idat = -1; /* XXX What should this be? */
610 1.1 fvdl break;
611 1.1 fvdl }
612 1.1 fvdl return copyout(&idat, data, sizeof (int));
613 1.1 fvdl case LINUX_TIOCGWINSZ:
614 1.1 fvdl SCARG(&ia, com) = TIOCGWINSZ;
615 1.1 fvdl break;
616 1.1 fvdl case LINUX_TIOCSWINSZ:
617 1.1 fvdl SCARG(&ia, com) = TIOCSWINSZ;
618 1.1 fvdl break;
619 1.1 fvdl case LINUX_TIOCGPGRP:
620 1.1 fvdl SCARG(&ia, com) = TIOCGPGRP;
621 1.1 fvdl break;
622 1.1 fvdl case LINUX_TIOCSPGRP:
623 1.1 fvdl SCARG(&ia, com) = TIOCSPGRP;
624 1.1 fvdl break;
625 1.1 fvdl case LINUX_FIONREAD:
626 1.1 fvdl SCARG(&ia, com) = FIONREAD;
627 1.1 fvdl break;
628 1.1 fvdl case LINUX_FIONBIO:
629 1.1 fvdl SCARG(&ia, com) = FIONBIO;
630 1.1 fvdl break;
631 1.1 fvdl case LINUX_FIOASYNC:
632 1.1 fvdl SCARG(&ia, com) = FIOASYNC;
633 1.1 fvdl break;
634 1.1 fvdl case LINUX_TIOCEXCL:
635 1.1 fvdl SCARG(&ia, com) = TIOCEXCL;
636 1.1 fvdl break;
637 1.1 fvdl case LINUX_TIOCNXCL:
638 1.1 fvdl SCARG(&ia, com) = TIOCNXCL;
639 1.1 fvdl break;
640 1.1 fvdl case LINUX_TIOCCONS:
641 1.1 fvdl SCARG(&ia, com) = TIOCCONS;
642 1.1 fvdl break;
643 1.1 fvdl case LINUX_TIOCNOTTY:
644 1.1 fvdl SCARG(&ia, com) = TIOCNOTTY;
645 1.2 fvdl break;
646 1.2 fvdl case LINUX_SIOCADDMULTI:
647 1.2 fvdl SCARG(&ia, com) = SIOCADDMULTI;
648 1.2 fvdl break;
649 1.2 fvdl case LINUX_SIOCDELMULTI:
650 1.2 fvdl SCARG(&ia, com) = SIOCDELMULTI;
651 1.1 fvdl break;
652 1.1 fvdl default:
653 1.6 fvdl return linux_machdepioctl(p, uap, retval);
654 1.1 fvdl }
655 1.1 fvdl
656 1.1 fvdl return ioctl(p, &ia, retval);
657 1.1 fvdl }
658