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