1
2
3
4
5
6
7#ifndef SYSCALL_DEFS_H
8#define SYSCALL_DEFS_H
9
10#include "syscall_nr.h"
11
12
13
14#define TARGET_SYS_SOCKET 1
15#define TARGET_SYS_BIND 2
16#define TARGET_SYS_CONNECT 3
17#define TARGET_SYS_LISTEN 4
18#define TARGET_SYS_ACCEPT 5
19#define TARGET_SYS_GETSOCKNAME 6
20#define TARGET_SYS_GETPEERNAME 7
21#define TARGET_SYS_SOCKETPAIR 8
22#define TARGET_SYS_SEND 9
23#define TARGET_SYS_RECV 10
24#define TARGET_SYS_SENDTO 11
25#define TARGET_SYS_RECVFROM 12
26#define TARGET_SYS_SHUTDOWN 13
27#define TARGET_SYS_SETSOCKOPT 14
28#define TARGET_SYS_GETSOCKOPT 15
29#define TARGET_SYS_SENDMSG 16
30#define TARGET_SYS_RECVMSG 17
31#define TARGET_SYS_ACCEPT4 18
32#define TARGET_SYS_RECVMMSG 19
33#define TARGET_SYS_SENDMMSG 20
34
35#define IPCOP_CALL(VERSION, OP) ((VERSION) << 16 | (OP))
36#define IPCOP_semop 1
37#define IPCOP_semget 2
38#define IPCOP_semctl 3
39#define IPCOP_semtimedop 4
40#define IPCOP_msgsnd 11
41#define IPCOP_msgrcv 12
42#define IPCOP_msgget 13
43#define IPCOP_msgctl 14
44#define IPCOP_shmat 21
45#define IPCOP_shmdt 22
46#define IPCOP_shmget 23
47#define IPCOP_shmctl 24
48
49
50
51
52
53
54
55
56
57#define TARGET_IOC_NRBITS 8
58#define TARGET_IOC_TYPEBITS 8
59
60#if (defined(TARGET_I386) && defined(TARGET_ABI32)) \
61 || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \
62 || defined(TARGET_SPARC) \
63 || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS)
64
65#define USE_UID16
66#define target_id uint16_t
67#else
68#define target_id uint32_t
69#endif
70
71#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \
72 || defined(TARGET_M68K) || defined(TARGET_CRIS) \
73 || defined(TARGET_S390X) \
74 || defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) \
75 || defined(TARGET_NIOS2) || defined(TARGET_RISCV) \
76 || defined(TARGET_XTENSA)
77
78#define TARGET_IOC_SIZEBITS 14
79#define TARGET_IOC_DIRBITS 2
80
81#define TARGET_IOC_NONE 0U
82#define TARGET_IOC_WRITE 1U
83#define TARGET_IOC_READ 2U
84
85#elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \
86 defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \
87 defined(TARGET_MIPS)
88
89#define TARGET_IOC_SIZEBITS 13
90#define TARGET_IOC_DIRBITS 3
91
92#define TARGET_IOC_NONE 1U
93#define TARGET_IOC_READ 2U
94#define TARGET_IOC_WRITE 4U
95
96#elif defined(TARGET_HPPA)
97
98#define TARGET_IOC_SIZEBITS 14
99#define TARGET_IOC_DIRBITS 2
100
101#define TARGET_IOC_NONE 0U
102#define TARGET_IOC_WRITE 2U
103#define TARGET_IOC_READ 1U
104
105#else
106#error unsupported CPU
107#endif
108
109#define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1)
110#define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1)
111#define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1)
112#define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1)
113
114#define TARGET_IOC_NRSHIFT 0
115#define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS)
116#define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS)
117#define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS)
118
119#define TARGET_IOC(dir,type,nr,size) \
120 (((dir) << TARGET_IOC_DIRSHIFT) | \
121 ((type) << TARGET_IOC_TYPESHIFT) | \
122 ((nr) << TARGET_IOC_NRSHIFT) | \
123 ((size) << TARGET_IOC_SIZESHIFT))
124
125
126#define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0)
127#define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size))
128#define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size))
129#define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size))
130
131
132#define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK)
133#define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
134#define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
135
136struct target_sockaddr {
137 abi_ushort sa_family;
138 uint8_t sa_data[14];
139};
140
141struct target_sockaddr_ll {
142 abi_ushort sll_family;
143 abi_ushort sll_protocol;
144 abi_int sll_ifindex;
145 abi_ushort sll_hatype;
146 uint8_t sll_pkttype;
147 uint8_t sll_halen;
148 uint8_t sll_addr[8];
149};
150
151struct target_sockaddr_un {
152 abi_ushort su_family;
153 uint8_t sun_path[108];
154};
155
156struct target_sockaddr_nl {
157 abi_ushort nl_family;
158 abi_ushort __pad;
159 abi_uint nl_pid;
160 abi_uint nl_groups;
161};
162
163struct target_in_addr {
164 abi_uint s_addr;
165};
166
167struct target_sockaddr_in {
168 abi_ushort sin_family;
169 abi_short sin_port;
170 struct target_in_addr sin_addr;
171 uint8_t __pad[sizeof(struct target_sockaddr) -
172 sizeof(abi_ushort) - sizeof(abi_short) -
173 sizeof(struct target_in_addr)];
174};
175
176struct target_sockaddr_in6 {
177 abi_ushort sin6_family;
178 abi_ushort sin6_port;
179 abi_uint sin6_flowinfo;
180 struct in6_addr sin6_addr;
181 abi_uint sin6_scope_id;
182};
183
184struct target_sock_filter {
185 abi_ushort code;
186 uint8_t jt;
187 uint8_t jf;
188 abi_uint k;
189};
190
191struct target_sock_fprog {
192 abi_ushort len;
193 abi_ulong filter;
194};
195
196struct target_ip_mreq {
197 struct target_in_addr imr_multiaddr;
198 struct target_in_addr imr_address;
199};
200
201struct target_ip_mreqn {
202 struct target_in_addr imr_multiaddr;
203 struct target_in_addr imr_address;
204 abi_long imr_ifindex;
205};
206
207struct target_ip_mreq_source {
208
209 uint32_t imr_multiaddr;
210 uint32_t imr_interface;
211 uint32_t imr_sourceaddr;
212};
213
214struct target_linger {
215 abi_int l_onoff;
216 abi_int l_linger;
217};
218
219#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
220struct target_timeval {
221 abi_long tv_sec;
222 abi_int tv_usec;
223};
224#define target__kernel_sock_timeval target_timeval
225#else
226struct target_timeval {
227 abi_long tv_sec;
228 abi_long tv_usec;
229};
230
231struct target__kernel_sock_timeval {
232 abi_llong tv_sec;
233 abi_llong tv_usec;
234};
235#endif
236
237struct target_timespec {
238 abi_long tv_sec;
239 abi_long tv_nsec;
240};
241
242struct target__kernel_timespec {
243 abi_llong tv_sec;
244 abi_llong tv_nsec;
245};
246
247struct target_timezone {
248 abi_int tz_minuteswest;
249 abi_int tz_dsttime;
250};
251
252struct target_itimerval {
253 struct target_timeval it_interval;
254 struct target_timeval it_value;
255};
256
257struct target_itimerspec {
258 struct target_timespec it_interval;
259 struct target_timespec it_value;
260};
261
262struct target_timex {
263 abi_uint modes;
264 abi_long offset;
265 abi_long freq;
266 abi_long maxerror;
267 abi_long esterror;
268 abi_int status;
269 abi_long constant;
270 abi_long precision;
271 abi_long tolerance;
272 struct target_timeval time;
273 abi_long tick;
274 abi_long ppsfreq;
275 abi_long jitter;
276 abi_int shift;
277 abi_long stabil;
278 abi_long jitcnt;
279 abi_long calcnt;
280 abi_long errcnt;
281 abi_long stbcnt;
282 abi_int tai;
283
284
285 abi_int:32; abi_int:32; abi_int:32; abi_int:32;
286 abi_int:32; abi_int:32; abi_int:32; abi_int:32;
287 abi_int:32; abi_int:32; abi_int:32;
288};
289
290typedef abi_long target_clock_t;
291
292#define TARGET_HZ 100
293
294struct target_tms {
295 target_clock_t tms_utime;
296 target_clock_t tms_stime;
297 target_clock_t tms_cutime;
298 target_clock_t tms_cstime;
299};
300
301struct target_utimbuf {
302 abi_long actime;
303 abi_long modtime;
304};
305
306struct target_sel_arg_struct {
307 abi_long n;
308 abi_long inp, outp, exp;
309 abi_long tvp;
310};
311
312struct target_iovec {
313 abi_long iov_base;
314 abi_long iov_len;
315};
316
317struct target_msghdr {
318 abi_long msg_name;
319 int msg_namelen;
320 abi_long msg_iov;
321 abi_long msg_iovlen;
322 abi_long msg_control;
323 abi_long msg_controllen;
324 unsigned int msg_flags;
325};
326
327struct target_cmsghdr {
328 abi_long cmsg_len;
329 int cmsg_level;
330 int cmsg_type;
331};
332
333#define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1))
334#define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \
335 __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start)
336#define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \
337 & (size_t) ~(sizeof (abi_long) - 1))
338#define TARGET_CMSG_SPACE(len) (sizeof(struct target_cmsghdr) + \
339 TARGET_CMSG_ALIGN(len))
340#define TARGET_CMSG_LEN(len) (sizeof(struct target_cmsghdr) + (len))
341
342static __inline__ struct target_cmsghdr *
343__target_cmsg_nxthdr(struct target_msghdr *__mhdr,
344 struct target_cmsghdr *__cmsg,
345 struct target_cmsghdr *__cmsg_start)
346{
347 struct target_cmsghdr *__ptr;
348
349 __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg
350 + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len)));
351 if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start)
352 > tswapal(__mhdr->msg_controllen)) {
353
354 return (struct target_cmsghdr *)0;
355 }
356 return __ptr;
357}
358
359struct target_mmsghdr {
360 struct target_msghdr msg_hdr;
361 unsigned int msg_len;
362};
363
364struct target_rusage {
365 struct target_timeval ru_utime;
366 struct target_timeval ru_stime;
367 abi_long ru_maxrss;
368 abi_long ru_ixrss;
369 abi_long ru_idrss;
370 abi_long ru_isrss;
371 abi_long ru_minflt;
372 abi_long ru_majflt;
373 abi_long ru_nswap;
374 abi_long ru_inblock;
375 abi_long ru_oublock;
376 abi_long ru_msgsnd;
377 abi_long ru_msgrcv;
378 abi_long ru_nsignals;
379 abi_long ru_nvcsw;
380 abi_long ru_nivcsw;
381};
382
383typedef struct {
384 int val[2];
385} kernel_fsid_t;
386
387struct target_dirent {
388 abi_long d_ino;
389 abi_long d_off;
390 unsigned short d_reclen;
391 char d_name[];
392};
393
394struct target_dirent64 {
395 uint64_t d_ino;
396 int64_t d_off;
397 unsigned short d_reclen;
398 unsigned char d_type;
399 char d_name[256];
400};
401
402
403
404#define TARGET_SIG_DFL ((abi_long)0)
405#define TARGET_SIG_IGN ((abi_long)1)
406#define TARGET_SIG_ERR ((abi_long)-1)
407
408#ifdef TARGET_MIPS
409#define TARGET_NSIG 128
410#else
411#define TARGET_NSIG 64
412#endif
413#define TARGET_NSIG_BPW TARGET_ABI_BITS
414#define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW)
415
416typedef struct {
417 abi_ulong sig[TARGET_NSIG_WORDS];
418} target_sigset_t;
419
420#ifdef BSWAP_NEEDED
421static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
422{
423 int i;
424 for(i = 0;i < TARGET_NSIG_WORDS; i++)
425 d->sig[i] = tswapal(s->sig[i]);
426}
427#else
428static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
429{
430 *d = *s;
431}
432#endif
433
434static inline void target_siginitset(target_sigset_t *d, abi_ulong set)
435{
436 int i;
437 d->sig[0] = set;
438 for(i = 1;i < TARGET_NSIG_WORDS; i++)
439 d->sig[i] = 0;
440}
441
442void host_to_target_sigset(target_sigset_t *d, const sigset_t *s);
443void target_to_host_sigset(sigset_t *d, const target_sigset_t *s);
444void host_to_target_old_sigset(abi_ulong *old_sigset,
445 const sigset_t *sigset);
446void target_to_host_old_sigset(sigset_t *sigset,
447 const abi_ulong *old_sigset);
448struct target_sigaction;
449int do_sigaction(int sig, const struct target_sigaction *act,
450 struct target_sigaction *oact);
451
452#include "target_signal.h"
453
454#ifdef TARGET_SA_RESTORER
455#define TARGET_ARCH_HAS_SA_RESTORER 1
456#endif
457
458#if defined(TARGET_ALPHA)
459struct target_old_sigaction {
460 abi_ulong _sa_handler;
461 abi_ulong sa_mask;
462 int32_t sa_flags;
463};
464
465struct target_rt_sigaction {
466 abi_ulong _sa_handler;
467 abi_ulong sa_flags;
468 target_sigset_t sa_mask;
469};
470
471
472
473struct target_sigaction {
474 abi_ulong _sa_handler;
475 abi_ulong sa_flags;
476 target_sigset_t sa_mask;
477 abi_ulong sa_restorer;
478};
479#elif defined(TARGET_MIPS)
480struct target_sigaction {
481 uint32_t sa_flags;
482#if defined(TARGET_ABI_MIPSN32)
483 uint32_t _sa_handler;
484#else
485 abi_ulong _sa_handler;
486#endif
487 target_sigset_t sa_mask;
488#ifdef TARGET_ARCH_HAS_SA_RESTORER
489
490 abi_ulong sa_restorer;
491#endif
492};
493#else
494struct target_old_sigaction {
495 abi_ulong _sa_handler;
496 abi_ulong sa_mask;
497 abi_ulong sa_flags;
498#ifdef TARGET_ARCH_HAS_SA_RESTORER
499 abi_ulong sa_restorer;
500#endif
501};
502
503struct target_sigaction {
504 abi_ulong _sa_handler;
505 abi_ulong sa_flags;
506#ifdef TARGET_ARCH_HAS_SA_RESTORER
507 abi_ulong sa_restorer;
508#endif
509 target_sigset_t sa_mask;
510#ifdef TARGET_ARCH_HAS_KA_RESTORER
511 abi_ulong ka_restorer;
512#endif
513};
514#endif
515
516typedef union target_sigval {
517 int sival_int;
518 abi_ulong sival_ptr;
519} target_sigval_t;
520#if 0
521#if defined (TARGET_SPARC)
522typedef struct {
523 struct {
524 abi_ulong psr;
525 abi_ulong pc;
526 abi_ulong npc;
527 abi_ulong y;
528 abi_ulong u_regs[16];
529 } si_regs;
530 int si_mask;
531} __siginfo_t;
532
533typedef struct {
534 unsigned long si_float_regs [32];
535 unsigned long si_fsr;
536 unsigned long si_fpqdepth;
537 struct {
538 unsigned long *insn_addr;
539 unsigned long insn;
540 } si_fpqueue [16];
541} __siginfo_fpu_t;
542#endif
543#endif
544
545#define TARGET_SI_MAX_SIZE 128
546
547#if TARGET_ABI_BITS == 32
548#define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int))
549#else
550#define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int))
551#endif
552
553#define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int))
554
555
556
557
558
559
560
561
562
563#define QEMU_SI_KILL 0
564#define QEMU_SI_TIMER 1
565#define QEMU_SI_POLL 2
566#define QEMU_SI_FAULT 3
567#define QEMU_SI_CHLD 4
568#define QEMU_SI_RT 5
569
570typedef struct target_siginfo {
571#ifdef TARGET_MIPS
572 int si_signo;
573 int si_code;
574 int si_errno;
575#else
576 int si_signo;
577 int si_errno;
578 int si_code;
579#endif
580
581 union {
582 int _pad[TARGET_SI_PAD_SIZE];
583
584
585 struct {
586 pid_t _pid;
587 uid_t _uid;
588 } _kill;
589
590
591 struct {
592 unsigned int _timer1;
593 unsigned int _timer2;
594 } _timer;
595
596
597 struct {
598 pid_t _pid;
599 uid_t _uid;
600 target_sigval_t _sigval;
601 } _rt;
602
603
604 struct {
605 pid_t _pid;
606 uid_t _uid;
607 int _status;
608 target_clock_t _utime;
609 target_clock_t _stime;
610 } _sigchld;
611
612
613 struct {
614 abi_ulong _addr;
615 } _sigfault;
616
617
618 struct {
619 int _band;
620 int _fd;
621 } _sigpoll;
622 } _sifields;
623} target_siginfo_t;
624
625
626
627
628
629#define TARGET_SI_USER 0
630#define TARGET_SI_KERNEL 0x80
631#define TARGET_SI_QUEUE -1
632#define TARGET_SI_TIMER -2
633#define TARGET_SI_MESGQ -3
634#define TARGET_SI_ASYNCIO -4
635#define TARGET_SI_SIGIO -5
636
637
638
639
640#define TARGET_ILL_ILLOPC (1)
641#define TARGET_ILL_ILLOPN (2)
642#define TARGET_ILL_ILLADR (3)
643#define TARGET_ILL_ILLTRP (4)
644#define TARGET_ILL_PRVOPC (5)
645#define TARGET_ILL_PRVREG (6)
646#define TARGET_ILL_COPROC (7)
647#define TARGET_ILL_BADSTK (8)
648#ifdef TARGET_TILEGX
649#define TARGET_ILL_DBLFLT (9)
650#define TARGET_ILL_HARDWALL (10)
651#endif
652
653
654
655
656#define TARGET_FPE_INTDIV (1)
657#define TARGET_FPE_INTOVF (2)
658#define TARGET_FPE_FLTDIV (3)
659#define TARGET_FPE_FLTOVF (4)
660#define TARGET_FPE_FLTUND (5)
661#define TARGET_FPE_FLTRES (6)
662#define TARGET_FPE_FLTINV (7)
663#define TARGET_FPE_FLTSUB (8)
664#define TARGET_FPE_FLTUNK (14)
665#define TARGET_NSIGFPE 15
666
667
668
669
670#define TARGET_SEGV_MAPERR (1)
671#define TARGET_SEGV_ACCERR (2)
672#define TARGET_SEGV_BNDERR (3)
673
674
675
676
677#define TARGET_BUS_ADRALN (1)
678#define TARGET_BUS_ADRERR (2)
679#define TARGET_BUS_OBJERR (3)
680
681#define TARGET_BUS_MCEERR_AR (4)
682
683#define TARGET_BUS_MCEERR_AO (5)
684
685
686
687
688#define TARGET_TRAP_BRKPT (1)
689#define TARGET_TRAP_TRACE (2)
690#define TARGET_TRAP_BRANCH (3)
691#define TARGET_TRAP_HWBKPT (4)
692
693struct target_rlimit {
694 abi_ulong rlim_cur;
695 abi_ulong rlim_max;
696};
697
698#if defined(TARGET_ALPHA)
699#define TARGET_RLIM_INFINITY 0x7fffffffffffffffull
700#elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32)
701#define TARGET_RLIM_INFINITY 0x7fffffffUL
702#else
703#define TARGET_RLIM_INFINITY ((abi_ulong)-1)
704#endif
705
706#if defined(TARGET_MIPS)
707#define TARGET_RLIMIT_CPU 0
708#define TARGET_RLIMIT_FSIZE 1
709#define TARGET_RLIMIT_DATA 2
710#define TARGET_RLIMIT_STACK 3
711#define TARGET_RLIMIT_CORE 4
712#define TARGET_RLIMIT_RSS 7
713#define TARGET_RLIMIT_NPROC 8
714#define TARGET_RLIMIT_NOFILE 5
715#define TARGET_RLIMIT_MEMLOCK 9
716#define TARGET_RLIMIT_AS 6
717#define TARGET_RLIMIT_LOCKS 10
718#define TARGET_RLIMIT_SIGPENDING 11
719#define TARGET_RLIMIT_MSGQUEUE 12
720#define TARGET_RLIMIT_NICE 13
721#define TARGET_RLIMIT_RTPRIO 14
722#else
723#define TARGET_RLIMIT_CPU 0
724#define TARGET_RLIMIT_FSIZE 1
725#define TARGET_RLIMIT_DATA 2
726#define TARGET_RLIMIT_STACK 3
727#define TARGET_RLIMIT_CORE 4
728#define TARGET_RLIMIT_RSS 5
729#if defined(TARGET_SPARC)
730#define TARGET_RLIMIT_NOFILE 6
731#define TARGET_RLIMIT_NPROC 7
732#else
733#define TARGET_RLIMIT_NPROC 6
734#define TARGET_RLIMIT_NOFILE 7
735#endif
736#define TARGET_RLIMIT_MEMLOCK 8
737#define TARGET_RLIMIT_AS 9
738#define TARGET_RLIMIT_LOCKS 10
739#define TARGET_RLIMIT_SIGPENDING 11
740#define TARGET_RLIMIT_MSGQUEUE 12
741#define TARGET_RLIMIT_NICE 13
742#define TARGET_RLIMIT_RTPRIO 14
743#endif
744
745struct target_pollfd {
746 int fd;
747 short events;
748 short revents;
749};
750
751
752#define TARGET_KIOCSOUND 0x4B2F
753#define TARGET_KDMKTONE 0x4B30
754#define TARGET_KDGKBTYPE 0x4b33
755#define TARGET_KDSETMODE 0x4b3a
756#define TARGET_KDGKBMODE 0x4b44
757#define TARGET_KDSKBMODE 0x4b45
758#define TARGET_KDGKBENT 0x4B46
759#define TARGET_KDGKBSENT 0x4B48
760#define TARGET_KDGKBLED 0x4B64
761#define TARGET_KDSKBLED 0x4B65
762#define TARGET_KDGETLED 0x4B31
763#define TARGET_KDSETLED 0x4B32
764#define TARGET_KDSIGACCEPT 0x4B4E
765
766#if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) || \
767 defined(TARGET_XTENSA)
768#define TARGET_FIOGETOWN TARGET_IOR('f', 123, int)
769#define TARGET_FIOSETOWN TARGET_IOW('f', 124, int)
770#define TARGET_SIOCATMARK TARGET_IOR('s', 7, int)
771#define TARGET_SIOCSPGRP TARGET_IOW('s', 8, pid_t)
772#define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t)
773#else
774#define TARGET_FIOGETOWN 0x8903
775#define TARGET_FIOSETOWN 0x8901
776#define TARGET_SIOCATMARK 0x8905
777#define TARGET_SIOCSPGRP 0x8902
778#define TARGET_SIOCGPGRP 0x8904
779#endif
780
781#if defined(TARGET_SH4)
782#define TARGET_SIOCGSTAMP_OLD TARGET_IOR('s', 100, struct target_timeval)
783#define TARGET_SIOCGSTAMPNS_OLD TARGET_IOR('s', 101, struct target_timespec)
784#else
785#define TARGET_SIOCGSTAMP_OLD 0x8906
786#define TARGET_SIOCGSTAMPNS_OLD 0x8907
787#endif
788
789#define TARGET_SIOCGSTAMP_NEW TARGET_IOR(0x89, 0x06, abi_llong[2])
790#define TARGET_SIOCGSTAMPNS_NEW TARGET_IOR(0x89, 0x07, abi_llong[2])
791
792
793#define TARGET_SIOCADDRT 0x890B
794#define TARGET_SIOCDELRT 0x890C
795#define TARGET_SIOCGIFNAME 0x8910
796#define TARGET_SIOCSIFLINK 0x8911
797#define TARGET_SIOCGIFCONF 0x8912
798#define TARGET_SIOCGIFFLAGS 0x8913
799#define TARGET_SIOCSIFFLAGS 0x8914
800#define TARGET_SIOCGIFADDR 0x8915
801#define TARGET_SIOCSIFADDR 0x8916
802#define TARGET_SIOCGIFDSTADDR 0x8917
803#define TARGET_SIOCSIFDSTADDR 0x8918
804#define TARGET_SIOCGIFBRDADDR 0x8919
805#define TARGET_SIOCSIFBRDADDR 0x891a
806#define TARGET_SIOCGIFNETMASK 0x891b
807#define TARGET_SIOCSIFNETMASK 0x891c
808#define TARGET_SIOCGIFMETRIC 0x891d
809#define TARGET_SIOCSIFMETRIC 0x891e
810#define TARGET_SIOCGIFMEM 0x891f
811#define TARGET_SIOCSIFMEM 0x8920
812#define TARGET_SIOCGIFMTU 0x8921
813#define TARGET_SIOCSIFMTU 0x8922
814#define TARGET_SIOCSIFHWADDR 0x8924
815#define TARGET_SIOCGIFENCAP 0x8925
816#define TARGET_SIOCSIFENCAP 0x8926
817#define TARGET_SIOCGIFHWADDR 0x8927
818#define TARGET_SIOCGIFSLAVE 0x8929
819#define TARGET_SIOCSIFSLAVE 0x8930
820#define TARGET_SIOCADDMULTI 0x8931
821#define TARGET_SIOCDELMULTI 0x8932
822#define TARGET_SIOCGIFINDEX 0x8933
823#define TARGET_SIOCSIFPFLAGS 0x8934
824#define TARGET_SIOCGIFPFLAGS 0x8935
825
826
827#define TARGET_SIOCGIFBR 0x8940
828#define TARGET_SIOCSIFBR 0x8941
829
830#define TARGET_SIOCGIFTXQLEN 0x8942
831#define TARGET_SIOCSIFTXQLEN 0x8943
832
833
834#define TARGET_OLD_SIOCDARP 0x8950
835#define TARGET_OLD_SIOCGARP 0x8951
836#define TARGET_OLD_SIOCSARP 0x8952
837#define TARGET_SIOCDARP 0x8953
838#define TARGET_SIOCGARP 0x8954
839#define TARGET_SIOCSARP 0x8955
840
841
842#define TARGET_SIOCDRARP 0x8960
843#define TARGET_SIOCGRARP 0x8961
844#define TARGET_SIOCSRARP 0x8962
845
846
847#define TARGET_SIOCGIFMAP 0x8970
848#define TARGET_SIOCSIFMAP 0x8971
849
850
851#define TARGET_SIOCADDDLCI 0x8980
852#define TARGET_SIOCDELDLCI 0x8981
853
854
855
856#define TARGET_SIOCGIWNAME 0x8B01
857
858
859
860#define TARGET_RNDGETENTCNT TARGET_IOR('R', 0x00, int)
861#define TARGET_RNDADDTOENTCNT TARGET_IOW('R', 0x01, int)
862#define TARGET_RNDZAPENTCNT TARGET_IO('R', 0x04)
863#define TARGET_RNDCLEARPOOL TARGET_IO('R', 0x06)
864#define TARGET_RNDRESEEDCRNG TARGET_IO('R', 0x07)
865
866
867
868#define TARGET_BLKROSET TARGET_IO(0x12,93)
869#define TARGET_BLKROGET TARGET_IO(0x12,94)
870#define TARGET_BLKRRPART TARGET_IO(0x12,95)
871#define TARGET_BLKGETSIZE TARGET_IO(0x12,96)
872#define TARGET_BLKFLSBUF TARGET_IO(0x12,97)
873#define TARGET_BLKRASET TARGET_IO(0x12,98)
874#define TARGET_BLKRAGET TARGET_IO(0x12,99)
875#define TARGET_BLKFRASET TARGET_IO(0x12,100)
876#define TARGET_BLKFRAGET TARGET_IO(0x12,101)
877#define TARGET_BLKSECTSET TARGET_IO(0x12,102)
878#define TARGET_BLKSECTGET TARGET_IO(0x12,103)
879#define TARGET_BLKSSZGET TARGET_IO(0x12,104)
880#define TARGET_BLKPG TARGET_IO(0x12,105)
881
882#define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong)
883#define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong)
884#define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong)
885
886
887
888#define TARGET_BLKDISCARD TARGET_IO(0x12, 119)
889#define TARGET_BLKIOMIN TARGET_IO(0x12, 120)
890#define TARGET_BLKIOOPT TARGET_IO(0x12, 121)
891#define TARGET_BLKALIGNOFF TARGET_IO(0x12, 122)
892#define TARGET_BLKPBSZGET TARGET_IO(0x12, 123)
893#define TARGET_BLKDISCARDZEROES TARGET_IO(0x12, 124)
894#define TARGET_BLKSECDISCARD TARGET_IO(0x12, 125)
895#define TARGET_BLKROTATIONAL TARGET_IO(0x12, 126)
896#define TARGET_BLKZEROOUT TARGET_IO(0x12, 127)
897
898
899
900#define TARGET_FDMSGON TARGET_IO(2, 0x45)
901#define TARGET_FDMSGOFF TARGET_IO(2, 0x46)
902#define TARGET_FDFLUSH TARGET_IO(2, 0x4b)
903#define TARGET_FDRESET TARGET_IO(2, 0x54)
904#define TARGET_FDRAWCMD TARGET_IO(2, 0x58)
905#define TARGET_FDTWADDLE TARGET_IO(2, 0x59)
906#define TARGET_FDEJECT TARGET_IO(2, 0x5a)
907
908#define TARGET_FIBMAP TARGET_IO(0x00,1)
909#define TARGET_FIGETBSZ TARGET_IO(0x00,2)
910
911#define TARGET_FICLONE TARGET_IOW(0x94, 9, int)
912#define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range)
913
914
915
916
917#define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, abi_long)
918#define TARGET_FS_IOC_SETFLAGS TARGET_IOW('f', 2, abi_long)
919
920#define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap)
921
922
923#define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0)
924#define TARGET_USBDEVFS_BULK TARGET_IOWRU('U', 2)
925#define TARGET_USBDEVFS_RESETEP TARGET_IORU('U', 3)
926#define TARGET_USBDEVFS_SETINTERFACE TARGET_IORU('U', 4)
927#define TARGET_USBDEVFS_SETCONFIGURATION TARGET_IORU('U', 5)
928#define TARGET_USBDEVFS_GETDRIVER TARGET_IOWU('U', 8)
929#define TARGET_USBDEVFS_SUBMITURB TARGET_IORU('U', 10)
930#define TARGET_USBDEVFS_DISCARDURB TARGET_IO('U', 11)
931#define TARGET_USBDEVFS_REAPURB TARGET_IOWU('U', 12)
932#define TARGET_USBDEVFS_REAPURBNDELAY TARGET_IOWU('U', 13)
933#define TARGET_USBDEVFS_DISCSIGNAL TARGET_IORU('U', 14)
934#define TARGET_USBDEVFS_CLAIMINTERFACE TARGET_IORU('U', 15)
935#define TARGET_USBDEVFS_RELEASEINTERFACE TARGET_IORU('U', 16)
936#define TARGET_USBDEVFS_CONNECTINFO TARGET_IOWU('U', 17)
937#define TARGET_USBDEVFS_IOCTL TARGET_IOWRU('U', 18)
938#define TARGET_USBDEVFS_HUB_PORTINFO TARGET_IORU('U', 19)
939#define TARGET_USBDEVFS_RESET TARGET_IO('U', 20)
940#define TARGET_USBDEVFS_CLEAR_HALT TARGET_IORU('U', 21)
941#define TARGET_USBDEVFS_DISCONNECT TARGET_IO('U', 22)
942#define TARGET_USBDEVFS_CONNECT TARGET_IO('U', 23)
943#define TARGET_USBDEVFS_CLAIM_PORT TARGET_IORU('U', 24)
944#define TARGET_USBDEVFS_RELEASE_PORT TARGET_IORU('U', 25)
945#define TARGET_USBDEVFS_GET_CAPABILITIES TARGET_IORU('U', 26)
946#define TARGET_USBDEVFS_DISCONNECT_CLAIM TARGET_IORU('U', 27)
947#define TARGET_USBDEVFS_DROP_PRIVILEGES TARGET_IOWU('U', 30)
948#define TARGET_USBDEVFS_GET_SPEED TARGET_IO('U', 31)
949
950
951#define TARGET_CDROMPAUSE 0x5301
952#define TARGET_CDROMRESUME 0x5302
953#define TARGET_CDROMPLAYMSF 0x5303
954#define TARGET_CDROMPLAYTRKIND 0x5304
955
956#define TARGET_CDROMREADTOCHDR 0x5305
957
958#define TARGET_CDROMREADTOCENTRY 0x5306
959
960#define TARGET_CDROMSTOP 0x5307
961#define TARGET_CDROMSTART 0x5308
962#define TARGET_CDROMEJECT 0x5309
963#define TARGET_CDROMVOLCTRL 0x530a
964
965#define TARGET_CDROMSUBCHNL 0x530b
966
967#define TARGET_CDROMREADMODE2 0x530c
968
969#define TARGET_CDROMREADMODE1 0x530d
970
971#define TARGET_CDROMREADAUDIO 0x530e
972#define TARGET_CDROMEJECT_SW 0x530f
973#define TARGET_CDROMMULTISESSION 0x5310
974
975
976#define TARGET_CDROM_GET_MCN 0x5311
977
978#define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN
979
980#define TARGET_CDROMRESET 0x5312
981#define TARGET_CDROMVOLREAD 0x5313
982
983#define TARGET_CDROMREADRAW 0x5314
984
985
986
987
988#define TARGET_CDROMREADCOOKED 0x5315
989#define TARGET_CDROMSEEK 0x5316
990
991
992
993
994
995#define TARGET_CDROMPLAYBLK 0x5317
996
997
998
999
1000#define TARGET_CDROMREADALL 0x5318
1001
1002
1003
1004
1005
1006
1007
1008
1009#define TARGET_CDROMGETSPINDOWN 0x531d
1010#define TARGET_CDROMSETSPINDOWN 0x531e
1011
1012
1013
1014
1015
1016
1017#define TARGET_CDROMCLOSETRAY 0x5319
1018#define TARGET_CDROM_SET_OPTIONS 0x5320
1019#define TARGET_CDROM_CLEAR_OPTIONS 0x5321
1020#define TARGET_CDROM_SELECT_SPEED 0x5322
1021#define TARGET_CDROM_SELECT_DISC 0x5323
1022#define TARGET_CDROM_MEDIA_CHANGED 0x5325
1023#define TARGET_CDROM_DRIVE_STATUS 0x5326
1024#define TARGET_CDROM_DISC_STATUS 0x5327
1025#define TARGET_CDROM_CHANGER_NSLOTS 0x5328
1026#define TARGET_CDROM_LOCKDOOR 0x5329
1027#define TARGET_CDROM_DEBUG 0x5330
1028#define TARGET_CDROM_GET_CAPABILITY 0x5331
1029
1030
1031
1032
1033
1034
1035#define TARGET_CDROMAUDIOBUFSIZ 0x5382
1036
1037
1038
1039#define TARGET_DVD_READ_STRUCT 0x5390
1040#define TARGET_DVD_WRITE_STRUCT 0x5391
1041#define TARGET_DVD_AUTH 0x5392
1042
1043#define TARGET_CDROM_SEND_PACKET 0x5393
1044#define TARGET_CDROM_NEXT_WRITABLE 0x5394
1045#define TARGET_CDROM_LAST_WRITTEN 0x5395
1046
1047
1048
1049
1050#define TARGET_HDIO_GETGEO 0x0301
1051#define TARGET_HDIO_GET_UNMASKINTR 0x0302
1052#define TARGET_HDIO_GET_MULTCOUNT 0x0304
1053#define TARGET_HDIO_GET_KEEPSETTINGS 0x0308
1054#define TARGET_HDIO_GET_32BIT 0x0309
1055#define TARGET_HDIO_GET_NOWERR 0x030a
1056#define TARGET_HDIO_GET_DMA 0x030b
1057#define TARGET_HDIO_GET_IDENTITY 0x030d
1058#define TARGET_HDIO_DRIVE_CMD 0x031f
1059
1060
1061#define TARGET_HDIO_SET_MULTCOUNT 0x0321
1062#define TARGET_HDIO_SET_UNMASKINTR 0x0322
1063#define TARGET_HDIO_SET_KEEPSETTINGS 0x0323
1064#define TARGET_HDIO_SET_32BIT 0x0324
1065#define TARGET_HDIO_SET_NOWERR 0x0325
1066#define TARGET_HDIO_SET_DMA 0x0326
1067#define TARGET_HDIO_SET_PIO_MODE 0x0327
1068
1069
1070#define TARGET_LOOP_SET_FD 0x4C00
1071#define TARGET_LOOP_CLR_FD 0x4C01
1072#define TARGET_LOOP_SET_STATUS 0x4C02
1073#define TARGET_LOOP_GET_STATUS 0x4C03
1074#define TARGET_LOOP_SET_STATUS64 0x4C04
1075#define TARGET_LOOP_GET_STATUS64 0x4C05
1076#define TARGET_LOOP_CHANGE_FD 0x4C06
1077
1078#define TARGET_LOOP_CTL_ADD 0x4C80
1079#define TARGET_LOOP_CTL_REMOVE 0x4C81
1080#define TARGET_LOOP_CTL_GET_FREE 0x4C82
1081
1082
1083#define TARGET_FBIOGET_VSCREENINFO 0x4600
1084#define TARGET_FBIOPUT_VSCREENINFO 0x4601
1085#define TARGET_FBIOGET_FSCREENINFO 0x4602
1086#define TARGET_FBIOGETCMAP 0x4604
1087#define TARGET_FBIOPUTCMAP 0x4605
1088#define TARGET_FBIOPAN_DISPLAY 0x4606
1089#define TARGET_FBIOGET_CON2FBMAP 0x460F
1090#define TARGET_FBIOPUT_CON2FBMAP 0x4610
1091
1092
1093#define TARGET_VT_OPENQRY 0x5600
1094#define TARGET_VT_GETSTATE 0x5603
1095#define TARGET_VT_ACTIVATE 0x5606
1096#define TARGET_VT_WAITACTIVE 0x5607
1097#define TARGET_VT_LOCKSWITCH 0x560b
1098#define TARGET_VT_UNLOCKSWITCH 0x560c
1099#define TARGET_VT_GETMODE 0x5601
1100#define TARGET_VT_SETMODE 0x5602
1101#define TARGET_VT_RELDISP 0x5605
1102#define TARGET_VT_DISALLOCATE 0x5608
1103
1104
1105#define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00)
1106#define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01)
1107#define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02)
1108#define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03)
1109#define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04)
1110#define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05)
1111#define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06)
1112#define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07)
1113#define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08)
1114#define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09)
1115#define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a)
1116#define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b)
1117#define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c)
1118#define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d)
1119#define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e)
1120#define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f)
1121
1122
1123
1124#define TARGET_NCC 8
1125struct target_termio {
1126 unsigned short c_iflag;
1127 unsigned short c_oflag;
1128 unsigned short c_cflag;
1129 unsigned short c_lflag;
1130 unsigned char c_line;
1131 unsigned char c_cc[TARGET_NCC];
1132};
1133
1134struct target_winsize {
1135 unsigned short ws_row;
1136 unsigned short ws_col;
1137 unsigned short ws_xpixel;
1138 unsigned short ws_ypixel;
1139};
1140
1141#include "termbits.h"
1142
1143#if defined(TARGET_MIPS)
1144#define TARGET_PROT_SEM 0x10
1145#else
1146#define TARGET_PROT_SEM 0x08
1147#endif
1148
1149
1150#define TARGET_MAP_SHARED 0x01
1151#define TARGET_MAP_PRIVATE 0x02
1152#if defined(TARGET_HPPA)
1153#define TARGET_MAP_TYPE 0x03
1154#else
1155#define TARGET_MAP_TYPE 0x0f
1156#endif
1157
1158
1159#if defined(TARGET_MIPS)
1160#define TARGET_MAP_FIXED 0x10
1161#define TARGET_MAP_ANONYMOUS 0x0800
1162#define TARGET_MAP_GROWSDOWN 0x1000
1163#define TARGET_MAP_DENYWRITE 0x2000
1164#define TARGET_MAP_EXECUTABLE 0x4000
1165#define TARGET_MAP_LOCKED 0x8000
1166#define TARGET_MAP_NORESERVE 0x0400
1167#define TARGET_MAP_POPULATE 0x10000
1168#define TARGET_MAP_NONBLOCK 0x20000
1169#define TARGET_MAP_STACK 0x40000
1170#define TARGET_MAP_HUGETLB 0x80000
1171#elif defined(TARGET_PPC)
1172#define TARGET_MAP_FIXED 0x10
1173#define TARGET_MAP_ANONYMOUS 0x20
1174#define TARGET_MAP_GROWSDOWN 0x0100
1175#define TARGET_MAP_DENYWRITE 0x0800
1176#define TARGET_MAP_EXECUTABLE 0x1000
1177#define TARGET_MAP_LOCKED 0x0080
1178#define TARGET_MAP_NORESERVE 0x0040
1179#define TARGET_MAP_POPULATE 0x8000
1180#define TARGET_MAP_NONBLOCK 0x10000
1181#define TARGET_MAP_STACK 0x20000
1182#define TARGET_MAP_HUGETLB 0x40000
1183#elif defined(TARGET_ALPHA)
1184#define TARGET_MAP_ANONYMOUS 0x10
1185#define TARGET_MAP_FIXED 0x100
1186#define TARGET_MAP_GROWSDOWN 0x01000
1187#define TARGET_MAP_DENYWRITE 0x02000
1188#define TARGET_MAP_EXECUTABLE 0x04000
1189#define TARGET_MAP_LOCKED 0x08000
1190#define TARGET_MAP_NORESERVE 0x10000
1191#define TARGET_MAP_POPULATE 0x20000
1192#define TARGET_MAP_NONBLOCK 0x40000
1193#define TARGET_MAP_STACK 0x80000
1194#define TARGET_MAP_HUGETLB 0x100000
1195#elif defined(TARGET_HPPA)
1196#define TARGET_MAP_ANONYMOUS 0x10
1197#define TARGET_MAP_FIXED 0x04
1198#define TARGET_MAP_GROWSDOWN 0x08000
1199#define TARGET_MAP_DENYWRITE 0x00800
1200#define TARGET_MAP_EXECUTABLE 0x01000
1201#define TARGET_MAP_LOCKED 0x02000
1202#define TARGET_MAP_NORESERVE 0x04000
1203#define TARGET_MAP_POPULATE 0x10000
1204#define TARGET_MAP_NONBLOCK 0x20000
1205#define TARGET_MAP_STACK 0x40000
1206#define TARGET_MAP_HUGETLB 0x80000
1207#elif defined(TARGET_XTENSA)
1208#define TARGET_MAP_FIXED 0x10
1209#define TARGET_MAP_ANONYMOUS 0x0800
1210#define TARGET_MAP_GROWSDOWN 0x1000
1211#define TARGET_MAP_DENYWRITE 0x2000
1212#define TARGET_MAP_EXECUTABLE 0x4000
1213#define TARGET_MAP_LOCKED 0x8000
1214#define TARGET_MAP_NORESERVE 0x0400
1215#define TARGET_MAP_POPULATE 0x10000
1216#define TARGET_MAP_NONBLOCK 0x20000
1217#define TARGET_MAP_STACK 0x40000
1218#define TARGET_MAP_HUGETLB 0x80000
1219#else
1220#define TARGET_MAP_FIXED 0x10
1221#define TARGET_MAP_ANONYMOUS 0x20
1222#define TARGET_MAP_GROWSDOWN 0x0100
1223#define TARGET_MAP_DENYWRITE 0x0800
1224#define TARGET_MAP_EXECUTABLE 0x1000
1225#define TARGET_MAP_LOCKED 0x2000
1226#define TARGET_MAP_NORESERVE 0x4000
1227#define TARGET_MAP_POPULATE 0x8000
1228#define TARGET_MAP_NONBLOCK 0x10000
1229#define TARGET_MAP_STACK 0x20000
1230#define TARGET_MAP_HUGETLB 0x40000
1231#define TARGET_MAP_UNINITIALIZED 0x4000000
1232#endif
1233
1234#if (defined(TARGET_I386) && defined(TARGET_ABI32)) \
1235 || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \
1236 || defined(TARGET_CRIS)
1237#define TARGET_STAT_HAVE_NSEC
1238struct target_stat {
1239 unsigned short st_dev;
1240 unsigned short __pad1;
1241 abi_ulong st_ino;
1242 unsigned short st_mode;
1243 unsigned short st_nlink;
1244 unsigned short st_uid;
1245 unsigned short st_gid;
1246 unsigned short st_rdev;
1247 unsigned short __pad2;
1248 abi_ulong st_size;
1249 abi_ulong st_blksize;
1250 abi_ulong st_blocks;
1251 abi_ulong target_st_atime;
1252 abi_ulong target_st_atime_nsec;
1253 abi_ulong target_st_mtime;
1254 abi_ulong target_st_mtime_nsec;
1255 abi_ulong target_st_ctime;
1256 abi_ulong target_st_ctime_nsec;
1257 abi_ulong __unused4;
1258 abi_ulong __unused5;
1259};
1260
1261
1262
1263
1264#define TARGET_HAS_STRUCT_STAT64
1265struct target_stat64 {
1266 unsigned short st_dev;
1267 unsigned char __pad0[10];
1268
1269#define TARGET_STAT64_HAS_BROKEN_ST_INO 1
1270 abi_ulong __st_ino;
1271
1272 unsigned int st_mode;
1273 unsigned int st_nlink;
1274
1275 abi_ulong st_uid;
1276 abi_ulong st_gid;
1277
1278 unsigned short st_rdev;
1279 unsigned char __pad3[10];
1280
1281 long long st_size;
1282 abi_ulong st_blksize;
1283
1284 abi_ulong st_blocks;
1285 abi_ulong __pad4;
1286
1287 abi_ulong target_st_atime;
1288 abi_ulong target_st_atime_nsec;
1289
1290 abi_ulong target_st_mtime;
1291 abi_ulong target_st_mtime_nsec;
1292
1293 abi_ulong target_st_ctime;
1294 abi_ulong target_st_ctime_nsec;
1295
1296 unsigned long long st_ino;
1297} QEMU_PACKED;
1298
1299#ifdef TARGET_ARM
1300#define TARGET_HAS_STRUCT_STAT64
1301struct target_eabi_stat64 {
1302 unsigned long long st_dev;
1303 unsigned int __pad1;
1304 abi_ulong __st_ino;
1305 unsigned int st_mode;
1306 unsigned int st_nlink;
1307
1308 abi_ulong st_uid;
1309 abi_ulong st_gid;
1310
1311 unsigned long long st_rdev;
1312 unsigned int __pad2[2];
1313
1314 long long st_size;
1315 abi_ulong st_blksize;
1316 unsigned int __pad3;
1317 unsigned long long st_blocks;
1318
1319 abi_ulong target_st_atime;
1320 abi_ulong target_st_atime_nsec;
1321
1322 abi_ulong target_st_mtime;
1323 abi_ulong target_st_mtime_nsec;
1324
1325 abi_ulong target_st_ctime;
1326 abi_ulong target_st_ctime_nsec;
1327
1328 unsigned long long st_ino;
1329} QEMU_PACKED;
1330#endif
1331
1332#elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
1333struct target_stat {
1334 unsigned int st_dev;
1335 abi_ulong st_ino;
1336 unsigned int st_mode;
1337 unsigned int st_nlink;
1338 unsigned int st_uid;
1339 unsigned int st_gid;
1340 unsigned int st_rdev;
1341 abi_long st_size;
1342 abi_long target_st_atime;
1343 abi_long target_st_mtime;
1344 abi_long target_st_ctime;
1345 abi_long st_blksize;
1346 abi_long st_blocks;
1347 abi_ulong __unused4[2];
1348};
1349
1350#define TARGET_HAS_STRUCT_STAT64
1351struct target_stat64 {
1352 unsigned char __pad0[6];
1353 unsigned short st_dev;
1354
1355 uint64_t st_ino;
1356 uint64_t st_nlink;
1357
1358 unsigned int st_mode;
1359
1360 unsigned int st_uid;
1361 unsigned int st_gid;
1362
1363 unsigned char __pad2[6];
1364 unsigned short st_rdev;
1365
1366 int64_t st_size;
1367 int64_t st_blksize;
1368
1369 unsigned char __pad4[4];
1370 unsigned int st_blocks;
1371
1372 abi_ulong target_st_atime;
1373 abi_ulong target_st_atime_nsec;
1374
1375 abi_ulong target_st_mtime;
1376 abi_ulong target_st_mtime_nsec;
1377
1378 abi_ulong target_st_ctime;
1379 abi_ulong target_st_ctime_nsec;
1380
1381 abi_ulong __unused4[3];
1382};
1383
1384#elif defined(TARGET_SPARC)
1385
1386#define TARGET_STAT_HAVE_NSEC
1387struct target_stat {
1388 unsigned short st_dev;
1389 abi_ulong st_ino;
1390 unsigned short st_mode;
1391 short st_nlink;
1392 unsigned short st_uid;
1393 unsigned short st_gid;
1394 unsigned short st_rdev;
1395 abi_long st_size;
1396 abi_long target_st_atime;
1397 abi_ulong target_st_atime_nsec;
1398 abi_long target_st_mtime;
1399 abi_ulong target_st_mtime_nsec;
1400 abi_long target_st_ctime;
1401 abi_ulong target_st_ctime_nsec;
1402 abi_long st_blksize;
1403 abi_long st_blocks;
1404 abi_ulong __unused1[2];
1405};
1406
1407#define TARGET_HAS_STRUCT_STAT64
1408struct target_stat64 {
1409 unsigned char __pad0[6];
1410 unsigned short st_dev;
1411
1412 uint64_t st_ino;
1413
1414 unsigned int st_mode;
1415 unsigned int st_nlink;
1416
1417 unsigned int st_uid;
1418 unsigned int st_gid;
1419
1420 unsigned char __pad2[6];
1421 unsigned short st_rdev;
1422
1423 unsigned char __pad3[8];
1424
1425 int64_t st_size;
1426 unsigned int st_blksize;
1427
1428 unsigned char __pad4[8];
1429 unsigned int st_blocks;
1430
1431 unsigned int target_st_atime;
1432 unsigned int target_st_atime_nsec;
1433
1434 unsigned int target_st_mtime;
1435 unsigned int target_st_mtime_nsec;
1436
1437 unsigned int target_st_ctime;
1438 unsigned int target_st_ctime_nsec;
1439
1440 unsigned int __unused1;
1441 unsigned int __unused2;
1442};
1443
1444#elif defined(TARGET_PPC)
1445
1446#define TARGET_STAT_HAVE_NSEC
1447struct target_stat {
1448 abi_ulong st_dev;
1449 abi_ulong st_ino;
1450#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
1451 abi_ulong st_nlink;
1452 unsigned int st_mode;
1453#else
1454 unsigned int st_mode;
1455 unsigned short st_nlink;
1456#endif
1457 unsigned int st_uid;
1458 unsigned int st_gid;
1459 abi_ulong st_rdev;
1460 abi_ulong st_size;
1461 abi_ulong st_blksize;
1462 abi_ulong st_blocks;
1463 abi_ulong target_st_atime;
1464 abi_ulong target_st_atime_nsec;
1465 abi_ulong target_st_mtime;
1466 abi_ulong target_st_mtime_nsec;
1467 abi_ulong target_st_ctime;
1468 abi_ulong target_st_ctime_nsec;
1469 abi_ulong __unused4;
1470 abi_ulong __unused5;
1471#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
1472 abi_ulong __unused6;
1473#endif
1474};
1475
1476#if !defined(TARGET_PPC64) || defined(TARGET_ABI32)
1477#define TARGET_HAS_STRUCT_STAT64
1478struct QEMU_PACKED target_stat64 {
1479 unsigned long long st_dev;
1480 unsigned long long st_ino;
1481 unsigned int st_mode;
1482 unsigned int st_nlink;
1483 unsigned int st_uid;
1484 unsigned int st_gid;
1485 unsigned long long st_rdev;
1486 unsigned long long __pad0;
1487 long long st_size;
1488 int st_blksize;
1489 unsigned int __pad1;
1490 long long st_blocks;
1491 int target_st_atime;
1492 unsigned int target_st_atime_nsec;
1493 int target_st_mtime;
1494 unsigned int target_st_mtime_nsec;
1495 int target_st_ctime;
1496 unsigned int target_st_ctime_nsec;
1497 unsigned int __unused4;
1498 unsigned int __unused5;
1499};
1500#endif
1501
1502#elif defined(TARGET_MICROBLAZE)
1503
1504#define TARGET_STAT_HAVE_NSEC
1505struct target_stat {
1506 abi_ulong st_dev;
1507 abi_ulong st_ino;
1508 unsigned int st_mode;
1509 unsigned short st_nlink;
1510 unsigned int st_uid;
1511 unsigned int st_gid;
1512 abi_ulong st_rdev;
1513 abi_ulong st_size;
1514 abi_ulong st_blksize;
1515 abi_ulong st_blocks;
1516 abi_ulong target_st_atime;
1517 abi_ulong target_st_atime_nsec;
1518 abi_ulong target_st_mtime;
1519 abi_ulong target_st_mtime_nsec;
1520 abi_ulong target_st_ctime;
1521 abi_ulong target_st_ctime_nsec;
1522 abi_ulong __unused4;
1523 abi_ulong __unused5;
1524};
1525
1526
1527#define TARGET_HAS_STRUCT_STAT64
1528struct QEMU_PACKED target_stat64 {
1529 uint64_t st_dev;
1530#define TARGET_STAT64_HAS_BROKEN_ST_INO 1
1531 uint32_t pad0;
1532 uint32_t __st_ino;
1533
1534 uint32_t st_mode;
1535 uint32_t st_nlink;
1536 uint32_t st_uid;
1537 uint32_t st_gid;
1538 uint64_t st_rdev;
1539 uint64_t __pad1;
1540
1541 int64_t st_size;
1542 int32_t st_blksize;
1543 uint32_t __pad2;
1544 int64_t st_blocks;
1545
1546 int target_st_atime;
1547 unsigned int target_st_atime_nsec;
1548 int target_st_mtime;
1549 unsigned int target_st_mtime_nsec;
1550 int target_st_ctime;
1551 unsigned int target_st_ctime_nsec;
1552 uint64_t st_ino;
1553};
1554
1555#elif defined(TARGET_M68K)
1556
1557struct target_stat {
1558 unsigned short st_dev;
1559 unsigned short __pad1;
1560 abi_ulong st_ino;
1561 unsigned short st_mode;
1562 unsigned short st_nlink;
1563 unsigned short st_uid;
1564 unsigned short st_gid;
1565 unsigned short st_rdev;
1566 unsigned short __pad2;
1567 abi_ulong st_size;
1568 abi_ulong st_blksize;
1569 abi_ulong st_blocks;
1570 abi_ulong target_st_atime;
1571 abi_ulong __unused1;
1572 abi_ulong target_st_mtime;
1573 abi_ulong __unused2;
1574 abi_ulong target_st_ctime;
1575 abi_ulong __unused3;
1576 abi_ulong __unused4;
1577 abi_ulong __unused5;
1578};
1579
1580
1581
1582
1583#define TARGET_HAS_STRUCT_STAT64
1584struct target_stat64 {
1585 unsigned long long st_dev;
1586 unsigned char __pad1[2];
1587
1588#define TARGET_STAT64_HAS_BROKEN_ST_INO 1
1589 abi_ulong __st_ino;
1590
1591 unsigned int st_mode;
1592 unsigned int st_nlink;
1593
1594 abi_ulong st_uid;
1595 abi_ulong st_gid;
1596
1597 unsigned long long st_rdev;
1598 unsigned char __pad3[2];
1599
1600 long long st_size;
1601 abi_ulong st_blksize;
1602
1603 abi_ulong __pad4;
1604 abi_ulong st_blocks;
1605
1606 abi_ulong target_st_atime;
1607 abi_ulong target_st_atime_nsec;
1608
1609 abi_ulong target_st_mtime;
1610 abi_ulong target_st_mtime_nsec;
1611
1612 abi_ulong target_st_ctime;
1613 abi_ulong target_st_ctime_nsec;
1614
1615 unsigned long long st_ino;
1616} QEMU_PACKED;
1617
1618#elif defined(TARGET_ABI_MIPSN64)
1619
1620#define TARGET_STAT_HAVE_NSEC
1621
1622struct target_stat {
1623 unsigned int st_dev;
1624 unsigned int st_pad0[3];
1625
1626 abi_ulong st_ino;
1627
1628 unsigned int st_mode;
1629 unsigned int st_nlink;
1630
1631 int st_uid;
1632 int st_gid;
1633
1634 unsigned int st_rdev;
1635 unsigned int st_pad1[3];
1636
1637 abi_ulong st_size;
1638
1639
1640
1641
1642
1643 unsigned int target_st_atime;
1644 unsigned int target_st_atime_nsec;
1645
1646 unsigned int target_st_mtime;
1647 unsigned int target_st_mtime_nsec;
1648
1649 unsigned int target_st_ctime;
1650 unsigned int target_st_ctime_nsec;
1651
1652 unsigned int st_blksize;
1653 unsigned int st_pad2;
1654
1655 abi_ulong st_blocks;
1656};
1657
1658#elif defined(TARGET_ABI_MIPSN32)
1659
1660#define TARGET_STAT_HAVE_NSEC
1661struct target_stat {
1662 abi_ulong st_dev;
1663 abi_ulong st_pad0[3];
1664 uint64_t st_ino;
1665 unsigned int st_mode;
1666 unsigned int st_nlink;
1667 int st_uid;
1668 int st_gid;
1669 abi_ulong st_rdev;
1670 abi_ulong st_pad1[3];
1671 int64_t st_size;
1672 abi_long target_st_atime;
1673 abi_ulong target_st_atime_nsec;
1674 abi_long target_st_mtime;
1675 abi_ulong target_st_mtime_nsec;
1676 abi_long target_st_ctime;
1677 abi_ulong target_st_ctime_nsec;
1678 abi_ulong st_blksize;
1679 abi_ulong st_pad2;
1680 int64_t st_blocks;
1681};
1682
1683#elif defined(TARGET_ABI_MIPSO32)
1684
1685#define TARGET_STAT_HAVE_NSEC
1686struct target_stat {
1687 unsigned st_dev;
1688 abi_long st_pad1[3];
1689 abi_ulong st_ino;
1690 unsigned int st_mode;
1691 unsigned int st_nlink;
1692 int st_uid;
1693 int st_gid;
1694 unsigned st_rdev;
1695 abi_long st_pad2[2];
1696 abi_long st_size;
1697 abi_long st_pad3;
1698
1699
1700
1701
1702 abi_long target_st_atime;
1703 abi_long target_st_atime_nsec;
1704 abi_long target_st_mtime;
1705 abi_long target_st_mtime_nsec;
1706 abi_long target_st_ctime;
1707 abi_long target_st_ctime_nsec;
1708 abi_long st_blksize;
1709 abi_long st_blocks;
1710 abi_long st_pad4[14];
1711};
1712
1713
1714
1715
1716
1717
1718
1719#define TARGET_HAS_STRUCT_STAT64
1720struct target_stat64 {
1721 abi_ulong st_dev;
1722 abi_ulong st_pad0[3];
1723
1724 uint64_t st_ino;
1725
1726 unsigned int st_mode;
1727 unsigned int st_nlink;
1728
1729 int st_uid;
1730 int st_gid;
1731
1732 abi_ulong st_rdev;
1733 abi_ulong st_pad1[3];
1734
1735 int64_t st_size;
1736
1737
1738
1739
1740
1741 abi_long target_st_atime;
1742 abi_ulong target_st_atime_nsec;
1743
1744 abi_long target_st_mtime;
1745 abi_ulong target_st_mtime_nsec;
1746
1747 abi_long target_st_ctime;
1748 abi_ulong target_st_ctime_nsec;
1749
1750 abi_ulong st_blksize;
1751 abi_ulong st_pad2;
1752
1753 int64_t st_blocks;
1754};
1755
1756#elif defined(TARGET_ALPHA)
1757
1758struct target_stat {
1759 unsigned int st_dev;
1760 unsigned int st_ino;
1761 unsigned int st_mode;
1762 unsigned int st_nlink;
1763 unsigned int st_uid;
1764 unsigned int st_gid;
1765 unsigned int st_rdev;
1766 abi_long st_size;
1767 abi_ulong target_st_atime;
1768 abi_ulong target_st_mtime;
1769 abi_ulong target_st_ctime;
1770 unsigned int st_blksize;
1771 unsigned int st_blocks;
1772 unsigned int st_flags;
1773 unsigned int st_gen;
1774};
1775
1776#define TARGET_HAS_STRUCT_STAT64
1777struct target_stat64 {
1778 abi_ulong st_dev;
1779 abi_ulong st_ino;
1780 abi_ulong st_rdev;
1781 abi_long st_size;
1782 abi_ulong st_blocks;
1783
1784 unsigned int st_mode;
1785 unsigned int st_uid;
1786 unsigned int st_gid;
1787 unsigned int st_blksize;
1788 unsigned int st_nlink;
1789 unsigned int __pad0;
1790
1791 abi_ulong target_st_atime;
1792 abi_ulong target_st_atime_nsec;
1793 abi_ulong target_st_mtime;
1794 abi_ulong target_st_mtime_nsec;
1795 abi_ulong target_st_ctime;
1796 abi_ulong target_st_ctime_nsec;
1797 abi_long __unused[3];
1798};
1799
1800#elif defined(TARGET_SH4)
1801
1802#define TARGET_STAT_HAVE_NSEC
1803struct target_stat {
1804 abi_ulong st_dev;
1805 abi_ulong st_ino;
1806 unsigned short st_mode;
1807 unsigned short st_nlink;
1808 unsigned short st_uid;
1809 unsigned short st_gid;
1810 abi_ulong st_rdev;
1811 abi_ulong st_size;
1812 abi_ulong st_blksize;
1813 abi_ulong st_blocks;
1814 abi_ulong target_st_atime;
1815 abi_ulong target_st_atime_nsec;
1816 abi_ulong target_st_mtime;
1817 abi_ulong target_st_mtime_nsec;
1818 abi_ulong target_st_ctime;
1819 abi_ulong target_st_ctime_nsec;
1820 abi_ulong __unused4;
1821 abi_ulong __unused5;
1822};
1823
1824
1825
1826
1827#define TARGET_HAS_STRUCT_STAT64
1828struct QEMU_PACKED target_stat64 {
1829 unsigned long long st_dev;
1830 unsigned char __pad0[4];
1831
1832#define TARGET_STAT64_HAS_BROKEN_ST_INO 1
1833 abi_ulong __st_ino;
1834
1835 unsigned int st_mode;
1836 unsigned int st_nlink;
1837
1838 abi_ulong st_uid;
1839 abi_ulong st_gid;
1840
1841 unsigned long long st_rdev;
1842 unsigned char __pad3[4];
1843
1844 long long st_size;
1845 abi_ulong st_blksize;
1846
1847 unsigned long long st_blocks;
1848
1849 abi_ulong target_st_atime;
1850 abi_ulong target_st_atime_nsec;
1851
1852 abi_ulong target_st_mtime;
1853 abi_ulong target_st_mtime_nsec;
1854
1855 abi_ulong target_st_ctime;
1856 abi_ulong target_st_ctime_nsec;
1857
1858 unsigned long long st_ino;
1859};
1860
1861#elif defined(TARGET_I386) && !defined(TARGET_ABI32)
1862#define TARGET_STAT_HAVE_NSEC
1863struct target_stat {
1864 abi_ulong st_dev;
1865 abi_ulong st_ino;
1866 abi_ulong st_nlink;
1867
1868 unsigned int st_mode;
1869 unsigned int st_uid;
1870 unsigned int st_gid;
1871 unsigned int __pad0;
1872 abi_ulong st_rdev;
1873 abi_long st_size;
1874 abi_long st_blksize;
1875 abi_long st_blocks;
1876
1877 abi_ulong target_st_atime;
1878 abi_ulong target_st_atime_nsec;
1879 abi_ulong target_st_mtime;
1880 abi_ulong target_st_mtime_nsec;
1881 abi_ulong target_st_ctime;
1882 abi_ulong target_st_ctime_nsec;
1883
1884 abi_long __unused[3];
1885};
1886#elif defined(TARGET_S390X)
1887struct target_stat {
1888 abi_ulong st_dev;
1889 abi_ulong st_ino;
1890 abi_ulong st_nlink;
1891 unsigned int st_mode;
1892 unsigned int st_uid;
1893 unsigned int st_gid;
1894 unsigned int __pad1;
1895 abi_ulong st_rdev;
1896 abi_ulong st_size;
1897 abi_ulong target_st_atime;
1898 abi_ulong target_st_atime_nsec;
1899 abi_ulong target_st_mtime;
1900 abi_ulong target_st_mtime_nsec;
1901 abi_ulong target_st_ctime;
1902 abi_ulong target_st_ctime_nsec;
1903 abi_ulong st_blksize;
1904 abi_long st_blocks;
1905 abi_ulong __unused[3];
1906};
1907#elif defined(TARGET_AARCH64)
1908#define TARGET_STAT_HAVE_NSEC
1909struct target_stat {
1910 abi_ulong st_dev;
1911 abi_ulong st_ino;
1912 unsigned int st_mode;
1913 unsigned int st_nlink;
1914 unsigned int st_uid;
1915 unsigned int st_gid;
1916 abi_ulong st_rdev;
1917 abi_ulong _pad1;
1918 abi_long st_size;
1919 int st_blksize;
1920 int __pad2;
1921 abi_long st_blocks;
1922 abi_long target_st_atime;
1923 abi_ulong target_st_atime_nsec;
1924 abi_long target_st_mtime;
1925 abi_ulong target_st_mtime_nsec;
1926 abi_long target_st_ctime;
1927 abi_ulong target_st_ctime_nsec;
1928 unsigned int __unused[2];
1929};
1930#elif defined(TARGET_XTENSA)
1931#define TARGET_STAT_HAVE_NSEC
1932struct target_stat {
1933 abi_ulong st_dev;
1934 abi_ulong st_ino;
1935 unsigned int st_mode;
1936 unsigned int st_nlink;
1937 unsigned int st_uid;
1938 unsigned int st_gid;
1939 abi_ulong st_rdev;
1940 abi_long st_size;
1941 abi_ulong st_blksize;
1942 abi_ulong st_blocks;
1943 abi_ulong target_st_atime;
1944 abi_ulong target_st_atime_nsec;
1945 abi_ulong target_st_mtime;
1946 abi_ulong target_st_mtime_nsec;
1947 abi_ulong target_st_ctime;
1948 abi_ulong target_st_ctime_nsec;
1949 abi_ulong __unused4;
1950 abi_ulong __unused5;
1951};
1952
1953#define TARGET_HAS_STRUCT_STAT64
1954struct target_stat64 {
1955 uint64_t st_dev;
1956 uint64_t st_ino;
1957 unsigned int st_mode;
1958 unsigned int st_nlink;
1959 unsigned int st_uid;
1960 unsigned int st_gid;
1961 uint64_t st_rdev;
1962 int64_t st_size;
1963 abi_ulong st_blksize;
1964 abi_ulong __unused2;
1965 uint64_t st_blocks;
1966 abi_ulong target_st_atime;
1967 abi_ulong target_st_atime_nsec;
1968 abi_ulong target_st_mtime;
1969 abi_ulong target_st_mtime_nsec;
1970 abi_ulong target_st_ctime;
1971 abi_ulong target_st_ctime_nsec;
1972 abi_ulong __unused4;
1973 abi_ulong __unused5;
1974};
1975
1976#elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) || \
1977 defined(TARGET_NIOS2) || defined(TARGET_RISCV)
1978
1979
1980
1981#define TARGET_STAT_HAVE_NSEC
1982struct target_stat {
1983 abi_ulong st_dev;
1984 abi_ulong st_ino;
1985 unsigned int st_mode;
1986 unsigned int st_nlink;
1987 unsigned int st_uid;
1988 unsigned int st_gid;
1989 abi_ulong st_rdev;
1990 abi_ulong __pad1;
1991 abi_long st_size;
1992 int st_blksize;
1993 int __pad2;
1994 abi_long st_blocks;
1995 abi_long target_st_atime;
1996 abi_ulong target_st_atime_nsec;
1997 abi_long target_st_mtime;
1998 abi_ulong target_st_mtime_nsec;
1999 abi_long target_st_ctime;
2000 abi_ulong target_st_ctime_nsec;
2001 unsigned int __unused4;
2002 unsigned int __unused5;
2003};
2004
2005#if !defined(TARGET_RISCV64)
2006#define TARGET_HAS_STRUCT_STAT64
2007struct target_stat64 {
2008 uint64_t st_dev;
2009 uint64_t st_ino;
2010 unsigned int st_mode;
2011 unsigned int st_nlink;
2012 unsigned int st_uid;
2013 unsigned int st_gid;
2014 uint64_t st_rdev;
2015 uint64_t __pad1;
2016 int64_t st_size;
2017 int st_blksize;
2018 int __pad2;
2019 int64_t st_blocks;
2020 int target_st_atime;
2021 unsigned int target_st_atime_nsec;
2022 int target_st_mtime;
2023 unsigned int target_st_mtime_nsec;
2024 int target_st_ctime;
2025 unsigned int target_st_ctime_nsec;
2026 unsigned int __unused4;
2027 unsigned int __unused5;
2028};
2029#endif
2030
2031#elif defined(TARGET_HPPA)
2032
2033#define TARGET_STAT_HAVE_NSEC
2034struct target_stat {
2035 abi_uint st_dev;
2036 abi_uint st_ino;
2037 abi_ushort st_mode;
2038 abi_ushort st_nlink;
2039 abi_ushort _res1;
2040 abi_ushort _res2;
2041 abi_uint st_rdev;
2042 abi_int st_size;
2043 abi_int target_st_atime;
2044 abi_uint target_st_atime_nsec;
2045 abi_int target_st_mtime;
2046 abi_uint target_st_mtime_nsec;
2047 abi_int target_st_ctime;
2048 abi_uint target_st_ctime_nsec;
2049 abi_int st_blksize;
2050 abi_int st_blocks;
2051 abi_uint _unused1;
2052 abi_uint _unused2;
2053 abi_uint _unused3;
2054 abi_uint _unused4;
2055 abi_ushort _unused5;
2056 abi_short st_fstype;
2057 abi_uint st_realdev;
2058 abi_ushort st_basemode;
2059 abi_ushort _unused6;
2060 abi_uint st_uid;
2061 abi_uint st_gid;
2062 abi_uint _unused7[3];
2063};
2064
2065#define TARGET_HAS_STRUCT_STAT64
2066struct target_stat64 {
2067 uint64_t st_dev;
2068 abi_uint _pad1;
2069 abi_uint _res1;
2070 abi_uint st_mode;
2071 abi_uint st_nlink;
2072 abi_uint st_uid;
2073 abi_uint st_gid;
2074 uint64_t st_rdev;
2075 abi_uint _pad2;
2076 int64_t st_size;
2077 abi_int st_blksize;
2078 int64_t st_blocks;
2079 abi_int target_st_atime;
2080 abi_uint target_st_atime_nsec;
2081 abi_int target_st_mtime;
2082 abi_uint target_st_mtime_nsec;
2083 abi_int target_st_ctime;
2084 abi_uint target_st_ctime_nsec;
2085 uint64_t st_ino;
2086};
2087
2088#else
2089#error unsupported CPU
2090#endif
2091
2092typedef struct {
2093 int val[2];
2094} target_fsid_t;
2095
2096#ifdef TARGET_MIPS
2097#ifdef TARGET_ABI_MIPSN32
2098struct target_statfs {
2099 int32_t f_type;
2100 int32_t f_bsize;
2101 int32_t f_frsize;
2102 int32_t f_blocks;
2103 int32_t f_bfree;
2104 int32_t f_files;
2105 int32_t f_ffree;
2106 int32_t f_bavail;
2107
2108
2109 target_fsid_t f_fsid;
2110 int32_t f_namelen;
2111 int32_t f_flags;
2112 int32_t f_spare[5];
2113};
2114#else
2115struct target_statfs {
2116 abi_long f_type;
2117 abi_long f_bsize;
2118 abi_long f_frsize;
2119 abi_long f_blocks;
2120 abi_long f_bfree;
2121 abi_long f_files;
2122 abi_long f_ffree;
2123 abi_long f_bavail;
2124
2125
2126 target_fsid_t f_fsid;
2127 abi_long f_namelen;
2128 abi_long f_flags;
2129 abi_long f_spare[5];
2130};
2131#endif
2132
2133struct target_statfs64 {
2134 uint32_t f_type;
2135 uint32_t f_bsize;
2136 uint32_t f_frsize;
2137 uint32_t __pad;
2138 uint64_t f_blocks;
2139 uint64_t f_bfree;
2140 uint64_t f_files;
2141 uint64_t f_ffree;
2142 uint64_t f_bavail;
2143 target_fsid_t f_fsid;
2144 uint32_t f_namelen;
2145 uint32_t f_flags;
2146 uint32_t f_spare[5];
2147};
2148#elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \
2149 defined(TARGET_SPARC64) || defined(TARGET_AARCH64) || \
2150 defined(TARGET_RISCV)) && !defined(TARGET_ABI32)
2151struct target_statfs {
2152 abi_long f_type;
2153 abi_long f_bsize;
2154 abi_long f_blocks;
2155 abi_long f_bfree;
2156 abi_long f_bavail;
2157 abi_long f_files;
2158 abi_long f_ffree;
2159 target_fsid_t f_fsid;
2160 abi_long f_namelen;
2161 abi_long f_frsize;
2162 abi_long f_flags;
2163 abi_long f_spare[4];
2164};
2165
2166struct target_statfs64 {
2167 abi_long f_type;
2168 abi_long f_bsize;
2169 abi_long f_blocks;
2170 abi_long f_bfree;
2171 abi_long f_bavail;
2172 abi_long f_files;
2173 abi_long f_ffree;
2174 target_fsid_t f_fsid;
2175 abi_long f_namelen;
2176 abi_long f_frsize;
2177 abi_long f_flags;
2178 abi_long f_spare[4];
2179};
2180#elif defined(TARGET_S390X)
2181struct target_statfs {
2182 int32_t f_type;
2183 int32_t f_bsize;
2184 abi_long f_blocks;
2185 abi_long f_bfree;
2186 abi_long f_bavail;
2187 abi_long f_files;
2188 abi_long f_ffree;
2189 kernel_fsid_t f_fsid;
2190 int32_t f_namelen;
2191 int32_t f_frsize;
2192 int32_t f_flags;
2193 int32_t f_spare[4];
2194
2195};
2196
2197struct target_statfs64 {
2198 int32_t f_type;
2199 int32_t f_bsize;
2200 abi_long f_blocks;
2201 abi_long f_bfree;
2202 abi_long f_bavail;
2203 abi_long f_files;
2204 abi_long f_ffree;
2205 kernel_fsid_t f_fsid;
2206 int32_t f_namelen;
2207 int32_t f_frsize;
2208 int32_t f_flags;
2209 int32_t f_spare[4];
2210};
2211#else
2212struct target_statfs {
2213 uint32_t f_type;
2214 uint32_t f_bsize;
2215 uint32_t f_blocks;
2216 uint32_t f_bfree;
2217 uint32_t f_bavail;
2218 uint32_t f_files;
2219 uint32_t f_ffree;
2220 target_fsid_t f_fsid;
2221 uint32_t f_namelen;
2222 uint32_t f_frsize;
2223 uint32_t f_flags;
2224 uint32_t f_spare[4];
2225};
2226
2227struct target_statfs64 {
2228 uint32_t f_type;
2229 uint32_t f_bsize;
2230 uint64_t f_blocks;
2231 uint64_t f_bfree;
2232 uint64_t f_bavail;
2233 uint64_t f_files;
2234 uint64_t f_ffree;
2235 target_fsid_t f_fsid;
2236 uint32_t f_namelen;
2237 uint32_t f_frsize;
2238 uint32_t f_flags;
2239 uint32_t f_spare[4];
2240};
2241#endif
2242
2243#define TARGET_F_LINUX_SPECIFIC_BASE 1024
2244#define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0)
2245#define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1)
2246#define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6)
2247#define TARGET_F_SETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 7)
2248#define TARGET_F_GETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 8)
2249#define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2)
2250
2251#include "target_fcntl.h"
2252
2253
2254
2255#define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int);
2256#define TARGET_SNDCTL_COPR_LOAD 0xcfb04301
2257#define TARGET_SNDCTL_COPR_RCODE 0xc0144303
2258#define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309
2259#define TARGET_SNDCTL_COPR_RDATA 0xc0144302
2260#define TARGET_SNDCTL_COPR_RESET 0x00004300
2261#define TARGET_SNDCTL_COPR_RUN 0xc0144306
2262#define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308
2263#define TARGET_SNDCTL_COPR_WCODE 0x40144305
2264#define TARGET_SNDCTL_COPR_WDATA 0x40144304
2265#define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0)
2266#define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1)
2267#define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int)
2268#define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int)
2269#define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int)
2270#define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int)
2271#define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int)
2272#define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int)
2273#define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8)
2274#define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int)
2275#define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int)
2276#define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int)
2277#define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12)
2278#define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13)
2279#define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int)
2280#define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int)
2281#define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17)
2282#define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18)
2283#define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19)
2284#define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20)
2285#define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e
2286#define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005
2287#define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016
2288#define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015
2289#define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010
2290#define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f
2291#define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107
2292#define TARGET_SNDCTL_MIDI_INFO 0xc074510c
2293#define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02
2294#define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01
2295#define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00
2296#define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110
2297#define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001
2298#define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103
2299#define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105
2300#define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104
2301#define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b
2302#define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a
2303#define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112
2304#define TARGET_SNDCTL_SEQ_PANIC 0x00005111
2305#define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106
2306#define TARGET_SNDCTL_SEQ_RESET 0x00005100
2307#define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109
2308#define TARGET_SNDCTL_SEQ_SYNC 0x00005101
2309#define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108
2310#define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d
2311#define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d
2312#define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102
2313#define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e
2314#define TARGET_SNDCTL_TMR_CONTINUE 0x00005404
2315#define TARGET_SNDCTL_TMR_METRONOME 0x40045407
2316#define TARGET_SNDCTL_TMR_SELECT 0x40045408
2317#define TARGET_SNDCTL_TMR_SOURCE 0xc0045406
2318#define TARGET_SNDCTL_TMR_START 0x00005402
2319#define TARGET_SNDCTL_TMR_STOP 0x00005403
2320#define TARGET_SNDCTL_TMR_TEMPO 0xc0045405
2321#define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401
2322#define TARGET_SOUND_PCM_READ_RATE 0x80045002
2323#define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006
2324#define TARGET_SOUND_PCM_READ_BITS 0x80045005
2325#define TARGET_SOUND_PCM_READ_FILTER 0x80045007
2326#define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info)
2327#define TARGET_SOUND_MIXER_ACCESS 0xc0804d66
2328#define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int)
2329#define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int)
2330#define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int)
2331#define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int)
2332#define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int)
2333
2334#define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int)
2335
2336#define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME)
2337#define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS)
2338#define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE)
2339#define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH)
2340#define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM)
2341#define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER)
2342#define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE)
2343#define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC)
2344#define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD)
2345#define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX)
2346#define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM)
2347#define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV)
2348#define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN)
2349#define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN)
2350#define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1)
2351#define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2)
2352#define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3)
2353
2354
2355#define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE)
2356#define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE)
2357#define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD)
2358
2359#define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC)
2360#define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK)
2361#define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK)
2362#define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS)
2363#define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS)
2364
2365#define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int)
2366
2367#define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME)
2368#define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS)
2369#define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE)
2370#define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH)
2371#define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM)
2372#define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER)
2373#define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE)
2374#define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC)
2375#define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD)
2376#define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX)
2377#define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM)
2378#define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV)
2379#define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN)
2380#define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN)
2381#define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1)
2382#define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2)
2383#define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3)
2384
2385
2386#define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE)
2387#define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE)
2388#define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD)
2389
2390#define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC)
2391
2392
2393#define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1)
2394#define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2)
2395
2396struct target_mtop {
2397 abi_short mt_op;
2398 abi_int mt_count;
2399};
2400
2401#if defined(TARGET_SPARC) || defined(TARGET_MIPS)
2402typedef abi_long target_kernel_daddr_t;
2403#else
2404typedef abi_int target_kernel_daddr_t;
2405#endif
2406
2407struct target_mtget {
2408 abi_long mt_type;
2409 abi_long mt_resid;
2410 abi_long mt_dsreg;
2411 abi_long mt_gstat;
2412 abi_long mt_erreg;
2413 target_kernel_daddr_t mt_fileno;
2414 target_kernel_daddr_t mt_blkno;
2415};
2416
2417struct target_mtpos {
2418 abi_long mt_blkno;
2419};
2420
2421#define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct target_mtop)
2422#define TARGET_MTIOCGET TARGET_IOR('m', 2, struct target_mtget)
2423#define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct target_mtpos)
2424
2425struct target_sysinfo {
2426 abi_long uptime;
2427 abi_ulong loads[3];
2428 abi_ulong totalram;
2429 abi_ulong freeram;
2430 abi_ulong sharedram;
2431 abi_ulong bufferram;
2432 abi_ulong totalswap;
2433 abi_ulong freeswap;
2434 unsigned short procs;
2435 unsigned short pad;
2436 abi_ulong totalhigh;
2437 abi_ulong freehigh;
2438 unsigned int mem_unit;
2439 char _f[20-2*sizeof(abi_long)-sizeof(int)];
2440};
2441
2442struct linux_dirent {
2443 long d_ino;
2444 unsigned long d_off;
2445 unsigned short d_reclen;
2446 char d_name[256];
2447};
2448
2449struct linux_dirent64 {
2450 uint64_t d_ino;
2451 int64_t d_off;
2452 unsigned short d_reclen;
2453 unsigned char d_type;
2454 char d_name[256];
2455};
2456
2457struct target_mq_attr {
2458 abi_long mq_flags;
2459 abi_long mq_maxmsg;
2460 abi_long mq_msgsize;
2461 abi_long mq_curmsgs;
2462};
2463
2464#include "socket.h"
2465
2466#include "errno_defs.h"
2467
2468#define FUTEX_WAIT 0
2469#define FUTEX_WAKE 1
2470#define FUTEX_FD 2
2471#define FUTEX_REQUEUE 3
2472#define FUTEX_CMP_REQUEUE 4
2473#define FUTEX_WAKE_OP 5
2474#define FUTEX_LOCK_PI 6
2475#define FUTEX_UNLOCK_PI 7
2476#define FUTEX_TRYLOCK_PI 8
2477#define FUTEX_WAIT_BITSET 9
2478#define FUTEX_WAKE_BITSET 10
2479
2480#define FUTEX_PRIVATE_FLAG 128
2481#define FUTEX_CLOCK_REALTIME 256
2482#define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)
2483
2484#ifdef CONFIG_EPOLL
2485#if defined(TARGET_X86_64)
2486#define TARGET_EPOLL_PACKED QEMU_PACKED
2487#else
2488#define TARGET_EPOLL_PACKED
2489#endif
2490
2491typedef union target_epoll_data {
2492 abi_ulong ptr;
2493 abi_int fd;
2494 abi_uint u32;
2495 abi_ullong u64;
2496} target_epoll_data_t;
2497
2498struct target_epoll_event {
2499 abi_uint events;
2500 target_epoll_data_t data;
2501} TARGET_EPOLL_PACKED;
2502
2503#define TARGET_EP_MAX_EVENTS (INT_MAX / sizeof(struct target_epoll_event))
2504
2505#endif
2506struct target_rlimit64 {
2507 uint64_t rlim_cur;
2508 uint64_t rlim_max;
2509};
2510
2511struct target_ucred {
2512 uint32_t pid;
2513 uint32_t uid;
2514 uint32_t gid;
2515};
2516
2517typedef int32_t target_timer_t;
2518
2519#define TARGET_SIGEV_MAX_SIZE 64
2520
2521
2522#ifdef TARGET_MIPS
2523#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long))
2524#else
2525#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \
2526 + sizeof(target_sigval_t))
2527#endif
2528
2529#define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \
2530 - TARGET_SIGEV_PREAMBLE_SIZE) \
2531 / sizeof(int32_t))
2532
2533struct target_sigevent {
2534 target_sigval_t sigev_value;
2535 abi_int sigev_signo;
2536 abi_int sigev_notify;
2537 union {
2538 abi_int _pad[TARGET_SIGEV_PAD_SIZE];
2539 abi_int _tid;
2540
2541
2542
2543
2544
2545 struct {
2546 abi_ulong _function;
2547 abi_ulong _attribute;
2548 } _sigev_thread;
2549 } _sigev_un;
2550};
2551
2552struct target_user_cap_header {
2553 uint32_t version;
2554 int pid;
2555};
2556
2557struct target_user_cap_data {
2558 uint32_t effective;
2559 uint32_t permitted;
2560 uint32_t inheritable;
2561};
2562
2563
2564
2565
2566#define TARGET_SYSLOG_ACTION_CLOSE 0
2567
2568#define TARGET_SYSLOG_ACTION_OPEN 1
2569
2570#define TARGET_SYSLOG_ACTION_READ 2
2571
2572#define TARGET_SYSLOG_ACTION_READ_ALL 3
2573
2574#define TARGET_SYSLOG_ACTION_READ_CLEAR 4
2575
2576#define TARGET_SYSLOG_ACTION_CLEAR 5
2577
2578#define TARGET_SYSLOG_ACTION_CONSOLE_OFF 6
2579
2580#define TARGET_SYSLOG_ACTION_CONSOLE_ON 7
2581
2582#define TARGET_SYSLOG_ACTION_CONSOLE_LEVEL 8
2583
2584#define TARGET_SYSLOG_ACTION_SIZE_UNREAD 9
2585
2586#define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10
2587
2588struct target_statx_timestamp {
2589 int64_t tv_sec;
2590 uint32_t tv_nsec;
2591 int32_t __reserved;
2592};
2593
2594struct target_statx {
2595
2596 uint32_t stx_mask;
2597 uint32_t stx_blksize;
2598 uint64_t stx_attributes;
2599
2600 uint32_t stx_nlink;
2601 uint32_t stx_uid;
2602 uint32_t stx_gid;
2603 uint16_t stx_mode;
2604 uint16_t __spare0[1];
2605
2606 uint64_t stx_ino;
2607 uint64_t stx_size;
2608 uint64_t stx_blocks;
2609 uint64_t stx_attributes_mask;
2610
2611 struct target_statx_timestamp stx_atime;
2612 struct target_statx_timestamp stx_btime;
2613 struct target_statx_timestamp stx_ctime;
2614 struct target_statx_timestamp stx_mtime;
2615
2616 uint32_t stx_rdev_major;
2617 uint32_t stx_rdev_minor;
2618 uint32_t stx_dev_major;
2619 uint32_t stx_dev_minor;
2620
2621 uint64_t __spare2[14];
2622
2623};
2624
2625#endif
2626