xref: /openbmc/qemu/linux-user/syscall_defs.h (revision edafea1330133eb8f6580a1c4f84fc5ec766eb4c)
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 
76180a181Sbellard #include "syscall_nr.h"
82521d698Sbellard 
931e31b8aSbellard #define SOCKOP_socket           1
1031e31b8aSbellard #define SOCKOP_bind             2
1131e31b8aSbellard #define SOCKOP_connect          3
1231e31b8aSbellard #define SOCKOP_listen           4
1331e31b8aSbellard #define SOCKOP_accept           5
1431e31b8aSbellard #define SOCKOP_getsockname      6
1531e31b8aSbellard #define SOCKOP_getpeername      7
1631e31b8aSbellard #define SOCKOP_socketpair       8
1731e31b8aSbellard #define SOCKOP_send             9
1831e31b8aSbellard #define SOCKOP_recv             10
1931e31b8aSbellard #define SOCKOP_sendto           11
2031e31b8aSbellard #define SOCKOP_recvfrom         12
2131e31b8aSbellard #define SOCKOP_shutdown         13
2231e31b8aSbellard #define SOCKOP_setsockopt       14
2331e31b8aSbellard #define SOCKOP_getsockopt       15
2431e31b8aSbellard #define SOCKOP_sendmsg          16
2531e31b8aSbellard #define SOCKOP_recvmsg          17
2631e31b8aSbellard 
278853f86eSbellard #define IPCOP_semop		1
288853f86eSbellard #define IPCOP_semget		2
298853f86eSbellard #define IPCOP_semctl		3
308853f86eSbellard #define IPCOP_semtimedop	4
318853f86eSbellard #define IPCOP_msgsnd		11
328853f86eSbellard #define IPCOP_msgrcv		12
338853f86eSbellard #define IPCOP_msgget		13
348853f86eSbellard #define IPCOP_msgctl		14
358853f86eSbellard #define IPCOP_shmat		21
368853f86eSbellard #define IPCOP_shmdt		22
378853f86eSbellard #define IPCOP_shmget		23
388853f86eSbellard #define IPCOP_shmctl		24
398853f86eSbellard 
402521d698Sbellard /*
412521d698Sbellard  * The following is for compatibility across the various Linux
422521d698Sbellard  * platforms.  The i386 ioctl numbering scheme doesn't really enforce
432521d698Sbellard  * a type field.  De facto, however, the top 8 bits of the lower 16
442521d698Sbellard  * bits are indeed used as a type field, so we might just as well make
452521d698Sbellard  * this explicit here.  Please be sure to use the decoding macros
462521d698Sbellard  * below from now on.
472521d698Sbellard  */
482521d698Sbellard #define TARGET_IOC_NRBITS	8
492521d698Sbellard #define TARGET_IOC_TYPEBITS	8
502521d698Sbellard 
5174d753acSMika Westerberg #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \
520c866a7eSRiku Voipio     || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS)
5374d753acSMika Westerberg     /* 16 bit uid wrappers emulation */
5474d753acSMika Westerberg #define USE_UID16
550c866a7eSRiku Voipio #define target_id uint16_t
560c866a7eSRiku Voipio #else
570c866a7eSRiku Voipio #define target_id uint32_t
5874d753acSMika Westerberg #endif
5974d753acSMika Westerberg 
60e6e5906bSpbrook #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \
61a4c075f1SUlrich Hecht     || defined(TARGET_M68K) || defined(TARGET_CRIS) || defined(TARGET_UNICORE32) \
62a4c075f1SUlrich Hecht     || defined(TARGET_S390X)
632521d698Sbellard 
642521d698Sbellard #define TARGET_IOC_SIZEBITS	14
652521d698Sbellard #define TARGET_IOC_DIRBITS	2
662521d698Sbellard 
672521d698Sbellard #define TARGET_IOC_NONE	  0U
682521d698Sbellard #define TARGET_IOC_WRITE  1U
692521d698Sbellard #define TARGET_IOC_READ	  2U
702521d698Sbellard 
71048f6b4dSbellard #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \
72b779e29eSEdgar E. Iglesias       defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \
73b779e29eSEdgar E. Iglesias       defined(TARGET_MIPS)
742521d698Sbellard 
752521d698Sbellard #define TARGET_IOC_SIZEBITS	13
762521d698Sbellard #define TARGET_IOC_DIRBITS	3
772521d698Sbellard 
782521d698Sbellard #define TARGET_IOC_NONE	  1U
792521d698Sbellard #define TARGET_IOC_READ	  2U
802521d698Sbellard #define TARGET_IOC_WRITE  4U
812521d698Sbellard 
822521d698Sbellard #else
832521d698Sbellard #error unsupported CPU
842521d698Sbellard #endif
852521d698Sbellard 
862521d698Sbellard #define TARGET_IOC_NRMASK	((1 << TARGET_IOC_NRBITS)-1)
872521d698Sbellard #define TARGET_IOC_TYPEMASK	((1 << TARGET_IOC_TYPEBITS)-1)
882521d698Sbellard #define TARGET_IOC_SIZEMASK	((1 << TARGET_IOC_SIZEBITS)-1)
892521d698Sbellard #define TARGET_IOC_DIRMASK	((1 << TARGET_IOC_DIRBITS)-1)
902521d698Sbellard 
912521d698Sbellard #define TARGET_IOC_NRSHIFT	0
922521d698Sbellard #define TARGET_IOC_TYPESHIFT	(TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS)
932521d698Sbellard #define TARGET_IOC_SIZESHIFT	(TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS)
942521d698Sbellard #define TARGET_IOC_DIRSHIFT	(TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS)
952521d698Sbellard 
962521d698Sbellard #define TARGET_IOC(dir,type,nr,size) \
972521d698Sbellard 	(((dir)  << TARGET_IOC_DIRSHIFT) | \
982521d698Sbellard 	 ((type) << TARGET_IOC_TYPESHIFT) | \
992521d698Sbellard 	 ((nr)   << TARGET_IOC_NRSHIFT) | \
1002521d698Sbellard 	 ((size) << TARGET_IOC_SIZESHIFT))
1012521d698Sbellard 
1022521d698Sbellard /* used to create numbers */
1032521d698Sbellard #define TARGET_IO(type,nr)		TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0)
1042521d698Sbellard #define TARGET_IOR(type,nr,size)	TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size))
1052521d698Sbellard #define TARGET_IOW(type,nr,size)	TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size))
1062521d698Sbellard #define TARGET_IOWR(type,nr,size)	TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size))
1072521d698Sbellard 
1082521d698Sbellard /* the size is automatically computed for these defines */
1092521d698Sbellard #define TARGET_IORU(type,nr)	TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK)
1102521d698Sbellard #define TARGET_IOWU(type,nr)	TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
1112521d698Sbellard #define TARGET_IOWRU(type,nr)	TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
1122521d698Sbellard 
1137854b056Sbellard struct target_sockaddr {
1147854b056Sbellard     uint16_t sa_family;
1157854b056Sbellard     uint8_t sa_data[14];
1167854b056Sbellard };
1177854b056Sbellard 
118b975b83bSLionel Landwerlin struct target_in_addr {
119b975b83bSLionel Landwerlin     uint32_t s_addr; /* big endian */
120b975b83bSLionel Landwerlin };
121b975b83bSLionel Landwerlin 
122b975b83bSLionel Landwerlin struct target_ip_mreq {
123b975b83bSLionel Landwerlin     struct target_in_addr imr_multiaddr;
124b975b83bSLionel Landwerlin     struct target_in_addr imr_address;
125b975b83bSLionel Landwerlin };
126b975b83bSLionel Landwerlin 
127b975b83bSLionel Landwerlin struct target_ip_mreqn {
128b975b83bSLionel Landwerlin     struct target_in_addr imr_multiaddr;
129b975b83bSLionel Landwerlin     struct target_in_addr imr_address;
130b975b83bSLionel Landwerlin     abi_long imr_ifindex;
131b975b83bSLionel Landwerlin };
132b975b83bSLionel Landwerlin 
1336e3cb58fSLionel Landwerlin struct target_ip_mreq_source {
1346e3cb58fSLionel Landwerlin     /* big endian */
1356e3cb58fSLionel Landwerlin     uint32_t imr_multiaddr;
1366e3cb58fSLionel Landwerlin     uint32_t imr_interface;
1376e3cb58fSLionel Landwerlin     uint32_t imr_sourceaddr;
1386e3cb58fSLionel Landwerlin };
1396e3cb58fSLionel Landwerlin 
14031e31b8aSbellard struct target_timeval {
141992f48a0Sblueswir1     abi_long tv_sec;
142992f48a0Sblueswir1     abi_long tv_usec;
14331e31b8aSbellard };
14431e31b8aSbellard 
1451b6b029eSbellard struct target_timespec {
146992f48a0Sblueswir1     abi_long tv_sec;
147992f48a0Sblueswir1     abi_long tv_nsec;
1481b6b029eSbellard };
1491b6b029eSbellard 
15066fb9763Sbellard struct target_itimerval {
15166fb9763Sbellard     struct target_timeval it_interval;
15266fb9763Sbellard     struct target_timeval it_value;
15366fb9763Sbellard };
15466fb9763Sbellard 
155c227f099SAnthony Liguori typedef abi_long target_clock_t;
15632f36bceSbellard 
157c596ed17Sbellard #define TARGET_HZ 100
158c596ed17Sbellard 
15932f36bceSbellard struct target_tms {
160c227f099SAnthony Liguori     target_clock_t tms_utime;
161c227f099SAnthony Liguori     target_clock_t tms_stime;
162c227f099SAnthony Liguori     target_clock_t tms_cutime;
163c227f099SAnthony Liguori     target_clock_t tms_cstime;
16432f36bceSbellard };
16532f36bceSbellard 
1666180a181Sbellard struct target_utimbuf {
167992f48a0Sblueswir1     abi_long actime;
168992f48a0Sblueswir1     abi_long modtime;
1696180a181Sbellard };
1706180a181Sbellard 
171f2674e31Sbellard struct target_sel_arg_struct {
172992f48a0Sblueswir1     abi_long n;
173992f48a0Sblueswir1     abi_long inp, outp, exp;
174992f48a0Sblueswir1     abi_long tvp;
175f2674e31Sbellard };
176f2674e31Sbellard 
17731e31b8aSbellard struct target_iovec {
178992f48a0Sblueswir1     abi_long iov_base;   /* Starting address */
179992f48a0Sblueswir1     abi_long iov_len;   /* Number of bytes */
18031e31b8aSbellard };
18131e31b8aSbellard 
1821a9353d2Sbellard struct target_msghdr {
183992f48a0Sblueswir1     abi_long	 msg_name;	 /* Socket name			*/
1841a9353d2Sbellard     int		 msg_namelen;	 /* Length of name		*/
185992f48a0Sblueswir1     abi_long	 msg_iov;	 /* Data blocks			*/
186992f48a0Sblueswir1     abi_long	 msg_iovlen;	 /* Number of blocks		*/
187992f48a0Sblueswir1     abi_long     msg_control;	 /* Per protocol magic (eg BSD file descriptor passing) */
188992f48a0Sblueswir1     abi_long	 msg_controllen; /* Length of cmsg list */
1891a9353d2Sbellard     unsigned int msg_flags;
1901a9353d2Sbellard };
1911a9353d2Sbellard 
1927854b056Sbellard struct target_cmsghdr {
193992f48a0Sblueswir1     abi_long     cmsg_len;
1947854b056Sbellard     int          cmsg_level;
1957854b056Sbellard     int          cmsg_type;
1967854b056Sbellard };
1977854b056Sbellard 
1987854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1))
1997854b056Sbellard #define TARGET_CMSG_NXTHDR(mhdr, cmsg) __target_cmsg_nxthdr (mhdr, cmsg)
200992f48a0Sblueswir1 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \
201992f48a0Sblueswir1                                & (size_t) ~(sizeof (abi_long) - 1))
2027854b056Sbellard #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \
2037854b056Sbellard                                + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)))
2047854b056Sbellard #define TARGET_CMSG_LEN(len)   (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len))
2057854b056Sbellard 
2067854b056Sbellard static __inline__ struct target_cmsghdr *
2077854b056Sbellard __target_cmsg_nxthdr (struct target_msghdr *__mhdr, struct target_cmsghdr *__cmsg)
2087854b056Sbellard {
2092b8bdefcSths   struct target_cmsghdr *__ptr;
2107854b056Sbellard 
2112b8bdefcSths   __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg
212cbb21eedSMatthias Braun                                     + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len)));
213cbb21eedSMatthias Braun   if ((unsigned long)((char *)(__ptr+1) - (char *)(size_t)tswapal(__mhdr->msg_control))
214cbb21eedSMatthias Braun       > tswapal(__mhdr->msg_controllen))
2157854b056Sbellard     /* No more entries.  */
2162b8bdefcSths     return (struct target_cmsghdr *)0;
2177854b056Sbellard   return __cmsg;
2187854b056Sbellard }
2197854b056Sbellard 
2207854b056Sbellard 
22131e31b8aSbellard struct  target_rusage {
22231e31b8aSbellard         struct target_timeval ru_utime;        /* user time used */
22331e31b8aSbellard         struct target_timeval ru_stime;        /* system time used */
224992f48a0Sblueswir1         abi_long    ru_maxrss;                 /* maximum resident set size */
225992f48a0Sblueswir1         abi_long    ru_ixrss;                  /* integral shared memory size */
226992f48a0Sblueswir1         abi_long    ru_idrss;                  /* integral unshared data size */
227992f48a0Sblueswir1         abi_long    ru_isrss;                  /* integral unshared stack size */
228992f48a0Sblueswir1         abi_long    ru_minflt;                 /* page reclaims */
229992f48a0Sblueswir1         abi_long    ru_majflt;                 /* page faults */
230992f48a0Sblueswir1         abi_long    ru_nswap;                  /* swaps */
231992f48a0Sblueswir1         abi_long    ru_inblock;                /* block input operations */
232992f48a0Sblueswir1         abi_long    ru_oublock;                /* block output operations */
233992f48a0Sblueswir1         abi_long    ru_msgsnd;                 /* messages sent */
234992f48a0Sblueswir1         abi_long    ru_msgrcv;                 /* messages received */
235992f48a0Sblueswir1         abi_long    ru_nsignals;               /* signals received */
236992f48a0Sblueswir1         abi_long    ru_nvcsw;                  /* voluntary context switches */
237992f48a0Sblueswir1         abi_long    ru_nivcsw;                 /* involuntary " */
23831e31b8aSbellard };
23931e31b8aSbellard 
24031e31b8aSbellard typedef struct {
24131e31b8aSbellard         int     val[2];
242c227f099SAnthony Liguori } kernel_fsid_t;
24331e31b8aSbellard 
24472f03900Sbellard struct kernel_statfs {
24531e31b8aSbellard 	int f_type;
24631e31b8aSbellard 	int f_bsize;
24731e31b8aSbellard 	int f_blocks;
24831e31b8aSbellard 	int f_bfree;
24931e31b8aSbellard 	int f_bavail;
25031e31b8aSbellard 	int f_files;
25131e31b8aSbellard 	int f_ffree;
252c227f099SAnthony Liguori         kernel_fsid_t f_fsid;
25331e31b8aSbellard 	int f_namelen;
25431e31b8aSbellard 	int f_spare[6];
25531e31b8aSbellard };
25631e31b8aSbellard 
257dab2ed99Sbellard struct target_dirent {
258992f48a0Sblueswir1 	abi_long	d_ino;
259992f48a0Sblueswir1 	abi_long	d_off;
260dab2ed99Sbellard 	unsigned short	d_reclen;
261dab2ed99Sbellard 	char		d_name[256]; /* We must not include limits.h! */
262dab2ed99Sbellard };
263dab2ed99Sbellard 
264dab2ed99Sbellard struct target_dirent64 {
265dab2ed99Sbellard 	uint64_t	d_ino;
266dab2ed99Sbellard 	int64_t		d_off;
267dab2ed99Sbellard 	unsigned short	d_reclen;
268dab2ed99Sbellard 	unsigned char	d_type;
269dab2ed99Sbellard 	char		d_name[256];
270dab2ed99Sbellard };
271dab2ed99Sbellard 
272dab2ed99Sbellard 
27331e31b8aSbellard /* mostly generic signal stuff */
274992f48a0Sblueswir1 #define TARGET_SIG_DFL	((abi_long)0)	/* default signal handling */
275992f48a0Sblueswir1 #define TARGET_SIG_IGN	((abi_long)1)	/* ignore signal */
276992f48a0Sblueswir1 #define TARGET_SIG_ERR	((abi_long)-1)	/* error return from signal */
27731e31b8aSbellard 
27831e31b8aSbellard #ifdef TARGET_MIPS
27931e31b8aSbellard #define TARGET_NSIG	   128
28031e31b8aSbellard #else
28131e31b8aSbellard #define TARGET_NSIG	   64
28231e31b8aSbellard #endif
283992f48a0Sblueswir1 #define TARGET_NSIG_BPW	   TARGET_ABI_BITS
28431e31b8aSbellard #define TARGET_NSIG_WORDS  (TARGET_NSIG / TARGET_NSIG_BPW)
28531e31b8aSbellard 
28631e31b8aSbellard typedef struct {
287992f48a0Sblueswir1     abi_ulong sig[TARGET_NSIG_WORDS];
288c227f099SAnthony Liguori } target_sigset_t;
28931e31b8aSbellard 
29066fb9763Sbellard #ifdef BSWAP_NEEDED
291c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
29266fb9763Sbellard {
29366fb9763Sbellard     int i;
29466fb9763Sbellard     for(i = 0;i < TARGET_NSIG_WORDS; i++)
295cbb21eedSMatthias Braun         d->sig[i] = tswapal(s->sig[i]);
29666fb9763Sbellard }
29766fb9763Sbellard #else
298c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
29966fb9763Sbellard {
30066fb9763Sbellard     *d = *s;
30166fb9763Sbellard }
30266fb9763Sbellard #endif
30366fb9763Sbellard 
304c227f099SAnthony Liguori static inline void target_siginitset(target_sigset_t *d, abi_ulong set)
30566fb9763Sbellard {
30666fb9763Sbellard     int i;
30766fb9763Sbellard     d->sig[0] = set;
30866fb9763Sbellard     for(i = 1;i < TARGET_NSIG_WORDS; i++)
30966fb9763Sbellard         d->sig[i] = 0;
31066fb9763Sbellard }
31166fb9763Sbellard 
312c227f099SAnthony Liguori void host_to_target_sigset(target_sigset_t *d, const sigset_t *s);
313c227f099SAnthony Liguori void target_to_host_sigset(sigset_t *d, const target_sigset_t *s);
314992f48a0Sblueswir1 void host_to_target_old_sigset(abi_ulong *old_sigset,
31566fb9763Sbellard                                const sigset_t *sigset);
31666fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset,
317992f48a0Sblueswir1                                const abi_ulong *old_sigset);
31866fb9763Sbellard struct target_sigaction;
31966fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act,
32066fb9763Sbellard                  struct target_sigaction *oact);
32166fb9763Sbellard 
322d2fbca94SGuan Xuetao #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \
323d2fbca94SGuan Xuetao     || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined(TARGET_SH4) \
324d2fbca94SGuan Xuetao     || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) \
325a4c075f1SUlrich Hecht     || defined(TARGET_MICROBLAZE) || defined(TARGET_UNICORE32) \
326a4c075f1SUlrich Hecht     || defined(TARGET_S390X)
3272521d698Sbellard 
328048f6b4dSbellard #if defined(TARGET_SPARC)
329048f6b4dSbellard #define TARGET_SA_NOCLDSTOP    8u
330048f6b4dSbellard #define TARGET_SA_NOCLDWAIT    0x100u
331048f6b4dSbellard #define TARGET_SA_SIGINFO      0x200u
332048f6b4dSbellard #define TARGET_SA_ONSTACK      1u
333048f6b4dSbellard #define TARGET_SA_RESTART      2u
334048f6b4dSbellard #define TARGET_SA_NODEFER      0x20u
335048f6b4dSbellard #define TARGET_SA_RESETHAND    4u
336048f6b4dSbellard #elif defined(TARGET_MIPS)
337048f6b4dSbellard #define TARGET_SA_NOCLDSTOP	0x00000001
338048f6b4dSbellard #define TARGET_SA_NOCLDWAIT	0x00010000
339048f6b4dSbellard #define TARGET_SA_SIGINFO	0x00000008
340048f6b4dSbellard #define TARGET_SA_ONSTACK	0x08000000
341048f6b4dSbellard #define TARGET_SA_NODEFER	0x40000000
342048f6b4dSbellard #define TARGET_SA_RESTART	0x10000000
343048f6b4dSbellard #define TARGET_SA_RESETHAND	0x80000000
344d26bc211Sths #if !defined(TARGET_ABI_MIPSN32) && !defined(TARGET_ABI_MIPSN64)
345d26bc211Sths #define TARGET_SA_RESTORER	0x04000000	/* Only for O32 */
346540635baSths #endif
34757f18a95SRichard Henderson #elif defined(TARGET_ALPHA)
34857f18a95SRichard Henderson #define TARGET_SA_ONSTACK	0x00000001
34957f18a95SRichard Henderson #define TARGET_SA_RESTART	0x00000002
35057f18a95SRichard Henderson #define TARGET_SA_NOCLDSTOP	0x00000004
35157f18a95SRichard Henderson #define TARGET_SA_NODEFER	0x00000008
35257f18a95SRichard Henderson #define TARGET_SA_RESETHAND	0x00000010
35357f18a95SRichard Henderson #define TARGET_SA_NOCLDWAIT	0x00000020 /* not supported yet */
35457f18a95SRichard Henderson #define TARGET_SA_SIGINFO	0x00000040
355048f6b4dSbellard #else
3562521d698Sbellard #define TARGET_SA_NOCLDSTOP	0x00000001
3572521d698Sbellard #define TARGET_SA_NOCLDWAIT	0x00000002 /* not supported yet */
3582521d698Sbellard #define TARGET_SA_SIGINFO	0x00000004
3592521d698Sbellard #define TARGET_SA_ONSTACK	0x08000000
3602521d698Sbellard #define TARGET_SA_RESTART	0x10000000
3612521d698Sbellard #define TARGET_SA_NODEFER	0x40000000
3622521d698Sbellard #define TARGET_SA_RESETHAND	0x80000000
3632521d698Sbellard #define TARGET_SA_RESTORER	0x04000000
3646d5e216dSbellard #endif
3656d5e216dSbellard 
3666d5e216dSbellard #if defined(TARGET_SPARC)
3676d5e216dSbellard 
3686d5e216dSbellard #define TARGET_SIGHUP		 1
3696d5e216dSbellard #define TARGET_SIGINT		 2
3706d5e216dSbellard #define TARGET_SIGQUIT		 3
3716d5e216dSbellard #define TARGET_SIGILL		 4
3726d5e216dSbellard #define TARGET_SIGTRAP		 5
3736d5e216dSbellard #define TARGET_SIGABRT		 6
3746d5e216dSbellard #define TARGET_SIGIOT		 6
3756d5e216dSbellard #define TARGET_SIGSTKFLT	 7 /* actually EMT */
3766d5e216dSbellard #define TARGET_SIGFPE		 8
3776d5e216dSbellard #define TARGET_SIGKILL		 9
3786d5e216dSbellard #define TARGET_SIGBUS		10
3796d5e216dSbellard #define TARGET_SIGSEGV		11
3806d5e216dSbellard #define TARGET_SIGSYS		12
3816d5e216dSbellard #define TARGET_SIGPIPE		13
3826d5e216dSbellard #define TARGET_SIGALRM		14
3836d5e216dSbellard #define TARGET_SIGTERM		15
3846d5e216dSbellard #define TARGET_SIGURG		16
3856d5e216dSbellard #define TARGET_SIGSTOP		17
3866d5e216dSbellard #define TARGET_SIGTSTP		18
3876d5e216dSbellard #define TARGET_SIGCONT		19
3886d5e216dSbellard #define TARGET_SIGCHLD		20
3896d5e216dSbellard #define TARGET_SIGTTIN		21
3906d5e216dSbellard #define TARGET_SIGTTOU		22
3916d5e216dSbellard #define TARGET_SIGIO		23
3926d5e216dSbellard #define TARGET_SIGXCPU		24
3936d5e216dSbellard #define TARGET_SIGXFSZ		25
3946d5e216dSbellard #define TARGET_SIGVTALRM	26
3956d5e216dSbellard #define TARGET_SIGPROF		27
3966d5e216dSbellard #define TARGET_SIGWINCH	        28
3976d5e216dSbellard #define TARGET_SIGPWR		29
3986d5e216dSbellard #define TARGET_SIGUSR1		30
3996d5e216dSbellard #define TARGET_SIGUSR2		31
4006d5e216dSbellard #define TARGET_SIGRTMIN         32
4016d5e216dSbellard 
4026d5e216dSbellard #define TARGET_SIG_BLOCK          0x01 /* for blocking signals */
4036d5e216dSbellard #define TARGET_SIG_UNBLOCK        0x02 /* for unblocking signals */
4046d5e216dSbellard #define TARGET_SIG_SETMASK        0x04 /* for setting the signal mask */
4056d5e216dSbellard 
406048f6b4dSbellard #elif defined(TARGET_MIPS)
407048f6b4dSbellard 
408048f6b4dSbellard #define TARGET_SIGHUP		 1	/* Hangup (POSIX).  */
409048f6b4dSbellard #define TARGET_SIGINT		 2	/* Interrupt (ANSI).  */
410048f6b4dSbellard #define TARGET_SIGQUIT		 3	/* Quit (POSIX).  */
411048f6b4dSbellard #define TARGET_SIGILL		 4	/* Illegal instruction (ANSI).  */
412048f6b4dSbellard #define TARGET_SIGTRAP		 5	/* Trace trap (POSIX).  */
413048f6b4dSbellard #define TARGET_SIGIOT		 6	/* IOT trap (4.2 BSD).  */
414048f6b4dSbellard #define TARGET_SIGABRT		 TARGET_SIGIOT	/* Abort (ANSI).  */
415048f6b4dSbellard #define TARGET_SIGEMT		 7
416048f6b4dSbellard #define TARGET_SIGSTKFLT	 7 /* XXX: incorrect */
417048f6b4dSbellard #define TARGET_SIGFPE		 8	/* Floating-point exception (ANSI).  */
418048f6b4dSbellard #define TARGET_SIGKILL		 9	/* Kill, unblockable (POSIX).  */
419048f6b4dSbellard #define TARGET_SIGBUS		10	/* BUS error (4.2 BSD).  */
420048f6b4dSbellard #define TARGET_SIGSEGV		11	/* Segmentation violation (ANSI).  */
421048f6b4dSbellard #define TARGET_SIGSYS		12
422048f6b4dSbellard #define TARGET_SIGPIPE		13	/* Broken pipe (POSIX).  */
423048f6b4dSbellard #define TARGET_SIGALRM		14	/* Alarm clock (POSIX).  */
424048f6b4dSbellard #define TARGET_SIGTERM		15	/* Termination (ANSI).  */
425048f6b4dSbellard #define TARGET_SIGUSR1		16	/* User-defined signal 1 (POSIX).  */
426048f6b4dSbellard #define TARGET_SIGUSR2		17	/* User-defined signal 2 (POSIX).  */
427048f6b4dSbellard #define TARGET_SIGCHLD		18	/* Child status has changed (POSIX).  */
428048f6b4dSbellard #define TARGET_SIGCLD		TARGET_SIGCHLD	/* Same as TARGET_SIGCHLD (System V).  */
429048f6b4dSbellard #define TARGET_SIGPWR		19	/* Power failure restart (System V).  */
430048f6b4dSbellard #define TARGET_SIGWINCH	20	/* Window size change (4.3 BSD, Sun).  */
431048f6b4dSbellard #define TARGET_SIGURG		21	/* Urgent condition on socket (4.2 BSD).  */
432048f6b4dSbellard #define TARGET_SIGIO		22	/* I/O now possible (4.2 BSD).  */
433048f6b4dSbellard #define TARGET_SIGPOLL		TARGET_SIGIO	/* Pollable event occurred (System V).  */
434048f6b4dSbellard #define TARGET_SIGSTOP		23	/* Stop, unblockable (POSIX).  */
435048f6b4dSbellard #define TARGET_SIGTSTP		24	/* Keyboard stop (POSIX).  */
436048f6b4dSbellard #define TARGET_SIGCONT		25	/* Continue (POSIX).  */
437048f6b4dSbellard #define TARGET_SIGTTIN		26	/* Background read from tty (POSIX).  */
438048f6b4dSbellard #define TARGET_SIGTTOU		27	/* Background write to tty (POSIX).  */
439048f6b4dSbellard #define TARGET_SIGVTALRM	28	/* Virtual alarm clock (4.2 BSD).  */
440048f6b4dSbellard #define TARGET_SIGPROF		29	/* Profiling alarm clock (4.2 BSD).  */
441048f6b4dSbellard #define TARGET_SIGXCPU		30	/* CPU limit exceeded (4.2 BSD).  */
442048f6b4dSbellard #define TARGET_SIGXFSZ		31	/* File size limit exceeded (4.2 BSD).  */
443048f6b4dSbellard #define TARGET_SIGRTMIN         32
444048f6b4dSbellard 
445048f6b4dSbellard #define TARGET_SIG_BLOCK	1	/* for blocking signals */
446048f6b4dSbellard #define TARGET_SIG_UNBLOCK	2	/* for unblocking signals */
447048f6b4dSbellard #define TARGET_SIG_SETMASK	3	/* for setting the signal mask */
448048f6b4dSbellard 
4496d5e216dSbellard #else
4502521d698Sbellard 
4512521d698Sbellard #define TARGET_SIGHUP		 1
4522521d698Sbellard #define TARGET_SIGINT		 2
4532521d698Sbellard #define TARGET_SIGQUIT		 3
4542521d698Sbellard #define TARGET_SIGILL		 4
4552521d698Sbellard #define TARGET_SIGTRAP		 5
4562521d698Sbellard #define TARGET_SIGABRT		 6
4572521d698Sbellard #define TARGET_SIGIOT		 6
4582521d698Sbellard #define TARGET_SIGBUS		 7
4592521d698Sbellard #define TARGET_SIGFPE		 8
4602521d698Sbellard #define TARGET_SIGKILL		 9
4612521d698Sbellard #define TARGET_SIGUSR1		10
4622521d698Sbellard #define TARGET_SIGSEGV		11
4632521d698Sbellard #define TARGET_SIGUSR2		12
4642521d698Sbellard #define TARGET_SIGPIPE		13
4652521d698Sbellard #define TARGET_SIGALRM		14
4662521d698Sbellard #define TARGET_SIGTERM		15
4672521d698Sbellard #define TARGET_SIGSTKFLT	16
4682521d698Sbellard #define TARGET_SIGCHLD		17
4692521d698Sbellard #define TARGET_SIGCONT		18
4702521d698Sbellard #define TARGET_SIGSTOP		19
4712521d698Sbellard #define TARGET_SIGTSTP		20
4722521d698Sbellard #define TARGET_SIGTTIN		21
4732521d698Sbellard #define TARGET_SIGTTOU		22
4742521d698Sbellard #define TARGET_SIGURG		23
4752521d698Sbellard #define TARGET_SIGXCPU		24
4762521d698Sbellard #define TARGET_SIGXFSZ		25
4772521d698Sbellard #define TARGET_SIGVTALRM	26
4782521d698Sbellard #define TARGET_SIGPROF		27
4792521d698Sbellard #define TARGET_SIGWINCH	        28
4802521d698Sbellard #define TARGET_SIGIO		29
481c596ed17Sbellard #define TARGET_SIGPWR		30
482c596ed17Sbellard #define TARGET_SIGSYS		31
4832521d698Sbellard #define TARGET_SIGRTMIN         32
4842521d698Sbellard 
4852521d698Sbellard #define TARGET_SIG_BLOCK          0    /* for blocking signals */
4862521d698Sbellard #define TARGET_SIG_UNBLOCK        1    /* for unblocking signals */
4872521d698Sbellard #define TARGET_SIG_SETMASK        2    /* for setting the signal mask */
4882521d698Sbellard 
4896d5e216dSbellard #endif
4906d5e216dSbellard 
4916049f4f8SRichard Henderson #if defined(TARGET_ALPHA)
4926049f4f8SRichard Henderson struct target_old_sigaction {
4936049f4f8SRichard Henderson     abi_ulong _sa_handler;
4946049f4f8SRichard Henderson     abi_ulong sa_mask;
4956049f4f8SRichard Henderson     abi_ulong sa_flags;
4966049f4f8SRichard Henderson };
497106ec879Sbellard 
4986049f4f8SRichard Henderson struct target_rt_sigaction {
4996049f4f8SRichard Henderson     abi_ulong _sa_handler;
5006049f4f8SRichard Henderson     abi_ulong sa_flags;
5016049f4f8SRichard Henderson     target_sigset_t sa_mask;
5026049f4f8SRichard Henderson };
5036049f4f8SRichard Henderson 
5046049f4f8SRichard Henderson /* This is the struct used inside the kernel.  The ka_restorer
5056049f4f8SRichard Henderson    field comes from the 5th argument to sys_rt_sigaction.  */
5066049f4f8SRichard Henderson struct target_sigaction {
5076049f4f8SRichard Henderson     abi_ulong _sa_handler;
5086049f4f8SRichard Henderson     abi_ulong sa_flags;
5096049f4f8SRichard Henderson     target_sigset_t sa_mask;
5106049f4f8SRichard Henderson     abi_ulong sa_restorer;
5116049f4f8SRichard Henderson };
5126049f4f8SRichard Henderson #elif defined(TARGET_MIPS)
513106ec879Sbellard struct target_sigaction {
514540635baSths 	uint32_t	sa_flags;
515d26bc211Sths #if defined(TARGET_ABI_MIPSN32)
516540635baSths 	uint32_t	_sa_handler;
517540635baSths #else
518992f48a0Sblueswir1 	abi_ulong	_sa_handler;
519540635baSths #endif
520c227f099SAnthony Liguori 	target_sigset_t	sa_mask;
521106ec879Sbellard };
522106ec879Sbellard #else
5232521d698Sbellard struct target_old_sigaction {
524992f48a0Sblueswir1         abi_ulong _sa_handler;
525992f48a0Sblueswir1         abi_ulong sa_mask;
526992f48a0Sblueswir1         abi_ulong sa_flags;
527992f48a0Sblueswir1         abi_ulong sa_restorer;
5282521d698Sbellard };
5292521d698Sbellard 
5302521d698Sbellard struct target_sigaction {
531992f48a0Sblueswir1         abi_ulong _sa_handler;
532992f48a0Sblueswir1         abi_ulong sa_flags;
533992f48a0Sblueswir1         abi_ulong sa_restorer;
534c227f099SAnthony Liguori         target_sigset_t sa_mask;
5352521d698Sbellard };
536106ec879Sbellard #endif
5372521d698Sbellard 
5382521d698Sbellard typedef union target_sigval {
5392521d698Sbellard 	int sival_int;
540992f48a0Sblueswir1         abi_ulong sival_ptr;
541c227f099SAnthony Liguori } target_sigval_t;
5426d5e216dSbellard #if 0
5436d5e216dSbellard #if defined (TARGET_SPARC)
5446d5e216dSbellard typedef struct {
5456d5e216dSbellard 	struct {
546992f48a0Sblueswir1 		abi_ulong psr;
547992f48a0Sblueswir1 		abi_ulong pc;
548992f48a0Sblueswir1 		abi_ulong npc;
549992f48a0Sblueswir1 		abi_ulong y;
550992f48a0Sblueswir1 		abi_ulong u_regs[16]; /* globals and ins */
5516d5e216dSbellard 	}		si_regs;
5526d5e216dSbellard 	int		si_mask;
5536d5e216dSbellard } __siginfo_t;
5546d5e216dSbellard 
5556d5e216dSbellard typedef struct {
5566d5e216dSbellard 	unsigned   long si_float_regs [32];
5576d5e216dSbellard 	unsigned   long si_fsr;
5586d5e216dSbellard 	unsigned   long si_fpqdepth;
5596d5e216dSbellard 	struct {
5606d5e216dSbellard 		unsigned long *insn_addr;
5616d5e216dSbellard 		unsigned long insn;
5626d5e216dSbellard 	} si_fpqueue [16];
5636d5e216dSbellard } __siginfo_fpu_t;
5646d5e216dSbellard #endif
5656d5e216dSbellard #endif
5662521d698Sbellard 
5672521d698Sbellard #define TARGET_SI_MAX_SIZE	128
5682521d698Sbellard #define TARGET_SI_PAD_SIZE	((TARGET_SI_MAX_SIZE/sizeof(int)) - 3)
5692521d698Sbellard 
5702521d698Sbellard typedef struct target_siginfo {
5713f53d546Spbrook #ifdef TARGET_MIPS
5723f53d546Spbrook 	int si_signo;
5733f53d546Spbrook 	int si_code;
5743f53d546Spbrook 	int si_errno;
5753f53d546Spbrook #else
5762521d698Sbellard 	int si_signo;
5772521d698Sbellard 	int si_errno;
5782521d698Sbellard 	int si_code;
5793f53d546Spbrook #endif
5802521d698Sbellard 
5812521d698Sbellard 	union {
5822521d698Sbellard 		int _pad[TARGET_SI_PAD_SIZE];
5832521d698Sbellard 
5842521d698Sbellard 		/* kill() */
5852521d698Sbellard 		struct {
5862521d698Sbellard 			pid_t _pid;		/* sender's pid */
5872521d698Sbellard 			uid_t _uid;		/* sender's uid */
5882521d698Sbellard 		} _kill;
5892521d698Sbellard 
5902521d698Sbellard 		/* POSIX.1b timers */
5912521d698Sbellard 		struct {
5922521d698Sbellard 			unsigned int _timer1;
5932521d698Sbellard 			unsigned int _timer2;
5942521d698Sbellard 		} _timer;
5952521d698Sbellard 
5962521d698Sbellard 		/* POSIX.1b signals */
5972521d698Sbellard 		struct {
5982521d698Sbellard 			pid_t _pid;		/* sender's pid */
5992521d698Sbellard 			uid_t _uid;		/* sender's uid */
600c227f099SAnthony Liguori 			target_sigval_t _sigval;
6012521d698Sbellard 		} _rt;
6022521d698Sbellard 
6032521d698Sbellard 		/* SIGCHLD */
6042521d698Sbellard 		struct {
6052521d698Sbellard 			pid_t _pid;		/* which child */
6062521d698Sbellard 			uid_t _uid;		/* sender's uid */
6072521d698Sbellard 			int _status;		/* exit code */
608c227f099SAnthony Liguori 			target_clock_t _utime;
609c227f099SAnthony Liguori                         target_clock_t _stime;
6102521d698Sbellard 		} _sigchld;
6112521d698Sbellard 
6122521d698Sbellard 		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
6132521d698Sbellard 		struct {
614992f48a0Sblueswir1 			abi_ulong _addr; /* faulting insn/memory ref. */
6152521d698Sbellard 		} _sigfault;
6162521d698Sbellard 
6172521d698Sbellard 		/* SIGPOLL */
6182521d698Sbellard 		struct {
6192521d698Sbellard 			int _band;	/* POLL_IN, POLL_OUT, POLL_MSG */
6202521d698Sbellard 			int _fd;
6212521d698Sbellard 		} _sigpoll;
6222521d698Sbellard 	} _sifields;
623c227f099SAnthony Liguori } target_siginfo_t;
6242521d698Sbellard 
6252521d698Sbellard /*
6262521d698Sbellard  * si_code values
6272521d698Sbellard  * Digital reserves positive values for kernel-generated signals.
6282521d698Sbellard  */
6292521d698Sbellard #define TARGET_SI_USER		0	/* sent by kill, sigsend, raise */
6302521d698Sbellard #define TARGET_SI_KERNEL	0x80	/* sent by the kernel from somewhere */
6312521d698Sbellard #define TARGET_SI_QUEUE	-1		/* sent by sigqueue */
6322521d698Sbellard #define TARGET_SI_TIMER -2              /* sent by timer expiration */
6332521d698Sbellard #define TARGET_SI_MESGQ	-3		/* sent by real time mesq state change */
6342521d698Sbellard #define TARGET_SI_ASYNCIO	-4	/* sent by AIO completion */
6352521d698Sbellard #define TARGET_SI_SIGIO	-5		/* sent by queued SIGIO */
6362521d698Sbellard 
6372521d698Sbellard /*
6382521d698Sbellard  * SIGILL si_codes
6392521d698Sbellard  */
640ffa65c3bSbellard #define TARGET_ILL_ILLOPC	(1)	/* illegal opcode */
6412521d698Sbellard #define TARGET_ILL_ILLOPN	(2)	/* illegal operand */
642ffa65c3bSbellard #define TARGET_ILL_ILLADR	(3)	/* illegal addressing mode */
643ffa65c3bSbellard #define TARGET_ILL_ILLTRP	(4)	/* illegal trap */
644ffa65c3bSbellard #define TARGET_ILL_PRVOPC	(5)	/* privileged opcode */
645ffa65c3bSbellard #define TARGET_ILL_PRVREG	(6)	/* privileged register */
646ffa65c3bSbellard #define TARGET_ILL_COPROC	(7)	/* coprocessor error */
647ffa65c3bSbellard #define TARGET_ILL_BADSTK	(8)	/* internal stack error */
6482521d698Sbellard 
6492521d698Sbellard /*
6502521d698Sbellard  * SIGFPE si_codes
6512521d698Sbellard  */
6522521d698Sbellard #define TARGET_FPE_INTDIV      (1)  /* integer divide by zero */
6532521d698Sbellard #define TARGET_FPE_INTOVF      (2)  /* integer overflow */
6542521d698Sbellard #define TARGET_FPE_FLTDIV      (3)  /* floating point divide by zero */
6552521d698Sbellard #define TARGET_FPE_FLTOVF      (4)  /* floating point overflow */
6562521d698Sbellard #define TARGET_FPE_FLTUND      (5)  /* floating point underflow */
6572521d698Sbellard #define TARGET_FPE_FLTRES      (6)  /* floating point inexact result */
6582521d698Sbellard #define TARGET_FPE_FLTINV      (7)  /* floating point invalid operation */
6592521d698Sbellard #define TARGET_FPE_FLTSUB      (8)  /* subscript out of range */
6602521d698Sbellard #define TARGET_NSIGFPE         8
6612521d698Sbellard 
6622521d698Sbellard /*
6632521d698Sbellard  * SIGSEGV si_codes
6642521d698Sbellard  */
6652521d698Sbellard #define TARGET_SEGV_MAPERR     (1)  /* address not mapped to object */
6662521d698Sbellard #define TARGET_SEGV_ACCERR     (2)  /* invalid permissions for mapped object */
6672521d698Sbellard 
6682521d698Sbellard /*
669ffa65c3bSbellard  * SIGBUS si_codes
670ffa65c3bSbellard  */
671ffa65c3bSbellard #define TARGET_BUS_ADRALN       (1)	/* invalid address alignment */
672b4916d7bSDong Xu Wang #define TARGET_BUS_ADRERR       (2)	/* non-existent physical address */
673ffa65c3bSbellard #define TARGET_BUS_OBJERR       (3)	/* object specific hardware error */
674ffa65c3bSbellard 
675ffa65c3bSbellard /*
6762521d698Sbellard  * SIGTRAP si_codes
6772521d698Sbellard  */
6782521d698Sbellard #define TARGET_TRAP_BRKPT	(1)	/* process breakpoint */
6792521d698Sbellard #define TARGET_TRAP_TRACE	(2)	/* process trace trap */
6802521d698Sbellard 
6812521d698Sbellard #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */
6822521d698Sbellard 
6839de5e440Sbellard struct target_rlimit {
684992f48a0Sblueswir1         abi_ulong   rlim_cur;
685992f48a0Sblueswir1         abi_ulong   rlim_max;
6869de5e440Sbellard };
6879de5e440Sbellard 
68881bbe906Stakasi-y@ops.dti.ne.jp #if defined(TARGET_ALPHA)
689e476492eSAurelien Jarno #define TARGET_RLIM_INFINITY	0x7fffffffffffffffull
6906cafd027SMatthias Braun #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32)
69181bbe906Stakasi-y@ops.dti.ne.jp #define TARGET_RLIM_INFINITY	0x7fffffffUL
69281bbe906Stakasi-y@ops.dti.ne.jp #else
69326b746dbSMatthias Braun #define TARGET_RLIM_INFINITY	((abi_ulong)-1)
69481bbe906Stakasi-y@ops.dti.ne.jp #endif
69581bbe906Stakasi-y@ops.dti.ne.jp 
696e22b7015SWesley W. Terpstra #if defined(TARGET_MIPS)
697e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU		0
698e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE		1
699e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA		2
700e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK		3
701e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE		4
702e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS		7
703e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC		8
704e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE		5
705e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK		9
706e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS		6
707e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS		10
708e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING	11
709e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE		12
710e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE		13
711e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO		14
712e22b7015SWesley W. Terpstra #else
713e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU		0
714e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE		1
715e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA		2
716e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK		3
717e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE		4
718e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS		5
7196cafd027SMatthias Braun #if defined(TARGET_SPARC)
7206cafd027SMatthias Braun #define TARGET_RLIMIT_NOFILE		6
7216cafd027SMatthias Braun #define TARGET_RLIMIT_NPROC		7
7226cafd027SMatthias Braun #else
723e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC		6
724e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE		7
7256cafd027SMatthias Braun #endif
726e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK		8
727e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS		9
728e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS		10
729e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING	11
730e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE		12
731e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE		13
732e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO		14
733e22b7015SWesley W. Terpstra #endif
734e22b7015SWesley W. Terpstra 
7359de5e440Sbellard struct target_pollfd {
7369de5e440Sbellard     int fd;           /* file descriptor */
7379de5e440Sbellard     short events;     /* requested events */
7389de5e440Sbellard     short revents;    /* returned events */
7399de5e440Sbellard };
7409de5e440Sbellard 
7418e5a0667Sbellard /* virtual terminal ioctls */
7420221cfcdSbellard #define TARGET_KIOCSOUND       0x4B2F	/* start sound generation (0 for off) */
7430221cfcdSbellard #define TARGET_KDMKTONE	       0x4B30	/* generate tone */
7448e5a0667Sbellard #define TARGET_KDGKBTYPE       0x4b33
745f7680a55SUlrich Hecht #define TARGET_KDSETMODE       0x4b3a
746f7680a55SUlrich Hecht #define TARGET_KDGKBMODE       0x4b44
747f7680a55SUlrich Hecht #define TARGET_KDSKBMODE       0x4b45
7480221cfcdSbellard #define TARGET_KDGKBENT	       0x4B46	/* gets one entry in translation table */
7490221cfcdSbellard #define TARGET_KDGKBSENT       0x4B48	/* gets one function key string entry */
750e6fe18fbSCédric VINCENT #define TARGET_KDGKBLED        0x4B64	/* get led flags (not lights) */
751e6fe18fbSCédric VINCENT #define TARGET_KDSKBLED        0x4B65	/* set led flags (not lights) */
752e6fe18fbSCédric VINCENT #define TARGET_KDGETLED        0x4B31	/* return current led state */
753e6fe18fbSCédric VINCENT #define TARGET_KDSETLED        0x4B32	/* set led state [lights, not flags] */
7548e5a0667Sbellard 
7552521d698Sbellard #define TARGET_SIOCATMARK      0x8905
7562521d698Sbellard 
75731e31b8aSbellard /* Networking ioctls */
75831e31b8aSbellard #define TARGET_SIOCADDRT       0x890B          /* add routing table entry */
75931e31b8aSbellard #define TARGET_SIOCDELRT       0x890C          /* delete routing table entry */
76031e31b8aSbellard #define TARGET_SIOCGIFNAME     0x8910          /* get iface name               */
76131e31b8aSbellard #define TARGET_SIOCSIFLINK     0x8911          /* set iface channel            */
76231e31b8aSbellard #define TARGET_SIOCGIFCONF     0x8912          /* get iface list               */
76331e31b8aSbellard #define TARGET_SIOCGIFFLAGS    0x8913          /* get flags                    */
76431e31b8aSbellard #define TARGET_SIOCSIFFLAGS    0x8914          /* set flags                    */
76531e31b8aSbellard #define TARGET_SIOCGIFADDR     0x8915          /* get PA address               */
76631e31b8aSbellard #define TARGET_SIOCSIFADDR     0x8916          /* set PA address               */
76731e31b8aSbellard #define TARGET_SIOCGIFDSTADDR  0x8917          /* get remote PA address        */
76831e31b8aSbellard #define TARGET_SIOCSIFDSTADDR  0x8918          /* set remote PA address        */
76931e31b8aSbellard #define TARGET_SIOCGIFBRDADDR  0x8919          /* get broadcast PA address     */
77031e31b8aSbellard #define TARGET_SIOCSIFBRDADDR  0x891a          /* set broadcast PA address     */
77131e31b8aSbellard #define TARGET_SIOCGIFNETMASK  0x891b          /* get network PA mask          */
77231e31b8aSbellard #define TARGET_SIOCSIFNETMASK  0x891c          /* set network PA mask          */
77331e31b8aSbellard #define TARGET_SIOCGIFMETRIC   0x891d          /* get metric                   */
77431e31b8aSbellard #define TARGET_SIOCSIFMETRIC   0x891e          /* set metric                   */
77531e31b8aSbellard #define TARGET_SIOCGIFMEM      0x891f          /* get memory address (BSD)     */
77631e31b8aSbellard #define TARGET_SIOCSIFMEM      0x8920          /* set memory address (BSD)     */
77731e31b8aSbellard #define TARGET_SIOCGIFMTU      0x8921          /* get MTU size                 */
77831e31b8aSbellard #define TARGET_SIOCSIFMTU      0x8922          /* set MTU size                 */
77931e31b8aSbellard #define TARGET_SIOCSIFHWADDR   0x8924          /* set hardware address (NI)    */
78031e31b8aSbellard #define TARGET_SIOCGIFENCAP    0x8925          /* get/set slip encapsulation   */
78131e31b8aSbellard #define TARGET_SIOCSIFENCAP    0x8926
78231e31b8aSbellard #define TARGET_SIOCGIFHWADDR   0x8927          /* Get hardware address         */
78331e31b8aSbellard #define TARGET_SIOCGIFSLAVE    0x8929          /* Driver slaving support       */
78431e31b8aSbellard #define TARGET_SIOCSIFSLAVE    0x8930
78531e31b8aSbellard #define TARGET_SIOCADDMULTI    0x8931          /* Multicast address lists      */
78631e31b8aSbellard #define TARGET_SIOCDELMULTI    0x8932
78731e31b8aSbellard 
78831e31b8aSbellard /* Bridging control calls */
78931e31b8aSbellard #define TARGET_SIOCGIFBR       0x8940          /* Bridging support             */
79031e31b8aSbellard #define TARGET_SIOCSIFBR       0x8941          /* Set bridging options         */
79131e31b8aSbellard 
79231e31b8aSbellard #define TARGET_SIOCGIFTXQLEN   0x8942          /* Get the tx queue length      */
79331e31b8aSbellard #define TARGET_SIOCSIFTXQLEN   0x8943          /* Set the tx queue length      */
79431e31b8aSbellard 
79531e31b8aSbellard /* ARP cache control calls. */
79631e31b8aSbellard #define TARGET_OLD_SIOCDARP    0x8950          /* old delete ARP table entry   */
79731e31b8aSbellard #define TARGET_OLD_SIOCGARP    0x8951          /* old get ARP table entry      */
79831e31b8aSbellard #define TARGET_OLD_SIOCSARP    0x8952          /* old set ARP table entry      */
79931e31b8aSbellard #define TARGET_SIOCDARP        0x8953          /* delete ARP table entry       */
80031e31b8aSbellard #define TARGET_SIOCGARP        0x8954          /* get ARP table entry          */
80131e31b8aSbellard #define TARGET_SIOCSARP        0x8955          /* set ARP table entry          */
80231e31b8aSbellard 
80331e31b8aSbellard /* RARP cache control calls. */
80431e31b8aSbellard #define TARGET_SIOCDRARP       0x8960          /* delete RARP table entry      */
80531e31b8aSbellard #define TARGET_SIOCGRARP       0x8961          /* get RARP table entry         */
80631e31b8aSbellard #define TARGET_SIOCSRARP       0x8962          /* set RARP table entry         */
80731e31b8aSbellard 
80831e31b8aSbellard /* Driver configuration calls */
80931e31b8aSbellard #define TARGET_SIOCGIFMAP      0x8970          /* Get device parameters        */
81031e31b8aSbellard #define TARGET_SIOCSIFMAP      0x8971          /* Set device parameters        */
81131e31b8aSbellard 
81231e31b8aSbellard /* DLCI configuration calls */
81331e31b8aSbellard #define TARGET_SIOCADDDLCI     0x8980          /* Create new DLCI device       */
81431e31b8aSbellard #define TARGET_SIOCDELDLCI     0x8981          /* Delete DLCI device           */
81531e31b8aSbellard 
81686fcd946SLaurent Vivier /* From <linux/wireless.h> */
81786fcd946SLaurent Vivier 
81886fcd946SLaurent Vivier #define TARGET_SIOCGIWNAME     0x8B01          /* get name == wireless protocol */
81931e31b8aSbellard 
82031e31b8aSbellard /* From <linux/fs.h> */
82131e31b8aSbellard 
82231e31b8aSbellard #define TARGET_BLKROSET   TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */
82331e31b8aSbellard #define TARGET_BLKROGET   TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */
82431e31b8aSbellard #define TARGET_BLKRRPART  TARGET_IO(0x12,95) /* re-read partition table */
82531e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */
82631e31b8aSbellard #define TARGET_BLKFLSBUF  TARGET_IO(0x12,97) /* flush buffer cache */
82731e31b8aSbellard #define TARGET_BLKRASET   TARGET_IO(0x12,98) /* Set read ahead for block device */
82831e31b8aSbellard #define TARGET_BLKRAGET   TARGET_IO(0x12,99) /* get current read ahead setting */
82931e31b8aSbellard #define TARGET_BLKFRASET  TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
83031e31b8aSbellard #define TARGET_BLKFRAGET  TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
83131e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
83231e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
83331e31b8aSbellard #define TARGET_BLKSSZGET  TARGET_IO(0x12,104)/* get block device sector size */
83431e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */
835*edafea13SAlexander Graf #define TARGET_BLKBSZGET  TARGET_IOR(0x12,112,int)
836*edafea13SAlexander Graf #define TARGET_BLKBSZSET  TARGET_IOW(0x12,113,int)
837*edafea13SAlexander Graf #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong)
838*edafea13SAlexander Graf                                              /* return device size in bytes
839*edafea13SAlexander Graf                                                 (u64 *arg) */
84031e31b8aSbellard #define TARGET_FIBMAP     TARGET_IO(0x00,1)  /* bmap access */
84131e31b8aSbellard #define TARGET_FIGETBSZ   TARGET_IO(0x00,2)  /* get the block size used for bmap */
842285da2b9SPeter Maydell #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap)
84331e31b8aSbellard 
84431e31b8aSbellard /* cdrom commands */
84531e31b8aSbellard #define TARGET_CDROMPAUSE		0x5301 /* Pause Audio Operation */
84631e31b8aSbellard #define TARGET_CDROMRESUME		0x5302 /* Resume paused Audio Operation */
84731e31b8aSbellard #define TARGET_CDROMPLAYMSF		0x5303 /* Play Audio MSF (struct cdrom_msf) */
84831e31b8aSbellard #define TARGET_CDROMPLAYTRKIND		0x5304 /* Play Audio Track/index
84931e31b8aSbellard                                            (struct cdrom_ti) */
85031e31b8aSbellard #define TARGET_CDROMREADTOCHDR		0x5305 /* Read TOC header
85131e31b8aSbellard                                            (struct cdrom_tochdr) */
85231e31b8aSbellard #define TARGET_CDROMREADTOCENTRY	0x5306 /* Read TOC entry
85331e31b8aSbellard                                            (struct cdrom_tocentry) */
85431e31b8aSbellard #define TARGET_CDROMSTOP		0x5307 /* Stop the cdrom drive */
85531e31b8aSbellard #define TARGET_CDROMSTART		0x5308 /* Start the cdrom drive */
85631e31b8aSbellard #define TARGET_CDROMEJECT		0x5309 /* Ejects the cdrom media */
85731e31b8aSbellard #define TARGET_CDROMVOLCTRL		0x530a /* Control output volume
85831e31b8aSbellard                                            (struct cdrom_volctrl) */
85931e31b8aSbellard #define TARGET_CDROMSUBCHNL		0x530b /* Read subchannel data
86031e31b8aSbellard                                            (struct cdrom_subchnl) */
86131e31b8aSbellard #define TARGET_CDROMREADMODE2		0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes)
86231e31b8aSbellard                                            (struct cdrom_read) */
86331e31b8aSbellard #define TARGET_CDROMREADMODE1		0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes)
86431e31b8aSbellard                                            (struct cdrom_read) */
86531e31b8aSbellard #define TARGET_CDROMREADAUDIO		0x530e /* (struct cdrom_read_audio) */
86631e31b8aSbellard #define TARGET_CDROMEJECT_SW		0x530f /* enable(1)/disable(0) auto-ejecting */
86731e31b8aSbellard #define TARGET_CDROMMULTISESSION	0x5310 /* Obtain the start-of-last-session
86831e31b8aSbellard                                            address of multi session disks
86931e31b8aSbellard                                            (struct cdrom_multisession) */
87031e31b8aSbellard #define TARGET_CDROM_GET_MCN		0x5311 /* Obtain the "Universal Product Code"
87131e31b8aSbellard                                            if available (struct cdrom_mcn) */
87231e31b8aSbellard #define TARGET_CDROM_GET_UPC		TARGET_CDROM_GET_MCN  /* This one is depricated,
873b4916d7bSDong Xu Wang                                           but here anyway for compatibility */
87431e31b8aSbellard #define TARGET_CDROMRESET		0x5312 /* hard-reset the drive */
87531e31b8aSbellard #define TARGET_CDROMVOLREAD		0x5313 /* Get the drive's volume setting
87631e31b8aSbellard                                           (struct cdrom_volctrl) */
87731e31b8aSbellard #define TARGET_CDROMREADRAW		0x5314	/* read data in raw mode (2352 Bytes)
87831e31b8aSbellard                                            (struct cdrom_read) */
87931e31b8aSbellard /*
88031e31b8aSbellard  * These ioctls are used only used in aztcd.c and optcd.c
88131e31b8aSbellard  */
88231e31b8aSbellard #define TARGET_CDROMREADCOOKED		0x5315	/* read data in cooked mode */
88331e31b8aSbellard #define TARGET_CDROMSEEK		0x5316  /* seek msf address */
88431e31b8aSbellard 
88531e31b8aSbellard /*
88631e31b8aSbellard  * This ioctl is only used by the scsi-cd driver.
88731e31b8aSbellard    It is for playing audio in logical block addressing mode.
88831e31b8aSbellard  */
88931e31b8aSbellard #define TARGET_CDROMPLAYBLK		0x5317	/* (struct cdrom_blk) */
89031e31b8aSbellard 
89131e31b8aSbellard /*
89231e31b8aSbellard  * These ioctls are only used in optcd.c
89331e31b8aSbellard  */
89431e31b8aSbellard #define TARGET_CDROMREADALL		0x5318	/* read all 2646 bytes */
89531e31b8aSbellard 
89631e31b8aSbellard /*
89731e31b8aSbellard  * These ioctls are (now) only in ide-cd.c for controlling
89831e31b8aSbellard  * drive spindown time.  They should be implemented in the
89931e31b8aSbellard  * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10,
90031e31b8aSbellard  * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE...
90131e31b8aSbellard  *  -Erik
90231e31b8aSbellard  */
90331e31b8aSbellard #define TARGET_CDROMGETSPINDOWN        0x531d
90431e31b8aSbellard #define TARGET_CDROMSETSPINDOWN        0x531e
90531e31b8aSbellard 
90631e31b8aSbellard /*
90731e31b8aSbellard  * These ioctls are implemented through the uniform CD-ROM driver
90831e31b8aSbellard  * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM
90931e31b8aSbellard  * drivers are eventually ported to the uniform CD-ROM driver interface.
91031e31b8aSbellard  */
91131e31b8aSbellard #define TARGET_CDROMCLOSETRAY		0x5319	/* pendant of CDROMEJECT */
91231e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS	0x5320  /* Set behavior options */
91331e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS	0x5321  /* Clear behavior options */
91431e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED	0x5322  /* Set the CD-ROM speed */
91531e31b8aSbellard #define TARGET_CDROM_SELECT_DISC	0x5323  /* Select disc (for juke-boxes) */
91631e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED	0x5325  /* Check is media changed  */
91731e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS	0x5326  /* Get tray position, etc. */
91831e31b8aSbellard #define TARGET_CDROM_DISC_STATUS	0x5327  /* Get disc type, etc. */
91931e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS    0x5328  /* Get number of slots */
92031e31b8aSbellard #define TARGET_CDROM_LOCKDOOR		0x5329  /* lock or unlock door */
92131e31b8aSbellard #define TARGET_CDROM_DEBUG		0x5330	/* Turn debug messages on/off */
92231e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY	0x5331	/* get capabilities */
92331e31b8aSbellard 
92431e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386.
92531e31b8aSbellard  * Future CDROM ioctls should be kept below 0x537F
92631e31b8aSbellard  */
92731e31b8aSbellard 
92831e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */
92931e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ        0x5382	/* set the audio buffer size */
93031e31b8aSbellard 					/* conflict with SCSI_IOCTL_GET_IDLUN */
93131e31b8aSbellard 
93231e31b8aSbellard /* DVD-ROM Specific ioctls */
93331e31b8aSbellard #define TARGET_DVD_READ_STRUCT		0x5390  /* Read structure */
93431e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT	0x5391  /* Write structure */
93531e31b8aSbellard #define TARGET_DVD_AUTH		0x5392  /* Authentication */
93631e31b8aSbellard 
93731e31b8aSbellard #define TARGET_CDROM_SEND_PACKET	0x5393	/* send a packet to the drive */
93831e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE	0x5394	/* get next writable block */
93931e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN	0x5395	/* get last block written on disc */
94031e31b8aSbellard 
94131e31b8aSbellard /* HD commands */
94231e31b8aSbellard 
94331e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
94431e31b8aSbellard #define TARGET_HDIO_GETGEO            0x0301  /* get device geometry */
94531e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR    0x0302  /* get current unmask setting */
94631e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT     0x0304  /* get current IDE blockmode setting */
94731e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS  0x0308  /* get keep-settings-on-reset flag */
94831e31b8aSbellard #define TARGET_HDIO_GET_32BIT         0x0309  /* get current io_32bit setting */
94931e31b8aSbellard #define TARGET_HDIO_GET_NOWERR        0x030a  /* get ignore-write-error flag */
95031e31b8aSbellard #define TARGET_HDIO_GET_DMA           0x030b  /* get use-dma flag */
9512521d698Sbellard #define TARGET_HDIO_GET_IDENTITY      0x030d  /* get IDE identification info */
95231e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD         0x031f  /* execute a special drive command */
95331e31b8aSbellard 
95431e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
95531e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT     0x0321  /* change IDE blockmode */
95631e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR    0x0322  /* permit other irqs during I/O */
95731e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS  0x0323  /* keep ioctl settings on reset */
95831e31b8aSbellard #define TARGET_HDIO_SET_32BIT         0x0324  /* change io_32bit flags */
95931e31b8aSbellard #define TARGET_HDIO_SET_NOWERR        0x0325  /* change ignore-write-error flag */
96031e31b8aSbellard #define TARGET_HDIO_SET_DMA           0x0326  /* change use-dma flag */
96131e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE      0x0327  /* reconfig interface to new speed */
9622521d698Sbellard 
963b8005914Sbalrog /* loop ioctls */
964b8005914Sbalrog #define TARGET_LOOP_SET_FD            0x4C00
965b8005914Sbalrog #define TARGET_LOOP_CLR_FD            0x4C01
966b8005914Sbalrog #define TARGET_LOOP_SET_STATUS        0x4C02
967b8005914Sbalrog #define TARGET_LOOP_GET_STATUS        0x4C03
968b8005914Sbalrog #define TARGET_LOOP_SET_STATUS64      0x4C04
969b8005914Sbalrog #define TARGET_LOOP_GET_STATUS64      0x4C05
970b8005914Sbalrog #define TARGET_LOOP_CHANGE_FD         0x4C06
9712521d698Sbellard 
972f7680a55SUlrich Hecht /* fb ioctls */
973f7680a55SUlrich Hecht #define TARGET_FBIOGET_VSCREENINFO    0x4600
974f7680a55SUlrich Hecht #define TARGET_FBIOPUT_VSCREENINFO    0x4601
975f7680a55SUlrich Hecht #define TARGET_FBIOGET_FSCREENINFO    0x4602
97612b81b71SCédric VINCENT #define TARGET_FBIOGETCMAP            0x4604
97712b81b71SCédric VINCENT #define TARGET_FBIOPUTCMAP            0x4605
97812b81b71SCédric VINCENT #define TARGET_FBIOPAN_DISPLAY        0x4606
97912b81b71SCédric VINCENT #define TARGET_FBIOGET_CON2FBMAP      0x460F
98012b81b71SCédric VINCENT #define TARGET_FBIOPUT_CON2FBMAP      0x4610
981f7680a55SUlrich Hecht 
982f7680a55SUlrich Hecht /* vt ioctls */
983f7680a55SUlrich Hecht #define TARGET_VT_OPENQRY             0x5600
984f7680a55SUlrich Hecht #define TARGET_VT_GETSTATE            0x5603
985f7680a55SUlrich Hecht #define TARGET_VT_ACTIVATE            0x5606
986f7680a55SUlrich Hecht #define TARGET_VT_WAITACTIVE          0x5607
987f7680a55SUlrich Hecht #define TARGET_VT_LOCKSWITCH          0x560b
988f7680a55SUlrich Hecht #define TARGET_VT_UNLOCKSWITCH        0x560c
989774750c0SCédric VINCENT #define TARGET_VT_GETMODE             0x5601
990774750c0SCédric VINCENT #define TARGET_VT_SETMODE             0x5602
991774750c0SCédric VINCENT #define TARGET_VT_RELDISP             0x5605
992774750c0SCédric VINCENT #define TARGET_VT_DISALLOCATE         0x5608
993f7680a55SUlrich Hecht 
99456e904ecSAlexander Graf /* device mapper */
99556e904ecSAlexander Graf #define TARGET_DM_VERSION             TARGET_IOWRU(0xfd, 0x00)
99656e904ecSAlexander Graf #define TARGET_DM_REMOVE_ALL          TARGET_IOWRU(0xfd, 0x01)
99756e904ecSAlexander Graf #define TARGET_DM_LIST_DEVICES        TARGET_IOWRU(0xfd, 0x02)
99856e904ecSAlexander Graf #define TARGET_DM_DEV_CREATE          TARGET_IOWRU(0xfd, 0x03)
99956e904ecSAlexander Graf #define TARGET_DM_DEV_REMOVE          TARGET_IOWRU(0xfd, 0x04)
100056e904ecSAlexander Graf #define TARGET_DM_DEV_RENAME          TARGET_IOWRU(0xfd, 0x05)
100156e904ecSAlexander Graf #define TARGET_DM_DEV_SUSPEND         TARGET_IOWRU(0xfd, 0x06)
100256e904ecSAlexander Graf #define TARGET_DM_DEV_STATUS          TARGET_IOWRU(0xfd, 0x07)
100356e904ecSAlexander Graf #define TARGET_DM_DEV_WAIT            TARGET_IOWRU(0xfd, 0x08)
100456e904ecSAlexander Graf #define TARGET_DM_TABLE_LOAD          TARGET_IOWRU(0xfd, 0x09)
100556e904ecSAlexander Graf #define TARGET_DM_TABLE_CLEAR         TARGET_IOWRU(0xfd, 0x0a)
100656e904ecSAlexander Graf #define TARGET_DM_TABLE_DEPS          TARGET_IOWRU(0xfd, 0x0b)
100756e904ecSAlexander Graf #define TARGET_DM_TABLE_STATUS        TARGET_IOWRU(0xfd, 0x0c)
100856e904ecSAlexander Graf #define TARGET_DM_LIST_VERSIONS       TARGET_IOWRU(0xfd, 0x0d)
100956e904ecSAlexander Graf #define TARGET_DM_TARGET_MSG          TARGET_IOWRU(0xfd, 0x0e)
101056e904ecSAlexander Graf #define TARGET_DM_DEV_SET_GEOMETRY    TARGET_IOWRU(0xfd, 0x0f)
101156e904ecSAlexander Graf 
10122521d698Sbellard /* from asm/termbits.h */
10132521d698Sbellard 
10143bfd9da1Sbellard #define TARGET_NCC 8
10153bfd9da1Sbellard struct target_termio {
10163bfd9da1Sbellard 	unsigned short c_iflag;		/* input mode flags */
10173bfd9da1Sbellard 	unsigned short c_oflag;		/* output mode flags */
10183bfd9da1Sbellard 	unsigned short c_cflag;		/* control mode flags */
10193bfd9da1Sbellard 	unsigned short c_lflag;		/* local mode flags */
10202521d698Sbellard 	unsigned char c_line;		/* line discipline */
10213bfd9da1Sbellard 	unsigned char c_cc[TARGET_NCC];	/* control characters */
10222521d698Sbellard };
10232521d698Sbellard 
10243bfd9da1Sbellard struct target_winsize {
10253bfd9da1Sbellard 	unsigned short ws_row;
10263bfd9da1Sbellard 	unsigned short ws_col;
10273bfd9da1Sbellard 	unsigned short ws_xpixel;
10283bfd9da1Sbellard 	unsigned short ws_ypixel;
10293bfd9da1Sbellard };
10302521d698Sbellard 
10313bfd9da1Sbellard #include "termbits.h"
10322521d698Sbellard 
10339e0b74a4SPaul Brook #if defined(TARGET_MIPS)
10349e0b74a4SPaul Brook #define TARGET_PROT_SEM         0x10
10359e0b74a4SPaul Brook #else
10369e0b74a4SPaul Brook #define TARGET_PROT_SEM         0x08
10379e0b74a4SPaul Brook #endif
10389e0b74a4SPaul Brook 
1039e44a3e79Saurel32 /* Common */
10402521d698Sbellard #define TARGET_MAP_SHARED	0x01		/* Share changes */
10412521d698Sbellard #define TARGET_MAP_PRIVATE	0x02		/* Changes are private */
10422521d698Sbellard #define TARGET_MAP_TYPE		0x0f		/* Mask for type of mapping */
1043e44a3e79Saurel32 
1044e44a3e79Saurel32 /* Target specific */
1045048f6b4dSbellard #if defined(TARGET_MIPS)
1046e44a3e79Saurel32 #define TARGET_MAP_FIXED	0x10		/* Interpret addr exactly */
1047048f6b4dSbellard #define TARGET_MAP_ANONYMOUS	0x0800		/* don't use a file */
1048048f6b4dSbellard #define TARGET_MAP_GROWSDOWN	0x1000		/* stack-like segment */
1049048f6b4dSbellard #define TARGET_MAP_DENYWRITE	0x2000		/* ETXTBSY */
1050048f6b4dSbellard #define TARGET_MAP_EXECUTABLE	0x4000		/* mark it as an executable */
1051048f6b4dSbellard #define TARGET_MAP_LOCKED	0x8000		/* pages are locked */
1052048f6b4dSbellard #define TARGET_MAP_NORESERVE	0x0400		/* don't check for reservations */
1053540635baSths #define TARGET_MAP_POPULATE	0x10000		/* populate (prefault) pagetables */
1054540635baSths #define TARGET_MAP_NONBLOCK	0x20000		/* do not block on IO */
1055e44a3e79Saurel32 #elif defined(TARGET_PPC)
1056e44a3e79Saurel32 #define TARGET_MAP_FIXED	0x10		/* Interpret addr exactly */
10572521d698Sbellard #define TARGET_MAP_ANONYMOUS	0x20		/* don't use a file */
10582521d698Sbellard #define TARGET_MAP_GROWSDOWN	0x0100		/* stack-like segment */
10592521d698Sbellard #define TARGET_MAP_DENYWRITE	0x0800		/* ETXTBSY */
10602521d698Sbellard #define TARGET_MAP_EXECUTABLE	0x1000		/* mark it as an executable */
10617ec93196Sj_mayer #define TARGET_MAP_LOCKED	0x0080		/* pages are locked */
10627ec93196Sj_mayer #define TARGET_MAP_NORESERVE	0x0040		/* don't check for reservations */
1063e44a3e79Saurel32 #define TARGET_MAP_POPULATE	0x8000		/* populate (prefault) pagetables */
1064e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK	0x10000		/* do not block on IO */
1065e44a3e79Saurel32 #elif defined(TARGET_ALPHA)
1066e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS	0x10		/* don't use a file */
1067e44a3e79Saurel32 #define TARGET_MAP_FIXED	0x100		/* Interpret addr exactly */
1068e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN	0x01000		/* stack-like segment */
1069e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE	0x02000		/* ETXTBSY */
1070e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE	0x04000		/* mark it as an executable */
1071e44a3e79Saurel32 #define TARGET_MAP_LOCKED	0x08000		/* lock the mapping */
1072e44a3e79Saurel32 #define TARGET_MAP_NORESERVE	0x10000		/* no check for reservations */
1073e44a3e79Saurel32 #define TARGET_MAP_POPULATE	0x20000		/* pop (prefault) pagetables */
1074e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK	0x40000		/* do not block on IO */
10757ec93196Sj_mayer #else
1076e44a3e79Saurel32 #define TARGET_MAP_FIXED	0x10		/* Interpret addr exactly */
1077e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS	0x20		/* don't use a file */
1078e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN	0x0100		/* stack-like segment */
1079e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE	0x0800		/* ETXTBSY */
1080e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE	0x1000		/* mark it as an executable */
10812521d698Sbellard #define TARGET_MAP_LOCKED	0x2000		/* pages are locked */
10822521d698Sbellard #define TARGET_MAP_NORESERVE	0x4000		/* don't check for reservations */
1083540635baSths #define TARGET_MAP_POPULATE	0x8000		/* populate (prefault) pagetables */
1084540635baSths #define TARGET_MAP_NONBLOCK	0x10000		/* do not block on IO */
1085906c1b8eSMike Frysinger #define TARGET_MAP_UNINITIALIZED 0x4000000	/* for anonymous mmap, memory could be uninitialized */
10867ec93196Sj_mayer #endif
10872521d698Sbellard 
1088d2fbca94SGuan Xuetao #if (defined(TARGET_I386) && defined(TARGET_ABI32)) || defined(TARGET_ARM) \
1089d2fbca94SGuan Xuetao     || defined(TARGET_CRIS) || defined(TARGET_UNICORE32)
10902521d698Sbellard struct target_stat {
10912521d698Sbellard 	unsigned short st_dev;
10922521d698Sbellard 	unsigned short __pad1;
1093992f48a0Sblueswir1 	abi_ulong st_ino;
10942521d698Sbellard 	unsigned short st_mode;
10952521d698Sbellard 	unsigned short st_nlink;
10962521d698Sbellard 	unsigned short st_uid;
10972521d698Sbellard 	unsigned short st_gid;
10982521d698Sbellard 	unsigned short st_rdev;
10992521d698Sbellard 	unsigned short __pad2;
1100992f48a0Sblueswir1 	abi_ulong  st_size;
1101992f48a0Sblueswir1 	abi_ulong  st_blksize;
1102992f48a0Sblueswir1 	abi_ulong  st_blocks;
1103992f48a0Sblueswir1 	abi_ulong  target_st_atime;
1104992f48a0Sblueswir1 	abi_ulong  __unused1;
1105992f48a0Sblueswir1 	abi_ulong  target_st_mtime;
1106992f48a0Sblueswir1 	abi_ulong  __unused2;
1107992f48a0Sblueswir1 	abi_ulong  target_st_ctime;
1108992f48a0Sblueswir1 	abi_ulong  __unused3;
1109992f48a0Sblueswir1 	abi_ulong  __unused4;
1110992f48a0Sblueswir1 	abi_ulong  __unused5;
11112521d698Sbellard };
11122521d698Sbellard 
11132521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely
11142521d698Sbellard  * insane amounts of padding around dev_t's.
11152521d698Sbellard  */
11162521d698Sbellard struct target_stat64 {
11172521d698Sbellard 	unsigned short	st_dev;
11182521d698Sbellard 	unsigned char	__pad0[10];
11192521d698Sbellard 
11202521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO	1
1121992f48a0Sblueswir1 	abi_ulong	__st_ino;
11222521d698Sbellard 
11232521d698Sbellard 	unsigned int	st_mode;
11242521d698Sbellard 	unsigned int	st_nlink;
11252521d698Sbellard 
1126992f48a0Sblueswir1 	abi_ulong	st_uid;
1127992f48a0Sblueswir1 	abi_ulong	st_gid;
11282521d698Sbellard 
11292521d698Sbellard 	unsigned short	st_rdev;
11302521d698Sbellard 	unsigned char	__pad3[10];
11312521d698Sbellard 
11322521d698Sbellard 	long long	st_size;
1133992f48a0Sblueswir1 	abi_ulong	st_blksize;
11342521d698Sbellard 
1135992f48a0Sblueswir1 	abi_ulong	st_blocks;	/* Number 512-byte blocks allocated. */
1136992f48a0Sblueswir1 	abi_ulong	__pad4;		/* future possible st_blocks high bits */
11372521d698Sbellard 
1138992f48a0Sblueswir1 	abi_ulong	target_st_atime;
1139992f48a0Sblueswir1 	abi_ulong	__pad5;
11402521d698Sbellard 
1141992f48a0Sblueswir1 	abi_ulong	target_st_mtime;
1142992f48a0Sblueswir1 	abi_ulong	__pad6;
11432521d698Sbellard 
1144992f48a0Sblueswir1 	abi_ulong	target_st_ctime;
1145992f48a0Sblueswir1 	abi_ulong	__pad7;		/* will be high 32 bits of ctime someday */
11462521d698Sbellard 
11472521d698Sbellard 	unsigned long long	st_ino;
1148541dc0d4SStefan Weil } QEMU_PACKED;
11492521d698Sbellard 
1150ce4defa0Spbrook #ifdef TARGET_ARM
1151ce4defa0Spbrook struct target_eabi_stat64 {
1152ce4defa0Spbrook         unsigned long long st_dev;
1153ce4defa0Spbrook         unsigned int    __pad1;
1154992f48a0Sblueswir1         abi_ulong    __st_ino;
1155ce4defa0Spbrook         unsigned int    st_mode;
1156ce4defa0Spbrook         unsigned int    st_nlink;
1157ce4defa0Spbrook 
1158992f48a0Sblueswir1         abi_ulong    st_uid;
1159992f48a0Sblueswir1         abi_ulong    st_gid;
1160ce4defa0Spbrook 
1161ce4defa0Spbrook         unsigned long long st_rdev;
1162ce4defa0Spbrook         unsigned int    __pad2[2];
1163ce4defa0Spbrook 
1164ce4defa0Spbrook         long long       st_size;
1165992f48a0Sblueswir1         abi_ulong    st_blksize;
1166ce4defa0Spbrook         unsigned int    __pad3;
1167ce4defa0Spbrook         unsigned long long st_blocks;
1168ce4defa0Spbrook 
1169992f48a0Sblueswir1         abi_ulong    target_st_atime;
1170992f48a0Sblueswir1         abi_ulong    target_st_atime_nsec;
1171ce4defa0Spbrook 
1172992f48a0Sblueswir1         abi_ulong    target_st_mtime;
1173992f48a0Sblueswir1         abi_ulong    target_st_mtime_nsec;
1174ce4defa0Spbrook 
1175992f48a0Sblueswir1         abi_ulong    target_st_ctime;
1176992f48a0Sblueswir1         abi_ulong    target_st_ctime_nsec;
1177ce4defa0Spbrook 
1178ce4defa0Spbrook         unsigned long long st_ino;
1179541dc0d4SStefan Weil } QEMU_PACKED;
1180ce4defa0Spbrook #endif
1181ce4defa0Spbrook 
1182992f48a0Sblueswir1 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
11831b8dd648Sblueswir1 struct target_stat {
11841b8dd648Sblueswir1 	unsigned int	st_dev;
1185992f48a0Sblueswir1 	abi_ulong	st_ino;
11861b8dd648Sblueswir1 	unsigned int	st_mode;
11871b8dd648Sblueswir1 	unsigned int	st_nlink;
11881b8dd648Sblueswir1 	unsigned int	st_uid;
11891b8dd648Sblueswir1 	unsigned int	st_gid;
11901b8dd648Sblueswir1 	unsigned int	st_rdev;
1191992f48a0Sblueswir1 	abi_long	st_size;
1192992f48a0Sblueswir1 	abi_long	target_st_atime;
1193992f48a0Sblueswir1 	abi_long	target_st_mtime;
1194992f48a0Sblueswir1 	abi_long	target_st_ctime;
1195992f48a0Sblueswir1 	abi_long	st_blksize;
1196992f48a0Sblueswir1 	abi_long	st_blocks;
1197992f48a0Sblueswir1 	abi_ulong	__unused4[2];
11981b8dd648Sblueswir1 };
11991b8dd648Sblueswir1 
12001b8dd648Sblueswir1 struct target_stat64 {
12011b8dd648Sblueswir1 	unsigned char	__pad0[6];
12021b8dd648Sblueswir1 	unsigned short	st_dev;
12031b8dd648Sblueswir1 
12041b8dd648Sblueswir1 	uint64_t	st_ino;
12051b8dd648Sblueswir1 	uint64_t	st_nlink;
12061b8dd648Sblueswir1 
12071b8dd648Sblueswir1 	unsigned int	st_mode;
12081b8dd648Sblueswir1 
12091b8dd648Sblueswir1 	unsigned int	st_uid;
12101b8dd648Sblueswir1 	unsigned int	st_gid;
12111b8dd648Sblueswir1 
12121b8dd648Sblueswir1 	unsigned char	__pad2[6];
12131b8dd648Sblueswir1 	unsigned short	st_rdev;
12141b8dd648Sblueswir1 
12151b8dd648Sblueswir1         int64_t		st_size;
12161b8dd648Sblueswir1 	int64_t		st_blksize;
12171b8dd648Sblueswir1 
12181b8dd648Sblueswir1 	unsigned char	__pad4[4];
12191b8dd648Sblueswir1 	unsigned int	st_blocks;
12201b8dd648Sblueswir1 
1221992f48a0Sblueswir1 	abi_ulong	target_st_atime;
1222992f48a0Sblueswir1 	abi_ulong	__unused1;
12231b8dd648Sblueswir1 
1224992f48a0Sblueswir1 	abi_ulong	target_st_mtime;
1225992f48a0Sblueswir1 	abi_ulong	__unused2;
12261b8dd648Sblueswir1 
1227992f48a0Sblueswir1 	abi_ulong	target_st_ctime;
1228992f48a0Sblueswir1 	abi_ulong	__unused3;
12291b8dd648Sblueswir1 
1230992f48a0Sblueswir1 	abi_ulong	__unused4[3];
12311b8dd648Sblueswir1 };
12321b8dd648Sblueswir1 
12333bfd9da1Sbellard #elif defined(TARGET_SPARC)
12343bfd9da1Sbellard 
12353bfd9da1Sbellard struct target_stat {
12363bfd9da1Sbellard 	unsigned short	st_dev;
1237992f48a0Sblueswir1 	abi_ulong	st_ino;
12383bfd9da1Sbellard 	unsigned short	st_mode;
12393bfd9da1Sbellard 	short		st_nlink;
12403bfd9da1Sbellard 	unsigned short	st_uid;
12413bfd9da1Sbellard 	unsigned short	st_gid;
12423bfd9da1Sbellard 	unsigned short	st_rdev;
1243992f48a0Sblueswir1 	abi_long	st_size;
1244992f48a0Sblueswir1 	abi_long	target_st_atime;
1245992f48a0Sblueswir1 	abi_ulong	__unused1;
1246992f48a0Sblueswir1 	abi_long	target_st_mtime;
1247992f48a0Sblueswir1 	abi_ulong	__unused2;
1248992f48a0Sblueswir1 	abi_long	target_st_ctime;
1249992f48a0Sblueswir1 	abi_ulong	__unused3;
1250992f48a0Sblueswir1 	abi_long	st_blksize;
1251992f48a0Sblueswir1 	abi_long	st_blocks;
1252992f48a0Sblueswir1 	abi_ulong	__unused4[2];
12533bfd9da1Sbellard };
12543bfd9da1Sbellard 
12553bfd9da1Sbellard struct target_stat64 {
12563bfd9da1Sbellard 	unsigned char	__pad0[6];
12573bfd9da1Sbellard 	unsigned short	st_dev;
12583bfd9da1Sbellard 
12593bfd9da1Sbellard 	uint64_t st_ino;
12603bfd9da1Sbellard 
12613bfd9da1Sbellard 	unsigned int	st_mode;
12623bfd9da1Sbellard 	unsigned int	st_nlink;
12633bfd9da1Sbellard 
12643bfd9da1Sbellard 	unsigned int	st_uid;
12653bfd9da1Sbellard 	unsigned int	st_gid;
12663bfd9da1Sbellard 
12673bfd9da1Sbellard 	unsigned char	__pad2[6];
12683bfd9da1Sbellard 	unsigned short	st_rdev;
12693bfd9da1Sbellard 
12703bfd9da1Sbellard 	unsigned char	__pad3[8];
12713bfd9da1Sbellard 
12723bfd9da1Sbellard         int64_t	st_size;
12733bfd9da1Sbellard 	unsigned int	st_blksize;
12743bfd9da1Sbellard 
12753bfd9da1Sbellard 	unsigned char	__pad4[8];
12763bfd9da1Sbellard 	unsigned int	st_blocks;
12773bfd9da1Sbellard 
12783bfd9da1Sbellard 	unsigned int	target_st_atime;
12793bfd9da1Sbellard 	unsigned int	__unused1;
12803bfd9da1Sbellard 
12813bfd9da1Sbellard 	unsigned int	target_st_mtime;
12823bfd9da1Sbellard 	unsigned int	__unused2;
12833bfd9da1Sbellard 
12843bfd9da1Sbellard 	unsigned int	target_st_ctime;
12853bfd9da1Sbellard 	unsigned int	__unused3;
12863bfd9da1Sbellard 
12873bfd9da1Sbellard 	unsigned int	__unused4;
12883bfd9da1Sbellard 	unsigned int	__unused5;
12893bfd9da1Sbellard };
12903bfd9da1Sbellard 
129167867308Sbellard #elif defined(TARGET_PPC)
129267867308Sbellard 
129367867308Sbellard struct target_stat {
1294e32448e0Sj_mayer 	abi_ulong st_dev;
1295992f48a0Sblueswir1 	abi_ulong st_ino;
1296325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
1297e32448e0Sj_mayer 	abi_ulong st_nlink;
1298325e651fSj_mayer 	unsigned int st_mode;
1299325e651fSj_mayer #else
130067867308Sbellard 	unsigned int st_mode;
130167867308Sbellard 	unsigned short st_nlink;
1302325e651fSj_mayer #endif
130367867308Sbellard 	unsigned int st_uid;
130467867308Sbellard 	unsigned int st_gid;
1305e32448e0Sj_mayer 	abi_ulong  st_rdev;
1306992f48a0Sblueswir1 	abi_ulong  st_size;
1307992f48a0Sblueswir1 	abi_ulong  st_blksize;
1308992f48a0Sblueswir1 	abi_ulong  st_blocks;
1309992f48a0Sblueswir1 	abi_ulong  target_st_atime;
1310e32448e0Sj_mayer 	abi_ulong  target_st_atime_nsec;
1311992f48a0Sblueswir1 	abi_ulong  target_st_mtime;
1312e32448e0Sj_mayer 	abi_ulong  target_st_mtime_nsec;
1313992f48a0Sblueswir1 	abi_ulong  target_st_ctime;
1314e32448e0Sj_mayer 	abi_ulong  target_st_ctime_nsec;
1315992f48a0Sblueswir1 	abi_ulong  __unused4;
1316992f48a0Sblueswir1 	abi_ulong  __unused5;
1317325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
1318325e651fSj_mayer 	abi_ulong  __unused6;
1319325e651fSj_mayer #endif
132067867308Sbellard };
132167867308Sbellard 
1322541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 {
132367867308Sbellard 	unsigned long long st_dev;
132467867308Sbellard         unsigned long long st_ino;
132567867308Sbellard 	unsigned int st_mode;
132667867308Sbellard 	unsigned int st_nlink;
132767867308Sbellard 	unsigned int st_uid;
132867867308Sbellard 	unsigned int st_gid;
132967867308Sbellard 	unsigned long long st_rdev;
1330e1ce5e40Saurel32 	unsigned long long __pad0;
133167867308Sbellard 	long long      st_size;
1332e32448e0Sj_mayer 	int	       st_blksize;
1333e1ce5e40Saurel32 	unsigned int   __pad1;
133461322e91SMax Filippov 	long long      st_blocks;	/* Number 512-byte blocks allocated. */
1335e32448e0Sj_mayer 	int	       target_st_atime;
1336e32448e0Sj_mayer         unsigned int   target_st_atime_nsec;
1337e32448e0Sj_mayer 	int	       target_st_mtime;
1338e32448e0Sj_mayer         unsigned int   target_st_mtime_nsec;
1339e32448e0Sj_mayer 	int            target_st_ctime;
1340e32448e0Sj_mayer         unsigned int   target_st_ctime_nsec;
1341e32448e0Sj_mayer         unsigned int   __unused4;
1342e32448e0Sj_mayer         unsigned int   __unused5;
134367867308Sbellard };
134467867308Sbellard 
1345b779e29eSEdgar E. Iglesias #elif defined(TARGET_MICROBLAZE)
1346b779e29eSEdgar E. Iglesias 
1347b779e29eSEdgar E. Iglesias struct target_stat {
1348b779e29eSEdgar E. Iglesias 	abi_ulong st_dev;
1349b779e29eSEdgar E. Iglesias 	abi_ulong st_ino;
1350b779e29eSEdgar E. Iglesias 	unsigned int st_mode;
1351b779e29eSEdgar E. Iglesias 	unsigned short st_nlink;
1352b779e29eSEdgar E. Iglesias 	unsigned int st_uid;
1353b779e29eSEdgar E. Iglesias 	unsigned int st_gid;
1354b779e29eSEdgar E. Iglesias 	abi_ulong  st_rdev;
1355b779e29eSEdgar E. Iglesias 	abi_ulong  st_size;
1356b779e29eSEdgar E. Iglesias 	abi_ulong  st_blksize;
1357b779e29eSEdgar E. Iglesias 	abi_ulong  st_blocks;
1358b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_atime;
1359b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_atime_nsec;
1360b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_mtime;
1361b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_mtime_nsec;
1362b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_ctime;
1363b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_ctime_nsec;
1364b779e29eSEdgar E. Iglesias 	abi_ulong  __unused4;
1365b779e29eSEdgar E. Iglesias 	abi_ulong  __unused5;
1366b779e29eSEdgar E. Iglesias };
1367b779e29eSEdgar E. Iglesias 
1368b779e29eSEdgar E. Iglesias /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout...  */
1369541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 {
1370b779e29eSEdgar E. Iglesias 	uint64_t st_dev;
1371a523eb06SEdgar E. Iglesias #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
1372a523eb06SEdgar E. Iglesias 	uint32_t pad0;
1373a523eb06SEdgar E. Iglesias 	uint32_t __st_ino;
1374a523eb06SEdgar E. Iglesias 
1375b779e29eSEdgar E. Iglesias 	uint32_t st_mode;
1376b779e29eSEdgar E. Iglesias 	uint32_t st_nlink;
1377b779e29eSEdgar E. Iglesias 	uint32_t st_uid;
1378b779e29eSEdgar E. Iglesias 	uint32_t st_gid;
1379b779e29eSEdgar E. Iglesias 	uint64_t st_rdev;
138021ebeb23SEdgar E. Iglesias 	uint64_t __pad1;
1381b779e29eSEdgar E. Iglesias 
1382b779e29eSEdgar E. Iglesias 	int64_t  st_size;
1383b779e29eSEdgar E. Iglesias 	int32_t  st_blksize;
138421ebeb23SEdgar E. Iglesias 	uint32_t __pad2;
1385b779e29eSEdgar E. Iglesias 	int64_t st_blocks;	/* Number 512-byte blocks allocated. */
1386b779e29eSEdgar E. Iglesias 
1387b779e29eSEdgar E. Iglesias 	int	       target_st_atime;
1388b779e29eSEdgar E. Iglesias 	unsigned int   target_st_atime_nsec;
1389b779e29eSEdgar E. Iglesias 	int	       target_st_mtime;
1390b779e29eSEdgar E. Iglesias 	unsigned int   target_st_mtime_nsec;
1391b779e29eSEdgar E. Iglesias 	int            target_st_ctime;
1392b779e29eSEdgar E. Iglesias 	unsigned int   target_st_ctime_nsec;
1393a523eb06SEdgar E. Iglesias 	uint64_t st_ino;
1394b779e29eSEdgar E. Iglesias };
1395b779e29eSEdgar E. Iglesias 
1396e6e5906bSpbrook #elif defined(TARGET_M68K)
1397e6e5906bSpbrook 
1398e6e5906bSpbrook struct target_stat {
1399e6e5906bSpbrook 	unsigned short st_dev;
1400e6e5906bSpbrook 	unsigned short __pad1;
1401992f48a0Sblueswir1 	abi_ulong st_ino;
1402e6e5906bSpbrook 	unsigned short st_mode;
1403e6e5906bSpbrook 	unsigned short st_nlink;
1404e6e5906bSpbrook 	unsigned short st_uid;
1405e6e5906bSpbrook 	unsigned short st_gid;
1406e6e5906bSpbrook 	unsigned short st_rdev;
1407e6e5906bSpbrook 	unsigned short __pad2;
1408992f48a0Sblueswir1 	abi_ulong  st_size;
1409992f48a0Sblueswir1 	abi_ulong  st_blksize;
1410992f48a0Sblueswir1 	abi_ulong  st_blocks;
1411992f48a0Sblueswir1 	abi_ulong  target_st_atime;
1412992f48a0Sblueswir1 	abi_ulong  __unused1;
1413992f48a0Sblueswir1 	abi_ulong  target_st_mtime;
1414992f48a0Sblueswir1 	abi_ulong  __unused2;
1415992f48a0Sblueswir1 	abi_ulong  target_st_ctime;
1416992f48a0Sblueswir1 	abi_ulong  __unused3;
1417992f48a0Sblueswir1 	abi_ulong  __unused4;
1418992f48a0Sblueswir1 	abi_ulong  __unused5;
1419e6e5906bSpbrook };
1420e6e5906bSpbrook 
1421e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely
1422e6e5906bSpbrook  * insane amounts of padding around dev_t's.
1423e6e5906bSpbrook  */
1424e6e5906bSpbrook struct target_stat64 {
1425e6e5906bSpbrook 	unsigned long long	st_dev;
1426e6e5906bSpbrook 	unsigned char	__pad1[2];
1427e6e5906bSpbrook 
1428e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO	1
1429992f48a0Sblueswir1 	abi_ulong	__st_ino;
1430e6e5906bSpbrook 
1431e6e5906bSpbrook 	unsigned int	st_mode;
1432e6e5906bSpbrook 	unsigned int	st_nlink;
1433e6e5906bSpbrook 
1434992f48a0Sblueswir1 	abi_ulong	st_uid;
1435992f48a0Sblueswir1 	abi_ulong	st_gid;
1436e6e5906bSpbrook 
1437e6e5906bSpbrook 	unsigned long long	st_rdev;
1438e6e5906bSpbrook 	unsigned char	__pad3[2];
1439e6e5906bSpbrook 
1440e6e5906bSpbrook 	long long	st_size;
1441992f48a0Sblueswir1 	abi_ulong	st_blksize;
1442e6e5906bSpbrook 
1443992f48a0Sblueswir1 	abi_ulong	__pad4;		/* future possible st_blocks high bits */
1444992f48a0Sblueswir1 	abi_ulong	st_blocks;	/* Number 512-byte blocks allocated. */
1445e6e5906bSpbrook 
1446992f48a0Sblueswir1 	abi_ulong	target_st_atime;
1447992f48a0Sblueswir1 	abi_ulong	target_st_atime_nsec;
1448e6e5906bSpbrook 
1449992f48a0Sblueswir1 	abi_ulong	target_st_mtime;
1450992f48a0Sblueswir1 	abi_ulong	target_st_mtime_nsec;
1451e6e5906bSpbrook 
1452992f48a0Sblueswir1 	abi_ulong	target_st_ctime;
1453992f48a0Sblueswir1 	abi_ulong	target_st_ctime_nsec;
1454e6e5906bSpbrook 
1455e6e5906bSpbrook 	unsigned long long	st_ino;
1456541dc0d4SStefan Weil } QEMU_PACKED;
1457e6e5906bSpbrook 
1458d26bc211Sths #elif defined(TARGET_ABI_MIPSN64)
1459540635baSths 
1460540635baSths /* The memory layout is the same as of struct stat64 of the 32-bit kernel.  */
1461540635baSths struct target_stat {
1462540635baSths 	unsigned int		st_dev;
1463540635baSths 	unsigned int		st_pad0[3]; /* Reserved for st_dev expansion */
1464540635baSths 
1465992f48a0Sblueswir1 	abi_ulong		st_ino;
1466540635baSths 
1467540635baSths 	unsigned int		st_mode;
1468540635baSths 	unsigned int		st_nlink;
1469540635baSths 
1470540635baSths 	int			st_uid;
1471540635baSths 	int			st_gid;
1472540635baSths 
1473540635baSths 	unsigned int		st_rdev;
1474540635baSths 	unsigned int		st_pad1[3]; /* Reserved for st_rdev expansion */
1475540635baSths 
1476992f48a0Sblueswir1 	abi_ulong		st_size;
1477540635baSths 
1478540635baSths 	/*
1479540635baSths 	 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1480540635baSths 	 * but we don't have it under Linux.
1481540635baSths 	 */
1482540635baSths 	unsigned int		target_st_atime;
1483540635baSths 	unsigned int		target_st_atime_nsec;
1484540635baSths 
1485540635baSths 	unsigned int		target_st_mtime;
1486540635baSths 	unsigned int		target_st_mtime_nsec;
1487540635baSths 
1488540635baSths 	unsigned int		target_st_ctime;
1489540635baSths 	unsigned int		target_st_ctime_nsec;
1490540635baSths 
1491540635baSths 	unsigned int		st_blksize;
1492540635baSths 	unsigned int		st_pad2;
1493540635baSths 
1494992f48a0Sblueswir1 	abi_ulong		st_blocks;
1495540635baSths };
1496540635baSths 
1497d26bc211Sths #elif defined(TARGET_ABI_MIPSN32)
1498540635baSths 
1499540635baSths struct target_stat {
1500540635baSths 	unsigned	st_dev;
1501540635baSths 	int		st_pad1[3];		/* Reserved for network id */
1502540635baSths 	unsigned int	st_ino;
1503540635baSths 	unsigned int	st_mode;
1504540635baSths 	unsigned int	st_nlink;
1505540635baSths 	int		st_uid;
1506540635baSths 	int		st_gid;
1507540635baSths 	unsigned 	st_rdev;
1508540635baSths 	unsigned int	st_pad2[2];
1509540635baSths 	unsigned int	st_size;
1510540635baSths 	unsigned int	st_pad3;
1511540635baSths 	/*
1512540635baSths 	 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1513540635baSths 	 * but we don't have it under Linux.
1514540635baSths 	 */
1515540635baSths 	unsigned int		target_st_atime;
1516540635baSths 	unsigned int		target_st_atime_nsec;
1517540635baSths 	unsigned int		target_st_mtime;
1518540635baSths 	unsigned int		target_st_mtime_nsec;
1519540635baSths 	unsigned int		target_st_ctime;
1520540635baSths 	unsigned int		target_st_ctime_nsec;
1521540635baSths 	unsigned int		st_blksize;
1522540635baSths 	unsigned int		st_blocks;
1523540635baSths 	unsigned int		st_pad4[14];
1524540635baSths };
1525540635baSths 
1526540635baSths /*
1527540635baSths  * This matches struct stat64 in glibc2.1, hence the absolutely insane
1528540635baSths  * amounts of padding around dev_t's.  The memory layout is the same as of
1529540635baSths  * struct stat of the 64-bit kernel.
1530540635baSths  */
1531540635baSths 
1532540635baSths struct target_stat64 {
1533540635baSths 	unsigned int	st_dev;
1534540635baSths 	unsigned int	st_pad0[3];	/* Reserved for st_dev expansion  */
1535540635baSths 
1536540635baSths 	target_ulong	st_ino;
1537540635baSths 
1538540635baSths         unsigned int	st_mode;
1539540635baSths         unsigned int	st_nlink;
1540540635baSths 
1541540635baSths 	int		st_uid;
1542540635baSths 	int		st_gid;
1543540635baSths 
1544540635baSths 	unsigned int	st_rdev;
1545540635baSths 	unsigned int	st_pad1[3];	/* Reserved for st_rdev expansion  */
1546540635baSths 
1547540635baSths 	int		st_size;
1548540635baSths 
1549540635baSths 	/*
1550540635baSths 	 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1551540635baSths 	 * but we don't have it under Linux.
1552540635baSths 	 */
1553540635baSths 	int		target_st_atime;
1554540635baSths 	unsigned int	target_st_atime_nsec;	/* Reserved for st_atime expansion  */
1555540635baSths 
1556540635baSths 	int		target_st_mtime;
1557540635baSths 	unsigned int	target_st_mtime_nsec;	/* Reserved for st_mtime expansion  */
1558540635baSths 
1559540635baSths 	int		target_st_ctime;
1560540635baSths 	unsigned int	target_st_ctime_nsec;	/* Reserved for st_ctime expansion  */
1561540635baSths 
1562540635baSths 	unsigned int	st_blksize;
1563540635baSths 	unsigned int	st_pad2;
1564540635baSths 
1565540635baSths 	int		st_blocks;
1566540635baSths };
1567540635baSths 
1568d26bc211Sths #elif defined(TARGET_ABI_MIPSO32)
1569048f6b4dSbellard 
1570048f6b4dSbellard struct target_stat {
1571048f6b4dSbellard 	unsigned	st_dev;
1572992f48a0Sblueswir1 	abi_long	st_pad1[3];		/* Reserved for network id */
1573992f48a0Sblueswir1 	abi_ulong	st_ino;
1574048f6b4dSbellard 	unsigned int	st_mode;
1575048f6b4dSbellard 	unsigned int	st_nlink;
1576048f6b4dSbellard 	int		st_uid;
1577048f6b4dSbellard 	int		st_gid;
1578048f6b4dSbellard 	unsigned 	st_rdev;
1579992f48a0Sblueswir1 	abi_long	st_pad2[2];
1580992f48a0Sblueswir1 	abi_long	st_size;
1581992f48a0Sblueswir1 	abi_long	st_pad3;
1582048f6b4dSbellard 	/*
1583048f6b4dSbellard 	 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1584048f6b4dSbellard 	 * but we don't have it under Linux.
1585048f6b4dSbellard 	 */
1586992f48a0Sblueswir1 	abi_long		target_st_atime;
1587992f48a0Sblueswir1 	abi_long		target_st_atime_nsec;
1588992f48a0Sblueswir1 	abi_long		target_st_mtime;
1589992f48a0Sblueswir1 	abi_long		target_st_mtime_nsec;
1590992f48a0Sblueswir1 	abi_long		target_st_ctime;
1591992f48a0Sblueswir1 	abi_long		target_st_ctime_nsec;
1592992f48a0Sblueswir1 	abi_long		st_blksize;
1593992f48a0Sblueswir1 	abi_long		st_blocks;
1594992f48a0Sblueswir1 	abi_long		st_pad4[14];
1595048f6b4dSbellard };
1596048f6b4dSbellard 
1597048f6b4dSbellard /*
1598048f6b4dSbellard  * This matches struct stat64 in glibc2.1, hence the absolutely insane
1599048f6b4dSbellard  * amounts of padding around dev_t's.  The memory layout is the same as of
1600048f6b4dSbellard  * struct stat of the 64-bit kernel.
1601048f6b4dSbellard  */
1602048f6b4dSbellard 
1603048f6b4dSbellard struct target_stat64 {
1604992f48a0Sblueswir1 	abi_ulong	st_dev;
1605992f48a0Sblueswir1 	abi_ulong	st_pad0[3];	/* Reserved for st_dev expansion  */
1606048f6b4dSbellard 
1607048f6b4dSbellard 	uint64_t	st_ino;
1608048f6b4dSbellard 
1609048f6b4dSbellard         unsigned int	st_mode;
1610048f6b4dSbellard         unsigned int	st_nlink;
1611048f6b4dSbellard 
1612048f6b4dSbellard 	int		st_uid;
1613048f6b4dSbellard 	int		st_gid;
1614048f6b4dSbellard 
1615992f48a0Sblueswir1 	abi_ulong	st_rdev;
1616992f48a0Sblueswir1 	abi_ulong	st_pad1[3];	/* Reserved for st_rdev expansion  */
1617048f6b4dSbellard 
1618048f6b4dSbellard 	int64_t 	st_size;
1619048f6b4dSbellard 
1620048f6b4dSbellard 	/*
1621048f6b4dSbellard 	 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1622048f6b4dSbellard 	 * but we don't have it under Linux.
1623048f6b4dSbellard 	 */
1624992f48a0Sblueswir1 	abi_long	target_st_atime;
1625992f48a0Sblueswir1 	abi_ulong	target_st_atime_nsec;	/* Reserved for st_atime expansion  */
1626048f6b4dSbellard 
1627992f48a0Sblueswir1 	abi_long	target_st_mtime;
1628992f48a0Sblueswir1 	abi_ulong	target_st_mtime_nsec;	/* Reserved for st_mtime expansion  */
1629048f6b4dSbellard 
1630992f48a0Sblueswir1 	abi_long	target_st_ctime;
1631992f48a0Sblueswir1 	abi_ulong	target_st_ctime_nsec;	/* Reserved for st_ctime expansion  */
1632048f6b4dSbellard 
1633992f48a0Sblueswir1 	abi_ulong	st_blksize;
1634992f48a0Sblueswir1 	abi_ulong	st_pad2;
1635048f6b4dSbellard 
1636048f6b4dSbellard 	int64_t  	st_blocks;
1637048f6b4dSbellard };
16387a3148a9Sj_mayer 
16397a3148a9Sj_mayer #elif defined(TARGET_ALPHA)
16407a3148a9Sj_mayer 
16417a3148a9Sj_mayer struct target_stat {
16427a3148a9Sj_mayer        unsigned int    st_dev;
16437a3148a9Sj_mayer        unsigned int    st_ino;
16447a3148a9Sj_mayer        unsigned int    st_mode;
16457a3148a9Sj_mayer        unsigned int    st_nlink;
16467a3148a9Sj_mayer        unsigned int    st_uid;
16477a3148a9Sj_mayer        unsigned int    st_gid;
16487a3148a9Sj_mayer        unsigned int    st_rdev;
1649992f48a0Sblueswir1        abi_long     st_size;
1650992f48a0Sblueswir1        abi_ulong    target_st_atime;
1651992f48a0Sblueswir1        abi_ulong    target_st_mtime;
1652992f48a0Sblueswir1        abi_ulong    target_st_ctime;
16537a3148a9Sj_mayer        unsigned int    st_blksize;
16547a3148a9Sj_mayer        unsigned int    st_blocks;
16557a3148a9Sj_mayer        unsigned int    st_flags;
16567a3148a9Sj_mayer        unsigned int    st_gen;
16577a3148a9Sj_mayer };
16587a3148a9Sj_mayer 
16597a3148a9Sj_mayer struct target_stat64 {
1660992f48a0Sblueswir1        abi_ulong    st_dev;
1661992f48a0Sblueswir1        abi_ulong    st_ino;
1662992f48a0Sblueswir1        abi_ulong    st_rdev;
1663992f48a0Sblueswir1        abi_long     st_size;
1664992f48a0Sblueswir1        abi_ulong    st_blocks;
16657a3148a9Sj_mayer 
16667a3148a9Sj_mayer        unsigned int    st_mode;
16677a3148a9Sj_mayer        unsigned int    st_uid;
16687a3148a9Sj_mayer        unsigned int    st_gid;
16697a3148a9Sj_mayer        unsigned int    st_blksize;
16707a3148a9Sj_mayer        unsigned int    st_nlink;
16717a3148a9Sj_mayer        unsigned int    __pad0;
16727a3148a9Sj_mayer 
1673992f48a0Sblueswir1        abi_ulong    target_st_atime;
1674992f48a0Sblueswir1        abi_ulong    target_st_atime_nsec;
1675992f48a0Sblueswir1        abi_ulong    target_st_mtime;
1676992f48a0Sblueswir1        abi_ulong    target_st_mtime_nsec;
1677992f48a0Sblueswir1        abi_ulong    target_st_ctime;
1678992f48a0Sblueswir1        abi_ulong    target_st_ctime_nsec;
1679992f48a0Sblueswir1        abi_long     __unused[3];
16807a3148a9Sj_mayer };
16817a3148a9Sj_mayer 
16826db45e65Sths #elif defined(TARGET_SH4)
16836db45e65Sths 
16846db45e65Sths struct target_stat {
1685992f48a0Sblueswir1 	abi_ulong  st_dev;
1686992f48a0Sblueswir1 	abi_ulong  st_ino;
16876db45e65Sths 	unsigned short st_mode;
16886db45e65Sths 	unsigned short st_nlink;
16896db45e65Sths 	unsigned short st_uid;
16906db45e65Sths 	unsigned short st_gid;
1691992f48a0Sblueswir1 	abi_ulong  st_rdev;
1692992f48a0Sblueswir1 	abi_ulong  st_size;
1693992f48a0Sblueswir1 	abi_ulong  st_blksize;
1694992f48a0Sblueswir1 	abi_ulong  st_blocks;
1695992f48a0Sblueswir1 	abi_ulong  target_st_atime;
1696992f48a0Sblueswir1 	abi_ulong  target_st_atime_nsec;
1697992f48a0Sblueswir1 	abi_ulong  target_st_mtime;
1698992f48a0Sblueswir1 	abi_ulong  target_st_mtime_nsec;
1699992f48a0Sblueswir1 	abi_ulong  target_st_ctime;
1700992f48a0Sblueswir1 	abi_ulong  target_st_ctime_nsec;
1701992f48a0Sblueswir1 	abi_ulong  __unused4;
1702992f48a0Sblueswir1 	abi_ulong  __unused5;
17036db45e65Sths };
17046db45e65Sths 
17056db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely
17066db45e65Sths  * insane amounts of padding around dev_t's.
17076db45e65Sths  */
1708541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 {
17096db45e65Sths 	unsigned long long	st_dev;
17106db45e65Sths 	unsigned char	__pad0[4];
17116db45e65Sths 
17126db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO	1
1713992f48a0Sblueswir1 	abi_ulong	__st_ino;
17146db45e65Sths 
17156db45e65Sths 	unsigned int	st_mode;
17166db45e65Sths 	unsigned int	st_nlink;
17176db45e65Sths 
1718992f48a0Sblueswir1 	abi_ulong	st_uid;
1719992f48a0Sblueswir1 	abi_ulong	st_gid;
17206db45e65Sths 
17216db45e65Sths 	unsigned long long	st_rdev;
17226db45e65Sths 	unsigned char	__pad3[4];
17236db45e65Sths 
17246db45e65Sths 	long long	st_size;
1725992f48a0Sblueswir1 	abi_ulong	st_blksize;
17266db45e65Sths 
17276db45e65Sths 	unsigned long long	st_blocks;	/* Number 512-byte blocks allocated. */
17286db45e65Sths 
1729992f48a0Sblueswir1 	abi_ulong	target_st_atime;
1730992f48a0Sblueswir1 	abi_ulong	target_st_atime_nsec;
17316db45e65Sths 
1732992f48a0Sblueswir1 	abi_ulong	target_st_mtime;
1733992f48a0Sblueswir1 	abi_ulong	target_st_mtime_nsec;
17346db45e65Sths 
1735992f48a0Sblueswir1 	abi_ulong	target_st_ctime;
1736992f48a0Sblueswir1 	abi_ulong	target_st_ctime_nsec;
17376db45e65Sths 
17386db45e65Sths 	unsigned long long	st_ino;
17396db45e65Sths };
17406db45e65Sths 
1741d2fd1af7Sbellard #elif defined(TARGET_I386) && !defined(TARGET_ABI32)
1742d2fd1af7Sbellard struct target_stat {
1743d2fd1af7Sbellard 	abi_ulong	st_dev;
1744d2fd1af7Sbellard 	abi_ulong	st_ino;
1745d2fd1af7Sbellard 	abi_ulong	st_nlink;
1746d2fd1af7Sbellard 
1747d2fd1af7Sbellard 	unsigned int	st_mode;
1748d2fd1af7Sbellard 	unsigned int	st_uid;
1749d2fd1af7Sbellard 	unsigned int	st_gid;
1750d2fd1af7Sbellard 	unsigned int	__pad0;
1751d2fd1af7Sbellard 	abi_ulong	st_rdev;
1752d2fd1af7Sbellard 	abi_long	st_size;
1753d2fd1af7Sbellard 	abi_long	st_blksize;
1754d2fd1af7Sbellard     	abi_long	st_blocks;	/* Number 512-byte blocks allocated. */
1755d2fd1af7Sbellard 
1756d2fd1af7Sbellard 	abi_ulong	target_st_atime;
1757d2fd1af7Sbellard 	abi_ulong 	target_st_atime_nsec;
1758d2fd1af7Sbellard 	abi_ulong	target_st_mtime;
1759d2fd1af7Sbellard 	abi_ulong	target_st_mtime_nsec;
1760d2fd1af7Sbellard 	abi_ulong	target_st_ctime;
1761d2fd1af7Sbellard 	abi_ulong       target_st_ctime_nsec;
1762d2fd1af7Sbellard 
1763d2fd1af7Sbellard   	abi_long	__unused[3];
1764d2fd1af7Sbellard };
1765a4c075f1SUlrich Hecht #elif defined(TARGET_S390X)
1766a4c075f1SUlrich Hecht struct target_stat {
1767a4c075f1SUlrich Hecht     abi_ulong  st_dev;
1768a4c075f1SUlrich Hecht     abi_ulong  st_ino;
1769a4c075f1SUlrich Hecht     abi_ulong  st_nlink;
1770a4c075f1SUlrich Hecht     unsigned int   st_mode;
1771a4c075f1SUlrich Hecht     unsigned int   st_uid;
1772a4c075f1SUlrich Hecht     unsigned int   st_gid;
1773a4c075f1SUlrich Hecht     unsigned int   __pad1;
1774a4c075f1SUlrich Hecht     abi_ulong  st_rdev;
1775a4c075f1SUlrich Hecht     abi_ulong  st_size;
1776a4c075f1SUlrich Hecht     abi_ulong  target_st_atime;
1777a4c075f1SUlrich Hecht     abi_ulong  target_st_atime_nsec;
1778a4c075f1SUlrich Hecht     abi_ulong  target_st_mtime;
1779a4c075f1SUlrich Hecht     abi_ulong  target_st_mtime_nsec;
1780a4c075f1SUlrich Hecht     abi_ulong  target_st_ctime;
1781a4c075f1SUlrich Hecht     abi_ulong  target_st_ctime_nsec;
1782a4c075f1SUlrich Hecht     abi_ulong  st_blksize;
1783a4c075f1SUlrich Hecht     abi_long       st_blocks;
1784a4c075f1SUlrich Hecht     abi_ulong  __unused[3];
1785a4c075f1SUlrich Hecht };
1786048f6b4dSbellard #else
1787048f6b4dSbellard #error unsupported CPU
1788048f6b4dSbellard #endif
17892521d698Sbellard 
17904ce6f8deSths typedef struct {
17914ce6f8deSths         int     val[2];
1792c227f099SAnthony Liguori } target_fsid_t;
17934ce6f8deSths 
179456c8f68fSbellard #ifdef TARGET_MIPS
1795d26bc211Sths #ifdef TARGET_ABI_MIPSN32
1796540635baSths struct target_statfs {
1797540635baSths 	int32_t			f_type;
1798540635baSths 	int32_t			f_bsize;
1799540635baSths 	int32_t			f_frsize;	/* Fragment size - unsupported */
1800540635baSths 	int32_t			f_blocks;
1801540635baSths 	int32_t			f_bfree;
1802540635baSths 	int32_t			f_files;
1803540635baSths 	int32_t			f_ffree;
1804540635baSths 	int32_t			f_bavail;
1805540635baSths 
1806540635baSths 	/* Linux specials */
1807c227f099SAnthony Liguori 	target_fsid_t		f_fsid;
1808540635baSths 	int32_t			f_namelen;
1809540635baSths 	int32_t			f_spare[6];
1810540635baSths };
1811540635baSths #else
181256c8f68fSbellard struct target_statfs {
1813992f48a0Sblueswir1 	abi_long		f_type;
1814992f48a0Sblueswir1 	abi_long		f_bsize;
1815992f48a0Sblueswir1 	abi_long		f_frsize;	/* Fragment size - unsupported */
1816992f48a0Sblueswir1 	abi_long		f_blocks;
1817992f48a0Sblueswir1 	abi_long		f_bfree;
1818992f48a0Sblueswir1 	abi_long		f_files;
1819992f48a0Sblueswir1 	abi_long		f_ffree;
1820992f48a0Sblueswir1 	abi_long		f_bavail;
182156c8f68fSbellard 
182256c8f68fSbellard 	/* Linux specials */
1823c227f099SAnthony Liguori 	target_fsid_t		f_fsid;
1824992f48a0Sblueswir1 	abi_long		f_namelen;
1825992f48a0Sblueswir1 	abi_long		f_spare[6];
182656c8f68fSbellard };
1827540635baSths #endif
182856c8f68fSbellard 
182956c8f68fSbellard struct target_statfs64 {
183056c8f68fSbellard 	uint32_t	f_type;
183156c8f68fSbellard 	uint32_t	f_bsize;
183256c8f68fSbellard 	uint32_t	f_frsize;	/* Fragment size - unsupported */
183356c8f68fSbellard 	uint32_t	__pad;
183456c8f68fSbellard 	uint64_t	f_blocks;
183556c8f68fSbellard 	uint64_t	f_bfree;
183656c8f68fSbellard 	uint64_t	f_files;
183756c8f68fSbellard 	uint64_t	f_ffree;
183856c8f68fSbellard 	uint64_t	f_bavail;
1839c227f099SAnthony Liguori 	target_fsid_t	f_fsid;
184056c8f68fSbellard 	uint32_t	f_namelen;
184156c8f68fSbellard 	uint32_t	f_spare[6];
184256c8f68fSbellard };
1843c4d10628Sbalrog #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \
1844c4d10628Sbalrog        defined(TARGET_SPARC64)) && !defined(TARGET_ABI32)
1845325e651fSj_mayer struct target_statfs {
1846325e651fSj_mayer 	abi_long f_type;
1847325e651fSj_mayer 	abi_long f_bsize;
1848325e651fSj_mayer 	abi_long f_blocks;
1849325e651fSj_mayer 	abi_long f_bfree;
1850325e651fSj_mayer 	abi_long f_bavail;
1851325e651fSj_mayer 	abi_long f_files;
1852325e651fSj_mayer 	abi_long f_ffree;
1853c227f099SAnthony Liguori 	target_fsid_t f_fsid;
1854325e651fSj_mayer 	abi_long f_namelen;
1855325e651fSj_mayer 	abi_long f_frsize;
1856325e651fSj_mayer 	abi_long f_spare[5];
1857325e651fSj_mayer };
1858325e651fSj_mayer 
1859325e651fSj_mayer struct target_statfs64 {
1860325e651fSj_mayer 	abi_long f_type;
1861325e651fSj_mayer 	abi_long f_bsize;
1862325e651fSj_mayer 	abi_long f_blocks;
1863325e651fSj_mayer 	abi_long f_bfree;
1864325e651fSj_mayer 	abi_long f_bavail;
1865325e651fSj_mayer 	abi_long f_files;
1866325e651fSj_mayer 	abi_long f_ffree;
1867c227f099SAnthony Liguori 	target_fsid_t f_fsid;
1868325e651fSj_mayer 	abi_long f_namelen;
1869325e651fSj_mayer 	abi_long f_frsize;
1870325e651fSj_mayer 	abi_long f_spare[5];
1871325e651fSj_mayer };
1872a4c075f1SUlrich Hecht #elif defined(TARGET_S390X)
1873a4c075f1SUlrich Hecht struct target_statfs {
1874a4c075f1SUlrich Hecht     int32_t  f_type;
1875a4c075f1SUlrich Hecht     int32_t  f_bsize;
1876a4c075f1SUlrich Hecht     abi_long f_blocks;
1877a4c075f1SUlrich Hecht     abi_long f_bfree;
1878a4c075f1SUlrich Hecht     abi_long f_bavail;
1879a4c075f1SUlrich Hecht     abi_long f_files;
1880a4c075f1SUlrich Hecht     abi_long f_ffree;
1881a4c075f1SUlrich Hecht     kernel_fsid_t f_fsid;
1882a4c075f1SUlrich Hecht     int32_t  f_namelen;
1883a4c075f1SUlrich Hecht     int32_t  f_frsize;
1884a4c075f1SUlrich Hecht     int32_t  f_spare[5];
1885a4c075f1SUlrich Hecht };
1886a4c075f1SUlrich Hecht 
1887a4c075f1SUlrich Hecht struct target_statfs64 {
1888a4c075f1SUlrich Hecht     int32_t  f_type;
1889a4c075f1SUlrich Hecht     int32_t  f_bsize;
1890a4c075f1SUlrich Hecht     abi_long f_blocks;
1891a4c075f1SUlrich Hecht     abi_long f_bfree;
1892a4c075f1SUlrich Hecht     abi_long f_bavail;
1893a4c075f1SUlrich Hecht     abi_long f_files;
1894a4c075f1SUlrich Hecht     abi_long f_ffree;
1895a4c075f1SUlrich Hecht     kernel_fsid_t f_fsid;
1896a4c075f1SUlrich Hecht     int32_t  f_namelen;
1897a4c075f1SUlrich Hecht     int32_t  f_frsize;
1898a4c075f1SUlrich Hecht     int32_t  f_spare[5];
1899a4c075f1SUlrich Hecht };
190056c8f68fSbellard #else
190156c8f68fSbellard struct target_statfs {
190256c8f68fSbellard 	uint32_t f_type;
190356c8f68fSbellard 	uint32_t f_bsize;
190456c8f68fSbellard 	uint32_t f_blocks;
190556c8f68fSbellard 	uint32_t f_bfree;
190656c8f68fSbellard 	uint32_t f_bavail;
190756c8f68fSbellard 	uint32_t f_files;
190856c8f68fSbellard 	uint32_t f_ffree;
1909c227f099SAnthony Liguori 	target_fsid_t f_fsid;
191056c8f68fSbellard 	uint32_t f_namelen;
191156c8f68fSbellard 	uint32_t f_frsize;
191256c8f68fSbellard 	uint32_t f_spare[5];
191356c8f68fSbellard };
191456c8f68fSbellard 
191556c8f68fSbellard struct target_statfs64 {
191656c8f68fSbellard 	uint32_t f_type;
191756c8f68fSbellard 	uint32_t f_bsize;
191856c8f68fSbellard 	uint64_t f_blocks;
191956c8f68fSbellard 	uint64_t f_bfree;
192056c8f68fSbellard 	uint64_t f_bavail;
192156c8f68fSbellard 	uint64_t f_files;
192256c8f68fSbellard 	uint64_t f_ffree;
1923c227f099SAnthony Liguori 	target_fsid_t f_fsid;
192456c8f68fSbellard         uint32_t f_namelen;
192556c8f68fSbellard 	uint32_t f_frsize;
192656c8f68fSbellard 	uint32_t f_spare[5];
192756c8f68fSbellard };
192856c8f68fSbellard #endif
192956c8f68fSbellard 
193056c8f68fSbellard 
19312521d698Sbellard #define TARGET_F_DUPFD         0       /* dup */
19322521d698Sbellard #define TARGET_F_GETFD         1       /* get close_on_exec */
19332521d698Sbellard #define TARGET_F_SETFD         2       /* set/clear close_on_exec */
19342521d698Sbellard #define TARGET_F_GETFL         3       /* get file->f_flags */
19352521d698Sbellard #define TARGET_F_SETFL         4       /* set file->f_flags */
19362521d698Sbellard 
19372521d698Sbellard #if defined(TARGET_ALPHA)
19382521d698Sbellard #define TARGET_F_GETLK         7
19392521d698Sbellard #define TARGET_F_SETLK         8
19402521d698Sbellard #define TARGET_F_SETLKW        9
19412521d698Sbellard #define TARGET_F_SETOWN        5       /*  for sockets. */
19422521d698Sbellard #define TARGET_F_GETOWN        6       /*  for sockets. */
19435f106811SArnaud Patard (Rtp) #elif defined(TARGET_MIPS)
19445f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK         14
19455f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK         6
19465f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW        7
19475f106811SArnaud Patard (Rtp) #define TARGET_F_SETOWN        24       /*  for sockets. */
19485f106811SArnaud Patard (Rtp) #define TARGET_F_GETOWN        25       /*  for sockets. */
19492521d698Sbellard #else
19502521d698Sbellard #define TARGET_F_GETLK         5
19512521d698Sbellard #define TARGET_F_SETLK         6
19522521d698Sbellard #define TARGET_F_SETLKW        7
19532521d698Sbellard #define TARGET_F_SETOWN        8       /*  for sockets. */
19542521d698Sbellard #define TARGET_F_GETOWN        9       /*  for sockets. */
19552521d698Sbellard #endif
19562521d698Sbellard 
19572521d698Sbellard #define TARGET_F_SETSIG        10      /*  for sockets. */
19582521d698Sbellard #define TARGET_F_GETSIG        11      /*  for sockets. */
19592521d698Sbellard 
19605f106811SArnaud Patard (Rtp) #if defined(TARGET_MIPS)
19615f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK64       33      /*  using 'struct flock64' */
19625f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK64       34
19635f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW64      35
19645f106811SArnaud Patard (Rtp) #else
19652521d698Sbellard #define TARGET_F_GETLK64       12      /*  using 'struct flock64' */
19662521d698Sbellard #define TARGET_F_SETLK64       13
19672521d698Sbellard #define TARGET_F_SETLKW64      14
19685f106811SArnaud Patard (Rtp) #endif
19697e22e546SUlrich Hecht 
19707e22e546SUlrich Hecht #define TARGET_F_LINUX_SPECIFIC_BASE 1024
19717e22e546SUlrich Hecht #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0)
19727e22e546SUlrich Hecht #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1)
19737e22e546SUlrich Hecht #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6)
19747e22e546SUlrich Hecht #define TARGET_F_NOTIFY  (TARGET_F_LINUX_SPECIFIC_BASE+2)
19757e22e546SUlrich Hecht 
1976f09936acSbellard #if defined (TARGET_ARM)
1977f09936acSbellard #define TARGET_O_ACCMODE          0003
1978f09936acSbellard #define TARGET_O_RDONLY             00
1979f09936acSbellard #define TARGET_O_WRONLY             01
1980f09936acSbellard #define TARGET_O_RDWR               02
1981f09936acSbellard #define TARGET_O_CREAT            0100 /* not fcntl */
1982f09936acSbellard #define TARGET_O_EXCL             0200 /* not fcntl */
1983f09936acSbellard #define TARGET_O_NOCTTY           0400 /* not fcntl */
1984f09936acSbellard #define TARGET_O_TRUNC           01000 /* not fcntl */
1985f09936acSbellard #define TARGET_O_APPEND          02000
1986f09936acSbellard #define TARGET_O_NONBLOCK        04000
1987048f6b4dSbellard #define TARGET_O_NDELAY        TARGET_O_NONBLOCK
1988f09936acSbellard #define TARGET_O_SYNC           010000
1989f09936acSbellard #define TARGET_FASYNC           020000 /* fcntl, for BSD compatibility */
1990f09936acSbellard #define TARGET_O_DIRECTORY      040000 /* must be a directory */
1991f09936acSbellard #define TARGET_O_NOFOLLOW      0100000 /* don't follow links */
1992f09936acSbellard #define TARGET_O_DIRECT        0200000 /* direct disk access hint */
1993f09936acSbellard #define TARGET_O_LARGEFILE     0400000
1994f09936acSbellard #elif defined (TARGET_PPC)
1995ffa65c3bSbellard #define TARGET_O_ACCMODE          0003
1996ffa65c3bSbellard #define TARGET_O_RDONLY             00
1997ffa65c3bSbellard #define TARGET_O_WRONLY             01
1998ffa65c3bSbellard #define TARGET_O_RDWR               02
1999ffa65c3bSbellard #define TARGET_O_CREAT            0100 /* not fcntl */
2000ffa65c3bSbellard #define TARGET_O_EXCL             0200 /* not fcntl */
2001ffa65c3bSbellard #define TARGET_O_NOCTTY           0400 /* not fcntl */
2002ffa65c3bSbellard #define TARGET_O_TRUNC           01000 /* not fcntl */
2003ffa65c3bSbellard #define TARGET_O_APPEND          02000
2004ffa65c3bSbellard #define TARGET_O_NONBLOCK        04000
2005048f6b4dSbellard #define TARGET_O_NDELAY        TARGET_O_NONBLOCK
2006ffa65c3bSbellard #define TARGET_O_SYNC           010000
2007ffa65c3bSbellard #define TARGET_FASYNC           020000 /* fcntl, for BSD compatibility */
2008ffa65c3bSbellard #define TARGET_O_DIRECTORY      040000 /* must be a directory */
2009ffa65c3bSbellard #define TARGET_O_NOFOLLOW      0100000 /* don't follow links */
2010ffa65c3bSbellard #define TARGET_O_LARGEFILE     0200000
2011ffa65c3bSbellard #define TARGET_O_DIRECT        0400000 /* direct disk access hint */
2012b779e29eSEdgar E. Iglesias #elif defined (TARGET_MICROBLAZE)
2013b779e29eSEdgar E. Iglesias #define TARGET_O_ACCMODE          0003
2014b779e29eSEdgar E. Iglesias #define TARGET_O_RDONLY             00
2015b779e29eSEdgar E. Iglesias #define TARGET_O_WRONLY             01
2016b779e29eSEdgar E. Iglesias #define TARGET_O_RDWR               02
2017b779e29eSEdgar E. Iglesias #define TARGET_O_CREAT            0100 /* not fcntl */
2018b779e29eSEdgar E. Iglesias #define TARGET_O_EXCL             0200 /* not fcntl */
2019b779e29eSEdgar E. Iglesias #define TARGET_O_NOCTTY           0400 /* not fcntl */
2020b779e29eSEdgar E. Iglesias #define TARGET_O_TRUNC           01000 /* not fcntl */
2021b779e29eSEdgar E. Iglesias #define TARGET_O_APPEND          02000
2022b779e29eSEdgar E. Iglesias #define TARGET_O_NONBLOCK        04000
2023b779e29eSEdgar E. Iglesias #define TARGET_O_NDELAY        TARGET_O_NONBLOCK
2024b779e29eSEdgar E. Iglesias #define TARGET_O_SYNC           010000
2025b779e29eSEdgar E. Iglesias #define TARGET_FASYNC           020000 /* fcntl, for BSD compatibility */
2026b779e29eSEdgar E. Iglesias #define TARGET_O_DIRECTORY      040000 /* must be a directory */
2027b779e29eSEdgar E. Iglesias #define TARGET_O_NOFOLLOW      0100000 /* don't follow links */
2028b779e29eSEdgar E. Iglesias #define TARGET_O_LARGEFILE     0200000
2029b779e29eSEdgar E. Iglesias #define TARGET_O_DIRECT        0400000 /* direct disk access hint */
20306d5e216dSbellard #elif defined (TARGET_SPARC)
20316d5e216dSbellard #define TARGET_O_RDONLY        0x0000
20326d5e216dSbellard #define TARGET_O_WRONLY        0x0001
20336d5e216dSbellard #define TARGET_O_RDWR          0x0002
20346d5e216dSbellard #define TARGET_O_ACCMODE       0x0003
20356d5e216dSbellard #define TARGET_O_APPEND        0x0008
20366d5e216dSbellard #define TARGET_FASYNC          0x0040  /* fcntl, for BSD compatibility */
20376d5e216dSbellard #define TARGET_O_CREAT         0x0200  /* not fcntl */
20386d5e216dSbellard #define TARGET_O_TRUNC         0x0400  /* not fcntl */
20396d5e216dSbellard #define TARGET_O_EXCL          0x0800  /* not fcntl */
20406d5e216dSbellard #define TARGET_O_SYNC          0x2000
20416d5e216dSbellard #define TARGET_O_NONBLOCK      0x4000
2042048f6b4dSbellard #define TARGET_O_NDELAY        (0x0004 | TARGET_O_NONBLOCK)
20436d5e216dSbellard #define TARGET_O_NOCTTY        0x8000  /* not fcntl */
20446d5e216dSbellard #define TARGET_O_DIRECTORY     0x10000 /* must be a directory */
20456d5e216dSbellard #define TARGET_O_NOFOLLOW      0x20000 /* don't follow links */
20466d5e216dSbellard #define TARGET_O_LARGEFILE     0x40000
20476d5e216dSbellard #define TARGET_O_DIRECT        0x100000 /* direct disk access hint */
2048048f6b4dSbellard #elif defined(TARGET_MIPS)
2049048f6b4dSbellard #define TARGET_O_ACCMODE	0x0003
2050048f6b4dSbellard #define TARGET_O_RDONLY	0x0000
2051048f6b4dSbellard #define TARGET_O_WRONLY	0x0001
2052048f6b4dSbellard #define TARGET_O_RDWR		0x0002
2053048f6b4dSbellard #define TARGET_O_APPEND	0x0008
2054048f6b4dSbellard #define TARGET_O_SYNC		0x0010
2055048f6b4dSbellard #define TARGET_O_NONBLOCK	0x0080
2056048f6b4dSbellard #define TARGET_O_CREAT         0x0100	/* not fcntl */
2057048f6b4dSbellard #define TARGET_O_TRUNC		0x0200	/* not fcntl */
2058048f6b4dSbellard #define TARGET_O_EXCL		0x0400	/* not fcntl */
2059048f6b4dSbellard #define TARGET_O_NOCTTY	0x0800	/* not fcntl */
2060048f6b4dSbellard #define TARGET_FASYNC		0x1000	/* fcntl, for BSD compatibility */
2061048f6b4dSbellard #define TARGET_O_LARGEFILE	0x2000	/* allow large file opens */
2062048f6b4dSbellard #define TARGET_O_DIRECT	0x8000	/* direct disk access hint */
2063048f6b4dSbellard #define TARGET_O_DIRECTORY	0x10000	/* must be a directory */
2064048f6b4dSbellard #define TARGET_O_NOFOLLOW	0x20000	/* don't follow links */
2065048f6b4dSbellard #define TARGET_O_NOATIME	0x40000
2066048f6b4dSbellard #define TARGET_O_NDELAY	TARGET_O_NONBLOCK
20671f961124Saurel32 #elif defined(TARGET_ALPHA)
20681f961124Saurel32 #define TARGET_O_ACCMODE	0x0003
20691f961124Saurel32 #define TARGET_O_RDONLY	0x0000
20701f961124Saurel32 #define TARGET_O_WRONLY	0x0001
20711f961124Saurel32 #define TARGET_O_RDWR		0x0002
20721f961124Saurel32 #define TARGET_O_APPEND	0x0008
20731f961124Saurel32 #define TARGET_O_SYNC		0x4000
20741f961124Saurel32 #define TARGET_O_NONBLOCK	0x0004
20751f961124Saurel32 #define TARGET_O_CREAT         0x0200	/* not fcntl */
20761f961124Saurel32 #define TARGET_O_TRUNC		0x0400	/* not fcntl */
20771f961124Saurel32 #define TARGET_O_EXCL		0x0800	/* not fcntl */
20781f961124Saurel32 #define TARGET_O_NOCTTY	0x1000	/* not fcntl */
20791f961124Saurel32 #define TARGET_FASYNC		0x2000	/* fcntl, for BSD compatibility */
20801f961124Saurel32 #define TARGET_O_LARGEFILE	0x0000	/* not necessary, always 64-bit */
20811f961124Saurel32 #define TARGET_O_DIRECT	0x80000	/* direct disk access hint */
20821f961124Saurel32 #define TARGET_O_DIRECTORY	0x8000	/* must be a directory */
20831f961124Saurel32 #define TARGET_O_NOFOLLOW	0x10000	/* don't follow links */
20841f961124Saurel32 #define TARGET_O_NOATIME	0x100000
20851f961124Saurel32 #define TARGET_O_NDELAY	TARGET_O_NONBLOCK
2086ffa65c3bSbellard #else
2087ffa65c3bSbellard #define TARGET_O_ACCMODE          0003
2088ffa65c3bSbellard #define TARGET_O_RDONLY             00
2089ffa65c3bSbellard #define TARGET_O_WRONLY             01
2090ffa65c3bSbellard #define TARGET_O_RDWR               02
2091ffa65c3bSbellard #define TARGET_O_CREAT            0100 /* not fcntl */
2092ffa65c3bSbellard #define TARGET_O_EXCL             0200 /* not fcntl */
2093ffa65c3bSbellard #define TARGET_O_NOCTTY           0400 /* not fcntl */
2094ffa65c3bSbellard #define TARGET_O_TRUNC           01000 /* not fcntl */
2095ffa65c3bSbellard #define TARGET_O_APPEND          02000
2096ffa65c3bSbellard #define TARGET_O_NONBLOCK        04000
2097048f6b4dSbellard #define TARGET_O_NDELAY        TARGET_O_NONBLOCK
2098ffa65c3bSbellard #define TARGET_O_SYNC           010000
2099ffa65c3bSbellard #define TARGET_FASYNC           020000 /* fcntl, for BSD compatibility */
2100ffa65c3bSbellard #define TARGET_O_DIRECT         040000 /* direct disk access hint */
2101ffa65c3bSbellard #define TARGET_O_LARGEFILE     0100000
2102ffa65c3bSbellard #define TARGET_O_DIRECTORY     0200000 /* must be a directory */
2103ffa65c3bSbellard #define TARGET_O_NOFOLLOW      0400000 /* don't follow links */
2104ffa65c3bSbellard #endif
2105ffa65c3bSbellard 
21062521d698Sbellard struct target_flock {
21072521d698Sbellard 	short l_type;
21082521d698Sbellard 	short l_whence;
2109992f48a0Sblueswir1 	abi_ulong l_start;
2110992f48a0Sblueswir1 	abi_ulong l_len;
21112521d698Sbellard 	int l_pid;
21122521d698Sbellard };
21132521d698Sbellard 
21142521d698Sbellard struct target_flock64 {
21152521d698Sbellard 	short  l_type;
21162521d698Sbellard 	short  l_whence;
2117b779e29eSEdgar E. Iglesias #if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) || defined(TARGET_SPARC) || defined(TARGET_HPPA) || defined (TARGET_MICROBLAZE)
2118ce3f0e2fSaurel32         int __pad;
2119ce3f0e2fSaurel32 #endif
21202521d698Sbellard 	unsigned long long l_start;
21212521d698Sbellard 	unsigned long long l_len;
21222521d698Sbellard 	int  l_pid;
2123541dc0d4SStefan Weil } QEMU_PACKED;
21242521d698Sbellard 
2125ce4defa0Spbrook #ifdef TARGET_ARM
2126ce4defa0Spbrook struct target_eabi_flock64 {
2127ce4defa0Spbrook 	short  l_type;
2128ce4defa0Spbrook 	short  l_whence;
2129ce4defa0Spbrook         int __pad;
2130ce4defa0Spbrook 	unsigned long long l_start;
2131ce4defa0Spbrook 	unsigned long long l_len;
2132ce4defa0Spbrook 	int  l_pid;
2133541dc0d4SStefan Weil } QEMU_PACKED;
2134ce4defa0Spbrook #endif
21352521d698Sbellard 
21362521d698Sbellard /* soundcard defines */
21372521d698Sbellard /* XXX: convert them all to arch indepedent entries */
21382521d698Sbellard #define TARGET_SNDCTL_COPR_HALT           TARGET_IOWR('C',  7, int);
21392521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD           0xcfb04301
21402521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE          0xc0144303
21412521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG         0x8fa44309
21422521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA          0xc0144302
21432521d698Sbellard #define TARGET_SNDCTL_COPR_RESET          0x00004300
21442521d698Sbellard #define TARGET_SNDCTL_COPR_RUN            0xc0144306
21452521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG        0xcfa44308
21462521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE          0x40144305
21472521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA          0x40144304
21482521d698Sbellard #define TARGET_SNDCTL_DSP_RESET           TARGET_IO('P', 0)
21492521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC            TARGET_IO('P', 1)
21502521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED           TARGET_IOWR('P', 2, int)
21512521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO          TARGET_IOWR('P', 3, int)
21522521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE      TARGET_IOWR('P', 4, int)
21532521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT          TARGET_IOWR('P', 5, int)
21542521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS        TARGET_IOWR('P', 6, int)
21552521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER     TARGET_IOWR('P', 7, int)
21562521d698Sbellard #define TARGET_SNDCTL_DSP_POST            TARGET_IO('P', 8)
21572521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE       TARGET_IOWR('P', 9, int)
21582521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT     TARGET_IOWR('P',10, int)
21592521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS         TARGET_IOR('P', 11, int)
21602521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE       TARGET_IORU('P',12)
21612521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE       TARGET_IORU('P',13)
21622521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS         TARGET_IOR('P', 15, int)
21632521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER      TARGET_IOR('P',16, int)
21642521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR         TARGET_IORU('P',17)
21652521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR         TARGET_IORU('P',18)
21662521d698Sbellard #define TARGET_SNDCTL_DSP_MAPINBUF        0x80085013
21672521d698Sbellard #define TARGET_SNDCTL_DSP_MAPOUTBUF       0x80085014
21682521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK        0x0000500e
21692521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE      0xc0045005
21702521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX       0x00005016
21712521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO       0x00005015
21722521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER      0x40045010
21732521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE       0x4004510f
21742521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR       0x40285107
21752521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO           0xc074510c
21762521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD         0xc0216d02
21772521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE        0xc0046d01
21782521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME        0xc0046d00
21792521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS         0xcfb85110
21802521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE          0xcfb85001
21812521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE        0xc0045103
21822521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT      0x80045105
21832521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT     0x80045104
21842521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS         0x8004510b
21852521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS        0x8004510a
21862521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND       0x40085112
21872521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC           0x00005111
21882521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE        0x40045106
21892521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET           0x00005100
21902521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES    0x40045109
21912521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC            0x00005101
21922521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI        0x40045108
21932521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD       0x4004510d
21942521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD        0x4004510d
21952521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO          0xc08c5102
21962521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL        0xc004510e
21972521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE        0x00005404
21982521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME       0x40045407
21992521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT          0x40045408
22002521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE          0xc0045406
22012521d698Sbellard #define TARGET_SNDCTL_TMR_START           0x00005402
22022521d698Sbellard #define TARGET_SNDCTL_TMR_STOP            0x00005403
22032521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO           0xc0045405
22042521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE        0xc0045401
22052521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE        0x80045002
22062521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS    0x80045006
22072521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS        0x80045005
22082521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER      0x80045007
22092521d698Sbellard #define TARGET_SOUND_MIXER_INFO           TARGET_IOR ('M', 101, mixer_info)
22102521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS         0xc0804d66
22112521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1       TARGET_IOWR('M', 111, int)
22122521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2       TARGET_IOWR('M', 112, int)
22132521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3       TARGET_IOWR('M', 113, int)
22142521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4       TARGET_IOWR('M', 114, int)
22152521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5       TARGET_IOWR('M', 115, int)
22162521d698Sbellard 
22172521d698Sbellard #define TARGET_MIXER_READ(dev)	TARGET_IOR('M', dev, int)
22182521d698Sbellard 
22192521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME		TARGET_MIXER_READ(SOUND_MIXER_VOLUME)
22202521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS		TARGET_MIXER_READ(SOUND_MIXER_BASS)
22212521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE		TARGET_MIXER_READ(SOUND_MIXER_TREBLE)
22222521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH		TARGET_MIXER_READ(SOUND_MIXER_SYNTH)
22232521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM		TARGET_MIXER_READ(SOUND_MIXER_PCM)
22242521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER	        TARGET_MIXER_READ(SOUND_MIXER_SPEAKER)
22252521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE		TARGET_MIXER_READ(SOUND_MIXER_LINE)
22262521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC		TARGET_MIXER_READ(SOUND_MIXER_MIC)
22272521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD		TARGET_MIXER_READ(SOUND_MIXER_CD)
22282521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX		TARGET_MIXER_READ(SOUND_MIXER_IMIX)
22292521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM		TARGET_MIXER_READ(SOUND_MIXER_ALTPCM)
22302521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV		TARGET_MIXER_READ(SOUND_MIXER_RECLEV)
22312521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN		TARGET_MIXER_READ(SOUND_MIXER_IGAIN)
22322521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN		TARGET_MIXER_READ(SOUND_MIXER_OGAIN)
22332521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1		TARGET_MIXER_READ(SOUND_MIXER_LINE1)
22342521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2		TARGET_MIXER_READ(SOUND_MIXER_LINE2)
22352521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3		TARGET_MIXER_READ(SOUND_MIXER_LINE3)
22362521d698Sbellard 
22372521d698Sbellard /* Obsolete macros */
22382521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE		TARGET_MIXER_READ(SOUND_MIXER_MUTE)
22392521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE	        TARGET_MIXER_READ(SOUND_MIXER_ENHANCE)
22402521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD		TARGET_MIXER_READ(SOUND_MIXER_LOUD)
22412521d698Sbellard 
22422521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC		TARGET_MIXER_READ(SOUND_MIXER_RECSRC)
22432521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK	        TARGET_MIXER_READ(SOUND_MIXER_DEVMASK)
22442521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK	        TARGET_MIXER_READ(SOUND_MIXER_RECMASK)
22452521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS	TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS)
22462521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS		TARGET_MIXER_READ(SOUND_MIXER_CAPS)
22472521d698Sbellard 
22482521d698Sbellard #define TARGET_MIXER_WRITE(dev)		TARGET_IOWR('M', dev, int)
22492521d698Sbellard 
22502521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME	TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME)
22512521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS		TARGET_MIXER_WRITE(SOUND_MIXER_BASS)
22522521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE	TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE)
22532521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH		TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH)
22542521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM		TARGET_MIXER_WRITE(SOUND_MIXER_PCM)
22552521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER	TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER)
22562521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE		TARGET_MIXER_WRITE(SOUND_MIXER_LINE)
22572521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC		TARGET_MIXER_WRITE(SOUND_MIXER_MIC)
22582521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD		TARGET_MIXER_WRITE(SOUND_MIXER_CD)
22592521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX		TARGET_MIXER_WRITE(SOUND_MIXER_IMIX)
22602521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM	TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM)
22612521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV	TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV)
22622521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN		TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN)
22632521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN		TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN)
22642521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1		TARGET_MIXER_WRITE(SOUND_MIXER_LINE1)
22652521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2		TARGET_MIXER_WRITE(SOUND_MIXER_LINE2)
22662521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3		TARGET_MIXER_WRITE(SOUND_MIXER_LINE3)
22672521d698Sbellard 
22682521d698Sbellard /* Obsolete macros */
22692521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE		TARGET_MIXER_WRITE(SOUND_MIXER_MUTE)
22702521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE	TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE)
22712521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD		TARGET_MIXER_WRITE(SOUND_MIXER_LOUD)
22722521d698Sbellard 
22732521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC	TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC)
22742521d698Sbellard 
22752521d698Sbellard /* vfat ioctls */
22762521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH    TARGET_IORU('r', 1)
22772521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT   TARGET_IORU('r', 2)
2278a5448a7dSbellard 
22798fbd6b52Sbalrog #define TARGET_MTIOCTOP        TARGET_IOW('m', 1, struct mtop)
22808fbd6b52Sbalrog #define TARGET_MTIOCGET        TARGET_IOR('m', 2, struct mtget)
22818fbd6b52Sbalrog #define TARGET_MTIOCPOS        TARGET_IOR('m', 3, struct mtpos)
22828fbd6b52Sbalrog 
2283a5448a7dSbellard struct target_sysinfo {
2284992f48a0Sblueswir1     abi_long uptime;                /* Seconds since boot */
2285992f48a0Sblueswir1     abi_ulong loads[3];             /* 1, 5, and 15 minute load averages */
2286992f48a0Sblueswir1     abi_ulong totalram;             /* Total usable main memory size */
2287992f48a0Sblueswir1     abi_ulong freeram;              /* Available memory size */
2288992f48a0Sblueswir1     abi_ulong sharedram;            /* Amount of shared memory */
2289992f48a0Sblueswir1     abi_ulong bufferram;            /* Memory used by buffers */
2290992f48a0Sblueswir1     abi_ulong totalswap;            /* Total swap space size */
2291992f48a0Sblueswir1     abi_ulong freeswap;             /* swap space still available */
2292a5448a7dSbellard     unsigned short procs;           /* Number of current processes */
2293a5448a7dSbellard     unsigned short pad;             /* explicit padding for m68k */
2294992f48a0Sblueswir1     abi_ulong totalhigh;            /* Total high memory size */
2295992f48a0Sblueswir1     abi_ulong freehigh;             /* Available high memory size */
2296a5448a7dSbellard     unsigned int mem_unit;          /* Memory unit size in bytes */
2297992f48a0Sblueswir1     char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */
2298a5448a7dSbellard };
22993532fa74Sbellard 
23006556a833Saurel32 struct linux_dirent {
23016556a833Saurel32     long            d_ino;
23026556a833Saurel32     unsigned long   d_off;
23036556a833Saurel32     unsigned short  d_reclen;
23046556a833Saurel32     char            d_name[256]; /* We must not include limits.h! */
23056556a833Saurel32 };
23066556a833Saurel32 
23076556a833Saurel32 struct linux_dirent64 {
23086556a833Saurel32     uint64_t        d_ino;
23096556a833Saurel32     int64_t         d_off;
23106556a833Saurel32     unsigned short  d_reclen;
23116556a833Saurel32     unsigned char   d_type;
23126556a833Saurel32     char            d_name[256];
23136556a833Saurel32 };
23146556a833Saurel32 
231524e1003aSaurel32 struct target_mq_attr {
231624e1003aSaurel32     abi_long mq_flags;
231724e1003aSaurel32     abi_long mq_maxmsg;
231824e1003aSaurel32     abi_long mq_msgsize;
231924e1003aSaurel32     abi_long mq_curmsgs;
232024e1003aSaurel32 };
232124e1003aSaurel32 
23223532fa74Sbellard #include "socket.h"
2323637947f1Sths 
2324637947f1Sths #include "errno_defs.h"
232503dfe9f8SRiku Voipio 
232603dfe9f8SRiku Voipio #define FUTEX_WAIT              0
232703dfe9f8SRiku Voipio #define FUTEX_WAKE              1
232803dfe9f8SRiku Voipio #define FUTEX_FD                2
232903dfe9f8SRiku Voipio #define FUTEX_REQUEUE           3
233003dfe9f8SRiku Voipio #define FUTEX_CMP_REQUEUE       4
233103dfe9f8SRiku Voipio #define FUTEX_WAKE_OP           5
233203dfe9f8SRiku Voipio #define FUTEX_LOCK_PI           6
233303dfe9f8SRiku Voipio #define FUTEX_UNLOCK_PI         7
233403dfe9f8SRiku Voipio #define FUTEX_TRYLOCK_PI        8
233503dfe9f8SRiku Voipio #define FUTEX_WAIT_BITSET       9
233603dfe9f8SRiku Voipio #define FUTEX_WAKE_BITSET       10
233703dfe9f8SRiku Voipio 
233803dfe9f8SRiku Voipio #define FUTEX_PRIVATE_FLAG      128
233903dfe9f8SRiku Voipio #define FUTEX_CLOCK_REALTIME    256
234003dfe9f8SRiku Voipio #define FUTEX_CMD_MASK          ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)
234103dfe9f8SRiku Voipio 
23423b6edd16SPeter Maydell #ifdef CONFIG_EPOLL
23433b6edd16SPeter Maydell typedef union target_epoll_data {
23443b6edd16SPeter Maydell     abi_ulong ptr;
23453b6edd16SPeter Maydell     abi_ulong fd;
23463b6edd16SPeter Maydell     uint32_t u32;
23473b6edd16SPeter Maydell     uint64_t u64;
23483b6edd16SPeter Maydell } target_epoll_data_t;
23493b6edd16SPeter Maydell 
23503b6edd16SPeter Maydell struct target_epoll_event {
23513b6edd16SPeter Maydell     uint32_t events;
23523b6edd16SPeter Maydell     target_epoll_data_t data;
23533b6edd16SPeter Maydell };
23543b6edd16SPeter Maydell #endif
2355163a05a8SPeter Maydell struct target_rlimit64 {
2356163a05a8SPeter Maydell     uint64_t rlim_cur;
2357163a05a8SPeter Maydell     uint64_t rlim_max;
2358163a05a8SPeter Maydell };
2359583359a6SAkos PASZTORY 
2360583359a6SAkos PASZTORY struct target_ucred {
2361583359a6SAkos PASZTORY     uint32_t pid;
2362583359a6SAkos PASZTORY     uint32_t uid;
2363583359a6SAkos PASZTORY     uint32_t gid;
2364583359a6SAkos PASZTORY };
2365