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