4 * Architecture specific compatibility types
6 #include <linux/seccomp.h>
7 #include <linux/thread_info.h>
8 #include <linux/types.h>
10 #include <asm/ptrace.h>
12 #define COMPAT_USER_HZ 100
14 typedef u32 compat_size_t;
15 typedef s32 compat_ssize_t;
16 typedef s32 compat_time_t;
17 typedef s32 compat_clock_t;
18 typedef s32 compat_suseconds_t;
20 typedef s32 compat_pid_t;
21 typedef s32 __compat_uid_t;
22 typedef s32 __compat_gid_t;
23 typedef __compat_uid_t __compat_uid32_t;
24 typedef __compat_gid_t __compat_gid32_t;
25 typedef u32 compat_mode_t;
26 typedef u32 compat_ino_t;
27 typedef u32 compat_dev_t;
28 typedef s32 compat_off_t;
29 typedef s64 compat_loff_t;
30 typedef u32 compat_nlink_t;
31 typedef s32 compat_ipc_pid_t;
32 typedef s32 compat_daddr_t;
33 typedef s32 compat_caddr_t;
37 typedef s32 compat_timer_t;
38 typedef s32 compat_key_t;
40 typedef s32 compat_int_t;
41 typedef s32 compat_long_t;
42 typedef s64 compat_s64;
43 typedef u32 compat_uint_t;
44 typedef u32 compat_ulong_t;
45 typedef u64 compat_u64;
47 struct compat_timespec {
52 struct compat_timeval {
61 compat_mode_t st_mode;
62 compat_nlink_t st_nlink;
63 __compat_uid_t st_uid;
64 __compat_gid_t st_gid;
69 compat_time_t st_atime;
71 compat_time_t st_mtime;
73 compat_time_t st_ctime;
95 struct compat_flock64 {
98 compat_loff_t l_start;
103 struct compat_statfs {
112 compat_fsid_t f_fsid;
117 #define COMPAT_RLIM_INFINITY 0x7fffffffUL
119 typedef u32 compat_old_sigset_t; /* at least 32 bits */
121 #define _COMPAT_NSIG 128 /* Don't ask !$@#% ... */
122 #define _COMPAT_NSIG_BPW 32
124 typedef u32 compat_sigset_word;
126 #define COMPAT_OFF_T_MAX 0x7fffffff
127 #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
130 * A pointer passed in from user mode. This should not
131 * be used for syscall parameters, just declare them
132 * as pointers because the syscall entry code will have
133 * appropriately converted them already.
135 typedef u32 compat_uptr_t;
137 static inline void __user *compat_ptr(compat_uptr_t uptr)
139 /* cast to a __user pointer via "unsigned long" makes sparse happy */
140 return (void __user *)(unsigned long)(long)uptr;
143 static inline compat_uptr_t ptr_to_compat(void __user *uptr)
145 return (u32)(unsigned long)uptr;
148 static inline void __user *compat_alloc_user_space(long len)
150 struct pt_regs *regs = (struct pt_regs *)
151 ((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1;
153 return (void __user *) (regs->regs[29] - len);
156 struct compat_ipc64_perm {
158 __compat_uid32_t uid;
159 __compat_gid32_t gid;
160 __compat_uid32_t cuid;
161 __compat_gid32_t cgid;
164 unsigned short __pad2;
165 compat_ulong_t __unused1;
166 compat_ulong_t __unused2;
169 struct compat_semid64_ds {
170 struct compat_ipc64_perm sem_perm;
171 compat_time_t sem_otime;
172 compat_time_t sem_ctime;
173 compat_ulong_t sem_nsems;
174 compat_ulong_t __unused1;
175 compat_ulong_t __unused2;
178 struct compat_msqid64_ds {
179 struct compat_ipc64_perm msg_perm;
180 #ifndef CONFIG_CPU_LITTLE_ENDIAN
181 compat_ulong_t __unused1;
183 compat_time_t msg_stime;
184 #ifdef CONFIG_CPU_LITTLE_ENDIAN
185 compat_ulong_t __unused1;
187 #ifndef CONFIG_CPU_LITTLE_ENDIAN
188 compat_ulong_t __unused2;
190 compat_time_t msg_rtime;
191 #ifdef CONFIG_CPU_LITTLE_ENDIAN
192 compat_ulong_t __unused2;
194 #ifndef CONFIG_CPU_LITTLE_ENDIAN
195 compat_ulong_t __unused3;
197 compat_time_t msg_ctime;
198 #ifdef CONFIG_CPU_LITTLE_ENDIAN
199 compat_ulong_t __unused3;
201 compat_ulong_t msg_cbytes;
202 compat_ulong_t msg_qnum;
203 compat_ulong_t msg_qbytes;
204 compat_pid_t msg_lspid;
205 compat_pid_t msg_lrpid;
206 compat_ulong_t __unused4;
207 compat_ulong_t __unused5;
210 struct compat_shmid64_ds {
211 struct compat_ipc64_perm shm_perm;
212 compat_size_t shm_segsz;
213 compat_time_t shm_atime;
214 compat_time_t shm_dtime;
215 compat_time_t shm_ctime;
216 compat_pid_t shm_cpid;
217 compat_pid_t shm_lpid;
218 compat_ulong_t shm_nattch;
219 compat_ulong_t __unused1;
220 compat_ulong_t __unused2;
223 static inline int is_compat_task(void)
225 return test_thread_flag(TIF_32BIT);
228 #endif /* _ASM_COMPAT_H */