diff options
Diffstat (limited to 'arch/sparc64/kernel/sunos_ioctl32.c')
-rw-r--r-- | arch/sparc64/kernel/sunos_ioctl32.c | 275 |
1 files changed, 0 insertions, 275 deletions
diff --git a/arch/sparc64/kernel/sunos_ioctl32.c b/arch/sparc64/kernel/sunos_ioctl32.c deleted file mode 100644 index 75d2bad49839..000000000000 --- a/arch/sparc64/kernel/sunos_ioctl32.c +++ /dev/null | |||
@@ -1,275 +0,0 @@ | |||
1 | /* $Id: sunos_ioctl32.c,v 1.11 2000/07/30 23:12:24 davem Exp $ | ||
2 | * sunos_ioctl32.c: SunOS ioctl compatibility on sparc64. | ||
3 | * | ||
4 | * Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx) | ||
5 | * Copyright (C) 1995, 1996, 1997 David S. Miller (davem@caip.rutgers.edu) | ||
6 | */ | ||
7 | |||
8 | #include <asm/uaccess.h> | ||
9 | |||
10 | #include <linux/sched.h> | ||
11 | #include <linux/errno.h> | ||
12 | #include <linux/string.h> | ||
13 | #include <linux/termios.h> | ||
14 | #include <linux/tty.h> | ||
15 | #include <linux/ioctl.h> | ||
16 | #include <linux/route.h> | ||
17 | #include <linux/sockios.h> | ||
18 | #include <linux/if.h> | ||
19 | #include <linux/netdevice.h> | ||
20 | #include <linux/if_arp.h> | ||
21 | #include <linux/fs.h> | ||
22 | #include <linux/file.h> | ||
23 | #include <linux/mm.h> | ||
24 | #include <linux/smp.h> | ||
25 | #include <linux/syscalls.h> | ||
26 | #include <linux/compat.h> | ||
27 | |||
28 | #define SUNOS_NR_OPEN 256 | ||
29 | |||
30 | struct rtentry32 { | ||
31 | u32 rt_pad1; | ||
32 | struct sockaddr rt_dst; /* target address */ | ||
33 | struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */ | ||
34 | struct sockaddr rt_genmask; /* target network mask (IP) */ | ||
35 | unsigned short rt_flags; | ||
36 | short rt_pad2; | ||
37 | u32 rt_pad3; | ||
38 | unsigned char rt_tos; | ||
39 | unsigned char rt_class; | ||
40 | short rt_pad4; | ||
41 | short rt_metric; /* +1 for binary compatibility! */ | ||
42 | /* char * */ u32 rt_dev; /* forcing the device at add */ | ||
43 | u32 rt_mtu; /* per route MTU/Window */ | ||
44 | u32 rt_window; /* Window clamping */ | ||
45 | unsigned short rt_irtt; /* Initial RTT */ | ||
46 | |||
47 | }; | ||
48 | |||
49 | struct ifmap32 { | ||
50 | u32 mem_start; | ||
51 | u32 mem_end; | ||
52 | unsigned short base_addr; | ||
53 | unsigned char irq; | ||
54 | unsigned char dma; | ||
55 | unsigned char port; | ||
56 | }; | ||
57 | |||
58 | struct ifreq32 { | ||
59 | #define IFHWADDRLEN 6 | ||
60 | #define IFNAMSIZ 16 | ||
61 | union { | ||
62 | char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */ | ||
63 | } ifr_ifrn; | ||
64 | union { | ||
65 | struct sockaddr ifru_addr; | ||
66 | struct sockaddr ifru_dstaddr; | ||
67 | struct sockaddr ifru_broadaddr; | ||
68 | struct sockaddr ifru_netmask; | ||
69 | struct sockaddr ifru_hwaddr; | ||
70 | short ifru_flags; | ||
71 | int ifru_ivalue; | ||
72 | int ifru_mtu; | ||
73 | struct ifmap32 ifru_map; | ||
74 | char ifru_slave[IFNAMSIZ]; /* Just fits the size */ | ||
75 | compat_caddr_t ifru_data; | ||
76 | } ifr_ifru; | ||
77 | }; | ||
78 | |||
79 | struct ifconf32 { | ||
80 | int ifc_len; /* size of buffer */ | ||
81 | compat_caddr_t ifcbuf; | ||
82 | }; | ||
83 | |||
84 | extern asmlinkage int compat_sys_ioctl(unsigned int, unsigned int, u32); | ||
85 | |||
86 | asmlinkage int sunos_ioctl (int fd, u32 cmd, u32 arg) | ||
87 | { | ||
88 | int ret = -EBADF; | ||
89 | |||
90 | if(fd >= SUNOS_NR_OPEN) | ||
91 | goto out; | ||
92 | if(!fcheck(fd)) | ||
93 | goto out; | ||
94 | |||
95 | if(cmd == TIOCSETD) { | ||
96 | mm_segment_t old_fs = get_fs(); | ||
97 | int __user *p; | ||
98 | int ntty = N_TTY; | ||
99 | int tmp; | ||
100 | |||
101 | p = (int __user *) (unsigned long) arg; | ||
102 | ret = -EFAULT; | ||
103 | if(get_user(tmp, p)) | ||
104 | goto out; | ||
105 | if(tmp == 2) { | ||
106 | set_fs(KERNEL_DS); | ||
107 | ret = sys_ioctl(fd, cmd, (unsigned long) &ntty); | ||
108 | set_fs(old_fs); | ||
109 | ret = (ret == -EINVAL ? -EOPNOTSUPP : ret); | ||
110 | goto out; | ||
111 | } | ||
112 | } | ||
113 | if(cmd == TIOCNOTTY) { | ||
114 | ret = sys_setsid(); | ||
115 | goto out; | ||
116 | } | ||
117 | switch(cmd) { | ||
118 | case _IOW('r', 10, struct rtentry32): | ||
119 | ret = compat_sys_ioctl(fd, SIOCADDRT, arg); | ||
120 | goto out; | ||
121 | case _IOW('r', 11, struct rtentry32): | ||
122 | ret = compat_sys_ioctl(fd, SIOCDELRT, arg); | ||
123 | goto out; | ||
124 | |||
125 | case _IOW('i', 12, struct ifreq32): | ||
126 | ret = compat_sys_ioctl(fd, SIOCSIFADDR, arg); | ||
127 | goto out; | ||
128 | case _IOWR('i', 13, struct ifreq32): | ||
129 | ret = compat_sys_ioctl(fd, SIOCGIFADDR, arg); | ||
130 | goto out; | ||
131 | case _IOW('i', 14, struct ifreq32): | ||
132 | ret = compat_sys_ioctl(fd, SIOCSIFDSTADDR, arg); | ||
133 | goto out; | ||
134 | case _IOWR('i', 15, struct ifreq32): | ||
135 | ret = compat_sys_ioctl(fd, SIOCGIFDSTADDR, arg); | ||
136 | goto out; | ||
137 | case _IOW('i', 16, struct ifreq32): | ||
138 | ret = compat_sys_ioctl(fd, SIOCSIFFLAGS, arg); | ||
139 | goto out; | ||
140 | case _IOWR('i', 17, struct ifreq32): | ||
141 | ret = compat_sys_ioctl(fd, SIOCGIFFLAGS, arg); | ||
142 | goto out; | ||
143 | case _IOW('i', 18, struct ifreq32): | ||
144 | ret = compat_sys_ioctl(fd, SIOCSIFMEM, arg); | ||
145 | goto out; | ||
146 | case _IOWR('i', 19, struct ifreq32): | ||
147 | ret = compat_sys_ioctl(fd, SIOCGIFMEM, arg); | ||
148 | goto out; | ||
149 | |||
150 | case _IOWR('i', 20, struct ifconf32): | ||
151 | ret = compat_sys_ioctl(fd, SIOCGIFCONF, arg); | ||
152 | goto out; | ||
153 | |||
154 | case _IOW('i', 21, struct ifreq32): | ||
155 | ret = compat_sys_ioctl(fd, SIOCSIFMTU, arg); | ||
156 | goto out; | ||
157 | |||
158 | case _IOWR('i', 22, struct ifreq32): | ||
159 | ret = compat_sys_ioctl(fd, SIOCGIFMTU, arg); | ||
160 | goto out; | ||
161 | |||
162 | case _IOWR('i', 23, struct ifreq32): | ||
163 | ret = compat_sys_ioctl(fd, SIOCGIFBRDADDR, arg); | ||
164 | goto out; | ||
165 | case _IOW('i', 24, struct ifreq32): | ||
166 | ret = compat_sys_ioctl(fd, SIOCSIFBRDADDR, arg); | ||
167 | goto out; | ||
168 | case _IOWR('i', 25, struct ifreq32): | ||
169 | ret = compat_sys_ioctl(fd, SIOCGIFNETMASK, arg); | ||
170 | goto out; | ||
171 | case _IOW('i', 26, struct ifreq32): | ||
172 | ret = compat_sys_ioctl(fd, SIOCSIFNETMASK, arg); | ||
173 | goto out; | ||
174 | case _IOWR('i', 27, struct ifreq32): | ||
175 | ret = compat_sys_ioctl(fd, SIOCGIFMETRIC, arg); | ||
176 | goto out; | ||
177 | case _IOW('i', 28, struct ifreq32): | ||
178 | ret = compat_sys_ioctl(fd, SIOCSIFMETRIC, arg); | ||
179 | goto out; | ||
180 | |||
181 | case _IOW('i', 30, struct arpreq): | ||
182 | ret = compat_sys_ioctl(fd, SIOCSARP, arg); | ||
183 | goto out; | ||
184 | case _IOWR('i', 31, struct arpreq): | ||
185 | ret = compat_sys_ioctl(fd, SIOCGARP, arg); | ||
186 | goto out; | ||
187 | case _IOW('i', 32, struct arpreq): | ||
188 | ret = compat_sys_ioctl(fd, SIOCDARP, arg); | ||
189 | goto out; | ||
190 | |||
191 | case _IOW('i', 40, struct ifreq32): /* SIOCUPPER */ | ||
192 | case _IOW('i', 41, struct ifreq32): /* SIOCLOWER */ | ||
193 | case _IOW('i', 44, struct ifreq32): /* SIOCSETSYNC */ | ||
194 | case _IOW('i', 45, struct ifreq32): /* SIOCGETSYNC */ | ||
195 | case _IOW('i', 46, struct ifreq32): /* SIOCSSDSTATS */ | ||
196 | case _IOW('i', 47, struct ifreq32): /* SIOCSSESTATS */ | ||
197 | case _IOW('i', 48, struct ifreq32): /* SIOCSPROMISC */ | ||
198 | ret = -EOPNOTSUPP; | ||
199 | goto out; | ||
200 | |||
201 | case _IOW('i', 49, struct ifreq32): | ||
202 | ret = compat_sys_ioctl(fd, SIOCADDMULTI, arg); | ||
203 | goto out; | ||
204 | case _IOW('i', 50, struct ifreq32): | ||
205 | ret = compat_sys_ioctl(fd, SIOCDELMULTI, arg); | ||
206 | goto out; | ||
207 | |||
208 | /* FDDI interface ioctls, unsupported. */ | ||
209 | |||
210 | case _IOW('i', 51, struct ifreq32): /* SIOCFDRESET */ | ||
211 | case _IOW('i', 52, struct ifreq32): /* SIOCFDSLEEP */ | ||
212 | case _IOW('i', 53, struct ifreq32): /* SIOCSTRTFMWAR */ | ||
213 | case _IOW('i', 54, struct ifreq32): /* SIOCLDNSTRTFW */ | ||
214 | case _IOW('i', 55, struct ifreq32): /* SIOCGETFDSTAT */ | ||
215 | case _IOW('i', 56, struct ifreq32): /* SIOCFDNMIINT */ | ||
216 | case _IOW('i', 57, struct ifreq32): /* SIOCFDEXUSER */ | ||
217 | case _IOW('i', 58, struct ifreq32): /* SIOCFDGNETMAP */ | ||
218 | case _IOW('i', 59, struct ifreq32): /* SIOCFDGIOCTL */ | ||
219 | printk("FDDI ioctl, returning EOPNOTSUPP\n"); | ||
220 | ret = -EOPNOTSUPP; | ||
221 | goto out; | ||
222 | |||
223 | case _IOW('t', 125, int): | ||
224 | /* More stupid tty sunos ioctls, just | ||
225 | * say it worked. | ||
226 | */ | ||
227 | ret = 0; | ||
228 | goto out; | ||
229 | |||
230 | /* Non posix grp */ | ||
231 | case _IOW('t', 118, int): { | ||
232 | int oldval, newval, __user *ptr; | ||
233 | |||
234 | cmd = TIOCSPGRP; | ||
235 | ptr = (int __user *) (unsigned long) arg; | ||
236 | ret = -EFAULT; | ||
237 | if(get_user(oldval, ptr)) | ||
238 | goto out; | ||
239 | ret = compat_sys_ioctl(fd, cmd, arg); | ||
240 | __get_user(newval, ptr); | ||
241 | if(newval == -1) { | ||
242 | __put_user(oldval, ptr); | ||
243 | ret = -EIO; | ||
244 | } | ||
245 | if(ret == -ENOTTY) | ||
246 | ret = -EIO; | ||
247 | goto out; | ||
248 | } | ||
249 | |||
250 | case _IOR('t', 119, int): { | ||
251 | int oldval, newval, __user *ptr; | ||
252 | |||
253 | cmd = TIOCGPGRP; | ||
254 | ptr = (int __user *) (unsigned long) arg; | ||
255 | ret = -EFAULT; | ||
256 | if(get_user(oldval, ptr)) | ||
257 | goto out; | ||
258 | ret = compat_sys_ioctl(fd, cmd, arg); | ||
259 | __get_user(newval, ptr); | ||
260 | if(newval == -1) { | ||
261 | __put_user(oldval, ptr); | ||
262 | ret = -EIO; | ||
263 | } | ||
264 | if(ret == -ENOTTY) | ||
265 | ret = -EIO; | ||
266 | goto out; | ||
267 | } | ||
268 | }; | ||
269 | |||
270 | ret = compat_sys_ioctl(fd, cmd, arg); | ||
271 | /* so stupid... */ | ||
272 | ret = (ret == -EINVAL ? -EOPNOTSUPP : ret); | ||
273 | out: | ||
274 | return ret; | ||
275 | } | ||