xref: /openbmc/qemu/linux-user/syscall_defs.h (revision cb9c377f54a756b04ef92c1c2e0453613ee863cf)
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 
7*cb9c377fSPaolo Bonzini #ifndef SYSCALL_DEFS_H
8*cb9c377fSPaolo Bonzini #define SYSCALL_DEFS_H 1
9*cb9c377fSPaolo Bonzini 
10*cb9c377fSPaolo Bonzini 
116180a181Sbellard #include "syscall_nr.h"
122521d698Sbellard 
1331e31b8aSbellard #define SOCKOP_socket           1
1431e31b8aSbellard #define SOCKOP_bind             2
1531e31b8aSbellard #define SOCKOP_connect          3
1631e31b8aSbellard #define SOCKOP_listen           4
1731e31b8aSbellard #define SOCKOP_accept           5
1831e31b8aSbellard #define SOCKOP_getsockname      6
1931e31b8aSbellard #define SOCKOP_getpeername      7
2031e31b8aSbellard #define SOCKOP_socketpair       8
2131e31b8aSbellard #define SOCKOP_send             9
2231e31b8aSbellard #define SOCKOP_recv             10
2331e31b8aSbellard #define SOCKOP_sendto           11
2431e31b8aSbellard #define SOCKOP_recvfrom         12
2531e31b8aSbellard #define SOCKOP_shutdown         13
2631e31b8aSbellard #define SOCKOP_setsockopt       14
2731e31b8aSbellard #define SOCKOP_getsockopt       15
2831e31b8aSbellard #define SOCKOP_sendmsg          16
2931e31b8aSbellard #define SOCKOP_recvmsg          17
3031e31b8aSbellard 
318853f86eSbellard #define IPCOP_semop		1
328853f86eSbellard #define IPCOP_semget		2
338853f86eSbellard #define IPCOP_semctl		3
348853f86eSbellard #define IPCOP_semtimedop	4
358853f86eSbellard #define IPCOP_msgsnd		11
368853f86eSbellard #define IPCOP_msgrcv		12
378853f86eSbellard #define IPCOP_msgget		13
388853f86eSbellard #define IPCOP_msgctl		14
398853f86eSbellard #define IPCOP_shmat		21
408853f86eSbellard #define IPCOP_shmdt		22
418853f86eSbellard #define IPCOP_shmget		23
428853f86eSbellard #define IPCOP_shmctl		24
438853f86eSbellard 
442521d698Sbellard /*
452521d698Sbellard  * The following is for compatibility across the various Linux
462521d698Sbellard  * platforms.  The i386 ioctl numbering scheme doesn't really enforce
472521d698Sbellard  * a type field.  De facto, however, the top 8 bits of the lower 16
482521d698Sbellard  * bits are indeed used as a type field, so we might just as well make
492521d698Sbellard  * this explicit here.  Please be sure to use the decoding macros
502521d698Sbellard  * below from now on.
512521d698Sbellard  */
522521d698Sbellard #define TARGET_IOC_NRBITS	8
532521d698Sbellard #define TARGET_IOC_TYPEBITS	8
542521d698Sbellard 
5574d753acSMika Westerberg #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \
560c866a7eSRiku Voipio     || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS)
5774d753acSMika Westerberg     /* 16 bit uid wrappers emulation */
5874d753acSMika Westerberg #define USE_UID16
590c866a7eSRiku Voipio #define target_id uint16_t
600c866a7eSRiku Voipio #else
610c866a7eSRiku Voipio #define target_id uint32_t
6274d753acSMika Westerberg #endif
6374d753acSMika Westerberg 
64e6e5906bSpbrook #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \
65a4c075f1SUlrich Hecht     || defined(TARGET_M68K) || defined(TARGET_CRIS) || defined(TARGET_UNICORE32) \
66d962783eSJia Liu     || defined(TARGET_S390X) || defined(TARGET_OPENRISC)
672521d698Sbellard 
682521d698Sbellard #define TARGET_IOC_SIZEBITS	14
692521d698Sbellard #define TARGET_IOC_DIRBITS	2
702521d698Sbellard 
712521d698Sbellard #define TARGET_IOC_NONE	  0U
722521d698Sbellard #define TARGET_IOC_WRITE  1U
732521d698Sbellard #define TARGET_IOC_READ	  2U
742521d698Sbellard 
75048f6b4dSbellard #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \
76b779e29eSEdgar E. Iglesias       defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \
77b779e29eSEdgar E. Iglesias       defined(TARGET_MIPS)
782521d698Sbellard 
792521d698Sbellard #define TARGET_IOC_SIZEBITS	13
802521d698Sbellard #define TARGET_IOC_DIRBITS	3
812521d698Sbellard 
822521d698Sbellard #define TARGET_IOC_NONE	  1U
832521d698Sbellard #define TARGET_IOC_READ	  2U
842521d698Sbellard #define TARGET_IOC_WRITE  4U
852521d698Sbellard 
862521d698Sbellard #else
872521d698Sbellard #error unsupported CPU
882521d698Sbellard #endif
892521d698Sbellard 
902521d698Sbellard #define TARGET_IOC_NRMASK	((1 << TARGET_IOC_NRBITS)-1)
912521d698Sbellard #define TARGET_IOC_TYPEMASK	((1 << TARGET_IOC_TYPEBITS)-1)
922521d698Sbellard #define TARGET_IOC_SIZEMASK	((1 << TARGET_IOC_SIZEBITS)-1)
932521d698Sbellard #define TARGET_IOC_DIRMASK	((1 << TARGET_IOC_DIRBITS)-1)
942521d698Sbellard 
952521d698Sbellard #define TARGET_IOC_NRSHIFT	0
962521d698Sbellard #define TARGET_IOC_TYPESHIFT	(TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS)
972521d698Sbellard #define TARGET_IOC_SIZESHIFT	(TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS)
982521d698Sbellard #define TARGET_IOC_DIRSHIFT	(TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS)
992521d698Sbellard 
1002521d698Sbellard #define TARGET_IOC(dir,type,nr,size) \
1012521d698Sbellard 	(((dir)  << TARGET_IOC_DIRSHIFT) | \
1022521d698Sbellard 	 ((type) << TARGET_IOC_TYPESHIFT) | \
1032521d698Sbellard 	 ((nr)   << TARGET_IOC_NRSHIFT) | \
1042521d698Sbellard 	 ((size) << TARGET_IOC_SIZESHIFT))
1052521d698Sbellard 
1062521d698Sbellard /* used to create numbers */
1072521d698Sbellard #define TARGET_IO(type,nr)		TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0)
1082521d698Sbellard #define TARGET_IOR(type,nr,size)	TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size))
1092521d698Sbellard #define TARGET_IOW(type,nr,size)	TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size))
1102521d698Sbellard #define TARGET_IOWR(type,nr,size)	TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size))
1112521d698Sbellard 
1122521d698Sbellard /* the size is automatically computed for these defines */
1132521d698Sbellard #define TARGET_IORU(type,nr)	TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK)
1142521d698Sbellard #define TARGET_IOWU(type,nr)	TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
1152521d698Sbellard #define TARGET_IOWRU(type,nr)	TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
1162521d698Sbellard 
1177854b056Sbellard struct target_sockaddr {
1187854b056Sbellard     uint16_t sa_family;
1197854b056Sbellard     uint8_t sa_data[14];
1207854b056Sbellard };
1217854b056Sbellard 
122b975b83bSLionel Landwerlin struct target_in_addr {
123b975b83bSLionel Landwerlin     uint32_t s_addr; /* big endian */
124b975b83bSLionel Landwerlin };
125b975b83bSLionel Landwerlin 
126b975b83bSLionel Landwerlin struct target_ip_mreq {
127b975b83bSLionel Landwerlin     struct target_in_addr imr_multiaddr;
128b975b83bSLionel Landwerlin     struct target_in_addr imr_address;
129b975b83bSLionel Landwerlin };
130b975b83bSLionel Landwerlin 
131b975b83bSLionel Landwerlin struct target_ip_mreqn {
132b975b83bSLionel Landwerlin     struct target_in_addr imr_multiaddr;
133b975b83bSLionel Landwerlin     struct target_in_addr imr_address;
134b975b83bSLionel Landwerlin     abi_long imr_ifindex;
135b975b83bSLionel Landwerlin };
136b975b83bSLionel Landwerlin 
1376e3cb58fSLionel Landwerlin struct target_ip_mreq_source {
1386e3cb58fSLionel Landwerlin     /* big endian */
1396e3cb58fSLionel Landwerlin     uint32_t imr_multiaddr;
1406e3cb58fSLionel Landwerlin     uint32_t imr_interface;
1416e3cb58fSLionel Landwerlin     uint32_t imr_sourceaddr;
1426e3cb58fSLionel Landwerlin };
1436e3cb58fSLionel Landwerlin 
14431e31b8aSbellard struct target_timeval {
145992f48a0Sblueswir1     abi_long tv_sec;
146992f48a0Sblueswir1     abi_long tv_usec;
14731e31b8aSbellard };
14831e31b8aSbellard 
1491b6b029eSbellard struct target_timespec {
150992f48a0Sblueswir1     abi_long tv_sec;
151992f48a0Sblueswir1     abi_long tv_nsec;
1521b6b029eSbellard };
1531b6b029eSbellard 
15466fb9763Sbellard struct target_itimerval {
15566fb9763Sbellard     struct target_timeval it_interval;
15666fb9763Sbellard     struct target_timeval it_value;
15766fb9763Sbellard };
15866fb9763Sbellard 
159c227f099SAnthony Liguori typedef abi_long target_clock_t;
16032f36bceSbellard 
161c596ed17Sbellard #define TARGET_HZ 100
162c596ed17Sbellard 
16332f36bceSbellard struct target_tms {
164c227f099SAnthony Liguori     target_clock_t tms_utime;
165c227f099SAnthony Liguori     target_clock_t tms_stime;
166c227f099SAnthony Liguori     target_clock_t tms_cutime;
167c227f099SAnthony Liguori     target_clock_t tms_cstime;
16832f36bceSbellard };
16932f36bceSbellard 
1706180a181Sbellard struct target_utimbuf {
171992f48a0Sblueswir1     abi_long actime;
172992f48a0Sblueswir1     abi_long modtime;
1736180a181Sbellard };
1746180a181Sbellard 
175f2674e31Sbellard struct target_sel_arg_struct {
176992f48a0Sblueswir1     abi_long n;
177992f48a0Sblueswir1     abi_long inp, outp, exp;
178992f48a0Sblueswir1     abi_long tvp;
179f2674e31Sbellard };
180f2674e31Sbellard 
18131e31b8aSbellard struct target_iovec {
182992f48a0Sblueswir1     abi_long iov_base;   /* Starting address */
183992f48a0Sblueswir1     abi_long iov_len;   /* Number of bytes */
18431e31b8aSbellard };
18531e31b8aSbellard 
1861a9353d2Sbellard struct target_msghdr {
187992f48a0Sblueswir1     abi_long	 msg_name;	 /* Socket name			*/
1881a9353d2Sbellard     int		 msg_namelen;	 /* Length of name		*/
189992f48a0Sblueswir1     abi_long	 msg_iov;	 /* Data blocks			*/
190992f48a0Sblueswir1     abi_long	 msg_iovlen;	 /* Number of blocks		*/
191992f48a0Sblueswir1     abi_long     msg_control;	 /* Per protocol magic (eg BSD file descriptor passing) */
192992f48a0Sblueswir1     abi_long	 msg_controllen; /* Length of cmsg list */
1931a9353d2Sbellard     unsigned int msg_flags;
1941a9353d2Sbellard };
1951a9353d2Sbellard 
1967854b056Sbellard struct target_cmsghdr {
197992f48a0Sblueswir1     abi_long     cmsg_len;
1987854b056Sbellard     int          cmsg_level;
1997854b056Sbellard     int          cmsg_type;
2007854b056Sbellard };
2017854b056Sbellard 
2027854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1))
2037854b056Sbellard #define TARGET_CMSG_NXTHDR(mhdr, cmsg) __target_cmsg_nxthdr (mhdr, cmsg)
204992f48a0Sblueswir1 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \
205992f48a0Sblueswir1                                & (size_t) ~(sizeof (abi_long) - 1))
2067854b056Sbellard #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \
2077854b056Sbellard                                + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)))
2087854b056Sbellard #define TARGET_CMSG_LEN(len)   (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len))
2097854b056Sbellard 
2107854b056Sbellard static __inline__ struct target_cmsghdr *
2117854b056Sbellard __target_cmsg_nxthdr (struct target_msghdr *__mhdr, struct target_cmsghdr *__cmsg)
2127854b056Sbellard {
2132b8bdefcSths   struct target_cmsghdr *__ptr;
2147854b056Sbellard 
2152b8bdefcSths   __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg
216cbb21eedSMatthias Braun                                     + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len)));
217cbb21eedSMatthias Braun   if ((unsigned long)((char *)(__ptr+1) - (char *)(size_t)tswapal(__mhdr->msg_control))
218cbb21eedSMatthias Braun       > tswapal(__mhdr->msg_controllen))
2197854b056Sbellard     /* No more entries.  */
2202b8bdefcSths     return (struct target_cmsghdr *)0;
2217854b056Sbellard   return __cmsg;
2227854b056Sbellard }
2237854b056Sbellard 
2247854b056Sbellard 
22531e31b8aSbellard struct  target_rusage {
22631e31b8aSbellard         struct target_timeval ru_utime;        /* user time used */
22731e31b8aSbellard         struct target_timeval ru_stime;        /* system time used */
228992f48a0Sblueswir1         abi_long    ru_maxrss;                 /* maximum resident set size */
229992f48a0Sblueswir1         abi_long    ru_ixrss;                  /* integral shared memory size */
230992f48a0Sblueswir1         abi_long    ru_idrss;                  /* integral unshared data size */
231992f48a0Sblueswir1         abi_long    ru_isrss;                  /* integral unshared stack size */
232992f48a0Sblueswir1         abi_long    ru_minflt;                 /* page reclaims */
233992f48a0Sblueswir1         abi_long    ru_majflt;                 /* page faults */
234992f48a0Sblueswir1         abi_long    ru_nswap;                  /* swaps */
235992f48a0Sblueswir1         abi_long    ru_inblock;                /* block input operations */
236992f48a0Sblueswir1         abi_long    ru_oublock;                /* block output operations */
237992f48a0Sblueswir1         abi_long    ru_msgsnd;                 /* messages sent */
238992f48a0Sblueswir1         abi_long    ru_msgrcv;                 /* messages received */
239992f48a0Sblueswir1         abi_long    ru_nsignals;               /* signals received */
240992f48a0Sblueswir1         abi_long    ru_nvcsw;                  /* voluntary context switches */
241992f48a0Sblueswir1         abi_long    ru_nivcsw;                 /* involuntary " */
24231e31b8aSbellard };
24331e31b8aSbellard 
24431e31b8aSbellard typedef struct {
24531e31b8aSbellard         int     val[2];
246c227f099SAnthony Liguori } kernel_fsid_t;
24731e31b8aSbellard 
24872f03900Sbellard struct kernel_statfs {
24931e31b8aSbellard 	int f_type;
25031e31b8aSbellard 	int f_bsize;
25131e31b8aSbellard 	int f_blocks;
25231e31b8aSbellard 	int f_bfree;
25331e31b8aSbellard 	int f_bavail;
25431e31b8aSbellard 	int f_files;
25531e31b8aSbellard 	int f_ffree;
256c227f099SAnthony Liguori         kernel_fsid_t f_fsid;
25731e31b8aSbellard 	int f_namelen;
25831e31b8aSbellard 	int f_spare[6];
25931e31b8aSbellard };
26031e31b8aSbellard 
261dab2ed99Sbellard struct target_dirent {
262992f48a0Sblueswir1         abi_long        d_ino;
263992f48a0Sblueswir1         abi_long        d_off;
264dab2ed99Sbellard         unsigned short  d_reclen;
265333858b7SDmitry V. Levin         char            d_name[];
266dab2ed99Sbellard };
267dab2ed99Sbellard 
268dab2ed99Sbellard struct target_dirent64 {
269dab2ed99Sbellard 	uint64_t	d_ino;
270dab2ed99Sbellard 	int64_t		d_off;
271dab2ed99Sbellard 	unsigned short	d_reclen;
272dab2ed99Sbellard 	unsigned char	d_type;
273dab2ed99Sbellard 	char		d_name[256];
274dab2ed99Sbellard };
275dab2ed99Sbellard 
276dab2ed99Sbellard 
27731e31b8aSbellard /* mostly generic signal stuff */
278992f48a0Sblueswir1 #define TARGET_SIG_DFL	((abi_long)0)	/* default signal handling */
279992f48a0Sblueswir1 #define TARGET_SIG_IGN	((abi_long)1)	/* ignore signal */
280992f48a0Sblueswir1 #define TARGET_SIG_ERR	((abi_long)-1)	/* error return from signal */
28131e31b8aSbellard 
28231e31b8aSbellard #ifdef TARGET_MIPS
28331e31b8aSbellard #define TARGET_NSIG	   128
28431e31b8aSbellard #else
28531e31b8aSbellard #define TARGET_NSIG	   64
28631e31b8aSbellard #endif
287992f48a0Sblueswir1 #define TARGET_NSIG_BPW	   TARGET_ABI_BITS
28831e31b8aSbellard #define TARGET_NSIG_WORDS  (TARGET_NSIG / TARGET_NSIG_BPW)
28931e31b8aSbellard 
29031e31b8aSbellard typedef struct {
291992f48a0Sblueswir1     abi_ulong sig[TARGET_NSIG_WORDS];
292c227f099SAnthony Liguori } target_sigset_t;
29331e31b8aSbellard 
29466fb9763Sbellard #ifdef BSWAP_NEEDED
295c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
29666fb9763Sbellard {
29766fb9763Sbellard     int i;
29866fb9763Sbellard     for(i = 0;i < TARGET_NSIG_WORDS; i++)
299cbb21eedSMatthias Braun         d->sig[i] = tswapal(s->sig[i]);
30066fb9763Sbellard }
30166fb9763Sbellard #else
302c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
30366fb9763Sbellard {
30466fb9763Sbellard     *d = *s;
30566fb9763Sbellard }
30666fb9763Sbellard #endif
30766fb9763Sbellard 
308c227f099SAnthony Liguori static inline void target_siginitset(target_sigset_t *d, abi_ulong set)
30966fb9763Sbellard {
31066fb9763Sbellard     int i;
31166fb9763Sbellard     d->sig[0] = set;
31266fb9763Sbellard     for(i = 1;i < TARGET_NSIG_WORDS; i++)
31366fb9763Sbellard         d->sig[i] = 0;
31466fb9763Sbellard }
31566fb9763Sbellard 
316c227f099SAnthony Liguori void host_to_target_sigset(target_sigset_t *d, const sigset_t *s);
317c227f099SAnthony Liguori void target_to_host_sigset(sigset_t *d, const target_sigset_t *s);
318992f48a0Sblueswir1 void host_to_target_old_sigset(abi_ulong *old_sigset,
31966fb9763Sbellard                                const sigset_t *sigset);
32066fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset,
321992f48a0Sblueswir1                                const abi_ulong *old_sigset);
32266fb9763Sbellard struct target_sigaction;
32366fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act,
32466fb9763Sbellard                  struct target_sigaction *oact);
32566fb9763Sbellard 
326d2fbca94SGuan Xuetao #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \
327d2fbca94SGuan Xuetao     || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined(TARGET_SH4) \
328d2fbca94SGuan Xuetao     || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) \
329a4c075f1SUlrich Hecht     || defined(TARGET_MICROBLAZE) || defined(TARGET_UNICORE32) \
330d962783eSJia Liu     || defined(TARGET_S390X) || defined(TARGET_OPENRISC)
3312521d698Sbellard 
332048f6b4dSbellard #if defined(TARGET_SPARC)
333048f6b4dSbellard #define TARGET_SA_NOCLDSTOP    8u
334048f6b4dSbellard #define TARGET_SA_NOCLDWAIT    0x100u
335048f6b4dSbellard #define TARGET_SA_SIGINFO      0x200u
336048f6b4dSbellard #define TARGET_SA_ONSTACK      1u
337048f6b4dSbellard #define TARGET_SA_RESTART      2u
338048f6b4dSbellard #define TARGET_SA_NODEFER      0x20u
339048f6b4dSbellard #define TARGET_SA_RESETHAND    4u
340048f6b4dSbellard #elif defined(TARGET_MIPS)
341048f6b4dSbellard #define TARGET_SA_NOCLDSTOP	0x00000001
342048f6b4dSbellard #define TARGET_SA_NOCLDWAIT	0x00010000
343048f6b4dSbellard #define TARGET_SA_SIGINFO	0x00000008
344048f6b4dSbellard #define TARGET_SA_ONSTACK	0x08000000
345048f6b4dSbellard #define TARGET_SA_NODEFER	0x40000000
346048f6b4dSbellard #define TARGET_SA_RESTART	0x10000000
347048f6b4dSbellard #define TARGET_SA_RESETHAND	0x80000000
348d26bc211Sths #if !defined(TARGET_ABI_MIPSN32) && !defined(TARGET_ABI_MIPSN64)
349d26bc211Sths #define TARGET_SA_RESTORER	0x04000000	/* Only for O32 */
350540635baSths #endif
351d962783eSJia Liu #elif defined(TARGET_OPENRISC)
352d962783eSJia Liu #define TARGET_SA_NOCLDSTOP    0x00000001
353d962783eSJia Liu #define TARGET_SA_NOCLDWAIT    0x00000002
354d962783eSJia Liu #define TARGET_SA_SIGINFO      0x00000004
355d962783eSJia Liu #define TARGET_SA_ONSTACK      0x08000000
356d962783eSJia Liu #define TARGET_SA_RESTART      0x10000000
357d962783eSJia Liu #define TARGET_SA_NODEFER      0x40000000
358d962783eSJia Liu #define TARGET_SA_RESETHAND    0x80000000
35957f18a95SRichard Henderson #elif defined(TARGET_ALPHA)
36057f18a95SRichard Henderson #define TARGET_SA_ONSTACK	0x00000001
36157f18a95SRichard Henderson #define TARGET_SA_RESTART	0x00000002
36257f18a95SRichard Henderson #define TARGET_SA_NOCLDSTOP	0x00000004
36357f18a95SRichard Henderson #define TARGET_SA_NODEFER	0x00000008
36457f18a95SRichard Henderson #define TARGET_SA_RESETHAND	0x00000010
36557f18a95SRichard Henderson #define TARGET_SA_NOCLDWAIT	0x00000020 /* not supported yet */
36657f18a95SRichard Henderson #define TARGET_SA_SIGINFO	0x00000040
367048f6b4dSbellard #else
3682521d698Sbellard #define TARGET_SA_NOCLDSTOP	0x00000001
3692521d698Sbellard #define TARGET_SA_NOCLDWAIT	0x00000002 /* not supported yet */
3702521d698Sbellard #define TARGET_SA_SIGINFO	0x00000004
3712521d698Sbellard #define TARGET_SA_ONSTACK	0x08000000
3722521d698Sbellard #define TARGET_SA_RESTART	0x10000000
3732521d698Sbellard #define TARGET_SA_NODEFER	0x40000000
3742521d698Sbellard #define TARGET_SA_RESETHAND	0x80000000
3752521d698Sbellard #define TARGET_SA_RESTORER	0x04000000
3766d5e216dSbellard #endif
3776d5e216dSbellard 
378d0f20495SRichard Henderson #if defined(TARGET_ALPHA)
379d0f20495SRichard Henderson 
380d0f20495SRichard Henderson #define TARGET_SIGHUP            1
381d0f20495SRichard Henderson #define TARGET_SIGINT            2
382d0f20495SRichard Henderson #define TARGET_SIGQUIT           3
383d0f20495SRichard Henderson #define TARGET_SIGILL            4
384d0f20495SRichard Henderson #define TARGET_SIGTRAP           5
385d0f20495SRichard Henderson #define TARGET_SIGABRT           6
386d0f20495SRichard Henderson #define TARGET_SIGSTKFLT         7 /* actually SIGEMT */
387d0f20495SRichard Henderson #define TARGET_SIGFPE            8
388d0f20495SRichard Henderson #define TARGET_SIGKILL           9
389d0f20495SRichard Henderson #define TARGET_SIGBUS           10
390d0f20495SRichard Henderson #define TARGET_SIGSEGV          11
391d0f20495SRichard Henderson #define TARGET_SIGSYS           12
392d0f20495SRichard Henderson #define TARGET_SIGPIPE          13
393d0f20495SRichard Henderson #define TARGET_SIGALRM          14
394d0f20495SRichard Henderson #define TARGET_SIGTERM          15
395d0f20495SRichard Henderson #define TARGET_SIGURG           16
396d0f20495SRichard Henderson #define TARGET_SIGSTOP          17
397d0f20495SRichard Henderson #define TARGET_SIGTSTP          18
398d0f20495SRichard Henderson #define TARGET_SIGCONT          19
399d0f20495SRichard Henderson #define TARGET_SIGCHLD          20
400d0f20495SRichard Henderson #define TARGET_SIGTTIN          21
401d0f20495SRichard Henderson #define TARGET_SIGTTOU          22
402d0f20495SRichard Henderson #define TARGET_SIGIO            23
403d0f20495SRichard Henderson #define TARGET_SIGXCPU          24
404d0f20495SRichard Henderson #define TARGET_SIGXFSZ          25
405d0f20495SRichard Henderson #define TARGET_SIGVTALRM        26
406d0f20495SRichard Henderson #define TARGET_SIGPROF          27
407d0f20495SRichard Henderson #define TARGET_SIGWINCH         28
408d0f20495SRichard Henderson #define TARGET_SIGPWR           29 /* actually SIGINFO */
409d0f20495SRichard Henderson #define TARGET_SIGUSR1          30
410d0f20495SRichard Henderson #define TARGET_SIGUSR2          31
411d0f20495SRichard Henderson #define TARGET_SIGRTMIN         32
412d0f20495SRichard Henderson 
413d0f20495SRichard Henderson #define TARGET_SIG_BLOCK         1
414d0f20495SRichard Henderson #define TARGET_SIG_UNBLOCK       2
415d0f20495SRichard Henderson #define TARGET_SIG_SETMASK       3
416d0f20495SRichard Henderson 
417d0f20495SRichard Henderson #elif defined(TARGET_SPARC)
4186d5e216dSbellard 
4196d5e216dSbellard #define TARGET_SIGHUP		 1
4206d5e216dSbellard #define TARGET_SIGINT		 2
4216d5e216dSbellard #define TARGET_SIGQUIT		 3
4226d5e216dSbellard #define TARGET_SIGILL		 4
4236d5e216dSbellard #define TARGET_SIGTRAP		 5
4246d5e216dSbellard #define TARGET_SIGABRT		 6
4256d5e216dSbellard #define TARGET_SIGIOT		 6
4266d5e216dSbellard #define TARGET_SIGSTKFLT	 7 /* actually EMT */
4276d5e216dSbellard #define TARGET_SIGFPE		 8
4286d5e216dSbellard #define TARGET_SIGKILL		 9
4296d5e216dSbellard #define TARGET_SIGBUS		10
4306d5e216dSbellard #define TARGET_SIGSEGV		11
4316d5e216dSbellard #define TARGET_SIGSYS		12
4326d5e216dSbellard #define TARGET_SIGPIPE		13
4336d5e216dSbellard #define TARGET_SIGALRM		14
4346d5e216dSbellard #define TARGET_SIGTERM		15
4356d5e216dSbellard #define TARGET_SIGURG		16
4366d5e216dSbellard #define TARGET_SIGSTOP		17
4376d5e216dSbellard #define TARGET_SIGTSTP		18
4386d5e216dSbellard #define TARGET_SIGCONT		19
4396d5e216dSbellard #define TARGET_SIGCHLD		20
4406d5e216dSbellard #define TARGET_SIGTTIN		21
4416d5e216dSbellard #define TARGET_SIGTTOU		22
4426d5e216dSbellard #define TARGET_SIGIO		23
4436d5e216dSbellard #define TARGET_SIGXCPU		24
4446d5e216dSbellard #define TARGET_SIGXFSZ		25
4456d5e216dSbellard #define TARGET_SIGVTALRM	26
4466d5e216dSbellard #define TARGET_SIGPROF		27
4476d5e216dSbellard #define TARGET_SIGWINCH	        28
4486d5e216dSbellard #define TARGET_SIGPWR		29
4496d5e216dSbellard #define TARGET_SIGUSR1		30
4506d5e216dSbellard #define TARGET_SIGUSR2		31
4516d5e216dSbellard #define TARGET_SIGRTMIN         32
4526d5e216dSbellard 
4536d5e216dSbellard #define TARGET_SIG_BLOCK          0x01 /* for blocking signals */
4546d5e216dSbellard #define TARGET_SIG_UNBLOCK        0x02 /* for unblocking signals */
4556d5e216dSbellard #define TARGET_SIG_SETMASK        0x04 /* for setting the signal mask */
4566d5e216dSbellard 
457048f6b4dSbellard #elif defined(TARGET_MIPS)
458048f6b4dSbellard 
459048f6b4dSbellard #define TARGET_SIGHUP		 1	/* Hangup (POSIX).  */
460048f6b4dSbellard #define TARGET_SIGINT		 2	/* Interrupt (ANSI).  */
461048f6b4dSbellard #define TARGET_SIGQUIT		 3	/* Quit (POSIX).  */
462048f6b4dSbellard #define TARGET_SIGILL		 4	/* Illegal instruction (ANSI).  */
463048f6b4dSbellard #define TARGET_SIGTRAP		 5	/* Trace trap (POSIX).  */
464048f6b4dSbellard #define TARGET_SIGIOT		 6	/* IOT trap (4.2 BSD).  */
465048f6b4dSbellard #define TARGET_SIGABRT		 TARGET_SIGIOT	/* Abort (ANSI).  */
466048f6b4dSbellard #define TARGET_SIGEMT		 7
467048f6b4dSbellard #define TARGET_SIGSTKFLT	 7 /* XXX: incorrect */
468048f6b4dSbellard #define TARGET_SIGFPE		 8	/* Floating-point exception (ANSI).  */
469048f6b4dSbellard #define TARGET_SIGKILL		 9	/* Kill, unblockable (POSIX).  */
470048f6b4dSbellard #define TARGET_SIGBUS		10	/* BUS error (4.2 BSD).  */
471048f6b4dSbellard #define TARGET_SIGSEGV		11	/* Segmentation violation (ANSI).  */
472048f6b4dSbellard #define TARGET_SIGSYS		12
473048f6b4dSbellard #define TARGET_SIGPIPE		13	/* Broken pipe (POSIX).  */
474048f6b4dSbellard #define TARGET_SIGALRM		14	/* Alarm clock (POSIX).  */
475048f6b4dSbellard #define TARGET_SIGTERM		15	/* Termination (ANSI).  */
476048f6b4dSbellard #define TARGET_SIGUSR1		16	/* User-defined signal 1 (POSIX).  */
477048f6b4dSbellard #define TARGET_SIGUSR2		17	/* User-defined signal 2 (POSIX).  */
478048f6b4dSbellard #define TARGET_SIGCHLD		18	/* Child status has changed (POSIX).  */
479048f6b4dSbellard #define TARGET_SIGCLD		TARGET_SIGCHLD	/* Same as TARGET_SIGCHLD (System V).  */
480048f6b4dSbellard #define TARGET_SIGPWR		19	/* Power failure restart (System V).  */
481048f6b4dSbellard #define TARGET_SIGWINCH	20	/* Window size change (4.3 BSD, Sun).  */
482048f6b4dSbellard #define TARGET_SIGURG		21	/* Urgent condition on socket (4.2 BSD).  */
483048f6b4dSbellard #define TARGET_SIGIO		22	/* I/O now possible (4.2 BSD).  */
484048f6b4dSbellard #define TARGET_SIGPOLL		TARGET_SIGIO	/* Pollable event occurred (System V).  */
485048f6b4dSbellard #define TARGET_SIGSTOP		23	/* Stop, unblockable (POSIX).  */
486048f6b4dSbellard #define TARGET_SIGTSTP		24	/* Keyboard stop (POSIX).  */
487048f6b4dSbellard #define TARGET_SIGCONT		25	/* Continue (POSIX).  */
488048f6b4dSbellard #define TARGET_SIGTTIN		26	/* Background read from tty (POSIX).  */
489048f6b4dSbellard #define TARGET_SIGTTOU		27	/* Background write to tty (POSIX).  */
490048f6b4dSbellard #define TARGET_SIGVTALRM	28	/* Virtual alarm clock (4.2 BSD).  */
491048f6b4dSbellard #define TARGET_SIGPROF		29	/* Profiling alarm clock (4.2 BSD).  */
492048f6b4dSbellard #define TARGET_SIGXCPU		30	/* CPU limit exceeded (4.2 BSD).  */
493048f6b4dSbellard #define TARGET_SIGXFSZ		31	/* File size limit exceeded (4.2 BSD).  */
494048f6b4dSbellard #define TARGET_SIGRTMIN         32
495048f6b4dSbellard 
496048f6b4dSbellard #define TARGET_SIG_BLOCK	1	/* for blocking signals */
497048f6b4dSbellard #define TARGET_SIG_UNBLOCK	2	/* for unblocking signals */
498048f6b4dSbellard #define TARGET_SIG_SETMASK	3	/* for setting the signal mask */
499048f6b4dSbellard 
5006d5e216dSbellard #else
5012521d698Sbellard 
502d962783eSJia Liu /* OpenRISC Using the general signals */
5032521d698Sbellard #define TARGET_SIGHUP		 1
5042521d698Sbellard #define TARGET_SIGINT		 2
5052521d698Sbellard #define TARGET_SIGQUIT		 3
5062521d698Sbellard #define TARGET_SIGILL		 4
5072521d698Sbellard #define TARGET_SIGTRAP		 5
5082521d698Sbellard #define TARGET_SIGABRT		 6
5092521d698Sbellard #define TARGET_SIGIOT		 6
5102521d698Sbellard #define TARGET_SIGBUS		 7
5112521d698Sbellard #define TARGET_SIGFPE		 8
5122521d698Sbellard #define TARGET_SIGKILL		 9
5132521d698Sbellard #define TARGET_SIGUSR1		10
5142521d698Sbellard #define TARGET_SIGSEGV		11
5152521d698Sbellard #define TARGET_SIGUSR2		12
5162521d698Sbellard #define TARGET_SIGPIPE		13
5172521d698Sbellard #define TARGET_SIGALRM		14
5182521d698Sbellard #define TARGET_SIGTERM		15
5192521d698Sbellard #define TARGET_SIGSTKFLT	16
5202521d698Sbellard #define TARGET_SIGCHLD		17
5212521d698Sbellard #define TARGET_SIGCONT		18
5222521d698Sbellard #define TARGET_SIGSTOP		19
5232521d698Sbellard #define TARGET_SIGTSTP		20
5242521d698Sbellard #define TARGET_SIGTTIN		21
5252521d698Sbellard #define TARGET_SIGTTOU		22
5262521d698Sbellard #define TARGET_SIGURG		23
5272521d698Sbellard #define TARGET_SIGXCPU		24
5282521d698Sbellard #define TARGET_SIGXFSZ		25
5292521d698Sbellard #define TARGET_SIGVTALRM	26
5302521d698Sbellard #define TARGET_SIGPROF		27
5312521d698Sbellard #define TARGET_SIGWINCH	        28
5322521d698Sbellard #define TARGET_SIGIO		29
533c596ed17Sbellard #define TARGET_SIGPWR		30
534c596ed17Sbellard #define TARGET_SIGSYS		31
5352521d698Sbellard #define TARGET_SIGRTMIN         32
5362521d698Sbellard 
5372521d698Sbellard #define TARGET_SIG_BLOCK          0    /* for blocking signals */
5382521d698Sbellard #define TARGET_SIG_UNBLOCK        1    /* for unblocking signals */
5392521d698Sbellard #define TARGET_SIG_SETMASK        2    /* for setting the signal mask */
5402521d698Sbellard 
5416d5e216dSbellard #endif
5426d5e216dSbellard 
5436049f4f8SRichard Henderson #if defined(TARGET_ALPHA)
5446049f4f8SRichard Henderson struct target_old_sigaction {
5456049f4f8SRichard Henderson     abi_ulong _sa_handler;
5466049f4f8SRichard Henderson     abi_ulong sa_mask;
5476049f4f8SRichard Henderson     abi_ulong sa_flags;
5486049f4f8SRichard Henderson };
549106ec879Sbellard 
5506049f4f8SRichard Henderson struct target_rt_sigaction {
5516049f4f8SRichard Henderson     abi_ulong _sa_handler;
5526049f4f8SRichard Henderson     abi_ulong sa_flags;
5536049f4f8SRichard Henderson     target_sigset_t sa_mask;
5546049f4f8SRichard Henderson };
5556049f4f8SRichard Henderson 
5566049f4f8SRichard Henderson /* This is the struct used inside the kernel.  The ka_restorer
5576049f4f8SRichard Henderson    field comes from the 5th argument to sys_rt_sigaction.  */
5586049f4f8SRichard Henderson struct target_sigaction {
5596049f4f8SRichard Henderson     abi_ulong _sa_handler;
5606049f4f8SRichard Henderson     abi_ulong sa_flags;
5616049f4f8SRichard Henderson     target_sigset_t sa_mask;
5626049f4f8SRichard Henderson     abi_ulong sa_restorer;
5636049f4f8SRichard Henderson };
5646049f4f8SRichard Henderson #elif defined(TARGET_MIPS)
565106ec879Sbellard struct target_sigaction {
566540635baSths 	uint32_t	sa_flags;
567d26bc211Sths #if defined(TARGET_ABI_MIPSN32)
568540635baSths 	uint32_t	_sa_handler;
569540635baSths #else
570992f48a0Sblueswir1 	abi_ulong	_sa_handler;
571540635baSths #endif
572c227f099SAnthony Liguori 	target_sigset_t	sa_mask;
573106ec879Sbellard };
574106ec879Sbellard #else
5752521d698Sbellard struct target_old_sigaction {
576992f48a0Sblueswir1         abi_ulong _sa_handler;
577992f48a0Sblueswir1         abi_ulong sa_mask;
578992f48a0Sblueswir1         abi_ulong sa_flags;
579992f48a0Sblueswir1         abi_ulong sa_restorer;
5802521d698Sbellard };
5812521d698Sbellard 
5822521d698Sbellard struct target_sigaction {
583992f48a0Sblueswir1         abi_ulong _sa_handler;
584992f48a0Sblueswir1         abi_ulong sa_flags;
585992f48a0Sblueswir1         abi_ulong sa_restorer;
586c227f099SAnthony Liguori         target_sigset_t sa_mask;
5872521d698Sbellard };
588106ec879Sbellard #endif
5892521d698Sbellard 
5902521d698Sbellard typedef union target_sigval {
5912521d698Sbellard 	int sival_int;
592992f48a0Sblueswir1         abi_ulong sival_ptr;
593c227f099SAnthony Liguori } target_sigval_t;
5946d5e216dSbellard #if 0
5956d5e216dSbellard #if defined (TARGET_SPARC)
5966d5e216dSbellard typedef struct {
5976d5e216dSbellard 	struct {
598992f48a0Sblueswir1 		abi_ulong psr;
599992f48a0Sblueswir1 		abi_ulong pc;
600992f48a0Sblueswir1 		abi_ulong npc;
601992f48a0Sblueswir1 		abi_ulong y;
602992f48a0Sblueswir1 		abi_ulong u_regs[16]; /* globals and ins */
6036d5e216dSbellard 	}		si_regs;
6046d5e216dSbellard 	int		si_mask;
6056d5e216dSbellard } __siginfo_t;
6066d5e216dSbellard 
6076d5e216dSbellard typedef struct {
6086d5e216dSbellard 	unsigned   long si_float_regs [32];
6096d5e216dSbellard 	unsigned   long si_fsr;
6106d5e216dSbellard 	unsigned   long si_fpqdepth;
6116d5e216dSbellard 	struct {
6126d5e216dSbellard 		unsigned long *insn_addr;
6136d5e216dSbellard 		unsigned long insn;
6146d5e216dSbellard 	} si_fpqueue [16];
6156d5e216dSbellard } __siginfo_fpu_t;
6166d5e216dSbellard #endif
6176d5e216dSbellard #endif
6182521d698Sbellard 
6192521d698Sbellard #define TARGET_SI_MAX_SIZE	128
6202521d698Sbellard #define TARGET_SI_PAD_SIZE	((TARGET_SI_MAX_SIZE/sizeof(int)) - 3)
6212521d698Sbellard 
6222521d698Sbellard typedef struct target_siginfo {
6233f53d546Spbrook #ifdef TARGET_MIPS
6243f53d546Spbrook 	int si_signo;
6253f53d546Spbrook 	int si_code;
6263f53d546Spbrook 	int si_errno;
6273f53d546Spbrook #else
6282521d698Sbellard 	int si_signo;
6292521d698Sbellard 	int si_errno;
6302521d698Sbellard 	int si_code;
6313f53d546Spbrook #endif
6322521d698Sbellard 
6332521d698Sbellard 	union {
6342521d698Sbellard 		int _pad[TARGET_SI_PAD_SIZE];
6352521d698Sbellard 
6362521d698Sbellard 		/* kill() */
6372521d698Sbellard 		struct {
6382521d698Sbellard 			pid_t _pid;		/* sender's pid */
6392521d698Sbellard 			uid_t _uid;		/* sender's uid */
6402521d698Sbellard 		} _kill;
6412521d698Sbellard 
6422521d698Sbellard 		/* POSIX.1b timers */
6432521d698Sbellard 		struct {
6442521d698Sbellard 			unsigned int _timer1;
6452521d698Sbellard 			unsigned int _timer2;
6462521d698Sbellard 		} _timer;
6472521d698Sbellard 
6482521d698Sbellard 		/* POSIX.1b signals */
6492521d698Sbellard 		struct {
6502521d698Sbellard 			pid_t _pid;		/* sender's pid */
6512521d698Sbellard 			uid_t _uid;		/* sender's uid */
652c227f099SAnthony Liguori 			target_sigval_t _sigval;
6532521d698Sbellard 		} _rt;
6542521d698Sbellard 
6552521d698Sbellard 		/* SIGCHLD */
6562521d698Sbellard 		struct {
6572521d698Sbellard 			pid_t _pid;		/* which child */
6582521d698Sbellard 			uid_t _uid;		/* sender's uid */
6592521d698Sbellard 			int _status;		/* exit code */
660c227f099SAnthony Liguori 			target_clock_t _utime;
661c227f099SAnthony Liguori                         target_clock_t _stime;
6622521d698Sbellard 		} _sigchld;
6632521d698Sbellard 
6642521d698Sbellard 		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
6652521d698Sbellard 		struct {
666992f48a0Sblueswir1 			abi_ulong _addr; /* faulting insn/memory ref. */
6672521d698Sbellard 		} _sigfault;
6682521d698Sbellard 
6692521d698Sbellard 		/* SIGPOLL */
6702521d698Sbellard 		struct {
6712521d698Sbellard 			int _band;	/* POLL_IN, POLL_OUT, POLL_MSG */
6722521d698Sbellard 			int _fd;
6732521d698Sbellard 		} _sigpoll;
6742521d698Sbellard 	} _sifields;
675c227f099SAnthony Liguori } target_siginfo_t;
6762521d698Sbellard 
6772521d698Sbellard /*
6782521d698Sbellard  * si_code values
6792521d698Sbellard  * Digital reserves positive values for kernel-generated signals.
6802521d698Sbellard  */
6812521d698Sbellard #define TARGET_SI_USER		0	/* sent by kill, sigsend, raise */
6822521d698Sbellard #define TARGET_SI_KERNEL	0x80	/* sent by the kernel from somewhere */
6832521d698Sbellard #define TARGET_SI_QUEUE	-1		/* sent by sigqueue */
6842521d698Sbellard #define TARGET_SI_TIMER -2              /* sent by timer expiration */
6852521d698Sbellard #define TARGET_SI_MESGQ	-3		/* sent by real time mesq state change */
6862521d698Sbellard #define TARGET_SI_ASYNCIO	-4	/* sent by AIO completion */
6872521d698Sbellard #define TARGET_SI_SIGIO	-5		/* sent by queued SIGIO */
6882521d698Sbellard 
6892521d698Sbellard /*
6902521d698Sbellard  * SIGILL si_codes
6912521d698Sbellard  */
692ffa65c3bSbellard #define TARGET_ILL_ILLOPC	(1)	/* illegal opcode */
6932521d698Sbellard #define TARGET_ILL_ILLOPN	(2)	/* illegal operand */
694ffa65c3bSbellard #define TARGET_ILL_ILLADR	(3)	/* illegal addressing mode */
695ffa65c3bSbellard #define TARGET_ILL_ILLTRP	(4)	/* illegal trap */
696ffa65c3bSbellard #define TARGET_ILL_PRVOPC	(5)	/* privileged opcode */
697ffa65c3bSbellard #define TARGET_ILL_PRVREG	(6)	/* privileged register */
698ffa65c3bSbellard #define TARGET_ILL_COPROC	(7)	/* coprocessor error */
699ffa65c3bSbellard #define TARGET_ILL_BADSTK	(8)	/* internal stack error */
7002521d698Sbellard 
7012521d698Sbellard /*
7022521d698Sbellard  * SIGFPE si_codes
7032521d698Sbellard  */
7042521d698Sbellard #define TARGET_FPE_INTDIV      (1)  /* integer divide by zero */
7052521d698Sbellard #define TARGET_FPE_INTOVF      (2)  /* integer overflow */
7062521d698Sbellard #define TARGET_FPE_FLTDIV      (3)  /* floating point divide by zero */
7072521d698Sbellard #define TARGET_FPE_FLTOVF      (4)  /* floating point overflow */
7082521d698Sbellard #define TARGET_FPE_FLTUND      (5)  /* floating point underflow */
7092521d698Sbellard #define TARGET_FPE_FLTRES      (6)  /* floating point inexact result */
7102521d698Sbellard #define TARGET_FPE_FLTINV      (7)  /* floating point invalid operation */
7112521d698Sbellard #define TARGET_FPE_FLTSUB      (8)  /* subscript out of range */
7122521d698Sbellard #define TARGET_NSIGFPE         8
7132521d698Sbellard 
7142521d698Sbellard /*
7152521d698Sbellard  * SIGSEGV si_codes
7162521d698Sbellard  */
7172521d698Sbellard #define TARGET_SEGV_MAPERR     (1)  /* address not mapped to object */
7182521d698Sbellard #define TARGET_SEGV_ACCERR     (2)  /* invalid permissions for mapped object */
7192521d698Sbellard 
7202521d698Sbellard /*
721ffa65c3bSbellard  * SIGBUS si_codes
722ffa65c3bSbellard  */
723ffa65c3bSbellard #define TARGET_BUS_ADRALN       (1)	/* invalid address alignment */
724b4916d7bSDong Xu Wang #define TARGET_BUS_ADRERR       (2)	/* non-existent physical address */
725ffa65c3bSbellard #define TARGET_BUS_OBJERR       (3)	/* object specific hardware error */
726ffa65c3bSbellard 
727ffa65c3bSbellard /*
7282521d698Sbellard  * SIGTRAP si_codes
7292521d698Sbellard  */
7302521d698Sbellard #define TARGET_TRAP_BRKPT	(1)	/* process breakpoint */
7312521d698Sbellard #define TARGET_TRAP_TRACE	(2)	/* process trace trap */
7322521d698Sbellard 
7332521d698Sbellard #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */
7342521d698Sbellard 
7359de5e440Sbellard struct target_rlimit {
736992f48a0Sblueswir1         abi_ulong   rlim_cur;
737992f48a0Sblueswir1         abi_ulong   rlim_max;
7389de5e440Sbellard };
7399de5e440Sbellard 
74081bbe906Stakasi-y@ops.dti.ne.jp #if defined(TARGET_ALPHA)
741e476492eSAurelien Jarno #define TARGET_RLIM_INFINITY	0x7fffffffffffffffull
7426cafd027SMatthias Braun #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32)
74381bbe906Stakasi-y@ops.dti.ne.jp #define TARGET_RLIM_INFINITY	0x7fffffffUL
74481bbe906Stakasi-y@ops.dti.ne.jp #else
74526b746dbSMatthias Braun #define TARGET_RLIM_INFINITY	((abi_ulong)-1)
74681bbe906Stakasi-y@ops.dti.ne.jp #endif
74781bbe906Stakasi-y@ops.dti.ne.jp 
748e22b7015SWesley W. Terpstra #if defined(TARGET_MIPS)
749e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU		0
750e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE		1
751e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA		2
752e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK		3
753e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE		4
754e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS		7
755e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC		8
756e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE		5
757e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK		9
758e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS		6
759e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS		10
760e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING	11
761e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE		12
762e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE		13
763e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO		14
764e22b7015SWesley W. Terpstra #else
765e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU		0
766e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE		1
767e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA		2
768e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK		3
769e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE		4
770e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS		5
7716cafd027SMatthias Braun #if defined(TARGET_SPARC)
7726cafd027SMatthias Braun #define TARGET_RLIMIT_NOFILE		6
7736cafd027SMatthias Braun #define TARGET_RLIMIT_NPROC		7
7746cafd027SMatthias Braun #else
775e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC		6
776e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE		7
7776cafd027SMatthias Braun #endif
778e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK		8
779e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS		9
780e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS		10
781e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING	11
782e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE		12
783e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE		13
784e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO		14
785e22b7015SWesley W. Terpstra #endif
786e22b7015SWesley W. Terpstra 
7879de5e440Sbellard struct target_pollfd {
7889de5e440Sbellard     int fd;           /* file descriptor */
7899de5e440Sbellard     short events;     /* requested events */
7909de5e440Sbellard     short revents;    /* returned events */
7919de5e440Sbellard };
7929de5e440Sbellard 
7938e5a0667Sbellard /* virtual terminal ioctls */
7940221cfcdSbellard #define TARGET_KIOCSOUND       0x4B2F	/* start sound generation (0 for off) */
7950221cfcdSbellard #define TARGET_KDMKTONE	       0x4B30	/* generate tone */
7968e5a0667Sbellard #define TARGET_KDGKBTYPE       0x4b33
797f7680a55SUlrich Hecht #define TARGET_KDSETMODE       0x4b3a
798f7680a55SUlrich Hecht #define TARGET_KDGKBMODE       0x4b44
799f7680a55SUlrich Hecht #define TARGET_KDSKBMODE       0x4b45
8000221cfcdSbellard #define TARGET_KDGKBENT	       0x4B46	/* gets one entry in translation table */
8010221cfcdSbellard #define TARGET_KDGKBSENT       0x4B48	/* gets one function key string entry */
802e6fe18fbSCédric VINCENT #define TARGET_KDGKBLED        0x4B64	/* get led flags (not lights) */
803e6fe18fbSCédric VINCENT #define TARGET_KDSKBLED        0x4B65	/* set led flags (not lights) */
804e6fe18fbSCédric VINCENT #define TARGET_KDGETLED        0x4B31	/* return current led state */
805e6fe18fbSCédric VINCENT #define TARGET_KDSETLED        0x4B32	/* set led state [lights, not flags] */
8068e5a0667Sbellard 
8072521d698Sbellard #define TARGET_SIOCATMARK      0x8905
8082521d698Sbellard 
80931e31b8aSbellard /* Networking ioctls */
81031e31b8aSbellard #define TARGET_SIOCADDRT       0x890B          /* add routing table entry */
81131e31b8aSbellard #define TARGET_SIOCDELRT       0x890C          /* delete routing table entry */
81231e31b8aSbellard #define TARGET_SIOCGIFNAME     0x8910          /* get iface name               */
81331e31b8aSbellard #define TARGET_SIOCSIFLINK     0x8911          /* set iface channel            */
81431e31b8aSbellard #define TARGET_SIOCGIFCONF     0x8912          /* get iface list               */
81531e31b8aSbellard #define TARGET_SIOCGIFFLAGS    0x8913          /* get flags                    */
81631e31b8aSbellard #define TARGET_SIOCSIFFLAGS    0x8914          /* set flags                    */
81731e31b8aSbellard #define TARGET_SIOCGIFADDR     0x8915          /* get PA address               */
81831e31b8aSbellard #define TARGET_SIOCSIFADDR     0x8916          /* set PA address               */
81931e31b8aSbellard #define TARGET_SIOCGIFDSTADDR  0x8917          /* get remote PA address        */
82031e31b8aSbellard #define TARGET_SIOCSIFDSTADDR  0x8918          /* set remote PA address        */
82131e31b8aSbellard #define TARGET_SIOCGIFBRDADDR  0x8919          /* get broadcast PA address     */
82231e31b8aSbellard #define TARGET_SIOCSIFBRDADDR  0x891a          /* set broadcast PA address     */
82331e31b8aSbellard #define TARGET_SIOCGIFNETMASK  0x891b          /* get network PA mask          */
82431e31b8aSbellard #define TARGET_SIOCSIFNETMASK  0x891c          /* set network PA mask          */
82531e31b8aSbellard #define TARGET_SIOCGIFMETRIC   0x891d          /* get metric                   */
82631e31b8aSbellard #define TARGET_SIOCSIFMETRIC   0x891e          /* set metric                   */
82731e31b8aSbellard #define TARGET_SIOCGIFMEM      0x891f          /* get memory address (BSD)     */
82831e31b8aSbellard #define TARGET_SIOCSIFMEM      0x8920          /* set memory address (BSD)     */
82931e31b8aSbellard #define TARGET_SIOCGIFMTU      0x8921          /* get MTU size                 */
83031e31b8aSbellard #define TARGET_SIOCSIFMTU      0x8922          /* set MTU size                 */
83131e31b8aSbellard #define TARGET_SIOCSIFHWADDR   0x8924          /* set hardware address (NI)    */
83231e31b8aSbellard #define TARGET_SIOCGIFENCAP    0x8925          /* get/set slip encapsulation   */
83331e31b8aSbellard #define TARGET_SIOCSIFENCAP    0x8926
83431e31b8aSbellard #define TARGET_SIOCGIFHWADDR   0x8927          /* Get hardware address         */
83531e31b8aSbellard #define TARGET_SIOCGIFSLAVE    0x8929          /* Driver slaving support       */
83631e31b8aSbellard #define TARGET_SIOCSIFSLAVE    0x8930
83731e31b8aSbellard #define TARGET_SIOCADDMULTI    0x8931          /* Multicast address lists      */
83831e31b8aSbellard #define TARGET_SIOCDELMULTI    0x8932
83931e31b8aSbellard 
84031e31b8aSbellard /* Bridging control calls */
84131e31b8aSbellard #define TARGET_SIOCGIFBR       0x8940          /* Bridging support             */
84231e31b8aSbellard #define TARGET_SIOCSIFBR       0x8941          /* Set bridging options         */
84331e31b8aSbellard 
84431e31b8aSbellard #define TARGET_SIOCGIFTXQLEN   0x8942          /* Get the tx queue length      */
84531e31b8aSbellard #define TARGET_SIOCSIFTXQLEN   0x8943          /* Set the tx queue length      */
84631e31b8aSbellard 
84731e31b8aSbellard /* ARP cache control calls. */
84831e31b8aSbellard #define TARGET_OLD_SIOCDARP    0x8950          /* old delete ARP table entry   */
84931e31b8aSbellard #define TARGET_OLD_SIOCGARP    0x8951          /* old get ARP table entry      */
85031e31b8aSbellard #define TARGET_OLD_SIOCSARP    0x8952          /* old set ARP table entry      */
85131e31b8aSbellard #define TARGET_SIOCDARP        0x8953          /* delete ARP table entry       */
85231e31b8aSbellard #define TARGET_SIOCGARP        0x8954          /* get ARP table entry          */
85331e31b8aSbellard #define TARGET_SIOCSARP        0x8955          /* set ARP table entry          */
85431e31b8aSbellard 
85531e31b8aSbellard /* RARP cache control calls. */
85631e31b8aSbellard #define TARGET_SIOCDRARP       0x8960          /* delete RARP table entry      */
85731e31b8aSbellard #define TARGET_SIOCGRARP       0x8961          /* get RARP table entry         */
85831e31b8aSbellard #define TARGET_SIOCSRARP       0x8962          /* set RARP table entry         */
85931e31b8aSbellard 
86031e31b8aSbellard /* Driver configuration calls */
86131e31b8aSbellard #define TARGET_SIOCGIFMAP      0x8970          /* Get device parameters        */
86231e31b8aSbellard #define TARGET_SIOCSIFMAP      0x8971          /* Set device parameters        */
86331e31b8aSbellard 
86431e31b8aSbellard /* DLCI configuration calls */
86531e31b8aSbellard #define TARGET_SIOCADDDLCI     0x8980          /* Create new DLCI device       */
86631e31b8aSbellard #define TARGET_SIOCDELDLCI     0x8981          /* Delete DLCI device           */
86731e31b8aSbellard 
86886fcd946SLaurent Vivier /* From <linux/wireless.h> */
86986fcd946SLaurent Vivier 
87086fcd946SLaurent Vivier #define TARGET_SIOCGIWNAME     0x8B01          /* get name == wireless protocol */
87131e31b8aSbellard 
87231e31b8aSbellard /* From <linux/fs.h> */
87331e31b8aSbellard 
87431e31b8aSbellard #define TARGET_BLKROSET   TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */
87531e31b8aSbellard #define TARGET_BLKROGET   TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */
87631e31b8aSbellard #define TARGET_BLKRRPART  TARGET_IO(0x12,95) /* re-read partition table */
87731e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */
87831e31b8aSbellard #define TARGET_BLKFLSBUF  TARGET_IO(0x12,97) /* flush buffer cache */
87931e31b8aSbellard #define TARGET_BLKRASET   TARGET_IO(0x12,98) /* Set read ahead for block device */
88031e31b8aSbellard #define TARGET_BLKRAGET   TARGET_IO(0x12,99) /* get current read ahead setting */
88131e31b8aSbellard #define TARGET_BLKFRASET  TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
88231e31b8aSbellard #define TARGET_BLKFRAGET  TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
88331e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
88431e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
88531e31b8aSbellard #define TARGET_BLKSSZGET  TARGET_IO(0x12,104)/* get block device sector size */
88631e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */
887c8b0bf54SPeter Maydell #define TARGET_BLKBSZGET  TARGET_IOR(0x12, 112, abi_ulong)
888c8b0bf54SPeter Maydell #define TARGET_BLKBSZSET  TARGET_IOW(0x12, 113, abi_ulong)
889edafea13SAlexander Graf #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong)
890edafea13SAlexander Graf                                              /* return device size in bytes
891edafea13SAlexander Graf                                                 (u64 *arg) */
89231e31b8aSbellard #define TARGET_FIBMAP     TARGET_IO(0x00,1)  /* bmap access */
89331e31b8aSbellard #define TARGET_FIGETBSZ   TARGET_IO(0x00,2)  /* get the block size used for bmap */
894285da2b9SPeter Maydell #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap)
89531e31b8aSbellard 
89631e31b8aSbellard /* cdrom commands */
89731e31b8aSbellard #define TARGET_CDROMPAUSE		0x5301 /* Pause Audio Operation */
89831e31b8aSbellard #define TARGET_CDROMRESUME		0x5302 /* Resume paused Audio Operation */
89931e31b8aSbellard #define TARGET_CDROMPLAYMSF		0x5303 /* Play Audio MSF (struct cdrom_msf) */
90031e31b8aSbellard #define TARGET_CDROMPLAYTRKIND		0x5304 /* Play Audio Track/index
90131e31b8aSbellard                                            (struct cdrom_ti) */
90231e31b8aSbellard #define TARGET_CDROMREADTOCHDR		0x5305 /* Read TOC header
90331e31b8aSbellard                                            (struct cdrom_tochdr) */
90431e31b8aSbellard #define TARGET_CDROMREADTOCENTRY	0x5306 /* Read TOC entry
90531e31b8aSbellard                                            (struct cdrom_tocentry) */
90631e31b8aSbellard #define TARGET_CDROMSTOP		0x5307 /* Stop the cdrom drive */
90731e31b8aSbellard #define TARGET_CDROMSTART		0x5308 /* Start the cdrom drive */
90831e31b8aSbellard #define TARGET_CDROMEJECT		0x5309 /* Ejects the cdrom media */
90931e31b8aSbellard #define TARGET_CDROMVOLCTRL		0x530a /* Control output volume
91031e31b8aSbellard                                            (struct cdrom_volctrl) */
91131e31b8aSbellard #define TARGET_CDROMSUBCHNL		0x530b /* Read subchannel data
91231e31b8aSbellard                                            (struct cdrom_subchnl) */
91331e31b8aSbellard #define TARGET_CDROMREADMODE2		0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes)
91431e31b8aSbellard                                            (struct cdrom_read) */
91531e31b8aSbellard #define TARGET_CDROMREADMODE1		0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes)
91631e31b8aSbellard                                            (struct cdrom_read) */
91731e31b8aSbellard #define TARGET_CDROMREADAUDIO		0x530e /* (struct cdrom_read_audio) */
91831e31b8aSbellard #define TARGET_CDROMEJECT_SW		0x530f /* enable(1)/disable(0) auto-ejecting */
91931e31b8aSbellard #define TARGET_CDROMMULTISESSION	0x5310 /* Obtain the start-of-last-session
92031e31b8aSbellard                                            address of multi session disks
92131e31b8aSbellard                                            (struct cdrom_multisession) */
92231e31b8aSbellard #define TARGET_CDROM_GET_MCN		0x5311 /* Obtain the "Universal Product Code"
92331e31b8aSbellard                                            if available (struct cdrom_mcn) */
92431e31b8aSbellard #define TARGET_CDROM_GET_UPC		TARGET_CDROM_GET_MCN  /* This one is depricated,
925b4916d7bSDong Xu Wang                                           but here anyway for compatibility */
92631e31b8aSbellard #define TARGET_CDROMRESET		0x5312 /* hard-reset the drive */
92731e31b8aSbellard #define TARGET_CDROMVOLREAD		0x5313 /* Get the drive's volume setting
92831e31b8aSbellard                                           (struct cdrom_volctrl) */
92931e31b8aSbellard #define TARGET_CDROMREADRAW		0x5314	/* read data in raw mode (2352 Bytes)
93031e31b8aSbellard                                            (struct cdrom_read) */
93131e31b8aSbellard /*
93231e31b8aSbellard  * These ioctls are used only used in aztcd.c and optcd.c
93331e31b8aSbellard  */
93431e31b8aSbellard #define TARGET_CDROMREADCOOKED		0x5315	/* read data in cooked mode */
93531e31b8aSbellard #define TARGET_CDROMSEEK		0x5316  /* seek msf address */
93631e31b8aSbellard 
93731e31b8aSbellard /*
93831e31b8aSbellard  * This ioctl is only used by the scsi-cd driver.
93931e31b8aSbellard    It is for playing audio in logical block addressing mode.
94031e31b8aSbellard  */
94131e31b8aSbellard #define TARGET_CDROMPLAYBLK		0x5317	/* (struct cdrom_blk) */
94231e31b8aSbellard 
94331e31b8aSbellard /*
94431e31b8aSbellard  * These ioctls are only used in optcd.c
94531e31b8aSbellard  */
94631e31b8aSbellard #define TARGET_CDROMREADALL		0x5318	/* read all 2646 bytes */
94731e31b8aSbellard 
94831e31b8aSbellard /*
94931e31b8aSbellard  * These ioctls are (now) only in ide-cd.c for controlling
95031e31b8aSbellard  * drive spindown time.  They should be implemented in the
95131e31b8aSbellard  * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10,
95231e31b8aSbellard  * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE...
95331e31b8aSbellard  *  -Erik
95431e31b8aSbellard  */
95531e31b8aSbellard #define TARGET_CDROMGETSPINDOWN        0x531d
95631e31b8aSbellard #define TARGET_CDROMSETSPINDOWN        0x531e
95731e31b8aSbellard 
95831e31b8aSbellard /*
95931e31b8aSbellard  * These ioctls are implemented through the uniform CD-ROM driver
96031e31b8aSbellard  * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM
96131e31b8aSbellard  * drivers are eventually ported to the uniform CD-ROM driver interface.
96231e31b8aSbellard  */
96331e31b8aSbellard #define TARGET_CDROMCLOSETRAY		0x5319	/* pendant of CDROMEJECT */
96431e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS	0x5320  /* Set behavior options */
96531e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS	0x5321  /* Clear behavior options */
96631e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED	0x5322  /* Set the CD-ROM speed */
96731e31b8aSbellard #define TARGET_CDROM_SELECT_DISC	0x5323  /* Select disc (for juke-boxes) */
96831e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED	0x5325  /* Check is media changed  */
96931e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS	0x5326  /* Get tray position, etc. */
97031e31b8aSbellard #define TARGET_CDROM_DISC_STATUS	0x5327  /* Get disc type, etc. */
97131e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS    0x5328  /* Get number of slots */
97231e31b8aSbellard #define TARGET_CDROM_LOCKDOOR		0x5329  /* lock or unlock door */
97331e31b8aSbellard #define TARGET_CDROM_DEBUG		0x5330	/* Turn debug messages on/off */
97431e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY	0x5331	/* get capabilities */
97531e31b8aSbellard 
97631e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386.
97731e31b8aSbellard  * Future CDROM ioctls should be kept below 0x537F
97831e31b8aSbellard  */
97931e31b8aSbellard 
98031e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */
98131e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ        0x5382	/* set the audio buffer size */
98231e31b8aSbellard 					/* conflict with SCSI_IOCTL_GET_IDLUN */
98331e31b8aSbellard 
98431e31b8aSbellard /* DVD-ROM Specific ioctls */
98531e31b8aSbellard #define TARGET_DVD_READ_STRUCT		0x5390  /* Read structure */
98631e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT	0x5391  /* Write structure */
98731e31b8aSbellard #define TARGET_DVD_AUTH		0x5392  /* Authentication */
98831e31b8aSbellard 
98931e31b8aSbellard #define TARGET_CDROM_SEND_PACKET	0x5393	/* send a packet to the drive */
99031e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE	0x5394	/* get next writable block */
99131e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN	0x5395	/* get last block written on disc */
99231e31b8aSbellard 
99331e31b8aSbellard /* HD commands */
99431e31b8aSbellard 
99531e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
99631e31b8aSbellard #define TARGET_HDIO_GETGEO            0x0301  /* get device geometry */
99731e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR    0x0302  /* get current unmask setting */
99831e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT     0x0304  /* get current IDE blockmode setting */
99931e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS  0x0308  /* get keep-settings-on-reset flag */
100031e31b8aSbellard #define TARGET_HDIO_GET_32BIT         0x0309  /* get current io_32bit setting */
100131e31b8aSbellard #define TARGET_HDIO_GET_NOWERR        0x030a  /* get ignore-write-error flag */
100231e31b8aSbellard #define TARGET_HDIO_GET_DMA           0x030b  /* get use-dma flag */
10032521d698Sbellard #define TARGET_HDIO_GET_IDENTITY      0x030d  /* get IDE identification info */
100431e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD         0x031f  /* execute a special drive command */
100531e31b8aSbellard 
100631e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
100731e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT     0x0321  /* change IDE blockmode */
100831e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR    0x0322  /* permit other irqs during I/O */
100931e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS  0x0323  /* keep ioctl settings on reset */
101031e31b8aSbellard #define TARGET_HDIO_SET_32BIT         0x0324  /* change io_32bit flags */
101131e31b8aSbellard #define TARGET_HDIO_SET_NOWERR        0x0325  /* change ignore-write-error flag */
101231e31b8aSbellard #define TARGET_HDIO_SET_DMA           0x0326  /* change use-dma flag */
101331e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE      0x0327  /* reconfig interface to new speed */
10142521d698Sbellard 
1015b8005914Sbalrog /* loop ioctls */
1016b8005914Sbalrog #define TARGET_LOOP_SET_FD            0x4C00
1017b8005914Sbalrog #define TARGET_LOOP_CLR_FD            0x4C01
1018b8005914Sbalrog #define TARGET_LOOP_SET_STATUS        0x4C02
1019b8005914Sbalrog #define TARGET_LOOP_GET_STATUS        0x4C03
1020b8005914Sbalrog #define TARGET_LOOP_SET_STATUS64      0x4C04
1021b8005914Sbalrog #define TARGET_LOOP_GET_STATUS64      0x4C05
1022b8005914Sbalrog #define TARGET_LOOP_CHANGE_FD         0x4C06
10232521d698Sbellard 
1024f7680a55SUlrich Hecht /* fb ioctls */
1025f7680a55SUlrich Hecht #define TARGET_FBIOGET_VSCREENINFO    0x4600
1026f7680a55SUlrich Hecht #define TARGET_FBIOPUT_VSCREENINFO    0x4601
1027f7680a55SUlrich Hecht #define TARGET_FBIOGET_FSCREENINFO    0x4602
102812b81b71SCédric VINCENT #define TARGET_FBIOGETCMAP            0x4604
102912b81b71SCédric VINCENT #define TARGET_FBIOPUTCMAP            0x4605
103012b81b71SCédric VINCENT #define TARGET_FBIOPAN_DISPLAY        0x4606
103112b81b71SCédric VINCENT #define TARGET_FBIOGET_CON2FBMAP      0x460F
103212b81b71SCédric VINCENT #define TARGET_FBIOPUT_CON2FBMAP      0x4610
1033f7680a55SUlrich Hecht 
1034f7680a55SUlrich Hecht /* vt ioctls */
1035f7680a55SUlrich Hecht #define TARGET_VT_OPENQRY             0x5600
1036f7680a55SUlrich Hecht #define TARGET_VT_GETSTATE            0x5603
1037f7680a55SUlrich Hecht #define TARGET_VT_ACTIVATE            0x5606
1038f7680a55SUlrich Hecht #define TARGET_VT_WAITACTIVE          0x5607
1039f7680a55SUlrich Hecht #define TARGET_VT_LOCKSWITCH          0x560b
1040f7680a55SUlrich Hecht #define TARGET_VT_UNLOCKSWITCH        0x560c
1041774750c0SCédric VINCENT #define TARGET_VT_GETMODE             0x5601
1042774750c0SCédric VINCENT #define TARGET_VT_SETMODE             0x5602
1043774750c0SCédric VINCENT #define TARGET_VT_RELDISP             0x5605
1044774750c0SCédric VINCENT #define TARGET_VT_DISALLOCATE         0x5608
1045f7680a55SUlrich Hecht 
104656e904ecSAlexander Graf /* device mapper */
104756e904ecSAlexander Graf #define TARGET_DM_VERSION             TARGET_IOWRU(0xfd, 0x00)
104856e904ecSAlexander Graf #define TARGET_DM_REMOVE_ALL          TARGET_IOWRU(0xfd, 0x01)
104956e904ecSAlexander Graf #define TARGET_DM_LIST_DEVICES        TARGET_IOWRU(0xfd, 0x02)
105056e904ecSAlexander Graf #define TARGET_DM_DEV_CREATE          TARGET_IOWRU(0xfd, 0x03)
105156e904ecSAlexander Graf #define TARGET_DM_DEV_REMOVE          TARGET_IOWRU(0xfd, 0x04)
105256e904ecSAlexander Graf #define TARGET_DM_DEV_RENAME          TARGET_IOWRU(0xfd, 0x05)
105356e904ecSAlexander Graf #define TARGET_DM_DEV_SUSPEND         TARGET_IOWRU(0xfd, 0x06)
105456e904ecSAlexander Graf #define TARGET_DM_DEV_STATUS          TARGET_IOWRU(0xfd, 0x07)
105556e904ecSAlexander Graf #define TARGET_DM_DEV_WAIT            TARGET_IOWRU(0xfd, 0x08)
105656e904ecSAlexander Graf #define TARGET_DM_TABLE_LOAD          TARGET_IOWRU(0xfd, 0x09)
105756e904ecSAlexander Graf #define TARGET_DM_TABLE_CLEAR         TARGET_IOWRU(0xfd, 0x0a)
105856e904ecSAlexander Graf #define TARGET_DM_TABLE_DEPS          TARGET_IOWRU(0xfd, 0x0b)
105956e904ecSAlexander Graf #define TARGET_DM_TABLE_STATUS        TARGET_IOWRU(0xfd, 0x0c)
106056e904ecSAlexander Graf #define TARGET_DM_LIST_VERSIONS       TARGET_IOWRU(0xfd, 0x0d)
106156e904ecSAlexander Graf #define TARGET_DM_TARGET_MSG          TARGET_IOWRU(0xfd, 0x0e)
106256e904ecSAlexander Graf #define TARGET_DM_DEV_SET_GEOMETRY    TARGET_IOWRU(0xfd, 0x0f)
106356e904ecSAlexander Graf 
10642521d698Sbellard /* from asm/termbits.h */
10652521d698Sbellard 
10663bfd9da1Sbellard #define TARGET_NCC 8
10673bfd9da1Sbellard struct target_termio {
10683bfd9da1Sbellard 	unsigned short c_iflag;		/* input mode flags */
10693bfd9da1Sbellard 	unsigned short c_oflag;		/* output mode flags */
10703bfd9da1Sbellard 	unsigned short c_cflag;		/* control mode flags */
10713bfd9da1Sbellard 	unsigned short c_lflag;		/* local mode flags */
10722521d698Sbellard 	unsigned char c_line;		/* line discipline */
10733bfd9da1Sbellard 	unsigned char c_cc[TARGET_NCC];	/* control characters */
10742521d698Sbellard };
10752521d698Sbellard 
10763bfd9da1Sbellard struct target_winsize {
10773bfd9da1Sbellard 	unsigned short ws_row;
10783bfd9da1Sbellard 	unsigned short ws_col;
10793bfd9da1Sbellard 	unsigned short ws_xpixel;
10803bfd9da1Sbellard 	unsigned short ws_ypixel;
10813bfd9da1Sbellard };
10822521d698Sbellard 
10833bfd9da1Sbellard #include "termbits.h"
10842521d698Sbellard 
10859e0b74a4SPaul Brook #if defined(TARGET_MIPS)
10869e0b74a4SPaul Brook #define TARGET_PROT_SEM         0x10
10879e0b74a4SPaul Brook #else
10889e0b74a4SPaul Brook #define TARGET_PROT_SEM         0x08
10899e0b74a4SPaul Brook #endif
10909e0b74a4SPaul Brook 
1091e44a3e79Saurel32 /* Common */
10922521d698Sbellard #define TARGET_MAP_SHARED	0x01		/* Share changes */
10932521d698Sbellard #define TARGET_MAP_PRIVATE	0x02		/* Changes are private */
10942521d698Sbellard #define TARGET_MAP_TYPE		0x0f		/* Mask for type of mapping */
1095e44a3e79Saurel32 
1096e44a3e79Saurel32 /* Target specific */
1097048f6b4dSbellard #if defined(TARGET_MIPS)
1098e44a3e79Saurel32 #define TARGET_MAP_FIXED	0x10		/* Interpret addr exactly */
1099048f6b4dSbellard #define TARGET_MAP_ANONYMOUS	0x0800		/* don't use a file */
1100048f6b4dSbellard #define TARGET_MAP_GROWSDOWN	0x1000		/* stack-like segment */
1101048f6b4dSbellard #define TARGET_MAP_DENYWRITE	0x2000		/* ETXTBSY */
1102048f6b4dSbellard #define TARGET_MAP_EXECUTABLE	0x4000		/* mark it as an executable */
1103048f6b4dSbellard #define TARGET_MAP_LOCKED	0x8000		/* pages are locked */
1104048f6b4dSbellard #define TARGET_MAP_NORESERVE	0x0400		/* don't check for reservations */
1105540635baSths #define TARGET_MAP_POPULATE	0x10000		/* populate (prefault) pagetables */
1106540635baSths #define TARGET_MAP_NONBLOCK	0x20000		/* do not block on IO */
1107e44a3e79Saurel32 #elif defined(TARGET_PPC)
1108e44a3e79Saurel32 #define TARGET_MAP_FIXED	0x10		/* Interpret addr exactly */
11092521d698Sbellard #define TARGET_MAP_ANONYMOUS	0x20		/* don't use a file */
11102521d698Sbellard #define TARGET_MAP_GROWSDOWN	0x0100		/* stack-like segment */
11112521d698Sbellard #define TARGET_MAP_DENYWRITE	0x0800		/* ETXTBSY */
11122521d698Sbellard #define TARGET_MAP_EXECUTABLE	0x1000		/* mark it as an executable */
11137ec93196Sj_mayer #define TARGET_MAP_LOCKED	0x0080		/* pages are locked */
11147ec93196Sj_mayer #define TARGET_MAP_NORESERVE	0x0040		/* don't check for reservations */
1115e44a3e79Saurel32 #define TARGET_MAP_POPULATE	0x8000		/* populate (prefault) pagetables */
1116e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK	0x10000		/* do not block on IO */
1117e44a3e79Saurel32 #elif defined(TARGET_ALPHA)
1118e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS	0x10		/* don't use a file */
1119e44a3e79Saurel32 #define TARGET_MAP_FIXED	0x100		/* Interpret addr exactly */
1120e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN	0x01000		/* stack-like segment */
1121e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE	0x02000		/* ETXTBSY */
1122e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE	0x04000		/* mark it as an executable */
1123e44a3e79Saurel32 #define TARGET_MAP_LOCKED	0x08000		/* lock the mapping */
1124e44a3e79Saurel32 #define TARGET_MAP_NORESERVE	0x10000		/* no check for reservations */
1125e44a3e79Saurel32 #define TARGET_MAP_POPULATE	0x20000		/* pop (prefault) pagetables */
1126e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK	0x40000		/* do not block on IO */
11277ec93196Sj_mayer #else
1128e44a3e79Saurel32 #define TARGET_MAP_FIXED	0x10		/* Interpret addr exactly */
1129e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS	0x20		/* don't use a file */
1130e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN	0x0100		/* stack-like segment */
1131e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE	0x0800		/* ETXTBSY */
1132e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE	0x1000		/* mark it as an executable */
11332521d698Sbellard #define TARGET_MAP_LOCKED	0x2000		/* pages are locked */
11342521d698Sbellard #define TARGET_MAP_NORESERVE	0x4000		/* don't check for reservations */
1135540635baSths #define TARGET_MAP_POPULATE	0x8000		/* populate (prefault) pagetables */
1136540635baSths #define TARGET_MAP_NONBLOCK	0x10000		/* do not block on IO */
1137906c1b8eSMike Frysinger #define TARGET_MAP_UNINITIALIZED 0x4000000	/* for anonymous mmap, memory could be uninitialized */
11387ec93196Sj_mayer #endif
11392521d698Sbellard 
1140d2fbca94SGuan Xuetao #if (defined(TARGET_I386) && defined(TARGET_ABI32)) || defined(TARGET_ARM) \
1141d962783eSJia Liu     || defined(TARGET_CRIS) || defined(TARGET_UNICORE32) \
1142d962783eSJia Liu     || defined(TARGET_OPENRISC)
11432521d698Sbellard struct target_stat {
11442521d698Sbellard 	unsigned short st_dev;
11452521d698Sbellard 	unsigned short __pad1;
1146992f48a0Sblueswir1 	abi_ulong st_ino;
11472521d698Sbellard 	unsigned short st_mode;
11482521d698Sbellard 	unsigned short st_nlink;
11492521d698Sbellard 	unsigned short st_uid;
11502521d698Sbellard 	unsigned short st_gid;
11512521d698Sbellard 	unsigned short st_rdev;
11522521d698Sbellard 	unsigned short __pad2;
1153992f48a0Sblueswir1 	abi_ulong  st_size;
1154992f48a0Sblueswir1 	abi_ulong  st_blksize;
1155992f48a0Sblueswir1 	abi_ulong  st_blocks;
1156992f48a0Sblueswir1 	abi_ulong  target_st_atime;
1157992f48a0Sblueswir1 	abi_ulong  __unused1;
1158992f48a0Sblueswir1 	abi_ulong  target_st_mtime;
1159992f48a0Sblueswir1 	abi_ulong  __unused2;
1160992f48a0Sblueswir1 	abi_ulong  target_st_ctime;
1161992f48a0Sblueswir1 	abi_ulong  __unused3;
1162992f48a0Sblueswir1 	abi_ulong  __unused4;
1163992f48a0Sblueswir1 	abi_ulong  __unused5;
11642521d698Sbellard };
11652521d698Sbellard 
11662521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely
11672521d698Sbellard  * insane amounts of padding around dev_t's.
11682521d698Sbellard  */
11692521d698Sbellard struct target_stat64 {
11702521d698Sbellard 	unsigned short	st_dev;
11712521d698Sbellard 	unsigned char	__pad0[10];
11722521d698Sbellard 
11732521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO	1
1174992f48a0Sblueswir1 	abi_ulong	__st_ino;
11752521d698Sbellard 
11762521d698Sbellard 	unsigned int	st_mode;
11772521d698Sbellard 	unsigned int	st_nlink;
11782521d698Sbellard 
1179992f48a0Sblueswir1 	abi_ulong	st_uid;
1180992f48a0Sblueswir1 	abi_ulong	st_gid;
11812521d698Sbellard 
11822521d698Sbellard 	unsigned short	st_rdev;
11832521d698Sbellard 	unsigned char	__pad3[10];
11842521d698Sbellard 
11852521d698Sbellard 	long long	st_size;
1186992f48a0Sblueswir1 	abi_ulong	st_blksize;
11872521d698Sbellard 
1188992f48a0Sblueswir1 	abi_ulong	st_blocks;	/* Number 512-byte blocks allocated. */
1189992f48a0Sblueswir1 	abi_ulong	__pad4;		/* future possible st_blocks high bits */
11902521d698Sbellard 
1191992f48a0Sblueswir1 	abi_ulong	target_st_atime;
1192992f48a0Sblueswir1 	abi_ulong	__pad5;
11932521d698Sbellard 
1194992f48a0Sblueswir1 	abi_ulong	target_st_mtime;
1195992f48a0Sblueswir1 	abi_ulong	__pad6;
11962521d698Sbellard 
1197992f48a0Sblueswir1 	abi_ulong	target_st_ctime;
1198992f48a0Sblueswir1 	abi_ulong	__pad7;		/* will be high 32 bits of ctime someday */
11992521d698Sbellard 
12002521d698Sbellard 	unsigned long long	st_ino;
1201541dc0d4SStefan Weil } QEMU_PACKED;
12022521d698Sbellard 
1203ce4defa0Spbrook #ifdef TARGET_ARM
1204ce4defa0Spbrook struct target_eabi_stat64 {
1205ce4defa0Spbrook         unsigned long long st_dev;
1206ce4defa0Spbrook         unsigned int    __pad1;
1207992f48a0Sblueswir1         abi_ulong    __st_ino;
1208ce4defa0Spbrook         unsigned int    st_mode;
1209ce4defa0Spbrook         unsigned int    st_nlink;
1210ce4defa0Spbrook 
1211992f48a0Sblueswir1         abi_ulong    st_uid;
1212992f48a0Sblueswir1         abi_ulong    st_gid;
1213ce4defa0Spbrook 
1214ce4defa0Spbrook         unsigned long long st_rdev;
1215ce4defa0Spbrook         unsigned int    __pad2[2];
1216ce4defa0Spbrook 
1217ce4defa0Spbrook         long long       st_size;
1218992f48a0Sblueswir1         abi_ulong    st_blksize;
1219ce4defa0Spbrook         unsigned int    __pad3;
1220ce4defa0Spbrook         unsigned long long st_blocks;
1221ce4defa0Spbrook 
1222992f48a0Sblueswir1         abi_ulong    target_st_atime;
1223992f48a0Sblueswir1         abi_ulong    target_st_atime_nsec;
1224ce4defa0Spbrook 
1225992f48a0Sblueswir1         abi_ulong    target_st_mtime;
1226992f48a0Sblueswir1         abi_ulong    target_st_mtime_nsec;
1227ce4defa0Spbrook 
1228992f48a0Sblueswir1         abi_ulong    target_st_ctime;
1229992f48a0Sblueswir1         abi_ulong    target_st_ctime_nsec;
1230ce4defa0Spbrook 
1231ce4defa0Spbrook         unsigned long long st_ino;
1232541dc0d4SStefan Weil } QEMU_PACKED;
1233ce4defa0Spbrook #endif
1234ce4defa0Spbrook 
1235992f48a0Sblueswir1 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
12361b8dd648Sblueswir1 struct target_stat {
12371b8dd648Sblueswir1 	unsigned int	st_dev;
1238992f48a0Sblueswir1 	abi_ulong	st_ino;
12391b8dd648Sblueswir1 	unsigned int	st_mode;
12401b8dd648Sblueswir1 	unsigned int	st_nlink;
12411b8dd648Sblueswir1 	unsigned int	st_uid;
12421b8dd648Sblueswir1 	unsigned int	st_gid;
12431b8dd648Sblueswir1 	unsigned int	st_rdev;
1244992f48a0Sblueswir1 	abi_long	st_size;
1245992f48a0Sblueswir1 	abi_long	target_st_atime;
1246992f48a0Sblueswir1 	abi_long	target_st_mtime;
1247992f48a0Sblueswir1 	abi_long	target_st_ctime;
1248992f48a0Sblueswir1 	abi_long	st_blksize;
1249992f48a0Sblueswir1 	abi_long	st_blocks;
1250992f48a0Sblueswir1 	abi_ulong	__unused4[2];
12511b8dd648Sblueswir1 };
12521b8dd648Sblueswir1 
12531b8dd648Sblueswir1 struct target_stat64 {
12541b8dd648Sblueswir1 	unsigned char	__pad0[6];
12551b8dd648Sblueswir1 	unsigned short	st_dev;
12561b8dd648Sblueswir1 
12571b8dd648Sblueswir1 	uint64_t	st_ino;
12581b8dd648Sblueswir1 	uint64_t	st_nlink;
12591b8dd648Sblueswir1 
12601b8dd648Sblueswir1 	unsigned int	st_mode;
12611b8dd648Sblueswir1 
12621b8dd648Sblueswir1 	unsigned int	st_uid;
12631b8dd648Sblueswir1 	unsigned int	st_gid;
12641b8dd648Sblueswir1 
12651b8dd648Sblueswir1 	unsigned char	__pad2[6];
12661b8dd648Sblueswir1 	unsigned short	st_rdev;
12671b8dd648Sblueswir1 
12681b8dd648Sblueswir1         int64_t		st_size;
12691b8dd648Sblueswir1 	int64_t		st_blksize;
12701b8dd648Sblueswir1 
12711b8dd648Sblueswir1 	unsigned char	__pad4[4];
12721b8dd648Sblueswir1 	unsigned int	st_blocks;
12731b8dd648Sblueswir1 
1274992f48a0Sblueswir1 	abi_ulong	target_st_atime;
1275992f48a0Sblueswir1 	abi_ulong	__unused1;
12761b8dd648Sblueswir1 
1277992f48a0Sblueswir1 	abi_ulong	target_st_mtime;
1278992f48a0Sblueswir1 	abi_ulong	__unused2;
12791b8dd648Sblueswir1 
1280992f48a0Sblueswir1 	abi_ulong	target_st_ctime;
1281992f48a0Sblueswir1 	abi_ulong	__unused3;
12821b8dd648Sblueswir1 
1283992f48a0Sblueswir1 	abi_ulong	__unused4[3];
12841b8dd648Sblueswir1 };
12851b8dd648Sblueswir1 
12863bfd9da1Sbellard #elif defined(TARGET_SPARC)
12873bfd9da1Sbellard 
12883bfd9da1Sbellard struct target_stat {
12893bfd9da1Sbellard 	unsigned short	st_dev;
1290992f48a0Sblueswir1 	abi_ulong	st_ino;
12913bfd9da1Sbellard 	unsigned short	st_mode;
12923bfd9da1Sbellard 	short		st_nlink;
12933bfd9da1Sbellard 	unsigned short	st_uid;
12943bfd9da1Sbellard 	unsigned short	st_gid;
12953bfd9da1Sbellard 	unsigned short	st_rdev;
1296992f48a0Sblueswir1 	abi_long	st_size;
1297992f48a0Sblueswir1 	abi_long	target_st_atime;
1298992f48a0Sblueswir1 	abi_ulong	__unused1;
1299992f48a0Sblueswir1 	abi_long	target_st_mtime;
1300992f48a0Sblueswir1 	abi_ulong	__unused2;
1301992f48a0Sblueswir1 	abi_long	target_st_ctime;
1302992f48a0Sblueswir1 	abi_ulong	__unused3;
1303992f48a0Sblueswir1 	abi_long	st_blksize;
1304992f48a0Sblueswir1 	abi_long	st_blocks;
1305992f48a0Sblueswir1 	abi_ulong	__unused4[2];
13063bfd9da1Sbellard };
13073bfd9da1Sbellard 
13083bfd9da1Sbellard struct target_stat64 {
13093bfd9da1Sbellard 	unsigned char	__pad0[6];
13103bfd9da1Sbellard 	unsigned short	st_dev;
13113bfd9da1Sbellard 
13123bfd9da1Sbellard 	uint64_t st_ino;
13133bfd9da1Sbellard 
13143bfd9da1Sbellard 	unsigned int	st_mode;
13153bfd9da1Sbellard 	unsigned int	st_nlink;
13163bfd9da1Sbellard 
13173bfd9da1Sbellard 	unsigned int	st_uid;
13183bfd9da1Sbellard 	unsigned int	st_gid;
13193bfd9da1Sbellard 
13203bfd9da1Sbellard 	unsigned char	__pad2[6];
13213bfd9da1Sbellard 	unsigned short	st_rdev;
13223bfd9da1Sbellard 
13233bfd9da1Sbellard 	unsigned char	__pad3[8];
13243bfd9da1Sbellard 
13253bfd9da1Sbellard         int64_t	st_size;
13263bfd9da1Sbellard 	unsigned int	st_blksize;
13273bfd9da1Sbellard 
13283bfd9da1Sbellard 	unsigned char	__pad4[8];
13293bfd9da1Sbellard 	unsigned int	st_blocks;
13303bfd9da1Sbellard 
13313bfd9da1Sbellard 	unsigned int	target_st_atime;
13323bfd9da1Sbellard 	unsigned int	__unused1;
13333bfd9da1Sbellard 
13343bfd9da1Sbellard 	unsigned int	target_st_mtime;
13353bfd9da1Sbellard 	unsigned int	__unused2;
13363bfd9da1Sbellard 
13373bfd9da1Sbellard 	unsigned int	target_st_ctime;
13383bfd9da1Sbellard 	unsigned int	__unused3;
13393bfd9da1Sbellard 
13403bfd9da1Sbellard 	unsigned int	__unused4;
13413bfd9da1Sbellard 	unsigned int	__unused5;
13423bfd9da1Sbellard };
13433bfd9da1Sbellard 
134467867308Sbellard #elif defined(TARGET_PPC)
134567867308Sbellard 
134667867308Sbellard struct target_stat {
1347e32448e0Sj_mayer 	abi_ulong st_dev;
1348992f48a0Sblueswir1 	abi_ulong st_ino;
1349325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
1350e32448e0Sj_mayer 	abi_ulong st_nlink;
1351325e651fSj_mayer 	unsigned int st_mode;
1352325e651fSj_mayer #else
135367867308Sbellard 	unsigned int st_mode;
135467867308Sbellard 	unsigned short st_nlink;
1355325e651fSj_mayer #endif
135667867308Sbellard 	unsigned int st_uid;
135767867308Sbellard 	unsigned int st_gid;
1358e32448e0Sj_mayer 	abi_ulong  st_rdev;
1359992f48a0Sblueswir1 	abi_ulong  st_size;
1360992f48a0Sblueswir1 	abi_ulong  st_blksize;
1361992f48a0Sblueswir1 	abi_ulong  st_blocks;
1362992f48a0Sblueswir1 	abi_ulong  target_st_atime;
1363e32448e0Sj_mayer 	abi_ulong  target_st_atime_nsec;
1364992f48a0Sblueswir1 	abi_ulong  target_st_mtime;
1365e32448e0Sj_mayer 	abi_ulong  target_st_mtime_nsec;
1366992f48a0Sblueswir1 	abi_ulong  target_st_ctime;
1367e32448e0Sj_mayer 	abi_ulong  target_st_ctime_nsec;
1368992f48a0Sblueswir1 	abi_ulong  __unused4;
1369992f48a0Sblueswir1 	abi_ulong  __unused5;
1370325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
1371325e651fSj_mayer 	abi_ulong  __unused6;
1372325e651fSj_mayer #endif
137367867308Sbellard };
137467867308Sbellard 
1375541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 {
137667867308Sbellard 	unsigned long long st_dev;
137767867308Sbellard         unsigned long long st_ino;
137867867308Sbellard 	unsigned int st_mode;
137967867308Sbellard 	unsigned int st_nlink;
138067867308Sbellard 	unsigned int st_uid;
138167867308Sbellard 	unsigned int st_gid;
138267867308Sbellard 	unsigned long long st_rdev;
1383e1ce5e40Saurel32 	unsigned long long __pad0;
138467867308Sbellard 	long long      st_size;
1385e32448e0Sj_mayer 	int	       st_blksize;
1386e1ce5e40Saurel32 	unsigned int   __pad1;
138761322e91SMax Filippov 	long long      st_blocks;	/* Number 512-byte blocks allocated. */
1388e32448e0Sj_mayer 	int	       target_st_atime;
1389e32448e0Sj_mayer         unsigned int   target_st_atime_nsec;
1390e32448e0Sj_mayer 	int	       target_st_mtime;
1391e32448e0Sj_mayer         unsigned int   target_st_mtime_nsec;
1392e32448e0Sj_mayer 	int            target_st_ctime;
1393e32448e0Sj_mayer         unsigned int   target_st_ctime_nsec;
1394e32448e0Sj_mayer         unsigned int   __unused4;
1395e32448e0Sj_mayer         unsigned int   __unused5;
139667867308Sbellard };
139767867308Sbellard 
1398b779e29eSEdgar E. Iglesias #elif defined(TARGET_MICROBLAZE)
1399b779e29eSEdgar E. Iglesias 
1400b779e29eSEdgar E. Iglesias struct target_stat {
1401b779e29eSEdgar E. Iglesias 	abi_ulong st_dev;
1402b779e29eSEdgar E. Iglesias 	abi_ulong st_ino;
1403b779e29eSEdgar E. Iglesias 	unsigned int st_mode;
1404b779e29eSEdgar E. Iglesias 	unsigned short st_nlink;
1405b779e29eSEdgar E. Iglesias 	unsigned int st_uid;
1406b779e29eSEdgar E. Iglesias 	unsigned int st_gid;
1407b779e29eSEdgar E. Iglesias 	abi_ulong  st_rdev;
1408b779e29eSEdgar E. Iglesias 	abi_ulong  st_size;
1409b779e29eSEdgar E. Iglesias 	abi_ulong  st_blksize;
1410b779e29eSEdgar E. Iglesias 	abi_ulong  st_blocks;
1411b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_atime;
1412b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_atime_nsec;
1413b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_mtime;
1414b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_mtime_nsec;
1415b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_ctime;
1416b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_ctime_nsec;
1417b779e29eSEdgar E. Iglesias 	abi_ulong  __unused4;
1418b779e29eSEdgar E. Iglesias 	abi_ulong  __unused5;
1419b779e29eSEdgar E. Iglesias };
1420b779e29eSEdgar E. Iglesias 
1421b779e29eSEdgar E. Iglesias /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout...  */
1422541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 {
1423b779e29eSEdgar E. Iglesias 	uint64_t st_dev;
1424a523eb06SEdgar E. Iglesias #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
1425a523eb06SEdgar E. Iglesias 	uint32_t pad0;
1426a523eb06SEdgar E. Iglesias 	uint32_t __st_ino;
1427a523eb06SEdgar E. Iglesias 
1428b779e29eSEdgar E. Iglesias 	uint32_t st_mode;
1429b779e29eSEdgar E. Iglesias 	uint32_t st_nlink;
1430b779e29eSEdgar E. Iglesias 	uint32_t st_uid;
1431b779e29eSEdgar E. Iglesias 	uint32_t st_gid;
1432b779e29eSEdgar E. Iglesias 	uint64_t st_rdev;
143321ebeb23SEdgar E. Iglesias 	uint64_t __pad1;
1434b779e29eSEdgar E. Iglesias 
1435b779e29eSEdgar E. Iglesias 	int64_t  st_size;
1436b779e29eSEdgar E. Iglesias 	int32_t  st_blksize;
143721ebeb23SEdgar E. Iglesias 	uint32_t __pad2;
1438b779e29eSEdgar E. Iglesias 	int64_t st_blocks;	/* Number 512-byte blocks allocated. */
1439b779e29eSEdgar E. Iglesias 
1440b779e29eSEdgar E. Iglesias 	int	       target_st_atime;
1441b779e29eSEdgar E. Iglesias 	unsigned int   target_st_atime_nsec;
1442b779e29eSEdgar E. Iglesias 	int	       target_st_mtime;
1443b779e29eSEdgar E. Iglesias 	unsigned int   target_st_mtime_nsec;
1444b779e29eSEdgar E. Iglesias 	int            target_st_ctime;
1445b779e29eSEdgar E. Iglesias 	unsigned int   target_st_ctime_nsec;
1446a523eb06SEdgar E. Iglesias 	uint64_t st_ino;
1447b779e29eSEdgar E. Iglesias };
1448b779e29eSEdgar E. Iglesias 
1449e6e5906bSpbrook #elif defined(TARGET_M68K)
1450e6e5906bSpbrook 
1451e6e5906bSpbrook struct target_stat {
1452e6e5906bSpbrook 	unsigned short st_dev;
1453e6e5906bSpbrook 	unsigned short __pad1;
1454992f48a0Sblueswir1 	abi_ulong st_ino;
1455e6e5906bSpbrook 	unsigned short st_mode;
1456e6e5906bSpbrook 	unsigned short st_nlink;
1457e6e5906bSpbrook 	unsigned short st_uid;
1458e6e5906bSpbrook 	unsigned short st_gid;
1459e6e5906bSpbrook 	unsigned short st_rdev;
1460e6e5906bSpbrook 	unsigned short __pad2;
1461992f48a0Sblueswir1 	abi_ulong  st_size;
1462992f48a0Sblueswir1 	abi_ulong  st_blksize;
1463992f48a0Sblueswir1 	abi_ulong  st_blocks;
1464992f48a0Sblueswir1 	abi_ulong  target_st_atime;
1465992f48a0Sblueswir1 	abi_ulong  __unused1;
1466992f48a0Sblueswir1 	abi_ulong  target_st_mtime;
1467992f48a0Sblueswir1 	abi_ulong  __unused2;
1468992f48a0Sblueswir1 	abi_ulong  target_st_ctime;
1469992f48a0Sblueswir1 	abi_ulong  __unused3;
1470992f48a0Sblueswir1 	abi_ulong  __unused4;
1471992f48a0Sblueswir1 	abi_ulong  __unused5;
1472e6e5906bSpbrook };
1473e6e5906bSpbrook 
1474e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely
1475e6e5906bSpbrook  * insane amounts of padding around dev_t's.
1476e6e5906bSpbrook  */
1477e6e5906bSpbrook struct target_stat64 {
1478e6e5906bSpbrook 	unsigned long long	st_dev;
1479e6e5906bSpbrook 	unsigned char	__pad1[2];
1480e6e5906bSpbrook 
1481e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO	1
1482992f48a0Sblueswir1 	abi_ulong	__st_ino;
1483e6e5906bSpbrook 
1484e6e5906bSpbrook 	unsigned int	st_mode;
1485e6e5906bSpbrook 	unsigned int	st_nlink;
1486e6e5906bSpbrook 
1487992f48a0Sblueswir1 	abi_ulong	st_uid;
1488992f48a0Sblueswir1 	abi_ulong	st_gid;
1489e6e5906bSpbrook 
1490e6e5906bSpbrook 	unsigned long long	st_rdev;
1491e6e5906bSpbrook 	unsigned char	__pad3[2];
1492e6e5906bSpbrook 
1493e6e5906bSpbrook 	long long	st_size;
1494992f48a0Sblueswir1 	abi_ulong	st_blksize;
1495e6e5906bSpbrook 
1496992f48a0Sblueswir1 	abi_ulong	__pad4;		/* future possible st_blocks high bits */
1497992f48a0Sblueswir1 	abi_ulong	st_blocks;	/* Number 512-byte blocks allocated. */
1498e6e5906bSpbrook 
1499992f48a0Sblueswir1 	abi_ulong	target_st_atime;
1500992f48a0Sblueswir1 	abi_ulong	target_st_atime_nsec;
1501e6e5906bSpbrook 
1502992f48a0Sblueswir1 	abi_ulong	target_st_mtime;
1503992f48a0Sblueswir1 	abi_ulong	target_st_mtime_nsec;
1504e6e5906bSpbrook 
1505992f48a0Sblueswir1 	abi_ulong	target_st_ctime;
1506992f48a0Sblueswir1 	abi_ulong	target_st_ctime_nsec;
1507e6e5906bSpbrook 
1508e6e5906bSpbrook 	unsigned long long	st_ino;
1509541dc0d4SStefan Weil } QEMU_PACKED;
1510e6e5906bSpbrook 
1511d26bc211Sths #elif defined(TARGET_ABI_MIPSN64)
1512540635baSths 
1513540635baSths /* The memory layout is the same as of struct stat64 of the 32-bit kernel.  */
1514540635baSths struct target_stat {
1515540635baSths 	unsigned int		st_dev;
1516540635baSths 	unsigned int		st_pad0[3]; /* Reserved for st_dev expansion */
1517540635baSths 
1518992f48a0Sblueswir1 	abi_ulong		st_ino;
1519540635baSths 
1520540635baSths 	unsigned int		st_mode;
1521540635baSths 	unsigned int		st_nlink;
1522540635baSths 
1523540635baSths 	int			st_uid;
1524540635baSths 	int			st_gid;
1525540635baSths 
1526540635baSths 	unsigned int		st_rdev;
1527540635baSths 	unsigned int		st_pad1[3]; /* Reserved for st_rdev expansion */
1528540635baSths 
1529992f48a0Sblueswir1 	abi_ulong		st_size;
1530540635baSths 
1531540635baSths 	/*
1532540635baSths 	 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1533540635baSths 	 * but we don't have it under Linux.
1534540635baSths 	 */
1535540635baSths 	unsigned int		target_st_atime;
1536540635baSths 	unsigned int		target_st_atime_nsec;
1537540635baSths 
1538540635baSths 	unsigned int		target_st_mtime;
1539540635baSths 	unsigned int		target_st_mtime_nsec;
1540540635baSths 
1541540635baSths 	unsigned int		target_st_ctime;
1542540635baSths 	unsigned int		target_st_ctime_nsec;
1543540635baSths 
1544540635baSths 	unsigned int		st_blksize;
1545540635baSths 	unsigned int		st_pad2;
1546540635baSths 
1547992f48a0Sblueswir1 	abi_ulong		st_blocks;
1548540635baSths };
1549540635baSths 
1550d26bc211Sths #elif defined(TARGET_ABI_MIPSN32)
1551540635baSths 
1552540635baSths struct target_stat {
1553540635baSths 	unsigned	st_dev;
1554540635baSths 	int		st_pad1[3];		/* Reserved for network id */
1555540635baSths 	unsigned int	st_ino;
1556540635baSths 	unsigned int	st_mode;
1557540635baSths 	unsigned int	st_nlink;
1558540635baSths 	int		st_uid;
1559540635baSths 	int		st_gid;
1560540635baSths 	unsigned 	st_rdev;
1561540635baSths 	unsigned int	st_pad2[2];
1562540635baSths 	unsigned int	st_size;
1563540635baSths 	unsigned int	st_pad3;
1564540635baSths 	/*
1565540635baSths 	 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1566540635baSths 	 * but we don't have it under Linux.
1567540635baSths 	 */
1568540635baSths 	unsigned int		target_st_atime;
1569540635baSths 	unsigned int		target_st_atime_nsec;
1570540635baSths 	unsigned int		target_st_mtime;
1571540635baSths 	unsigned int		target_st_mtime_nsec;
1572540635baSths 	unsigned int		target_st_ctime;
1573540635baSths 	unsigned int		target_st_ctime_nsec;
1574540635baSths 	unsigned int		st_blksize;
1575540635baSths 	unsigned int		st_blocks;
1576540635baSths 	unsigned int		st_pad4[14];
1577540635baSths };
1578540635baSths 
1579540635baSths /*
1580540635baSths  * This matches struct stat64 in glibc2.1, hence the absolutely insane
1581540635baSths  * amounts of padding around dev_t's.  The memory layout is the same as of
1582540635baSths  * struct stat of the 64-bit kernel.
1583540635baSths  */
1584540635baSths 
1585540635baSths struct target_stat64 {
1586540635baSths 	unsigned int	st_dev;
1587540635baSths 	unsigned int	st_pad0[3];	/* Reserved for st_dev expansion  */
1588540635baSths 
1589540635baSths 	target_ulong	st_ino;
1590540635baSths 
1591540635baSths         unsigned int	st_mode;
1592540635baSths         unsigned int	st_nlink;
1593540635baSths 
1594540635baSths 	int		st_uid;
1595540635baSths 	int		st_gid;
1596540635baSths 
1597540635baSths 	unsigned int	st_rdev;
1598540635baSths 	unsigned int	st_pad1[3];	/* Reserved for st_rdev expansion  */
1599540635baSths 
1600540635baSths 	int		st_size;
1601540635baSths 
1602540635baSths 	/*
1603540635baSths 	 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1604540635baSths 	 * but we don't have it under Linux.
1605540635baSths 	 */
1606540635baSths 	int		target_st_atime;
1607540635baSths 	unsigned int	target_st_atime_nsec;	/* Reserved for st_atime expansion  */
1608540635baSths 
1609540635baSths 	int		target_st_mtime;
1610540635baSths 	unsigned int	target_st_mtime_nsec;	/* Reserved for st_mtime expansion  */
1611540635baSths 
1612540635baSths 	int		target_st_ctime;
1613540635baSths 	unsigned int	target_st_ctime_nsec;	/* Reserved for st_ctime expansion  */
1614540635baSths 
1615540635baSths 	unsigned int	st_blksize;
1616540635baSths 	unsigned int	st_pad2;
1617540635baSths 
1618540635baSths 	int		st_blocks;
1619540635baSths };
1620540635baSths 
1621d26bc211Sths #elif defined(TARGET_ABI_MIPSO32)
1622048f6b4dSbellard 
1623048f6b4dSbellard struct target_stat {
1624048f6b4dSbellard 	unsigned	st_dev;
1625992f48a0Sblueswir1 	abi_long	st_pad1[3];		/* Reserved for network id */
1626992f48a0Sblueswir1 	abi_ulong	st_ino;
1627048f6b4dSbellard 	unsigned int	st_mode;
1628048f6b4dSbellard 	unsigned int	st_nlink;
1629048f6b4dSbellard 	int		st_uid;
1630048f6b4dSbellard 	int		st_gid;
1631048f6b4dSbellard 	unsigned 	st_rdev;
1632992f48a0Sblueswir1 	abi_long	st_pad2[2];
1633992f48a0Sblueswir1 	abi_long	st_size;
1634992f48a0Sblueswir1 	abi_long	st_pad3;
1635048f6b4dSbellard 	/*
1636048f6b4dSbellard 	 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1637048f6b4dSbellard 	 * but we don't have it under Linux.
1638048f6b4dSbellard 	 */
1639992f48a0Sblueswir1 	abi_long		target_st_atime;
1640992f48a0Sblueswir1 	abi_long		target_st_atime_nsec;
1641992f48a0Sblueswir1 	abi_long		target_st_mtime;
1642992f48a0Sblueswir1 	abi_long		target_st_mtime_nsec;
1643992f48a0Sblueswir1 	abi_long		target_st_ctime;
1644992f48a0Sblueswir1 	abi_long		target_st_ctime_nsec;
1645992f48a0Sblueswir1 	abi_long		st_blksize;
1646992f48a0Sblueswir1 	abi_long		st_blocks;
1647992f48a0Sblueswir1 	abi_long		st_pad4[14];
1648048f6b4dSbellard };
1649048f6b4dSbellard 
1650048f6b4dSbellard /*
1651048f6b4dSbellard  * This matches struct stat64 in glibc2.1, hence the absolutely insane
1652048f6b4dSbellard  * amounts of padding around dev_t's.  The memory layout is the same as of
1653048f6b4dSbellard  * struct stat of the 64-bit kernel.
1654048f6b4dSbellard  */
1655048f6b4dSbellard 
1656048f6b4dSbellard struct target_stat64 {
1657992f48a0Sblueswir1 	abi_ulong	st_dev;
1658992f48a0Sblueswir1 	abi_ulong	st_pad0[3];	/* Reserved for st_dev expansion  */
1659048f6b4dSbellard 
1660048f6b4dSbellard 	uint64_t	st_ino;
1661048f6b4dSbellard 
1662048f6b4dSbellard         unsigned int	st_mode;
1663048f6b4dSbellard         unsigned int	st_nlink;
1664048f6b4dSbellard 
1665048f6b4dSbellard 	int		st_uid;
1666048f6b4dSbellard 	int		st_gid;
1667048f6b4dSbellard 
1668992f48a0Sblueswir1 	abi_ulong	st_rdev;
1669992f48a0Sblueswir1 	abi_ulong	st_pad1[3];	/* Reserved for st_rdev expansion  */
1670048f6b4dSbellard 
1671048f6b4dSbellard 	int64_t 	st_size;
1672048f6b4dSbellard 
1673048f6b4dSbellard 	/*
1674048f6b4dSbellard 	 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1675048f6b4dSbellard 	 * but we don't have it under Linux.
1676048f6b4dSbellard 	 */
1677992f48a0Sblueswir1 	abi_long	target_st_atime;
1678992f48a0Sblueswir1 	abi_ulong	target_st_atime_nsec;	/* Reserved for st_atime expansion  */
1679048f6b4dSbellard 
1680992f48a0Sblueswir1 	abi_long	target_st_mtime;
1681992f48a0Sblueswir1 	abi_ulong	target_st_mtime_nsec;	/* Reserved for st_mtime expansion  */
1682048f6b4dSbellard 
1683992f48a0Sblueswir1 	abi_long	target_st_ctime;
1684992f48a0Sblueswir1 	abi_ulong	target_st_ctime_nsec;	/* Reserved for st_ctime expansion  */
1685048f6b4dSbellard 
1686992f48a0Sblueswir1 	abi_ulong	st_blksize;
1687992f48a0Sblueswir1 	abi_ulong	st_pad2;
1688048f6b4dSbellard 
1689048f6b4dSbellard 	int64_t  	st_blocks;
1690048f6b4dSbellard };
16917a3148a9Sj_mayer 
16927a3148a9Sj_mayer #elif defined(TARGET_ALPHA)
16937a3148a9Sj_mayer 
16947a3148a9Sj_mayer struct target_stat {
16957a3148a9Sj_mayer        unsigned int    st_dev;
16967a3148a9Sj_mayer        unsigned int    st_ino;
16977a3148a9Sj_mayer        unsigned int    st_mode;
16987a3148a9Sj_mayer        unsigned int    st_nlink;
16997a3148a9Sj_mayer        unsigned int    st_uid;
17007a3148a9Sj_mayer        unsigned int    st_gid;
17017a3148a9Sj_mayer        unsigned int    st_rdev;
1702992f48a0Sblueswir1        abi_long     st_size;
1703992f48a0Sblueswir1        abi_ulong    target_st_atime;
1704992f48a0Sblueswir1        abi_ulong    target_st_mtime;
1705992f48a0Sblueswir1        abi_ulong    target_st_ctime;
17067a3148a9Sj_mayer        unsigned int    st_blksize;
17077a3148a9Sj_mayer        unsigned int    st_blocks;
17087a3148a9Sj_mayer        unsigned int    st_flags;
17097a3148a9Sj_mayer        unsigned int    st_gen;
17107a3148a9Sj_mayer };
17117a3148a9Sj_mayer 
17127a3148a9Sj_mayer struct target_stat64 {
1713992f48a0Sblueswir1        abi_ulong    st_dev;
1714992f48a0Sblueswir1        abi_ulong    st_ino;
1715992f48a0Sblueswir1        abi_ulong    st_rdev;
1716992f48a0Sblueswir1        abi_long     st_size;
1717992f48a0Sblueswir1        abi_ulong    st_blocks;
17187a3148a9Sj_mayer 
17197a3148a9Sj_mayer        unsigned int    st_mode;
17207a3148a9Sj_mayer        unsigned int    st_uid;
17217a3148a9Sj_mayer        unsigned int    st_gid;
17227a3148a9Sj_mayer        unsigned int    st_blksize;
17237a3148a9Sj_mayer        unsigned int    st_nlink;
17247a3148a9Sj_mayer        unsigned int    __pad0;
17257a3148a9Sj_mayer 
1726992f48a0Sblueswir1        abi_ulong    target_st_atime;
1727992f48a0Sblueswir1        abi_ulong    target_st_atime_nsec;
1728992f48a0Sblueswir1        abi_ulong    target_st_mtime;
1729992f48a0Sblueswir1        abi_ulong    target_st_mtime_nsec;
1730992f48a0Sblueswir1        abi_ulong    target_st_ctime;
1731992f48a0Sblueswir1        abi_ulong    target_st_ctime_nsec;
1732992f48a0Sblueswir1        abi_long     __unused[3];
17337a3148a9Sj_mayer };
17347a3148a9Sj_mayer 
17356db45e65Sths #elif defined(TARGET_SH4)
17366db45e65Sths 
17376db45e65Sths struct target_stat {
1738992f48a0Sblueswir1 	abi_ulong  st_dev;
1739992f48a0Sblueswir1 	abi_ulong  st_ino;
17406db45e65Sths 	unsigned short st_mode;
17416db45e65Sths 	unsigned short st_nlink;
17426db45e65Sths 	unsigned short st_uid;
17436db45e65Sths 	unsigned short st_gid;
1744992f48a0Sblueswir1 	abi_ulong  st_rdev;
1745992f48a0Sblueswir1 	abi_ulong  st_size;
1746992f48a0Sblueswir1 	abi_ulong  st_blksize;
1747992f48a0Sblueswir1 	abi_ulong  st_blocks;
1748992f48a0Sblueswir1 	abi_ulong  target_st_atime;
1749992f48a0Sblueswir1 	abi_ulong  target_st_atime_nsec;
1750992f48a0Sblueswir1 	abi_ulong  target_st_mtime;
1751992f48a0Sblueswir1 	abi_ulong  target_st_mtime_nsec;
1752992f48a0Sblueswir1 	abi_ulong  target_st_ctime;
1753992f48a0Sblueswir1 	abi_ulong  target_st_ctime_nsec;
1754992f48a0Sblueswir1 	abi_ulong  __unused4;
1755992f48a0Sblueswir1 	abi_ulong  __unused5;
17566db45e65Sths };
17576db45e65Sths 
17586db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely
17596db45e65Sths  * insane amounts of padding around dev_t's.
17606db45e65Sths  */
1761541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 {
17626db45e65Sths 	unsigned long long	st_dev;
17636db45e65Sths 	unsigned char	__pad0[4];
17646db45e65Sths 
17656db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO	1
1766992f48a0Sblueswir1 	abi_ulong	__st_ino;
17676db45e65Sths 
17686db45e65Sths 	unsigned int	st_mode;
17696db45e65Sths 	unsigned int	st_nlink;
17706db45e65Sths 
1771992f48a0Sblueswir1 	abi_ulong	st_uid;
1772992f48a0Sblueswir1 	abi_ulong	st_gid;
17736db45e65Sths 
17746db45e65Sths 	unsigned long long	st_rdev;
17756db45e65Sths 	unsigned char	__pad3[4];
17766db45e65Sths 
17776db45e65Sths 	long long	st_size;
1778992f48a0Sblueswir1 	abi_ulong	st_blksize;
17796db45e65Sths 
17806db45e65Sths 	unsigned long long	st_blocks;	/* Number 512-byte blocks allocated. */
17816db45e65Sths 
1782992f48a0Sblueswir1 	abi_ulong	target_st_atime;
1783992f48a0Sblueswir1 	abi_ulong	target_st_atime_nsec;
17846db45e65Sths 
1785992f48a0Sblueswir1 	abi_ulong	target_st_mtime;
1786992f48a0Sblueswir1 	abi_ulong	target_st_mtime_nsec;
17876db45e65Sths 
1788992f48a0Sblueswir1 	abi_ulong	target_st_ctime;
1789992f48a0Sblueswir1 	abi_ulong	target_st_ctime_nsec;
17906db45e65Sths 
17916db45e65Sths 	unsigned long long	st_ino;
17926db45e65Sths };
17936db45e65Sths 
1794d2fd1af7Sbellard #elif defined(TARGET_I386) && !defined(TARGET_ABI32)
1795d2fd1af7Sbellard struct target_stat {
1796d2fd1af7Sbellard 	abi_ulong	st_dev;
1797d2fd1af7Sbellard 	abi_ulong	st_ino;
1798d2fd1af7Sbellard 	abi_ulong	st_nlink;
1799d2fd1af7Sbellard 
1800d2fd1af7Sbellard 	unsigned int	st_mode;
1801d2fd1af7Sbellard 	unsigned int	st_uid;
1802d2fd1af7Sbellard 	unsigned int	st_gid;
1803d2fd1af7Sbellard 	unsigned int	__pad0;
1804d2fd1af7Sbellard 	abi_ulong	st_rdev;
1805d2fd1af7Sbellard 	abi_long	st_size;
1806d2fd1af7Sbellard 	abi_long	st_blksize;
1807d2fd1af7Sbellard     	abi_long	st_blocks;	/* Number 512-byte blocks allocated. */
1808d2fd1af7Sbellard 
1809d2fd1af7Sbellard 	abi_ulong	target_st_atime;
1810d2fd1af7Sbellard 	abi_ulong 	target_st_atime_nsec;
1811d2fd1af7Sbellard 	abi_ulong	target_st_mtime;
1812d2fd1af7Sbellard 	abi_ulong	target_st_mtime_nsec;
1813d2fd1af7Sbellard 	abi_ulong	target_st_ctime;
1814d2fd1af7Sbellard 	abi_ulong       target_st_ctime_nsec;
1815d2fd1af7Sbellard 
1816d2fd1af7Sbellard   	abi_long	__unused[3];
1817d2fd1af7Sbellard };
1818a4c075f1SUlrich Hecht #elif defined(TARGET_S390X)
1819a4c075f1SUlrich Hecht struct target_stat {
1820a4c075f1SUlrich Hecht     abi_ulong  st_dev;
1821a4c075f1SUlrich Hecht     abi_ulong  st_ino;
1822a4c075f1SUlrich Hecht     abi_ulong  st_nlink;
1823a4c075f1SUlrich Hecht     unsigned int   st_mode;
1824a4c075f1SUlrich Hecht     unsigned int   st_uid;
1825a4c075f1SUlrich Hecht     unsigned int   st_gid;
1826a4c075f1SUlrich Hecht     unsigned int   __pad1;
1827a4c075f1SUlrich Hecht     abi_ulong  st_rdev;
1828a4c075f1SUlrich Hecht     abi_ulong  st_size;
1829a4c075f1SUlrich Hecht     abi_ulong  target_st_atime;
1830a4c075f1SUlrich Hecht     abi_ulong  target_st_atime_nsec;
1831a4c075f1SUlrich Hecht     abi_ulong  target_st_mtime;
1832a4c075f1SUlrich Hecht     abi_ulong  target_st_mtime_nsec;
1833a4c075f1SUlrich Hecht     abi_ulong  target_st_ctime;
1834a4c075f1SUlrich Hecht     abi_ulong  target_st_ctime_nsec;
1835a4c075f1SUlrich Hecht     abi_ulong  st_blksize;
1836a4c075f1SUlrich Hecht     abi_long       st_blocks;
1837a4c075f1SUlrich Hecht     abi_ulong  __unused[3];
1838a4c075f1SUlrich Hecht };
1839d962783eSJia Liu #elif defined(TARGET_OPENRISC)
1840d962783eSJia Liu struct target_stat {
1841d962783eSJia Liu     abi_ulong st_dev;
1842d962783eSJia Liu     abi_ulong st_ino;
1843d962783eSJia Liu     abi_ulong st_nlink;
1844d962783eSJia Liu 
1845d962783eSJia Liu     unsigned int st_mode;
1846d962783eSJia Liu     unsigned int st_uid;
1847d962783eSJia Liu     unsigned int st_gid;
1848d962783eSJia Liu     unsigned int __pad0;
1849d962783eSJia Liu     abi_ulong st_rdev;
1850d962783eSJia Liu     abi_long st_size;
1851d962783eSJia Liu     abi_long st_blksize;
1852d962783eSJia Liu     abi_long st_blocks;    /* Number 512-byte blocks allocated. */
1853d962783eSJia Liu 
1854d962783eSJia Liu     abi_ulong target_st_atime;
1855d962783eSJia Liu     abi_ulong target_st_atime_nsec;
1856d962783eSJia Liu     abi_ulong target_st_mtime;
1857d962783eSJia Liu     abi_ulong target_st_mtime_nsec;
1858d962783eSJia Liu     abi_ulong target_st_ctime;
1859d962783eSJia Liu     abi_ulong target_st_ctime_nsec;
1860d962783eSJia Liu 
1861d962783eSJia Liu     abi_long __unused[3];
1862d962783eSJia Liu };
1863048f6b4dSbellard #else
1864048f6b4dSbellard #error unsupported CPU
1865048f6b4dSbellard #endif
18662521d698Sbellard 
18674ce6f8deSths typedef struct {
18684ce6f8deSths         int     val[2];
1869c227f099SAnthony Liguori } target_fsid_t;
18704ce6f8deSths 
187156c8f68fSbellard #ifdef TARGET_MIPS
1872d26bc211Sths #ifdef TARGET_ABI_MIPSN32
1873540635baSths struct target_statfs {
1874540635baSths 	int32_t			f_type;
1875540635baSths 	int32_t			f_bsize;
1876540635baSths 	int32_t			f_frsize;	/* Fragment size - unsupported */
1877540635baSths 	int32_t			f_blocks;
1878540635baSths 	int32_t			f_bfree;
1879540635baSths 	int32_t			f_files;
1880540635baSths 	int32_t			f_ffree;
1881540635baSths 	int32_t			f_bavail;
1882540635baSths 
1883540635baSths 	/* Linux specials */
1884c227f099SAnthony Liguori 	target_fsid_t		f_fsid;
1885540635baSths 	int32_t			f_namelen;
1886540635baSths 	int32_t			f_spare[6];
1887540635baSths };
1888540635baSths #else
188956c8f68fSbellard struct target_statfs {
1890992f48a0Sblueswir1 	abi_long		f_type;
1891992f48a0Sblueswir1 	abi_long		f_bsize;
1892992f48a0Sblueswir1 	abi_long		f_frsize;	/* Fragment size - unsupported */
1893992f48a0Sblueswir1 	abi_long		f_blocks;
1894992f48a0Sblueswir1 	abi_long		f_bfree;
1895992f48a0Sblueswir1 	abi_long		f_files;
1896992f48a0Sblueswir1 	abi_long		f_ffree;
1897992f48a0Sblueswir1 	abi_long		f_bavail;
189856c8f68fSbellard 
189956c8f68fSbellard 	/* Linux specials */
1900c227f099SAnthony Liguori 	target_fsid_t		f_fsid;
1901992f48a0Sblueswir1 	abi_long		f_namelen;
1902992f48a0Sblueswir1 	abi_long		f_spare[6];
190356c8f68fSbellard };
1904540635baSths #endif
190556c8f68fSbellard 
190656c8f68fSbellard struct target_statfs64 {
190756c8f68fSbellard 	uint32_t	f_type;
190856c8f68fSbellard 	uint32_t	f_bsize;
190956c8f68fSbellard 	uint32_t	f_frsize;	/* Fragment size - unsupported */
191056c8f68fSbellard 	uint32_t	__pad;
191156c8f68fSbellard 	uint64_t	f_blocks;
191256c8f68fSbellard 	uint64_t	f_bfree;
191356c8f68fSbellard 	uint64_t	f_files;
191456c8f68fSbellard 	uint64_t	f_ffree;
191556c8f68fSbellard 	uint64_t	f_bavail;
1916c227f099SAnthony Liguori 	target_fsid_t	f_fsid;
191756c8f68fSbellard 	uint32_t	f_namelen;
191856c8f68fSbellard 	uint32_t	f_spare[6];
191956c8f68fSbellard };
1920c4d10628Sbalrog #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \
1921c4d10628Sbalrog        defined(TARGET_SPARC64)) && !defined(TARGET_ABI32)
1922325e651fSj_mayer struct target_statfs {
1923325e651fSj_mayer 	abi_long f_type;
1924325e651fSj_mayer 	abi_long f_bsize;
1925325e651fSj_mayer 	abi_long f_blocks;
1926325e651fSj_mayer 	abi_long f_bfree;
1927325e651fSj_mayer 	abi_long f_bavail;
1928325e651fSj_mayer 	abi_long f_files;
1929325e651fSj_mayer 	abi_long f_ffree;
1930c227f099SAnthony Liguori 	target_fsid_t f_fsid;
1931325e651fSj_mayer 	abi_long f_namelen;
1932325e651fSj_mayer 	abi_long f_frsize;
1933325e651fSj_mayer 	abi_long f_spare[5];
1934325e651fSj_mayer };
1935325e651fSj_mayer 
1936325e651fSj_mayer struct target_statfs64 {
1937325e651fSj_mayer 	abi_long f_type;
1938325e651fSj_mayer 	abi_long f_bsize;
1939325e651fSj_mayer 	abi_long f_blocks;
1940325e651fSj_mayer 	abi_long f_bfree;
1941325e651fSj_mayer 	abi_long f_bavail;
1942325e651fSj_mayer 	abi_long f_files;
1943325e651fSj_mayer 	abi_long f_ffree;
1944c227f099SAnthony Liguori 	target_fsid_t f_fsid;
1945325e651fSj_mayer 	abi_long f_namelen;
1946325e651fSj_mayer 	abi_long f_frsize;
1947325e651fSj_mayer 	abi_long f_spare[5];
1948325e651fSj_mayer };
1949a4c075f1SUlrich Hecht #elif defined(TARGET_S390X)
1950a4c075f1SUlrich Hecht struct target_statfs {
1951a4c075f1SUlrich Hecht     int32_t  f_type;
1952a4c075f1SUlrich Hecht     int32_t  f_bsize;
1953a4c075f1SUlrich Hecht     abi_long f_blocks;
1954a4c075f1SUlrich Hecht     abi_long f_bfree;
1955a4c075f1SUlrich Hecht     abi_long f_bavail;
1956a4c075f1SUlrich Hecht     abi_long f_files;
1957a4c075f1SUlrich Hecht     abi_long f_ffree;
1958a4c075f1SUlrich Hecht     kernel_fsid_t f_fsid;
1959a4c075f1SUlrich Hecht     int32_t  f_namelen;
1960a4c075f1SUlrich Hecht     int32_t  f_frsize;
1961a4c075f1SUlrich Hecht     int32_t  f_spare[5];
1962a4c075f1SUlrich Hecht };
1963a4c075f1SUlrich Hecht 
1964a4c075f1SUlrich Hecht struct target_statfs64 {
1965a4c075f1SUlrich Hecht     int32_t  f_type;
1966a4c075f1SUlrich Hecht     int32_t  f_bsize;
1967a4c075f1SUlrich Hecht     abi_long f_blocks;
1968a4c075f1SUlrich Hecht     abi_long f_bfree;
1969a4c075f1SUlrich Hecht     abi_long f_bavail;
1970a4c075f1SUlrich Hecht     abi_long f_files;
1971a4c075f1SUlrich Hecht     abi_long f_ffree;
1972a4c075f1SUlrich Hecht     kernel_fsid_t f_fsid;
1973a4c075f1SUlrich Hecht     int32_t  f_namelen;
1974a4c075f1SUlrich Hecht     int32_t  f_frsize;
1975a4c075f1SUlrich Hecht     int32_t  f_spare[5];
1976a4c075f1SUlrich Hecht };
197756c8f68fSbellard #else
197856c8f68fSbellard struct target_statfs {
197956c8f68fSbellard 	uint32_t f_type;
198056c8f68fSbellard 	uint32_t f_bsize;
198156c8f68fSbellard 	uint32_t f_blocks;
198256c8f68fSbellard 	uint32_t f_bfree;
198356c8f68fSbellard 	uint32_t f_bavail;
198456c8f68fSbellard 	uint32_t f_files;
198556c8f68fSbellard 	uint32_t f_ffree;
1986c227f099SAnthony Liguori 	target_fsid_t f_fsid;
198756c8f68fSbellard 	uint32_t f_namelen;
198856c8f68fSbellard 	uint32_t f_frsize;
198956c8f68fSbellard 	uint32_t f_spare[5];
199056c8f68fSbellard };
199156c8f68fSbellard 
199256c8f68fSbellard struct target_statfs64 {
199356c8f68fSbellard 	uint32_t f_type;
199456c8f68fSbellard 	uint32_t f_bsize;
199556c8f68fSbellard 	uint64_t f_blocks;
199656c8f68fSbellard 	uint64_t f_bfree;
199756c8f68fSbellard 	uint64_t f_bavail;
199856c8f68fSbellard 	uint64_t f_files;
199956c8f68fSbellard 	uint64_t f_ffree;
2000c227f099SAnthony Liguori 	target_fsid_t f_fsid;
200156c8f68fSbellard         uint32_t f_namelen;
200256c8f68fSbellard 	uint32_t f_frsize;
200356c8f68fSbellard 	uint32_t f_spare[5];
200456c8f68fSbellard };
200556c8f68fSbellard #endif
200656c8f68fSbellard 
200756c8f68fSbellard 
20082521d698Sbellard #define TARGET_F_DUPFD         0       /* dup */
20092521d698Sbellard #define TARGET_F_GETFD         1       /* get close_on_exec */
20102521d698Sbellard #define TARGET_F_SETFD         2       /* set/clear close_on_exec */
20112521d698Sbellard #define TARGET_F_GETFL         3       /* get file->f_flags */
20122521d698Sbellard #define TARGET_F_SETFL         4       /* set file->f_flags */
20132521d698Sbellard 
20142521d698Sbellard #if defined(TARGET_ALPHA)
20152521d698Sbellard #define TARGET_F_GETLK         7
20162521d698Sbellard #define TARGET_F_SETLK         8
20172521d698Sbellard #define TARGET_F_SETLKW        9
20182521d698Sbellard #define TARGET_F_SETOWN        5       /*  for sockets. */
20192521d698Sbellard #define TARGET_F_GETOWN        6       /*  for sockets. */
20205f106811SArnaud Patard (Rtp) #elif defined(TARGET_MIPS)
20215f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK         14
20225f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK         6
20235f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW        7
20245f106811SArnaud Patard (Rtp) #define TARGET_F_SETOWN        24       /*  for sockets. */
20255f106811SArnaud Patard (Rtp) #define TARGET_F_GETOWN        25       /*  for sockets. */
20262521d698Sbellard #else
20272521d698Sbellard #define TARGET_F_GETLK         5
20282521d698Sbellard #define TARGET_F_SETLK         6
20292521d698Sbellard #define TARGET_F_SETLKW        7
20302521d698Sbellard #define TARGET_F_SETOWN        8       /*  for sockets. */
20312521d698Sbellard #define TARGET_F_GETOWN        9       /*  for sockets. */
20322521d698Sbellard #endif
20332521d698Sbellard 
20342521d698Sbellard #define TARGET_F_SETSIG        10      /*  for sockets. */
20352521d698Sbellard #define TARGET_F_GETSIG        11      /*  for sockets. */
20362521d698Sbellard 
20375f106811SArnaud Patard (Rtp) #if defined(TARGET_MIPS)
20385f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK64       33      /*  using 'struct flock64' */
20395f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK64       34
20405f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW64      35
20415f106811SArnaud Patard (Rtp) #else
20422521d698Sbellard #define TARGET_F_GETLK64       12      /*  using 'struct flock64' */
20432521d698Sbellard #define TARGET_F_SETLK64       13
20442521d698Sbellard #define TARGET_F_SETLKW64      14
20455f106811SArnaud Patard (Rtp) #endif
20467e22e546SUlrich Hecht 
20477e22e546SUlrich Hecht #define TARGET_F_LINUX_SPECIFIC_BASE 1024
20487e22e546SUlrich Hecht #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0)
20497e22e546SUlrich Hecht #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1)
20507e22e546SUlrich Hecht #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6)
20517e22e546SUlrich Hecht #define TARGET_F_NOTIFY  (TARGET_F_LINUX_SPECIFIC_BASE+2)
20527e22e546SUlrich Hecht 
20534eeea4f3SRichard Henderson #if defined(TARGET_ALPHA)
20544eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK           04
20554eeea4f3SRichard Henderson #define TARGET_O_APPEND            010
20564eeea4f3SRichard Henderson #define TARGET_O_CREAT           01000 /* not fcntl */
20574eeea4f3SRichard Henderson #define TARGET_O_TRUNC           02000 /* not fcntl */
20584eeea4f3SRichard Henderson #define TARGET_O_EXCL            04000 /* not fcntl */
20594eeea4f3SRichard Henderson #define TARGET_O_NOCTTY         010000 /* not fcntl */
20604eeea4f3SRichard Henderson #define TARGET_O_DSYNC          040000
20614eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE           0 /* not necessary, always 64-bit */
20624eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY     0100000 /* must be a directory */
20634eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW      0200000 /* don't follow links */
20644eeea4f3SRichard Henderson #define TARGET_O_DIRECT       02000000 /* direct disk access hint */
20654eeea4f3SRichard Henderson #define TARGET_O_NOATIME      04000000
20664eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC     010000000
20674eeea4f3SRichard Henderson #define TARGET___O_SYNC      020000000
20684eeea4f3SRichard Henderson #define TARGET_O_PATH        040000000
20694eeea4f3SRichard Henderson #elif defined(TARGET_ARM) || defined(TARGET_M68K)
2070f09936acSbellard #define TARGET_O_DIRECTORY      040000 /* must be a directory */
2071f09936acSbellard #define TARGET_O_NOFOLLOW      0100000 /* don't follow links */
2072f09936acSbellard #define TARGET_O_DIRECT        0200000 /* direct disk access hint */
2073f09936acSbellard #define TARGET_O_LARGEFILE     0400000
2074048f6b4dSbellard #elif defined(TARGET_MIPS)
2075048f6b4dSbellard #define TARGET_O_APPEND         0x0008
20764eeea4f3SRichard Henderson #define TARGET_O_DSYNC          0x0010
2077048f6b4dSbellard #define TARGET_O_NONBLOCK       0x0080
2078048f6b4dSbellard #define TARGET_O_CREAT          0x0100  /* not fcntl */
2079048f6b4dSbellard #define TARGET_O_TRUNC          0x0200  /* not fcntl */
2080048f6b4dSbellard #define TARGET_O_EXCL           0x0400  /* not fcntl */
2081048f6b4dSbellard #define TARGET_O_NOCTTY         0x0800  /* not fcntl */
2082048f6b4dSbellard #define TARGET_FASYNC           0x1000  /* fcntl, for BSD compatibility */
2083048f6b4dSbellard #define TARGET_O_LARGEFILE      0x2000  /* allow large file opens */
20844eeea4f3SRichard Henderson #define TARGET___O_SYNC         0x4000
2085048f6b4dSbellard #define TARGET_O_DIRECT         0x8000  /* direct disk access hint */
20864eeea4f3SRichard Henderson #elif defined (TARGET_PPC)
20874eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY      040000 /* must be a directory */
20884eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW      0100000 /* don't follow links */
20894eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE     0200000
20904eeea4f3SRichard Henderson #define TARGET_O_DIRECT        0400000 /* direct disk access hint */
20914eeea4f3SRichard Henderson #elif defined (TARGET_SPARC)
20921f961124Saurel32 #define TARGET_O_APPEND         0x0008
20934eeea4f3SRichard Henderson #define TARGET_FASYNC           0x0040  /* fcntl, for BSD compatibility */
20941f961124Saurel32 #define TARGET_O_CREAT          0x0200  /* not fcntl */
20951f961124Saurel32 #define TARGET_O_TRUNC          0x0400  /* not fcntl */
20961f961124Saurel32 #define TARGET_O_EXCL           0x0800  /* not fcntl */
20974eeea4f3SRichard Henderson #define TARGET_O_DSYNC          0x2000
20984eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK       0x4000
20994eeea4f3SRichard Henderson # ifdef TARGET_SPARC64
21004eeea4f3SRichard Henderson #  define TARGET_O_NDELAY       0x0004
2101ffa65c3bSbellard # else
21024eeea4f3SRichard Henderson #  define TARGET_O_NDELAY       (0x0004 | TARGET_O_NONBLOCK)
21034eeea4f3SRichard Henderson # endif
21044eeea4f3SRichard Henderson #define TARGET_O_NOCTTY         0x8000  /* not fcntl */
21054eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE     0x40000
21064eeea4f3SRichard Henderson #define TARGET_O_DIRECT       0x100000  /* direct disk access hint */
21074eeea4f3SRichard Henderson #define TARGET_O_NOATIME      0x200000
21084eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC      0x400000
21094eeea4f3SRichard Henderson #define TARGET___O_SYNC       0x800000
21104eeea4f3SRichard Henderson #define TARGET_O_PATH        0x1000000
21114eeea4f3SRichard Henderson #endif
21124eeea4f3SRichard Henderson 
21134eeea4f3SRichard Henderson /* <asm-generic/fcntl.h> values follow.  */
2114ffa65c3bSbellard #define TARGET_O_ACCMODE          0003
2115ffa65c3bSbellard #define TARGET_O_RDONLY             00
2116ffa65c3bSbellard #define TARGET_O_WRONLY             01
2117ffa65c3bSbellard #define TARGET_O_RDWR               02
21184eeea4f3SRichard Henderson #ifndef TARGET_O_CREAT
2119ffa65c3bSbellard #define TARGET_O_CREAT            0100 /* not fcntl */
21204eeea4f3SRichard Henderson #endif
21214eeea4f3SRichard Henderson #ifndef TARGET_O_EXCL
2122ffa65c3bSbellard #define TARGET_O_EXCL             0200 /* not fcntl */
21234eeea4f3SRichard Henderson #endif
21244eeea4f3SRichard Henderson #ifndef TARGET_O_NOCTTY
2125ffa65c3bSbellard #define TARGET_O_NOCTTY           0400 /* not fcntl */
21264eeea4f3SRichard Henderson #endif
21274eeea4f3SRichard Henderson #ifndef TARGET_O_TRUNC
2128ffa65c3bSbellard #define TARGET_O_TRUNC           01000 /* not fcntl */
21294eeea4f3SRichard Henderson #endif
21304eeea4f3SRichard Henderson #ifndef TARGET_O_APPEND
2131ffa65c3bSbellard #define TARGET_O_APPEND          02000
21324eeea4f3SRichard Henderson #endif
21334eeea4f3SRichard Henderson #ifndef TARGET_O_NONBLOCK
2134ffa65c3bSbellard #define TARGET_O_NONBLOCK        04000
21354eeea4f3SRichard Henderson #endif
21364eeea4f3SRichard Henderson #ifndef TARGET_O_DSYNC
21374eeea4f3SRichard Henderson #define TARGET_O_DSYNC          010000
21384eeea4f3SRichard Henderson #endif
21394eeea4f3SRichard Henderson #ifndef TARGET_FASYNC
2140ffa65c3bSbellard #define TARGET_FASYNC           020000 /* fcntl, for BSD compatibility */
21414eeea4f3SRichard Henderson #endif
21424eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECT
2143ffa65c3bSbellard #define TARGET_O_DIRECT         040000 /* direct disk access hint */
21444eeea4f3SRichard Henderson #endif
21454eeea4f3SRichard Henderson #ifndef TARGET_O_LARGEFILE
2146ffa65c3bSbellard #define TARGET_O_LARGEFILE     0100000
21474eeea4f3SRichard Henderson #endif
21484eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECTORY
2149ffa65c3bSbellard #define TARGET_O_DIRECTORY     0200000 /* must be a directory */
21504eeea4f3SRichard Henderson #endif
21514eeea4f3SRichard Henderson #ifndef TARGET_O_NOFOLLOW
2152ffa65c3bSbellard #define TARGET_O_NOFOLLOW      0400000 /* don't follow links */
2153ffa65c3bSbellard #endif
21544eeea4f3SRichard Henderson #ifndef TARGET_O_NOATIME
21554eeea4f3SRichard Henderson #define TARGET_O_NOATIME      01000000
21564eeea4f3SRichard Henderson #endif
21574eeea4f3SRichard Henderson #ifndef TARGET_O_CLOEXEC
21584eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC      02000000
21594eeea4f3SRichard Henderson #endif
21604eeea4f3SRichard Henderson #ifndef TARGET___O_SYNC
21614eeea4f3SRichard Henderson #define TARGET___O_SYNC       04000000
21624eeea4f3SRichard Henderson #endif
21634eeea4f3SRichard Henderson #ifndef TARGET_O_PATH
21644eeea4f3SRichard Henderson #define TARGET_O_PATH        010000000
21654eeea4f3SRichard Henderson #endif
21664eeea4f3SRichard Henderson #ifndef TARGET_O_NDELAY
21674eeea4f3SRichard Henderson #define TARGET_O_NDELAY  TARGET_O_NONBLOCK
21684eeea4f3SRichard Henderson #endif
21694eeea4f3SRichard Henderson #ifndef TARGET_O_SYNC
21704eeea4f3SRichard Henderson #define TARGET_O_SYNC    (TARGET___O_SYNC | TARGET_O_DSYNC)
21714eeea4f3SRichard Henderson #endif
2172ffa65c3bSbellard 
21732521d698Sbellard struct target_flock {
21742521d698Sbellard 	short l_type;
21752521d698Sbellard 	short l_whence;
2176992f48a0Sblueswir1 	abi_ulong l_start;
2177992f48a0Sblueswir1 	abi_ulong l_len;
21782521d698Sbellard 	int l_pid;
21792521d698Sbellard };
21802521d698Sbellard 
21812521d698Sbellard struct target_flock64 {
21822521d698Sbellard 	short  l_type;
21832521d698Sbellard 	short  l_whence;
2184b779e29eSEdgar E. Iglesias #if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) || defined(TARGET_SPARC) || defined(TARGET_HPPA) || defined (TARGET_MICROBLAZE)
2185ce3f0e2fSaurel32         int __pad;
2186ce3f0e2fSaurel32 #endif
21872521d698Sbellard 	unsigned long long l_start;
21882521d698Sbellard 	unsigned long long l_len;
21892521d698Sbellard 	int  l_pid;
2190541dc0d4SStefan Weil } QEMU_PACKED;
21912521d698Sbellard 
2192ce4defa0Spbrook #ifdef TARGET_ARM
2193ce4defa0Spbrook struct target_eabi_flock64 {
2194ce4defa0Spbrook 	short  l_type;
2195ce4defa0Spbrook 	short  l_whence;
2196ce4defa0Spbrook         int __pad;
2197ce4defa0Spbrook 	unsigned long long l_start;
2198ce4defa0Spbrook 	unsigned long long l_len;
2199ce4defa0Spbrook 	int  l_pid;
2200541dc0d4SStefan Weil } QEMU_PACKED;
2201ce4defa0Spbrook #endif
22022521d698Sbellard 
22032521d698Sbellard /* soundcard defines */
22042521d698Sbellard /* XXX: convert them all to arch indepedent entries */
22052521d698Sbellard #define TARGET_SNDCTL_COPR_HALT           TARGET_IOWR('C',  7, int);
22062521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD           0xcfb04301
22072521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE          0xc0144303
22082521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG         0x8fa44309
22092521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA          0xc0144302
22102521d698Sbellard #define TARGET_SNDCTL_COPR_RESET          0x00004300
22112521d698Sbellard #define TARGET_SNDCTL_COPR_RUN            0xc0144306
22122521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG        0xcfa44308
22132521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE          0x40144305
22142521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA          0x40144304
22152521d698Sbellard #define TARGET_SNDCTL_DSP_RESET           TARGET_IO('P', 0)
22162521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC            TARGET_IO('P', 1)
22172521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED           TARGET_IOWR('P', 2, int)
22182521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO          TARGET_IOWR('P', 3, int)
22192521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE      TARGET_IOWR('P', 4, int)
22202521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT          TARGET_IOWR('P', 5, int)
22212521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS        TARGET_IOWR('P', 6, int)
22222521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER     TARGET_IOWR('P', 7, int)
22232521d698Sbellard #define TARGET_SNDCTL_DSP_POST            TARGET_IO('P', 8)
22242521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE       TARGET_IOWR('P', 9, int)
22252521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT     TARGET_IOWR('P',10, int)
22262521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS         TARGET_IOR('P', 11, int)
22272521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE       TARGET_IORU('P',12)
22282521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE       TARGET_IORU('P',13)
22292521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS         TARGET_IOR('P', 15, int)
22302521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER      TARGET_IOR('P',16, int)
22312521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR         TARGET_IORU('P',17)
22322521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR         TARGET_IORU('P',18)
22335f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPINBUF        TARGET_IORU('P', 19)
22345f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPOUTBUF       TARGET_IORU('P', 20)
22352521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK        0x0000500e
22362521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE      0xc0045005
22372521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX       0x00005016
22382521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO       0x00005015
22392521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER      0x40045010
22402521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE       0x4004510f
22412521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR       0x40285107
22422521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO           0xc074510c
22432521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD         0xc0216d02
22442521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE        0xc0046d01
22452521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME        0xc0046d00
22462521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS         0xcfb85110
22472521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE          0xcfb85001
22482521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE        0xc0045103
22492521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT      0x80045105
22502521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT     0x80045104
22512521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS         0x8004510b
22522521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS        0x8004510a
22532521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND       0x40085112
22542521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC           0x00005111
22552521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE        0x40045106
22562521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET           0x00005100
22572521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES    0x40045109
22582521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC            0x00005101
22592521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI        0x40045108
22602521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD       0x4004510d
22612521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD        0x4004510d
22622521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO          0xc08c5102
22632521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL        0xc004510e
22642521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE        0x00005404
22652521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME       0x40045407
22662521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT          0x40045408
22672521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE          0xc0045406
22682521d698Sbellard #define TARGET_SNDCTL_TMR_START           0x00005402
22692521d698Sbellard #define TARGET_SNDCTL_TMR_STOP            0x00005403
22702521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO           0xc0045405
22712521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE        0xc0045401
22722521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE        0x80045002
22732521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS    0x80045006
22742521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS        0x80045005
22752521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER      0x80045007
22762521d698Sbellard #define TARGET_SOUND_MIXER_INFO           TARGET_IOR ('M', 101, mixer_info)
22772521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS         0xc0804d66
22782521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1       TARGET_IOWR('M', 111, int)
22792521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2       TARGET_IOWR('M', 112, int)
22802521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3       TARGET_IOWR('M', 113, int)
22812521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4       TARGET_IOWR('M', 114, int)
22822521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5       TARGET_IOWR('M', 115, int)
22832521d698Sbellard 
22842521d698Sbellard #define TARGET_MIXER_READ(dev)	TARGET_IOR('M', dev, int)
22852521d698Sbellard 
22862521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME		TARGET_MIXER_READ(SOUND_MIXER_VOLUME)
22872521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS		TARGET_MIXER_READ(SOUND_MIXER_BASS)
22882521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE		TARGET_MIXER_READ(SOUND_MIXER_TREBLE)
22892521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH		TARGET_MIXER_READ(SOUND_MIXER_SYNTH)
22902521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM		TARGET_MIXER_READ(SOUND_MIXER_PCM)
22912521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER	        TARGET_MIXER_READ(SOUND_MIXER_SPEAKER)
22922521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE		TARGET_MIXER_READ(SOUND_MIXER_LINE)
22932521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC		TARGET_MIXER_READ(SOUND_MIXER_MIC)
22942521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD		TARGET_MIXER_READ(SOUND_MIXER_CD)
22952521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX		TARGET_MIXER_READ(SOUND_MIXER_IMIX)
22962521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM		TARGET_MIXER_READ(SOUND_MIXER_ALTPCM)
22972521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV		TARGET_MIXER_READ(SOUND_MIXER_RECLEV)
22982521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN		TARGET_MIXER_READ(SOUND_MIXER_IGAIN)
22992521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN		TARGET_MIXER_READ(SOUND_MIXER_OGAIN)
23002521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1		TARGET_MIXER_READ(SOUND_MIXER_LINE1)
23012521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2		TARGET_MIXER_READ(SOUND_MIXER_LINE2)
23022521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3		TARGET_MIXER_READ(SOUND_MIXER_LINE3)
23032521d698Sbellard 
23042521d698Sbellard /* Obsolete macros */
23052521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE		TARGET_MIXER_READ(SOUND_MIXER_MUTE)
23062521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE	        TARGET_MIXER_READ(SOUND_MIXER_ENHANCE)
23072521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD		TARGET_MIXER_READ(SOUND_MIXER_LOUD)
23082521d698Sbellard 
23092521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC		TARGET_MIXER_READ(SOUND_MIXER_RECSRC)
23102521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK	        TARGET_MIXER_READ(SOUND_MIXER_DEVMASK)
23112521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK	        TARGET_MIXER_READ(SOUND_MIXER_RECMASK)
23122521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS	TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS)
23132521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS		TARGET_MIXER_READ(SOUND_MIXER_CAPS)
23142521d698Sbellard 
23152521d698Sbellard #define TARGET_MIXER_WRITE(dev)		TARGET_IOWR('M', dev, int)
23162521d698Sbellard 
23172521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME	TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME)
23182521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS		TARGET_MIXER_WRITE(SOUND_MIXER_BASS)
23192521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE	TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE)
23202521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH		TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH)
23212521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM		TARGET_MIXER_WRITE(SOUND_MIXER_PCM)
23222521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER	TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER)
23232521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE		TARGET_MIXER_WRITE(SOUND_MIXER_LINE)
23242521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC		TARGET_MIXER_WRITE(SOUND_MIXER_MIC)
23252521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD		TARGET_MIXER_WRITE(SOUND_MIXER_CD)
23262521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX		TARGET_MIXER_WRITE(SOUND_MIXER_IMIX)
23272521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM	TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM)
23282521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV	TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV)
23292521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN		TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN)
23302521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN		TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN)
23312521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1		TARGET_MIXER_WRITE(SOUND_MIXER_LINE1)
23322521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2		TARGET_MIXER_WRITE(SOUND_MIXER_LINE2)
23332521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3		TARGET_MIXER_WRITE(SOUND_MIXER_LINE3)
23342521d698Sbellard 
23352521d698Sbellard /* Obsolete macros */
23362521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE		TARGET_MIXER_WRITE(SOUND_MIXER_MUTE)
23372521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE	TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE)
23382521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD		TARGET_MIXER_WRITE(SOUND_MIXER_LOUD)
23392521d698Sbellard 
23402521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC	TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC)
23412521d698Sbellard 
23422521d698Sbellard /* vfat ioctls */
23432521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH    TARGET_IORU('r', 1)
23442521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT   TARGET_IORU('r', 2)
2345a5448a7dSbellard 
23468fbd6b52Sbalrog #define TARGET_MTIOCTOP        TARGET_IOW('m', 1, struct mtop)
23478fbd6b52Sbalrog #define TARGET_MTIOCGET        TARGET_IOR('m', 2, struct mtget)
23488fbd6b52Sbalrog #define TARGET_MTIOCPOS        TARGET_IOR('m', 3, struct mtpos)
23498fbd6b52Sbalrog 
2350a5448a7dSbellard struct target_sysinfo {
2351992f48a0Sblueswir1     abi_long uptime;                /* Seconds since boot */
2352992f48a0Sblueswir1     abi_ulong loads[3];             /* 1, 5, and 15 minute load averages */
2353992f48a0Sblueswir1     abi_ulong totalram;             /* Total usable main memory size */
2354992f48a0Sblueswir1     abi_ulong freeram;              /* Available memory size */
2355992f48a0Sblueswir1     abi_ulong sharedram;            /* Amount of shared memory */
2356992f48a0Sblueswir1     abi_ulong bufferram;            /* Memory used by buffers */
2357992f48a0Sblueswir1     abi_ulong totalswap;            /* Total swap space size */
2358992f48a0Sblueswir1     abi_ulong freeswap;             /* swap space still available */
2359a5448a7dSbellard     unsigned short procs;           /* Number of current processes */
2360a5448a7dSbellard     unsigned short pad;             /* explicit padding for m68k */
2361992f48a0Sblueswir1     abi_ulong totalhigh;            /* Total high memory size */
2362992f48a0Sblueswir1     abi_ulong freehigh;             /* Available high memory size */
2363a5448a7dSbellard     unsigned int mem_unit;          /* Memory unit size in bytes */
2364992f48a0Sblueswir1     char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */
2365a5448a7dSbellard };
23663532fa74Sbellard 
23676556a833Saurel32 struct linux_dirent {
23686556a833Saurel32     long            d_ino;
23696556a833Saurel32     unsigned long   d_off;
23706556a833Saurel32     unsigned short  d_reclen;
23716556a833Saurel32     char            d_name[256]; /* We must not include limits.h! */
23726556a833Saurel32 };
23736556a833Saurel32 
23746556a833Saurel32 struct linux_dirent64 {
23756556a833Saurel32     uint64_t        d_ino;
23766556a833Saurel32     int64_t         d_off;
23776556a833Saurel32     unsigned short  d_reclen;
23786556a833Saurel32     unsigned char   d_type;
23796556a833Saurel32     char            d_name[256];
23806556a833Saurel32 };
23816556a833Saurel32 
238224e1003aSaurel32 struct target_mq_attr {
238324e1003aSaurel32     abi_long mq_flags;
238424e1003aSaurel32     abi_long mq_maxmsg;
238524e1003aSaurel32     abi_long mq_msgsize;
238624e1003aSaurel32     abi_long mq_curmsgs;
238724e1003aSaurel32 };
238824e1003aSaurel32 
23893532fa74Sbellard #include "socket.h"
2390637947f1Sths 
2391637947f1Sths #include "errno_defs.h"
239203dfe9f8SRiku Voipio 
239303dfe9f8SRiku Voipio #define FUTEX_WAIT              0
239403dfe9f8SRiku Voipio #define FUTEX_WAKE              1
239503dfe9f8SRiku Voipio #define FUTEX_FD                2
239603dfe9f8SRiku Voipio #define FUTEX_REQUEUE           3
239703dfe9f8SRiku Voipio #define FUTEX_CMP_REQUEUE       4
239803dfe9f8SRiku Voipio #define FUTEX_WAKE_OP           5
239903dfe9f8SRiku Voipio #define FUTEX_LOCK_PI           6
240003dfe9f8SRiku Voipio #define FUTEX_UNLOCK_PI         7
240103dfe9f8SRiku Voipio #define FUTEX_TRYLOCK_PI        8
240203dfe9f8SRiku Voipio #define FUTEX_WAIT_BITSET       9
240303dfe9f8SRiku Voipio #define FUTEX_WAKE_BITSET       10
240403dfe9f8SRiku Voipio 
240503dfe9f8SRiku Voipio #define FUTEX_PRIVATE_FLAG      128
240603dfe9f8SRiku Voipio #define FUTEX_CLOCK_REALTIME    256
240703dfe9f8SRiku Voipio #define FUTEX_CMD_MASK          ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)
240803dfe9f8SRiku Voipio 
24093b6edd16SPeter Maydell #ifdef CONFIG_EPOLL
24103b6edd16SPeter Maydell typedef union target_epoll_data {
24113b6edd16SPeter Maydell     abi_ulong ptr;
24123b6edd16SPeter Maydell     abi_ulong fd;
24133b6edd16SPeter Maydell     uint32_t u32;
24143b6edd16SPeter Maydell     uint64_t u64;
24153b6edd16SPeter Maydell } target_epoll_data_t;
24163b6edd16SPeter Maydell 
24173b6edd16SPeter Maydell struct target_epoll_event {
24183b6edd16SPeter Maydell     uint32_t events;
24193b6edd16SPeter Maydell     target_epoll_data_t data;
24203b6edd16SPeter Maydell };
24213b6edd16SPeter Maydell #endif
2422163a05a8SPeter Maydell struct target_rlimit64 {
2423163a05a8SPeter Maydell     uint64_t rlim_cur;
2424163a05a8SPeter Maydell     uint64_t rlim_max;
2425163a05a8SPeter Maydell };
2426583359a6SAkos PASZTORY 
2427583359a6SAkos PASZTORY struct target_ucred {
2428583359a6SAkos PASZTORY     uint32_t pid;
2429583359a6SAkos PASZTORY     uint32_t uid;
2430583359a6SAkos PASZTORY     uint32_t gid;
2431583359a6SAkos PASZTORY };
2432*cb9c377fSPaolo Bonzini 
2433*cb9c377fSPaolo Bonzini #endif
2434