This source file includes following definitions.
- sunos_ioctl
1
2
3
4
5
6
7
8 #include <asm/segment.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/ioctl.h>
15 #include <linux/route.h>
16 #include <linux/sockios.h>
17 #include <linux/if.h>
18 #include <linux/netdevice.h>
19 #include <linux/if_arp.h>
20 #include <linux/fs.h>
21 #include <linux/mm.h>
22 #include <asm/kbio.h>
23
24 #if 0
25 extern char sunkbd_type;
26 extern char sunkbd_layout;
27 #endif
28
29 extern asmlinkage int sys_ioctl(unsigned int, unsigned int, unsigned long);
30 extern asmlinkage int sys_setsid(void);
31
32 asmlinkage int sunos_ioctl (int fd, unsigned long cmd, unsigned long arg)
33 {
34 struct file *filp;
35 int foo;
36
37 if (fd >= NR_OPEN || !(filp = current->files->fd [fd]))
38 return -EBADF;
39
40
41 if(cmd == TIOCSETD) {
42 int *p, ntty = N_TTY, old_fs;
43
44 p = (int *) arg;
45 foo = verify_area(VERIFY_WRITE, p, sizeof(int));
46 if(foo) return foo;
47 if(*p == 2) {
48 old_fs = get_fs();
49 set_fs(KERNEL_DS);
50 foo = sys_ioctl(fd, cmd, (int) &ntty);
51 set_fs(old_fs);
52 return (foo == -EINVAL ? -EOPNOTSUPP : foo);
53 }
54 }
55
56
57 if(cmd == TIOCNOTTY)
58 return sys_setsid();
59
60
61 switch (cmd) {
62 case _IOW('r', 10, struct rtentry):
63 return sys_ioctl(fd, SIOCADDRT, arg);
64 case _IOW('r', 11, struct rtentry):
65 return sys_ioctl(fd, SIOCDELRT, arg);
66 case _IOW('i', 12, struct ifreq):
67 return sys_ioctl(fd, SIOCSIFADDR, arg);
68 case _IORW('i', 13, struct ifreq):
69 return sys_ioctl(fd, SIOCGIFADDR, arg);
70 case _IOW('i', 14, struct ifreq):
71 return sys_ioctl(fd, SIOCSIFDSTADDR, arg);
72 case _IORW('i', 15, struct ifreq):
73 return sys_ioctl(fd, SIOCGIFDSTADDR, arg);
74 case _IOW('i', 16, struct ifreq):
75 return sys_ioctl(fd, SIOCSIFFLAGS, arg);
76 case _IORW('i', 17, struct ifreq):
77 return sys_ioctl(fd, SIOCGIFFLAGS, arg);
78 case _IOW('i', 18, struct ifreq):
79 return sys_ioctl(fd, SIOCSIFMEM, arg);
80 case _IORW('i', 19, struct ifreq):
81 return sys_ioctl(fd, SIOCGIFMEM, arg);
82 case _IORW('i', 20, struct ifconf):
83 return sys_ioctl(fd, SIOCGIFCONF, arg);
84 case _IOW('i', 21, struct ifreq):
85 return sys_ioctl(fd, SIOCSIFMTU, arg);
86 case _IORW('i', 22, struct ifreq):
87 return sys_ioctl(fd, SIOCGIFMTU, arg);
88
89 case _IORW('i', 23, struct ifreq):
90 return sys_ioctl(fd, SIOCGIFBRDADDR, arg);
91 case _IOW('i', 24, struct ifreq):
92 return sys_ioctl(fd, SIOCGIFBRDADDR, arg);
93 case _IORW('i', 25, struct ifreq):
94 return sys_ioctl(fd, SIOCGIFNETMASK, arg);
95 case _IOW('i', 26, struct ifreq):
96 return sys_ioctl(fd, SIOCSIFNETMASK, arg);
97 case _IORW('i', 27, struct ifreq):
98 return sys_ioctl(fd, SIOCGIFMETRIC, arg);
99 case _IOW('i', 28, struct ifreq):
100 return sys_ioctl(fd, SIOCSIFMETRIC, arg);
101
102 case _IOW('i', 30, struct arpreq):
103 return sys_ioctl(fd, SIOCSARP, arg);
104 case _IOW('i', 31, struct arpreq):
105 return sys_ioctl(fd, SIOCGARP, arg);
106 case _IOW('i', 32, struct arpreq):
107 return sys_ioctl(fd, SIOCGARP, arg);
108
109 case _IOW('i', 40, struct ifreq):
110 case _IOW('i', 41, struct ifreq):
111 case _IOW('i', 44, struct ifreq):
112 case _IOW('i', 45, struct ifreq):
113 case _IOW('i', 46, struct ifreq):
114 case _IOW('i', 47, struct ifreq):
115 case _IOW('i', 48, struct ifreq):
116 return -EOPNOTSUPP;
117
118 case _IOW('i', 49, struct ifreq):
119 return sys_ioctl(fd, SIOCADDMULTI, arg);
120 case _IOW('i', 50, struct ifreq):
121 return sys_ioctl(fd, SIOCDELMULTI, arg);
122
123
124
125 case _IOW('i', 51, struct ifreq):
126 case _IOW('i', 52, struct ifreq):
127 case _IOW('i', 53, struct ifreq):
128 case _IOW('i', 54, struct ifreq):
129 case _IOW('i', 55, struct ifreq):
130 case _IOW('i', 56, struct ifreq):
131 case _IOW('i', 57, struct ifreq):
132 case _IOW('i', 58, struct ifreq):
133 case _IOW('i', 59, struct ifreq):
134 printk("FDDI ioctl, returning EOPNOTSUPP\n");
135 return -EOPNOTSUPP;
136 case _IOW('t', 125, int):
137
138
139
140 return 0;
141
142 case _IOW('t', 118, int): {
143 int oldval, *ptr;
144
145 cmd = TIOCSPGRP;
146 ptr = (int *) arg;
147 oldval = verify_area(VERIFY_WRITE, ptr, sizeof(int));
148 if(oldval)
149 return oldval;
150 oldval = *ptr;
151 foo = sys_ioctl(fd, cmd, arg);
152 if(*ptr == -1) {
153 *ptr = oldval;
154 foo = -EIO;
155 }
156 if(foo == -ENOTTY)
157 foo = -EIO;
158 return foo;
159 }
160
161 case _IOR('t', 119, int): {
162 int oldval, *ptr;
163
164 cmd = TIOCGPGRP;
165 ptr = (int *) arg;
166 oldval = verify_area(VERIFY_WRITE, ptr, sizeof(int));
167 if(oldval)
168 return oldval;
169 oldval = *ptr;
170 foo = sys_ioctl(fd, cmd, arg);
171 if(*ptr == -1) {
172 *ptr = oldval;
173 foo = -EIO;
174 }
175 if(foo == -ENOTTY)
176 foo = -EIO;
177 return foo;
178 }
179 }
180
181 #if 0
182 if (cmd & 0xff00 == ('k' << 8)){
183 printk ("[[KBIO: %8.8x\n", (unsigned int) cmd);
184 }
185 #endif
186
187 foo = sys_ioctl(fd, cmd, arg);
188
189 return (foo == -EINVAL ? -EOPNOTSUPP : foo);
190 }
191
192