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