]>
Commit | Line | Data |
---|---|---|
31e31b8a FB |
1 | /* common syscall defines for all architectures */ |
2 | ||
2521d698 | 3 | /* Note: although the syscall numbers change between architectures, |
b4916d7b | 4 | most of them stay the same, so we handle it by putting ifdefs if |
2521d698 FB |
5 | necessary */ |
6 | ||
cb9c377f | 7 | #ifndef SYSCALL_DEFS_H |
1b3c4fdf | 8 | #define SYSCALL_DEFS_H |
cb9c377f | 9 | |
6180a181 | 10 | #include "syscall_nr.h" |
2521d698 | 11 | |
ff71a454 AM |
12 | |
13 | /* socket operations for socketcall() */ | |
14 | #define TARGET_SYS_SOCKET 1 /* socket() */ | |
15 | #define TARGET_SYS_BIND 2 /* bind() */ | |
16 | #define TARGET_SYS_CONNECT 3 /* connect() */ | |
17 | #define TARGET_SYS_LISTEN 4 /* listen() */ | |
18 | #define TARGET_SYS_ACCEPT 5 /* accept() */ | |
19 | #define TARGET_SYS_GETSOCKNAME 6 /* getsockname() */ | |
20 | #define TARGET_SYS_GETPEERNAME 7 /* getpeername() */ | |
21 | #define TARGET_SYS_SOCKETPAIR 8 /* socketpair() */ | |
22 | #define TARGET_SYS_SEND 9 /* send() */ | |
23 | #define TARGET_SYS_RECV 10 /* recv() */ | |
24 | #define TARGET_SYS_SENDTO 11 /* sendto() */ | |
25 | #define TARGET_SYS_RECVFROM 12 /* recvfrom() */ | |
26 | #define TARGET_SYS_SHUTDOWN 13 /* shutdown() */ | |
27 | #define TARGET_SYS_SETSOCKOPT 14 /* setsockopt() */ | |
28 | #define TARGET_SYS_GETSOCKOPT 15 /* getsockopt() */ | |
29 | #define TARGET_SYS_SENDMSG 16 /* sendmsg() */ | |
30 | #define TARGET_SYS_RECVMSG 17 /* recvmsg() */ | |
31 | #define TARGET_SYS_ACCEPT4 18 /* accept4() */ | |
32 | #define TARGET_SYS_RECVMMSG 19 /* recvmmsg() */ | |
33 | #define TARGET_SYS_SENDMMSG 20 /* sendmmsg() */ | |
31e31b8a | 34 | |
524fa340 | 35 | #define IPCOP_CALL(VERSION, OP) ((VERSION) << 16 | (OP)) |
8853f86e FB |
36 | #define IPCOP_semop 1 |
37 | #define IPCOP_semget 2 | |
38 | #define IPCOP_semctl 3 | |
39 | #define IPCOP_semtimedop 4 | |
40 | #define IPCOP_msgsnd 11 | |
41 | #define IPCOP_msgrcv 12 | |
42 | #define IPCOP_msgget 13 | |
43 | #define IPCOP_msgctl 14 | |
44 | #define IPCOP_shmat 21 | |
45 | #define IPCOP_shmdt 22 | |
46 | #define IPCOP_shmget 23 | |
47 | #define IPCOP_shmctl 24 | |
48 | ||
2521d698 FB |
49 | /* |
50 | * The following is for compatibility across the various Linux | |
51 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | |
52 | * a type field. De facto, however, the top 8 bits of the lower 16 | |
53 | * bits are indeed used as a type field, so we might just as well make | |
54 | * this explicit here. Please be sure to use the decoding macros | |
55 | * below from now on. | |
56 | */ | |
57 | #define TARGET_IOC_NRBITS 8 | |
58 | #define TARGET_IOC_TYPEBITS 8 | |
59 | ||
716f3fbe PM |
60 | #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ |
61 | || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ | |
cd98d390 | 62 | || defined(TARGET_SPARC) \ |
0c866a7e | 63 | || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) |
74d753ac MW |
64 | /* 16 bit uid wrappers emulation */ |
65 | #define USE_UID16 | |
0c866a7e RV |
66 | #define target_id uint16_t |
67 | #else | |
68 | #define target_id uint32_t | |
74d753ac MW |
69 | #endif |
70 | ||
e6e5906b | 71 | #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ |
b16189b2 | 72 | || defined(TARGET_M68K) || defined(TARGET_CRIS) \ |
daa4374a | 73 | || defined(TARGET_S390X) \ |
a0a839b6 | 74 | || defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) \ |
ba7651fb MF |
75 | || defined(TARGET_NIOS2) || defined(TARGET_RISCV) \ |
76 | || defined(TARGET_XTENSA) | |
2521d698 FB |
77 | |
78 | #define TARGET_IOC_SIZEBITS 14 | |
79 | #define TARGET_IOC_DIRBITS 2 | |
80 | ||
81 | #define TARGET_IOC_NONE 0U | |
82 | #define TARGET_IOC_WRITE 1U | |
83 | #define TARGET_IOC_READ 2U | |
84 | ||
048f6b4d | 85 | #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ |
b779e29e EI |
86 | defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \ |
87 | defined(TARGET_MIPS) | |
2521d698 FB |
88 | |
89 | #define TARGET_IOC_SIZEBITS 13 | |
90 | #define TARGET_IOC_DIRBITS 3 | |
91 | ||
92 | #define TARGET_IOC_NONE 1U | |
93 | #define TARGET_IOC_READ 2U | |
94 | #define TARGET_IOC_WRITE 4U | |
95 | ||
a10d1e50 RH |
96 | #elif defined(TARGET_HPPA) |
97 | ||
98 | #define TARGET_IOC_SIZEBITS 14 | |
99 | #define TARGET_IOC_DIRBITS 2 | |
100 | ||
101 | #define TARGET_IOC_NONE 0U | |
102 | #define TARGET_IOC_WRITE 2U | |
103 | #define TARGET_IOC_READ 1U | |
104 | ||
2521d698 FB |
105 | #else |
106 | #error unsupported CPU | |
107 | #endif | |
108 | ||
109 | #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) | |
110 | #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) | |
111 | #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) | |
112 | #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) | |
113 | ||
114 | #define TARGET_IOC_NRSHIFT 0 | |
115 | #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) | |
116 | #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) | |
117 | #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) | |
118 | ||
119 | #define TARGET_IOC(dir,type,nr,size) \ | |
120 | (((dir) << TARGET_IOC_DIRSHIFT) | \ | |
121 | ((type) << TARGET_IOC_TYPESHIFT) | \ | |
122 | ((nr) << TARGET_IOC_NRSHIFT) | \ | |
123 | ((size) << TARGET_IOC_SIZESHIFT)) | |
124 | ||
125 | /* used to create numbers */ | |
126 | #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) | |
127 | #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) | |
128 | #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) | |
129 | #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) | |
130 | ||
131 | /* the size is automatically computed for these defines */ | |
132 | #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) | |
133 | #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) | |
134 | #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) | |
135 | ||
7854b056 FB |
136 | struct target_sockaddr { |
137 | uint16_t sa_family; | |
138 | uint8_t sa_data[14]; | |
139 | }; | |
140 | ||
33a29b51 JT |
141 | struct target_sockaddr_ll { |
142 | uint16_t sll_family; /* Always AF_PACKET */ | |
143 | uint16_t sll_protocol; /* Physical layer protocol */ | |
144 | int sll_ifindex; /* Interface number */ | |
145 | uint16_t sll_hatype; /* ARP hardware type */ | |
146 | uint8_t sll_pkttype; /* Packet type */ | |
147 | uint8_t sll_halen; /* Length of address */ | |
148 | uint8_t sll_addr[8]; /* Physical layer address */ | |
149 | }; | |
150 | ||
fb3aabf3 LV |
151 | struct target_sockaddr_un { |
152 | uint16_t su_family; | |
153 | uint8_t sun_path[108]; | |
154 | }; | |
155 | ||
156 | struct target_in_addr { | |
157 | uint32_t s_addr; /* big endian */ | |
158 | }; | |
159 | ||
160 | struct target_sockaddr_in { | |
161 | uint16_t sin_family; | |
162 | int16_t sin_port; /* big endian */ | |
163 | struct target_in_addr sin_addr; | |
164 | uint8_t __pad[sizeof(struct target_sockaddr) - | |
165 | sizeof(uint16_t) - sizeof(int16_t) - | |
166 | sizeof(struct target_in_addr)]; | |
167 | }; | |
168 | ||
ee1ac3a1 HD |
169 | struct target_sockaddr_in6 { |
170 | uint16_t sin6_family; | |
171 | uint16_t sin6_port; /* big endian */ | |
172 | uint32_t sin6_flowinfo; /* big endian */ | |
173 | struct in6_addr sin6_addr; /* IPv6 address, big endian */ | |
174 | uint32_t sin6_scope_id; | |
175 | }; | |
176 | ||
f57d4192 LV |
177 | struct target_sock_filter { |
178 | abi_ushort code; | |
179 | uint8_t jt; | |
180 | uint8_t jf; | |
181 | abi_uint k; | |
182 | }; | |
183 | ||
184 | struct target_sock_fprog { | |
185 | abi_ushort len; | |
186 | abi_ulong filter; | |
187 | }; | |
188 | ||
b975b83b LL |
189 | struct target_ip_mreq { |
190 | struct target_in_addr imr_multiaddr; | |
191 | struct target_in_addr imr_address; | |
192 | }; | |
193 | ||
194 | struct target_ip_mreqn { | |
195 | struct target_in_addr imr_multiaddr; | |
196 | struct target_in_addr imr_address; | |
197 | abi_long imr_ifindex; | |
198 | }; | |
199 | ||
6e3cb58f LL |
200 | struct target_ip_mreq_source { |
201 | /* big endian */ | |
202 | uint32_t imr_multiaddr; | |
203 | uint32_t imr_interface; | |
204 | uint32_t imr_sourceaddr; | |
205 | }; | |
206 | ||
83eb6e50 CMAB |
207 | struct target_linger { |
208 | abi_int l_onoff; /* Linger active */ | |
209 | abi_int l_linger; /* How long to linger for */ | |
210 | }; | |
211 | ||
31e31b8a | 212 | struct target_timeval { |
992f48a0 BS |
213 | abi_long tv_sec; |
214 | abi_long tv_usec; | |
31e31b8a FB |
215 | }; |
216 | ||
1b6b029e | 217 | struct target_timespec { |
992f48a0 BS |
218 | abi_long tv_sec; |
219 | abi_long tv_nsec; | |
1b6b029e FB |
220 | }; |
221 | ||
ef4467e9 PB |
222 | struct target_timezone { |
223 | abi_int tz_minuteswest; | |
224 | abi_int tz_dsttime; | |
225 | }; | |
226 | ||
66fb9763 FB |
227 | struct target_itimerval { |
228 | struct target_timeval it_interval; | |
229 | struct target_timeval it_value; | |
230 | }; | |
231 | ||
905bba13 ECL |
232 | struct target_itimerspec { |
233 | struct target_timespec it_interval; | |
234 | struct target_timespec it_value; | |
235 | }; | |
236 | ||
19f59bce AM |
237 | struct target_timex { |
238 | abi_uint modes; /* Mode selector */ | |
239 | abi_long offset; /* Time offset */ | |
240 | abi_long freq; /* Frequency offset */ | |
241 | abi_long maxerror; /* Maximum error (microseconds) */ | |
242 | abi_long esterror; /* Estimated error (microseconds) */ | |
243 | abi_int status; /* Clock command/status */ | |
244 | abi_long constant; /* PLL (phase-locked loop) time constant */ | |
245 | abi_long precision; /* Clock precision (microseconds, ro) */ | |
246 | abi_long tolerance; /* Clock freq. tolerance (ppm, ro) */ | |
247 | struct target_timeval time; /* Current time */ | |
248 | abi_long tick; /* Microseconds between clock ticks */ | |
249 | abi_long ppsfreq; /* PPS (pulse per second) frequency */ | |
250 | abi_long jitter; /* PPS jitter (ro); nanoseconds */ | |
251 | abi_int shift; /* PPS interval duration (seconds) */ | |
252 | abi_long stabil; /* PPS stability */ | |
253 | abi_long jitcnt; /* PPS jitter limit exceeded (ro) */ | |
254 | abi_long calcnt; /* PPS calibration intervals */ | |
255 | abi_long errcnt; /* PPS calibration errors */ | |
256 | abi_long stbcnt; /* PPS stability limit exceeded */ | |
257 | abi_int tai; /* TAI offset */ | |
258 | ||
259 | /* Further padding bytes to allow for future expansion */ | |
260 | abi_int:32; abi_int:32; abi_int:32; abi_int:32; | |
261 | abi_int:32; abi_int:32; abi_int:32; abi_int:32; | |
262 | abi_int:32; abi_int:32; abi_int:32; | |
263 | }; | |
264 | ||
c227f099 | 265 | typedef abi_long target_clock_t; |
32f36bce | 266 | |
c596ed17 FB |
267 | #define TARGET_HZ 100 |
268 | ||
32f36bce | 269 | struct target_tms { |
c227f099 AL |
270 | target_clock_t tms_utime; |
271 | target_clock_t tms_stime; | |
272 | target_clock_t tms_cutime; | |
273 | target_clock_t tms_cstime; | |
32f36bce FB |
274 | }; |
275 | ||
6180a181 | 276 | struct target_utimbuf { |
992f48a0 BS |
277 | abi_long actime; |
278 | abi_long modtime; | |
6180a181 FB |
279 | }; |
280 | ||
f2674e31 | 281 | struct target_sel_arg_struct { |
992f48a0 BS |
282 | abi_long n; |
283 | abi_long inp, outp, exp; | |
284 | abi_long tvp; | |
f2674e31 FB |
285 | }; |
286 | ||
31e31b8a | 287 | struct target_iovec { |
992f48a0 BS |
288 | abi_long iov_base; /* Starting address */ |
289 | abi_long iov_len; /* Number of bytes */ | |
31e31b8a FB |
290 | }; |
291 | ||
1a9353d2 | 292 | struct target_msghdr { |
992f48a0 BS |
293 | abi_long msg_name; /* Socket name */ |
294 | int msg_namelen; /* Length of name */ | |
295 | abi_long msg_iov; /* Data blocks */ | |
296 | abi_long msg_iovlen; /* Number of blocks */ | |
297 | abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ | |
298 | abi_long msg_controllen; /* Length of cmsg list */ | |
1a9353d2 FB |
299 | unsigned int msg_flags; |
300 | }; | |
301 | ||
7854b056 | 302 | struct target_cmsghdr { |
992f48a0 | 303 | abi_long cmsg_len; |
7854b056 FB |
304 | int cmsg_level; |
305 | int cmsg_type; | |
306 | }; | |
307 | ||
308 | #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) | |
ee104587 JN |
309 | #define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \ |
310 | __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start) | |
992f48a0 BS |
311 | #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ |
312 | & (size_t) ~(sizeof (abi_long) - 1)) | |
ad762b99 PM |
313 | #define TARGET_CMSG_SPACE(len) (sizeof(struct target_cmsghdr) + \ |
314 | TARGET_CMSG_ALIGN(len)) | |
315 | #define TARGET_CMSG_LEN(len) (sizeof(struct target_cmsghdr) + (len)) | |
7854b056 FB |
316 | |
317 | static __inline__ struct target_cmsghdr * | |
ee104587 JN |
318 | __target_cmsg_nxthdr(struct target_msghdr *__mhdr, |
319 | struct target_cmsghdr *__cmsg, | |
320 | struct target_cmsghdr *__cmsg_start) | |
7854b056 | 321 | { |
2b8bdefc TS |
322 | struct target_cmsghdr *__ptr; |
323 | ||
324 | __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg | |
cbb21eed | 325 | + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len))); |
ee104587 JN |
326 | if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start) |
327 | > tswapal(__mhdr->msg_controllen)) { | |
7854b056 | 328 | /* No more entries. */ |
2b8bdefc | 329 | return (struct target_cmsghdr *)0; |
ee104587 JN |
330 | } |
331 | return __ptr; | |
7854b056 FB |
332 | } |
333 | ||
f19e00d7 AG |
334 | struct target_mmsghdr { |
335 | struct target_msghdr msg_hdr; /* Message header */ | |
336 | unsigned int msg_len; /* Number of bytes transmitted */ | |
337 | }; | |
7854b056 | 338 | |
31e31b8a FB |
339 | struct target_rusage { |
340 | struct target_timeval ru_utime; /* user time used */ | |
341 | struct target_timeval ru_stime; /* system time used */ | |
992f48a0 BS |
342 | abi_long ru_maxrss; /* maximum resident set size */ |
343 | abi_long ru_ixrss; /* integral shared memory size */ | |
344 | abi_long ru_idrss; /* integral unshared data size */ | |
345 | abi_long ru_isrss; /* integral unshared stack size */ | |
346 | abi_long ru_minflt; /* page reclaims */ | |
347 | abi_long ru_majflt; /* page faults */ | |
348 | abi_long ru_nswap; /* swaps */ | |
349 | abi_long ru_inblock; /* block input operations */ | |
350 | abi_long ru_oublock; /* block output operations */ | |
351 | abi_long ru_msgsnd; /* messages sent */ | |
352 | abi_long ru_msgrcv; /* messages received */ | |
353 | abi_long ru_nsignals; /* signals received */ | |
354 | abi_long ru_nvcsw; /* voluntary context switches */ | |
355 | abi_long ru_nivcsw; /* involuntary " */ | |
31e31b8a FB |
356 | }; |
357 | ||
358 | typedef struct { | |
359 | int val[2]; | |
c227f099 | 360 | } kernel_fsid_t; |
31e31b8a | 361 | |
dab2ed99 | 362 | struct target_dirent { |
333858b7 DL |
363 | abi_long d_ino; |
364 | abi_long d_off; | |
365 | unsigned short d_reclen; | |
366 | char d_name[]; | |
dab2ed99 FB |
367 | }; |
368 | ||
369 | struct target_dirent64 { | |
370 | uint64_t d_ino; | |
371 | int64_t d_off; | |
372 | unsigned short d_reclen; | |
373 | unsigned char d_type; | |
374 | char d_name[256]; | |
375 | }; | |
376 | ||
377 | ||
31e31b8a | 378 | /* mostly generic signal stuff */ |
992f48a0 BS |
379 | #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ |
380 | #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ | |
381 | #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ | |
31e31b8a FB |
382 | |
383 | #ifdef TARGET_MIPS | |
384 | #define TARGET_NSIG 128 | |
385 | #else | |
386 | #define TARGET_NSIG 64 | |
387 | #endif | |
992f48a0 | 388 | #define TARGET_NSIG_BPW TARGET_ABI_BITS |
31e31b8a FB |
389 | #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) |
390 | ||
391 | typedef struct { | |
992f48a0 | 392 | abi_ulong sig[TARGET_NSIG_WORDS]; |
c227f099 | 393 | } target_sigset_t; |
31e31b8a | 394 | |
66fb9763 | 395 | #ifdef BSWAP_NEEDED |
c227f099 | 396 | static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) |
66fb9763 FB |
397 | { |
398 | int i; | |
399 | for(i = 0;i < TARGET_NSIG_WORDS; i++) | |
cbb21eed | 400 | d->sig[i] = tswapal(s->sig[i]); |
66fb9763 FB |
401 | } |
402 | #else | |
c227f099 | 403 | static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) |
66fb9763 FB |
404 | { |
405 | *d = *s; | |
406 | } | |
407 | #endif | |
408 | ||
c227f099 | 409 | static inline void target_siginitset(target_sigset_t *d, abi_ulong set) |
66fb9763 FB |
410 | { |
411 | int i; | |
412 | d->sig[0] = set; | |
413 | for(i = 1;i < TARGET_NSIG_WORDS; i++) | |
414 | d->sig[i] = 0; | |
415 | } | |
416 | ||
c227f099 AL |
417 | void host_to_target_sigset(target_sigset_t *d, const sigset_t *s); |
418 | void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); | |
992f48a0 | 419 | void host_to_target_old_sigset(abi_ulong *old_sigset, |
66fb9763 | 420 | const sigset_t *sigset); |
5fafdf24 | 421 | void target_to_host_old_sigset(sigset_t *sigset, |
992f48a0 | 422 | const abi_ulong *old_sigset); |
66fb9763 FB |
423 | struct target_sigaction; |
424 | int do_sigaction(int sig, const struct target_sigaction *act, | |
425 | struct target_sigaction *oact); | |
426 | ||
9850f9f6 LV |
427 | #include "target_signal.h" |
428 | ||
7f047de1 RH |
429 | #ifdef TARGET_SA_RESTORER |
430 | #define TARGET_ARCH_HAS_SA_RESTORER 1 | |
431 | #endif | |
432 | ||
6049f4f8 RH |
433 | #if defined(TARGET_ALPHA) |
434 | struct target_old_sigaction { | |
435 | abi_ulong _sa_handler; | |
436 | abi_ulong sa_mask; | |
d2565875 | 437 | int32_t sa_flags; |
6049f4f8 RH |
438 | }; |
439 | ||
440 | struct target_rt_sigaction { | |
441 | abi_ulong _sa_handler; | |
442 | abi_ulong sa_flags; | |
443 | target_sigset_t sa_mask; | |
444 | }; | |
106ec879 | 445 | |
6049f4f8 RH |
446 | /* This is the struct used inside the kernel. The ka_restorer |
447 | field comes from the 5th argument to sys_rt_sigaction. */ | |
448 | struct target_sigaction { | |
449 | abi_ulong _sa_handler; | |
450 | abi_ulong sa_flags; | |
451 | target_sigset_t sa_mask; | |
452 | abi_ulong sa_restorer; | |
453 | }; | |
454 | #elif defined(TARGET_MIPS) | |
106ec879 | 455 | struct target_sigaction { |
540635ba | 456 | uint32_t sa_flags; |
d26bc211 | 457 | #if defined(TARGET_ABI_MIPSN32) |
540635ba TS |
458 | uint32_t _sa_handler; |
459 | #else | |
992f48a0 | 460 | abi_ulong _sa_handler; |
540635ba | 461 | #endif |
c227f099 | 462 | target_sigset_t sa_mask; |
7f047de1 RH |
463 | #ifdef TARGET_ARCH_HAS_SA_RESTORER |
464 | /* ??? This is always present, but ignored unless O32. */ | |
465 | abi_ulong sa_restorer; | |
466 | #endif | |
106ec879 | 467 | }; |
106ec879 | 468 | #else |
2521d698 | 469 | struct target_old_sigaction { |
992f48a0 BS |
470 | abi_ulong _sa_handler; |
471 | abi_ulong sa_mask; | |
472 | abi_ulong sa_flags; | |
7f047de1 | 473 | #ifdef TARGET_ARCH_HAS_SA_RESTORER |
992f48a0 | 474 | abi_ulong sa_restorer; |
7f047de1 | 475 | #endif |
2521d698 FB |
476 | }; |
477 | ||
478 | struct target_sigaction { | |
992f48a0 BS |
479 | abi_ulong _sa_handler; |
480 | abi_ulong sa_flags; | |
7f047de1 | 481 | #ifdef TARGET_ARCH_HAS_SA_RESTORER |
992f48a0 | 482 | abi_ulong sa_restorer; |
7f047de1 | 483 | #endif |
c227f099 | 484 | target_sigset_t sa_mask; |
5de154e8 LV |
485 | #ifdef TARGET_ARCH_HAS_KA_RESTORER |
486 | abi_ulong ka_restorer; | |
487 | #endif | |
2521d698 | 488 | }; |
106ec879 | 489 | #endif |
2521d698 FB |
490 | |
491 | typedef union target_sigval { | |
492 | int sival_int; | |
992f48a0 | 493 | abi_ulong sival_ptr; |
c227f099 | 494 | } target_sigval_t; |
6d5e216d FB |
495 | #if 0 |
496 | #if defined (TARGET_SPARC) | |
497 | typedef struct { | |
498 | struct { | |
992f48a0 BS |
499 | abi_ulong psr; |
500 | abi_ulong pc; | |
501 | abi_ulong npc; | |
502 | abi_ulong y; | |
503 | abi_ulong u_regs[16]; /* globals and ins */ | |
6d5e216d FB |
504 | } si_regs; |
505 | int si_mask; | |
506 | } __siginfo_t; | |
507 | ||
508 | typedef struct { | |
509 | unsigned long si_float_regs [32]; | |
510 | unsigned long si_fsr; | |
511 | unsigned long si_fpqdepth; | |
512 | struct { | |
513 | unsigned long *insn_addr; | |
514 | unsigned long insn; | |
515 | } si_fpqueue [16]; | |
516 | } __siginfo_fpu_t; | |
517 | #endif | |
518 | #endif | |
2521d698 FB |
519 | |
520 | #define TARGET_SI_MAX_SIZE 128 | |
aa5e03d2 MO |
521 | |
522 | #if TARGET_ABI_BITS == 32 | |
523 | #define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int)) | |
524 | #else | |
525 | #define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int)) | |
526 | #endif | |
527 | ||
528 | #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int)) | |
2521d698 | 529 | |
a70dadc7 PM |
530 | /* Within QEMU the top 16 bits of si_code indicate which of the parts of |
531 | * the union in target_siginfo is valid. This only applies between | |
532 | * host_to_target_siginfo_noswap() and tswap_siginfo(); it does not | |
533 | * appear either within host siginfo_t or in target_siginfo structures | |
534 | * which we get from the guest userspace program. (The Linux kernel | |
535 | * does a similar thing with using the top bits for its own internal | |
536 | * purposes but not letting them be visible to userspace.) | |
537 | */ | |
538 | #define QEMU_SI_KILL 0 | |
539 | #define QEMU_SI_TIMER 1 | |
540 | #define QEMU_SI_POLL 2 | |
541 | #define QEMU_SI_FAULT 3 | |
542 | #define QEMU_SI_CHLD 4 | |
543 | #define QEMU_SI_RT 5 | |
544 | ||
2521d698 | 545 | typedef struct target_siginfo { |
3f53d546 PB |
546 | #ifdef TARGET_MIPS |
547 | int si_signo; | |
548 | int si_code; | |
549 | int si_errno; | |
550 | #else | |
2521d698 FB |
551 | int si_signo; |
552 | int si_errno; | |
553 | int si_code; | |
3f53d546 | 554 | #endif |
2521d698 FB |
555 | |
556 | union { | |
557 | int _pad[TARGET_SI_PAD_SIZE]; | |
558 | ||
559 | /* kill() */ | |
560 | struct { | |
561 | pid_t _pid; /* sender's pid */ | |
562 | uid_t _uid; /* sender's uid */ | |
563 | } _kill; | |
564 | ||
565 | /* POSIX.1b timers */ | |
566 | struct { | |
567 | unsigned int _timer1; | |
568 | unsigned int _timer2; | |
569 | } _timer; | |
570 | ||
571 | /* POSIX.1b signals */ | |
572 | struct { | |
573 | pid_t _pid; /* sender's pid */ | |
574 | uid_t _uid; /* sender's uid */ | |
c227f099 | 575 | target_sigval_t _sigval; |
2521d698 FB |
576 | } _rt; |
577 | ||
578 | /* SIGCHLD */ | |
579 | struct { | |
580 | pid_t _pid; /* which child */ | |
581 | uid_t _uid; /* sender's uid */ | |
582 | int _status; /* exit code */ | |
c227f099 AL |
583 | target_clock_t _utime; |
584 | target_clock_t _stime; | |
2521d698 FB |
585 | } _sigchld; |
586 | ||
587 | /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ | |
588 | struct { | |
992f48a0 | 589 | abi_ulong _addr; /* faulting insn/memory ref. */ |
2521d698 FB |
590 | } _sigfault; |
591 | ||
592 | /* SIGPOLL */ | |
593 | struct { | |
594 | int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ | |
595 | int _fd; | |
596 | } _sigpoll; | |
597 | } _sifields; | |
c227f099 | 598 | } target_siginfo_t; |
2521d698 FB |
599 | |
600 | /* | |
601 | * si_code values | |
602 | * Digital reserves positive values for kernel-generated signals. | |
603 | */ | |
604 | #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ | |
605 | #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ | |
606 | #define TARGET_SI_QUEUE -1 /* sent by sigqueue */ | |
607 | #define TARGET_SI_TIMER -2 /* sent by timer expiration */ | |
608 | #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ | |
609 | #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ | |
610 | #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ | |
611 | ||
612 | /* | |
613 | * SIGILL si_codes | |
614 | */ | |
ffa65c3b | 615 | #define TARGET_ILL_ILLOPC (1) /* illegal opcode */ |
2521d698 | 616 | #define TARGET_ILL_ILLOPN (2) /* illegal operand */ |
ffa65c3b FB |
617 | #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ |
618 | #define TARGET_ILL_ILLTRP (4) /* illegal trap */ | |
619 | #define TARGET_ILL_PRVOPC (5) /* privileged opcode */ | |
620 | #define TARGET_ILL_PRVREG (6) /* privileged register */ | |
621 | #define TARGET_ILL_COPROC (7) /* coprocessor error */ | |
622 | #define TARGET_ILL_BADSTK (8) /* internal stack error */ | |
de2fdd56 CG |
623 | #ifdef TARGET_TILEGX |
624 | #define TARGET_ILL_DBLFLT (9) /* double fault */ | |
625 | #define TARGET_ILL_HARDWALL (10) /* user networks hardwall violation */ | |
626 | #endif | |
2521d698 FB |
627 | |
628 | /* | |
629 | * SIGFPE si_codes | |
630 | */ | |
631 | #define TARGET_FPE_INTDIV (1) /* integer divide by zero */ | |
632 | #define TARGET_FPE_INTOVF (2) /* integer overflow */ | |
633 | #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ | |
634 | #define TARGET_FPE_FLTOVF (4) /* floating point overflow */ | |
635 | #define TARGET_FPE_FLTUND (5) /* floating point underflow */ | |
636 | #define TARGET_FPE_FLTRES (6) /* floating point inexact result */ | |
637 | #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ | |
638 | #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ | |
21ba8564 RH |
639 | #define TARGET_FPE_FLTUNK (14) /* undiagnosed fp exception */ |
640 | #define TARGET_NSIGFPE 15 | |
2521d698 FB |
641 | |
642 | /* | |
643 | * SIGSEGV si_codes | |
644 | */ | |
645 | #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ | |
646 | #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ | |
de2fdd56 | 647 | #define TARGET_SEGV_BNDERR (3) /* failed address bound checks */ |
2521d698 | 648 | |
ffa65c3b FB |
649 | /* |
650 | * SIGBUS si_codes | |
651 | */ | |
652 | #define TARGET_BUS_ADRALN (1) /* invalid address alignment */ | |
b4916d7b | 653 | #define TARGET_BUS_ADRERR (2) /* non-existent physical address */ |
ffa65c3b | 654 | #define TARGET_BUS_OBJERR (3) /* object specific hardware error */ |
de2fdd56 CG |
655 | /* hardware memory error consumed on a machine check: action required */ |
656 | #define TARGET_BUS_MCEERR_AR (4) | |
657 | /* hardware memory error detected in process but not consumed: action optional*/ | |
658 | #define TARGET_BUS_MCEERR_AO (5) | |
ffa65c3b | 659 | |
2521d698 FB |
660 | /* |
661 | * SIGTRAP si_codes | |
662 | */ | |
663 | #define TARGET_TRAP_BRKPT (1) /* process breakpoint */ | |
664 | #define TARGET_TRAP_TRACE (2) /* process trace trap */ | |
de2fdd56 CG |
665 | #define TARGET_TRAP_BRANCH (3) /* process taken branch trap */ |
666 | #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */ | |
2521d698 | 667 | |
9de5e440 | 668 | struct target_rlimit { |
992f48a0 BS |
669 | abi_ulong rlim_cur; |
670 | abi_ulong rlim_max; | |
9de5e440 FB |
671 | }; |
672 | ||
81bbe906 | 673 | #if defined(TARGET_ALPHA) |
e476492e | 674 | #define TARGET_RLIM_INFINITY 0x7fffffffffffffffull |
6cafd027 | 675 | #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32) |
81bbe906 TY |
676 | #define TARGET_RLIM_INFINITY 0x7fffffffUL |
677 | #else | |
26b746db | 678 | #define TARGET_RLIM_INFINITY ((abi_ulong)-1) |
81bbe906 TY |
679 | #endif |
680 | ||
e22b7015 WT |
681 | #if defined(TARGET_MIPS) |
682 | #define TARGET_RLIMIT_CPU 0 | |
683 | #define TARGET_RLIMIT_FSIZE 1 | |
684 | #define TARGET_RLIMIT_DATA 2 | |
685 | #define TARGET_RLIMIT_STACK 3 | |
686 | #define TARGET_RLIMIT_CORE 4 | |
687 | #define TARGET_RLIMIT_RSS 7 | |
688 | #define TARGET_RLIMIT_NPROC 8 | |
689 | #define TARGET_RLIMIT_NOFILE 5 | |
690 | #define TARGET_RLIMIT_MEMLOCK 9 | |
691 | #define TARGET_RLIMIT_AS 6 | |
692 | #define TARGET_RLIMIT_LOCKS 10 | |
693 | #define TARGET_RLIMIT_SIGPENDING 11 | |
694 | #define TARGET_RLIMIT_MSGQUEUE 12 | |
695 | #define TARGET_RLIMIT_NICE 13 | |
696 | #define TARGET_RLIMIT_RTPRIO 14 | |
697 | #else | |
698 | #define TARGET_RLIMIT_CPU 0 | |
699 | #define TARGET_RLIMIT_FSIZE 1 | |
700 | #define TARGET_RLIMIT_DATA 2 | |
701 | #define TARGET_RLIMIT_STACK 3 | |
702 | #define TARGET_RLIMIT_CORE 4 | |
703 | #define TARGET_RLIMIT_RSS 5 | |
6cafd027 MB |
704 | #if defined(TARGET_SPARC) |
705 | #define TARGET_RLIMIT_NOFILE 6 | |
706 | #define TARGET_RLIMIT_NPROC 7 | |
707 | #else | |
e22b7015 WT |
708 | #define TARGET_RLIMIT_NPROC 6 |
709 | #define TARGET_RLIMIT_NOFILE 7 | |
6cafd027 | 710 | #endif |
e22b7015 WT |
711 | #define TARGET_RLIMIT_MEMLOCK 8 |
712 | #define TARGET_RLIMIT_AS 9 | |
713 | #define TARGET_RLIMIT_LOCKS 10 | |
714 | #define TARGET_RLIMIT_SIGPENDING 11 | |
715 | #define TARGET_RLIMIT_MSGQUEUE 12 | |
716 | #define TARGET_RLIMIT_NICE 13 | |
717 | #define TARGET_RLIMIT_RTPRIO 14 | |
718 | #endif | |
719 | ||
9de5e440 FB |
720 | struct target_pollfd { |
721 | int fd; /* file descriptor */ | |
722 | short events; /* requested events */ | |
723 | short revents; /* returned events */ | |
724 | }; | |
725 | ||
8e5a0667 | 726 | /* virtual terminal ioctls */ |
0221cfcd FB |
727 | #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ |
728 | #define TARGET_KDMKTONE 0x4B30 /* generate tone */ | |
8e5a0667 | 729 | #define TARGET_KDGKBTYPE 0x4b33 |
f7680a55 UH |
730 | #define TARGET_KDSETMODE 0x4b3a |
731 | #define TARGET_KDGKBMODE 0x4b44 | |
732 | #define TARGET_KDSKBMODE 0x4b45 | |
0221cfcd FB |
733 | #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ |
734 | #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ | |
e6fe18fb CV |
735 | #define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ |
736 | #define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ | |
737 | #define TARGET_KDGETLED 0x4B31 /* return current led state */ | |
738 | #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */ | |
ca56f5b5 | 739 | #define TARGET_KDSIGACCEPT 0x4B4E |
8e5a0667 | 740 | |
d14eabbe AM |
741 | #if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) || \ |
742 | defined(TARGET_XTENSA) | |
e1be1606 | 743 | #define TARGET_SIOCATMARK TARGET_IOR('s', 7, int) |
c495a793 | 744 | #define TARGET_SIOCSPGRP TARGET_IOW('s', 8, pid_t) |
405b4915 | 745 | #define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t) |
e1be1606 | 746 | #else |
2521d698 | 747 | #define TARGET_SIOCATMARK 0x8905 |
c495a793 | 748 | #define TARGET_SIOCSPGRP 0x8902 |
405b4915 | 749 | #define TARGET_SIOCGPGRP 0x8904 |
e1be1606 | 750 | #endif |
c495a793 | 751 | |
405b4915 HD |
752 | #define TARGET_SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ |
753 | #define TARGET_SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | |
2521d698 | 754 | |
31e31b8a FB |
755 | /* Networking ioctls */ |
756 | #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ | |
757 | #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ | |
758 | #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ | |
759 | #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ | |
760 | #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ | |
761 | #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ | |
762 | #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ | |
763 | #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ | |
764 | #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ | |
765 | #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ | |
766 | #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ | |
767 | #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ | |
768 | #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ | |
769 | #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ | |
770 | #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ | |
771 | #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ | |
772 | #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ | |
773 | #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ | |
774 | #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ | |
775 | #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ | |
776 | #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ | |
777 | #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ | |
778 | #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ | |
779 | #define TARGET_SIOCSIFENCAP 0x8926 | |
780 | #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ | |
781 | #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ | |
782 | #define TARGET_SIOCSIFSLAVE 0x8930 | |
783 | #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ | |
784 | #define TARGET_SIOCDELMULTI 0x8932 | |
f63eb01a | 785 | #define TARGET_SIOCGIFINDEX 0x8933 |
4bdcd79e NC |
786 | #define TARGET_SIOCSIFPFLAGS 0x8934 /* set extended flags */ |
787 | #define TARGET_SIOCGIFPFLAGS 0x8935 /* get extended flags */ | |
31e31b8a FB |
788 | |
789 | /* Bridging control calls */ | |
790 | #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ | |
791 | #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ | |
792 | ||
793 | #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ | |
794 | #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ | |
795 | ||
796 | /* ARP cache control calls. */ | |
797 | #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ | |
798 | #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ | |
799 | #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ | |
800 | #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ | |
801 | #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ | |
802 | #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ | |
803 | ||
804 | /* RARP cache control calls. */ | |
805 | #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ | |
806 | #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ | |
807 | #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ | |
808 | ||
809 | /* Driver configuration calls */ | |
810 | #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ | |
811 | #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ | |
812 | ||
813 | /* DLCI configuration calls */ | |
814 | #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ | |
815 | #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ | |
816 | ||
86fcd946 LV |
817 | /* From <linux/wireless.h> */ |
818 | ||
819 | #define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ | |
31e31b8a | 820 | |
d6d6d6fe MB |
821 | /* From <linux/random.h> */ |
822 | ||
823 | #define TARGET_RNDGETENTCNT TARGET_IOR('R', 0x00, int) | |
824 | #define TARGET_RNDADDTOENTCNT TARGET_IOW('R', 0x01, int) | |
825 | #define TARGET_RNDZAPENTCNT TARGET_IO('R', 0x04) | |
826 | #define TARGET_RNDCLEARPOOL TARGET_IO('R', 0x06) | |
827 | ||
31e31b8a FB |
828 | /* From <linux/fs.h> */ |
829 | ||
830 | #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ | |
831 | #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ | |
832 | #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ | |
833 | #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ | |
834 | #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ | |
835 | #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ | |
836 | #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ | |
837 | #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ | |
838 | #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ | |
839 | #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ | |
840 | #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ | |
841 | #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ | |
fff8c539 | 842 | #define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */ |
31e31b8a | 843 | /* A jump here: 108-111 have been used for various private purposes. */ |
c8b0bf54 PM |
844 | #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong) |
845 | #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong) | |
edafea13 AG |
846 | #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) |
847 | /* return device size in bytes | |
848 | (u64 *arg) */ | |
4715856a PM |
849 | |
850 | #define TARGET_BLKDISCARD TARGET_IO(0x12, 119) | |
851 | #define TARGET_BLKIOMIN TARGET_IO(0x12, 120) | |
852 | #define TARGET_BLKIOOPT TARGET_IO(0x12, 121) | |
853 | #define TARGET_BLKALIGNOFF TARGET_IO(0x12, 122) | |
854 | #define TARGET_BLKPBSZGET TARGET_IO(0x12, 123) | |
855 | #define TARGET_BLKDISCARDZEROES TARGET_IO(0x12, 124) | |
856 | #define TARGET_BLKSECDISCARD TARGET_IO(0x12, 125) | |
857 | #define TARGET_BLKROTATIONAL TARGET_IO(0x12, 126) | |
858 | #define TARGET_BLKZEROOUT TARGET_IO(0x12, 127) | |
859 | ||
31e31b8a FB |
860 | #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ |
861 | #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ | |
21992cb6 HD |
862 | |
863 | #define TARGET_FICLONE TARGET_IOW(0x94, 9, int) | |
864 | #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range) | |
865 | ||
60807231 PM |
866 | /* Note that the ioctl numbers claim type "long" but the actual type |
867 | * used by the kernel is "int". | |
868 | */ | |
1847b7ba PM |
869 | #define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, abi_long) |
870 | #define TARGET_FS_IOC_SETFLAGS TARGET_IOW('f', 2, abi_long) | |
60807231 | 871 | |
285da2b9 | 872 | #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) |
31e31b8a | 873 | |
6c753a63 CT |
874 | /* usb ioctls */ |
875 | #define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0) | |
876 | #define TARGET_USBDEVFS_BULK TARGET_IOWRU('U', 2) | |
877 | #define TARGET_USBDEVFS_RESETEP TARGET_IORU('U', 3) | |
878 | #define TARGET_USBDEVFS_SETINTERFACE TARGET_IORU('U', 4) | |
879 | #define TARGET_USBDEVFS_SETCONFIGURATION TARGET_IORU('U', 5) | |
880 | #define TARGET_USBDEVFS_GETDRIVER TARGET_IOWU('U', 8) | |
a133367e CT |
881 | #define TARGET_USBDEVFS_SUBMITURB TARGET_IORU('U', 10) |
882 | #define TARGET_USBDEVFS_DISCARDURB TARGET_IO('U', 11) | |
883 | #define TARGET_USBDEVFS_REAPURB TARGET_IOWU('U', 12) | |
884 | #define TARGET_USBDEVFS_REAPURBNDELAY TARGET_IOWU('U', 13) | |
6c753a63 CT |
885 | #define TARGET_USBDEVFS_DISCSIGNAL TARGET_IORU('U', 14) |
886 | #define TARGET_USBDEVFS_CLAIMINTERFACE TARGET_IORU('U', 15) | |
887 | #define TARGET_USBDEVFS_RELEASEINTERFACE TARGET_IORU('U', 16) | |
888 | #define TARGET_USBDEVFS_CONNECTINFO TARGET_IOWU('U', 17) | |
889 | #define TARGET_USBDEVFS_IOCTL TARGET_IOWRU('U', 18) | |
890 | #define TARGET_USBDEVFS_HUB_PORTINFO TARGET_IORU('U', 19) | |
891 | #define TARGET_USBDEVFS_RESET TARGET_IO('U', 20) | |
892 | #define TARGET_USBDEVFS_CLEAR_HALT TARGET_IORU('U', 21) | |
893 | #define TARGET_USBDEVFS_DISCONNECT TARGET_IO('U', 22) | |
894 | #define TARGET_USBDEVFS_CONNECT TARGET_IO('U', 23) | |
895 | #define TARGET_USBDEVFS_CLAIM_PORT TARGET_IORU('U', 24) | |
896 | #define TARGET_USBDEVFS_RELEASE_PORT TARGET_IORU('U', 25) | |
897 | #define TARGET_USBDEVFS_GET_CAPABILITIES TARGET_IORU('U', 26) | |
898 | #define TARGET_USBDEVFS_DISCONNECT_CLAIM TARGET_IORU('U', 27) | |
899 | #define TARGET_USBDEVFS_DROP_PRIVILEGES TARGET_IOWU('U', 30) | |
900 | #define TARGET_USBDEVFS_GET_SPEED TARGET_IO('U', 31) | |
901 | ||
31e31b8a | 902 | /* cdrom commands */ |
5fafdf24 | 903 | #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ |
31e31b8a FB |
904 | #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ |
905 | #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ | |
5fafdf24 | 906 | #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index |
31e31b8a | 907 | (struct cdrom_ti) */ |
5fafdf24 | 908 | #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header |
31e31b8a | 909 | (struct cdrom_tochdr) */ |
5fafdf24 | 910 | #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry |
31e31b8a FB |
911 | (struct cdrom_tocentry) */ |
912 | #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ | |
913 | #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ | |
914 | #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ | |
5fafdf24 | 915 | #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume |
31e31b8a | 916 | (struct cdrom_volctrl) */ |
5fafdf24 | 917 | #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data |
31e31b8a | 918 | (struct cdrom_subchnl) */ |
5fafdf24 | 919 | #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) |
31e31b8a FB |
920 | (struct cdrom_read) */ |
921 | #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) | |
922 | (struct cdrom_read) */ | |
923 | #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ | |
924 | #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ | |
5fafdf24 TS |
925 | #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session |
926 | address of multi session disks | |
31e31b8a | 927 | (struct cdrom_multisession) */ |
5fafdf24 | 928 | #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" |
31e31b8a | 929 | if available (struct cdrom_mcn) */ |
67cc32eb | 930 | #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is deprecated, |
b4916d7b | 931 | but here anyway for compatibility */ |
31e31b8a | 932 | #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ |
5fafdf24 | 933 | #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting |
31e31b8a FB |
934 | (struct cdrom_volctrl) */ |
935 | #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) | |
936 | (struct cdrom_read) */ | |
5fafdf24 | 937 | /* |
31e31b8a FB |
938 | * These ioctls are used only used in aztcd.c and optcd.c |
939 | */ | |
940 | #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ | |
941 | #define TARGET_CDROMSEEK 0x5316 /* seek msf address */ | |
3b46e624 | 942 | |
31e31b8a | 943 | /* |
3b46e624 | 944 | * This ioctl is only used by the scsi-cd driver. |
31e31b8a FB |
945 | It is for playing audio in logical block addressing mode. |
946 | */ | |
947 | #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ | |
948 | ||
5fafdf24 | 949 | /* |
31e31b8a FB |
950 | * These ioctls are only used in optcd.c |
951 | */ | |
952 | #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ | |
953 | ||
5fafdf24 TS |
954 | /* |
955 | * These ioctls are (now) only in ide-cd.c for controlling | |
31e31b8a FB |
956 | * drive spindown time. They should be implemented in the |
957 | * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, | |
958 | * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... | |
959 | * -Erik | |
960 | */ | |
961 | #define TARGET_CDROMGETSPINDOWN 0x531d | |
962 | #define TARGET_CDROMSETSPINDOWN 0x531e | |
963 | ||
5fafdf24 | 964 | /* |
31e31b8a FB |
965 | * These ioctls are implemented through the uniform CD-ROM driver |
966 | * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM | |
967 | * drivers are eventually ported to the uniform CD-ROM driver interface. | |
968 | */ | |
969 | #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ | |
970 | #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ | |
971 | #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ | |
972 | #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ | |
973 | #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ | |
974 | #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ | |
975 | #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ | |
976 | #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ | |
977 | #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ | |
978 | #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ | |
979 | #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ | |
980 | #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ | |
981 | ||
982 | /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. | |
983 | * Future CDROM ioctls should be kept below 0x537F | |
984 | */ | |
985 | ||
986 | /* This ioctl is only used by sbpcd at the moment */ | |
987 | #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ | |
988 | /* conflict with SCSI_IOCTL_GET_IDLUN */ | |
989 | ||
990 | /* DVD-ROM Specific ioctls */ | |
991 | #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ | |
992 | #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ | |
993 | #define TARGET_DVD_AUTH 0x5392 /* Authentication */ | |
994 | ||
995 | #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ | |
996 | #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ | |
997 | #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ | |
998 | ||
999 | /* HD commands */ | |
1000 | ||
1001 | /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ | |
1002 | #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ | |
1003 | #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ | |
1004 | #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ | |
31e31b8a FB |
1005 | #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ |
1006 | #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ | |
1007 | #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ | |
1008 | #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ | |
2521d698 | 1009 | #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ |
31e31b8a FB |
1010 | #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ |
1011 | ||
1012 | /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ | |
1013 | #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ | |
1014 | #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ | |
1015 | #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ | |
1016 | #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ | |
1017 | #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ | |
1018 | #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ | |
1019 | #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ | |
2521d698 | 1020 | |
b8005914 AZ |
1021 | /* loop ioctls */ |
1022 | #define TARGET_LOOP_SET_FD 0x4C00 | |
1023 | #define TARGET_LOOP_CLR_FD 0x4C01 | |
1024 | #define TARGET_LOOP_SET_STATUS 0x4C02 | |
1025 | #define TARGET_LOOP_GET_STATUS 0x4C03 | |
1026 | #define TARGET_LOOP_SET_STATUS64 0x4C04 | |
1027 | #define TARGET_LOOP_GET_STATUS64 0x4C05 | |
1028 | #define TARGET_LOOP_CHANGE_FD 0x4C06 | |
2521d698 | 1029 | |
884cdc48 PM |
1030 | #define TARGET_LOOP_CTL_ADD 0x4C80 |
1031 | #define TARGET_LOOP_CTL_REMOVE 0x4C81 | |
1032 | #define TARGET_LOOP_CTL_GET_FREE 0x4C82 | |
1033 | ||
f7680a55 UH |
1034 | /* fb ioctls */ |
1035 | #define TARGET_FBIOGET_VSCREENINFO 0x4600 | |
1036 | #define TARGET_FBIOPUT_VSCREENINFO 0x4601 | |
1037 | #define TARGET_FBIOGET_FSCREENINFO 0x4602 | |
12b81b71 CV |
1038 | #define TARGET_FBIOGETCMAP 0x4604 |
1039 | #define TARGET_FBIOPUTCMAP 0x4605 | |
1040 | #define TARGET_FBIOPAN_DISPLAY 0x4606 | |
1041 | #define TARGET_FBIOGET_CON2FBMAP 0x460F | |
1042 | #define TARGET_FBIOPUT_CON2FBMAP 0x4610 | |
f7680a55 UH |
1043 | |
1044 | /* vt ioctls */ | |
1045 | #define TARGET_VT_OPENQRY 0x5600 | |
1046 | #define TARGET_VT_GETSTATE 0x5603 | |
1047 | #define TARGET_VT_ACTIVATE 0x5606 | |
1048 | #define TARGET_VT_WAITACTIVE 0x5607 | |
1049 | #define TARGET_VT_LOCKSWITCH 0x560b | |
1050 | #define TARGET_VT_UNLOCKSWITCH 0x560c | |
774750c0 CV |
1051 | #define TARGET_VT_GETMODE 0x5601 |
1052 | #define TARGET_VT_SETMODE 0x5602 | |
1053 | #define TARGET_VT_RELDISP 0x5605 | |
1054 | #define TARGET_VT_DISALLOCATE 0x5608 | |
f7680a55 | 1055 | |
56e904ec AG |
1056 | /* device mapper */ |
1057 | #define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00) | |
1058 | #define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01) | |
1059 | #define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02) | |
1060 | #define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03) | |
1061 | #define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04) | |
1062 | #define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05) | |
1063 | #define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06) | |
1064 | #define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07) | |
1065 | #define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08) | |
1066 | #define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09) | |
1067 | #define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a) | |
1068 | #define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b) | |
1069 | #define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c) | |
1070 | #define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d) | |
1071 | #define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e) | |
1072 | #define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f) | |
1073 | ||
2521d698 FB |
1074 | /* from asm/termbits.h */ |
1075 | ||
3bfd9da1 FB |
1076 | #define TARGET_NCC 8 |
1077 | struct target_termio { | |
1078 | unsigned short c_iflag; /* input mode flags */ | |
1079 | unsigned short c_oflag; /* output mode flags */ | |
1080 | unsigned short c_cflag; /* control mode flags */ | |
1081 | unsigned short c_lflag; /* local mode flags */ | |
1082 | unsigned char c_line; /* line discipline */ | |
1083 | unsigned char c_cc[TARGET_NCC]; /* control characters */ | |
1084 | }; | |
2521d698 | 1085 | |
3bfd9da1 FB |
1086 | struct target_winsize { |
1087 | unsigned short ws_row; | |
1088 | unsigned short ws_col; | |
1089 | unsigned short ws_xpixel; | |
1090 | unsigned short ws_ypixel; | |
2521d698 FB |
1091 | }; |
1092 | ||
3bfd9da1 | 1093 | #include "termbits.h" |
2521d698 | 1094 | |
9e0b74a4 PB |
1095 | #if defined(TARGET_MIPS) |
1096 | #define TARGET_PROT_SEM 0x10 | |
1097 | #else | |
1098 | #define TARGET_PROT_SEM 0x08 | |
1099 | #endif | |
1100 | ||
e44a3e79 | 1101 | /* Common */ |
2521d698 FB |
1102 | #define TARGET_MAP_SHARED 0x01 /* Share changes */ |
1103 | #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ | |
e65be6a7 HD |
1104 | #if defined(TARGET_HPPA) |
1105 | #define TARGET_MAP_TYPE 0x03 /* Mask for type of mapping */ | |
1106 | #else | |
1107 | #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ | |
1108 | #endif | |
e44a3e79 AJ |
1109 | |
1110 | /* Target specific */ | |
048f6b4d | 1111 | #if defined(TARGET_MIPS) |
e44a3e79 | 1112 | #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ |
048f6b4d FB |
1113 | #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ |
1114 | #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ | |
1115 | #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ | |
1116 | #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ | |
1117 | #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ | |
1118 | #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ | |
540635ba TS |
1119 | #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ |
1120 | #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ | |
541e1690 HD |
1121 | #define TARGET_MAP_STACK 0x40000 /* ignored */ |
1122 | #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ | |
e44a3e79 AJ |
1123 | #elif defined(TARGET_PPC) |
1124 | #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ | |
2521d698 | 1125 | #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ |
2521d698 FB |
1126 | #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ |
1127 | #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ | |
1128 | #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ | |
7ec93196 JM |
1129 | #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ |
1130 | #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ | |
e44a3e79 AJ |
1131 | #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
1132 | #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ | |
541e1690 HD |
1133 | #define TARGET_MAP_STACK 0x20000 /* ignored */ |
1134 | #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ | |
e44a3e79 AJ |
1135 | #elif defined(TARGET_ALPHA) |
1136 | #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ | |
1137 | #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ | |
1138 | #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ | |
1139 | #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ | |
1140 | #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ | |
1141 | #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ | |
1142 | #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ | |
1143 | #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ | |
1144 | #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ | |
541e1690 HD |
1145 | #define TARGET_MAP_STACK 0x80000 /* ignored */ |
1146 | #define TARGET_MAP_HUGETLB 0x100000 /* create a huge page mapping */ | |
a10d1e50 RH |
1147 | #elif defined(TARGET_HPPA) |
1148 | #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ | |
1149 | #define TARGET_MAP_FIXED 0x04 /* Interpret addr exactly */ | |
1150 | #define TARGET_MAP_GROWSDOWN 0x08000 /* stack-like segment */ | |
1151 | #define TARGET_MAP_DENYWRITE 0x00800 /* ETXTBSY */ | |
1152 | #define TARGET_MAP_EXECUTABLE 0x01000 /* mark it as an executable */ | |
1153 | #define TARGET_MAP_LOCKED 0x02000 /* lock the mapping */ | |
1154 | #define TARGET_MAP_NORESERVE 0x04000 /* no check for reservations */ | |
1155 | #define TARGET_MAP_POPULATE 0x10000 /* pop (prefault) pagetables */ | |
1156 | #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ | |
541e1690 HD |
1157 | #define TARGET_MAP_STACK 0x40000 /* ignored */ |
1158 | #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ | |
ba7651fb MF |
1159 | #elif defined(TARGET_XTENSA) |
1160 | #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ | |
1161 | #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ | |
1162 | #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ | |
1163 | #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ | |
1164 | #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ | |
1165 | #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ | |
1166 | #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ | |
1167 | #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ | |
1168 | #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ | |
1169 | #define TARGET_MAP_STACK 0x40000 | |
1170 | #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ | |
7ec93196 | 1171 | #else |
e44a3e79 AJ |
1172 | #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ |
1173 | #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ | |
1174 | #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ | |
1175 | #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ | |
1176 | #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ | |
2521d698 FB |
1177 | #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ |
1178 | #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ | |
540635ba TS |
1179 | #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
1180 | #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ | |
541e1690 HD |
1181 | #define TARGET_MAP_STACK 0x20000 /* ignored */ |
1182 | #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ | |
906c1b8e | 1183 | #define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ |
7ec93196 | 1184 | #endif |
2521d698 | 1185 | |
09701199 AG |
1186 | #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ |
1187 | || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ | |
daa4374a | 1188 | || defined(TARGET_CRIS) |
5f992db6 | 1189 | #define TARGET_STAT_HAVE_NSEC |
2521d698 FB |
1190 | struct target_stat { |
1191 | unsigned short st_dev; | |
1192 | unsigned short __pad1; | |
992f48a0 | 1193 | abi_ulong st_ino; |
2521d698 FB |
1194 | unsigned short st_mode; |
1195 | unsigned short st_nlink; | |
1196 | unsigned short st_uid; | |
1197 | unsigned short st_gid; | |
1198 | unsigned short st_rdev; | |
1199 | unsigned short __pad2; | |
992f48a0 BS |
1200 | abi_ulong st_size; |
1201 | abi_ulong st_blksize; | |
1202 | abi_ulong st_blocks; | |
1203 | abi_ulong target_st_atime; | |
5f992db6 | 1204 | abi_ulong target_st_atime_nsec; |
992f48a0 | 1205 | abi_ulong target_st_mtime; |
5f992db6 | 1206 | abi_ulong target_st_mtime_nsec; |
992f48a0 | 1207 | abi_ulong target_st_ctime; |
5f992db6 | 1208 | abi_ulong target_st_ctime_nsec; |
992f48a0 BS |
1209 | abi_ulong __unused4; |
1210 | abi_ulong __unused5; | |
2521d698 FB |
1211 | }; |
1212 | ||
1213 | /* This matches struct stat64 in glibc2.1, hence the absolutely | |
1214 | * insane amounts of padding around dev_t's. | |
1215 | */ | |
20d155bc | 1216 | #define TARGET_HAS_STRUCT_STAT64 |
2521d698 FB |
1217 | struct target_stat64 { |
1218 | unsigned short st_dev; | |
1219 | unsigned char __pad0[10]; | |
1220 | ||
1221 | #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 | |
992f48a0 | 1222 | abi_ulong __st_ino; |
2521d698 FB |
1223 | |
1224 | unsigned int st_mode; | |
1225 | unsigned int st_nlink; | |
1226 | ||
992f48a0 BS |
1227 | abi_ulong st_uid; |
1228 | abi_ulong st_gid; | |
2521d698 FB |
1229 | |
1230 | unsigned short st_rdev; | |
1231 | unsigned char __pad3[10]; | |
1232 | ||
1233 | long long st_size; | |
992f48a0 | 1234 | abi_ulong st_blksize; |
2521d698 | 1235 | |
992f48a0 BS |
1236 | abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ |
1237 | abi_ulong __pad4; /* future possible st_blocks high bits */ | |
2521d698 | 1238 | |
992f48a0 | 1239 | abi_ulong target_st_atime; |
5f992db6 | 1240 | abi_ulong target_st_atime_nsec; |
2521d698 | 1241 | |
992f48a0 | 1242 | abi_ulong target_st_mtime; |
5f992db6 | 1243 | abi_ulong target_st_mtime_nsec; |
2521d698 | 1244 | |
992f48a0 | 1245 | abi_ulong target_st_ctime; |
5f992db6 | 1246 | abi_ulong target_st_ctime_nsec; |
2521d698 FB |
1247 | |
1248 | unsigned long long st_ino; | |
541dc0d4 | 1249 | } QEMU_PACKED; |
2521d698 | 1250 | |
ce4defa0 | 1251 | #ifdef TARGET_ARM |
20d155bc | 1252 | #define TARGET_HAS_STRUCT_STAT64 |
ce4defa0 PB |
1253 | struct target_eabi_stat64 { |
1254 | unsigned long long st_dev; | |
1255 | unsigned int __pad1; | |
992f48a0 | 1256 | abi_ulong __st_ino; |
ce4defa0 PB |
1257 | unsigned int st_mode; |
1258 | unsigned int st_nlink; | |
1259 | ||
992f48a0 BS |
1260 | abi_ulong st_uid; |
1261 | abi_ulong st_gid; | |
ce4defa0 PB |
1262 | |
1263 | unsigned long long st_rdev; | |
1264 | unsigned int __pad2[2]; | |
1265 | ||
1266 | long long st_size; | |
992f48a0 | 1267 | abi_ulong st_blksize; |
ce4defa0 PB |
1268 | unsigned int __pad3; |
1269 | unsigned long long st_blocks; | |
1270 | ||
992f48a0 BS |
1271 | abi_ulong target_st_atime; |
1272 | abi_ulong target_st_atime_nsec; | |
ce4defa0 | 1273 | |
992f48a0 BS |
1274 | abi_ulong target_st_mtime; |
1275 | abi_ulong target_st_mtime_nsec; | |
ce4defa0 | 1276 | |
992f48a0 BS |
1277 | abi_ulong target_st_ctime; |
1278 | abi_ulong target_st_ctime_nsec; | |
ce4defa0 PB |
1279 | |
1280 | unsigned long long st_ino; | |
541dc0d4 | 1281 | } QEMU_PACKED; |
ce4defa0 PB |
1282 | #endif |
1283 | ||
992f48a0 | 1284 | #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) |
1b8dd648 BS |
1285 | struct target_stat { |
1286 | unsigned int st_dev; | |
992f48a0 | 1287 | abi_ulong st_ino; |
1b8dd648 BS |
1288 | unsigned int st_mode; |
1289 | unsigned int st_nlink; | |
1290 | unsigned int st_uid; | |
1291 | unsigned int st_gid; | |
1292 | unsigned int st_rdev; | |
992f48a0 BS |
1293 | abi_long st_size; |
1294 | abi_long target_st_atime; | |
1295 | abi_long target_st_mtime; | |
1296 | abi_long target_st_ctime; | |
1297 | abi_long st_blksize; | |
1298 | abi_long st_blocks; | |
1299 | abi_ulong __unused4[2]; | |
1b8dd648 BS |
1300 | }; |
1301 | ||
20d155bc | 1302 | #define TARGET_HAS_STRUCT_STAT64 |
1b8dd648 BS |
1303 | struct target_stat64 { |
1304 | unsigned char __pad0[6]; | |
1305 | unsigned short st_dev; | |
1306 | ||
1307 | uint64_t st_ino; | |
1308 | uint64_t st_nlink; | |
1309 | ||
1310 | unsigned int st_mode; | |
1311 | ||
1312 | unsigned int st_uid; | |
1313 | unsigned int st_gid; | |
1314 | ||
1315 | unsigned char __pad2[6]; | |
1316 | unsigned short st_rdev; | |
1317 | ||
1318 | int64_t st_size; | |
1319 | int64_t st_blksize; | |
1320 | ||
1321 | unsigned char __pad4[4]; | |
1322 | unsigned int st_blocks; | |
1323 | ||
992f48a0 | 1324 | abi_ulong target_st_atime; |
5f992db6 | 1325 | abi_ulong target_st_atime_nsec; |
1b8dd648 | 1326 | |
992f48a0 | 1327 | abi_ulong target_st_mtime; |
5f992db6 | 1328 | abi_ulong target_st_mtime_nsec; |
1b8dd648 | 1329 | |
992f48a0 | 1330 | abi_ulong target_st_ctime; |
5f992db6 | 1331 | abi_ulong target_st_ctime_nsec; |
1b8dd648 | 1332 | |
992f48a0 | 1333 | abi_ulong __unused4[3]; |
1b8dd648 BS |
1334 | }; |
1335 | ||
3bfd9da1 FB |
1336 | #elif defined(TARGET_SPARC) |
1337 | ||
5f992db6 | 1338 | #define TARGET_STAT_HAVE_NSEC |
3bfd9da1 FB |
1339 | struct target_stat { |
1340 | unsigned short st_dev; | |
992f48a0 | 1341 | abi_ulong st_ino; |
3bfd9da1 FB |
1342 | unsigned short st_mode; |
1343 | short st_nlink; | |
1344 | unsigned short st_uid; | |
1345 | unsigned short st_gid; | |
1346 | unsigned short st_rdev; | |
992f48a0 BS |
1347 | abi_long st_size; |
1348 | abi_long target_st_atime; | |
5f992db6 | 1349 | abi_ulong target_st_atime_nsec; |
992f48a0 | 1350 | abi_long target_st_mtime; |
5f992db6 | 1351 | abi_ulong target_st_mtime_nsec; |
992f48a0 | 1352 | abi_long target_st_ctime; |
5f992db6 | 1353 | abi_ulong target_st_ctime_nsec; |
992f48a0 BS |
1354 | abi_long st_blksize; |
1355 | abi_long st_blocks; | |
5f992db6 | 1356 | abi_ulong __unused1[2]; |
3bfd9da1 FB |
1357 | }; |
1358 | ||
20d155bc | 1359 | #define TARGET_HAS_STRUCT_STAT64 |
3bfd9da1 FB |
1360 | struct target_stat64 { |
1361 | unsigned char __pad0[6]; | |
1362 | unsigned short st_dev; | |
1363 | ||
1364 | uint64_t st_ino; | |
1365 | ||
1366 | unsigned int st_mode; | |
1367 | unsigned int st_nlink; | |
1368 | ||
1369 | unsigned int st_uid; | |
1370 | unsigned int st_gid; | |
1371 | ||
1372 | unsigned char __pad2[6]; | |
1373 | unsigned short st_rdev; | |
1374 | ||
1375 | unsigned char __pad3[8]; | |
1376 | ||
1377 | int64_t st_size; | |
1378 | unsigned int st_blksize; | |
1379 | ||
1380 | unsigned char __pad4[8]; | |
1381 | unsigned int st_blocks; | |
1382 | ||
1383 | unsigned int target_st_atime; | |
5f992db6 | 1384 | unsigned int target_st_atime_nsec; |
3bfd9da1 FB |
1385 | |
1386 | unsigned int target_st_mtime; | |
5f992db6 | 1387 | unsigned int target_st_mtime_nsec; |
3bfd9da1 FB |
1388 | |
1389 | unsigned int target_st_ctime; | |
5f992db6 | 1390 | unsigned int target_st_ctime_nsec; |
3bfd9da1 | 1391 | |
5f992db6 CYT |
1392 | unsigned int __unused1; |
1393 | unsigned int __unused2; | |
3bfd9da1 FB |
1394 | }; |
1395 | ||
67867308 FB |
1396 | #elif defined(TARGET_PPC) |
1397 | ||
5f992db6 | 1398 | #define TARGET_STAT_HAVE_NSEC |
67867308 | 1399 | struct target_stat { |
e32448e0 | 1400 | abi_ulong st_dev; |
992f48a0 | 1401 | abi_ulong st_ino; |
325e651f | 1402 | #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) |
e32448e0 | 1403 | abi_ulong st_nlink; |
325e651f JM |
1404 | unsigned int st_mode; |
1405 | #else | |
67867308 FB |
1406 | unsigned int st_mode; |
1407 | unsigned short st_nlink; | |
325e651f | 1408 | #endif |
67867308 FB |
1409 | unsigned int st_uid; |
1410 | unsigned int st_gid; | |
e32448e0 | 1411 | abi_ulong st_rdev; |
992f48a0 BS |
1412 | abi_ulong st_size; |
1413 | abi_ulong st_blksize; | |
1414 | abi_ulong st_blocks; | |
1415 | abi_ulong target_st_atime; | |
e32448e0 | 1416 | abi_ulong target_st_atime_nsec; |
992f48a0 | 1417 | abi_ulong target_st_mtime; |
e32448e0 | 1418 | abi_ulong target_st_mtime_nsec; |
992f48a0 | 1419 | abi_ulong target_st_ctime; |
e32448e0 | 1420 | abi_ulong target_st_ctime_nsec; |
992f48a0 BS |
1421 | abi_ulong __unused4; |
1422 | abi_ulong __unused5; | |
325e651f JM |
1423 | #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) |
1424 | abi_ulong __unused6; | |
1425 | #endif | |
67867308 FB |
1426 | }; |
1427 | ||
20d155bc SW |
1428 | #if !defined(TARGET_PPC64) || defined(TARGET_ABI32) |
1429 | #define TARGET_HAS_STRUCT_STAT64 | |
541dc0d4 | 1430 | struct QEMU_PACKED target_stat64 { |
67867308 | 1431 | unsigned long long st_dev; |
67867308 | 1432 | unsigned long long st_ino; |
3bfd9da1 FB |
1433 | unsigned int st_mode; |
1434 | unsigned int st_nlink; | |
67867308 FB |
1435 | unsigned int st_uid; |
1436 | unsigned int st_gid; | |
3bfd9da1 | 1437 | unsigned long long st_rdev; |
e1ce5e40 | 1438 | unsigned long long __pad0; |
e32448e0 JM |
1439 | long long st_size; |
1440 | int st_blksize; | |
e1ce5e40 | 1441 | unsigned int __pad1; |
61322e91 | 1442 | long long st_blocks; /* Number 512-byte blocks allocated. */ |
e32448e0 JM |
1443 | int target_st_atime; |
1444 | unsigned int target_st_atime_nsec; | |
1445 | int target_st_mtime; | |
1446 | unsigned int target_st_mtime_nsec; | |
1447 | int target_st_ctime; | |
1448 | unsigned int target_st_ctime_nsec; | |
1449 | unsigned int __unused4; | |
1450 | unsigned int __unused5; | |
67867308 | 1451 | }; |
20d155bc | 1452 | #endif |
67867308 | 1453 | |
b779e29e EI |
1454 | #elif defined(TARGET_MICROBLAZE) |
1455 | ||
5f992db6 | 1456 | #define TARGET_STAT_HAVE_NSEC |
b779e29e EI |
1457 | struct target_stat { |
1458 | abi_ulong st_dev; | |
1459 | abi_ulong st_ino; | |
1460 | unsigned int st_mode; | |
1461 | unsigned short st_nlink; | |
1462 | unsigned int st_uid; | |
1463 | unsigned int st_gid; | |
1464 | abi_ulong st_rdev; | |
1465 | abi_ulong st_size; | |
1466 | abi_ulong st_blksize; | |
1467 | abi_ulong st_blocks; | |
1468 | abi_ulong target_st_atime; | |
1469 | abi_ulong target_st_atime_nsec; | |
1470 | abi_ulong target_st_mtime; | |
1471 | abi_ulong target_st_mtime_nsec; | |
1472 | abi_ulong target_st_ctime; | |
1473 | abi_ulong target_st_ctime_nsec; | |
1474 | abi_ulong __unused4; | |
1475 | abi_ulong __unused5; | |
1476 | }; | |
1477 | ||
1478 | /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ | |
20d155bc | 1479 | #define TARGET_HAS_STRUCT_STAT64 |
541dc0d4 | 1480 | struct QEMU_PACKED target_stat64 { |
b779e29e | 1481 | uint64_t st_dev; |
a523eb06 EI |
1482 | #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 |
1483 | uint32_t pad0; | |
1484 | uint32_t __st_ino; | |
1485 | ||
b779e29e EI |
1486 | uint32_t st_mode; |
1487 | uint32_t st_nlink; | |
1488 | uint32_t st_uid; | |
1489 | uint32_t st_gid; | |
1490 | uint64_t st_rdev; | |
21ebeb23 | 1491 | uint64_t __pad1; |
b779e29e EI |
1492 | |
1493 | int64_t st_size; | |
21ebeb23 EI |
1494 | int32_t st_blksize; |
1495 | uint32_t __pad2; | |
b779e29e EI |
1496 | int64_t st_blocks; /* Number 512-byte blocks allocated. */ |
1497 | ||
1498 | int target_st_atime; | |
a523eb06 | 1499 | unsigned int target_st_atime_nsec; |
b779e29e | 1500 | int target_st_mtime; |
a523eb06 | 1501 | unsigned int target_st_mtime_nsec; |
b779e29e | 1502 | int target_st_ctime; |
a523eb06 EI |
1503 | unsigned int target_st_ctime_nsec; |
1504 | uint64_t st_ino; | |
b779e29e EI |
1505 | }; |
1506 | ||
e6e5906b PB |
1507 | #elif defined(TARGET_M68K) |
1508 | ||
1509 | struct target_stat { | |
1510 | unsigned short st_dev; | |
1511 | unsigned short __pad1; | |
992f48a0 | 1512 | abi_ulong st_ino; |
e6e5906b PB |
1513 | unsigned short st_mode; |
1514 | unsigned short st_nlink; | |
1515 | unsigned short st_uid; | |
1516 | unsigned short st_gid; | |
1517 | unsigned short st_rdev; | |
1518 | unsigned short __pad2; | |
992f48a0 BS |
1519 | abi_ulong st_size; |
1520 | abi_ulong st_blksize; | |
1521 | abi_ulong st_blocks; | |
1522 | abi_ulong target_st_atime; | |
1523 | abi_ulong __unused1; | |
1524 | abi_ulong target_st_mtime; | |
1525 | abi_ulong __unused2; | |
1526 | abi_ulong target_st_ctime; | |
1527 | abi_ulong __unused3; | |
1528 | abi_ulong __unused4; | |
1529 | abi_ulong __unused5; | |
e6e5906b PB |
1530 | }; |
1531 | ||
1532 | /* This matches struct stat64 in glibc2.1, hence the absolutely | |
1533 | * insane amounts of padding around dev_t's. | |
1534 | */ | |
20d155bc | 1535 | #define TARGET_HAS_STRUCT_STAT64 |
e6e5906b PB |
1536 | struct target_stat64 { |
1537 | unsigned long long st_dev; | |
1538 | unsigned char __pad1[2]; | |
1539 | ||
1540 | #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 | |
992f48a0 | 1541 | abi_ulong __st_ino; |
e6e5906b PB |
1542 | |
1543 | unsigned int st_mode; | |
1544 | unsigned int st_nlink; | |
1545 | ||
992f48a0 BS |
1546 | abi_ulong st_uid; |
1547 | abi_ulong st_gid; | |
e6e5906b PB |
1548 | |
1549 | unsigned long long st_rdev; | |
1550 | unsigned char __pad3[2]; | |
1551 | ||
1552 | long long st_size; | |
992f48a0 | 1553 | abi_ulong st_blksize; |
e6e5906b | 1554 | |
992f48a0 BS |
1555 | abi_ulong __pad4; /* future possible st_blocks high bits */ |
1556 | abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ | |
e6e5906b | 1557 | |
992f48a0 BS |
1558 | abi_ulong target_st_atime; |
1559 | abi_ulong target_st_atime_nsec; | |
e6e5906b | 1560 | |
992f48a0 BS |
1561 | abi_ulong target_st_mtime; |
1562 | abi_ulong target_st_mtime_nsec; | |
e6e5906b | 1563 | |
992f48a0 BS |
1564 | abi_ulong target_st_ctime; |
1565 | abi_ulong target_st_ctime_nsec; | |
e6e5906b PB |
1566 | |
1567 | unsigned long long st_ino; | |
541dc0d4 | 1568 | } QEMU_PACKED; |
e6e5906b | 1569 | |
d26bc211 | 1570 | #elif defined(TARGET_ABI_MIPSN64) |
540635ba | 1571 | |
5f992db6 | 1572 | #define TARGET_STAT_HAVE_NSEC |
540635ba TS |
1573 | /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ |
1574 | struct target_stat { | |
1575 | unsigned int st_dev; | |
1576 | unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ | |
1577 | ||
992f48a0 | 1578 | abi_ulong st_ino; |
540635ba TS |
1579 | |
1580 | unsigned int st_mode; | |
1581 | unsigned int st_nlink; | |
1582 | ||
1583 | int st_uid; | |
1584 | int st_gid; | |
1585 | ||
1586 | unsigned int st_rdev; | |
1587 | unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ | |
1588 | ||
992f48a0 | 1589 | abi_ulong st_size; |
540635ba TS |
1590 | |
1591 | /* | |
1592 | * Actually this should be timestruc_t st_atime, st_mtime and st_ctime | |
1593 | * but we don't have it under Linux. | |
1594 | */ | |
1595 | unsigned int target_st_atime; | |
1596 | unsigned int target_st_atime_nsec; | |
1597 | ||
1598 | unsigned int target_st_mtime; | |
1599 | unsigned int target_st_mtime_nsec; | |
1600 | ||
1601 | unsigned int target_st_ctime; | |
1602 | unsigned int target_st_ctime_nsec; | |
1603 | ||
1604 | unsigned int st_blksize; | |
1605 | unsigned int st_pad2; | |
1606 | ||
992f48a0 | 1607 | abi_ulong st_blocks; |
540635ba TS |
1608 | }; |
1609 | ||
d26bc211 | 1610 | #elif defined(TARGET_ABI_MIPSN32) |
540635ba | 1611 | |
5f992db6 | 1612 | #define TARGET_STAT_HAVE_NSEC |
540635ba | 1613 | struct target_stat { |
1ab2aea2 LA |
1614 | abi_ulong st_dev; |
1615 | abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ | |
1616 | uint64_t st_ino; | |
1617 | unsigned int st_mode; | |
1618 | unsigned int st_nlink; | |
1619 | int st_uid; | |
1620 | int st_gid; | |
1621 | abi_ulong st_rdev; | |
1622 | abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ | |
1623 | int64_t st_size; | |
1624 | abi_long target_st_atime; | |
1625 | abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ | |
1626 | abi_long target_st_mtime; | |
1627 | abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ | |
1628 | abi_long target_st_ctime; | |
1629 | abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ | |
1630 | abi_ulong st_blksize; | |
1631 | abi_ulong st_pad2; | |
1632 | int64_t st_blocks; | |
540635ba TS |
1633 | }; |
1634 | ||
d26bc211 | 1635 | #elif defined(TARGET_ABI_MIPSO32) |
048f6b4d | 1636 | |
5f992db6 | 1637 | #define TARGET_STAT_HAVE_NSEC |
048f6b4d FB |
1638 | struct target_stat { |
1639 | unsigned st_dev; | |
992f48a0 BS |
1640 | abi_long st_pad1[3]; /* Reserved for network id */ |
1641 | abi_ulong st_ino; | |
048f6b4d FB |
1642 | unsigned int st_mode; |
1643 | unsigned int st_nlink; | |
1644 | int st_uid; | |
1645 | int st_gid; | |
1646 | unsigned st_rdev; | |
992f48a0 BS |
1647 | abi_long st_pad2[2]; |
1648 | abi_long st_size; | |
1649 | abi_long st_pad3; | |
048f6b4d FB |
1650 | /* |
1651 | * Actually this should be timestruc_t st_atime, st_mtime and st_ctime | |
1652 | * but we don't have it under Linux. | |
1653 | */ | |
992f48a0 BS |
1654 | abi_long target_st_atime; |
1655 | abi_long target_st_atime_nsec; | |
1656 | abi_long target_st_mtime; | |
1657 | abi_long target_st_mtime_nsec; | |
1658 | abi_long target_st_ctime; | |
1659 | abi_long target_st_ctime_nsec; | |
1660 | abi_long st_blksize; | |
1661 | abi_long st_blocks; | |
1662 | abi_long st_pad4[14]; | |
048f6b4d FB |
1663 | }; |
1664 | ||
1665 | /* | |
1666 | * This matches struct stat64 in glibc2.1, hence the absolutely insane | |
1667 | * amounts of padding around dev_t's. The memory layout is the same as of | |
1668 | * struct stat of the 64-bit kernel. | |
1669 | */ | |
1670 | ||
20d155bc | 1671 | #define TARGET_HAS_STRUCT_STAT64 |
048f6b4d | 1672 | struct target_stat64 { |
992f48a0 BS |
1673 | abi_ulong st_dev; |
1674 | abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ | |
048f6b4d FB |
1675 | |
1676 | uint64_t st_ino; | |
1677 | ||
1678 | unsigned int st_mode; | |
1679 | unsigned int st_nlink; | |
1680 | ||
1681 | int st_uid; | |
1682 | int st_gid; | |
1683 | ||
992f48a0 BS |
1684 | abi_ulong st_rdev; |
1685 | abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ | |
048f6b4d FB |
1686 | |
1687 | int64_t st_size; | |
1688 | ||
1689 | /* | |
1690 | * Actually this should be timestruc_t st_atime, st_mtime and st_ctime | |
1691 | * but we don't have it under Linux. | |
1692 | */ | |
992f48a0 BS |
1693 | abi_long target_st_atime; |
1694 | abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ | |
048f6b4d | 1695 | |
992f48a0 BS |
1696 | abi_long target_st_mtime; |
1697 | abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ | |
048f6b4d | 1698 | |
992f48a0 BS |
1699 | abi_long target_st_ctime; |
1700 | abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ | |
048f6b4d | 1701 | |
992f48a0 BS |
1702 | abi_ulong st_blksize; |
1703 | abi_ulong st_pad2; | |
048f6b4d FB |
1704 | |
1705 | int64_t st_blocks; | |
1706 | }; | |
7a3148a9 JM |
1707 | |
1708 | #elif defined(TARGET_ALPHA) | |
1709 | ||
1710 | struct target_stat { | |
1711 | unsigned int st_dev; | |
1712 | unsigned int st_ino; | |
1713 | unsigned int st_mode; | |
1714 | unsigned int st_nlink; | |
1715 | unsigned int st_uid; | |
1716 | unsigned int st_gid; | |
1717 | unsigned int st_rdev; | |
992f48a0 BS |
1718 | abi_long st_size; |
1719 | abi_ulong target_st_atime; | |
1720 | abi_ulong target_st_mtime; | |
1721 | abi_ulong target_st_ctime; | |
7a3148a9 JM |
1722 | unsigned int st_blksize; |
1723 | unsigned int st_blocks; | |
1724 | unsigned int st_flags; | |
1725 | unsigned int st_gen; | |
1726 | }; | |
1727 | ||
20d155bc | 1728 | #define TARGET_HAS_STRUCT_STAT64 |
7a3148a9 | 1729 | struct target_stat64 { |
992f48a0 BS |
1730 | abi_ulong st_dev; |
1731 | abi_ulong st_ino; | |
1732 | abi_ulong st_rdev; | |
1733 | abi_long st_size; | |
1734 | abi_ulong st_blocks; | |
7a3148a9 JM |
1735 | |
1736 | unsigned int st_mode; | |
1737 | unsigned int st_uid; | |
1738 | unsigned int st_gid; | |
1739 | unsigned int st_blksize; | |
1740 | unsigned int st_nlink; | |
1741 | unsigned int __pad0; | |
1742 | ||
992f48a0 BS |
1743 | abi_ulong target_st_atime; |
1744 | abi_ulong target_st_atime_nsec; | |
1745 | abi_ulong target_st_mtime; | |
1746 | abi_ulong target_st_mtime_nsec; | |
1747 | abi_ulong target_st_ctime; | |
1748 | abi_ulong target_st_ctime_nsec; | |
1749 | abi_long __unused[3]; | |
7a3148a9 JM |
1750 | }; |
1751 | ||
6db45e65 TS |
1752 | #elif defined(TARGET_SH4) |
1753 | ||
5f992db6 | 1754 | #define TARGET_STAT_HAVE_NSEC |
6db45e65 | 1755 | struct target_stat { |
992f48a0 BS |
1756 | abi_ulong st_dev; |
1757 | abi_ulong st_ino; | |
6db45e65 TS |
1758 | unsigned short st_mode; |
1759 | unsigned short st_nlink; | |
1760 | unsigned short st_uid; | |
1761 | unsigned short st_gid; | |
992f48a0 BS |
1762 | abi_ulong st_rdev; |
1763 | abi_ulong st_size; | |
1764 | abi_ulong st_blksize; | |
1765 | abi_ulong st_blocks; | |
1766 | abi_ulong target_st_atime; | |
1767 | abi_ulong target_st_atime_nsec; | |
1768 | abi_ulong target_st_mtime; | |
1769 | abi_ulong target_st_mtime_nsec; | |
1770 | abi_ulong target_st_ctime; | |
1771 | abi_ulong target_st_ctime_nsec; | |
1772 | abi_ulong __unused4; | |
1773 | abi_ulong __unused5; | |
6db45e65 TS |
1774 | }; |
1775 | ||
1776 | /* This matches struct stat64 in glibc2.1, hence the absolutely | |
1777 | * insane amounts of padding around dev_t's. | |
1778 | */ | |
20d155bc | 1779 | #define TARGET_HAS_STRUCT_STAT64 |
541dc0d4 | 1780 | struct QEMU_PACKED target_stat64 { |
6db45e65 TS |
1781 | unsigned long long st_dev; |
1782 | unsigned char __pad0[4]; | |
1783 | ||
1784 | #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 | |
992f48a0 | 1785 | abi_ulong __st_ino; |
6db45e65 TS |
1786 | |
1787 | unsigned int st_mode; | |
1788 | unsigned int st_nlink; | |
1789 | ||
992f48a0 BS |
1790 | abi_ulong st_uid; |
1791 | abi_ulong st_gid; | |
6db45e65 TS |
1792 | |
1793 | unsigned long long st_rdev; | |
1794 | unsigned char __pad3[4]; | |
1795 | ||
1796 | long long st_size; | |
992f48a0 | 1797 | abi_ulong st_blksize; |
6db45e65 TS |
1798 | |
1799 | unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ | |
1800 | ||
992f48a0 BS |
1801 | abi_ulong target_st_atime; |
1802 | abi_ulong target_st_atime_nsec; | |
6db45e65 | 1803 | |
992f48a0 BS |
1804 | abi_ulong target_st_mtime; |
1805 | abi_ulong target_st_mtime_nsec; | |
6db45e65 | 1806 | |
992f48a0 BS |
1807 | abi_ulong target_st_ctime; |
1808 | abi_ulong target_st_ctime_nsec; | |
6db45e65 TS |
1809 | |
1810 | unsigned long long st_ino; | |
1811 | }; | |
1812 | ||
d2fd1af7 | 1813 | #elif defined(TARGET_I386) && !defined(TARGET_ABI32) |
5f992db6 | 1814 | #define TARGET_STAT_HAVE_NSEC |
d2fd1af7 FB |
1815 | struct target_stat { |
1816 | abi_ulong st_dev; | |
1817 | abi_ulong st_ino; | |
1818 | abi_ulong st_nlink; | |
1819 | ||
1820 | unsigned int st_mode; | |
1821 | unsigned int st_uid; | |
1822 | unsigned int st_gid; | |
1823 | unsigned int __pad0; | |
1824 | abi_ulong st_rdev; | |
1825 | abi_long st_size; | |
1826 | abi_long st_blksize; | |
72e21db7 | 1827 | abi_long st_blocks; /* Number 512-byte blocks allocated. */ |
d2fd1af7 FB |
1828 | |
1829 | abi_ulong target_st_atime; | |
1830 | abi_ulong target_st_atime_nsec; | |
1831 | abi_ulong target_st_mtime; | |
1832 | abi_ulong target_st_mtime_nsec; | |
1833 | abi_ulong target_st_ctime; | |
1834 | abi_ulong target_st_ctime_nsec; | |
1835 | ||
72e21db7 | 1836 | abi_long __unused[3]; |
d2fd1af7 | 1837 | }; |
a4c075f1 UH |
1838 | #elif defined(TARGET_S390X) |
1839 | struct target_stat { | |
1840 | abi_ulong st_dev; | |
1841 | abi_ulong st_ino; | |
1842 | abi_ulong st_nlink; | |
1843 | unsigned int st_mode; | |
1844 | unsigned int st_uid; | |
1845 | unsigned int st_gid; | |
1846 | unsigned int __pad1; | |
1847 | abi_ulong st_rdev; | |
1848 | abi_ulong st_size; | |
1849 | abi_ulong target_st_atime; | |
1850 | abi_ulong target_st_atime_nsec; | |
1851 | abi_ulong target_st_mtime; | |
1852 | abi_ulong target_st_mtime_nsec; | |
1853 | abi_ulong target_st_ctime; | |
1854 | abi_ulong target_st_ctime_nsec; | |
1855 | abi_ulong st_blksize; | |
1856 | abi_long st_blocks; | |
1857 | abi_ulong __unused[3]; | |
1858 | }; | |
09701199 | 1859 | #elif defined(TARGET_AARCH64) |
5f992db6 | 1860 | #define TARGET_STAT_HAVE_NSEC |
09701199 AG |
1861 | struct target_stat { |
1862 | abi_ulong st_dev; | |
1863 | abi_ulong st_ino; | |
1864 | unsigned int st_mode; | |
1865 | unsigned int st_nlink; | |
1866 | unsigned int st_uid; | |
1867 | unsigned int st_gid; | |
1868 | abi_ulong st_rdev; | |
1869 | abi_ulong _pad1; | |
1870 | abi_long st_size; | |
1871 | int st_blksize; | |
1872 | int __pad2; | |
1873 | abi_long st_blocks; | |
1874 | abi_long target_st_atime; | |
1875 | abi_ulong target_st_atime_nsec; | |
1876 | abi_long target_st_mtime; | |
1877 | abi_ulong target_st_mtime_nsec; | |
1878 | abi_long target_st_ctime; | |
1879 | abi_ulong target_st_ctime_nsec; | |
1880 | unsigned int __unused[2]; | |
1881 | }; | |
ba7651fb | 1882 | #elif defined(TARGET_XTENSA) |
5f992db6 | 1883 | #define TARGET_STAT_HAVE_NSEC |
ba7651fb MF |
1884 | struct target_stat { |
1885 | abi_ulong st_dev; | |
1886 | abi_ulong st_ino; | |
1887 | unsigned int st_mode; | |
1888 | unsigned int st_nlink; | |
1889 | unsigned int st_uid; | |
1890 | unsigned int st_gid; | |
1891 | abi_ulong st_rdev; | |
1892 | abi_long st_size; | |
1893 | abi_ulong st_blksize; | |
1894 | abi_ulong st_blocks; | |
1895 | abi_ulong target_st_atime; | |
1896 | abi_ulong target_st_atime_nsec; | |
1897 | abi_ulong target_st_mtime; | |
1898 | abi_ulong target_st_mtime_nsec; | |
1899 | abi_ulong target_st_ctime; | |
1900 | abi_ulong target_st_ctime_nsec; | |
1901 | abi_ulong __unused4; | |
1902 | abi_ulong __unused5; | |
1903 | }; | |
1904 | ||
1905 | #define TARGET_HAS_STRUCT_STAT64 | |
1906 | struct target_stat64 { | |
1907 | uint64_t st_dev; /* Device */ | |
1908 | uint64_t st_ino; /* File serial number */ | |
1909 | unsigned int st_mode; /* File mode. */ | |
1910 | unsigned int st_nlink; /* Link count. */ | |
1911 | unsigned int st_uid; /* User ID of the file's owner. */ | |
1912 | unsigned int st_gid; /* Group ID of the file's group. */ | |
1913 | uint64_t st_rdev; /* Device number, if device. */ | |
1914 | int64_t st_size; /* Size of file, in bytes. */ | |
1915 | abi_ulong st_blksize; /* Optimal block size for I/O. */ | |
1916 | abi_ulong __unused2; | |
1917 | uint64_t st_blocks; /* Number 512-byte blocks allocated. */ | |
1918 | abi_ulong target_st_atime; /* Time of last access. */ | |
1919 | abi_ulong target_st_atime_nsec; | |
1920 | abi_ulong target_st_mtime; /* Time of last modification. */ | |
1921 | abi_ulong target_st_mtime_nsec; | |
1922 | abi_ulong target_st_ctime; /* Time of last status change. */ | |
1923 | abi_ulong target_st_ctime_nsec; | |
1924 | abi_ulong __unused4; | |
1925 | abi_ulong __unused5; | |
1926 | }; | |
1927 | ||
a0a839b6 | 1928 | #elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) || \ |
47ae93cd | 1929 | defined(TARGET_NIOS2) || defined(TARGET_RISCV) |
c7819dfb PM |
1930 | |
1931 | /* These are the asm-generic versions of the stat and stat64 structures */ | |
1932 | ||
5f992db6 | 1933 | #define TARGET_STAT_HAVE_NSEC |
d962783e JL |
1934 | struct target_stat { |
1935 | abi_ulong st_dev; | |
1936 | abi_ulong st_ino; | |
d962783e | 1937 | unsigned int st_mode; |
c7819dfb | 1938 | unsigned int st_nlink; |
d962783e JL |
1939 | unsigned int st_uid; |
1940 | unsigned int st_gid; | |
d962783e | 1941 | abi_ulong st_rdev; |
c7819dfb | 1942 | abi_ulong __pad1; |
d962783e | 1943 | abi_long st_size; |
c7819dfb PM |
1944 | int st_blksize; |
1945 | int __pad2; | |
1946 | abi_long st_blocks; | |
1947 | abi_long target_st_atime; | |
d962783e | 1948 | abi_ulong target_st_atime_nsec; |
c7819dfb | 1949 | abi_long target_st_mtime; |
d962783e | 1950 | abi_ulong target_st_mtime_nsec; |
c7819dfb | 1951 | abi_long target_st_ctime; |
d962783e | 1952 | abi_ulong target_st_ctime_nsec; |
c7819dfb PM |
1953 | unsigned int __unused4; |
1954 | unsigned int __unused5; | |
1955 | }; | |
d962783e | 1956 | |
47ae93cd | 1957 | #if !defined(TARGET_RISCV64) |
20d155bc | 1958 | #define TARGET_HAS_STRUCT_STAT64 |
c7819dfb PM |
1959 | struct target_stat64 { |
1960 | uint64_t st_dev; | |
1961 | uint64_t st_ino; | |
1962 | unsigned int st_mode; | |
1963 | unsigned int st_nlink; | |
1964 | unsigned int st_uid; | |
1965 | unsigned int st_gid; | |
1966 | uint64_t st_rdev; | |
1967 | uint64_t __pad1; | |
1968 | int64_t st_size; | |
1969 | int st_blksize; | |
1970 | int __pad2; | |
1971 | int64_t st_blocks; | |
1972 | int target_st_atime; | |
1973 | unsigned int target_st_atime_nsec; | |
1974 | int target_st_mtime; | |
1975 | unsigned int target_st_mtime_nsec; | |
1976 | int target_st_ctime; | |
1977 | unsigned int target_st_ctime_nsec; | |
1978 | unsigned int __unused4; | |
1979 | unsigned int __unused5; | |
d962783e | 1980 | }; |
47ae93cd | 1981 | #endif |
c7819dfb | 1982 | |
a10d1e50 RH |
1983 | #elif defined(TARGET_HPPA) |
1984 | ||
5f992db6 | 1985 | #define TARGET_STAT_HAVE_NSEC |
a10d1e50 RH |
1986 | struct target_stat { |
1987 | abi_uint st_dev; | |
1988 | abi_uint st_ino; | |
1989 | abi_ushort st_mode; | |
1990 | abi_ushort st_nlink; | |
1991 | abi_ushort _res1; | |
1992 | abi_ushort _res2; | |
1993 | abi_uint st_rdev; | |
1994 | abi_int st_size; | |
1995 | abi_int target_st_atime; | |
1996 | abi_uint target_st_atime_nsec; | |
1997 | abi_int target_st_mtime; | |
1998 | abi_uint target_st_mtime_nsec; | |
1999 | abi_int target_st_ctime; | |
2000 | abi_uint target_st_ctime_nsec; | |
2001 | abi_int st_blksize; | |
2002 | abi_int st_blocks; | |
2003 | abi_uint _unused1; | |
2004 | abi_uint _unused2; | |
2005 | abi_uint _unused3; | |
2006 | abi_uint _unused4; | |
2007 | abi_ushort _unused5; | |
2008 | abi_short st_fstype; | |
2009 | abi_uint st_realdev; | |
2010 | abi_ushort st_basemode; | |
2011 | abi_ushort _unused6; | |
2012 | abi_uint st_uid; | |
2013 | abi_uint st_gid; | |
2014 | abi_uint _unused7[3]; | |
2015 | }; | |
2016 | ||
2017 | #define TARGET_HAS_STRUCT_STAT64 | |
2018 | struct target_stat64 { | |
2019 | uint64_t st_dev; | |
2020 | abi_uint _pad1; | |
2021 | abi_uint _res1; | |
2022 | abi_uint st_mode; | |
2023 | abi_uint st_nlink; | |
2024 | abi_uint st_uid; | |
2025 | abi_uint st_gid; | |
2026 | uint64_t st_rdev; | |
2027 | abi_uint _pad2; | |
2028 | int64_t st_size; | |
2029 | abi_int st_blksize; | |
2030 | int64_t st_blocks; | |
2031 | abi_int target_st_atime; | |
2032 | abi_uint target_st_atime_nsec; | |
2033 | abi_int target_st_mtime; | |
2034 | abi_uint target_st_mtime_nsec; | |
2035 | abi_int target_st_ctime; | |
2036 | abi_uint target_st_ctime_nsec; | |
2037 | uint64_t st_ino; | |
2038 | }; | |
2039 | ||
048f6b4d FB |
2040 | #else |
2041 | #error unsupported CPU | |
2042 | #endif | |
2521d698 | 2043 | |
4ce6f8de TS |
2044 | typedef struct { |
2045 | int val[2]; | |
c227f099 | 2046 | } target_fsid_t; |
4ce6f8de | 2047 | |
56c8f68f | 2048 | #ifdef TARGET_MIPS |
d26bc211 | 2049 | #ifdef TARGET_ABI_MIPSN32 |
540635ba TS |
2050 | struct target_statfs { |
2051 | int32_t f_type; | |
2052 | int32_t f_bsize; | |
2053 | int32_t f_frsize; /* Fragment size - unsupported */ | |
2054 | int32_t f_blocks; | |
2055 | int32_t f_bfree; | |
2056 | int32_t f_files; | |
2057 | int32_t f_ffree; | |
2058 | int32_t f_bavail; | |
2059 | ||
2060 | /* Linux specials */ | |
c227f099 | 2061 | target_fsid_t f_fsid; |
540635ba | 2062 | int32_t f_namelen; |
d4247ec2 SL |
2063 | int32_t f_flags; |
2064 | int32_t f_spare[5]; | |
540635ba TS |
2065 | }; |
2066 | #else | |
56c8f68f | 2067 | struct target_statfs { |
992f48a0 BS |
2068 | abi_long f_type; |
2069 | abi_long f_bsize; | |
2070 | abi_long f_frsize; /* Fragment size - unsupported */ | |
2071 | abi_long f_blocks; | |
2072 | abi_long f_bfree; | |
2073 | abi_long f_files; | |
2074 | abi_long f_ffree; | |
2075 | abi_long f_bavail; | |
56c8f68f FB |
2076 | |
2077 | /* Linux specials */ | |
c227f099 | 2078 | target_fsid_t f_fsid; |
992f48a0 | 2079 | abi_long f_namelen; |
d4247ec2 SL |
2080 | abi_long f_flags; |
2081 | abi_long f_spare[5]; | |
56c8f68f | 2082 | }; |
540635ba | 2083 | #endif |
56c8f68f FB |
2084 | |
2085 | struct target_statfs64 { | |
2086 | uint32_t f_type; | |
2087 | uint32_t f_bsize; | |
2088 | uint32_t f_frsize; /* Fragment size - unsupported */ | |
2089 | uint32_t __pad; | |
2090 | uint64_t f_blocks; | |
2091 | uint64_t f_bfree; | |
2092 | uint64_t f_files; | |
2093 | uint64_t f_ffree; | |
2094 | uint64_t f_bavail; | |
c227f099 | 2095 | target_fsid_t f_fsid; |
56c8f68f | 2096 | uint32_t f_namelen; |
d4247ec2 SL |
2097 | uint32_t f_flags; |
2098 | uint32_t f_spare[5]; | |
56c8f68f | 2099 | }; |
c4d10628 | 2100 | #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ |
47ae93cd MC |
2101 | defined(TARGET_SPARC64) || defined(TARGET_AARCH64) || \ |
2102 | defined(TARGET_RISCV)) && !defined(TARGET_ABI32) | |
325e651f JM |
2103 | struct target_statfs { |
2104 | abi_long f_type; | |
2105 | abi_long f_bsize; | |
2106 | abi_long f_blocks; | |
2107 | abi_long f_bfree; | |
2108 | abi_long f_bavail; | |
2109 | abi_long f_files; | |
2110 | abi_long f_ffree; | |
c227f099 | 2111 | target_fsid_t f_fsid; |
325e651f JM |
2112 | abi_long f_namelen; |
2113 | abi_long f_frsize; | |
d4247ec2 SL |
2114 | abi_long f_flags; |
2115 | abi_long f_spare[4]; | |
325e651f JM |
2116 | }; |
2117 | ||
2118 | struct target_statfs64 { | |
2119 | abi_long f_type; | |
2120 | abi_long f_bsize; | |
2121 | abi_long f_blocks; | |
2122 | abi_long f_bfree; | |
2123 | abi_long f_bavail; | |
2124 | abi_long f_files; | |
2125 | abi_long f_ffree; | |
c227f099 | 2126 | target_fsid_t f_fsid; |
325e651f JM |
2127 | abi_long f_namelen; |
2128 | abi_long f_frsize; | |
d4247ec2 SL |
2129 | abi_long f_flags; |
2130 | abi_long f_spare[4]; | |
325e651f | 2131 | }; |
a4c075f1 UH |
2132 | #elif defined(TARGET_S390X) |
2133 | struct target_statfs { | |
2134 | int32_t f_type; | |
2135 | int32_t f_bsize; | |
2136 | abi_long f_blocks; | |
2137 | abi_long f_bfree; | |
2138 | abi_long f_bavail; | |
2139 | abi_long f_files; | |
2140 | abi_long f_ffree; | |
2141 | kernel_fsid_t f_fsid; | |
2142 | int32_t f_namelen; | |
2143 | int32_t f_frsize; | |
d4247ec2 SL |
2144 | int32_t f_flags; |
2145 | int32_t f_spare[4]; | |
2146 | ||
a4c075f1 UH |
2147 | }; |
2148 | ||
2149 | struct target_statfs64 { | |
2150 | int32_t f_type; | |
2151 | int32_t f_bsize; | |
2152 | abi_long f_blocks; | |
2153 | abi_long f_bfree; | |
2154 | abi_long f_bavail; | |
2155 | abi_long f_files; | |
2156 | abi_long f_ffree; | |
2157 | kernel_fsid_t f_fsid; | |
2158 | int32_t f_namelen; | |
2159 | int32_t f_frsize; | |
d4247ec2 SL |
2160 | int32_t f_flags; |
2161 | int32_t f_spare[4]; | |
a4c075f1 | 2162 | }; |
56c8f68f FB |
2163 | #else |
2164 | struct target_statfs { | |
2165 | uint32_t f_type; | |
2166 | uint32_t f_bsize; | |
2167 | uint32_t f_blocks; | |
2168 | uint32_t f_bfree; | |
2169 | uint32_t f_bavail; | |
2170 | uint32_t f_files; | |
2171 | uint32_t f_ffree; | |
c227f099 | 2172 | target_fsid_t f_fsid; |
56c8f68f FB |
2173 | uint32_t f_namelen; |
2174 | uint32_t f_frsize; | |
d4247ec2 SL |
2175 | uint32_t f_flags; |
2176 | uint32_t f_spare[4]; | |
56c8f68f FB |
2177 | }; |
2178 | ||
2179 | struct target_statfs64 { | |
2180 | uint32_t f_type; | |
2181 | uint32_t f_bsize; | |
2182 | uint64_t f_blocks; | |
2183 | uint64_t f_bfree; | |
2184 | uint64_t f_bavail; | |
2185 | uint64_t f_files; | |
2186 | uint64_t f_ffree; | |
c227f099 | 2187 | target_fsid_t f_fsid; |
56c8f68f FB |
2188 | uint32_t f_namelen; |
2189 | uint32_t f_frsize; | |
d4247ec2 SL |
2190 | uint32_t f_flags; |
2191 | uint32_t f_spare[4]; | |
56c8f68f FB |
2192 | }; |
2193 | #endif | |
2194 | ||
7e22e546 UH |
2195 | #define TARGET_F_LINUX_SPECIFIC_BASE 1024 |
2196 | #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0) | |
2197 | #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1) | |
2198 | #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) | |
7e3b92ec PM |
2199 | #define TARGET_F_SETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 7) |
2200 | #define TARGET_F_GETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 8) | |
7e22e546 UH |
2201 | #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2) |
2202 | ||
5de7706e | 2203 | #include "target_fcntl.h" |
8d5d3004 | 2204 | |
2521d698 | 2205 | /* soundcard defines */ |
67cc32eb | 2206 | /* XXX: convert them all to arch independent entries */ |
2521d698 FB |
2207 | #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); |
2208 | #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 | |
2209 | #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 | |
2210 | #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 | |
2211 | #define TARGET_SNDCTL_COPR_RDATA 0xc0144302 | |
2212 | #define TARGET_SNDCTL_COPR_RESET 0x00004300 | |
2213 | #define TARGET_SNDCTL_COPR_RUN 0xc0144306 | |
2214 | #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 | |
2215 | #define TARGET_SNDCTL_COPR_WCODE 0x40144305 | |
2216 | #define TARGET_SNDCTL_COPR_WDATA 0x40144304 | |
2217 | #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) | |
2218 | #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) | |
2219 | #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) | |
2220 | #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) | |
2221 | #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) | |
2222 | #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) | |
2223 | #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) | |
2224 | #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) | |
2225 | #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) | |
2226 | #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) | |
2227 | #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) | |
2228 | #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) | |
2229 | #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) | |
2230 | #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) | |
2231 | #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) | |
2232 | #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) | |
2233 | #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) | |
2234 | #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) | |
5f72307d PM |
2235 | #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19) |
2236 | #define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20) | |
2521d698 FB |
2237 | #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e |
2238 | #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 | |
2239 | #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 | |
2240 | #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 | |
2241 | #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 | |
2242 | #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f | |
2243 | #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 | |
2244 | #define TARGET_SNDCTL_MIDI_INFO 0xc074510c | |
2245 | #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 | |
2246 | #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 | |
2247 | #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 | |
2248 | #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 | |
2249 | #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 | |
2250 | #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 | |
2251 | #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 | |
2252 | #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 | |
2253 | #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b | |
2254 | #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a | |
2255 | #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 | |
2256 | #define TARGET_SNDCTL_SEQ_PANIC 0x00005111 | |
2257 | #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 | |
2258 | #define TARGET_SNDCTL_SEQ_RESET 0x00005100 | |
2259 | #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 | |
2260 | #define TARGET_SNDCTL_SEQ_SYNC 0x00005101 | |
2261 | #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 | |
2262 | #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d | |
2263 | #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d | |
2264 | #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 | |
2265 | #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e | |
2266 | #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 | |
2267 | #define TARGET_SNDCTL_TMR_METRONOME 0x40045407 | |
2268 | #define TARGET_SNDCTL_TMR_SELECT 0x40045408 | |
2269 | #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 | |
2270 | #define TARGET_SNDCTL_TMR_START 0x00005402 | |
2271 | #define TARGET_SNDCTL_TMR_STOP 0x00005403 | |
2272 | #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 | |
2273 | #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 | |
2274 | #define TARGET_SOUND_PCM_READ_RATE 0x80045002 | |
2275 | #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 | |
2276 | #define TARGET_SOUND_PCM_READ_BITS 0x80045005 | |
2277 | #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 | |
2278 | #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) | |
2279 | #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 | |
2280 | #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) | |
2281 | #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) | |
2282 | #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) | |
2283 | #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) | |
2284 | #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) | |
2285 | ||
2286 | #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) | |
2287 | ||
2288 | #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) | |
2289 | #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) | |
2290 | #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) | |
2291 | #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) | |
2292 | #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) | |
2293 | #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) | |
2294 | #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) | |
2295 | #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) | |
2296 | #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) | |
2297 | #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) | |
2298 | #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) | |
2299 | #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) | |
2300 | #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) | |
2301 | #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) | |
2302 | #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) | |
2303 | #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) | |
2304 | #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) | |
2305 | ||
2306 | /* Obsolete macros */ | |
2307 | #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) | |
2308 | #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) | |
2309 | #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) | |
2310 | ||
2311 | #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) | |
2312 | #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) | |
2313 | #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) | |
2314 | #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) | |
2315 | #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) | |
2316 | ||
2317 | #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) | |
2318 | ||
2319 | #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) | |
2320 | #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) | |
2321 | #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) | |
2322 | #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) | |
2323 | #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) | |
2324 | #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) | |
2325 | #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) | |
2326 | #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) | |
2327 | #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) | |
2328 | #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) | |
2329 | #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) | |
2330 | #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) | |
2331 | #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) | |
2332 | #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) | |
2333 | #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) | |
2334 | #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) | |
2335 | #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) | |
2336 | ||
2337 | /* Obsolete macros */ | |
2338 | #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) | |
2339 | #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) | |
2340 | #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) | |
2341 | ||
2342 | #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) | |
2343 | ||
2344 | /* vfat ioctls */ | |
2345 | #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) | |
2346 | #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) | |
a5448a7d | 2347 | |
f443e396 PM |
2348 | struct target_mtop { |
2349 | abi_short mt_op; | |
2350 | abi_int mt_count; | |
2351 | }; | |
2352 | ||
2353 | #if defined(TARGET_SPARC) || defined(TARGET_MIPS) | |
2354 | typedef abi_long target_kernel_daddr_t; | |
2355 | #else | |
2356 | typedef abi_int target_kernel_daddr_t; | |
2357 | #endif | |
2358 | ||
2359 | struct target_mtget { | |
2360 | abi_long mt_type; | |
2361 | abi_long mt_resid; | |
2362 | abi_long mt_dsreg; | |
2363 | abi_long mt_gstat; | |
2364 | abi_long mt_erreg; | |
2365 | target_kernel_daddr_t mt_fileno; | |
2366 | target_kernel_daddr_t mt_blkno; | |
2367 | }; | |
2368 | ||
2369 | struct target_mtpos { | |
2370 | abi_long mt_blkno; | |
2371 | }; | |
2372 | ||
2373 | #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct target_mtop) | |
2374 | #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct target_mtget) | |
2375 | #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct target_mtpos) | |
8fbd6b52 | 2376 | |
a5448a7d | 2377 | struct target_sysinfo { |
992f48a0 BS |
2378 | abi_long uptime; /* Seconds since boot */ |
2379 | abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */ | |
2380 | abi_ulong totalram; /* Total usable main memory size */ | |
2381 | abi_ulong freeram; /* Available memory size */ | |
2382 | abi_ulong sharedram; /* Amount of shared memory */ | |
2383 | abi_ulong bufferram; /* Memory used by buffers */ | |
2384 | abi_ulong totalswap; /* Total swap space size */ | |
2385 | abi_ulong freeswap; /* swap space still available */ | |
a5448a7d FB |
2386 | unsigned short procs; /* Number of current processes */ |
2387 | unsigned short pad; /* explicit padding for m68k */ | |
992f48a0 BS |
2388 | abi_ulong totalhigh; /* Total high memory size */ |
2389 | abi_ulong freehigh; /* Available high memory size */ | |
a5448a7d | 2390 | unsigned int mem_unit; /* Memory unit size in bytes */ |
992f48a0 | 2391 | char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ |
a5448a7d | 2392 | }; |
3532fa74 | 2393 | |
6556a833 AJ |
2394 | struct linux_dirent { |
2395 | long d_ino; | |
2396 | unsigned long d_off; | |
2397 | unsigned short d_reclen; | |
2398 | char d_name[256]; /* We must not include limits.h! */ | |
2399 | }; | |
2400 | ||
2401 | struct linux_dirent64 { | |
2402 | uint64_t d_ino; | |
2403 | int64_t d_off; | |
2404 | unsigned short d_reclen; | |
2405 | unsigned char d_type; | |
2406 | char d_name[256]; | |
2407 | }; | |
2408 | ||
24e1003a AJ |
2409 | struct target_mq_attr { |
2410 | abi_long mq_flags; | |
2411 | abi_long mq_maxmsg; | |
2412 | abi_long mq_msgsize; | |
2413 | abi_long mq_curmsgs; | |
2414 | }; | |
2415 | ||
3532fa74 | 2416 | #include "socket.h" |
637947f1 TS |
2417 | |
2418 | #include "errno_defs.h" | |
03dfe9f8 RV |
2419 | |
2420 | #define FUTEX_WAIT 0 | |
2421 | #define FUTEX_WAKE 1 | |
2422 | #define FUTEX_FD 2 | |
2423 | #define FUTEX_REQUEUE 3 | |
2424 | #define FUTEX_CMP_REQUEUE 4 | |
2425 | #define FUTEX_WAKE_OP 5 | |
2426 | #define FUTEX_LOCK_PI 6 | |
2427 | #define FUTEX_UNLOCK_PI 7 | |
2428 | #define FUTEX_TRYLOCK_PI 8 | |
2429 | #define FUTEX_WAIT_BITSET 9 | |
2430 | #define FUTEX_WAKE_BITSET 10 | |
2431 | ||
2432 | #define FUTEX_PRIVATE_FLAG 128 | |
2433 | #define FUTEX_CLOCK_REALTIME 256 | |
2434 | #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) | |
2435 | ||
3b6edd16 | 2436 | #ifdef CONFIG_EPOLL |
928bed6a LV |
2437 | #if defined(TARGET_X86_64) |
2438 | #define TARGET_EPOLL_PACKED QEMU_PACKED | |
2439 | #else | |
2440 | #define TARGET_EPOLL_PACKED | |
2441 | #endif | |
2442 | ||
3b6edd16 PM |
2443 | typedef union target_epoll_data { |
2444 | abi_ulong ptr; | |
928bed6a LV |
2445 | abi_int fd; |
2446 | abi_uint u32; | |
2447 | abi_ullong u64; | |
3b6edd16 PM |
2448 | } target_epoll_data_t; |
2449 | ||
2450 | struct target_epoll_event { | |
928bed6a | 2451 | abi_uint events; |
3b6edd16 | 2452 | target_epoll_data_t data; |
928bed6a | 2453 | } TARGET_EPOLL_PACKED; |
2ba7fae3 PM |
2454 | |
2455 | #define TARGET_EP_MAX_EVENTS (INT_MAX / sizeof(struct target_epoll_event)) | |
2456 | ||
3b6edd16 | 2457 | #endif |
163a05a8 PM |
2458 | struct target_rlimit64 { |
2459 | uint64_t rlim_cur; | |
2460 | uint64_t rlim_max; | |
2461 | }; | |
583359a6 AP |
2462 | |
2463 | struct target_ucred { | |
2464 | uint32_t pid; | |
2465 | uint32_t uid; | |
2466 | uint32_t gid; | |
2467 | }; | |
cb9c377f | 2468 | |
aecc8861 | 2469 | typedef int32_t target_timer_t; |
905bba13 | 2470 | |
34d60862 NC |
2471 | #define TARGET_SIGEV_MAX_SIZE 64 |
2472 | ||
2473 | /* This is architecture-specific but most architectures use the default */ | |
2474 | #ifdef TARGET_MIPS | |
2475 | #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long)) | |
2476 | #else | |
2477 | #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ | |
2478 | + sizeof(target_sigval_t)) | |
2479 | #endif | |
2480 | ||
2481 | #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ | |
2482 | - TARGET_SIGEV_PREAMBLE_SIZE) \ | |
2483 | / sizeof(int32_t)) | |
2484 | ||
905bba13 ECL |
2485 | struct target_sigevent { |
2486 | target_sigval_t sigev_value; | |
17351c3f PM |
2487 | abi_int sigev_signo; |
2488 | abi_int sigev_notify; | |
905bba13 | 2489 | union { |
17351c3f PM |
2490 | abi_int _pad[TARGET_SIGEV_PAD_SIZE]; |
2491 | abi_int _tid; | |
905bba13 | 2492 | |
17351c3f PM |
2493 | /* The kernel (and thus QEMU) never looks at these; |
2494 | * they're only used as part of the ABI between a | |
2495 | * userspace program and libc. | |
2496 | */ | |
905bba13 | 2497 | struct { |
17351c3f PM |
2498 | abi_ulong _function; |
2499 | abi_ulong _attribute; | |
905bba13 ECL |
2500 | } _sigev_thread; |
2501 | } _sigev_un; | |
2502 | }; | |
e0eb210e PM |
2503 | |
2504 | struct target_user_cap_header { | |
2505 | uint32_t version; | |
2506 | int pid; | |
2507 | }; | |
2508 | ||
2509 | struct target_user_cap_data { | |
2510 | uint32_t effective; | |
2511 | uint32_t permitted; | |
2512 | uint32_t inheritable; | |
2513 | }; | |
1b3c4fdf | 2514 | |
da2c8ad7 AM |
2515 | /* from kernel's include/linux/syslog.h */ |
2516 | ||
2517 | /* Close the log. Currently a NOP. */ | |
2518 | #define TARGET_SYSLOG_ACTION_CLOSE 0 | |
2519 | /* Open the log. Currently a NOP. */ | |
2520 | #define TARGET_SYSLOG_ACTION_OPEN 1 | |
2521 | /* Read from the log. */ | |
2522 | #define TARGET_SYSLOG_ACTION_READ 2 | |
2523 | /* Read all messages remaining in the ring buffer. */ | |
2524 | #define TARGET_SYSLOG_ACTION_READ_ALL 3 | |
2525 | /* Read and clear all messages remaining in the ring buffer */ | |
2526 | #define TARGET_SYSLOG_ACTION_READ_CLEAR 4 | |
2527 | /* Clear ring buffer. */ | |
2528 | #define TARGET_SYSLOG_ACTION_CLEAR 5 | |
2529 | /* Disable printk's to console */ | |
2530 | #define TARGET_SYSLOG_ACTION_CONSOLE_OFF 6 | |
2531 | /* Enable printk's to console */ | |
2532 | #define TARGET_SYSLOG_ACTION_CONSOLE_ON 7 | |
2533 | /* Set level of messages printed to console */ | |
2534 | #define TARGET_SYSLOG_ACTION_CONSOLE_LEVEL 8 | |
2535 | /* Return number of unread characters in the log buffer */ | |
2536 | #define TARGET_SYSLOG_ACTION_SIZE_UNREAD 9 | |
2537 | /* Return size of the log buffer */ | |
2538 | #define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10 | |
2539 | ||
efa92184 AR |
2540 | struct target_statx_timestamp { |
2541 | int64_t tv_sec; | |
2542 | uint32_t tv_nsec; | |
2543 | int32_t __reserved; | |
2544 | }; | |
2545 | ||
2546 | struct target_statx { | |
2547 | /* 0x00 */ | |
2548 | uint32_t stx_mask; /* What results were written [uncond] */ | |
2549 | uint32_t stx_blksize; /* Preferred general I/O size [uncond] */ | |
2550 | uint64_t stx_attributes; /* Flags conveying information about the file */ | |
2551 | /* 0x10 */ | |
2552 | uint32_t stx_nlink; /* Number of hard links */ | |
2553 | uint32_t stx_uid; /* User ID of owner */ | |
2554 | uint32_t stx_gid; /* Group ID of owner */ | |
2555 | uint16_t stx_mode; /* File mode */ | |
2556 | uint16_t __spare0[1]; | |
2557 | /* 0x20 */ | |
2558 | uint64_t stx_ino; /* Inode number */ | |
2559 | uint64_t stx_size; /* File size */ | |
2560 | uint64_t stx_blocks; /* Number of 512-byte blocks allocated */ | |
2561 | uint64_t stx_attributes_mask; /* Mask to show what is supported */ | |
2562 | /* 0x40 */ | |
2563 | struct target_statx_timestamp stx_atime; /* Last access time */ | |
2564 | struct target_statx_timestamp stx_btime; /* File creation time */ | |
2565 | struct target_statx_timestamp stx_ctime; /* Last attribute change time */ | |
2566 | struct target_statx_timestamp stx_mtime; /* Last data modification time */ | |
2567 | /* 0x80 */ | |
2568 | uint32_t stx_rdev_major; /* Device ID of special file [if bdev/cdev] */ | |
2569 | uint32_t stx_rdev_minor; | |
2570 | uint32_t stx_dev_major; /* ID of device containing file [uncond] */ | |
2571 | uint32_t stx_dev_minor; | |
2572 | /* 0x90 */ | |
2573 | uint64_t __spare2[14]; /* Spare space for future expansion */ | |
2574 | /* 0x100 */ | |
2575 | }; | |
2576 | ||
1b3c4fdf | 2577 | #endif |