Root/
1 | #ifndef _LINUX_COMPAT_H |
2 | #define _LINUX_COMPAT_H |
3 | /* |
4 | * These are the type definitions for the architecture specific |
5 | * syscall compatibility layer. |
6 | */ |
7 | |
8 | #ifdef CONFIG_COMPAT |
9 | |
10 | #include <linux/stat.h> |
11 | #include <linux/param.h> /* for HZ */ |
12 | #include <linux/sem.h> |
13 | #include <linux/socket.h> |
14 | #include <linux/if.h> |
15 | |
16 | #include <asm/compat.h> |
17 | #include <asm/siginfo.h> |
18 | #include <asm/signal.h> |
19 | |
20 | #define compat_jiffies_to_clock_t(x) \ |
21 | (((unsigned long)(x) * COMPAT_USER_HZ) / HZ) |
22 | |
23 | typedef __compat_uid32_t compat_uid_t; |
24 | typedef __compat_gid32_t compat_gid_t; |
25 | |
26 | struct compat_sel_arg_struct; |
27 | struct rusage; |
28 | |
29 | struct compat_itimerspec { |
30 | struct compat_timespec it_interval; |
31 | struct compat_timespec it_value; |
32 | }; |
33 | |
34 | struct compat_utimbuf { |
35 | compat_time_t actime; |
36 | compat_time_t modtime; |
37 | }; |
38 | |
39 | struct compat_itimerval { |
40 | struct compat_timeval it_interval; |
41 | struct compat_timeval it_value; |
42 | }; |
43 | |
44 | struct compat_tms { |
45 | compat_clock_t tms_utime; |
46 | compat_clock_t tms_stime; |
47 | compat_clock_t tms_cutime; |
48 | compat_clock_t tms_cstime; |
49 | }; |
50 | |
51 | struct compat_timex { |
52 | compat_uint_t modes; |
53 | compat_long_t offset; |
54 | compat_long_t freq; |
55 | compat_long_t maxerror; |
56 | compat_long_t esterror; |
57 | compat_int_t status; |
58 | compat_long_t constant; |
59 | compat_long_t precision; |
60 | compat_long_t tolerance; |
61 | struct compat_timeval time; |
62 | compat_long_t tick; |
63 | compat_long_t ppsfreq; |
64 | compat_long_t jitter; |
65 | compat_int_t shift; |
66 | compat_long_t stabil; |
67 | compat_long_t jitcnt; |
68 | compat_long_t calcnt; |
69 | compat_long_t errcnt; |
70 | compat_long_t stbcnt; |
71 | compat_int_t tai; |
72 | |
73 | compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; |
74 | compat_int_t :32; compat_int_t :32; compat_int_t :32; compat_int_t :32; |
75 | compat_int_t :32; compat_int_t :32; compat_int_t :32; |
76 | }; |
77 | |
78 | #define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW) |
79 | |
80 | typedef struct { |
81 | compat_sigset_word sig[_COMPAT_NSIG_WORDS]; |
82 | } compat_sigset_t; |
83 | |
84 | extern int get_compat_timespec(struct timespec *, const struct compat_timespec __user *); |
85 | extern int put_compat_timespec(const struct timespec *, struct compat_timespec __user *); |
86 | |
87 | struct compat_iovec { |
88 | compat_uptr_t iov_base; |
89 | compat_size_t iov_len; |
90 | }; |
91 | |
92 | struct compat_rlimit { |
93 | compat_ulong_t rlim_cur; |
94 | compat_ulong_t rlim_max; |
95 | }; |
96 | |
97 | struct compat_rusage { |
98 | struct compat_timeval ru_utime; |
99 | struct compat_timeval ru_stime; |
100 | compat_long_t ru_maxrss; |
101 | compat_long_t ru_ixrss; |
102 | compat_long_t ru_idrss; |
103 | compat_long_t ru_isrss; |
104 | compat_long_t ru_minflt; |
105 | compat_long_t ru_majflt; |
106 | compat_long_t ru_nswap; |
107 | compat_long_t ru_inblock; |
108 | compat_long_t ru_oublock; |
109 | compat_long_t ru_msgsnd; |
110 | compat_long_t ru_msgrcv; |
111 | compat_long_t ru_nsignals; |
112 | compat_long_t ru_nvcsw; |
113 | compat_long_t ru_nivcsw; |
114 | }; |
115 | |
116 | extern int put_compat_rusage(const struct rusage *, struct compat_rusage __user *); |
117 | |
118 | struct compat_siginfo; |
119 | |
120 | extern asmlinkage long compat_sys_waitid(int, compat_pid_t, |
121 | struct compat_siginfo __user *, int, |
122 | struct compat_rusage __user *); |
123 | |
124 | struct compat_dirent { |
125 | u32 d_ino; |
126 | compat_off_t d_off; |
127 | u16 d_reclen; |
128 | char d_name[256]; |
129 | }; |
130 | |
131 | struct compat_ustat { |
132 | compat_daddr_t f_tfree; |
133 | compat_ino_t f_tinode; |
134 | char f_fname[6]; |
135 | char f_fpack[6]; |
136 | }; |
137 | |
138 | typedef union compat_sigval { |
139 | compat_int_t sival_int; |
140 | compat_uptr_t sival_ptr; |
141 | } compat_sigval_t; |
142 | |
143 | #define COMPAT_SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3) |
144 | |
145 | typedef struct compat_sigevent { |
146 | compat_sigval_t sigev_value; |
147 | compat_int_t sigev_signo; |
148 | compat_int_t sigev_notify; |
149 | union { |
150 | compat_int_t _pad[COMPAT_SIGEV_PAD_SIZE]; |
151 | compat_int_t _tid; |
152 | |
153 | struct { |
154 | compat_uptr_t _function; |
155 | compat_uptr_t _attribute; |
156 | } _sigev_thread; |
157 | } _sigev_un; |
158 | } compat_sigevent_t; |
159 | |
160 | struct compat_ifmap { |
161 | compat_ulong_t mem_start; |
162 | compat_ulong_t mem_end; |
163 | unsigned short base_addr; |
164 | unsigned char irq; |
165 | unsigned char dma; |
166 | unsigned char port; |
167 | }; |
168 | |
169 | struct compat_if_settings |
170 | { |
171 | unsigned int type; /* Type of physical device or protocol */ |
172 | unsigned int size; /* Size of the data allocated by the caller */ |
173 | compat_uptr_t ifs_ifsu; /* union of pointers */ |
174 | }; |
175 | |
176 | struct compat_ifreq { |
177 | union { |
178 | char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */ |
179 | } ifr_ifrn; |
180 | union { |
181 | struct sockaddr ifru_addr; |
182 | struct sockaddr ifru_dstaddr; |
183 | struct sockaddr ifru_broadaddr; |
184 | struct sockaddr ifru_netmask; |
185 | struct sockaddr ifru_hwaddr; |
186 | short ifru_flags; |
187 | compat_int_t ifru_ivalue; |
188 | compat_int_t ifru_mtu; |
189 | struct compat_ifmap ifru_map; |
190 | char ifru_slave[IFNAMSIZ]; /* Just fits the size */ |
191 | char ifru_newname[IFNAMSIZ]; |
192 | compat_caddr_t ifru_data; |
193 | struct compat_if_settings ifru_settings; |
194 | } ifr_ifru; |
195 | }; |
196 | |
197 | struct compat_ifconf { |
198 | compat_int_t ifc_len; /* size of buffer */ |
199 | compat_caddr_t ifcbuf; |
200 | }; |
201 | |
202 | struct compat_robust_list { |
203 | compat_uptr_t next; |
204 | }; |
205 | |
206 | struct compat_robust_list_head { |
207 | struct compat_robust_list list; |
208 | compat_long_t futex_offset; |
209 | compat_uptr_t list_op_pending; |
210 | }; |
211 | |
212 | extern void compat_exit_robust_list(struct task_struct *curr); |
213 | |
214 | asmlinkage long |
215 | compat_sys_set_robust_list(struct compat_robust_list_head __user *head, |
216 | compat_size_t len); |
217 | asmlinkage long |
218 | compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, |
219 | compat_size_t __user *len_ptr); |
220 | |
221 | long compat_sys_semctl(int first, int second, int third, void __user *uptr); |
222 | long compat_sys_msgsnd(int first, int second, int third, void __user *uptr); |
223 | long compat_sys_msgrcv(int first, int second, int msgtyp, int third, |
224 | int version, void __user *uptr); |
225 | long compat_sys_msgctl(int first, int second, void __user *uptr); |
226 | long compat_sys_shmat(int first, int second, compat_uptr_t third, int version, |
227 | void __user *uptr); |
228 | long compat_sys_shmctl(int first, int second, void __user *uptr); |
229 | long compat_sys_semtimedop(int semid, struct sembuf __user *tsems, |
230 | unsigned nsems, const struct compat_timespec __user *timeout); |
231 | asmlinkage long compat_sys_keyctl(u32 option, |
232 | u32 arg2, u32 arg3, u32 arg4, u32 arg5); |
233 | asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u32); |
234 | |
235 | asmlinkage ssize_t compat_sys_readv(unsigned long fd, |
236 | const struct compat_iovec __user *vec, unsigned long vlen); |
237 | asmlinkage ssize_t compat_sys_writev(unsigned long fd, |
238 | const struct compat_iovec __user *vec, unsigned long vlen); |
239 | asmlinkage ssize_t compat_sys_preadv(unsigned long fd, |
240 | const struct compat_iovec __user *vec, |
241 | unsigned long vlen, u32 pos_low, u32 pos_high); |
242 | asmlinkage ssize_t compat_sys_pwritev(unsigned long fd, |
243 | const struct compat_iovec __user *vec, |
244 | unsigned long vlen, u32 pos_low, u32 pos_high); |
245 | |
246 | int compat_do_execve(char * filename, compat_uptr_t __user *argv, |
247 | compat_uptr_t __user *envp, struct pt_regs * regs); |
248 | |
249 | asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, |
250 | compat_ulong_t __user *outp, compat_ulong_t __user *exp, |
251 | struct compat_timeval __user *tvp); |
252 | |
253 | asmlinkage long compat_sys_old_select(struct compat_sel_arg_struct __user *arg); |
254 | |
255 | asmlinkage long compat_sys_wait4(compat_pid_t pid, |
256 | compat_uint_t __user *stat_addr, int options, |
257 | struct compat_rusage __user *ru); |
258 | |
259 | #define BITS_PER_COMPAT_LONG (8*sizeof(compat_long_t)) |
260 | |
261 | #define BITS_TO_COMPAT_LONGS(bits) \ |
262 | (((bits)+BITS_PER_COMPAT_LONG-1)/BITS_PER_COMPAT_LONG) |
263 | |
264 | long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask, |
265 | unsigned long bitmap_size); |
266 | long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask, |
267 | unsigned long bitmap_size); |
268 | int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from); |
269 | int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from); |
270 | int get_compat_sigevent(struct sigevent *event, |
271 | const struct compat_sigevent __user *u_event); |
272 | long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig, |
273 | struct compat_siginfo __user *uinfo); |
274 | |
275 | static inline int compat_timeval_compare(struct compat_timeval *lhs, |
276 | struct compat_timeval *rhs) |
277 | { |
278 | if (lhs->tv_sec < rhs->tv_sec) |
279 | return -1; |
280 | if (lhs->tv_sec > rhs->tv_sec) |
281 | return 1; |
282 | return lhs->tv_usec - rhs->tv_usec; |
283 | } |
284 | |
285 | static inline int compat_timespec_compare(struct compat_timespec *lhs, |
286 | struct compat_timespec *rhs) |
287 | { |
288 | if (lhs->tv_sec < rhs->tv_sec) |
289 | return -1; |
290 | if (lhs->tv_sec > rhs->tv_sec) |
291 | return 1; |
292 | return lhs->tv_nsec - rhs->tv_nsec; |
293 | } |
294 | |
295 | extern int get_compat_itimerspec(struct itimerspec *dst, |
296 | const struct compat_itimerspec __user *src); |
297 | extern int put_compat_itimerspec(struct compat_itimerspec __user *dst, |
298 | const struct itimerspec *src); |
299 | |
300 | asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv, |
301 | struct timezone __user *tz); |
302 | asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv, |
303 | struct timezone __user *tz); |
304 | |
305 | asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); |
306 | |
307 | extern int compat_printk(const char *fmt, ...); |
308 | extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat); |
309 | |
310 | asmlinkage long compat_sys_migrate_pages(compat_pid_t pid, |
311 | compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes, |
312 | const compat_ulong_t __user *new_nodes); |
313 | |
314 | extern int compat_ptrace_request(struct task_struct *child, |
315 | compat_long_t request, |
316 | compat_ulong_t addr, compat_ulong_t data); |
317 | |
318 | extern long compat_arch_ptrace(struct task_struct *child, compat_long_t request, |
319 | compat_ulong_t addr, compat_ulong_t data); |
320 | asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid, |
321 | compat_long_t addr, compat_long_t data); |
322 | |
323 | /* |
324 | * epoll (fs/eventpoll.c) compat bits follow ... |
325 | */ |
326 | struct epoll_event; |
327 | #define compat_epoll_event epoll_event |
328 | asmlinkage long compat_sys_epoll_pwait(int epfd, |
329 | struct compat_epoll_event __user *events, |
330 | int maxevents, int timeout, |
331 | const compat_sigset_t __user *sigmask, |
332 | compat_size_t sigsetsize); |
333 | |
334 | asmlinkage long compat_sys_utimensat(unsigned int dfd, const char __user *filename, |
335 | struct compat_timespec __user *t, int flags); |
336 | |
337 | asmlinkage long compat_sys_signalfd(int ufd, |
338 | const compat_sigset_t __user *sigmask, |
339 | compat_size_t sigsetsize); |
340 | asmlinkage long compat_sys_timerfd_settime(int ufd, int flags, |
341 | const struct compat_itimerspec __user *utmr, |
342 | struct compat_itimerspec __user *otmr); |
343 | asmlinkage long compat_sys_timerfd_gettime(int ufd, |
344 | struct compat_itimerspec __user *otmr); |
345 | |
346 | asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page, |
347 | __u32 __user *pages, |
348 | const int __user *nodes, |
349 | int __user *status, |
350 | int flags); |
351 | asmlinkage long compat_sys_futimesat(unsigned int dfd, const char __user *filename, |
352 | struct compat_timeval __user *t); |
353 | asmlinkage long compat_sys_newfstatat(unsigned int dfd, const char __user * filename, |
354 | struct compat_stat __user *statbuf, |
355 | int flag); |
356 | asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, |
357 | int flags, int mode); |
358 | |
359 | extern ssize_t compat_rw_copy_check_uvector(int type, |
360 | const struct compat_iovec __user *uvector, unsigned long nr_segs, |
361 | unsigned long fast_segs, struct iovec *fast_pointer, |
362 | struct iovec **ret_pointer); |
363 | |
364 | extern void __user *compat_alloc_user_space(unsigned long len); |
365 | |
366 | #endif /* CONFIG_COMPAT */ |
367 | #endif /* _LINUX_COMPAT_H */ |
368 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9