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