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