]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - include/asm-mips/compat.h
[MIPS] Use SYSVIPC_COMPAT to fix various problems on N32
[mirror_ubuntu-zesty-kernel.git] / include / asm-mips / compat.h
CommitLineData
1da177e4
LT
1#ifndef _ASM_COMPAT_H
2#define _ASM_COMPAT_H
3/*
4 * Architecture specific compatibility types
5 */
6#include <linux/types.h>
7#include <asm/page.h>
8
9#define COMPAT_USER_HZ 100
10
11typedef u32 compat_size_t;
12typedef s32 compat_ssize_t;
13typedef s32 compat_time_t;
14typedef s32 compat_clock_t;
15typedef s32 compat_suseconds_t;
16
17typedef s32 compat_pid_t;
4ee1303a
RB
18typedef s32 __compat_uid_t;
19typedef s32 __compat_gid_t;
20typedef __compat_uid_t __compat_uid32_t;
21typedef __compat_gid_t __compat_gid32_t;
1da177e4
LT
22typedef u32 compat_mode_t;
23typedef u32 compat_ino_t;
24typedef u32 compat_dev_t;
25typedef s32 compat_off_t;
26typedef s64 compat_loff_t;
27typedef u32 compat_nlink_t;
28typedef s32 compat_ipc_pid_t;
29typedef s32 compat_daddr_t;
30typedef s32 compat_caddr_t;
31typedef struct {
32 s32 val[2];
33} compat_fsid_t;
0d77e5a2 34typedef s32 compat_timer_t;
05e43966 35typedef s32 compat_key_t;
1da177e4
LT
36
37typedef s32 compat_int_t;
38typedef s32 compat_long_t;
39typedef u32 compat_uint_t;
40typedef u32 compat_ulong_t;
41
42struct compat_timespec {
43 compat_time_t tv_sec;
44 s32 tv_nsec;
45};
46
47struct compat_timeval {
48 compat_time_t tv_sec;
49 s32 tv_usec;
50};
51
52struct compat_stat {
53 compat_dev_t st_dev;
54 s32 st_pad1[3];
55 compat_ino_t st_ino;
56 compat_mode_t st_mode;
57 compat_nlink_t st_nlink;
4ee1303a
RB
58 __compat_uid_t st_uid;
59 __compat_gid_t st_gid;
1da177e4
LT
60 compat_dev_t st_rdev;
61 s32 st_pad2[2];
62 compat_off_t st_size;
63 s32 st_pad3;
64 compat_time_t st_atime;
65 s32 st_atime_nsec;
66 compat_time_t st_mtime;
67 s32 st_mtime_nsec;
68 compat_time_t st_ctime;
69 s32 st_ctime_nsec;
70 s32 st_blksize;
71 s32 st_blocks;
72 s32 st_pad4[14];
73};
74
75struct compat_flock {
76 short l_type;
77 short l_whence;
78 compat_off_t l_start;
79 compat_off_t l_len;
80 s32 l_sysid;
81 compat_pid_t l_pid;
82 short __unused;
83 s32 pad[4];
84};
85
86#define F_GETLK64 33
87#define F_SETLK64 34
88#define F_SETLKW64 35
89
90struct compat_flock64 {
91 short l_type;
92 short l_whence;
93 compat_loff_t l_start;
94 compat_loff_t l_len;
95 compat_pid_t l_pid;
96};
97
98struct compat_statfs {
99 int f_type;
100 int f_bsize;
101 int f_frsize;
102 int f_blocks;
103 int f_bfree;
104 int f_files;
105 int f_ffree;
106 int f_bavail;
107 compat_fsid_t f_fsid;
108 int f_namelen;
109 int f_spare[6];
110};
111
112#define COMPAT_RLIM_INFINITY 0x7fffffffUL
113
114typedef u32 compat_old_sigset_t; /* at least 32 bits */
115
116#define _COMPAT_NSIG 128 /* Don't ask !$@#% ... */
117#define _COMPAT_NSIG_BPW 32
118
119typedef u32 compat_sigset_word;
120
121#define COMPAT_OFF_T_MAX 0x7fffffff
122#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
123
124/*
125 * A pointer passed in from user mode. This should not
126 * be used for syscall parameters, just declare them
127 * as pointers because the syscall entry code will have
128 * appropriately comverted them already.
129 */
130typedef u32 compat_uptr_t;
131
219ac73a 132static inline void __user *compat_ptr(compat_uptr_t uptr)
1da177e4 133{
219ac73a 134 return (void __user *)(long)uptr;
1da177e4
LT
135}
136
62ac285f
IM
137static inline compat_uptr_t ptr_to_compat(void __user *uptr)
138{
139 return (u32)(unsigned long)uptr;
140}
141
219ac73a 142static inline void __user *compat_alloc_user_space(long len)
1da177e4
LT
143{
144 struct pt_regs *regs = (struct pt_regs *)
145 ((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1;
146
219ac73a 147 return (void __user *) (regs->regs[29] - len);
1da177e4 148}
1da177e4 149
05e43966
AN
150struct compat_ipc64_perm {
151 compat_key_t key;
152 __compat_uid32_t uid;
153 __compat_gid32_t gid;
154 __compat_uid32_t cuid;
155 __compat_gid32_t cgid;
156 compat_mode_t mode;
157 unsigned short seq;
158 unsigned short __pad2;
159 compat_ulong_t __unused1;
160 compat_ulong_t __unused2;
161};
162
163struct compat_semid64_ds {
164 struct compat_ipc64_perm sem_perm;
165 compat_time_t sem_otime;
166 compat_time_t sem_ctime;
167 compat_ulong_t sem_nsems;
168 compat_ulong_t __unused1;
169 compat_ulong_t __unused2;
170};
171
172struct compat_msqid64_ds {
173 struct compat_ipc64_perm msg_perm;
174#ifndef CONFIG_CPU_LITTLE_ENDIAN
175 compat_ulong_t __unused1;
176#endif
177 compat_time_t msg_stime;
178#ifdef CONFIG_CPU_LITTLE_ENDIAN
179 compat_ulong_t __unused1;
180#endif
181#ifndef CONFIG_CPU_LITTLE_ENDIAN
182 compat_ulong_t __unused2;
183#endif
184 compat_time_t msg_rtime;
185#ifdef CONFIG_CPU_LITTLE_ENDIAN
186 compat_ulong_t __unused2;
187#endif
188#ifndef CONFIG_CPU_LITTLE_ENDIAN
189 compat_ulong_t __unused3;
190#endif
191 compat_time_t msg_ctime;
192#ifdef CONFIG_CPU_LITTLE_ENDIAN
193 compat_ulong_t __unused3;
194#endif
195 compat_ulong_t msg_cbytes;
196 compat_ulong_t msg_qnum;
197 compat_ulong_t msg_qbytes;
198 compat_pid_t msg_lspid;
199 compat_pid_t msg_lrpid;
200 compat_ulong_t __unused4;
201 compat_ulong_t __unused5;
202};
203
204struct compat_shmid64_ds {
205 struct compat_ipc64_perm shm_perm;
206 compat_size_t shm_segsz;
207 compat_time_t shm_atime;
208 compat_time_t shm_dtime;
209 compat_time_t shm_ctime;
210 compat_pid_t shm_cpid;
211 compat_pid_t shm_lpid;
212 compat_ulong_t shm_nattch;
213 compat_ulong_t __unused1;
214 compat_ulong_t __unused2;
215};
216
1da177e4 217#endif /* _ASM_COMPAT_H */