xref: /openbmc/qemu/linux-user/syscall_defs.h (revision 19f59bcef91cd4abc04d10c9ecbf5183b71f1b06)
131e31b8aSbellard /* common syscall defines for all architectures */
231e31b8aSbellard 
32521d698Sbellard /* Note: although the syscall numbers change between architectures,
4b4916d7bSDong Xu Wang    most of them stay the same, so we handle it by putting ifdefs if
52521d698Sbellard    necessary */
62521d698Sbellard 
7cb9c377fSPaolo Bonzini #ifndef SYSCALL_DEFS_H
81b3c4fdfSMarkus Armbruster #define SYSCALL_DEFS_H
9cb9c377fSPaolo Bonzini 
106180a181Sbellard #include "syscall_nr.h"
112521d698Sbellard 
1231e31b8aSbellard #define SOCKOP_socket           1
1331e31b8aSbellard #define SOCKOP_bind             2
1431e31b8aSbellard #define SOCKOP_connect          3
1531e31b8aSbellard #define SOCKOP_listen           4
1631e31b8aSbellard #define SOCKOP_accept           5
1731e31b8aSbellard #define SOCKOP_getsockname      6
1831e31b8aSbellard #define SOCKOP_getpeername      7
1931e31b8aSbellard #define SOCKOP_socketpair       8
2031e31b8aSbellard #define SOCKOP_send             9
2131e31b8aSbellard #define SOCKOP_recv             10
2231e31b8aSbellard #define SOCKOP_sendto           11
2331e31b8aSbellard #define SOCKOP_recvfrom         12
2431e31b8aSbellard #define SOCKOP_shutdown         13
2531e31b8aSbellard #define SOCKOP_setsockopt       14
2631e31b8aSbellard #define SOCKOP_getsockopt       15
2731e31b8aSbellard #define SOCKOP_sendmsg          16
2831e31b8aSbellard #define SOCKOP_recvmsg          17
29b9d36eb2SAndré Hentschel #define SOCKOP_accept4          18
305a53dc50SJohn Paul Adrian Glaubitz #define SOCKOP_recvmmsg         19
315a53dc50SJohn Paul Adrian Glaubitz #define SOCKOP_sendmmsg         20
3231e31b8aSbellard 
338853f86eSbellard #define IPCOP_semop		1
348853f86eSbellard #define IPCOP_semget		2
358853f86eSbellard #define IPCOP_semctl		3
368853f86eSbellard #define IPCOP_semtimedop	4
378853f86eSbellard #define IPCOP_msgsnd		11
388853f86eSbellard #define IPCOP_msgrcv		12
398853f86eSbellard #define IPCOP_msgget		13
408853f86eSbellard #define IPCOP_msgctl		14
418853f86eSbellard #define IPCOP_shmat		21
428853f86eSbellard #define IPCOP_shmdt		22
438853f86eSbellard #define IPCOP_shmget		23
448853f86eSbellard #define IPCOP_shmctl		24
458853f86eSbellard 
462521d698Sbellard /*
472521d698Sbellard  * The following is for compatibility across the various Linux
482521d698Sbellard  * platforms.  The i386 ioctl numbering scheme doesn't really enforce
492521d698Sbellard  * a type field.  De facto, however, the top 8 bits of the lower 16
502521d698Sbellard  * bits are indeed used as a type field, so we might just as well make
512521d698Sbellard  * this explicit here.  Please be sure to use the decoding macros
522521d698Sbellard  * below from now on.
532521d698Sbellard  */
542521d698Sbellard #define TARGET_IOC_NRBITS	8
552521d698Sbellard #define TARGET_IOC_TYPEBITS	8
562521d698Sbellard 
57716f3fbeSPeter Maydell #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \
58716f3fbeSPeter Maydell     || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \
59cd98d390SAndreas Schwab     || defined(TARGET_SPARC) \
600c866a7eSRiku Voipio     || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS)
6174d753acSMika Westerberg     /* 16 bit uid wrappers emulation */
6274d753acSMika Westerberg #define USE_UID16
630c866a7eSRiku Voipio #define target_id uint16_t
640c866a7eSRiku Voipio #else
650c866a7eSRiku Voipio #define target_id uint32_t
6674d753acSMika Westerberg #endif
6774d753acSMika Westerberg 
68e6e5906bSpbrook #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \
69b16189b2SChen Gang     || defined(TARGET_M68K) || defined(TARGET_CRIS) \
70b16189b2SChen Gang     || defined(TARGET_UNICORE32) || defined(TARGET_S390X) \
71b16189b2SChen Gang     || defined(TARGET_OPENRISC) || defined(TARGET_TILEGX)
722521d698Sbellard 
732521d698Sbellard #define TARGET_IOC_SIZEBITS	14
742521d698Sbellard #define TARGET_IOC_DIRBITS	2
752521d698Sbellard 
762521d698Sbellard #define TARGET_IOC_NONE	  0U
772521d698Sbellard #define TARGET_IOC_WRITE  1U
782521d698Sbellard #define TARGET_IOC_READ	  2U
792521d698Sbellard 
80048f6b4dSbellard #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \
81b779e29eSEdgar E. Iglesias       defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \
82b779e29eSEdgar E. Iglesias       defined(TARGET_MIPS)
832521d698Sbellard 
842521d698Sbellard #define TARGET_IOC_SIZEBITS	13
852521d698Sbellard #define TARGET_IOC_DIRBITS	3
862521d698Sbellard 
872521d698Sbellard #define TARGET_IOC_NONE	  1U
882521d698Sbellard #define TARGET_IOC_READ	  2U
892521d698Sbellard #define TARGET_IOC_WRITE  4U
902521d698Sbellard 
912521d698Sbellard #else
922521d698Sbellard #error unsupported CPU
932521d698Sbellard #endif
942521d698Sbellard 
952521d698Sbellard #define TARGET_IOC_NRMASK	((1 << TARGET_IOC_NRBITS)-1)
962521d698Sbellard #define TARGET_IOC_TYPEMASK	((1 << TARGET_IOC_TYPEBITS)-1)
972521d698Sbellard #define TARGET_IOC_SIZEMASK	((1 << TARGET_IOC_SIZEBITS)-1)
982521d698Sbellard #define TARGET_IOC_DIRMASK	((1 << TARGET_IOC_DIRBITS)-1)
992521d698Sbellard 
1002521d698Sbellard #define TARGET_IOC_NRSHIFT	0
1012521d698Sbellard #define TARGET_IOC_TYPESHIFT	(TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS)
1022521d698Sbellard #define TARGET_IOC_SIZESHIFT	(TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS)
1032521d698Sbellard #define TARGET_IOC_DIRSHIFT	(TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS)
1042521d698Sbellard 
1052521d698Sbellard #define TARGET_IOC(dir,type,nr,size) \
1062521d698Sbellard 	(((dir)  << TARGET_IOC_DIRSHIFT) | \
1072521d698Sbellard 	 ((type) << TARGET_IOC_TYPESHIFT) | \
1082521d698Sbellard 	 ((nr)   << TARGET_IOC_NRSHIFT) | \
1092521d698Sbellard 	 ((size) << TARGET_IOC_SIZESHIFT))
1102521d698Sbellard 
1112521d698Sbellard /* used to create numbers */
1122521d698Sbellard #define TARGET_IO(type,nr)		TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0)
1132521d698Sbellard #define TARGET_IOR(type,nr,size)	TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size))
1142521d698Sbellard #define TARGET_IOW(type,nr,size)	TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size))
1152521d698Sbellard #define TARGET_IOWR(type,nr,size)	TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size))
1162521d698Sbellard 
1172521d698Sbellard /* the size is automatically computed for these defines */
1182521d698Sbellard #define TARGET_IORU(type,nr)	TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK)
1192521d698Sbellard #define TARGET_IOWU(type,nr)	TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
1202521d698Sbellard #define TARGET_IOWRU(type,nr)	TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
1212521d698Sbellard 
1227854b056Sbellard struct target_sockaddr {
1237854b056Sbellard     uint16_t sa_family;
1247854b056Sbellard     uint8_t sa_data[14];
1257854b056Sbellard };
1267854b056Sbellard 
12733a29b51SJoakim Tjernlund struct target_sockaddr_ll {
12833a29b51SJoakim Tjernlund     uint16_t sll_family;   /* Always AF_PACKET */
12933a29b51SJoakim Tjernlund     uint16_t sll_protocol; /* Physical layer protocol */
13033a29b51SJoakim Tjernlund     int      sll_ifindex;  /* Interface number */
13133a29b51SJoakim Tjernlund     uint16_t sll_hatype;   /* ARP hardware type */
13233a29b51SJoakim Tjernlund     uint8_t  sll_pkttype;  /* Packet type */
13333a29b51SJoakim Tjernlund     uint8_t  sll_halen;    /* Length of address */
13433a29b51SJoakim Tjernlund     uint8_t  sll_addr[8];  /* Physical layer address */
13533a29b51SJoakim Tjernlund };
13633a29b51SJoakim Tjernlund 
137fb3aabf3SLaurent Vivier struct target_sockaddr_un {
138fb3aabf3SLaurent Vivier     uint16_t su_family;
139fb3aabf3SLaurent Vivier     uint8_t sun_path[108];
140fb3aabf3SLaurent Vivier };
141fb3aabf3SLaurent Vivier 
142fb3aabf3SLaurent Vivier struct target_in_addr {
143fb3aabf3SLaurent Vivier     uint32_t s_addr; /* big endian */
144fb3aabf3SLaurent Vivier };
145fb3aabf3SLaurent Vivier 
146fb3aabf3SLaurent Vivier struct target_sockaddr_in {
147fb3aabf3SLaurent Vivier   uint16_t sin_family;
148fb3aabf3SLaurent Vivier   int16_t sin_port; /* big endian */
149fb3aabf3SLaurent Vivier   struct target_in_addr sin_addr;
150fb3aabf3SLaurent Vivier   uint8_t __pad[sizeof(struct target_sockaddr) -
151fb3aabf3SLaurent Vivier                 sizeof(uint16_t) - sizeof(int16_t) -
152fb3aabf3SLaurent Vivier                 sizeof(struct target_in_addr)];
153fb3aabf3SLaurent Vivier };
154fb3aabf3SLaurent Vivier 
155f57d4192SLaurent Vivier struct target_sock_filter {
156f57d4192SLaurent Vivier     abi_ushort code;
157f57d4192SLaurent Vivier     uint8_t jt;
158f57d4192SLaurent Vivier     uint8_t jf;
159f57d4192SLaurent Vivier     abi_uint k;
160f57d4192SLaurent Vivier };
161f57d4192SLaurent Vivier 
162f57d4192SLaurent Vivier struct target_sock_fprog {
163f57d4192SLaurent Vivier     abi_ushort len;
164f57d4192SLaurent Vivier     abi_ulong filter;
165f57d4192SLaurent Vivier };
166f57d4192SLaurent Vivier 
167b975b83bSLionel Landwerlin struct target_ip_mreq {
168b975b83bSLionel Landwerlin     struct target_in_addr imr_multiaddr;
169b975b83bSLionel Landwerlin     struct target_in_addr imr_address;
170b975b83bSLionel Landwerlin };
171b975b83bSLionel Landwerlin 
172b975b83bSLionel Landwerlin struct target_ip_mreqn {
173b975b83bSLionel Landwerlin     struct target_in_addr imr_multiaddr;
174b975b83bSLionel Landwerlin     struct target_in_addr imr_address;
175b975b83bSLionel Landwerlin     abi_long imr_ifindex;
176b975b83bSLionel Landwerlin };
177b975b83bSLionel Landwerlin 
1786e3cb58fSLionel Landwerlin struct target_ip_mreq_source {
1796e3cb58fSLionel Landwerlin     /* big endian */
1806e3cb58fSLionel Landwerlin     uint32_t imr_multiaddr;
1816e3cb58fSLionel Landwerlin     uint32_t imr_interface;
1826e3cb58fSLionel Landwerlin     uint32_t imr_sourceaddr;
1836e3cb58fSLionel Landwerlin };
1846e3cb58fSLionel Landwerlin 
18531e31b8aSbellard struct target_timeval {
186992f48a0Sblueswir1     abi_long tv_sec;
187992f48a0Sblueswir1     abi_long tv_usec;
18831e31b8aSbellard };
18931e31b8aSbellard 
1901b6b029eSbellard struct target_timespec {
191992f48a0Sblueswir1     abi_long tv_sec;
192992f48a0Sblueswir1     abi_long tv_nsec;
1931b6b029eSbellard };
1941b6b029eSbellard 
195ef4467e9SPaul Burton struct target_timezone {
196ef4467e9SPaul Burton     abi_int tz_minuteswest;
197ef4467e9SPaul Burton     abi_int tz_dsttime;
198ef4467e9SPaul Burton };
199ef4467e9SPaul Burton 
20066fb9763Sbellard struct target_itimerval {
20166fb9763Sbellard     struct target_timeval it_interval;
20266fb9763Sbellard     struct target_timeval it_value;
20366fb9763Sbellard };
20466fb9763Sbellard 
205905bba13SErik de Castro Lopo struct target_itimerspec {
206905bba13SErik de Castro Lopo     struct target_timespec it_interval;
207905bba13SErik de Castro Lopo     struct target_timespec it_value;
208905bba13SErik de Castro Lopo };
209905bba13SErik de Castro Lopo 
210*19f59bceSAleksandar Markovic struct target_timex {
211*19f59bceSAleksandar Markovic     abi_uint modes;              /* Mode selector */
212*19f59bceSAleksandar Markovic     abi_long offset;             /* Time offset */
213*19f59bceSAleksandar Markovic     abi_long freq;               /* Frequency offset */
214*19f59bceSAleksandar Markovic     abi_long maxerror;           /* Maximum error (microseconds) */
215*19f59bceSAleksandar Markovic     abi_long esterror;           /* Estimated error (microseconds) */
216*19f59bceSAleksandar Markovic     abi_int status;              /* Clock command/status */
217*19f59bceSAleksandar Markovic     abi_long constant;           /* PLL (phase-locked loop) time constant */
218*19f59bceSAleksandar Markovic     abi_long precision;          /* Clock precision (microseconds, ro) */
219*19f59bceSAleksandar Markovic     abi_long tolerance;          /* Clock freq. tolerance (ppm, ro) */
220*19f59bceSAleksandar Markovic     struct target_timeval time;  /* Current time */
221*19f59bceSAleksandar Markovic     abi_long tick;               /* Microseconds between clock ticks */
222*19f59bceSAleksandar Markovic     abi_long ppsfreq;            /* PPS (pulse per second) frequency */
223*19f59bceSAleksandar Markovic     abi_long jitter;             /* PPS jitter (ro); nanoseconds */
224*19f59bceSAleksandar Markovic     abi_int shift;               /* PPS interval duration (seconds) */
225*19f59bceSAleksandar Markovic     abi_long stabil;             /* PPS stability */
226*19f59bceSAleksandar Markovic     abi_long jitcnt;             /* PPS jitter limit exceeded (ro) */
227*19f59bceSAleksandar Markovic     abi_long calcnt;             /* PPS calibration intervals */
228*19f59bceSAleksandar Markovic     abi_long errcnt;             /* PPS calibration errors */
229*19f59bceSAleksandar Markovic     abi_long stbcnt;             /* PPS stability limit exceeded */
230*19f59bceSAleksandar Markovic     abi_int tai;                 /* TAI offset */
231*19f59bceSAleksandar Markovic 
232*19f59bceSAleksandar Markovic     /* Further padding bytes to allow for future expansion */
233*19f59bceSAleksandar Markovic     abi_int:32; abi_int:32; abi_int:32; abi_int:32;
234*19f59bceSAleksandar Markovic     abi_int:32; abi_int:32; abi_int:32; abi_int:32;
235*19f59bceSAleksandar Markovic     abi_int:32; abi_int:32; abi_int:32;
236*19f59bceSAleksandar Markovic };
237*19f59bceSAleksandar Markovic 
238c227f099SAnthony Liguori typedef abi_long target_clock_t;
23932f36bceSbellard 
240c596ed17Sbellard #define TARGET_HZ 100
241c596ed17Sbellard 
24232f36bceSbellard struct target_tms {
243c227f099SAnthony Liguori     target_clock_t tms_utime;
244c227f099SAnthony Liguori     target_clock_t tms_stime;
245c227f099SAnthony Liguori     target_clock_t tms_cutime;
246c227f099SAnthony Liguori     target_clock_t tms_cstime;
24732f36bceSbellard };
24832f36bceSbellard 
2496180a181Sbellard struct target_utimbuf {
250992f48a0Sblueswir1     abi_long actime;
251992f48a0Sblueswir1     abi_long modtime;
2526180a181Sbellard };
2536180a181Sbellard 
254f2674e31Sbellard struct target_sel_arg_struct {
255992f48a0Sblueswir1     abi_long n;
256992f48a0Sblueswir1     abi_long inp, outp, exp;
257992f48a0Sblueswir1     abi_long tvp;
258f2674e31Sbellard };
259f2674e31Sbellard 
26031e31b8aSbellard struct target_iovec {
261992f48a0Sblueswir1     abi_long iov_base;   /* Starting address */
262992f48a0Sblueswir1     abi_long iov_len;   /* Number of bytes */
26331e31b8aSbellard };
26431e31b8aSbellard 
2651a9353d2Sbellard struct target_msghdr {
266992f48a0Sblueswir1     abi_long	 msg_name;	 /* Socket name			*/
2671a9353d2Sbellard     int		 msg_namelen;	 /* Length of name		*/
268992f48a0Sblueswir1     abi_long	 msg_iov;	 /* Data blocks			*/
269992f48a0Sblueswir1     abi_long	 msg_iovlen;	 /* Number of blocks		*/
270992f48a0Sblueswir1     abi_long     msg_control;	 /* Per protocol magic (eg BSD file descriptor passing) */
271992f48a0Sblueswir1     abi_long	 msg_controllen; /* Length of cmsg list */
2721a9353d2Sbellard     unsigned int msg_flags;
2731a9353d2Sbellard };
2741a9353d2Sbellard 
2757854b056Sbellard struct target_cmsghdr {
276992f48a0Sblueswir1     abi_long     cmsg_len;
2777854b056Sbellard     int          cmsg_level;
2787854b056Sbellard     int          cmsg_type;
2797854b056Sbellard };
2807854b056Sbellard 
2817854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1))
282ee104587SJonathan Neuschäfer #define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \
283ee104587SJonathan Neuschäfer                                __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start)
284992f48a0Sblueswir1 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \
285992f48a0Sblueswir1                                & (size_t) ~(sizeof (abi_long) - 1))
2867854b056Sbellard #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \
2877854b056Sbellard                                + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)))
2887854b056Sbellard #define TARGET_CMSG_LEN(len)   (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len))
2897854b056Sbellard 
2907854b056Sbellard static __inline__ struct target_cmsghdr *
291ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(struct target_msghdr *__mhdr,
292ee104587SJonathan Neuschäfer                      struct target_cmsghdr *__cmsg,
293ee104587SJonathan Neuschäfer                      struct target_cmsghdr *__cmsg_start)
2947854b056Sbellard {
2952b8bdefcSths   struct target_cmsghdr *__ptr;
2967854b056Sbellard 
2972b8bdefcSths   __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg
298cbb21eedSMatthias Braun                                     + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len)));
299ee104587SJonathan Neuschäfer   if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start)
300ee104587SJonathan Neuschäfer       > tswapal(__mhdr->msg_controllen)) {
3017854b056Sbellard     /* No more entries.  */
3022b8bdefcSths     return (struct target_cmsghdr *)0;
303ee104587SJonathan Neuschäfer   }
304ee104587SJonathan Neuschäfer   return __ptr;
3057854b056Sbellard }
3067854b056Sbellard 
307f19e00d7SAlexander Graf struct target_mmsghdr {
308f19e00d7SAlexander Graf     struct target_msghdr msg_hdr;              /* Message header */
309f19e00d7SAlexander Graf     unsigned int         msg_len;              /* Number of bytes transmitted */
310f19e00d7SAlexander Graf };
3117854b056Sbellard 
31231e31b8aSbellard struct  target_rusage {
31331e31b8aSbellard         struct target_timeval ru_utime;        /* user time used */
31431e31b8aSbellard         struct target_timeval ru_stime;        /* system time used */
315992f48a0Sblueswir1         abi_long    ru_maxrss;                 /* maximum resident set size */
316992f48a0Sblueswir1         abi_long    ru_ixrss;                  /* integral shared memory size */
317992f48a0Sblueswir1         abi_long    ru_idrss;                  /* integral unshared data size */
318992f48a0Sblueswir1         abi_long    ru_isrss;                  /* integral unshared stack size */
319992f48a0Sblueswir1         abi_long    ru_minflt;                 /* page reclaims */
320992f48a0Sblueswir1         abi_long    ru_majflt;                 /* page faults */
321992f48a0Sblueswir1         abi_long    ru_nswap;                  /* swaps */
322992f48a0Sblueswir1         abi_long    ru_inblock;                /* block input operations */
323992f48a0Sblueswir1         abi_long    ru_oublock;                /* block output operations */
324992f48a0Sblueswir1         abi_long    ru_msgsnd;                 /* messages sent */
325992f48a0Sblueswir1         abi_long    ru_msgrcv;                 /* messages received */
326992f48a0Sblueswir1         abi_long    ru_nsignals;               /* signals received */
327992f48a0Sblueswir1         abi_long    ru_nvcsw;                  /* voluntary context switches */
328992f48a0Sblueswir1         abi_long    ru_nivcsw;                 /* involuntary " */
32931e31b8aSbellard };
33031e31b8aSbellard 
33131e31b8aSbellard typedef struct {
33231e31b8aSbellard         int     val[2];
333c227f099SAnthony Liguori } kernel_fsid_t;
33431e31b8aSbellard 
33572f03900Sbellard struct kernel_statfs {
33631e31b8aSbellard 	int f_type;
33731e31b8aSbellard 	int f_bsize;
33831e31b8aSbellard 	int f_blocks;
33931e31b8aSbellard 	int f_bfree;
34031e31b8aSbellard 	int f_bavail;
34131e31b8aSbellard 	int f_files;
34231e31b8aSbellard 	int f_ffree;
343c227f099SAnthony Liguori         kernel_fsid_t f_fsid;
34431e31b8aSbellard 	int f_namelen;
34531e31b8aSbellard 	int f_spare[6];
34631e31b8aSbellard };
34731e31b8aSbellard 
348dab2ed99Sbellard struct target_dirent {
349992f48a0Sblueswir1         abi_long        d_ino;
350992f48a0Sblueswir1         abi_long        d_off;
351dab2ed99Sbellard         unsigned short  d_reclen;
352333858b7SDmitry V. Levin         char            d_name[];
353dab2ed99Sbellard };
354dab2ed99Sbellard 
355dab2ed99Sbellard struct target_dirent64 {
356dab2ed99Sbellard 	uint64_t	d_ino;
357dab2ed99Sbellard 	int64_t		d_off;
358dab2ed99Sbellard 	unsigned short	d_reclen;
359dab2ed99Sbellard 	unsigned char	d_type;
360dab2ed99Sbellard 	char		d_name[256];
361dab2ed99Sbellard };
362dab2ed99Sbellard 
363dab2ed99Sbellard 
36431e31b8aSbellard /* mostly generic signal stuff */
365992f48a0Sblueswir1 #define TARGET_SIG_DFL	((abi_long)0)	/* default signal handling */
366992f48a0Sblueswir1 #define TARGET_SIG_IGN	((abi_long)1)	/* ignore signal */
367992f48a0Sblueswir1 #define TARGET_SIG_ERR	((abi_long)-1)	/* error return from signal */
36831e31b8aSbellard 
36931e31b8aSbellard #ifdef TARGET_MIPS
37031e31b8aSbellard #define TARGET_NSIG	   128
37131e31b8aSbellard #else
37231e31b8aSbellard #define TARGET_NSIG	   64
37331e31b8aSbellard #endif
374992f48a0Sblueswir1 #define TARGET_NSIG_BPW	   TARGET_ABI_BITS
37531e31b8aSbellard #define TARGET_NSIG_WORDS  (TARGET_NSIG / TARGET_NSIG_BPW)
37631e31b8aSbellard 
37731e31b8aSbellard typedef struct {
378992f48a0Sblueswir1     abi_ulong sig[TARGET_NSIG_WORDS];
379c227f099SAnthony Liguori } target_sigset_t;
38031e31b8aSbellard 
38166fb9763Sbellard #ifdef BSWAP_NEEDED
382c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
38366fb9763Sbellard {
38466fb9763Sbellard     int i;
38566fb9763Sbellard     for(i = 0;i < TARGET_NSIG_WORDS; i++)
386cbb21eedSMatthias Braun         d->sig[i] = tswapal(s->sig[i]);
38766fb9763Sbellard }
38866fb9763Sbellard #else
389c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
39066fb9763Sbellard {
39166fb9763Sbellard     *d = *s;
39266fb9763Sbellard }
39366fb9763Sbellard #endif
39466fb9763Sbellard 
395c227f099SAnthony Liguori static inline void target_siginitset(target_sigset_t *d, abi_ulong set)
39666fb9763Sbellard {
39766fb9763Sbellard     int i;
39866fb9763Sbellard     d->sig[0] = set;
39966fb9763Sbellard     for(i = 1;i < TARGET_NSIG_WORDS; i++)
40066fb9763Sbellard         d->sig[i] = 0;
40166fb9763Sbellard }
40266fb9763Sbellard 
403c227f099SAnthony Liguori void host_to_target_sigset(target_sigset_t *d, const sigset_t *s);
404c227f099SAnthony Liguori void target_to_host_sigset(sigset_t *d, const target_sigset_t *s);
405992f48a0Sblueswir1 void host_to_target_old_sigset(abi_ulong *old_sigset,
40666fb9763Sbellard                                const sigset_t *sigset);
40766fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset,
408992f48a0Sblueswir1                                const abi_ulong *old_sigset);
40966fb9763Sbellard struct target_sigaction;
41066fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act,
41166fb9763Sbellard                  struct target_sigaction *oact);
41266fb9763Sbellard 
413d2fbca94SGuan Xuetao #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \
414d2fbca94SGuan Xuetao     || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined(TARGET_SH4) \
415d2fbca94SGuan Xuetao     || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) \
416a4c075f1SUlrich Hecht     || defined(TARGET_MICROBLAZE) || defined(TARGET_UNICORE32) \
417b16189b2SChen Gang     || defined(TARGET_S390X) || defined(TARGET_OPENRISC) \
418b16189b2SChen Gang     || defined(TARGET_TILEGX)
4192521d698Sbellard 
420048f6b4dSbellard #if defined(TARGET_SPARC)
421048f6b4dSbellard #define TARGET_SA_NOCLDSTOP    8u
422048f6b4dSbellard #define TARGET_SA_NOCLDWAIT    0x100u
423048f6b4dSbellard #define TARGET_SA_SIGINFO      0x200u
424048f6b4dSbellard #define TARGET_SA_ONSTACK      1u
425048f6b4dSbellard #define TARGET_SA_RESTART      2u
426048f6b4dSbellard #define TARGET_SA_NODEFER      0x20u
427048f6b4dSbellard #define TARGET_SA_RESETHAND    4u
428048f6b4dSbellard #elif defined(TARGET_MIPS)
429048f6b4dSbellard #define TARGET_SA_NOCLDSTOP	0x00000001
430048f6b4dSbellard #define TARGET_SA_NOCLDWAIT	0x00010000
431048f6b4dSbellard #define TARGET_SA_SIGINFO	0x00000008
432048f6b4dSbellard #define TARGET_SA_ONSTACK	0x08000000
433048f6b4dSbellard #define TARGET_SA_NODEFER	0x40000000
434048f6b4dSbellard #define TARGET_SA_RESTART	0x10000000
435048f6b4dSbellard #define TARGET_SA_RESETHAND	0x80000000
436d26bc211Sths #if !defined(TARGET_ABI_MIPSN32) && !defined(TARGET_ABI_MIPSN64)
437d26bc211Sths #define TARGET_SA_RESTORER	0x04000000	/* Only for O32 */
438540635baSths #endif
439d962783eSJia Liu #elif defined(TARGET_OPENRISC)
440d962783eSJia Liu #define TARGET_SA_NOCLDSTOP    0x00000001
441d962783eSJia Liu #define TARGET_SA_NOCLDWAIT    0x00000002
442d962783eSJia Liu #define TARGET_SA_SIGINFO      0x00000004
443d962783eSJia Liu #define TARGET_SA_ONSTACK      0x08000000
444d962783eSJia Liu #define TARGET_SA_RESTART      0x10000000
445d962783eSJia Liu #define TARGET_SA_NODEFER      0x40000000
446d962783eSJia Liu #define TARGET_SA_RESETHAND    0x80000000
44757f18a95SRichard Henderson #elif defined(TARGET_ALPHA)
44857f18a95SRichard Henderson #define TARGET_SA_ONSTACK	0x00000001
44957f18a95SRichard Henderson #define TARGET_SA_RESTART	0x00000002
45057f18a95SRichard Henderson #define TARGET_SA_NOCLDSTOP	0x00000004
45157f18a95SRichard Henderson #define TARGET_SA_NODEFER	0x00000008
45257f18a95SRichard Henderson #define TARGET_SA_RESETHAND	0x00000010
45357f18a95SRichard Henderson #define TARGET_SA_NOCLDWAIT	0x00000020 /* not supported yet */
45457f18a95SRichard Henderson #define TARGET_SA_SIGINFO	0x00000040
455048f6b4dSbellard #else
4562521d698Sbellard #define TARGET_SA_NOCLDSTOP	0x00000001
4572521d698Sbellard #define TARGET_SA_NOCLDWAIT	0x00000002 /* not supported yet */
4582521d698Sbellard #define TARGET_SA_SIGINFO	0x00000004
4592521d698Sbellard #define TARGET_SA_ONSTACK	0x08000000
4602521d698Sbellard #define TARGET_SA_RESTART	0x10000000
4612521d698Sbellard #define TARGET_SA_NODEFER	0x40000000
4622521d698Sbellard #define TARGET_SA_RESETHAND	0x80000000
4632521d698Sbellard #define TARGET_SA_RESTORER	0x04000000
4646d5e216dSbellard #endif
4656d5e216dSbellard 
466d0f20495SRichard Henderson #if defined(TARGET_ALPHA)
467d0f20495SRichard Henderson 
468d0f20495SRichard Henderson #define TARGET_SIGHUP            1
469d0f20495SRichard Henderson #define TARGET_SIGINT            2
470d0f20495SRichard Henderson #define TARGET_SIGQUIT           3
471d0f20495SRichard Henderson #define TARGET_SIGILL            4
472d0f20495SRichard Henderson #define TARGET_SIGTRAP           5
473d0f20495SRichard Henderson #define TARGET_SIGABRT           6
474d0f20495SRichard Henderson #define TARGET_SIGSTKFLT         7 /* actually SIGEMT */
475d0f20495SRichard Henderson #define TARGET_SIGFPE            8
476d0f20495SRichard Henderson #define TARGET_SIGKILL           9
477d0f20495SRichard Henderson #define TARGET_SIGBUS           10
478d0f20495SRichard Henderson #define TARGET_SIGSEGV          11
479d0f20495SRichard Henderson #define TARGET_SIGSYS           12
480d0f20495SRichard Henderson #define TARGET_SIGPIPE          13
481d0f20495SRichard Henderson #define TARGET_SIGALRM          14
482d0f20495SRichard Henderson #define TARGET_SIGTERM          15
483d0f20495SRichard Henderson #define TARGET_SIGURG           16
484d0f20495SRichard Henderson #define TARGET_SIGSTOP          17
485d0f20495SRichard Henderson #define TARGET_SIGTSTP          18
486d0f20495SRichard Henderson #define TARGET_SIGCONT          19
487d0f20495SRichard Henderson #define TARGET_SIGCHLD          20
488d0f20495SRichard Henderson #define TARGET_SIGTTIN          21
489d0f20495SRichard Henderson #define TARGET_SIGTTOU          22
490d0f20495SRichard Henderson #define TARGET_SIGIO            23
491d0f20495SRichard Henderson #define TARGET_SIGXCPU          24
492d0f20495SRichard Henderson #define TARGET_SIGXFSZ          25
493d0f20495SRichard Henderson #define TARGET_SIGVTALRM        26
494d0f20495SRichard Henderson #define TARGET_SIGPROF          27
495d0f20495SRichard Henderson #define TARGET_SIGWINCH         28
496d0f20495SRichard Henderson #define TARGET_SIGPWR           29 /* actually SIGINFO */
497d0f20495SRichard Henderson #define TARGET_SIGUSR1          30
498d0f20495SRichard Henderson #define TARGET_SIGUSR2          31
499d0f20495SRichard Henderson #define TARGET_SIGRTMIN         32
500d0f20495SRichard Henderson 
501d0f20495SRichard Henderson #define TARGET_SIG_BLOCK         1
502d0f20495SRichard Henderson #define TARGET_SIG_UNBLOCK       2
503d0f20495SRichard Henderson #define TARGET_SIG_SETMASK       3
504d0f20495SRichard Henderson 
505d0f20495SRichard Henderson #elif defined(TARGET_SPARC)
5066d5e216dSbellard 
5076d5e216dSbellard #define TARGET_SIGHUP		 1
5086d5e216dSbellard #define TARGET_SIGINT		 2
5096d5e216dSbellard #define TARGET_SIGQUIT		 3
5106d5e216dSbellard #define TARGET_SIGILL		 4
5116d5e216dSbellard #define TARGET_SIGTRAP		 5
5126d5e216dSbellard #define TARGET_SIGABRT		 6
5136d5e216dSbellard #define TARGET_SIGIOT		 6
5146d5e216dSbellard #define TARGET_SIGSTKFLT	 7 /* actually EMT */
5156d5e216dSbellard #define TARGET_SIGFPE		 8
5166d5e216dSbellard #define TARGET_SIGKILL		 9
5176d5e216dSbellard #define TARGET_SIGBUS		10
5186d5e216dSbellard #define TARGET_SIGSEGV		11
5196d5e216dSbellard #define TARGET_SIGSYS		12
5206d5e216dSbellard #define TARGET_SIGPIPE		13
5216d5e216dSbellard #define TARGET_SIGALRM		14
5226d5e216dSbellard #define TARGET_SIGTERM		15
5236d5e216dSbellard #define TARGET_SIGURG		16
5246d5e216dSbellard #define TARGET_SIGSTOP		17
5256d5e216dSbellard #define TARGET_SIGTSTP		18
5266d5e216dSbellard #define TARGET_SIGCONT		19
5276d5e216dSbellard #define TARGET_SIGCHLD		20
5286d5e216dSbellard #define TARGET_SIGTTIN		21
5296d5e216dSbellard #define TARGET_SIGTTOU		22
5306d5e216dSbellard #define TARGET_SIGIO		23
5316d5e216dSbellard #define TARGET_SIGXCPU		24
5326d5e216dSbellard #define TARGET_SIGXFSZ		25
5336d5e216dSbellard #define TARGET_SIGVTALRM	26
5346d5e216dSbellard #define TARGET_SIGPROF		27
5356d5e216dSbellard #define TARGET_SIGWINCH	        28
5366d5e216dSbellard #define TARGET_SIGPWR		29
5376d5e216dSbellard #define TARGET_SIGUSR1		30
5386d5e216dSbellard #define TARGET_SIGUSR2		31
5396d5e216dSbellard #define TARGET_SIGRTMIN         32
5406d5e216dSbellard 
5416d5e216dSbellard #define TARGET_SIG_BLOCK          0x01 /* for blocking signals */
5426d5e216dSbellard #define TARGET_SIG_UNBLOCK        0x02 /* for unblocking signals */
5436d5e216dSbellard #define TARGET_SIG_SETMASK        0x04 /* for setting the signal mask */
5446d5e216dSbellard 
545048f6b4dSbellard #elif defined(TARGET_MIPS)
546048f6b4dSbellard 
547048f6b4dSbellard #define TARGET_SIGHUP		 1	/* Hangup (POSIX).  */
548048f6b4dSbellard #define TARGET_SIGINT		 2	/* Interrupt (ANSI).  */
549048f6b4dSbellard #define TARGET_SIGQUIT		 3	/* Quit (POSIX).  */
550048f6b4dSbellard #define TARGET_SIGILL		 4	/* Illegal instruction (ANSI).  */
551048f6b4dSbellard #define TARGET_SIGTRAP		 5	/* Trace trap (POSIX).  */
552048f6b4dSbellard #define TARGET_SIGIOT		 6	/* IOT trap (4.2 BSD).  */
553048f6b4dSbellard #define TARGET_SIGABRT		 TARGET_SIGIOT	/* Abort (ANSI).  */
554048f6b4dSbellard #define TARGET_SIGEMT		 7
555048f6b4dSbellard #define TARGET_SIGSTKFLT	 7 /* XXX: incorrect */
556048f6b4dSbellard #define TARGET_SIGFPE		 8	/* Floating-point exception (ANSI).  */
557048f6b4dSbellard #define TARGET_SIGKILL		 9	/* Kill, unblockable (POSIX).  */
558048f6b4dSbellard #define TARGET_SIGBUS		10	/* BUS error (4.2 BSD).  */
559048f6b4dSbellard #define TARGET_SIGSEGV		11	/* Segmentation violation (ANSI).  */
560048f6b4dSbellard #define TARGET_SIGSYS		12
561048f6b4dSbellard #define TARGET_SIGPIPE		13	/* Broken pipe (POSIX).  */
562048f6b4dSbellard #define TARGET_SIGALRM		14	/* Alarm clock (POSIX).  */
563048f6b4dSbellard #define TARGET_SIGTERM		15	/* Termination (ANSI).  */
564048f6b4dSbellard #define TARGET_SIGUSR1		16	/* User-defined signal 1 (POSIX).  */
565048f6b4dSbellard #define TARGET_SIGUSR2		17	/* User-defined signal 2 (POSIX).  */
566048f6b4dSbellard #define TARGET_SIGCHLD		18	/* Child status has changed (POSIX).  */
567048f6b4dSbellard #define TARGET_SIGCLD		TARGET_SIGCHLD	/* Same as TARGET_SIGCHLD (System V).  */
568048f6b4dSbellard #define TARGET_SIGPWR		19	/* Power failure restart (System V).  */
569048f6b4dSbellard #define TARGET_SIGWINCH	20	/* Window size change (4.3 BSD, Sun).  */
570048f6b4dSbellard #define TARGET_SIGURG		21	/* Urgent condition on socket (4.2 BSD).  */
571048f6b4dSbellard #define TARGET_SIGIO		22	/* I/O now possible (4.2 BSD).  */
572048f6b4dSbellard #define TARGET_SIGPOLL		TARGET_SIGIO	/* Pollable event occurred (System V).  */
573048f6b4dSbellard #define TARGET_SIGSTOP		23	/* Stop, unblockable (POSIX).  */
574048f6b4dSbellard #define TARGET_SIGTSTP		24	/* Keyboard stop (POSIX).  */
575048f6b4dSbellard #define TARGET_SIGCONT		25	/* Continue (POSIX).  */
576048f6b4dSbellard #define TARGET_SIGTTIN		26	/* Background read from tty (POSIX).  */
577048f6b4dSbellard #define TARGET_SIGTTOU		27	/* Background write to tty (POSIX).  */
578048f6b4dSbellard #define TARGET_SIGVTALRM	28	/* Virtual alarm clock (4.2 BSD).  */
579048f6b4dSbellard #define TARGET_SIGPROF		29	/* Profiling alarm clock (4.2 BSD).  */
580048f6b4dSbellard #define TARGET_SIGXCPU		30	/* CPU limit exceeded (4.2 BSD).  */
581048f6b4dSbellard #define TARGET_SIGXFSZ		31	/* File size limit exceeded (4.2 BSD).  */
582048f6b4dSbellard #define TARGET_SIGRTMIN         32
583048f6b4dSbellard 
584048f6b4dSbellard #define TARGET_SIG_BLOCK	1	/* for blocking signals */
585048f6b4dSbellard #define TARGET_SIG_UNBLOCK	2	/* for unblocking signals */
586048f6b4dSbellard #define TARGET_SIG_SETMASK	3	/* for setting the signal mask */
587048f6b4dSbellard 
5886d5e216dSbellard #else
5892521d698Sbellard 
590d962783eSJia Liu /* OpenRISC Using the general signals */
5912521d698Sbellard #define TARGET_SIGHUP		 1
5922521d698Sbellard #define TARGET_SIGINT		 2
5932521d698Sbellard #define TARGET_SIGQUIT		 3
5942521d698Sbellard #define TARGET_SIGILL		 4
5952521d698Sbellard #define TARGET_SIGTRAP		 5
5962521d698Sbellard #define TARGET_SIGABRT		 6
5972521d698Sbellard #define TARGET_SIGIOT		 6
5982521d698Sbellard #define TARGET_SIGBUS		 7
5992521d698Sbellard #define TARGET_SIGFPE		 8
6002521d698Sbellard #define TARGET_SIGKILL		 9
6012521d698Sbellard #define TARGET_SIGUSR1		10
6022521d698Sbellard #define TARGET_SIGSEGV		11
6032521d698Sbellard #define TARGET_SIGUSR2		12
6042521d698Sbellard #define TARGET_SIGPIPE		13
6052521d698Sbellard #define TARGET_SIGALRM		14
6062521d698Sbellard #define TARGET_SIGTERM		15
6072521d698Sbellard #define TARGET_SIGSTKFLT	16
6082521d698Sbellard #define TARGET_SIGCHLD		17
6092521d698Sbellard #define TARGET_SIGCONT		18
6102521d698Sbellard #define TARGET_SIGSTOP		19
6112521d698Sbellard #define TARGET_SIGTSTP		20
6122521d698Sbellard #define TARGET_SIGTTIN		21
6132521d698Sbellard #define TARGET_SIGTTOU		22
6142521d698Sbellard #define TARGET_SIGURG		23
6152521d698Sbellard #define TARGET_SIGXCPU		24
6162521d698Sbellard #define TARGET_SIGXFSZ		25
6172521d698Sbellard #define TARGET_SIGVTALRM	26
6182521d698Sbellard #define TARGET_SIGPROF		27
6192521d698Sbellard #define TARGET_SIGWINCH	        28
6202521d698Sbellard #define TARGET_SIGIO		29
621c596ed17Sbellard #define TARGET_SIGPWR		30
622c596ed17Sbellard #define TARGET_SIGSYS		31
6232521d698Sbellard #define TARGET_SIGRTMIN         32
6242521d698Sbellard 
6252521d698Sbellard #define TARGET_SIG_BLOCK          0    /* for blocking signals */
6262521d698Sbellard #define TARGET_SIG_UNBLOCK        1    /* for unblocking signals */
6272521d698Sbellard #define TARGET_SIG_SETMASK        2    /* for setting the signal mask */
6282521d698Sbellard 
6296d5e216dSbellard #endif
6306d5e216dSbellard 
6316049f4f8SRichard Henderson #if defined(TARGET_ALPHA)
6326049f4f8SRichard Henderson struct target_old_sigaction {
6336049f4f8SRichard Henderson     abi_ulong _sa_handler;
6346049f4f8SRichard Henderson     abi_ulong sa_mask;
635d2565875SRichard Henderson     int32_t sa_flags;
6366049f4f8SRichard Henderson };
637106ec879Sbellard 
6386049f4f8SRichard Henderson struct target_rt_sigaction {
6396049f4f8SRichard Henderson     abi_ulong _sa_handler;
6406049f4f8SRichard Henderson     abi_ulong sa_flags;
6416049f4f8SRichard Henderson     target_sigset_t sa_mask;
6426049f4f8SRichard Henderson };
6436049f4f8SRichard Henderson 
6446049f4f8SRichard Henderson /* This is the struct used inside the kernel.  The ka_restorer
6456049f4f8SRichard Henderson    field comes from the 5th argument to sys_rt_sigaction.  */
6466049f4f8SRichard Henderson struct target_sigaction {
6476049f4f8SRichard Henderson     abi_ulong _sa_handler;
6486049f4f8SRichard Henderson     abi_ulong sa_flags;
6496049f4f8SRichard Henderson     target_sigset_t sa_mask;
6506049f4f8SRichard Henderson     abi_ulong sa_restorer;
6516049f4f8SRichard Henderson };
6526049f4f8SRichard Henderson #elif defined(TARGET_MIPS)
653106ec879Sbellard struct target_sigaction {
654540635baSths 	uint32_t	sa_flags;
655d26bc211Sths #if defined(TARGET_ABI_MIPSN32)
656540635baSths 	uint32_t	_sa_handler;
657540635baSths #else
658992f48a0Sblueswir1 	abi_ulong	_sa_handler;
659540635baSths #endif
660c227f099SAnthony Liguori 	target_sigset_t	sa_mask;
661106ec879Sbellard };
662106ec879Sbellard #else
6632521d698Sbellard struct target_old_sigaction {
664992f48a0Sblueswir1         abi_ulong _sa_handler;
665992f48a0Sblueswir1         abi_ulong sa_mask;
666992f48a0Sblueswir1         abi_ulong sa_flags;
667992f48a0Sblueswir1         abi_ulong sa_restorer;
6682521d698Sbellard };
6692521d698Sbellard 
6702521d698Sbellard struct target_sigaction {
671992f48a0Sblueswir1         abi_ulong _sa_handler;
672992f48a0Sblueswir1         abi_ulong sa_flags;
673992f48a0Sblueswir1         abi_ulong sa_restorer;
674c227f099SAnthony Liguori         target_sigset_t sa_mask;
6752521d698Sbellard };
676106ec879Sbellard #endif
6772521d698Sbellard 
6782521d698Sbellard typedef union target_sigval {
6792521d698Sbellard 	int sival_int;
680992f48a0Sblueswir1         abi_ulong sival_ptr;
681c227f099SAnthony Liguori } target_sigval_t;
6826d5e216dSbellard #if 0
6836d5e216dSbellard #if defined (TARGET_SPARC)
6846d5e216dSbellard typedef struct {
6856d5e216dSbellard 	struct {
686992f48a0Sblueswir1 		abi_ulong psr;
687992f48a0Sblueswir1 		abi_ulong pc;
688992f48a0Sblueswir1 		abi_ulong npc;
689992f48a0Sblueswir1 		abi_ulong y;
690992f48a0Sblueswir1 		abi_ulong u_regs[16]; /* globals and ins */
6916d5e216dSbellard 	}		si_regs;
6926d5e216dSbellard 	int		si_mask;
6936d5e216dSbellard } __siginfo_t;
6946d5e216dSbellard 
6956d5e216dSbellard typedef struct {
6966d5e216dSbellard 	unsigned   long si_float_regs [32];
6976d5e216dSbellard 	unsigned   long si_fsr;
6986d5e216dSbellard 	unsigned   long si_fpqdepth;
6996d5e216dSbellard 	struct {
7006d5e216dSbellard 		unsigned long *insn_addr;
7016d5e216dSbellard 		unsigned long insn;
7026d5e216dSbellard 	} si_fpqueue [16];
7036d5e216dSbellard } __siginfo_fpu_t;
7046d5e216dSbellard #endif
7056d5e216dSbellard #endif
7062521d698Sbellard 
7072521d698Sbellard #define TARGET_SI_MAX_SIZE	128
708aa5e03d2SMaxim Ostapenko 
709aa5e03d2SMaxim Ostapenko #if TARGET_ABI_BITS == 32
710aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int))
711aa5e03d2SMaxim Ostapenko #else
712aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int))
713aa5e03d2SMaxim Ostapenko #endif
714aa5e03d2SMaxim Ostapenko 
715aa5e03d2SMaxim Ostapenko #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int))
7162521d698Sbellard 
717a70dadc7SPeter Maydell /* Within QEMU the top 16 bits of si_code indicate which of the parts of
718a70dadc7SPeter Maydell  * the union in target_siginfo is valid. This only applies between
719a70dadc7SPeter Maydell  * host_to_target_siginfo_noswap() and tswap_siginfo(); it does not
720a70dadc7SPeter Maydell  * appear either within host siginfo_t or in target_siginfo structures
721a70dadc7SPeter Maydell  * which we get from the guest userspace program. (The Linux kernel
722a70dadc7SPeter Maydell  * does a similar thing with using the top bits for its own internal
723a70dadc7SPeter Maydell  * purposes but not letting them be visible to userspace.)
724a70dadc7SPeter Maydell  */
725a70dadc7SPeter Maydell #define QEMU_SI_KILL 0
726a70dadc7SPeter Maydell #define QEMU_SI_TIMER 1
727a70dadc7SPeter Maydell #define QEMU_SI_POLL 2
728a70dadc7SPeter Maydell #define QEMU_SI_FAULT 3
729a70dadc7SPeter Maydell #define QEMU_SI_CHLD 4
730a70dadc7SPeter Maydell #define QEMU_SI_RT 5
731a70dadc7SPeter Maydell 
7322521d698Sbellard typedef struct target_siginfo {
7333f53d546Spbrook #ifdef TARGET_MIPS
7343f53d546Spbrook 	int si_signo;
7353f53d546Spbrook 	int si_code;
7363f53d546Spbrook 	int si_errno;
7373f53d546Spbrook #else
7382521d698Sbellard 	int si_signo;
7392521d698Sbellard 	int si_errno;
7402521d698Sbellard 	int si_code;
7413f53d546Spbrook #endif
7422521d698Sbellard 
7432521d698Sbellard 	union {
7442521d698Sbellard 		int _pad[TARGET_SI_PAD_SIZE];
7452521d698Sbellard 
7462521d698Sbellard 		/* kill() */
7472521d698Sbellard 		struct {
7482521d698Sbellard 			pid_t _pid;		/* sender's pid */
7492521d698Sbellard 			uid_t _uid;		/* sender's uid */
7502521d698Sbellard 		} _kill;
7512521d698Sbellard 
7522521d698Sbellard 		/* POSIX.1b timers */
7532521d698Sbellard 		struct {
7542521d698Sbellard 			unsigned int _timer1;
7552521d698Sbellard 			unsigned int _timer2;
7562521d698Sbellard 		} _timer;
7572521d698Sbellard 
7582521d698Sbellard 		/* POSIX.1b signals */
7592521d698Sbellard 		struct {
7602521d698Sbellard 			pid_t _pid;		/* sender's pid */
7612521d698Sbellard 			uid_t _uid;		/* sender's uid */
762c227f099SAnthony Liguori 			target_sigval_t _sigval;
7632521d698Sbellard 		} _rt;
7642521d698Sbellard 
7652521d698Sbellard 		/* SIGCHLD */
7662521d698Sbellard 		struct {
7672521d698Sbellard 			pid_t _pid;		/* which child */
7682521d698Sbellard 			uid_t _uid;		/* sender's uid */
7692521d698Sbellard 			int _status;		/* exit code */
770c227f099SAnthony Liguori 			target_clock_t _utime;
771c227f099SAnthony Liguori                         target_clock_t _stime;
7722521d698Sbellard 		} _sigchld;
7732521d698Sbellard 
7742521d698Sbellard 		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
7752521d698Sbellard 		struct {
776992f48a0Sblueswir1 			abi_ulong _addr; /* faulting insn/memory ref. */
7772521d698Sbellard 		} _sigfault;
7782521d698Sbellard 
7792521d698Sbellard 		/* SIGPOLL */
7802521d698Sbellard 		struct {
7812521d698Sbellard 			int _band;	/* POLL_IN, POLL_OUT, POLL_MSG */
7822521d698Sbellard 			int _fd;
7832521d698Sbellard 		} _sigpoll;
7842521d698Sbellard 	} _sifields;
785c227f099SAnthony Liguori } target_siginfo_t;
7862521d698Sbellard 
7872521d698Sbellard /*
7882521d698Sbellard  * si_code values
7892521d698Sbellard  * Digital reserves positive values for kernel-generated signals.
7902521d698Sbellard  */
7912521d698Sbellard #define TARGET_SI_USER		0	/* sent by kill, sigsend, raise */
7922521d698Sbellard #define TARGET_SI_KERNEL	0x80	/* sent by the kernel from somewhere */
7932521d698Sbellard #define TARGET_SI_QUEUE	-1		/* sent by sigqueue */
7942521d698Sbellard #define TARGET_SI_TIMER -2              /* sent by timer expiration */
7952521d698Sbellard #define TARGET_SI_MESGQ	-3		/* sent by real time mesq state change */
7962521d698Sbellard #define TARGET_SI_ASYNCIO	-4	/* sent by AIO completion */
7972521d698Sbellard #define TARGET_SI_SIGIO	-5		/* sent by queued SIGIO */
7982521d698Sbellard 
7992521d698Sbellard /*
8002521d698Sbellard  * SIGILL si_codes
8012521d698Sbellard  */
802ffa65c3bSbellard #define TARGET_ILL_ILLOPC	(1)	/* illegal opcode */
8032521d698Sbellard #define TARGET_ILL_ILLOPN	(2)	/* illegal operand */
804ffa65c3bSbellard #define TARGET_ILL_ILLADR	(3)	/* illegal addressing mode */
805ffa65c3bSbellard #define TARGET_ILL_ILLTRP	(4)	/* illegal trap */
806ffa65c3bSbellard #define TARGET_ILL_PRVOPC	(5)	/* privileged opcode */
807ffa65c3bSbellard #define TARGET_ILL_PRVREG	(6)	/* privileged register */
808ffa65c3bSbellard #define TARGET_ILL_COPROC	(7)	/* coprocessor error */
809ffa65c3bSbellard #define TARGET_ILL_BADSTK	(8)	/* internal stack error */
810de2fdd56SChen Gang #ifdef TARGET_TILEGX
811de2fdd56SChen Gang #define TARGET_ILL_DBLFLT       (9)     /* double fault */
812de2fdd56SChen Gang #define TARGET_ILL_HARDWALL     (10)    /* user networks hardwall violation */
813de2fdd56SChen Gang #endif
8142521d698Sbellard 
8152521d698Sbellard /*
8162521d698Sbellard  * SIGFPE si_codes
8172521d698Sbellard  */
8182521d698Sbellard #define TARGET_FPE_INTDIV      (1)  /* integer divide by zero */
8192521d698Sbellard #define TARGET_FPE_INTOVF      (2)  /* integer overflow */
8202521d698Sbellard #define TARGET_FPE_FLTDIV      (3)  /* floating point divide by zero */
8212521d698Sbellard #define TARGET_FPE_FLTOVF      (4)  /* floating point overflow */
8222521d698Sbellard #define TARGET_FPE_FLTUND      (5)  /* floating point underflow */
8232521d698Sbellard #define TARGET_FPE_FLTRES      (6)  /* floating point inexact result */
8242521d698Sbellard #define TARGET_FPE_FLTINV      (7)  /* floating point invalid operation */
8252521d698Sbellard #define TARGET_FPE_FLTSUB      (8)  /* subscript out of range */
8262521d698Sbellard #define TARGET_NSIGFPE         8
8272521d698Sbellard 
8282521d698Sbellard /*
8292521d698Sbellard  * SIGSEGV si_codes
8302521d698Sbellard  */
8312521d698Sbellard #define TARGET_SEGV_MAPERR     (1)  /* address not mapped to object */
8322521d698Sbellard #define TARGET_SEGV_ACCERR     (2)  /* invalid permissions for mapped object */
833de2fdd56SChen Gang #define TARGET_SEGV_BNDERR     (3)  /* failed address bound checks */
8342521d698Sbellard 
8352521d698Sbellard /*
836ffa65c3bSbellard  * SIGBUS si_codes
837ffa65c3bSbellard  */
838ffa65c3bSbellard #define TARGET_BUS_ADRALN       (1)	/* invalid address alignment */
839b4916d7bSDong Xu Wang #define TARGET_BUS_ADRERR       (2)	/* non-existent physical address */
840ffa65c3bSbellard #define TARGET_BUS_OBJERR       (3)	/* object specific hardware error */
841de2fdd56SChen Gang /* hardware memory error consumed on a machine check: action required */
842de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AR    (4)
843de2fdd56SChen Gang /* hardware memory error detected in process but not consumed: action optional*/
844de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AO    (5)
845ffa65c3bSbellard 
846ffa65c3bSbellard /*
8472521d698Sbellard  * SIGTRAP si_codes
8482521d698Sbellard  */
8492521d698Sbellard #define TARGET_TRAP_BRKPT	(1)	/* process breakpoint */
8502521d698Sbellard #define TARGET_TRAP_TRACE	(2)	/* process trace trap */
851de2fdd56SChen Gang #define TARGET_TRAP_BRANCH      (3)     /* process taken branch trap */
852de2fdd56SChen Gang #define TARGET_TRAP_HWBKPT      (4)     /* hardware breakpoint/watchpoint */
8532521d698Sbellard 
8542521d698Sbellard #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */
8552521d698Sbellard 
8569de5e440Sbellard struct target_rlimit {
857992f48a0Sblueswir1         abi_ulong   rlim_cur;
858992f48a0Sblueswir1         abi_ulong   rlim_max;
8599de5e440Sbellard };
8609de5e440Sbellard 
86181bbe906Stakasi-y@ops.dti.ne.jp #if defined(TARGET_ALPHA)
862e476492eSAurelien Jarno #define TARGET_RLIM_INFINITY	0x7fffffffffffffffull
8636cafd027SMatthias Braun #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32)
86481bbe906Stakasi-y@ops.dti.ne.jp #define TARGET_RLIM_INFINITY	0x7fffffffUL
86581bbe906Stakasi-y@ops.dti.ne.jp #else
86626b746dbSMatthias Braun #define TARGET_RLIM_INFINITY	((abi_ulong)-1)
86781bbe906Stakasi-y@ops.dti.ne.jp #endif
86881bbe906Stakasi-y@ops.dti.ne.jp 
869e22b7015SWesley W. Terpstra #if defined(TARGET_MIPS)
870e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU		0
871e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE		1
872e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA		2
873e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK		3
874e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE		4
875e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS		7
876e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC		8
877e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE		5
878e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK		9
879e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS		6
880e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS		10
881e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING	11
882e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE		12
883e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE		13
884e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO		14
885e22b7015SWesley W. Terpstra #else
886e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU		0
887e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE		1
888e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA		2
889e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK		3
890e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE		4
891e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS		5
8926cafd027SMatthias Braun #if defined(TARGET_SPARC)
8936cafd027SMatthias Braun #define TARGET_RLIMIT_NOFILE		6
8946cafd027SMatthias Braun #define TARGET_RLIMIT_NPROC		7
8956cafd027SMatthias Braun #else
896e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC		6
897e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE		7
8986cafd027SMatthias Braun #endif
899e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK		8
900e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS		9
901e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS		10
902e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING	11
903e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE		12
904e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE		13
905e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO		14
906e22b7015SWesley W. Terpstra #endif
907e22b7015SWesley W. Terpstra 
9089de5e440Sbellard struct target_pollfd {
9099de5e440Sbellard     int fd;           /* file descriptor */
9109de5e440Sbellard     short events;     /* requested events */
9119de5e440Sbellard     short revents;    /* returned events */
9129de5e440Sbellard };
9139de5e440Sbellard 
9148e5a0667Sbellard /* virtual terminal ioctls */
9150221cfcdSbellard #define TARGET_KIOCSOUND       0x4B2F	/* start sound generation (0 for off) */
9160221cfcdSbellard #define TARGET_KDMKTONE	       0x4B30	/* generate tone */
9178e5a0667Sbellard #define TARGET_KDGKBTYPE       0x4b33
918f7680a55SUlrich Hecht #define TARGET_KDSETMODE       0x4b3a
919f7680a55SUlrich Hecht #define TARGET_KDGKBMODE       0x4b44
920f7680a55SUlrich Hecht #define TARGET_KDSKBMODE       0x4b45
9210221cfcdSbellard #define TARGET_KDGKBENT	       0x4B46	/* gets one entry in translation table */
9220221cfcdSbellard #define TARGET_KDGKBSENT       0x4B48	/* gets one function key string entry */
923e6fe18fbSCédric VINCENT #define TARGET_KDGKBLED        0x4B64	/* get led flags (not lights) */
924e6fe18fbSCédric VINCENT #define TARGET_KDSKBLED        0x4B65	/* set led flags (not lights) */
925e6fe18fbSCédric VINCENT #define TARGET_KDGETLED        0x4B31	/* return current led state */
926e6fe18fbSCédric VINCENT #define TARGET_KDSETLED        0x4B32	/* set led state [lights, not flags] */
927ca56f5b5SPaul Burton #define TARGET_KDSIGACCEPT     0x4B4E
9288e5a0667Sbellard 
929e1be1606SAleksandar Markovic #if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4)
930e1be1606SAleksandar Markovic #define TARGET_SIOCATMARK      TARGET_IOR('s', 7, int)
931e1be1606SAleksandar Markovic #else
9322521d698Sbellard #define TARGET_SIOCATMARK      0x8905
933e1be1606SAleksandar Markovic #endif
9342521d698Sbellard 
93531e31b8aSbellard /* Networking ioctls */
93631e31b8aSbellard #define TARGET_SIOCADDRT       0x890B          /* add routing table entry */
93731e31b8aSbellard #define TARGET_SIOCDELRT       0x890C          /* delete routing table entry */
93831e31b8aSbellard #define TARGET_SIOCGIFNAME     0x8910          /* get iface name               */
93931e31b8aSbellard #define TARGET_SIOCSIFLINK     0x8911          /* set iface channel            */
94031e31b8aSbellard #define TARGET_SIOCGIFCONF     0x8912          /* get iface list               */
94131e31b8aSbellard #define TARGET_SIOCGIFFLAGS    0x8913          /* get flags                    */
94231e31b8aSbellard #define TARGET_SIOCSIFFLAGS    0x8914          /* set flags                    */
94331e31b8aSbellard #define TARGET_SIOCGIFADDR     0x8915          /* get PA address               */
94431e31b8aSbellard #define TARGET_SIOCSIFADDR     0x8916          /* set PA address               */
94531e31b8aSbellard #define TARGET_SIOCGIFDSTADDR  0x8917          /* get remote PA address        */
94631e31b8aSbellard #define TARGET_SIOCSIFDSTADDR  0x8918          /* set remote PA address        */
94731e31b8aSbellard #define TARGET_SIOCGIFBRDADDR  0x8919          /* get broadcast PA address     */
94831e31b8aSbellard #define TARGET_SIOCSIFBRDADDR  0x891a          /* set broadcast PA address     */
94931e31b8aSbellard #define TARGET_SIOCGIFNETMASK  0x891b          /* get network PA mask          */
95031e31b8aSbellard #define TARGET_SIOCSIFNETMASK  0x891c          /* set network PA mask          */
95131e31b8aSbellard #define TARGET_SIOCGIFMETRIC   0x891d          /* get metric                   */
95231e31b8aSbellard #define TARGET_SIOCSIFMETRIC   0x891e          /* set metric                   */
95331e31b8aSbellard #define TARGET_SIOCGIFMEM      0x891f          /* get memory address (BSD)     */
95431e31b8aSbellard #define TARGET_SIOCSIFMEM      0x8920          /* set memory address (BSD)     */
95531e31b8aSbellard #define TARGET_SIOCGIFMTU      0x8921          /* get MTU size                 */
95631e31b8aSbellard #define TARGET_SIOCSIFMTU      0x8922          /* set MTU size                 */
95731e31b8aSbellard #define TARGET_SIOCSIFHWADDR   0x8924          /* set hardware address (NI)    */
95831e31b8aSbellard #define TARGET_SIOCGIFENCAP    0x8925          /* get/set slip encapsulation   */
95931e31b8aSbellard #define TARGET_SIOCSIFENCAP    0x8926
96031e31b8aSbellard #define TARGET_SIOCGIFHWADDR   0x8927          /* Get hardware address         */
96131e31b8aSbellard #define TARGET_SIOCGIFSLAVE    0x8929          /* Driver slaving support       */
96231e31b8aSbellard #define TARGET_SIOCSIFSLAVE    0x8930
96331e31b8aSbellard #define TARGET_SIOCADDMULTI    0x8931          /* Multicast address lists      */
96431e31b8aSbellard #define TARGET_SIOCDELMULTI    0x8932
965f63eb01aSPaul Burton #define TARGET_SIOCGIFINDEX    0x8933
96631e31b8aSbellard 
96731e31b8aSbellard /* Bridging control calls */
96831e31b8aSbellard #define TARGET_SIOCGIFBR       0x8940          /* Bridging support             */
96931e31b8aSbellard #define TARGET_SIOCSIFBR       0x8941          /* Set bridging options         */
97031e31b8aSbellard 
97131e31b8aSbellard #define TARGET_SIOCGIFTXQLEN   0x8942          /* Get the tx queue length      */
97231e31b8aSbellard #define TARGET_SIOCSIFTXQLEN   0x8943          /* Set the tx queue length      */
97331e31b8aSbellard 
97431e31b8aSbellard /* ARP cache control calls. */
97531e31b8aSbellard #define TARGET_OLD_SIOCDARP    0x8950          /* old delete ARP table entry   */
97631e31b8aSbellard #define TARGET_OLD_SIOCGARP    0x8951          /* old get ARP table entry      */
97731e31b8aSbellard #define TARGET_OLD_SIOCSARP    0x8952          /* old set ARP table entry      */
97831e31b8aSbellard #define TARGET_SIOCDARP        0x8953          /* delete ARP table entry       */
97931e31b8aSbellard #define TARGET_SIOCGARP        0x8954          /* get ARP table entry          */
98031e31b8aSbellard #define TARGET_SIOCSARP        0x8955          /* set ARP table entry          */
98131e31b8aSbellard 
98231e31b8aSbellard /* RARP cache control calls. */
98331e31b8aSbellard #define TARGET_SIOCDRARP       0x8960          /* delete RARP table entry      */
98431e31b8aSbellard #define TARGET_SIOCGRARP       0x8961          /* get RARP table entry         */
98531e31b8aSbellard #define TARGET_SIOCSRARP       0x8962          /* set RARP table entry         */
98631e31b8aSbellard 
98731e31b8aSbellard /* Driver configuration calls */
98831e31b8aSbellard #define TARGET_SIOCGIFMAP      0x8970          /* Get device parameters        */
98931e31b8aSbellard #define TARGET_SIOCSIFMAP      0x8971          /* Set device parameters        */
99031e31b8aSbellard 
99131e31b8aSbellard /* DLCI configuration calls */
99231e31b8aSbellard #define TARGET_SIOCADDDLCI     0x8980          /* Create new DLCI device       */
99331e31b8aSbellard #define TARGET_SIOCDELDLCI     0x8981          /* Delete DLCI device           */
99431e31b8aSbellard 
99586fcd946SLaurent Vivier /* From <linux/wireless.h> */
99686fcd946SLaurent Vivier 
99786fcd946SLaurent Vivier #define TARGET_SIOCGIWNAME     0x8B01          /* get name == wireless protocol */
99831e31b8aSbellard 
99931e31b8aSbellard /* From <linux/fs.h> */
100031e31b8aSbellard 
100131e31b8aSbellard #define TARGET_BLKROSET   TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */
100231e31b8aSbellard #define TARGET_BLKROGET   TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */
100331e31b8aSbellard #define TARGET_BLKRRPART  TARGET_IO(0x12,95) /* re-read partition table */
100431e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */
100531e31b8aSbellard #define TARGET_BLKFLSBUF  TARGET_IO(0x12,97) /* flush buffer cache */
100631e31b8aSbellard #define TARGET_BLKRASET   TARGET_IO(0x12,98) /* Set read ahead for block device */
100731e31b8aSbellard #define TARGET_BLKRAGET   TARGET_IO(0x12,99) /* get current read ahead setting */
100831e31b8aSbellard #define TARGET_BLKFRASET  TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
100931e31b8aSbellard #define TARGET_BLKFRAGET  TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
101031e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
101131e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
101231e31b8aSbellard #define TARGET_BLKSSZGET  TARGET_IO(0x12,104)/* get block device sector size */
1013fff8c539SAndreas Färber #define TARGET_BLKPG      TARGET_IO(0x12,105)/* Partition table and disk geometry handling */
101431e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */
1015c8b0bf54SPeter Maydell #define TARGET_BLKBSZGET  TARGET_IOR(0x12, 112, abi_ulong)
1016c8b0bf54SPeter Maydell #define TARGET_BLKBSZSET  TARGET_IOW(0x12, 113, abi_ulong)
1017edafea13SAlexander Graf #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong)
1018edafea13SAlexander Graf                                              /* return device size in bytes
1019edafea13SAlexander Graf                                                 (u64 *arg) */
10204715856aSPeter Maydell 
10214715856aSPeter Maydell #define TARGET_BLKDISCARD TARGET_IO(0x12, 119)
10224715856aSPeter Maydell #define TARGET_BLKIOMIN TARGET_IO(0x12, 120)
10234715856aSPeter Maydell #define TARGET_BLKIOOPT TARGET_IO(0x12, 121)
10244715856aSPeter Maydell #define TARGET_BLKALIGNOFF TARGET_IO(0x12, 122)
10254715856aSPeter Maydell #define TARGET_BLKPBSZGET TARGET_IO(0x12, 123)
10264715856aSPeter Maydell #define TARGET_BLKDISCARDZEROES TARGET_IO(0x12, 124)
10274715856aSPeter Maydell #define TARGET_BLKSECDISCARD TARGET_IO(0x12, 125)
10284715856aSPeter Maydell #define TARGET_BLKROTATIONAL TARGET_IO(0x12, 126)
10294715856aSPeter Maydell #define TARGET_BLKZEROOUT TARGET_IO(0x12, 127)
10304715856aSPeter Maydell 
103131e31b8aSbellard #define TARGET_FIBMAP     TARGET_IO(0x00,1)  /* bmap access */
103231e31b8aSbellard #define TARGET_FIGETBSZ   TARGET_IO(0x00,2)  /* get the block size used for bmap */
103360807231SPeter Maydell /* Note that the ioctl numbers claim type "long" but the actual type
103460807231SPeter Maydell  * used by the kernel is "int".
103560807231SPeter Maydell  */
103660807231SPeter Maydell #define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, long)
103760807231SPeter Maydell #define TARGET_FS_IOC_SETFLAGS TARGET_IOW('f', 2, long)
103860807231SPeter Maydell 
1039285da2b9SPeter Maydell #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap)
104031e31b8aSbellard 
104131e31b8aSbellard /* cdrom commands */
104231e31b8aSbellard #define TARGET_CDROMPAUSE		0x5301 /* Pause Audio Operation */
104331e31b8aSbellard #define TARGET_CDROMRESUME		0x5302 /* Resume paused Audio Operation */
104431e31b8aSbellard #define TARGET_CDROMPLAYMSF		0x5303 /* Play Audio MSF (struct cdrom_msf) */
104531e31b8aSbellard #define TARGET_CDROMPLAYTRKIND		0x5304 /* Play Audio Track/index
104631e31b8aSbellard                                            (struct cdrom_ti) */
104731e31b8aSbellard #define TARGET_CDROMREADTOCHDR		0x5305 /* Read TOC header
104831e31b8aSbellard                                            (struct cdrom_tochdr) */
104931e31b8aSbellard #define TARGET_CDROMREADTOCENTRY	0x5306 /* Read TOC entry
105031e31b8aSbellard                                            (struct cdrom_tocentry) */
105131e31b8aSbellard #define TARGET_CDROMSTOP		0x5307 /* Stop the cdrom drive */
105231e31b8aSbellard #define TARGET_CDROMSTART		0x5308 /* Start the cdrom drive */
105331e31b8aSbellard #define TARGET_CDROMEJECT		0x5309 /* Ejects the cdrom media */
105431e31b8aSbellard #define TARGET_CDROMVOLCTRL		0x530a /* Control output volume
105531e31b8aSbellard                                            (struct cdrom_volctrl) */
105631e31b8aSbellard #define TARGET_CDROMSUBCHNL		0x530b /* Read subchannel data
105731e31b8aSbellard                                            (struct cdrom_subchnl) */
105831e31b8aSbellard #define TARGET_CDROMREADMODE2		0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes)
105931e31b8aSbellard                                            (struct cdrom_read) */
106031e31b8aSbellard #define TARGET_CDROMREADMODE1		0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes)
106131e31b8aSbellard                                            (struct cdrom_read) */
106231e31b8aSbellard #define TARGET_CDROMREADAUDIO		0x530e /* (struct cdrom_read_audio) */
106331e31b8aSbellard #define TARGET_CDROMEJECT_SW		0x530f /* enable(1)/disable(0) auto-ejecting */
106431e31b8aSbellard #define TARGET_CDROMMULTISESSION	0x5310 /* Obtain the start-of-last-session
106531e31b8aSbellard                                            address of multi session disks
106631e31b8aSbellard                                            (struct cdrom_multisession) */
106731e31b8aSbellard #define TARGET_CDROM_GET_MCN		0x5311 /* Obtain the "Universal Product Code"
106831e31b8aSbellard                                            if available (struct cdrom_mcn) */
106967cc32ebSVeres Lajos #define TARGET_CDROM_GET_UPC		TARGET_CDROM_GET_MCN  /* This one is deprecated,
1070b4916d7bSDong Xu Wang                                           but here anyway for compatibility */
107131e31b8aSbellard #define TARGET_CDROMRESET		0x5312 /* hard-reset the drive */
107231e31b8aSbellard #define TARGET_CDROMVOLREAD		0x5313 /* Get the drive's volume setting
107331e31b8aSbellard                                           (struct cdrom_volctrl) */
107431e31b8aSbellard #define TARGET_CDROMREADRAW		0x5314	/* read data in raw mode (2352 Bytes)
107531e31b8aSbellard                                            (struct cdrom_read) */
107631e31b8aSbellard /*
107731e31b8aSbellard  * These ioctls are used only used in aztcd.c and optcd.c
107831e31b8aSbellard  */
107931e31b8aSbellard #define TARGET_CDROMREADCOOKED		0x5315	/* read data in cooked mode */
108031e31b8aSbellard #define TARGET_CDROMSEEK		0x5316  /* seek msf address */
108131e31b8aSbellard 
108231e31b8aSbellard /*
108331e31b8aSbellard  * This ioctl is only used by the scsi-cd driver.
108431e31b8aSbellard    It is for playing audio in logical block addressing mode.
108531e31b8aSbellard  */
108631e31b8aSbellard #define TARGET_CDROMPLAYBLK		0x5317	/* (struct cdrom_blk) */
108731e31b8aSbellard 
108831e31b8aSbellard /*
108931e31b8aSbellard  * These ioctls are only used in optcd.c
109031e31b8aSbellard  */
109131e31b8aSbellard #define TARGET_CDROMREADALL		0x5318	/* read all 2646 bytes */
109231e31b8aSbellard 
109331e31b8aSbellard /*
109431e31b8aSbellard  * These ioctls are (now) only in ide-cd.c for controlling
109531e31b8aSbellard  * drive spindown time.  They should be implemented in the
109631e31b8aSbellard  * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10,
109731e31b8aSbellard  * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE...
109831e31b8aSbellard  *  -Erik
109931e31b8aSbellard  */
110031e31b8aSbellard #define TARGET_CDROMGETSPINDOWN        0x531d
110131e31b8aSbellard #define TARGET_CDROMSETSPINDOWN        0x531e
110231e31b8aSbellard 
110331e31b8aSbellard /*
110431e31b8aSbellard  * These ioctls are implemented through the uniform CD-ROM driver
110531e31b8aSbellard  * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM
110631e31b8aSbellard  * drivers are eventually ported to the uniform CD-ROM driver interface.
110731e31b8aSbellard  */
110831e31b8aSbellard #define TARGET_CDROMCLOSETRAY		0x5319	/* pendant of CDROMEJECT */
110931e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS	0x5320  /* Set behavior options */
111031e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS	0x5321  /* Clear behavior options */
111131e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED	0x5322  /* Set the CD-ROM speed */
111231e31b8aSbellard #define TARGET_CDROM_SELECT_DISC	0x5323  /* Select disc (for juke-boxes) */
111331e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED	0x5325  /* Check is media changed  */
111431e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS	0x5326  /* Get tray position, etc. */
111531e31b8aSbellard #define TARGET_CDROM_DISC_STATUS	0x5327  /* Get disc type, etc. */
111631e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS    0x5328  /* Get number of slots */
111731e31b8aSbellard #define TARGET_CDROM_LOCKDOOR		0x5329  /* lock or unlock door */
111831e31b8aSbellard #define TARGET_CDROM_DEBUG		0x5330	/* Turn debug messages on/off */
111931e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY	0x5331	/* get capabilities */
112031e31b8aSbellard 
112131e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386.
112231e31b8aSbellard  * Future CDROM ioctls should be kept below 0x537F
112331e31b8aSbellard  */
112431e31b8aSbellard 
112531e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */
112631e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ        0x5382	/* set the audio buffer size */
112731e31b8aSbellard 					/* conflict with SCSI_IOCTL_GET_IDLUN */
112831e31b8aSbellard 
112931e31b8aSbellard /* DVD-ROM Specific ioctls */
113031e31b8aSbellard #define TARGET_DVD_READ_STRUCT		0x5390  /* Read structure */
113131e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT	0x5391  /* Write structure */
113231e31b8aSbellard #define TARGET_DVD_AUTH		0x5392  /* Authentication */
113331e31b8aSbellard 
113431e31b8aSbellard #define TARGET_CDROM_SEND_PACKET	0x5393	/* send a packet to the drive */
113531e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE	0x5394	/* get next writable block */
113631e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN	0x5395	/* get last block written on disc */
113731e31b8aSbellard 
113831e31b8aSbellard /* HD commands */
113931e31b8aSbellard 
114031e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
114131e31b8aSbellard #define TARGET_HDIO_GETGEO            0x0301  /* get device geometry */
114231e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR    0x0302  /* get current unmask setting */
114331e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT     0x0304  /* get current IDE blockmode setting */
114431e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS  0x0308  /* get keep-settings-on-reset flag */
114531e31b8aSbellard #define TARGET_HDIO_GET_32BIT         0x0309  /* get current io_32bit setting */
114631e31b8aSbellard #define TARGET_HDIO_GET_NOWERR        0x030a  /* get ignore-write-error flag */
114731e31b8aSbellard #define TARGET_HDIO_GET_DMA           0x030b  /* get use-dma flag */
11482521d698Sbellard #define TARGET_HDIO_GET_IDENTITY      0x030d  /* get IDE identification info */
114931e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD         0x031f  /* execute a special drive command */
115031e31b8aSbellard 
115131e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
115231e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT     0x0321  /* change IDE blockmode */
115331e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR    0x0322  /* permit other irqs during I/O */
115431e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS  0x0323  /* keep ioctl settings on reset */
115531e31b8aSbellard #define TARGET_HDIO_SET_32BIT         0x0324  /* change io_32bit flags */
115631e31b8aSbellard #define TARGET_HDIO_SET_NOWERR        0x0325  /* change ignore-write-error flag */
115731e31b8aSbellard #define TARGET_HDIO_SET_DMA           0x0326  /* change use-dma flag */
115831e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE      0x0327  /* reconfig interface to new speed */
11592521d698Sbellard 
1160b8005914Sbalrog /* loop ioctls */
1161b8005914Sbalrog #define TARGET_LOOP_SET_FD            0x4C00
1162b8005914Sbalrog #define TARGET_LOOP_CLR_FD            0x4C01
1163b8005914Sbalrog #define TARGET_LOOP_SET_STATUS        0x4C02
1164b8005914Sbalrog #define TARGET_LOOP_GET_STATUS        0x4C03
1165b8005914Sbalrog #define TARGET_LOOP_SET_STATUS64      0x4C04
1166b8005914Sbalrog #define TARGET_LOOP_GET_STATUS64      0x4C05
1167b8005914Sbalrog #define TARGET_LOOP_CHANGE_FD         0x4C06
11682521d698Sbellard 
1169884cdc48SPeter Maydell #define TARGET_LOOP_CTL_ADD           0x4C80
1170884cdc48SPeter Maydell #define TARGET_LOOP_CTL_REMOVE        0x4C81
1171884cdc48SPeter Maydell #define TARGET_LOOP_CTL_GET_FREE      0x4C82
1172884cdc48SPeter Maydell 
1173f7680a55SUlrich Hecht /* fb ioctls */
1174f7680a55SUlrich Hecht #define TARGET_FBIOGET_VSCREENINFO    0x4600
1175f7680a55SUlrich Hecht #define TARGET_FBIOPUT_VSCREENINFO    0x4601
1176f7680a55SUlrich Hecht #define TARGET_FBIOGET_FSCREENINFO    0x4602
117712b81b71SCédric VINCENT #define TARGET_FBIOGETCMAP            0x4604
117812b81b71SCédric VINCENT #define TARGET_FBIOPUTCMAP            0x4605
117912b81b71SCédric VINCENT #define TARGET_FBIOPAN_DISPLAY        0x4606
118012b81b71SCédric VINCENT #define TARGET_FBIOGET_CON2FBMAP      0x460F
118112b81b71SCédric VINCENT #define TARGET_FBIOPUT_CON2FBMAP      0x4610
1182f7680a55SUlrich Hecht 
1183f7680a55SUlrich Hecht /* vt ioctls */
1184f7680a55SUlrich Hecht #define TARGET_VT_OPENQRY             0x5600
1185f7680a55SUlrich Hecht #define TARGET_VT_GETSTATE            0x5603
1186f7680a55SUlrich Hecht #define TARGET_VT_ACTIVATE            0x5606
1187f7680a55SUlrich Hecht #define TARGET_VT_WAITACTIVE          0x5607
1188f7680a55SUlrich Hecht #define TARGET_VT_LOCKSWITCH          0x560b
1189f7680a55SUlrich Hecht #define TARGET_VT_UNLOCKSWITCH        0x560c
1190774750c0SCédric VINCENT #define TARGET_VT_GETMODE             0x5601
1191774750c0SCédric VINCENT #define TARGET_VT_SETMODE             0x5602
1192774750c0SCédric VINCENT #define TARGET_VT_RELDISP             0x5605
1193774750c0SCédric VINCENT #define TARGET_VT_DISALLOCATE         0x5608
1194f7680a55SUlrich Hecht 
119556e904ecSAlexander Graf /* device mapper */
119656e904ecSAlexander Graf #define TARGET_DM_VERSION             TARGET_IOWRU(0xfd, 0x00)
119756e904ecSAlexander Graf #define TARGET_DM_REMOVE_ALL          TARGET_IOWRU(0xfd, 0x01)
119856e904ecSAlexander Graf #define TARGET_DM_LIST_DEVICES        TARGET_IOWRU(0xfd, 0x02)
119956e904ecSAlexander Graf #define TARGET_DM_DEV_CREATE          TARGET_IOWRU(0xfd, 0x03)
120056e904ecSAlexander Graf #define TARGET_DM_DEV_REMOVE          TARGET_IOWRU(0xfd, 0x04)
120156e904ecSAlexander Graf #define TARGET_DM_DEV_RENAME          TARGET_IOWRU(0xfd, 0x05)
120256e904ecSAlexander Graf #define TARGET_DM_DEV_SUSPEND         TARGET_IOWRU(0xfd, 0x06)
120356e904ecSAlexander Graf #define TARGET_DM_DEV_STATUS          TARGET_IOWRU(0xfd, 0x07)
120456e904ecSAlexander Graf #define TARGET_DM_DEV_WAIT            TARGET_IOWRU(0xfd, 0x08)
120556e904ecSAlexander Graf #define TARGET_DM_TABLE_LOAD          TARGET_IOWRU(0xfd, 0x09)
120656e904ecSAlexander Graf #define TARGET_DM_TABLE_CLEAR         TARGET_IOWRU(0xfd, 0x0a)
120756e904ecSAlexander Graf #define TARGET_DM_TABLE_DEPS          TARGET_IOWRU(0xfd, 0x0b)
120856e904ecSAlexander Graf #define TARGET_DM_TABLE_STATUS        TARGET_IOWRU(0xfd, 0x0c)
120956e904ecSAlexander Graf #define TARGET_DM_LIST_VERSIONS       TARGET_IOWRU(0xfd, 0x0d)
121056e904ecSAlexander Graf #define TARGET_DM_TARGET_MSG          TARGET_IOWRU(0xfd, 0x0e)
121156e904ecSAlexander Graf #define TARGET_DM_DEV_SET_GEOMETRY    TARGET_IOWRU(0xfd, 0x0f)
121256e904ecSAlexander Graf 
12132521d698Sbellard /* from asm/termbits.h */
12142521d698Sbellard 
12153bfd9da1Sbellard #define TARGET_NCC 8
12163bfd9da1Sbellard struct target_termio {
12173bfd9da1Sbellard 	unsigned short c_iflag;		/* input mode flags */
12183bfd9da1Sbellard 	unsigned short c_oflag;		/* output mode flags */
12193bfd9da1Sbellard 	unsigned short c_cflag;		/* control mode flags */
12203bfd9da1Sbellard 	unsigned short c_lflag;		/* local mode flags */
12212521d698Sbellard 	unsigned char c_line;		/* line discipline */
12223bfd9da1Sbellard 	unsigned char c_cc[TARGET_NCC];	/* control characters */
12232521d698Sbellard };
12242521d698Sbellard 
12253bfd9da1Sbellard struct target_winsize {
12263bfd9da1Sbellard 	unsigned short ws_row;
12273bfd9da1Sbellard 	unsigned short ws_col;
12283bfd9da1Sbellard 	unsigned short ws_xpixel;
12293bfd9da1Sbellard 	unsigned short ws_ypixel;
12303bfd9da1Sbellard };
12312521d698Sbellard 
12323bfd9da1Sbellard #include "termbits.h"
12332521d698Sbellard 
12349e0b74a4SPaul Brook #if defined(TARGET_MIPS)
12359e0b74a4SPaul Brook #define TARGET_PROT_SEM         0x10
12369e0b74a4SPaul Brook #else
12379e0b74a4SPaul Brook #define TARGET_PROT_SEM         0x08
12389e0b74a4SPaul Brook #endif
12399e0b74a4SPaul Brook 
1240e44a3e79Saurel32 /* Common */
12412521d698Sbellard #define TARGET_MAP_SHARED	0x01		/* Share changes */
12422521d698Sbellard #define TARGET_MAP_PRIVATE	0x02		/* Changes are private */
12432521d698Sbellard #define TARGET_MAP_TYPE		0x0f		/* Mask for type of mapping */
1244e44a3e79Saurel32 
1245e44a3e79Saurel32 /* Target specific */
1246048f6b4dSbellard #if defined(TARGET_MIPS)
1247e44a3e79Saurel32 #define TARGET_MAP_FIXED	0x10		/* Interpret addr exactly */
1248048f6b4dSbellard #define TARGET_MAP_ANONYMOUS	0x0800		/* don't use a file */
1249048f6b4dSbellard #define TARGET_MAP_GROWSDOWN	0x1000		/* stack-like segment */
1250048f6b4dSbellard #define TARGET_MAP_DENYWRITE	0x2000		/* ETXTBSY */
1251048f6b4dSbellard #define TARGET_MAP_EXECUTABLE	0x4000		/* mark it as an executable */
1252048f6b4dSbellard #define TARGET_MAP_LOCKED	0x8000		/* pages are locked */
1253048f6b4dSbellard #define TARGET_MAP_NORESERVE	0x0400		/* don't check for reservations */
1254540635baSths #define TARGET_MAP_POPULATE	0x10000		/* populate (prefault) pagetables */
1255540635baSths #define TARGET_MAP_NONBLOCK	0x20000		/* do not block on IO */
1256e44a3e79Saurel32 #elif defined(TARGET_PPC)
1257e44a3e79Saurel32 #define TARGET_MAP_FIXED	0x10		/* Interpret addr exactly */
12582521d698Sbellard #define TARGET_MAP_ANONYMOUS	0x20		/* don't use a file */
12592521d698Sbellard #define TARGET_MAP_GROWSDOWN	0x0100		/* stack-like segment */
12602521d698Sbellard #define TARGET_MAP_DENYWRITE	0x0800		/* ETXTBSY */
12612521d698Sbellard #define TARGET_MAP_EXECUTABLE	0x1000		/* mark it as an executable */
12627ec93196Sj_mayer #define TARGET_MAP_LOCKED	0x0080		/* pages are locked */
12637ec93196Sj_mayer #define TARGET_MAP_NORESERVE	0x0040		/* don't check for reservations */
1264e44a3e79Saurel32 #define TARGET_MAP_POPULATE	0x8000		/* populate (prefault) pagetables */
1265e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK	0x10000		/* do not block on IO */
1266e44a3e79Saurel32 #elif defined(TARGET_ALPHA)
1267e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS	0x10		/* don't use a file */
1268e44a3e79Saurel32 #define TARGET_MAP_FIXED	0x100		/* Interpret addr exactly */
1269e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN	0x01000		/* stack-like segment */
1270e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE	0x02000		/* ETXTBSY */
1271e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE	0x04000		/* mark it as an executable */
1272e44a3e79Saurel32 #define TARGET_MAP_LOCKED	0x08000		/* lock the mapping */
1273e44a3e79Saurel32 #define TARGET_MAP_NORESERVE	0x10000		/* no check for reservations */
1274e44a3e79Saurel32 #define TARGET_MAP_POPULATE	0x20000		/* pop (prefault) pagetables */
1275e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK	0x40000		/* do not block on IO */
12767ec93196Sj_mayer #else
1277e44a3e79Saurel32 #define TARGET_MAP_FIXED	0x10		/* Interpret addr exactly */
1278e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS	0x20		/* don't use a file */
1279e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN	0x0100		/* stack-like segment */
1280e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE	0x0800		/* ETXTBSY */
1281e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE	0x1000		/* mark it as an executable */
12822521d698Sbellard #define TARGET_MAP_LOCKED	0x2000		/* pages are locked */
12832521d698Sbellard #define TARGET_MAP_NORESERVE	0x4000		/* don't check for reservations */
1284540635baSths #define TARGET_MAP_POPULATE	0x8000		/* populate (prefault) pagetables */
1285540635baSths #define TARGET_MAP_NONBLOCK	0x10000		/* do not block on IO */
1286906c1b8eSMike Frysinger #define TARGET_MAP_UNINITIALIZED 0x4000000	/* for anonymous mmap, memory could be uninitialized */
12877ec93196Sj_mayer #endif
12882521d698Sbellard 
128909701199SAlexander Graf #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \
129009701199SAlexander Graf     || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \
1291c7819dfbSPeter Maydell     || defined(TARGET_CRIS) || defined(TARGET_UNICORE32)
12922521d698Sbellard struct target_stat {
12932521d698Sbellard 	unsigned short st_dev;
12942521d698Sbellard 	unsigned short __pad1;
1295992f48a0Sblueswir1 	abi_ulong st_ino;
12962521d698Sbellard 	unsigned short st_mode;
12972521d698Sbellard 	unsigned short st_nlink;
12982521d698Sbellard 	unsigned short st_uid;
12992521d698Sbellard 	unsigned short st_gid;
13002521d698Sbellard 	unsigned short st_rdev;
13012521d698Sbellard 	unsigned short __pad2;
1302992f48a0Sblueswir1 	abi_ulong  st_size;
1303992f48a0Sblueswir1 	abi_ulong  st_blksize;
1304992f48a0Sblueswir1 	abi_ulong  st_blocks;
1305992f48a0Sblueswir1 	abi_ulong  target_st_atime;
1306992f48a0Sblueswir1 	abi_ulong  __unused1;
1307992f48a0Sblueswir1 	abi_ulong  target_st_mtime;
1308992f48a0Sblueswir1 	abi_ulong  __unused2;
1309992f48a0Sblueswir1 	abi_ulong  target_st_ctime;
1310992f48a0Sblueswir1 	abi_ulong  __unused3;
1311992f48a0Sblueswir1 	abi_ulong  __unused4;
1312992f48a0Sblueswir1 	abi_ulong  __unused5;
13132521d698Sbellard };
13142521d698Sbellard 
13152521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely
13162521d698Sbellard  * insane amounts of padding around dev_t's.
13172521d698Sbellard  */
131820d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64
13192521d698Sbellard struct target_stat64 {
13202521d698Sbellard 	unsigned short	st_dev;
13212521d698Sbellard 	unsigned char	__pad0[10];
13222521d698Sbellard 
13232521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO	1
1324992f48a0Sblueswir1 	abi_ulong	__st_ino;
13252521d698Sbellard 
13262521d698Sbellard 	unsigned int	st_mode;
13272521d698Sbellard 	unsigned int	st_nlink;
13282521d698Sbellard 
1329992f48a0Sblueswir1 	abi_ulong	st_uid;
1330992f48a0Sblueswir1 	abi_ulong	st_gid;
13312521d698Sbellard 
13322521d698Sbellard 	unsigned short	st_rdev;
13332521d698Sbellard 	unsigned char	__pad3[10];
13342521d698Sbellard 
13352521d698Sbellard 	long long	st_size;
1336992f48a0Sblueswir1 	abi_ulong	st_blksize;
13372521d698Sbellard 
1338992f48a0Sblueswir1 	abi_ulong	st_blocks;	/* Number 512-byte blocks allocated. */
1339992f48a0Sblueswir1 	abi_ulong	__pad4;		/* future possible st_blocks high bits */
13402521d698Sbellard 
1341992f48a0Sblueswir1 	abi_ulong	target_st_atime;
1342992f48a0Sblueswir1 	abi_ulong	__pad5;
13432521d698Sbellard 
1344992f48a0Sblueswir1 	abi_ulong	target_st_mtime;
1345992f48a0Sblueswir1 	abi_ulong	__pad6;
13462521d698Sbellard 
1347992f48a0Sblueswir1 	abi_ulong	target_st_ctime;
1348992f48a0Sblueswir1 	abi_ulong	__pad7;		/* will be high 32 bits of ctime someday */
13492521d698Sbellard 
13502521d698Sbellard 	unsigned long long	st_ino;
1351541dc0d4SStefan Weil } QEMU_PACKED;
13522521d698Sbellard 
1353ce4defa0Spbrook #ifdef TARGET_ARM
135420d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64
1355ce4defa0Spbrook struct target_eabi_stat64 {
1356ce4defa0Spbrook         unsigned long long st_dev;
1357ce4defa0Spbrook         unsigned int    __pad1;
1358992f48a0Sblueswir1         abi_ulong    __st_ino;
1359ce4defa0Spbrook         unsigned int    st_mode;
1360ce4defa0Spbrook         unsigned int    st_nlink;
1361ce4defa0Spbrook 
1362992f48a0Sblueswir1         abi_ulong    st_uid;
1363992f48a0Sblueswir1         abi_ulong    st_gid;
1364ce4defa0Spbrook 
1365ce4defa0Spbrook         unsigned long long st_rdev;
1366ce4defa0Spbrook         unsigned int    __pad2[2];
1367ce4defa0Spbrook 
1368ce4defa0Spbrook         long long       st_size;
1369992f48a0Sblueswir1         abi_ulong    st_blksize;
1370ce4defa0Spbrook         unsigned int    __pad3;
1371ce4defa0Spbrook         unsigned long long st_blocks;
1372ce4defa0Spbrook 
1373992f48a0Sblueswir1         abi_ulong    target_st_atime;
1374992f48a0Sblueswir1         abi_ulong    target_st_atime_nsec;
1375ce4defa0Spbrook 
1376992f48a0Sblueswir1         abi_ulong    target_st_mtime;
1377992f48a0Sblueswir1         abi_ulong    target_st_mtime_nsec;
1378ce4defa0Spbrook 
1379992f48a0Sblueswir1         abi_ulong    target_st_ctime;
1380992f48a0Sblueswir1         abi_ulong    target_st_ctime_nsec;
1381ce4defa0Spbrook 
1382ce4defa0Spbrook         unsigned long long st_ino;
1383541dc0d4SStefan Weil } QEMU_PACKED;
1384ce4defa0Spbrook #endif
1385ce4defa0Spbrook 
1386992f48a0Sblueswir1 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
13871b8dd648Sblueswir1 struct target_stat {
13881b8dd648Sblueswir1 	unsigned int	st_dev;
1389992f48a0Sblueswir1 	abi_ulong	st_ino;
13901b8dd648Sblueswir1 	unsigned int	st_mode;
13911b8dd648Sblueswir1 	unsigned int	st_nlink;
13921b8dd648Sblueswir1 	unsigned int	st_uid;
13931b8dd648Sblueswir1 	unsigned int	st_gid;
13941b8dd648Sblueswir1 	unsigned int	st_rdev;
1395992f48a0Sblueswir1 	abi_long	st_size;
1396992f48a0Sblueswir1 	abi_long	target_st_atime;
1397992f48a0Sblueswir1 	abi_long	target_st_mtime;
1398992f48a0Sblueswir1 	abi_long	target_st_ctime;
1399992f48a0Sblueswir1 	abi_long	st_blksize;
1400992f48a0Sblueswir1 	abi_long	st_blocks;
1401992f48a0Sblueswir1 	abi_ulong	__unused4[2];
14021b8dd648Sblueswir1 };
14031b8dd648Sblueswir1 
140420d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64
14051b8dd648Sblueswir1 struct target_stat64 {
14061b8dd648Sblueswir1 	unsigned char	__pad0[6];
14071b8dd648Sblueswir1 	unsigned short	st_dev;
14081b8dd648Sblueswir1 
14091b8dd648Sblueswir1 	uint64_t	st_ino;
14101b8dd648Sblueswir1 	uint64_t	st_nlink;
14111b8dd648Sblueswir1 
14121b8dd648Sblueswir1 	unsigned int	st_mode;
14131b8dd648Sblueswir1 
14141b8dd648Sblueswir1 	unsigned int	st_uid;
14151b8dd648Sblueswir1 	unsigned int	st_gid;
14161b8dd648Sblueswir1 
14171b8dd648Sblueswir1 	unsigned char	__pad2[6];
14181b8dd648Sblueswir1 	unsigned short	st_rdev;
14191b8dd648Sblueswir1 
14201b8dd648Sblueswir1         int64_t		st_size;
14211b8dd648Sblueswir1 	int64_t		st_blksize;
14221b8dd648Sblueswir1 
14231b8dd648Sblueswir1 	unsigned char	__pad4[4];
14241b8dd648Sblueswir1 	unsigned int	st_blocks;
14251b8dd648Sblueswir1 
1426992f48a0Sblueswir1 	abi_ulong	target_st_atime;
1427992f48a0Sblueswir1 	abi_ulong	__unused1;
14281b8dd648Sblueswir1 
1429992f48a0Sblueswir1 	abi_ulong	target_st_mtime;
1430992f48a0Sblueswir1 	abi_ulong	__unused2;
14311b8dd648Sblueswir1 
1432992f48a0Sblueswir1 	abi_ulong	target_st_ctime;
1433992f48a0Sblueswir1 	abi_ulong	__unused3;
14341b8dd648Sblueswir1 
1435992f48a0Sblueswir1 	abi_ulong	__unused4[3];
14361b8dd648Sblueswir1 };
14371b8dd648Sblueswir1 
14383bfd9da1Sbellard #elif defined(TARGET_SPARC)
14393bfd9da1Sbellard 
14403bfd9da1Sbellard struct target_stat {
14413bfd9da1Sbellard 	unsigned short	st_dev;
1442992f48a0Sblueswir1 	abi_ulong	st_ino;
14433bfd9da1Sbellard 	unsigned short	st_mode;
14443bfd9da1Sbellard 	short		st_nlink;
14453bfd9da1Sbellard 	unsigned short	st_uid;
14463bfd9da1Sbellard 	unsigned short	st_gid;
14473bfd9da1Sbellard 	unsigned short	st_rdev;
1448992f48a0Sblueswir1 	abi_long	st_size;
1449992f48a0Sblueswir1 	abi_long	target_st_atime;
1450992f48a0Sblueswir1 	abi_ulong	__unused1;
1451992f48a0Sblueswir1 	abi_long	target_st_mtime;
1452992f48a0Sblueswir1 	abi_ulong	__unused2;
1453992f48a0Sblueswir1 	abi_long	target_st_ctime;
1454992f48a0Sblueswir1 	abi_ulong	__unused3;
1455992f48a0Sblueswir1 	abi_long	st_blksize;
1456992f48a0Sblueswir1 	abi_long	st_blocks;
1457992f48a0Sblueswir1 	abi_ulong	__unused4[2];
14583bfd9da1Sbellard };
14593bfd9da1Sbellard 
146020d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64
14613bfd9da1Sbellard struct target_stat64 {
14623bfd9da1Sbellard 	unsigned char	__pad0[6];
14633bfd9da1Sbellard 	unsigned short	st_dev;
14643bfd9da1Sbellard 
14653bfd9da1Sbellard 	uint64_t st_ino;
14663bfd9da1Sbellard 
14673bfd9da1Sbellard 	unsigned int	st_mode;
14683bfd9da1Sbellard 	unsigned int	st_nlink;
14693bfd9da1Sbellard 
14703bfd9da1Sbellard 	unsigned int	st_uid;
14713bfd9da1Sbellard 	unsigned int	st_gid;
14723bfd9da1Sbellard 
14733bfd9da1Sbellard 	unsigned char	__pad2[6];
14743bfd9da1Sbellard 	unsigned short	st_rdev;
14753bfd9da1Sbellard 
14763bfd9da1Sbellard 	unsigned char	__pad3[8];
14773bfd9da1Sbellard 
14783bfd9da1Sbellard         int64_t	st_size;
14793bfd9da1Sbellard 	unsigned int	st_blksize;
14803bfd9da1Sbellard 
14813bfd9da1Sbellard 	unsigned char	__pad4[8];
14823bfd9da1Sbellard 	unsigned int	st_blocks;
14833bfd9da1Sbellard 
14843bfd9da1Sbellard 	unsigned int	target_st_atime;
14853bfd9da1Sbellard 	unsigned int	__unused1;
14863bfd9da1Sbellard 
14873bfd9da1Sbellard 	unsigned int	target_st_mtime;
14883bfd9da1Sbellard 	unsigned int	__unused2;
14893bfd9da1Sbellard 
14903bfd9da1Sbellard 	unsigned int	target_st_ctime;
14913bfd9da1Sbellard 	unsigned int	__unused3;
14923bfd9da1Sbellard 
14933bfd9da1Sbellard 	unsigned int	__unused4;
14943bfd9da1Sbellard 	unsigned int	__unused5;
14953bfd9da1Sbellard };
14963bfd9da1Sbellard 
149767867308Sbellard #elif defined(TARGET_PPC)
149867867308Sbellard 
149967867308Sbellard struct target_stat {
1500e32448e0Sj_mayer 	abi_ulong st_dev;
1501992f48a0Sblueswir1 	abi_ulong st_ino;
1502325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
1503e32448e0Sj_mayer 	abi_ulong st_nlink;
1504325e651fSj_mayer 	unsigned int st_mode;
1505325e651fSj_mayer #else
150667867308Sbellard 	unsigned int st_mode;
150767867308Sbellard 	unsigned short st_nlink;
1508325e651fSj_mayer #endif
150967867308Sbellard 	unsigned int st_uid;
151067867308Sbellard 	unsigned int st_gid;
1511e32448e0Sj_mayer 	abi_ulong  st_rdev;
1512992f48a0Sblueswir1 	abi_ulong  st_size;
1513992f48a0Sblueswir1 	abi_ulong  st_blksize;
1514992f48a0Sblueswir1 	abi_ulong  st_blocks;
1515992f48a0Sblueswir1 	abi_ulong  target_st_atime;
1516e32448e0Sj_mayer 	abi_ulong  target_st_atime_nsec;
1517992f48a0Sblueswir1 	abi_ulong  target_st_mtime;
1518e32448e0Sj_mayer 	abi_ulong  target_st_mtime_nsec;
1519992f48a0Sblueswir1 	abi_ulong  target_st_ctime;
1520e32448e0Sj_mayer 	abi_ulong  target_st_ctime_nsec;
1521992f48a0Sblueswir1 	abi_ulong  __unused4;
1522992f48a0Sblueswir1 	abi_ulong  __unused5;
1523325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
1524325e651fSj_mayer 	abi_ulong  __unused6;
1525325e651fSj_mayer #endif
152667867308Sbellard };
152767867308Sbellard 
152820d155bcSStefan Weil #if !defined(TARGET_PPC64) || defined(TARGET_ABI32)
152920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64
1530541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 {
153167867308Sbellard 	unsigned long long st_dev;
153267867308Sbellard         unsigned long long st_ino;
153367867308Sbellard 	unsigned int st_mode;
153467867308Sbellard 	unsigned int st_nlink;
153567867308Sbellard 	unsigned int st_uid;
153667867308Sbellard 	unsigned int st_gid;
153767867308Sbellard 	unsigned long long st_rdev;
1538e1ce5e40Saurel32 	unsigned long long __pad0;
153967867308Sbellard 	long long      st_size;
1540e32448e0Sj_mayer 	int	       st_blksize;
1541e1ce5e40Saurel32 	unsigned int   __pad1;
154261322e91SMax Filippov 	long long      st_blocks;	/* Number 512-byte blocks allocated. */
1543e32448e0Sj_mayer 	int	       target_st_atime;
1544e32448e0Sj_mayer         unsigned int   target_st_atime_nsec;
1545e32448e0Sj_mayer 	int	       target_st_mtime;
1546e32448e0Sj_mayer         unsigned int   target_st_mtime_nsec;
1547e32448e0Sj_mayer 	int            target_st_ctime;
1548e32448e0Sj_mayer         unsigned int   target_st_ctime_nsec;
1549e32448e0Sj_mayer         unsigned int   __unused4;
1550e32448e0Sj_mayer         unsigned int   __unused5;
155167867308Sbellard };
155220d155bcSStefan Weil #endif
155367867308Sbellard 
1554b779e29eSEdgar E. Iglesias #elif defined(TARGET_MICROBLAZE)
1555b779e29eSEdgar E. Iglesias 
1556b779e29eSEdgar E. Iglesias struct target_stat {
1557b779e29eSEdgar E. Iglesias 	abi_ulong st_dev;
1558b779e29eSEdgar E. Iglesias 	abi_ulong st_ino;
1559b779e29eSEdgar E. Iglesias 	unsigned int st_mode;
1560b779e29eSEdgar E. Iglesias 	unsigned short st_nlink;
1561b779e29eSEdgar E. Iglesias 	unsigned int st_uid;
1562b779e29eSEdgar E. Iglesias 	unsigned int st_gid;
1563b779e29eSEdgar E. Iglesias 	abi_ulong  st_rdev;
1564b779e29eSEdgar E. Iglesias 	abi_ulong  st_size;
1565b779e29eSEdgar E. Iglesias 	abi_ulong  st_blksize;
1566b779e29eSEdgar E. Iglesias 	abi_ulong  st_blocks;
1567b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_atime;
1568b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_atime_nsec;
1569b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_mtime;
1570b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_mtime_nsec;
1571b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_ctime;
1572b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_ctime_nsec;
1573b779e29eSEdgar E. Iglesias 	abi_ulong  __unused4;
1574b779e29eSEdgar E. Iglesias 	abi_ulong  __unused5;
1575b779e29eSEdgar E. Iglesias };
1576b779e29eSEdgar E. Iglesias 
1577b779e29eSEdgar E. Iglesias /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout...  */
157820d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64
1579541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 {
1580b779e29eSEdgar E. Iglesias 	uint64_t st_dev;
1581a523eb06SEdgar E. Iglesias #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
1582a523eb06SEdgar E. Iglesias 	uint32_t pad0;
1583a523eb06SEdgar E. Iglesias 	uint32_t __st_ino;
1584a523eb06SEdgar E. Iglesias 
1585b779e29eSEdgar E. Iglesias 	uint32_t st_mode;
1586b779e29eSEdgar E. Iglesias 	uint32_t st_nlink;
1587b779e29eSEdgar E. Iglesias 	uint32_t st_uid;
1588b779e29eSEdgar E. Iglesias 	uint32_t st_gid;
1589b779e29eSEdgar E. Iglesias 	uint64_t st_rdev;
159021ebeb23SEdgar E. Iglesias 	uint64_t __pad1;
1591b779e29eSEdgar E. Iglesias 
1592b779e29eSEdgar E. Iglesias 	int64_t  st_size;
1593b779e29eSEdgar E. Iglesias 	int32_t  st_blksize;
159421ebeb23SEdgar E. Iglesias 	uint32_t __pad2;
1595b779e29eSEdgar E. Iglesias 	int64_t st_blocks;	/* Number 512-byte blocks allocated. */
1596b779e29eSEdgar E. Iglesias 
1597b779e29eSEdgar E. Iglesias 	int	       target_st_atime;
1598b779e29eSEdgar E. Iglesias 	unsigned int   target_st_atime_nsec;
1599b779e29eSEdgar E. Iglesias 	int	       target_st_mtime;
1600b779e29eSEdgar E. Iglesias 	unsigned int   target_st_mtime_nsec;
1601b779e29eSEdgar E. Iglesias 	int            target_st_ctime;
1602b779e29eSEdgar E. Iglesias 	unsigned int   target_st_ctime_nsec;
1603a523eb06SEdgar E. Iglesias 	uint64_t st_ino;
1604b779e29eSEdgar E. Iglesias };
1605b779e29eSEdgar E. Iglesias 
1606e6e5906bSpbrook #elif defined(TARGET_M68K)
1607e6e5906bSpbrook 
1608e6e5906bSpbrook struct target_stat {
1609e6e5906bSpbrook 	unsigned short st_dev;
1610e6e5906bSpbrook 	unsigned short __pad1;
1611992f48a0Sblueswir1 	abi_ulong st_ino;
1612e6e5906bSpbrook 	unsigned short st_mode;
1613e6e5906bSpbrook 	unsigned short st_nlink;
1614e6e5906bSpbrook 	unsigned short st_uid;
1615e6e5906bSpbrook 	unsigned short st_gid;
1616e6e5906bSpbrook 	unsigned short st_rdev;
1617e6e5906bSpbrook 	unsigned short __pad2;
1618992f48a0Sblueswir1 	abi_ulong  st_size;
1619992f48a0Sblueswir1 	abi_ulong  st_blksize;
1620992f48a0Sblueswir1 	abi_ulong  st_blocks;
1621992f48a0Sblueswir1 	abi_ulong  target_st_atime;
1622992f48a0Sblueswir1 	abi_ulong  __unused1;
1623992f48a0Sblueswir1 	abi_ulong  target_st_mtime;
1624992f48a0Sblueswir1 	abi_ulong  __unused2;
1625992f48a0Sblueswir1 	abi_ulong  target_st_ctime;
1626992f48a0Sblueswir1 	abi_ulong  __unused3;
1627992f48a0Sblueswir1 	abi_ulong  __unused4;
1628992f48a0Sblueswir1 	abi_ulong  __unused5;
1629e6e5906bSpbrook };
1630e6e5906bSpbrook 
1631e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely
1632e6e5906bSpbrook  * insane amounts of padding around dev_t's.
1633e6e5906bSpbrook  */
163420d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64
1635e6e5906bSpbrook struct target_stat64 {
1636e6e5906bSpbrook 	unsigned long long	st_dev;
1637e6e5906bSpbrook 	unsigned char	__pad1[2];
1638e6e5906bSpbrook 
1639e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO	1
1640992f48a0Sblueswir1 	abi_ulong	__st_ino;
1641e6e5906bSpbrook 
1642e6e5906bSpbrook 	unsigned int	st_mode;
1643e6e5906bSpbrook 	unsigned int	st_nlink;
1644e6e5906bSpbrook 
1645992f48a0Sblueswir1 	abi_ulong	st_uid;
1646992f48a0Sblueswir1 	abi_ulong	st_gid;
1647e6e5906bSpbrook 
1648e6e5906bSpbrook 	unsigned long long	st_rdev;
1649e6e5906bSpbrook 	unsigned char	__pad3[2];
1650e6e5906bSpbrook 
1651e6e5906bSpbrook 	long long	st_size;
1652992f48a0Sblueswir1 	abi_ulong	st_blksize;
1653e6e5906bSpbrook 
1654992f48a0Sblueswir1 	abi_ulong	__pad4;		/* future possible st_blocks high bits */
1655992f48a0Sblueswir1 	abi_ulong	st_blocks;	/* Number 512-byte blocks allocated. */
1656e6e5906bSpbrook 
1657992f48a0Sblueswir1 	abi_ulong	target_st_atime;
1658992f48a0Sblueswir1 	abi_ulong	target_st_atime_nsec;
1659e6e5906bSpbrook 
1660992f48a0Sblueswir1 	abi_ulong	target_st_mtime;
1661992f48a0Sblueswir1 	abi_ulong	target_st_mtime_nsec;
1662e6e5906bSpbrook 
1663992f48a0Sblueswir1 	abi_ulong	target_st_ctime;
1664992f48a0Sblueswir1 	abi_ulong	target_st_ctime_nsec;
1665e6e5906bSpbrook 
1666e6e5906bSpbrook 	unsigned long long	st_ino;
1667541dc0d4SStefan Weil } QEMU_PACKED;
1668e6e5906bSpbrook 
1669d26bc211Sths #elif defined(TARGET_ABI_MIPSN64)
1670540635baSths 
1671540635baSths /* The memory layout is the same as of struct stat64 of the 32-bit kernel.  */
1672540635baSths struct target_stat {
1673540635baSths 	unsigned int		st_dev;
1674540635baSths 	unsigned int		st_pad0[3]; /* Reserved for st_dev expansion */
1675540635baSths 
1676992f48a0Sblueswir1 	abi_ulong		st_ino;
1677540635baSths 
1678540635baSths 	unsigned int		st_mode;
1679540635baSths 	unsigned int		st_nlink;
1680540635baSths 
1681540635baSths 	int			st_uid;
1682540635baSths 	int			st_gid;
1683540635baSths 
1684540635baSths 	unsigned int		st_rdev;
1685540635baSths 	unsigned int		st_pad1[3]; /* Reserved for st_rdev expansion */
1686540635baSths 
1687992f48a0Sblueswir1 	abi_ulong		st_size;
1688540635baSths 
1689540635baSths 	/*
1690540635baSths 	 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1691540635baSths 	 * but we don't have it under Linux.
1692540635baSths 	 */
1693540635baSths 	unsigned int		target_st_atime;
1694540635baSths 	unsigned int		target_st_atime_nsec;
1695540635baSths 
1696540635baSths 	unsigned int		target_st_mtime;
1697540635baSths 	unsigned int		target_st_mtime_nsec;
1698540635baSths 
1699540635baSths 	unsigned int		target_st_ctime;
1700540635baSths 	unsigned int		target_st_ctime_nsec;
1701540635baSths 
1702540635baSths 	unsigned int		st_blksize;
1703540635baSths 	unsigned int		st_pad2;
1704540635baSths 
1705992f48a0Sblueswir1 	abi_ulong		st_blocks;
1706540635baSths };
1707540635baSths 
1708d26bc211Sths #elif defined(TARGET_ABI_MIPSN32)
1709540635baSths 
1710540635baSths struct target_stat {
17111ab2aea2SLeon Alrae         abi_ulong    st_dev;
17121ab2aea2SLeon Alrae         abi_ulong    st_pad0[3]; /* Reserved for st_dev expansion */
17131ab2aea2SLeon Alrae         uint64_t     st_ino;
1714540635baSths         unsigned int st_mode;
1715540635baSths         unsigned int st_nlink;
1716540635baSths         int          st_uid;
1717540635baSths         int          st_gid;
17181ab2aea2SLeon Alrae         abi_ulong    st_rdev;
17191ab2aea2SLeon Alrae         abi_ulong    st_pad1[3]; /* Reserved for st_rdev expansion */
17201ab2aea2SLeon Alrae         int64_t      st_size;
17211ab2aea2SLeon Alrae         abi_long     target_st_atime;
17221ab2aea2SLeon Alrae         abi_ulong    target_st_atime_nsec; /* Reserved for st_atime expansion */
17231ab2aea2SLeon Alrae         abi_long     target_st_mtime;
17241ab2aea2SLeon Alrae         abi_ulong    target_st_mtime_nsec; /* Reserved for st_mtime expansion */
17251ab2aea2SLeon Alrae         abi_long     target_st_ctime;
17261ab2aea2SLeon Alrae         abi_ulong    target_st_ctime_nsec; /* Reserved for st_ctime expansion */
17271ab2aea2SLeon Alrae         abi_ulong    st_blksize;
17281ab2aea2SLeon Alrae         abi_ulong    st_pad2;
17291ab2aea2SLeon Alrae         int64_t      st_blocks;
1730540635baSths };
1731540635baSths 
1732d26bc211Sths #elif defined(TARGET_ABI_MIPSO32)
1733048f6b4dSbellard 
1734048f6b4dSbellard struct target_stat {
1735048f6b4dSbellard 	unsigned	st_dev;
1736992f48a0Sblueswir1 	abi_long	st_pad1[3];		/* Reserved for network id */
1737992f48a0Sblueswir1 	abi_ulong	st_ino;
1738048f6b4dSbellard 	unsigned int	st_mode;
1739048f6b4dSbellard 	unsigned int	st_nlink;
1740048f6b4dSbellard 	int		st_uid;
1741048f6b4dSbellard 	int		st_gid;
1742048f6b4dSbellard 	unsigned 	st_rdev;
1743992f48a0Sblueswir1 	abi_long	st_pad2[2];
1744992f48a0Sblueswir1 	abi_long	st_size;
1745992f48a0Sblueswir1 	abi_long	st_pad3;
1746048f6b4dSbellard 	/*
1747048f6b4dSbellard 	 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1748048f6b4dSbellard 	 * but we don't have it under Linux.
1749048f6b4dSbellard 	 */
1750992f48a0Sblueswir1 	abi_long		target_st_atime;
1751992f48a0Sblueswir1 	abi_long		target_st_atime_nsec;
1752992f48a0Sblueswir1 	abi_long		target_st_mtime;
1753992f48a0Sblueswir1 	abi_long		target_st_mtime_nsec;
1754992f48a0Sblueswir1 	abi_long		target_st_ctime;
1755992f48a0Sblueswir1 	abi_long		target_st_ctime_nsec;
1756992f48a0Sblueswir1 	abi_long		st_blksize;
1757992f48a0Sblueswir1 	abi_long		st_blocks;
1758992f48a0Sblueswir1 	abi_long		st_pad4[14];
1759048f6b4dSbellard };
1760048f6b4dSbellard 
1761048f6b4dSbellard /*
1762048f6b4dSbellard  * This matches struct stat64 in glibc2.1, hence the absolutely insane
1763048f6b4dSbellard  * amounts of padding around dev_t's.  The memory layout is the same as of
1764048f6b4dSbellard  * struct stat of the 64-bit kernel.
1765048f6b4dSbellard  */
1766048f6b4dSbellard 
176720d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64
1768048f6b4dSbellard struct target_stat64 {
1769992f48a0Sblueswir1 	abi_ulong	st_dev;
1770992f48a0Sblueswir1 	abi_ulong	st_pad0[3];	/* Reserved for st_dev expansion  */
1771048f6b4dSbellard 
1772048f6b4dSbellard 	uint64_t	st_ino;
1773048f6b4dSbellard 
1774048f6b4dSbellard         unsigned int	st_mode;
1775048f6b4dSbellard         unsigned int	st_nlink;
1776048f6b4dSbellard 
1777048f6b4dSbellard 	int		st_uid;
1778048f6b4dSbellard 	int		st_gid;
1779048f6b4dSbellard 
1780992f48a0Sblueswir1 	abi_ulong	st_rdev;
1781992f48a0Sblueswir1 	abi_ulong	st_pad1[3];	/* Reserved for st_rdev expansion  */
1782048f6b4dSbellard 
1783048f6b4dSbellard 	int64_t 	st_size;
1784048f6b4dSbellard 
1785048f6b4dSbellard 	/*
1786048f6b4dSbellard 	 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1787048f6b4dSbellard 	 * but we don't have it under Linux.
1788048f6b4dSbellard 	 */
1789992f48a0Sblueswir1 	abi_long	target_st_atime;
1790992f48a0Sblueswir1 	abi_ulong	target_st_atime_nsec;	/* Reserved for st_atime expansion  */
1791048f6b4dSbellard 
1792992f48a0Sblueswir1 	abi_long	target_st_mtime;
1793992f48a0Sblueswir1 	abi_ulong	target_st_mtime_nsec;	/* Reserved for st_mtime expansion  */
1794048f6b4dSbellard 
1795992f48a0Sblueswir1 	abi_long	target_st_ctime;
1796992f48a0Sblueswir1 	abi_ulong	target_st_ctime_nsec;	/* Reserved for st_ctime expansion  */
1797048f6b4dSbellard 
1798992f48a0Sblueswir1 	abi_ulong	st_blksize;
1799992f48a0Sblueswir1 	abi_ulong	st_pad2;
1800048f6b4dSbellard 
1801048f6b4dSbellard 	int64_t  	st_blocks;
1802048f6b4dSbellard };
18037a3148a9Sj_mayer 
18047a3148a9Sj_mayer #elif defined(TARGET_ALPHA)
18057a3148a9Sj_mayer 
18067a3148a9Sj_mayer struct target_stat {
18077a3148a9Sj_mayer        unsigned int    st_dev;
18087a3148a9Sj_mayer        unsigned int    st_ino;
18097a3148a9Sj_mayer        unsigned int    st_mode;
18107a3148a9Sj_mayer        unsigned int    st_nlink;
18117a3148a9Sj_mayer        unsigned int    st_uid;
18127a3148a9Sj_mayer        unsigned int    st_gid;
18137a3148a9Sj_mayer        unsigned int    st_rdev;
1814992f48a0Sblueswir1        abi_long     st_size;
1815992f48a0Sblueswir1        abi_ulong    target_st_atime;
1816992f48a0Sblueswir1        abi_ulong    target_st_mtime;
1817992f48a0Sblueswir1        abi_ulong    target_st_ctime;
18187a3148a9Sj_mayer        unsigned int    st_blksize;
18197a3148a9Sj_mayer        unsigned int    st_blocks;
18207a3148a9Sj_mayer        unsigned int    st_flags;
18217a3148a9Sj_mayer        unsigned int    st_gen;
18227a3148a9Sj_mayer };
18237a3148a9Sj_mayer 
182420d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64
18257a3148a9Sj_mayer struct target_stat64 {
1826992f48a0Sblueswir1        abi_ulong    st_dev;
1827992f48a0Sblueswir1        abi_ulong    st_ino;
1828992f48a0Sblueswir1        abi_ulong    st_rdev;
1829992f48a0Sblueswir1        abi_long     st_size;
1830992f48a0Sblueswir1        abi_ulong    st_blocks;
18317a3148a9Sj_mayer 
18327a3148a9Sj_mayer        unsigned int    st_mode;
18337a3148a9Sj_mayer        unsigned int    st_uid;
18347a3148a9Sj_mayer        unsigned int    st_gid;
18357a3148a9Sj_mayer        unsigned int    st_blksize;
18367a3148a9Sj_mayer        unsigned int    st_nlink;
18377a3148a9Sj_mayer        unsigned int    __pad0;
18387a3148a9Sj_mayer 
1839992f48a0Sblueswir1        abi_ulong    target_st_atime;
1840992f48a0Sblueswir1        abi_ulong    target_st_atime_nsec;
1841992f48a0Sblueswir1        abi_ulong    target_st_mtime;
1842992f48a0Sblueswir1        abi_ulong    target_st_mtime_nsec;
1843992f48a0Sblueswir1        abi_ulong    target_st_ctime;
1844992f48a0Sblueswir1        abi_ulong    target_st_ctime_nsec;
1845992f48a0Sblueswir1        abi_long     __unused[3];
18467a3148a9Sj_mayer };
18477a3148a9Sj_mayer 
18486db45e65Sths #elif defined(TARGET_SH4)
18496db45e65Sths 
18506db45e65Sths struct target_stat {
1851992f48a0Sblueswir1 	abi_ulong  st_dev;
1852992f48a0Sblueswir1 	abi_ulong  st_ino;
18536db45e65Sths 	unsigned short st_mode;
18546db45e65Sths 	unsigned short st_nlink;
18556db45e65Sths 	unsigned short st_uid;
18566db45e65Sths 	unsigned short st_gid;
1857992f48a0Sblueswir1 	abi_ulong  st_rdev;
1858992f48a0Sblueswir1 	abi_ulong  st_size;
1859992f48a0Sblueswir1 	abi_ulong  st_blksize;
1860992f48a0Sblueswir1 	abi_ulong  st_blocks;
1861992f48a0Sblueswir1 	abi_ulong  target_st_atime;
1862992f48a0Sblueswir1 	abi_ulong  target_st_atime_nsec;
1863992f48a0Sblueswir1 	abi_ulong  target_st_mtime;
1864992f48a0Sblueswir1 	abi_ulong  target_st_mtime_nsec;
1865992f48a0Sblueswir1 	abi_ulong  target_st_ctime;
1866992f48a0Sblueswir1 	abi_ulong  target_st_ctime_nsec;
1867992f48a0Sblueswir1 	abi_ulong  __unused4;
1868992f48a0Sblueswir1 	abi_ulong  __unused5;
18696db45e65Sths };
18706db45e65Sths 
18716db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely
18726db45e65Sths  * insane amounts of padding around dev_t's.
18736db45e65Sths  */
187420d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64
1875541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 {
18766db45e65Sths 	unsigned long long	st_dev;
18776db45e65Sths 	unsigned char	__pad0[4];
18786db45e65Sths 
18796db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO	1
1880992f48a0Sblueswir1 	abi_ulong	__st_ino;
18816db45e65Sths 
18826db45e65Sths 	unsigned int	st_mode;
18836db45e65Sths 	unsigned int	st_nlink;
18846db45e65Sths 
1885992f48a0Sblueswir1 	abi_ulong	st_uid;
1886992f48a0Sblueswir1 	abi_ulong	st_gid;
18876db45e65Sths 
18886db45e65Sths 	unsigned long long	st_rdev;
18896db45e65Sths 	unsigned char	__pad3[4];
18906db45e65Sths 
18916db45e65Sths 	long long	st_size;
1892992f48a0Sblueswir1 	abi_ulong	st_blksize;
18936db45e65Sths 
18946db45e65Sths 	unsigned long long	st_blocks;	/* Number 512-byte blocks allocated. */
18956db45e65Sths 
1896992f48a0Sblueswir1 	abi_ulong	target_st_atime;
1897992f48a0Sblueswir1 	abi_ulong	target_st_atime_nsec;
18986db45e65Sths 
1899992f48a0Sblueswir1 	abi_ulong	target_st_mtime;
1900992f48a0Sblueswir1 	abi_ulong	target_st_mtime_nsec;
19016db45e65Sths 
1902992f48a0Sblueswir1 	abi_ulong	target_st_ctime;
1903992f48a0Sblueswir1 	abi_ulong	target_st_ctime_nsec;
19046db45e65Sths 
19056db45e65Sths 	unsigned long long	st_ino;
19066db45e65Sths };
19076db45e65Sths 
1908d2fd1af7Sbellard #elif defined(TARGET_I386) && !defined(TARGET_ABI32)
1909d2fd1af7Sbellard struct target_stat {
1910d2fd1af7Sbellard 	abi_ulong	st_dev;
1911d2fd1af7Sbellard 	abi_ulong	st_ino;
1912d2fd1af7Sbellard 	abi_ulong	st_nlink;
1913d2fd1af7Sbellard 
1914d2fd1af7Sbellard 	unsigned int	st_mode;
1915d2fd1af7Sbellard 	unsigned int	st_uid;
1916d2fd1af7Sbellard 	unsigned int	st_gid;
1917d2fd1af7Sbellard 	unsigned int	__pad0;
1918d2fd1af7Sbellard 	abi_ulong	st_rdev;
1919d2fd1af7Sbellard 	abi_long	st_size;
1920d2fd1af7Sbellard 	abi_long	st_blksize;
1921d2fd1af7Sbellard     	abi_long	st_blocks;	/* Number 512-byte blocks allocated. */
1922d2fd1af7Sbellard 
1923d2fd1af7Sbellard 	abi_ulong	target_st_atime;
1924d2fd1af7Sbellard 	abi_ulong 	target_st_atime_nsec;
1925d2fd1af7Sbellard 	abi_ulong	target_st_mtime;
1926d2fd1af7Sbellard 	abi_ulong	target_st_mtime_nsec;
1927d2fd1af7Sbellard 	abi_ulong	target_st_ctime;
1928d2fd1af7Sbellard 	abi_ulong       target_st_ctime_nsec;
1929d2fd1af7Sbellard 
1930d2fd1af7Sbellard   	abi_long	__unused[3];
1931d2fd1af7Sbellard };
1932a4c075f1SUlrich Hecht #elif defined(TARGET_S390X)
1933a4c075f1SUlrich Hecht struct target_stat {
1934a4c075f1SUlrich Hecht     abi_ulong  st_dev;
1935a4c075f1SUlrich Hecht     abi_ulong  st_ino;
1936a4c075f1SUlrich Hecht     abi_ulong  st_nlink;
1937a4c075f1SUlrich Hecht     unsigned int   st_mode;
1938a4c075f1SUlrich Hecht     unsigned int   st_uid;
1939a4c075f1SUlrich Hecht     unsigned int   st_gid;
1940a4c075f1SUlrich Hecht     unsigned int   __pad1;
1941a4c075f1SUlrich Hecht     abi_ulong  st_rdev;
1942a4c075f1SUlrich Hecht     abi_ulong  st_size;
1943a4c075f1SUlrich Hecht     abi_ulong  target_st_atime;
1944a4c075f1SUlrich Hecht     abi_ulong  target_st_atime_nsec;
1945a4c075f1SUlrich Hecht     abi_ulong  target_st_mtime;
1946a4c075f1SUlrich Hecht     abi_ulong  target_st_mtime_nsec;
1947a4c075f1SUlrich Hecht     abi_ulong  target_st_ctime;
1948a4c075f1SUlrich Hecht     abi_ulong  target_st_ctime_nsec;
1949a4c075f1SUlrich Hecht     abi_ulong  st_blksize;
1950a4c075f1SUlrich Hecht     abi_long       st_blocks;
1951a4c075f1SUlrich Hecht     abi_ulong  __unused[3];
1952a4c075f1SUlrich Hecht };
195309701199SAlexander Graf #elif defined(TARGET_AARCH64)
195409701199SAlexander Graf struct target_stat {
195509701199SAlexander Graf     abi_ulong  st_dev;
195609701199SAlexander Graf     abi_ulong  st_ino;
195709701199SAlexander Graf     unsigned int st_mode;
195809701199SAlexander Graf     unsigned int st_nlink;
195909701199SAlexander Graf     unsigned int   st_uid;
196009701199SAlexander Graf     unsigned int   st_gid;
196109701199SAlexander Graf     abi_ulong  st_rdev;
196209701199SAlexander Graf     abi_ulong  _pad1;
196309701199SAlexander Graf     abi_long  st_size;
196409701199SAlexander Graf     int        st_blksize;
196509701199SAlexander Graf     int        __pad2;
196609701199SAlexander Graf     abi_long   st_blocks;
196709701199SAlexander Graf     abi_long  target_st_atime;
196809701199SAlexander Graf     abi_ulong  target_st_atime_nsec;
196909701199SAlexander Graf     abi_long  target_st_mtime;
197009701199SAlexander Graf     abi_ulong  target_st_mtime_nsec;
197109701199SAlexander Graf     abi_long  target_st_ctime;
197209701199SAlexander Graf     abi_ulong  target_st_ctime_nsec;
197309701199SAlexander Graf     unsigned int __unused[2];
197409701199SAlexander Graf };
1975b16189b2SChen Gang #elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX)
1976c7819dfbSPeter Maydell 
1977c7819dfbSPeter Maydell /* These are the asm-generic versions of the stat and stat64 structures */
1978c7819dfbSPeter Maydell 
1979d962783eSJia Liu struct target_stat {
1980d962783eSJia Liu     abi_ulong st_dev;
1981d962783eSJia Liu     abi_ulong st_ino;
1982d962783eSJia Liu     unsigned int st_mode;
1983c7819dfbSPeter Maydell     unsigned int st_nlink;
1984d962783eSJia Liu     unsigned int st_uid;
1985d962783eSJia Liu     unsigned int st_gid;
1986d962783eSJia Liu     abi_ulong st_rdev;
1987c7819dfbSPeter Maydell     abi_ulong __pad1;
1988d962783eSJia Liu     abi_long st_size;
1989c7819dfbSPeter Maydell     int st_blksize;
1990c7819dfbSPeter Maydell     int __pad2;
1991c7819dfbSPeter Maydell     abi_long st_blocks;
1992c7819dfbSPeter Maydell     abi_long target_st_atime;
1993d962783eSJia Liu     abi_ulong target_st_atime_nsec;
1994c7819dfbSPeter Maydell     abi_long target_st_mtime;
1995d962783eSJia Liu     abi_ulong target_st_mtime_nsec;
1996c7819dfbSPeter Maydell     abi_long target_st_ctime;
1997d962783eSJia Liu     abi_ulong target_st_ctime_nsec;
1998c7819dfbSPeter Maydell     unsigned int __unused4;
1999c7819dfbSPeter Maydell     unsigned int __unused5;
2000d962783eSJia Liu };
2001c7819dfbSPeter Maydell 
200220d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64
2003c7819dfbSPeter Maydell struct target_stat64 {
2004c7819dfbSPeter Maydell     uint64_t st_dev;
2005c7819dfbSPeter Maydell     uint64_t st_ino;
2006c7819dfbSPeter Maydell     unsigned int st_mode;
2007c7819dfbSPeter Maydell     unsigned int st_nlink;
2008c7819dfbSPeter Maydell     unsigned int st_uid;
2009c7819dfbSPeter Maydell     unsigned int st_gid;
2010c7819dfbSPeter Maydell     uint64_t st_rdev;
2011c7819dfbSPeter Maydell     uint64_t __pad1;
2012c7819dfbSPeter Maydell     int64_t st_size;
2013c7819dfbSPeter Maydell     int st_blksize;
2014c7819dfbSPeter Maydell     int __pad2;
2015c7819dfbSPeter Maydell     int64_t st_blocks;
2016c7819dfbSPeter Maydell     int target_st_atime;
2017c7819dfbSPeter Maydell     unsigned int target_st_atime_nsec;
2018c7819dfbSPeter Maydell     int target_st_mtime;
2019c7819dfbSPeter Maydell     unsigned int target_st_mtime_nsec;
2020c7819dfbSPeter Maydell     int target_st_ctime;
2021c7819dfbSPeter Maydell     unsigned int target_st_ctime_nsec;
2022c7819dfbSPeter Maydell     unsigned int __unused4;
2023c7819dfbSPeter Maydell     unsigned int __unused5;
2024c7819dfbSPeter Maydell };
2025c7819dfbSPeter Maydell 
2026048f6b4dSbellard #else
2027048f6b4dSbellard #error unsupported CPU
2028048f6b4dSbellard #endif
20292521d698Sbellard 
20304ce6f8deSths typedef struct {
20314ce6f8deSths         int     val[2];
2032c227f099SAnthony Liguori } target_fsid_t;
20334ce6f8deSths 
203456c8f68fSbellard #ifdef TARGET_MIPS
2035d26bc211Sths #ifdef TARGET_ABI_MIPSN32
2036540635baSths struct target_statfs {
2037540635baSths 	int32_t			f_type;
2038540635baSths 	int32_t			f_bsize;
2039540635baSths 	int32_t			f_frsize;	/* Fragment size - unsupported */
2040540635baSths 	int32_t			f_blocks;
2041540635baSths 	int32_t			f_bfree;
2042540635baSths 	int32_t			f_files;
2043540635baSths 	int32_t			f_ffree;
2044540635baSths 	int32_t			f_bavail;
2045540635baSths 
2046540635baSths 	/* Linux specials */
2047c227f099SAnthony Liguori 	target_fsid_t		f_fsid;
2048540635baSths 	int32_t			f_namelen;
2049540635baSths 	int32_t			f_spare[6];
2050540635baSths };
2051540635baSths #else
205256c8f68fSbellard struct target_statfs {
2053992f48a0Sblueswir1 	abi_long		f_type;
2054992f48a0Sblueswir1 	abi_long		f_bsize;
2055992f48a0Sblueswir1 	abi_long		f_frsize;	/* Fragment size - unsupported */
2056992f48a0Sblueswir1 	abi_long		f_blocks;
2057992f48a0Sblueswir1 	abi_long		f_bfree;
2058992f48a0Sblueswir1 	abi_long		f_files;
2059992f48a0Sblueswir1 	abi_long		f_ffree;
2060992f48a0Sblueswir1 	abi_long		f_bavail;
206156c8f68fSbellard 
206256c8f68fSbellard 	/* Linux specials */
2063c227f099SAnthony Liguori 	target_fsid_t		f_fsid;
2064992f48a0Sblueswir1 	abi_long		f_namelen;
2065992f48a0Sblueswir1 	abi_long		f_spare[6];
206656c8f68fSbellard };
2067540635baSths #endif
206856c8f68fSbellard 
206956c8f68fSbellard struct target_statfs64 {
207056c8f68fSbellard 	uint32_t	f_type;
207156c8f68fSbellard 	uint32_t	f_bsize;
207256c8f68fSbellard 	uint32_t	f_frsize;	/* Fragment size - unsupported */
207356c8f68fSbellard 	uint32_t	__pad;
207456c8f68fSbellard 	uint64_t	f_blocks;
207556c8f68fSbellard 	uint64_t	f_bfree;
207656c8f68fSbellard 	uint64_t	f_files;
207756c8f68fSbellard 	uint64_t	f_ffree;
207856c8f68fSbellard 	uint64_t	f_bavail;
2079c227f099SAnthony Liguori 	target_fsid_t	f_fsid;
208056c8f68fSbellard 	uint32_t	f_namelen;
208156c8f68fSbellard 	uint32_t	f_spare[6];
208256c8f68fSbellard };
2083c4d10628Sbalrog #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \
208409701199SAlexander Graf        defined(TARGET_SPARC64) || defined(TARGET_AARCH64)) && \
208509701199SAlexander Graf        !defined(TARGET_ABI32)
2086325e651fSj_mayer struct target_statfs {
2087325e651fSj_mayer 	abi_long f_type;
2088325e651fSj_mayer 	abi_long f_bsize;
2089325e651fSj_mayer 	abi_long f_blocks;
2090325e651fSj_mayer 	abi_long f_bfree;
2091325e651fSj_mayer 	abi_long f_bavail;
2092325e651fSj_mayer 	abi_long f_files;
2093325e651fSj_mayer 	abi_long f_ffree;
2094c227f099SAnthony Liguori 	target_fsid_t f_fsid;
2095325e651fSj_mayer 	abi_long f_namelen;
2096325e651fSj_mayer 	abi_long f_frsize;
2097325e651fSj_mayer 	abi_long f_spare[5];
2098325e651fSj_mayer };
2099325e651fSj_mayer 
2100325e651fSj_mayer struct target_statfs64 {
2101325e651fSj_mayer 	abi_long f_type;
2102325e651fSj_mayer 	abi_long f_bsize;
2103325e651fSj_mayer 	abi_long f_blocks;
2104325e651fSj_mayer 	abi_long f_bfree;
2105325e651fSj_mayer 	abi_long f_bavail;
2106325e651fSj_mayer 	abi_long f_files;
2107325e651fSj_mayer 	abi_long f_ffree;
2108c227f099SAnthony Liguori 	target_fsid_t f_fsid;
2109325e651fSj_mayer 	abi_long f_namelen;
2110325e651fSj_mayer 	abi_long f_frsize;
2111325e651fSj_mayer 	abi_long f_spare[5];
2112325e651fSj_mayer };
2113a4c075f1SUlrich Hecht #elif defined(TARGET_S390X)
2114a4c075f1SUlrich Hecht struct target_statfs {
2115a4c075f1SUlrich Hecht     int32_t  f_type;
2116a4c075f1SUlrich Hecht     int32_t  f_bsize;
2117a4c075f1SUlrich Hecht     abi_long f_blocks;
2118a4c075f1SUlrich Hecht     abi_long f_bfree;
2119a4c075f1SUlrich Hecht     abi_long f_bavail;
2120a4c075f1SUlrich Hecht     abi_long f_files;
2121a4c075f1SUlrich Hecht     abi_long f_ffree;
2122a4c075f1SUlrich Hecht     kernel_fsid_t f_fsid;
2123a4c075f1SUlrich Hecht     int32_t  f_namelen;
2124a4c075f1SUlrich Hecht     int32_t  f_frsize;
2125a4c075f1SUlrich Hecht     int32_t  f_spare[5];
2126a4c075f1SUlrich Hecht };
2127a4c075f1SUlrich Hecht 
2128a4c075f1SUlrich Hecht struct target_statfs64 {
2129a4c075f1SUlrich Hecht     int32_t  f_type;
2130a4c075f1SUlrich Hecht     int32_t  f_bsize;
2131a4c075f1SUlrich Hecht     abi_long f_blocks;
2132a4c075f1SUlrich Hecht     abi_long f_bfree;
2133a4c075f1SUlrich Hecht     abi_long f_bavail;
2134a4c075f1SUlrich Hecht     abi_long f_files;
2135a4c075f1SUlrich Hecht     abi_long f_ffree;
2136a4c075f1SUlrich Hecht     kernel_fsid_t f_fsid;
2137a4c075f1SUlrich Hecht     int32_t  f_namelen;
2138a4c075f1SUlrich Hecht     int32_t  f_frsize;
2139a4c075f1SUlrich Hecht     int32_t  f_spare[5];
2140a4c075f1SUlrich Hecht };
214156c8f68fSbellard #else
214256c8f68fSbellard struct target_statfs {
214356c8f68fSbellard 	uint32_t f_type;
214456c8f68fSbellard 	uint32_t f_bsize;
214556c8f68fSbellard 	uint32_t f_blocks;
214656c8f68fSbellard 	uint32_t f_bfree;
214756c8f68fSbellard 	uint32_t f_bavail;
214856c8f68fSbellard 	uint32_t f_files;
214956c8f68fSbellard 	uint32_t f_ffree;
2150c227f099SAnthony Liguori 	target_fsid_t f_fsid;
215156c8f68fSbellard 	uint32_t f_namelen;
215256c8f68fSbellard 	uint32_t f_frsize;
215356c8f68fSbellard 	uint32_t f_spare[5];
215456c8f68fSbellard };
215556c8f68fSbellard 
215656c8f68fSbellard struct target_statfs64 {
215756c8f68fSbellard 	uint32_t f_type;
215856c8f68fSbellard 	uint32_t f_bsize;
215956c8f68fSbellard 	uint64_t f_blocks;
216056c8f68fSbellard 	uint64_t f_bfree;
216156c8f68fSbellard 	uint64_t f_bavail;
216256c8f68fSbellard 	uint64_t f_files;
216356c8f68fSbellard 	uint64_t f_ffree;
2164c227f099SAnthony Liguori 	target_fsid_t f_fsid;
216556c8f68fSbellard         uint32_t f_namelen;
216656c8f68fSbellard 	uint32_t f_frsize;
216756c8f68fSbellard 	uint32_t f_spare[5];
216856c8f68fSbellard };
216956c8f68fSbellard #endif
217056c8f68fSbellard 
217156c8f68fSbellard 
21722521d698Sbellard #define TARGET_F_DUPFD         0       /* dup */
21732521d698Sbellard #define TARGET_F_GETFD         1       /* get close_on_exec */
21742521d698Sbellard #define TARGET_F_SETFD         2       /* set/clear close_on_exec */
21752521d698Sbellard #define TARGET_F_GETFL         3       /* get file->f_flags */
21762521d698Sbellard #define TARGET_F_SETFL         4       /* set file->f_flags */
21772521d698Sbellard 
21782521d698Sbellard #if defined(TARGET_ALPHA)
21792521d698Sbellard #define TARGET_F_GETLK         7
21802521d698Sbellard #define TARGET_F_SETLK         8
21812521d698Sbellard #define TARGET_F_SETLKW        9
21822521d698Sbellard #define TARGET_F_SETOWN        5       /*  for sockets. */
21832521d698Sbellard #define TARGET_F_GETOWN        6       /*  for sockets. */
21842ba7f730SLaurent Vivier 
21852ba7f730SLaurent Vivier #define TARGET_F_RDLCK         1
21862ba7f730SLaurent Vivier #define TARGET_F_WRLCK         2
21872ba7f730SLaurent Vivier #define TARGET_F_UNLCK         8
21882ba7f730SLaurent Vivier #define TARGET_F_EXLCK         16
21892ba7f730SLaurent Vivier #define TARGET_F_SHLCK         32
21905f106811SArnaud Patard (Rtp) #elif defined(TARGET_MIPS)
21915f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK         14
21925f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK         6
21935f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW        7
21945f106811SArnaud Patard (Rtp) #define TARGET_F_SETOWN        24       /*  for sockets. */
21953a87a954SAleksandar Markovic #define TARGET_F_GETOWN        23       /*  for sockets. */
21962521d698Sbellard #else
21972521d698Sbellard #define TARGET_F_GETLK         5
21982521d698Sbellard #define TARGET_F_SETLK         6
21992521d698Sbellard #define TARGET_F_SETLKW        7
22002521d698Sbellard #define TARGET_F_SETOWN        8       /*  for sockets. */
22012521d698Sbellard #define TARGET_F_GETOWN        9       /*  for sockets. */
22022521d698Sbellard #endif
22038d5d3004SAndreas Schwab #define TARGET_F_SETOWN_EX     15
22048d5d3004SAndreas Schwab #define TARGET_F_GETOWN_EX     16
22052521d698Sbellard 
22062ba7f730SLaurent Vivier #ifndef TARGET_F_RDLCK
22072ba7f730SLaurent Vivier #define TARGET_F_RDLCK         0
22082ba7f730SLaurent Vivier #define TARGET_F_WRLCK         1
22092ba7f730SLaurent Vivier #define TARGET_F_UNLCK         2
22102ba7f730SLaurent Vivier #endif
22112ba7f730SLaurent Vivier 
22122ba7f730SLaurent Vivier #ifndef TARGET_F_EXLCK
22132ba7f730SLaurent Vivier #define TARGET_F_EXLCK         4
22142ba7f730SLaurent Vivier #define TARGET_F_SHLCK         8
22152ba7f730SLaurent Vivier #endif
22162ba7f730SLaurent Vivier 
22172ba7f730SLaurent Vivier 
22182521d698Sbellard #define TARGET_F_SETSIG        10      /*  for sockets. */
22192521d698Sbellard #define TARGET_F_GETSIG        11      /*  for sockets. */
22202521d698Sbellard 
22215f106811SArnaud Patard (Rtp) #if defined(TARGET_MIPS)
22225f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK64       33      /*  using 'struct flock64' */
22235f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK64       34
22245f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW64      35
22255f106811SArnaud Patard (Rtp) #else
22262521d698Sbellard #define TARGET_F_GETLK64       12      /*  using 'struct flock64' */
22272521d698Sbellard #define TARGET_F_SETLK64       13
22282521d698Sbellard #define TARGET_F_SETLKW64      14
22295f106811SArnaud Patard (Rtp) #endif
22307e22e546SUlrich Hecht 
22317e22e546SUlrich Hecht #define TARGET_F_LINUX_SPECIFIC_BASE 1024
22327e22e546SUlrich Hecht #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0)
22337e22e546SUlrich Hecht #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1)
22347e22e546SUlrich Hecht #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6)
22357e3b92ecSPeter Maydell #define TARGET_F_SETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 7)
22367e3b92ecSPeter Maydell #define TARGET_F_GETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 8)
22377e22e546SUlrich Hecht #define TARGET_F_NOTIFY  (TARGET_F_LINUX_SPECIFIC_BASE+2)
22387e22e546SUlrich Hecht 
22394eeea4f3SRichard Henderson #if defined(TARGET_ALPHA)
22404eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK           04
22414eeea4f3SRichard Henderson #define TARGET_O_APPEND            010
22424eeea4f3SRichard Henderson #define TARGET_O_CREAT           01000 /* not fcntl */
22434eeea4f3SRichard Henderson #define TARGET_O_TRUNC           02000 /* not fcntl */
22444eeea4f3SRichard Henderson #define TARGET_O_EXCL            04000 /* not fcntl */
22454eeea4f3SRichard Henderson #define TARGET_O_NOCTTY         010000 /* not fcntl */
22464eeea4f3SRichard Henderson #define TARGET_O_DSYNC          040000
22474eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE           0 /* not necessary, always 64-bit */
22484eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY     0100000 /* must be a directory */
22494eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW      0200000 /* don't follow links */
22504eeea4f3SRichard Henderson #define TARGET_O_DIRECT       02000000 /* direct disk access hint */
22514eeea4f3SRichard Henderson #define TARGET_O_NOATIME      04000000
22524eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC     010000000
22534eeea4f3SRichard Henderson #define TARGET___O_SYNC      020000000
22544eeea4f3SRichard Henderson #define TARGET_O_PATH        040000000
22554eeea4f3SRichard Henderson #elif defined(TARGET_ARM) || defined(TARGET_M68K)
2256f09936acSbellard #define TARGET_O_DIRECTORY      040000 /* must be a directory */
2257f09936acSbellard #define TARGET_O_NOFOLLOW      0100000 /* don't follow links */
2258f09936acSbellard #define TARGET_O_DIRECT        0200000 /* direct disk access hint */
2259f09936acSbellard #define TARGET_O_LARGEFILE     0400000
2260048f6b4dSbellard #elif defined(TARGET_MIPS)
2261048f6b4dSbellard #define TARGET_O_APPEND         0x0008
22624eeea4f3SRichard Henderson #define TARGET_O_DSYNC          0x0010
2263048f6b4dSbellard #define TARGET_O_NONBLOCK       0x0080
2264048f6b4dSbellard #define TARGET_O_CREAT          0x0100  /* not fcntl */
2265048f6b4dSbellard #define TARGET_O_TRUNC          0x0200  /* not fcntl */
2266048f6b4dSbellard #define TARGET_O_EXCL           0x0400  /* not fcntl */
2267048f6b4dSbellard #define TARGET_O_NOCTTY         0x0800  /* not fcntl */
2268048f6b4dSbellard #define TARGET_FASYNC           0x1000  /* fcntl, for BSD compatibility */
2269048f6b4dSbellard #define TARGET_O_LARGEFILE      0x2000  /* allow large file opens */
22704eeea4f3SRichard Henderson #define TARGET___O_SYNC         0x4000
2271048f6b4dSbellard #define TARGET_O_DIRECT         0x8000  /* direct disk access hint */
22724eeea4f3SRichard Henderson #elif defined (TARGET_PPC)
22734eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY      040000 /* must be a directory */
22744eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW      0100000 /* don't follow links */
22754eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE     0200000
22764eeea4f3SRichard Henderson #define TARGET_O_DIRECT        0400000 /* direct disk access hint */
22774eeea4f3SRichard Henderson #elif defined (TARGET_SPARC)
22781f961124Saurel32 #define TARGET_O_APPEND         0x0008
22794eeea4f3SRichard Henderson #define TARGET_FASYNC           0x0040  /* fcntl, for BSD compatibility */
22801f961124Saurel32 #define TARGET_O_CREAT          0x0200  /* not fcntl */
22811f961124Saurel32 #define TARGET_O_TRUNC          0x0400  /* not fcntl */
22821f961124Saurel32 #define TARGET_O_EXCL           0x0800  /* not fcntl */
22834eeea4f3SRichard Henderson #define TARGET_O_DSYNC          0x2000
22844eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK       0x4000
22854eeea4f3SRichard Henderson # ifdef TARGET_SPARC64
22864eeea4f3SRichard Henderson #  define TARGET_O_NDELAY       0x0004
2287ffa65c3bSbellard # else
22884eeea4f3SRichard Henderson #  define TARGET_O_NDELAY       (0x0004 | TARGET_O_NONBLOCK)
22894eeea4f3SRichard Henderson # endif
22904eeea4f3SRichard Henderson #define TARGET_O_NOCTTY         0x8000  /* not fcntl */
22914eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE     0x40000
22924eeea4f3SRichard Henderson #define TARGET_O_DIRECT       0x100000  /* direct disk access hint */
22934eeea4f3SRichard Henderson #define TARGET_O_NOATIME      0x200000
22944eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC      0x400000
22954eeea4f3SRichard Henderson #define TARGET___O_SYNC       0x800000
22964eeea4f3SRichard Henderson #define TARGET_O_PATH        0x1000000
22974eeea4f3SRichard Henderson #endif
22984eeea4f3SRichard Henderson 
22994eeea4f3SRichard Henderson /* <asm-generic/fcntl.h> values follow.  */
2300ffa65c3bSbellard #define TARGET_O_ACCMODE          0003
2301ffa65c3bSbellard #define TARGET_O_RDONLY             00
2302ffa65c3bSbellard #define TARGET_O_WRONLY             01
2303ffa65c3bSbellard #define TARGET_O_RDWR               02
23044eeea4f3SRichard Henderson #ifndef TARGET_O_CREAT
2305ffa65c3bSbellard #define TARGET_O_CREAT            0100 /* not fcntl */
23064eeea4f3SRichard Henderson #endif
23074eeea4f3SRichard Henderson #ifndef TARGET_O_EXCL
2308ffa65c3bSbellard #define TARGET_O_EXCL             0200 /* not fcntl */
23094eeea4f3SRichard Henderson #endif
23104eeea4f3SRichard Henderson #ifndef TARGET_O_NOCTTY
2311ffa65c3bSbellard #define TARGET_O_NOCTTY           0400 /* not fcntl */
23124eeea4f3SRichard Henderson #endif
23134eeea4f3SRichard Henderson #ifndef TARGET_O_TRUNC
2314ffa65c3bSbellard #define TARGET_O_TRUNC           01000 /* not fcntl */
23154eeea4f3SRichard Henderson #endif
23164eeea4f3SRichard Henderson #ifndef TARGET_O_APPEND
2317ffa65c3bSbellard #define TARGET_O_APPEND          02000
23184eeea4f3SRichard Henderson #endif
23194eeea4f3SRichard Henderson #ifndef TARGET_O_NONBLOCK
2320ffa65c3bSbellard #define TARGET_O_NONBLOCK        04000
23214eeea4f3SRichard Henderson #endif
23224eeea4f3SRichard Henderson #ifndef TARGET_O_DSYNC
23234eeea4f3SRichard Henderson #define TARGET_O_DSYNC          010000
23244eeea4f3SRichard Henderson #endif
23254eeea4f3SRichard Henderson #ifndef TARGET_FASYNC
2326ffa65c3bSbellard #define TARGET_FASYNC           020000 /* fcntl, for BSD compatibility */
23274eeea4f3SRichard Henderson #endif
23284eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECT
2329ffa65c3bSbellard #define TARGET_O_DIRECT         040000 /* direct disk access hint */
23304eeea4f3SRichard Henderson #endif
23314eeea4f3SRichard Henderson #ifndef TARGET_O_LARGEFILE
2332ffa65c3bSbellard #define TARGET_O_LARGEFILE     0100000
23334eeea4f3SRichard Henderson #endif
23344eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECTORY
2335ffa65c3bSbellard #define TARGET_O_DIRECTORY     0200000 /* must be a directory */
23364eeea4f3SRichard Henderson #endif
23374eeea4f3SRichard Henderson #ifndef TARGET_O_NOFOLLOW
2338ffa65c3bSbellard #define TARGET_O_NOFOLLOW      0400000 /* don't follow links */
2339ffa65c3bSbellard #endif
23404eeea4f3SRichard Henderson #ifndef TARGET_O_NOATIME
23414eeea4f3SRichard Henderson #define TARGET_O_NOATIME      01000000
23424eeea4f3SRichard Henderson #endif
23434eeea4f3SRichard Henderson #ifndef TARGET_O_CLOEXEC
23444eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC      02000000
23454eeea4f3SRichard Henderson #endif
23464eeea4f3SRichard Henderson #ifndef TARGET___O_SYNC
23474eeea4f3SRichard Henderson #define TARGET___O_SYNC       04000000
23484eeea4f3SRichard Henderson #endif
23494eeea4f3SRichard Henderson #ifndef TARGET_O_PATH
23504eeea4f3SRichard Henderson #define TARGET_O_PATH        010000000
23514eeea4f3SRichard Henderson #endif
23524eeea4f3SRichard Henderson #ifndef TARGET_O_NDELAY
23534eeea4f3SRichard Henderson #define TARGET_O_NDELAY  TARGET_O_NONBLOCK
23544eeea4f3SRichard Henderson #endif
23554eeea4f3SRichard Henderson #ifndef TARGET_O_SYNC
23564eeea4f3SRichard Henderson #define TARGET_O_SYNC    (TARGET___O_SYNC | TARGET_O_DSYNC)
23574eeea4f3SRichard Henderson #endif
2358ffa65c3bSbellard 
23592521d698Sbellard struct target_flock {
23602521d698Sbellard     short l_type;
23612521d698Sbellard     short l_whence;
23628efb2ed5SPeter Maydell     abi_long l_start;
23638efb2ed5SPeter Maydell     abi_long l_len;
23648a8001b1SAleksandar Markovic #if defined(TARGET_MIPS)
23658a8001b1SAleksandar Markovic     abi_long l_sysid;
23668a8001b1SAleksandar Markovic #endif
23672521d698Sbellard     int l_pid;
23688a8001b1SAleksandar Markovic #if defined(TARGET_MIPS)
23698a8001b1SAleksandar Markovic     abi_long pad[4];
23708a8001b1SAleksandar Markovic #endif
23712521d698Sbellard };
23722521d698Sbellard 
23732521d698Sbellard struct target_flock64 {
23742521d698Sbellard     short  l_type;
23752521d698Sbellard     short  l_whence;
2376d41f3c3cSThomas Huth #if defined(TARGET_PPC) || defined(TARGET_X86_64) \
2377d41f3c3cSThomas Huth     || defined(TARGET_MIPS) || defined(TARGET_SPARC) \
2378b16189b2SChen Gang     || defined(TARGET_MICROBLAZE) || defined(TARGET_TILEGX)
2379ce3f0e2fSaurel32     int __pad;
2380ce3f0e2fSaurel32 #endif
23818efb2ed5SPeter Maydell     abi_llong l_start;
23828efb2ed5SPeter Maydell     abi_llong l_len;
23832521d698Sbellard     int  l_pid;
2384541dc0d4SStefan Weil } QEMU_PACKED;
23852521d698Sbellard 
2386ce4defa0Spbrook #ifdef TARGET_ARM
2387ce4defa0Spbrook struct target_eabi_flock64 {
2388ce4defa0Spbrook     short  l_type;
2389ce4defa0Spbrook     short  l_whence;
2390ce4defa0Spbrook     int __pad;
23918efb2ed5SPeter Maydell     abi_llong l_start;
23928efb2ed5SPeter Maydell     abi_llong l_len;
2393ce4defa0Spbrook     int  l_pid;
2394541dc0d4SStefan Weil } QEMU_PACKED;
2395ce4defa0Spbrook #endif
23962521d698Sbellard 
23978d5d3004SAndreas Schwab struct target_f_owner_ex {
23988d5d3004SAndreas Schwab         int type;	/* Owner type of ID.  */
23998d5d3004SAndreas Schwab         int pid;	/* ID of owner.  */
24008d5d3004SAndreas Schwab };
24018d5d3004SAndreas Schwab 
24022521d698Sbellard /* soundcard defines */
240367cc32ebSVeres Lajos /* XXX: convert them all to arch independent entries */
24042521d698Sbellard #define TARGET_SNDCTL_COPR_HALT           TARGET_IOWR('C',  7, int);
24052521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD           0xcfb04301
24062521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE          0xc0144303
24072521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG         0x8fa44309
24082521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA          0xc0144302
24092521d698Sbellard #define TARGET_SNDCTL_COPR_RESET          0x00004300
24102521d698Sbellard #define TARGET_SNDCTL_COPR_RUN            0xc0144306
24112521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG        0xcfa44308
24122521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE          0x40144305
24132521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA          0x40144304
24142521d698Sbellard #define TARGET_SNDCTL_DSP_RESET           TARGET_IO('P', 0)
24152521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC            TARGET_IO('P', 1)
24162521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED           TARGET_IOWR('P', 2, int)
24172521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO          TARGET_IOWR('P', 3, int)
24182521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE      TARGET_IOWR('P', 4, int)
24192521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT          TARGET_IOWR('P', 5, int)
24202521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS        TARGET_IOWR('P', 6, int)
24212521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER     TARGET_IOWR('P', 7, int)
24222521d698Sbellard #define TARGET_SNDCTL_DSP_POST            TARGET_IO('P', 8)
24232521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE       TARGET_IOWR('P', 9, int)
24242521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT     TARGET_IOWR('P',10, int)
24252521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS         TARGET_IOR('P', 11, int)
24262521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE       TARGET_IORU('P',12)
24272521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE       TARGET_IORU('P',13)
24282521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS         TARGET_IOR('P', 15, int)
24292521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER      TARGET_IOR('P',16, int)
24302521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR         TARGET_IORU('P',17)
24312521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR         TARGET_IORU('P',18)
24325f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPINBUF        TARGET_IORU('P', 19)
24335f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPOUTBUF       TARGET_IORU('P', 20)
24342521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK        0x0000500e
24352521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE      0xc0045005
24362521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX       0x00005016
24372521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO       0x00005015
24382521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER      0x40045010
24392521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE       0x4004510f
24402521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR       0x40285107
24412521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO           0xc074510c
24422521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD         0xc0216d02
24432521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE        0xc0046d01
24442521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME        0xc0046d00
24452521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS         0xcfb85110
24462521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE          0xcfb85001
24472521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE        0xc0045103
24482521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT      0x80045105
24492521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT     0x80045104
24502521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS         0x8004510b
24512521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS        0x8004510a
24522521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND       0x40085112
24532521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC           0x00005111
24542521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE        0x40045106
24552521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET           0x00005100
24562521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES    0x40045109
24572521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC            0x00005101
24582521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI        0x40045108
24592521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD       0x4004510d
24602521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD        0x4004510d
24612521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO          0xc08c5102
24622521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL        0xc004510e
24632521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE        0x00005404
24642521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME       0x40045407
24652521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT          0x40045408
24662521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE          0xc0045406
24672521d698Sbellard #define TARGET_SNDCTL_TMR_START           0x00005402
24682521d698Sbellard #define TARGET_SNDCTL_TMR_STOP            0x00005403
24692521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO           0xc0045405
24702521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE        0xc0045401
24712521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE        0x80045002
24722521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS    0x80045006
24732521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS        0x80045005
24742521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER      0x80045007
24752521d698Sbellard #define TARGET_SOUND_MIXER_INFO           TARGET_IOR ('M', 101, mixer_info)
24762521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS         0xc0804d66
24772521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1       TARGET_IOWR('M', 111, int)
24782521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2       TARGET_IOWR('M', 112, int)
24792521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3       TARGET_IOWR('M', 113, int)
24802521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4       TARGET_IOWR('M', 114, int)
24812521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5       TARGET_IOWR('M', 115, int)
24822521d698Sbellard 
24832521d698Sbellard #define TARGET_MIXER_READ(dev)	TARGET_IOR('M', dev, int)
24842521d698Sbellard 
24852521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME		TARGET_MIXER_READ(SOUND_MIXER_VOLUME)
24862521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS		TARGET_MIXER_READ(SOUND_MIXER_BASS)
24872521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE		TARGET_MIXER_READ(SOUND_MIXER_TREBLE)
24882521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH		TARGET_MIXER_READ(SOUND_MIXER_SYNTH)
24892521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM		TARGET_MIXER_READ(SOUND_MIXER_PCM)
24902521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER	        TARGET_MIXER_READ(SOUND_MIXER_SPEAKER)
24912521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE		TARGET_MIXER_READ(SOUND_MIXER_LINE)
24922521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC		TARGET_MIXER_READ(SOUND_MIXER_MIC)
24932521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD		TARGET_MIXER_READ(SOUND_MIXER_CD)
24942521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX		TARGET_MIXER_READ(SOUND_MIXER_IMIX)
24952521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM		TARGET_MIXER_READ(SOUND_MIXER_ALTPCM)
24962521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV		TARGET_MIXER_READ(SOUND_MIXER_RECLEV)
24972521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN		TARGET_MIXER_READ(SOUND_MIXER_IGAIN)
24982521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN		TARGET_MIXER_READ(SOUND_MIXER_OGAIN)
24992521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1		TARGET_MIXER_READ(SOUND_MIXER_LINE1)
25002521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2		TARGET_MIXER_READ(SOUND_MIXER_LINE2)
25012521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3		TARGET_MIXER_READ(SOUND_MIXER_LINE3)
25022521d698Sbellard 
25032521d698Sbellard /* Obsolete macros */
25042521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE		TARGET_MIXER_READ(SOUND_MIXER_MUTE)
25052521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE	        TARGET_MIXER_READ(SOUND_MIXER_ENHANCE)
25062521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD		TARGET_MIXER_READ(SOUND_MIXER_LOUD)
25072521d698Sbellard 
25082521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC		TARGET_MIXER_READ(SOUND_MIXER_RECSRC)
25092521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK	        TARGET_MIXER_READ(SOUND_MIXER_DEVMASK)
25102521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK	        TARGET_MIXER_READ(SOUND_MIXER_RECMASK)
25112521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS	TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS)
25122521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS		TARGET_MIXER_READ(SOUND_MIXER_CAPS)
25132521d698Sbellard 
25142521d698Sbellard #define TARGET_MIXER_WRITE(dev)		TARGET_IOWR('M', dev, int)
25152521d698Sbellard 
25162521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME	TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME)
25172521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS		TARGET_MIXER_WRITE(SOUND_MIXER_BASS)
25182521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE	TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE)
25192521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH		TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH)
25202521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM		TARGET_MIXER_WRITE(SOUND_MIXER_PCM)
25212521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER	TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER)
25222521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE		TARGET_MIXER_WRITE(SOUND_MIXER_LINE)
25232521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC		TARGET_MIXER_WRITE(SOUND_MIXER_MIC)
25242521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD		TARGET_MIXER_WRITE(SOUND_MIXER_CD)
25252521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX		TARGET_MIXER_WRITE(SOUND_MIXER_IMIX)
25262521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM	TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM)
25272521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV	TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV)
25282521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN		TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN)
25292521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN		TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN)
25302521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1		TARGET_MIXER_WRITE(SOUND_MIXER_LINE1)
25312521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2		TARGET_MIXER_WRITE(SOUND_MIXER_LINE2)
25322521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3		TARGET_MIXER_WRITE(SOUND_MIXER_LINE3)
25332521d698Sbellard 
25342521d698Sbellard /* Obsolete macros */
25352521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE		TARGET_MIXER_WRITE(SOUND_MIXER_MUTE)
25362521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE	TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE)
25372521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD		TARGET_MIXER_WRITE(SOUND_MIXER_LOUD)
25382521d698Sbellard 
25392521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC	TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC)
25402521d698Sbellard 
25412521d698Sbellard /* vfat ioctls */
25422521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH    TARGET_IORU('r', 1)
25432521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT   TARGET_IORU('r', 2)
2544a5448a7dSbellard 
25458fbd6b52Sbalrog #define TARGET_MTIOCTOP        TARGET_IOW('m', 1, struct mtop)
25468fbd6b52Sbalrog #define TARGET_MTIOCGET        TARGET_IOR('m', 2, struct mtget)
25478fbd6b52Sbalrog #define TARGET_MTIOCPOS        TARGET_IOR('m', 3, struct mtpos)
25488fbd6b52Sbalrog 
2549a5448a7dSbellard struct target_sysinfo {
2550992f48a0Sblueswir1     abi_long uptime;                /* Seconds since boot */
2551992f48a0Sblueswir1     abi_ulong loads[3];             /* 1, 5, and 15 minute load averages */
2552992f48a0Sblueswir1     abi_ulong totalram;             /* Total usable main memory size */
2553992f48a0Sblueswir1     abi_ulong freeram;              /* Available memory size */
2554992f48a0Sblueswir1     abi_ulong sharedram;            /* Amount of shared memory */
2555992f48a0Sblueswir1     abi_ulong bufferram;            /* Memory used by buffers */
2556992f48a0Sblueswir1     abi_ulong totalswap;            /* Total swap space size */
2557992f48a0Sblueswir1     abi_ulong freeswap;             /* swap space still available */
2558a5448a7dSbellard     unsigned short procs;           /* Number of current processes */
2559a5448a7dSbellard     unsigned short pad;             /* explicit padding for m68k */
2560992f48a0Sblueswir1     abi_ulong totalhigh;            /* Total high memory size */
2561992f48a0Sblueswir1     abi_ulong freehigh;             /* Available high memory size */
2562a5448a7dSbellard     unsigned int mem_unit;          /* Memory unit size in bytes */
2563992f48a0Sblueswir1     char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */
2564a5448a7dSbellard };
25653532fa74Sbellard 
25666556a833Saurel32 struct linux_dirent {
25676556a833Saurel32     long            d_ino;
25686556a833Saurel32     unsigned long   d_off;
25696556a833Saurel32     unsigned short  d_reclen;
25706556a833Saurel32     char            d_name[256]; /* We must not include limits.h! */
25716556a833Saurel32 };
25726556a833Saurel32 
25736556a833Saurel32 struct linux_dirent64 {
25746556a833Saurel32     uint64_t        d_ino;
25756556a833Saurel32     int64_t         d_off;
25766556a833Saurel32     unsigned short  d_reclen;
25776556a833Saurel32     unsigned char   d_type;
25786556a833Saurel32     char            d_name[256];
25796556a833Saurel32 };
25806556a833Saurel32 
258124e1003aSaurel32 struct target_mq_attr {
258224e1003aSaurel32     abi_long mq_flags;
258324e1003aSaurel32     abi_long mq_maxmsg;
258424e1003aSaurel32     abi_long mq_msgsize;
258524e1003aSaurel32     abi_long mq_curmsgs;
258624e1003aSaurel32 };
258724e1003aSaurel32 
25883532fa74Sbellard #include "socket.h"
2589637947f1Sths 
2590637947f1Sths #include "errno_defs.h"
259103dfe9f8SRiku Voipio 
259203dfe9f8SRiku Voipio #define FUTEX_WAIT              0
259303dfe9f8SRiku Voipio #define FUTEX_WAKE              1
259403dfe9f8SRiku Voipio #define FUTEX_FD                2
259503dfe9f8SRiku Voipio #define FUTEX_REQUEUE           3
259603dfe9f8SRiku Voipio #define FUTEX_CMP_REQUEUE       4
259703dfe9f8SRiku Voipio #define FUTEX_WAKE_OP           5
259803dfe9f8SRiku Voipio #define FUTEX_LOCK_PI           6
259903dfe9f8SRiku Voipio #define FUTEX_UNLOCK_PI         7
260003dfe9f8SRiku Voipio #define FUTEX_TRYLOCK_PI        8
260103dfe9f8SRiku Voipio #define FUTEX_WAIT_BITSET       9
260203dfe9f8SRiku Voipio #define FUTEX_WAKE_BITSET       10
260303dfe9f8SRiku Voipio 
260403dfe9f8SRiku Voipio #define FUTEX_PRIVATE_FLAG      128
260503dfe9f8SRiku Voipio #define FUTEX_CLOCK_REALTIME    256
260603dfe9f8SRiku Voipio #define FUTEX_CMD_MASK          ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)
260703dfe9f8SRiku Voipio 
26083b6edd16SPeter Maydell #ifdef CONFIG_EPOLL
2609928bed6aSLaurent Vivier #if defined(TARGET_X86_64)
2610928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED QEMU_PACKED
2611928bed6aSLaurent Vivier #else
2612928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED
2613928bed6aSLaurent Vivier #endif
2614928bed6aSLaurent Vivier 
26153b6edd16SPeter Maydell typedef union target_epoll_data {
26163b6edd16SPeter Maydell     abi_ulong ptr;
2617928bed6aSLaurent Vivier     abi_int fd;
2618928bed6aSLaurent Vivier     abi_uint u32;
2619928bed6aSLaurent Vivier     abi_ullong u64;
26203b6edd16SPeter Maydell } target_epoll_data_t;
26213b6edd16SPeter Maydell 
26223b6edd16SPeter Maydell struct target_epoll_event {
2623928bed6aSLaurent Vivier     abi_uint events;
26243b6edd16SPeter Maydell     target_epoll_data_t data;
2625928bed6aSLaurent Vivier } TARGET_EPOLL_PACKED;
26262ba7fae3SPeter Maydell 
26272ba7fae3SPeter Maydell #define TARGET_EP_MAX_EVENTS (INT_MAX / sizeof(struct target_epoll_event))
26282ba7fae3SPeter Maydell 
26293b6edd16SPeter Maydell #endif
2630163a05a8SPeter Maydell struct target_rlimit64 {
2631163a05a8SPeter Maydell     uint64_t rlim_cur;
2632163a05a8SPeter Maydell     uint64_t rlim_max;
2633163a05a8SPeter Maydell };
2634583359a6SAkos PASZTORY 
2635583359a6SAkos PASZTORY struct target_ucred {
2636583359a6SAkos PASZTORY     uint32_t pid;
2637583359a6SAkos PASZTORY     uint32_t uid;
2638583359a6SAkos PASZTORY     uint32_t gid;
2639583359a6SAkos PASZTORY };
2640cb9c377fSPaolo Bonzini 
2641aecc8861SAlexander Graf typedef int32_t target_timer_t;
2642905bba13SErik de Castro Lopo 
264334d60862SNatanael Copa #define TARGET_SIGEV_MAX_SIZE 64
264434d60862SNatanael Copa 
264534d60862SNatanael Copa /* This is architecture-specific but most architectures use the default */
264634d60862SNatanael Copa #ifdef TARGET_MIPS
264734d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long))
264834d60862SNatanael Copa #else
264934d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \
265034d60862SNatanael Copa                                     + sizeof(target_sigval_t))
265134d60862SNatanael Copa #endif
265234d60862SNatanael Copa 
265334d60862SNatanael Copa #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \
265434d60862SNatanael Copa                                 - TARGET_SIGEV_PREAMBLE_SIZE) \
265534d60862SNatanael Copa                                / sizeof(int32_t))
265634d60862SNatanael Copa 
2657905bba13SErik de Castro Lopo struct target_sigevent {
2658905bba13SErik de Castro Lopo     target_sigval_t sigev_value;
2659905bba13SErik de Castro Lopo     int32_t sigev_signo;
2660905bba13SErik de Castro Lopo     int32_t sigev_notify;
2661905bba13SErik de Castro Lopo     union {
266234d60862SNatanael Copa         int32_t _pad[TARGET_SIGEV_PAD_SIZE];
2663905bba13SErik de Castro Lopo         int32_t _tid;
2664905bba13SErik de Castro Lopo 
2665905bba13SErik de Castro Lopo         struct {
2666905bba13SErik de Castro Lopo             void (*_function)(sigval_t);
2667905bba13SErik de Castro Lopo             void *_attribute;
2668905bba13SErik de Castro Lopo         } _sigev_thread;
2669905bba13SErik de Castro Lopo     } _sigev_un;
2670905bba13SErik de Castro Lopo };
2671e0eb210eSPeter Maydell 
2672e0eb210eSPeter Maydell struct target_user_cap_header {
2673e0eb210eSPeter Maydell     uint32_t version;
2674e0eb210eSPeter Maydell     int pid;
2675e0eb210eSPeter Maydell };
2676e0eb210eSPeter Maydell 
2677e0eb210eSPeter Maydell struct target_user_cap_data {
2678e0eb210eSPeter Maydell     uint32_t effective;
2679e0eb210eSPeter Maydell     uint32_t permitted;
2680e0eb210eSPeter Maydell     uint32_t inheritable;
2681e0eb210eSPeter Maydell };
26821b3c4fdfSMarkus Armbruster 
26831b3c4fdfSMarkus Armbruster #endif
2684