xref: /openbmc/qemu/linux-user/syscall_defs.h (revision 285da2b9a83353703d07e141fdb447e82944146c)
131e31b8aSbellard /* common syscall defines for all architectures */
231e31b8aSbellard 
32521d698Sbellard /* Note: although the syscall numbers change between architectures,
42521d698Sbellard    most of them stay the same, so we handle it by puting ifdefs if
52521d698Sbellard    necessary */
62521d698Sbellard 
76180a181Sbellard #include "syscall_nr.h"
82521d698Sbellard 
931e31b8aSbellard #define SOCKOP_socket           1
1031e31b8aSbellard #define SOCKOP_bind             2
1131e31b8aSbellard #define SOCKOP_connect          3
1231e31b8aSbellard #define SOCKOP_listen           4
1331e31b8aSbellard #define SOCKOP_accept           5
1431e31b8aSbellard #define SOCKOP_getsockname      6
1531e31b8aSbellard #define SOCKOP_getpeername      7
1631e31b8aSbellard #define SOCKOP_socketpair       8
1731e31b8aSbellard #define SOCKOP_send             9
1831e31b8aSbellard #define SOCKOP_recv             10
1931e31b8aSbellard #define SOCKOP_sendto           11
2031e31b8aSbellard #define SOCKOP_recvfrom         12
2131e31b8aSbellard #define SOCKOP_shutdown         13
2231e31b8aSbellard #define SOCKOP_setsockopt       14
2331e31b8aSbellard #define SOCKOP_getsockopt       15
2431e31b8aSbellard #define SOCKOP_sendmsg          16
2531e31b8aSbellard #define SOCKOP_recvmsg          17
2631e31b8aSbellard 
278853f86eSbellard #define IPCOP_semop		1
288853f86eSbellard #define IPCOP_semget		2
298853f86eSbellard #define IPCOP_semctl		3
308853f86eSbellard #define IPCOP_semtimedop	4
318853f86eSbellard #define IPCOP_msgsnd		11
328853f86eSbellard #define IPCOP_msgrcv		12
338853f86eSbellard #define IPCOP_msgget		13
348853f86eSbellard #define IPCOP_msgctl		14
358853f86eSbellard #define IPCOP_shmat		21
368853f86eSbellard #define IPCOP_shmdt		22
378853f86eSbellard #define IPCOP_shmget		23
388853f86eSbellard #define IPCOP_shmctl		24
398853f86eSbellard 
402521d698Sbellard /*
412521d698Sbellard  * The following is for compatibility across the various Linux
422521d698Sbellard  * platforms.  The i386 ioctl numbering scheme doesn't really enforce
432521d698Sbellard  * a type field.  De facto, however, the top 8 bits of the lower 16
442521d698Sbellard  * bits are indeed used as a type field, so we might just as well make
452521d698Sbellard  * this explicit here.  Please be sure to use the decoding macros
462521d698Sbellard  * below from now on.
472521d698Sbellard  */
482521d698Sbellard #define TARGET_IOC_NRBITS	8
492521d698Sbellard #define TARGET_IOC_TYPEBITS	8
502521d698Sbellard 
5174d753acSMika Westerberg #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \
52b2e7aab2SMartin Mohring     || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) || defined(TARGET_PPC) || defined(TARGET_MIPS)
5374d753acSMika Westerberg     /* 16 bit uid wrappers emulation */
5474d753acSMika Westerberg #define USE_UID16
5574d753acSMika Westerberg #endif
5674d753acSMika Westerberg 
57e6e5906bSpbrook #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \
58dccfec67Saurel32     || defined(TARGET_M68K) || defined(TARGET_CRIS)
592521d698Sbellard 
602521d698Sbellard #define TARGET_IOC_SIZEBITS	14
612521d698Sbellard #define TARGET_IOC_DIRBITS	2
622521d698Sbellard 
632521d698Sbellard #define TARGET_IOC_NONE	  0U
642521d698Sbellard #define TARGET_IOC_WRITE  1U
652521d698Sbellard #define TARGET_IOC_READ	  2U
662521d698Sbellard 
67048f6b4dSbellard #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \
68b779e29eSEdgar E. Iglesias       defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \
69b779e29eSEdgar E. Iglesias       defined(TARGET_MIPS)
702521d698Sbellard 
712521d698Sbellard #define TARGET_IOC_SIZEBITS	13
722521d698Sbellard #define TARGET_IOC_DIRBITS	3
732521d698Sbellard 
742521d698Sbellard #define TARGET_IOC_NONE	  1U
752521d698Sbellard #define TARGET_IOC_READ	  2U
762521d698Sbellard #define TARGET_IOC_WRITE  4U
772521d698Sbellard 
782521d698Sbellard #else
792521d698Sbellard #error unsupported CPU
802521d698Sbellard #endif
812521d698Sbellard 
822521d698Sbellard #define TARGET_IOC_NRMASK	((1 << TARGET_IOC_NRBITS)-1)
832521d698Sbellard #define TARGET_IOC_TYPEMASK	((1 << TARGET_IOC_TYPEBITS)-1)
842521d698Sbellard #define TARGET_IOC_SIZEMASK	((1 << TARGET_IOC_SIZEBITS)-1)
852521d698Sbellard #define TARGET_IOC_DIRMASK	((1 << TARGET_IOC_DIRBITS)-1)
862521d698Sbellard 
872521d698Sbellard #define TARGET_IOC_NRSHIFT	0
882521d698Sbellard #define TARGET_IOC_TYPESHIFT	(TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS)
892521d698Sbellard #define TARGET_IOC_SIZESHIFT	(TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS)
902521d698Sbellard #define TARGET_IOC_DIRSHIFT	(TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS)
912521d698Sbellard 
922521d698Sbellard #define TARGET_IOC(dir,type,nr,size) \
932521d698Sbellard 	(((dir)  << TARGET_IOC_DIRSHIFT) | \
942521d698Sbellard 	 ((type) << TARGET_IOC_TYPESHIFT) | \
952521d698Sbellard 	 ((nr)   << TARGET_IOC_NRSHIFT) | \
962521d698Sbellard 	 ((size) << TARGET_IOC_SIZESHIFT))
972521d698Sbellard 
982521d698Sbellard /* used to create numbers */
992521d698Sbellard #define TARGET_IO(type,nr)		TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0)
1002521d698Sbellard #define TARGET_IOR(type,nr,size)	TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size))
1012521d698Sbellard #define TARGET_IOW(type,nr,size)	TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size))
1022521d698Sbellard #define TARGET_IOWR(type,nr,size)	TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size))
1032521d698Sbellard 
1042521d698Sbellard /* the size is automatically computed for these defines */
1052521d698Sbellard #define TARGET_IORU(type,nr)	TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK)
1062521d698Sbellard #define TARGET_IOWU(type,nr)	TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
1072521d698Sbellard #define TARGET_IOWRU(type,nr)	TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
1082521d698Sbellard 
1097854b056Sbellard struct target_sockaddr {
1107854b056Sbellard     uint16_t sa_family;
1117854b056Sbellard     uint8_t sa_data[14];
1127854b056Sbellard };
1137854b056Sbellard 
114b975b83bSLionel Landwerlin struct target_in_addr {
115b975b83bSLionel Landwerlin     uint32_t s_addr; /* big endian */
116b975b83bSLionel Landwerlin };
117b975b83bSLionel Landwerlin 
118b975b83bSLionel Landwerlin struct target_ip_mreq {
119b975b83bSLionel Landwerlin     struct target_in_addr imr_multiaddr;
120b975b83bSLionel Landwerlin     struct target_in_addr imr_address;
121b975b83bSLionel Landwerlin };
122b975b83bSLionel Landwerlin 
123b975b83bSLionel Landwerlin struct target_ip_mreqn {
124b975b83bSLionel Landwerlin     struct target_in_addr imr_multiaddr;
125b975b83bSLionel Landwerlin     struct target_in_addr imr_address;
126b975b83bSLionel Landwerlin     abi_long imr_ifindex;
127b975b83bSLionel Landwerlin };
128b975b83bSLionel Landwerlin 
1296e3cb58fSLionel Landwerlin struct target_ip_mreq_source {
1306e3cb58fSLionel Landwerlin     /* big endian */
1316e3cb58fSLionel Landwerlin     uint32_t imr_multiaddr;
1326e3cb58fSLionel Landwerlin     uint32_t imr_interface;
1336e3cb58fSLionel Landwerlin     uint32_t imr_sourceaddr;
1346e3cb58fSLionel Landwerlin };
1356e3cb58fSLionel Landwerlin 
13631e31b8aSbellard struct target_timeval {
137992f48a0Sblueswir1     abi_long tv_sec;
138992f48a0Sblueswir1     abi_long tv_usec;
13931e31b8aSbellard };
14031e31b8aSbellard 
1411b6b029eSbellard struct target_timespec {
142992f48a0Sblueswir1     abi_long tv_sec;
143992f48a0Sblueswir1     abi_long tv_nsec;
1441b6b029eSbellard };
1451b6b029eSbellard 
14666fb9763Sbellard struct target_itimerval {
14766fb9763Sbellard     struct target_timeval it_interval;
14866fb9763Sbellard     struct target_timeval it_value;
14966fb9763Sbellard };
15066fb9763Sbellard 
151c227f099SAnthony Liguori typedef abi_long target_clock_t;
15232f36bceSbellard 
153c596ed17Sbellard #define TARGET_HZ 100
154c596ed17Sbellard 
15532f36bceSbellard struct target_tms {
156c227f099SAnthony Liguori     target_clock_t tms_utime;
157c227f099SAnthony Liguori     target_clock_t tms_stime;
158c227f099SAnthony Liguori     target_clock_t tms_cutime;
159c227f099SAnthony Liguori     target_clock_t tms_cstime;
16032f36bceSbellard };
16132f36bceSbellard 
1626180a181Sbellard struct target_utimbuf {
163992f48a0Sblueswir1     abi_long actime;
164992f48a0Sblueswir1     abi_long modtime;
1656180a181Sbellard };
1666180a181Sbellard 
167f2674e31Sbellard struct target_sel_arg_struct {
168992f48a0Sblueswir1     abi_long n;
169992f48a0Sblueswir1     abi_long inp, outp, exp;
170992f48a0Sblueswir1     abi_long tvp;
171f2674e31Sbellard };
172f2674e31Sbellard 
17331e31b8aSbellard struct target_iovec {
174992f48a0Sblueswir1     abi_long iov_base;   /* Starting address */
175992f48a0Sblueswir1     abi_long iov_len;   /* Number of bytes */
17631e31b8aSbellard };
17731e31b8aSbellard 
1781a9353d2Sbellard struct target_msghdr {
179992f48a0Sblueswir1     abi_long	 msg_name;	 /* Socket name			*/
1801a9353d2Sbellard     int		 msg_namelen;	 /* Length of name		*/
181992f48a0Sblueswir1     abi_long	 msg_iov;	 /* Data blocks			*/
182992f48a0Sblueswir1     abi_long	 msg_iovlen;	 /* Number of blocks		*/
183992f48a0Sblueswir1     abi_long     msg_control;	 /* Per protocol magic (eg BSD file descriptor passing) */
184992f48a0Sblueswir1     abi_long	 msg_controllen; /* Length of cmsg list */
1851a9353d2Sbellard     unsigned int msg_flags;
1861a9353d2Sbellard };
1871a9353d2Sbellard 
1887854b056Sbellard struct target_cmsghdr {
189992f48a0Sblueswir1     abi_long     cmsg_len;
1907854b056Sbellard     int          cmsg_level;
1917854b056Sbellard     int          cmsg_type;
1927854b056Sbellard };
1937854b056Sbellard 
1947854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1))
1957854b056Sbellard #define TARGET_CMSG_NXTHDR(mhdr, cmsg) __target_cmsg_nxthdr (mhdr, cmsg)
196992f48a0Sblueswir1 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \
197992f48a0Sblueswir1                                & (size_t) ~(sizeof (abi_long) - 1))
1987854b056Sbellard #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \
1997854b056Sbellard                                + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)))
2007854b056Sbellard #define TARGET_CMSG_LEN(len)   (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len))
2017854b056Sbellard 
2027854b056Sbellard static __inline__ struct target_cmsghdr *
2037854b056Sbellard __target_cmsg_nxthdr (struct target_msghdr *__mhdr, struct target_cmsghdr *__cmsg)
2047854b056Sbellard {
2052b8bdefcSths   struct target_cmsghdr *__ptr;
2067854b056Sbellard 
2072b8bdefcSths   __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg
2087854b056Sbellard                                     + TARGET_CMSG_ALIGN (tswapl(__cmsg->cmsg_len)));
2092b8bdefcSths   if ((unsigned long)((char *)(__ptr+1) - (char *)(size_t)tswapl(__mhdr->msg_control))
2102b8bdefcSths       > tswapl(__mhdr->msg_controllen))
2117854b056Sbellard     /* No more entries.  */
2122b8bdefcSths     return (struct target_cmsghdr *)0;
2137854b056Sbellard   return __cmsg;
2147854b056Sbellard }
2157854b056Sbellard 
2167854b056Sbellard 
21731e31b8aSbellard struct  target_rusage {
21831e31b8aSbellard         struct target_timeval ru_utime;        /* user time used */
21931e31b8aSbellard         struct target_timeval ru_stime;        /* system time used */
220992f48a0Sblueswir1         abi_long    ru_maxrss;                 /* maximum resident set size */
221992f48a0Sblueswir1         abi_long    ru_ixrss;                  /* integral shared memory size */
222992f48a0Sblueswir1         abi_long    ru_idrss;                  /* integral unshared data size */
223992f48a0Sblueswir1         abi_long    ru_isrss;                  /* integral unshared stack size */
224992f48a0Sblueswir1         abi_long    ru_minflt;                 /* page reclaims */
225992f48a0Sblueswir1         abi_long    ru_majflt;                 /* page faults */
226992f48a0Sblueswir1         abi_long    ru_nswap;                  /* swaps */
227992f48a0Sblueswir1         abi_long    ru_inblock;                /* block input operations */
228992f48a0Sblueswir1         abi_long    ru_oublock;                /* block output operations */
229992f48a0Sblueswir1         abi_long    ru_msgsnd;                 /* messages sent */
230992f48a0Sblueswir1         abi_long    ru_msgrcv;                 /* messages received */
231992f48a0Sblueswir1         abi_long    ru_nsignals;               /* signals received */
232992f48a0Sblueswir1         abi_long    ru_nvcsw;                  /* voluntary context switches */
233992f48a0Sblueswir1         abi_long    ru_nivcsw;                 /* involuntary " */
23431e31b8aSbellard };
23531e31b8aSbellard 
23631e31b8aSbellard typedef struct {
23731e31b8aSbellard         int     val[2];
238c227f099SAnthony Liguori } kernel_fsid_t;
23931e31b8aSbellard 
24072f03900Sbellard struct kernel_statfs {
24131e31b8aSbellard 	int f_type;
24231e31b8aSbellard 	int f_bsize;
24331e31b8aSbellard 	int f_blocks;
24431e31b8aSbellard 	int f_bfree;
24531e31b8aSbellard 	int f_bavail;
24631e31b8aSbellard 	int f_files;
24731e31b8aSbellard 	int f_ffree;
248c227f099SAnthony Liguori         kernel_fsid_t f_fsid;
24931e31b8aSbellard 	int f_namelen;
25031e31b8aSbellard 	int f_spare[6];
25131e31b8aSbellard };
25231e31b8aSbellard 
253dab2ed99Sbellard struct target_dirent {
254992f48a0Sblueswir1 	abi_long	d_ino;
255992f48a0Sblueswir1 	abi_long	d_off;
256dab2ed99Sbellard 	unsigned short	d_reclen;
257dab2ed99Sbellard 	char		d_name[256]; /* We must not include limits.h! */
258dab2ed99Sbellard };
259dab2ed99Sbellard 
260dab2ed99Sbellard struct target_dirent64 {
261dab2ed99Sbellard 	uint64_t	d_ino;
262dab2ed99Sbellard 	int64_t		d_off;
263dab2ed99Sbellard 	unsigned short	d_reclen;
264dab2ed99Sbellard 	unsigned char	d_type;
265dab2ed99Sbellard 	char		d_name[256];
266dab2ed99Sbellard };
267dab2ed99Sbellard 
268dab2ed99Sbellard 
26931e31b8aSbellard /* mostly generic signal stuff */
270992f48a0Sblueswir1 #define TARGET_SIG_DFL	((abi_long)0)	/* default signal handling */
271992f48a0Sblueswir1 #define TARGET_SIG_IGN	((abi_long)1)	/* ignore signal */
272992f48a0Sblueswir1 #define TARGET_SIG_ERR	((abi_long)-1)	/* error return from signal */
27331e31b8aSbellard 
27431e31b8aSbellard #ifdef TARGET_MIPS
27531e31b8aSbellard #define TARGET_NSIG	   128
27631e31b8aSbellard #else
27731e31b8aSbellard #define TARGET_NSIG	   64
27831e31b8aSbellard #endif
279992f48a0Sblueswir1 #define TARGET_NSIG_BPW	   TARGET_ABI_BITS
28031e31b8aSbellard #define TARGET_NSIG_WORDS  (TARGET_NSIG / TARGET_NSIG_BPW)
28131e31b8aSbellard 
28231e31b8aSbellard typedef struct {
283992f48a0Sblueswir1     abi_ulong sig[TARGET_NSIG_WORDS];
284c227f099SAnthony Liguori } target_sigset_t;
28531e31b8aSbellard 
28666fb9763Sbellard #ifdef BSWAP_NEEDED
287c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
28866fb9763Sbellard {
28966fb9763Sbellard     int i;
29066fb9763Sbellard     for(i = 0;i < TARGET_NSIG_WORDS; i++)
29166fb9763Sbellard         d->sig[i] = tswapl(s->sig[i]);
29266fb9763Sbellard }
29366fb9763Sbellard #else
294c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
29566fb9763Sbellard {
29666fb9763Sbellard     *d = *s;
29766fb9763Sbellard }
29866fb9763Sbellard #endif
29966fb9763Sbellard 
300c227f099SAnthony Liguori static inline void target_siginitset(target_sigset_t *d, abi_ulong set)
30166fb9763Sbellard {
30266fb9763Sbellard     int i;
30366fb9763Sbellard     d->sig[0] = set;
30466fb9763Sbellard     for(i = 1;i < TARGET_NSIG_WORDS; i++)
30566fb9763Sbellard         d->sig[i] = 0;
30666fb9763Sbellard }
30766fb9763Sbellard 
308c227f099SAnthony Liguori void host_to_target_sigset(target_sigset_t *d, const sigset_t *s);
309c227f099SAnthony Liguori void target_to_host_sigset(sigset_t *d, const target_sigset_t *s);
310992f48a0Sblueswir1 void host_to_target_old_sigset(abi_ulong *old_sigset,
31166fb9763Sbellard                                const sigset_t *sigset);
31266fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset,
313992f48a0Sblueswir1                                const abi_ulong *old_sigset);
31466fb9763Sbellard struct target_sigaction;
31566fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act,
31666fb9763Sbellard                  struct target_sigaction *oact);
31766fb9763Sbellard 
318b779e29eSEdgar E. Iglesias #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined (TARGET_SH4) || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) || defined(TARGET_MICROBLAZE)
3192521d698Sbellard 
320048f6b4dSbellard #if defined(TARGET_SPARC)
321048f6b4dSbellard #define TARGET_SA_NOCLDSTOP    8u
322048f6b4dSbellard #define TARGET_SA_NOCLDWAIT    0x100u
323048f6b4dSbellard #define TARGET_SA_SIGINFO      0x200u
324048f6b4dSbellard #define TARGET_SA_ONSTACK      1u
325048f6b4dSbellard #define TARGET_SA_RESTART      2u
326048f6b4dSbellard #define TARGET_SA_NODEFER      0x20u
327048f6b4dSbellard #define TARGET_SA_RESETHAND    4u
328048f6b4dSbellard #elif defined(TARGET_MIPS)
329048f6b4dSbellard #define TARGET_SA_NOCLDSTOP	0x00000001
330048f6b4dSbellard #define TARGET_SA_NOCLDWAIT	0x00010000
331048f6b4dSbellard #define TARGET_SA_SIGINFO	0x00000008
332048f6b4dSbellard #define TARGET_SA_ONSTACK	0x08000000
333048f6b4dSbellard #define TARGET_SA_NODEFER	0x40000000
334048f6b4dSbellard #define TARGET_SA_RESTART	0x10000000
335048f6b4dSbellard #define TARGET_SA_RESETHAND	0x80000000
336d26bc211Sths #if !defined(TARGET_ABI_MIPSN32) && !defined(TARGET_ABI_MIPSN64)
337d26bc211Sths #define TARGET_SA_RESTORER	0x04000000	/* Only for O32 */
338540635baSths #endif
33957f18a95SRichard Henderson #elif defined(TARGET_ALPHA)
34057f18a95SRichard Henderson #define TARGET_SA_ONSTACK	0x00000001
34157f18a95SRichard Henderson #define TARGET_SA_RESTART	0x00000002
34257f18a95SRichard Henderson #define TARGET_SA_NOCLDSTOP	0x00000004
34357f18a95SRichard Henderson #define TARGET_SA_NODEFER	0x00000008
34457f18a95SRichard Henderson #define TARGET_SA_RESETHAND	0x00000010
34557f18a95SRichard Henderson #define TARGET_SA_NOCLDWAIT	0x00000020 /* not supported yet */
34657f18a95SRichard Henderson #define TARGET_SA_SIGINFO	0x00000040
347048f6b4dSbellard #else
3482521d698Sbellard #define TARGET_SA_NOCLDSTOP	0x00000001
3492521d698Sbellard #define TARGET_SA_NOCLDWAIT	0x00000002 /* not supported yet */
3502521d698Sbellard #define TARGET_SA_SIGINFO	0x00000004
3512521d698Sbellard #define TARGET_SA_ONSTACK	0x08000000
3522521d698Sbellard #define TARGET_SA_RESTART	0x10000000
3532521d698Sbellard #define TARGET_SA_NODEFER	0x40000000
3542521d698Sbellard #define TARGET_SA_RESETHAND	0x80000000
3552521d698Sbellard #define TARGET_SA_RESTORER	0x04000000
3566d5e216dSbellard #endif
3576d5e216dSbellard 
3586d5e216dSbellard #if defined(TARGET_SPARC)
3596d5e216dSbellard 
3606d5e216dSbellard #define TARGET_SIGHUP		 1
3616d5e216dSbellard #define TARGET_SIGINT		 2
3626d5e216dSbellard #define TARGET_SIGQUIT		 3
3636d5e216dSbellard #define TARGET_SIGILL		 4
3646d5e216dSbellard #define TARGET_SIGTRAP		 5
3656d5e216dSbellard #define TARGET_SIGABRT		 6
3666d5e216dSbellard #define TARGET_SIGIOT		 6
3676d5e216dSbellard #define TARGET_SIGSTKFLT	 7 /* actually EMT */
3686d5e216dSbellard #define TARGET_SIGFPE		 8
3696d5e216dSbellard #define TARGET_SIGKILL		 9
3706d5e216dSbellard #define TARGET_SIGBUS		10
3716d5e216dSbellard #define TARGET_SIGSEGV		11
3726d5e216dSbellard #define TARGET_SIGSYS		12
3736d5e216dSbellard #define TARGET_SIGPIPE		13
3746d5e216dSbellard #define TARGET_SIGALRM		14
3756d5e216dSbellard #define TARGET_SIGTERM		15
3766d5e216dSbellard #define TARGET_SIGURG		16
3776d5e216dSbellard #define TARGET_SIGSTOP		17
3786d5e216dSbellard #define TARGET_SIGTSTP		18
3796d5e216dSbellard #define TARGET_SIGCONT		19
3806d5e216dSbellard #define TARGET_SIGCHLD		20
3816d5e216dSbellard #define TARGET_SIGTTIN		21
3826d5e216dSbellard #define TARGET_SIGTTOU		22
3836d5e216dSbellard #define TARGET_SIGIO		23
3846d5e216dSbellard #define TARGET_SIGXCPU		24
3856d5e216dSbellard #define TARGET_SIGXFSZ		25
3866d5e216dSbellard #define TARGET_SIGVTALRM	26
3876d5e216dSbellard #define TARGET_SIGPROF		27
3886d5e216dSbellard #define TARGET_SIGWINCH	        28
3896d5e216dSbellard #define TARGET_SIGPWR		29
3906d5e216dSbellard #define TARGET_SIGUSR1		30
3916d5e216dSbellard #define TARGET_SIGUSR2		31
3926d5e216dSbellard #define TARGET_SIGRTMIN         32
3936d5e216dSbellard 
3946d5e216dSbellard #define TARGET_SIG_BLOCK          0x01 /* for blocking signals */
3956d5e216dSbellard #define TARGET_SIG_UNBLOCK        0x02 /* for unblocking signals */
3966d5e216dSbellard #define TARGET_SIG_SETMASK        0x04 /* for setting the signal mask */
3976d5e216dSbellard 
398048f6b4dSbellard #elif defined(TARGET_MIPS)
399048f6b4dSbellard 
400048f6b4dSbellard #define TARGET_SIGHUP		 1	/* Hangup (POSIX).  */
401048f6b4dSbellard #define TARGET_SIGINT		 2	/* Interrupt (ANSI).  */
402048f6b4dSbellard #define TARGET_SIGQUIT		 3	/* Quit (POSIX).  */
403048f6b4dSbellard #define TARGET_SIGILL		 4	/* Illegal instruction (ANSI).  */
404048f6b4dSbellard #define TARGET_SIGTRAP		 5	/* Trace trap (POSIX).  */
405048f6b4dSbellard #define TARGET_SIGIOT		 6	/* IOT trap (4.2 BSD).  */
406048f6b4dSbellard #define TARGET_SIGABRT		 TARGET_SIGIOT	/* Abort (ANSI).  */
407048f6b4dSbellard #define TARGET_SIGEMT		 7
408048f6b4dSbellard #define TARGET_SIGSTKFLT	 7 /* XXX: incorrect */
409048f6b4dSbellard #define TARGET_SIGFPE		 8	/* Floating-point exception (ANSI).  */
410048f6b4dSbellard #define TARGET_SIGKILL		 9	/* Kill, unblockable (POSIX).  */
411048f6b4dSbellard #define TARGET_SIGBUS		10	/* BUS error (4.2 BSD).  */
412048f6b4dSbellard #define TARGET_SIGSEGV		11	/* Segmentation violation (ANSI).  */
413048f6b4dSbellard #define TARGET_SIGSYS		12
414048f6b4dSbellard #define TARGET_SIGPIPE		13	/* Broken pipe (POSIX).  */
415048f6b4dSbellard #define TARGET_SIGALRM		14	/* Alarm clock (POSIX).  */
416048f6b4dSbellard #define TARGET_SIGTERM		15	/* Termination (ANSI).  */
417048f6b4dSbellard #define TARGET_SIGUSR1		16	/* User-defined signal 1 (POSIX).  */
418048f6b4dSbellard #define TARGET_SIGUSR2		17	/* User-defined signal 2 (POSIX).  */
419048f6b4dSbellard #define TARGET_SIGCHLD		18	/* Child status has changed (POSIX).  */
420048f6b4dSbellard #define TARGET_SIGCLD		TARGET_SIGCHLD	/* Same as TARGET_SIGCHLD (System V).  */
421048f6b4dSbellard #define TARGET_SIGPWR		19	/* Power failure restart (System V).  */
422048f6b4dSbellard #define TARGET_SIGWINCH	20	/* Window size change (4.3 BSD, Sun).  */
423048f6b4dSbellard #define TARGET_SIGURG		21	/* Urgent condition on socket (4.2 BSD).  */
424048f6b4dSbellard #define TARGET_SIGIO		22	/* I/O now possible (4.2 BSD).  */
425048f6b4dSbellard #define TARGET_SIGPOLL		TARGET_SIGIO	/* Pollable event occurred (System V).  */
426048f6b4dSbellard #define TARGET_SIGSTOP		23	/* Stop, unblockable (POSIX).  */
427048f6b4dSbellard #define TARGET_SIGTSTP		24	/* Keyboard stop (POSIX).  */
428048f6b4dSbellard #define TARGET_SIGCONT		25	/* Continue (POSIX).  */
429048f6b4dSbellard #define TARGET_SIGTTIN		26	/* Background read from tty (POSIX).  */
430048f6b4dSbellard #define TARGET_SIGTTOU		27	/* Background write to tty (POSIX).  */
431048f6b4dSbellard #define TARGET_SIGVTALRM	28	/* Virtual alarm clock (4.2 BSD).  */
432048f6b4dSbellard #define TARGET_SIGPROF		29	/* Profiling alarm clock (4.2 BSD).  */
433048f6b4dSbellard #define TARGET_SIGXCPU		30	/* CPU limit exceeded (4.2 BSD).  */
434048f6b4dSbellard #define TARGET_SIGXFSZ		31	/* File size limit exceeded (4.2 BSD).  */
435048f6b4dSbellard #define TARGET_SIGRTMIN         32
436048f6b4dSbellard 
437048f6b4dSbellard #define TARGET_SIG_BLOCK	1	/* for blocking signals */
438048f6b4dSbellard #define TARGET_SIG_UNBLOCK	2	/* for unblocking signals */
439048f6b4dSbellard #define TARGET_SIG_SETMASK	3	/* for setting the signal mask */
440048f6b4dSbellard 
4416d5e216dSbellard #else
4422521d698Sbellard 
4432521d698Sbellard #define TARGET_SIGHUP		 1
4442521d698Sbellard #define TARGET_SIGINT		 2
4452521d698Sbellard #define TARGET_SIGQUIT		 3
4462521d698Sbellard #define TARGET_SIGILL		 4
4472521d698Sbellard #define TARGET_SIGTRAP		 5
4482521d698Sbellard #define TARGET_SIGABRT		 6
4492521d698Sbellard #define TARGET_SIGIOT		 6
4502521d698Sbellard #define TARGET_SIGBUS		 7
4512521d698Sbellard #define TARGET_SIGFPE		 8
4522521d698Sbellard #define TARGET_SIGKILL		 9
4532521d698Sbellard #define TARGET_SIGUSR1		10
4542521d698Sbellard #define TARGET_SIGSEGV		11
4552521d698Sbellard #define TARGET_SIGUSR2		12
4562521d698Sbellard #define TARGET_SIGPIPE		13
4572521d698Sbellard #define TARGET_SIGALRM		14
4582521d698Sbellard #define TARGET_SIGTERM		15
4592521d698Sbellard #define TARGET_SIGSTKFLT	16
4602521d698Sbellard #define TARGET_SIGCHLD		17
4612521d698Sbellard #define TARGET_SIGCONT		18
4622521d698Sbellard #define TARGET_SIGSTOP		19
4632521d698Sbellard #define TARGET_SIGTSTP		20
4642521d698Sbellard #define TARGET_SIGTTIN		21
4652521d698Sbellard #define TARGET_SIGTTOU		22
4662521d698Sbellard #define TARGET_SIGURG		23
4672521d698Sbellard #define TARGET_SIGXCPU		24
4682521d698Sbellard #define TARGET_SIGXFSZ		25
4692521d698Sbellard #define TARGET_SIGVTALRM	26
4702521d698Sbellard #define TARGET_SIGPROF		27
4712521d698Sbellard #define TARGET_SIGWINCH	        28
4722521d698Sbellard #define TARGET_SIGIO		29
473c596ed17Sbellard #define TARGET_SIGPWR		30
474c596ed17Sbellard #define TARGET_SIGSYS		31
4752521d698Sbellard #define TARGET_SIGRTMIN         32
4762521d698Sbellard 
4772521d698Sbellard #define TARGET_SIG_BLOCK          0    /* for blocking signals */
4782521d698Sbellard #define TARGET_SIG_UNBLOCK        1    /* for unblocking signals */
4792521d698Sbellard #define TARGET_SIG_SETMASK        2    /* for setting the signal mask */
4802521d698Sbellard 
4816d5e216dSbellard #endif
4826d5e216dSbellard 
4836049f4f8SRichard Henderson #if defined(TARGET_ALPHA)
4846049f4f8SRichard Henderson struct target_old_sigaction {
4856049f4f8SRichard Henderson     abi_ulong _sa_handler;
4866049f4f8SRichard Henderson     abi_ulong sa_mask;
4876049f4f8SRichard Henderson     abi_ulong sa_flags;
4886049f4f8SRichard Henderson };
489106ec879Sbellard 
4906049f4f8SRichard Henderson struct target_rt_sigaction {
4916049f4f8SRichard Henderson     abi_ulong _sa_handler;
4926049f4f8SRichard Henderson     abi_ulong sa_flags;
4936049f4f8SRichard Henderson     target_sigset_t sa_mask;
4946049f4f8SRichard Henderson };
4956049f4f8SRichard Henderson 
4966049f4f8SRichard Henderson /* This is the struct used inside the kernel.  The ka_restorer
4976049f4f8SRichard Henderson    field comes from the 5th argument to sys_rt_sigaction.  */
4986049f4f8SRichard Henderson struct target_sigaction {
4996049f4f8SRichard Henderson     abi_ulong _sa_handler;
5006049f4f8SRichard Henderson     abi_ulong sa_flags;
5016049f4f8SRichard Henderson     target_sigset_t sa_mask;
5026049f4f8SRichard Henderson     abi_ulong sa_restorer;
5036049f4f8SRichard Henderson };
5046049f4f8SRichard Henderson #elif defined(TARGET_MIPS)
505106ec879Sbellard struct target_sigaction {
506540635baSths 	uint32_t	sa_flags;
507d26bc211Sths #if defined(TARGET_ABI_MIPSN32)
508540635baSths 	uint32_t	_sa_handler;
509540635baSths #else
510992f48a0Sblueswir1 	abi_ulong	_sa_handler;
511540635baSths #endif
512c227f099SAnthony Liguori 	target_sigset_t	sa_mask;
513106ec879Sbellard };
514106ec879Sbellard #else
5152521d698Sbellard struct target_old_sigaction {
516992f48a0Sblueswir1         abi_ulong _sa_handler;
517992f48a0Sblueswir1         abi_ulong sa_mask;
518992f48a0Sblueswir1         abi_ulong sa_flags;
519992f48a0Sblueswir1         abi_ulong sa_restorer;
5202521d698Sbellard };
5212521d698Sbellard 
5222521d698Sbellard struct target_sigaction {
523992f48a0Sblueswir1         abi_ulong _sa_handler;
524992f48a0Sblueswir1         abi_ulong sa_flags;
525992f48a0Sblueswir1         abi_ulong sa_restorer;
526c227f099SAnthony Liguori         target_sigset_t sa_mask;
5272521d698Sbellard };
528106ec879Sbellard #endif
5292521d698Sbellard 
5302521d698Sbellard typedef union target_sigval {
5312521d698Sbellard 	int sival_int;
532992f48a0Sblueswir1         abi_ulong sival_ptr;
533c227f099SAnthony Liguori } target_sigval_t;
5346d5e216dSbellard #if 0
5356d5e216dSbellard #if defined (TARGET_SPARC)
5366d5e216dSbellard typedef struct {
5376d5e216dSbellard 	struct {
538992f48a0Sblueswir1 		abi_ulong psr;
539992f48a0Sblueswir1 		abi_ulong pc;
540992f48a0Sblueswir1 		abi_ulong npc;
541992f48a0Sblueswir1 		abi_ulong y;
542992f48a0Sblueswir1 		abi_ulong u_regs[16]; /* globals and ins */
5436d5e216dSbellard 	}		si_regs;
5446d5e216dSbellard 	int		si_mask;
5456d5e216dSbellard } __siginfo_t;
5466d5e216dSbellard 
5476d5e216dSbellard typedef struct {
5486d5e216dSbellard 	unsigned   long si_float_regs [32];
5496d5e216dSbellard 	unsigned   long si_fsr;
5506d5e216dSbellard 	unsigned   long si_fpqdepth;
5516d5e216dSbellard 	struct {
5526d5e216dSbellard 		unsigned long *insn_addr;
5536d5e216dSbellard 		unsigned long insn;
5546d5e216dSbellard 	} si_fpqueue [16];
5556d5e216dSbellard } __siginfo_fpu_t;
5566d5e216dSbellard #endif
5576d5e216dSbellard #endif
5582521d698Sbellard 
5592521d698Sbellard #define TARGET_SI_MAX_SIZE	128
5602521d698Sbellard #define TARGET_SI_PAD_SIZE	((TARGET_SI_MAX_SIZE/sizeof(int)) - 3)
5612521d698Sbellard 
5622521d698Sbellard typedef struct target_siginfo {
5633f53d546Spbrook #ifdef TARGET_MIPS
5643f53d546Spbrook 	int si_signo;
5653f53d546Spbrook 	int si_code;
5663f53d546Spbrook 	int si_errno;
5673f53d546Spbrook #else
5682521d698Sbellard 	int si_signo;
5692521d698Sbellard 	int si_errno;
5702521d698Sbellard 	int si_code;
5713f53d546Spbrook #endif
5722521d698Sbellard 
5732521d698Sbellard 	union {
5742521d698Sbellard 		int _pad[TARGET_SI_PAD_SIZE];
5752521d698Sbellard 
5762521d698Sbellard 		/* kill() */
5772521d698Sbellard 		struct {
5782521d698Sbellard 			pid_t _pid;		/* sender's pid */
5792521d698Sbellard 			uid_t _uid;		/* sender's uid */
5802521d698Sbellard 		} _kill;
5812521d698Sbellard 
5822521d698Sbellard 		/* POSIX.1b timers */
5832521d698Sbellard 		struct {
5842521d698Sbellard 			unsigned int _timer1;
5852521d698Sbellard 			unsigned int _timer2;
5862521d698Sbellard 		} _timer;
5872521d698Sbellard 
5882521d698Sbellard 		/* POSIX.1b signals */
5892521d698Sbellard 		struct {
5902521d698Sbellard 			pid_t _pid;		/* sender's pid */
5912521d698Sbellard 			uid_t _uid;		/* sender's uid */
592c227f099SAnthony Liguori 			target_sigval_t _sigval;
5932521d698Sbellard 		} _rt;
5942521d698Sbellard 
5952521d698Sbellard 		/* SIGCHLD */
5962521d698Sbellard 		struct {
5972521d698Sbellard 			pid_t _pid;		/* which child */
5982521d698Sbellard 			uid_t _uid;		/* sender's uid */
5992521d698Sbellard 			int _status;		/* exit code */
600c227f099SAnthony Liguori 			target_clock_t _utime;
601c227f099SAnthony Liguori                         target_clock_t _stime;
6022521d698Sbellard 		} _sigchld;
6032521d698Sbellard 
6042521d698Sbellard 		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
6052521d698Sbellard 		struct {
606992f48a0Sblueswir1 			abi_ulong _addr; /* faulting insn/memory ref. */
6072521d698Sbellard 		} _sigfault;
6082521d698Sbellard 
6092521d698Sbellard 		/* SIGPOLL */
6102521d698Sbellard 		struct {
6112521d698Sbellard 			int _band;	/* POLL_IN, POLL_OUT, POLL_MSG */
6122521d698Sbellard 			int _fd;
6132521d698Sbellard 		} _sigpoll;
6142521d698Sbellard 	} _sifields;
615c227f099SAnthony Liguori } target_siginfo_t;
6162521d698Sbellard 
6172521d698Sbellard /*
6182521d698Sbellard  * si_code values
6192521d698Sbellard  * Digital reserves positive values for kernel-generated signals.
6202521d698Sbellard  */
6212521d698Sbellard #define TARGET_SI_USER		0	/* sent by kill, sigsend, raise */
6222521d698Sbellard #define TARGET_SI_KERNEL	0x80	/* sent by the kernel from somewhere */
6232521d698Sbellard #define TARGET_SI_QUEUE	-1		/* sent by sigqueue */
6242521d698Sbellard #define TARGET_SI_TIMER -2              /* sent by timer expiration */
6252521d698Sbellard #define TARGET_SI_MESGQ	-3		/* sent by real time mesq state change */
6262521d698Sbellard #define TARGET_SI_ASYNCIO	-4	/* sent by AIO completion */
6272521d698Sbellard #define TARGET_SI_SIGIO	-5		/* sent by queued SIGIO */
6282521d698Sbellard 
6292521d698Sbellard /*
6302521d698Sbellard  * SIGILL si_codes
6312521d698Sbellard  */
632ffa65c3bSbellard #define TARGET_ILL_ILLOPC	(1)	/* illegal opcode */
6332521d698Sbellard #define TARGET_ILL_ILLOPN	(2)	/* illegal operand */
634ffa65c3bSbellard #define TARGET_ILL_ILLADR	(3)	/* illegal addressing mode */
635ffa65c3bSbellard #define TARGET_ILL_ILLTRP	(4)	/* illegal trap */
636ffa65c3bSbellard #define TARGET_ILL_PRVOPC	(5)	/* privileged opcode */
637ffa65c3bSbellard #define TARGET_ILL_PRVREG	(6)	/* privileged register */
638ffa65c3bSbellard #define TARGET_ILL_COPROC	(7)	/* coprocessor error */
639ffa65c3bSbellard #define TARGET_ILL_BADSTK	(8)	/* internal stack error */
6402521d698Sbellard 
6412521d698Sbellard /*
6422521d698Sbellard  * SIGFPE si_codes
6432521d698Sbellard  */
6442521d698Sbellard #define TARGET_FPE_INTDIV      (1)  /* integer divide by zero */
6452521d698Sbellard #define TARGET_FPE_INTOVF      (2)  /* integer overflow */
6462521d698Sbellard #define TARGET_FPE_FLTDIV      (3)  /* floating point divide by zero */
6472521d698Sbellard #define TARGET_FPE_FLTOVF      (4)  /* floating point overflow */
6482521d698Sbellard #define TARGET_FPE_FLTUND      (5)  /* floating point underflow */
6492521d698Sbellard #define TARGET_FPE_FLTRES      (6)  /* floating point inexact result */
6502521d698Sbellard #define TARGET_FPE_FLTINV      (7)  /* floating point invalid operation */
6512521d698Sbellard #define TARGET_FPE_FLTSUB      (8)  /* subscript out of range */
6522521d698Sbellard #define TARGET_NSIGFPE         8
6532521d698Sbellard 
6542521d698Sbellard /*
6552521d698Sbellard  * SIGSEGV si_codes
6562521d698Sbellard  */
6572521d698Sbellard #define TARGET_SEGV_MAPERR     (1)  /* address not mapped to object */
6582521d698Sbellard #define TARGET_SEGV_ACCERR     (2)  /* invalid permissions for mapped object */
6592521d698Sbellard 
6602521d698Sbellard /*
661ffa65c3bSbellard  * SIGBUS si_codes
662ffa65c3bSbellard  */
663ffa65c3bSbellard #define TARGET_BUS_ADRALN       (1)	/* invalid address alignment */
664ffa65c3bSbellard #define TARGET_BUS_ADRERR       (2)	/* non-existant physical address */
665ffa65c3bSbellard #define TARGET_BUS_OBJERR       (3)	/* object specific hardware error */
666ffa65c3bSbellard 
667ffa65c3bSbellard /*
6682521d698Sbellard  * SIGTRAP si_codes
6692521d698Sbellard  */
6702521d698Sbellard #define TARGET_TRAP_BRKPT	(1)	/* process breakpoint */
6712521d698Sbellard #define TARGET_TRAP_TRACE	(2)	/* process trace trap */
6722521d698Sbellard 
6732521d698Sbellard #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */
6742521d698Sbellard 
6759de5e440Sbellard struct target_rlimit {
676992f48a0Sblueswir1         abi_ulong   rlim_cur;
677992f48a0Sblueswir1         abi_ulong   rlim_max;
6789de5e440Sbellard };
6799de5e440Sbellard 
68081bbe906Stakasi-y@ops.dti.ne.jp #if defined(TARGET_ALPHA)
681e476492eSAurelien Jarno #define TARGET_RLIM_INFINITY	0x7fffffffffffffffull
68281bbe906Stakasi-y@ops.dti.ne.jp #elif defined(TARGET_MIPS) || defined(TARGET_SPARC)
68381bbe906Stakasi-y@ops.dti.ne.jp #define TARGET_RLIM_INFINITY	0x7fffffffUL
68481bbe906Stakasi-y@ops.dti.ne.jp #else
68581bbe906Stakasi-y@ops.dti.ne.jp #define TARGET_RLIM_INFINITY	((target_ulong)~0UL)
68681bbe906Stakasi-y@ops.dti.ne.jp #endif
68781bbe906Stakasi-y@ops.dti.ne.jp 
6889de5e440Sbellard struct target_pollfd {
6899de5e440Sbellard     int fd;           /* file descriptor */
6909de5e440Sbellard     short events;     /* requested events */
6919de5e440Sbellard     short revents;    /* returned events */
6929de5e440Sbellard };
6939de5e440Sbellard 
6948e5a0667Sbellard /* virtual terminal ioctls */
6950221cfcdSbellard #define TARGET_KIOCSOUND       0x4B2F	/* start sound generation (0 for off) */
6960221cfcdSbellard #define TARGET_KDMKTONE	       0x4B30	/* generate tone */
6978e5a0667Sbellard #define TARGET_KDGKBTYPE       0x4b33
698f7680a55SUlrich Hecht #define TARGET_KDSETMODE       0x4b3a
699f7680a55SUlrich Hecht #define TARGET_KDGKBMODE       0x4b44
700f7680a55SUlrich Hecht #define TARGET_KDSKBMODE       0x4b45
7010221cfcdSbellard #define TARGET_KDGKBENT	       0x4B46	/* gets one entry in translation table */
7020221cfcdSbellard #define TARGET_KDGKBSENT       0x4B48	/* gets one function key string entry */
7038e5a0667Sbellard 
7042521d698Sbellard #define TARGET_SIOCATMARK      0x8905
7052521d698Sbellard 
70631e31b8aSbellard /* Networking ioctls */
70731e31b8aSbellard #define TARGET_SIOCADDRT       0x890B          /* add routing table entry */
70831e31b8aSbellard #define TARGET_SIOCDELRT       0x890C          /* delete routing table entry */
70931e31b8aSbellard #define TARGET_SIOCGIFNAME     0x8910          /* get iface name               */
71031e31b8aSbellard #define TARGET_SIOCSIFLINK     0x8911          /* set iface channel            */
71131e31b8aSbellard #define TARGET_SIOCGIFCONF     0x8912          /* get iface list               */
71231e31b8aSbellard #define TARGET_SIOCGIFFLAGS    0x8913          /* get flags                    */
71331e31b8aSbellard #define TARGET_SIOCSIFFLAGS    0x8914          /* set flags                    */
71431e31b8aSbellard #define TARGET_SIOCGIFADDR     0x8915          /* get PA address               */
71531e31b8aSbellard #define TARGET_SIOCSIFADDR     0x8916          /* set PA address               */
71631e31b8aSbellard #define TARGET_SIOCGIFDSTADDR  0x8917          /* get remote PA address        */
71731e31b8aSbellard #define TARGET_SIOCSIFDSTADDR  0x8918          /* set remote PA address        */
71831e31b8aSbellard #define TARGET_SIOCGIFBRDADDR  0x8919          /* get broadcast PA address     */
71931e31b8aSbellard #define TARGET_SIOCSIFBRDADDR  0x891a          /* set broadcast PA address     */
72031e31b8aSbellard #define TARGET_SIOCGIFNETMASK  0x891b          /* get network PA mask          */
72131e31b8aSbellard #define TARGET_SIOCSIFNETMASK  0x891c          /* set network PA mask          */
72231e31b8aSbellard #define TARGET_SIOCGIFMETRIC   0x891d          /* get metric                   */
72331e31b8aSbellard #define TARGET_SIOCSIFMETRIC   0x891e          /* set metric                   */
72431e31b8aSbellard #define TARGET_SIOCGIFMEM      0x891f          /* get memory address (BSD)     */
72531e31b8aSbellard #define TARGET_SIOCSIFMEM      0x8920          /* set memory address (BSD)     */
72631e31b8aSbellard #define TARGET_SIOCGIFMTU      0x8921          /* get MTU size                 */
72731e31b8aSbellard #define TARGET_SIOCSIFMTU      0x8922          /* set MTU size                 */
72831e31b8aSbellard #define TARGET_SIOCSIFHWADDR   0x8924          /* set hardware address (NI)    */
72931e31b8aSbellard #define TARGET_SIOCGIFENCAP    0x8925          /* get/set slip encapsulation   */
73031e31b8aSbellard #define TARGET_SIOCSIFENCAP    0x8926
73131e31b8aSbellard #define TARGET_SIOCGIFHWADDR   0x8927          /* Get hardware address         */
73231e31b8aSbellard #define TARGET_SIOCGIFSLAVE    0x8929          /* Driver slaving support       */
73331e31b8aSbellard #define TARGET_SIOCSIFSLAVE    0x8930
73431e31b8aSbellard #define TARGET_SIOCADDMULTI    0x8931          /* Multicast address lists      */
73531e31b8aSbellard #define TARGET_SIOCDELMULTI    0x8932
73631e31b8aSbellard 
73731e31b8aSbellard /* Bridging control calls */
73831e31b8aSbellard #define TARGET_SIOCGIFBR       0x8940          /* Bridging support             */
73931e31b8aSbellard #define TARGET_SIOCSIFBR       0x8941          /* Set bridging options         */
74031e31b8aSbellard 
74131e31b8aSbellard #define TARGET_SIOCGIFTXQLEN   0x8942          /* Get the tx queue length      */
74231e31b8aSbellard #define TARGET_SIOCSIFTXQLEN   0x8943          /* Set the tx queue length      */
74331e31b8aSbellard 
74431e31b8aSbellard /* ARP cache control calls. */
74531e31b8aSbellard #define TARGET_OLD_SIOCDARP    0x8950          /* old delete ARP table entry   */
74631e31b8aSbellard #define TARGET_OLD_SIOCGARP    0x8951          /* old get ARP table entry      */
74731e31b8aSbellard #define TARGET_OLD_SIOCSARP    0x8952          /* old set ARP table entry      */
74831e31b8aSbellard #define TARGET_SIOCDARP        0x8953          /* delete ARP table entry       */
74931e31b8aSbellard #define TARGET_SIOCGARP        0x8954          /* get ARP table entry          */
75031e31b8aSbellard #define TARGET_SIOCSARP        0x8955          /* set ARP table entry          */
75131e31b8aSbellard 
75231e31b8aSbellard /* RARP cache control calls. */
75331e31b8aSbellard #define TARGET_SIOCDRARP       0x8960          /* delete RARP table entry      */
75431e31b8aSbellard #define TARGET_SIOCGRARP       0x8961          /* get RARP table entry         */
75531e31b8aSbellard #define TARGET_SIOCSRARP       0x8962          /* set RARP table entry         */
75631e31b8aSbellard 
75731e31b8aSbellard /* Driver configuration calls */
75831e31b8aSbellard #define TARGET_SIOCGIFMAP      0x8970          /* Get device parameters        */
75931e31b8aSbellard #define TARGET_SIOCSIFMAP      0x8971          /* Set device parameters        */
76031e31b8aSbellard 
76131e31b8aSbellard /* DLCI configuration calls */
76231e31b8aSbellard #define TARGET_SIOCADDDLCI     0x8980          /* Create new DLCI device       */
76331e31b8aSbellard #define TARGET_SIOCDELDLCI     0x8981          /* Delete DLCI device           */
76431e31b8aSbellard 
76531e31b8aSbellard 
76631e31b8aSbellard /* From <linux/fs.h> */
76731e31b8aSbellard 
76831e31b8aSbellard #define TARGET_BLKROSET   TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */
76931e31b8aSbellard #define TARGET_BLKROGET   TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */
77031e31b8aSbellard #define TARGET_BLKRRPART  TARGET_IO(0x12,95) /* re-read partition table */
77131e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */
77231e31b8aSbellard #define TARGET_BLKFLSBUF  TARGET_IO(0x12,97) /* flush buffer cache */
77331e31b8aSbellard #define TARGET_BLKRASET   TARGET_IO(0x12,98) /* Set read ahead for block device */
77431e31b8aSbellard #define TARGET_BLKRAGET   TARGET_IO(0x12,99) /* get current read ahead setting */
77531e31b8aSbellard #define TARGET_BLKFRASET  TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
77631e31b8aSbellard #define TARGET_BLKFRAGET  TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
77731e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
77831e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
77931e31b8aSbellard #define TARGET_BLKSSZGET  TARGET_IO(0x12,104)/* get block device sector size */
78031e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */
78131e31b8aSbellard #define TARGET_BLKBSZGET  TARGET_IOR(0x12,112,sizeof(int))
78231e31b8aSbellard #define TARGET_BLKBSZSET  TARGET_IOW(0x12,113,sizeof(int))
78331e31b8aSbellard #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,sizeof(uint64_t)) /* return device size in bytes (u64 *arg) */
78431e31b8aSbellard #define TARGET_FIBMAP     TARGET_IO(0x00,1)  /* bmap access */
78531e31b8aSbellard #define TARGET_FIGETBSZ   TARGET_IO(0x00,2)  /* get the block size used for bmap */
786*285da2b9SPeter Maydell #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap)
78731e31b8aSbellard 
78831e31b8aSbellard /* cdrom commands */
78931e31b8aSbellard #define TARGET_CDROMPAUSE		0x5301 /* Pause Audio Operation */
79031e31b8aSbellard #define TARGET_CDROMRESUME		0x5302 /* Resume paused Audio Operation */
79131e31b8aSbellard #define TARGET_CDROMPLAYMSF		0x5303 /* Play Audio MSF (struct cdrom_msf) */
79231e31b8aSbellard #define TARGET_CDROMPLAYTRKIND		0x5304 /* Play Audio Track/index
79331e31b8aSbellard                                            (struct cdrom_ti) */
79431e31b8aSbellard #define TARGET_CDROMREADTOCHDR		0x5305 /* Read TOC header
79531e31b8aSbellard                                            (struct cdrom_tochdr) */
79631e31b8aSbellard #define TARGET_CDROMREADTOCENTRY	0x5306 /* Read TOC entry
79731e31b8aSbellard                                            (struct cdrom_tocentry) */
79831e31b8aSbellard #define TARGET_CDROMSTOP		0x5307 /* Stop the cdrom drive */
79931e31b8aSbellard #define TARGET_CDROMSTART		0x5308 /* Start the cdrom drive */
80031e31b8aSbellard #define TARGET_CDROMEJECT		0x5309 /* Ejects the cdrom media */
80131e31b8aSbellard #define TARGET_CDROMVOLCTRL		0x530a /* Control output volume
80231e31b8aSbellard                                            (struct cdrom_volctrl) */
80331e31b8aSbellard #define TARGET_CDROMSUBCHNL		0x530b /* Read subchannel data
80431e31b8aSbellard                                            (struct cdrom_subchnl) */
80531e31b8aSbellard #define TARGET_CDROMREADMODE2		0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes)
80631e31b8aSbellard                                            (struct cdrom_read) */
80731e31b8aSbellard #define TARGET_CDROMREADMODE1		0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes)
80831e31b8aSbellard                                            (struct cdrom_read) */
80931e31b8aSbellard #define TARGET_CDROMREADAUDIO		0x530e /* (struct cdrom_read_audio) */
81031e31b8aSbellard #define TARGET_CDROMEJECT_SW		0x530f /* enable(1)/disable(0) auto-ejecting */
81131e31b8aSbellard #define TARGET_CDROMMULTISESSION	0x5310 /* Obtain the start-of-last-session
81231e31b8aSbellard                                            address of multi session disks
81331e31b8aSbellard                                            (struct cdrom_multisession) */
81431e31b8aSbellard #define TARGET_CDROM_GET_MCN		0x5311 /* Obtain the "Universal Product Code"
81531e31b8aSbellard                                            if available (struct cdrom_mcn) */
81631e31b8aSbellard #define TARGET_CDROM_GET_UPC		TARGET_CDROM_GET_MCN  /* This one is depricated,
81731e31b8aSbellard                                           but here anyway for compatability */
81831e31b8aSbellard #define TARGET_CDROMRESET		0x5312 /* hard-reset the drive */
81931e31b8aSbellard #define TARGET_CDROMVOLREAD		0x5313 /* Get the drive's volume setting
82031e31b8aSbellard                                           (struct cdrom_volctrl) */
82131e31b8aSbellard #define TARGET_CDROMREADRAW		0x5314	/* read data in raw mode (2352 Bytes)
82231e31b8aSbellard                                            (struct cdrom_read) */
82331e31b8aSbellard /*
82431e31b8aSbellard  * These ioctls are used only used in aztcd.c and optcd.c
82531e31b8aSbellard  */
82631e31b8aSbellard #define TARGET_CDROMREADCOOKED		0x5315	/* read data in cooked mode */
82731e31b8aSbellard #define TARGET_CDROMSEEK		0x5316  /* seek msf address */
82831e31b8aSbellard 
82931e31b8aSbellard /*
83031e31b8aSbellard  * This ioctl is only used by the scsi-cd driver.
83131e31b8aSbellard    It is for playing audio in logical block addressing mode.
83231e31b8aSbellard  */
83331e31b8aSbellard #define TARGET_CDROMPLAYBLK		0x5317	/* (struct cdrom_blk) */
83431e31b8aSbellard 
83531e31b8aSbellard /*
83631e31b8aSbellard  * These ioctls are only used in optcd.c
83731e31b8aSbellard  */
83831e31b8aSbellard #define TARGET_CDROMREADALL		0x5318	/* read all 2646 bytes */
83931e31b8aSbellard 
84031e31b8aSbellard /*
84131e31b8aSbellard  * These ioctls are (now) only in ide-cd.c for controlling
84231e31b8aSbellard  * drive spindown time.  They should be implemented in the
84331e31b8aSbellard  * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10,
84431e31b8aSbellard  * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE...
84531e31b8aSbellard  *  -Erik
84631e31b8aSbellard  */
84731e31b8aSbellard #define TARGET_CDROMGETSPINDOWN        0x531d
84831e31b8aSbellard #define TARGET_CDROMSETSPINDOWN        0x531e
84931e31b8aSbellard 
85031e31b8aSbellard /*
85131e31b8aSbellard  * These ioctls are implemented through the uniform CD-ROM driver
85231e31b8aSbellard  * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM
85331e31b8aSbellard  * drivers are eventually ported to the uniform CD-ROM driver interface.
85431e31b8aSbellard  */
85531e31b8aSbellard #define TARGET_CDROMCLOSETRAY		0x5319	/* pendant of CDROMEJECT */
85631e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS	0x5320  /* Set behavior options */
85731e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS	0x5321  /* Clear behavior options */
85831e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED	0x5322  /* Set the CD-ROM speed */
85931e31b8aSbellard #define TARGET_CDROM_SELECT_DISC	0x5323  /* Select disc (for juke-boxes) */
86031e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED	0x5325  /* Check is media changed  */
86131e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS	0x5326  /* Get tray position, etc. */
86231e31b8aSbellard #define TARGET_CDROM_DISC_STATUS	0x5327  /* Get disc type, etc. */
86331e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS    0x5328  /* Get number of slots */
86431e31b8aSbellard #define TARGET_CDROM_LOCKDOOR		0x5329  /* lock or unlock door */
86531e31b8aSbellard #define TARGET_CDROM_DEBUG		0x5330	/* Turn debug messages on/off */
86631e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY	0x5331	/* get capabilities */
86731e31b8aSbellard 
86831e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386.
86931e31b8aSbellard  * Future CDROM ioctls should be kept below 0x537F
87031e31b8aSbellard  */
87131e31b8aSbellard 
87231e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */
87331e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ        0x5382	/* set the audio buffer size */
87431e31b8aSbellard 					/* conflict with SCSI_IOCTL_GET_IDLUN */
87531e31b8aSbellard 
87631e31b8aSbellard /* DVD-ROM Specific ioctls */
87731e31b8aSbellard #define TARGET_DVD_READ_STRUCT		0x5390  /* Read structure */
87831e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT	0x5391  /* Write structure */
87931e31b8aSbellard #define TARGET_DVD_AUTH		0x5392  /* Authentication */
88031e31b8aSbellard 
88131e31b8aSbellard #define TARGET_CDROM_SEND_PACKET	0x5393	/* send a packet to the drive */
88231e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE	0x5394	/* get next writable block */
88331e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN	0x5395	/* get last block written on disc */
88431e31b8aSbellard 
88531e31b8aSbellard /* HD commands */
88631e31b8aSbellard 
88731e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
88831e31b8aSbellard #define TARGET_HDIO_GETGEO            0x0301  /* get device geometry */
88931e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR    0x0302  /* get current unmask setting */
89031e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT     0x0304  /* get current IDE blockmode setting */
89131e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS  0x0308  /* get keep-settings-on-reset flag */
89231e31b8aSbellard #define TARGET_HDIO_GET_32BIT         0x0309  /* get current io_32bit setting */
89331e31b8aSbellard #define TARGET_HDIO_GET_NOWERR        0x030a  /* get ignore-write-error flag */
89431e31b8aSbellard #define TARGET_HDIO_GET_DMA           0x030b  /* get use-dma flag */
8952521d698Sbellard #define TARGET_HDIO_GET_IDENTITY      0x030d  /* get IDE identification info */
89631e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD         0x031f  /* execute a special drive command */
89731e31b8aSbellard 
89831e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
89931e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT     0x0321  /* change IDE blockmode */
90031e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR    0x0322  /* permit other irqs during I/O */
90131e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS  0x0323  /* keep ioctl settings on reset */
90231e31b8aSbellard #define TARGET_HDIO_SET_32BIT         0x0324  /* change io_32bit flags */
90331e31b8aSbellard #define TARGET_HDIO_SET_NOWERR        0x0325  /* change ignore-write-error flag */
90431e31b8aSbellard #define TARGET_HDIO_SET_DMA           0x0326  /* change use-dma flag */
90531e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE      0x0327  /* reconfig interface to new speed */
9062521d698Sbellard 
907b8005914Sbalrog /* loop ioctls */
908b8005914Sbalrog #define TARGET_LOOP_SET_FD            0x4C00
909b8005914Sbalrog #define TARGET_LOOP_CLR_FD            0x4C01
910b8005914Sbalrog #define TARGET_LOOP_SET_STATUS        0x4C02
911b8005914Sbalrog #define TARGET_LOOP_GET_STATUS        0x4C03
912b8005914Sbalrog #define TARGET_LOOP_SET_STATUS64      0x4C04
913b8005914Sbalrog #define TARGET_LOOP_GET_STATUS64      0x4C05
914b8005914Sbalrog #define TARGET_LOOP_CHANGE_FD         0x4C06
9152521d698Sbellard 
916f7680a55SUlrich Hecht /* fb ioctls */
917f7680a55SUlrich Hecht #define TARGET_FBIOGET_VSCREENINFO    0x4600
918f7680a55SUlrich Hecht #define TARGET_FBIOPUT_VSCREENINFO    0x4601
919f7680a55SUlrich Hecht #define TARGET_FBIOGET_FSCREENINFO    0x4602
920f7680a55SUlrich Hecht 
921f7680a55SUlrich Hecht /* vt ioctls */
922f7680a55SUlrich Hecht #define TARGET_VT_OPENQRY             0x5600
923f7680a55SUlrich Hecht #define TARGET_VT_GETSTATE            0x5603
924f7680a55SUlrich Hecht #define TARGET_VT_ACTIVATE            0x5606
925f7680a55SUlrich Hecht #define TARGET_VT_WAITACTIVE          0x5607
926f7680a55SUlrich Hecht #define TARGET_VT_LOCKSWITCH          0x560b
927f7680a55SUlrich Hecht #define TARGET_VT_UNLOCKSWITCH        0x560c
928f7680a55SUlrich Hecht 
9292521d698Sbellard /* from asm/termbits.h */
9302521d698Sbellard 
9313bfd9da1Sbellard #define TARGET_NCC 8
9323bfd9da1Sbellard struct target_termio {
9333bfd9da1Sbellard 	unsigned short c_iflag;		/* input mode flags */
9343bfd9da1Sbellard 	unsigned short c_oflag;		/* output mode flags */
9353bfd9da1Sbellard 	unsigned short c_cflag;		/* control mode flags */
9363bfd9da1Sbellard 	unsigned short c_lflag;		/* local mode flags */
9372521d698Sbellard 	unsigned char c_line;		/* line discipline */
9383bfd9da1Sbellard 	unsigned char c_cc[TARGET_NCC];	/* control characters */
9392521d698Sbellard };
9402521d698Sbellard 
9413bfd9da1Sbellard struct target_winsize {
9423bfd9da1Sbellard 	unsigned short ws_row;
9433bfd9da1Sbellard 	unsigned short ws_col;
9443bfd9da1Sbellard 	unsigned short ws_xpixel;
9453bfd9da1Sbellard 	unsigned short ws_ypixel;
9463bfd9da1Sbellard };
9472521d698Sbellard 
9483bfd9da1Sbellard #include "termbits.h"
9492521d698Sbellard 
9509e0b74a4SPaul Brook #if defined(TARGET_MIPS)
9519e0b74a4SPaul Brook #define TARGET_PROT_SEM         0x10
9529e0b74a4SPaul Brook #else
9539e0b74a4SPaul Brook #define TARGET_PROT_SEM         0x08
9549e0b74a4SPaul Brook #endif
9559e0b74a4SPaul Brook 
956e44a3e79Saurel32 /* Common */
9572521d698Sbellard #define TARGET_MAP_SHARED	0x01		/* Share changes */
9582521d698Sbellard #define TARGET_MAP_PRIVATE	0x02		/* Changes are private */
9592521d698Sbellard #define TARGET_MAP_TYPE		0x0f		/* Mask for type of mapping */
960e44a3e79Saurel32 
961e44a3e79Saurel32 /* Target specific */
962048f6b4dSbellard #if defined(TARGET_MIPS)
963e44a3e79Saurel32 #define TARGET_MAP_FIXED	0x10		/* Interpret addr exactly */
964048f6b4dSbellard #define TARGET_MAP_ANONYMOUS	0x0800		/* don't use a file */
965048f6b4dSbellard #define TARGET_MAP_GROWSDOWN	0x1000		/* stack-like segment */
966048f6b4dSbellard #define TARGET_MAP_DENYWRITE	0x2000		/* ETXTBSY */
967048f6b4dSbellard #define TARGET_MAP_EXECUTABLE	0x4000		/* mark it as an executable */
968048f6b4dSbellard #define TARGET_MAP_LOCKED	0x8000		/* pages are locked */
969048f6b4dSbellard #define TARGET_MAP_NORESERVE	0x0400		/* don't check for reservations */
970540635baSths #define TARGET_MAP_POPULATE	0x10000		/* populate (prefault) pagetables */
971540635baSths #define TARGET_MAP_NONBLOCK	0x20000		/* do not block on IO */
972e44a3e79Saurel32 #elif defined(TARGET_PPC)
973e44a3e79Saurel32 #define TARGET_MAP_FIXED	0x10		/* Interpret addr exactly */
9742521d698Sbellard #define TARGET_MAP_ANONYMOUS	0x20		/* don't use a file */
9752521d698Sbellard #define TARGET_MAP_GROWSDOWN	0x0100		/* stack-like segment */
9762521d698Sbellard #define TARGET_MAP_DENYWRITE	0x0800		/* ETXTBSY */
9772521d698Sbellard #define TARGET_MAP_EXECUTABLE	0x1000		/* mark it as an executable */
9787ec93196Sj_mayer #define TARGET_MAP_LOCKED	0x0080		/* pages are locked */
9797ec93196Sj_mayer #define TARGET_MAP_NORESERVE	0x0040		/* don't check for reservations */
980e44a3e79Saurel32 #define TARGET_MAP_POPULATE	0x8000		/* populate (prefault) pagetables */
981e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK	0x10000		/* do not block on IO */
982e44a3e79Saurel32 #elif defined(TARGET_ALPHA)
983e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS	0x10		/* don't use a file */
984e44a3e79Saurel32 #define TARGET_MAP_FIXED	0x100		/* Interpret addr exactly */
985e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN	0x01000		/* stack-like segment */
986e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE	0x02000		/* ETXTBSY */
987e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE	0x04000		/* mark it as an executable */
988e44a3e79Saurel32 #define TARGET_MAP_LOCKED	0x08000		/* lock the mapping */
989e44a3e79Saurel32 #define TARGET_MAP_NORESERVE	0x10000		/* no check for reservations */
990e44a3e79Saurel32 #define TARGET_MAP_POPULATE	0x20000		/* pop (prefault) pagetables */
991e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK	0x40000		/* do not block on IO */
9927ec93196Sj_mayer #else
993e44a3e79Saurel32 #define TARGET_MAP_FIXED	0x10		/* Interpret addr exactly */
994e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS	0x20		/* don't use a file */
995e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN	0x0100		/* stack-like segment */
996e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE	0x0800		/* ETXTBSY */
997e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE	0x1000		/* mark it as an executable */
9982521d698Sbellard #define TARGET_MAP_LOCKED	0x2000		/* pages are locked */
9992521d698Sbellard #define TARGET_MAP_NORESERVE	0x4000		/* don't check for reservations */
1000540635baSths #define TARGET_MAP_POPULATE	0x8000		/* populate (prefault) pagetables */
1001540635baSths #define TARGET_MAP_NONBLOCK	0x10000		/* do not block on IO */
10027ec93196Sj_mayer #endif
10032521d698Sbellard 
1004d2fd1af7Sbellard #if (defined(TARGET_I386) && defined(TARGET_ABI32)) || defined(TARGET_ARM) || defined(TARGET_CRIS)
10052521d698Sbellard struct target_stat {
10062521d698Sbellard 	unsigned short st_dev;
10072521d698Sbellard 	unsigned short __pad1;
1008992f48a0Sblueswir1 	abi_ulong st_ino;
10092521d698Sbellard 	unsigned short st_mode;
10102521d698Sbellard 	unsigned short st_nlink;
10112521d698Sbellard 	unsigned short st_uid;
10122521d698Sbellard 	unsigned short st_gid;
10132521d698Sbellard 	unsigned short st_rdev;
10142521d698Sbellard 	unsigned short __pad2;
1015992f48a0Sblueswir1 	abi_ulong  st_size;
1016992f48a0Sblueswir1 	abi_ulong  st_blksize;
1017992f48a0Sblueswir1 	abi_ulong  st_blocks;
1018992f48a0Sblueswir1 	abi_ulong  target_st_atime;
1019992f48a0Sblueswir1 	abi_ulong  __unused1;
1020992f48a0Sblueswir1 	abi_ulong  target_st_mtime;
1021992f48a0Sblueswir1 	abi_ulong  __unused2;
1022992f48a0Sblueswir1 	abi_ulong  target_st_ctime;
1023992f48a0Sblueswir1 	abi_ulong  __unused3;
1024992f48a0Sblueswir1 	abi_ulong  __unused4;
1025992f48a0Sblueswir1 	abi_ulong  __unused5;
10262521d698Sbellard };
10272521d698Sbellard 
10282521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely
10292521d698Sbellard  * insane amounts of padding around dev_t's.
10302521d698Sbellard  */
10312521d698Sbellard struct target_stat64 {
10322521d698Sbellard 	unsigned short	st_dev;
10332521d698Sbellard 	unsigned char	__pad0[10];
10342521d698Sbellard 
10352521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO	1
1036992f48a0Sblueswir1 	abi_ulong	__st_ino;
10372521d698Sbellard 
10382521d698Sbellard 	unsigned int	st_mode;
10392521d698Sbellard 	unsigned int	st_nlink;
10402521d698Sbellard 
1041992f48a0Sblueswir1 	abi_ulong	st_uid;
1042992f48a0Sblueswir1 	abi_ulong	st_gid;
10432521d698Sbellard 
10442521d698Sbellard 	unsigned short	st_rdev;
10452521d698Sbellard 	unsigned char	__pad3[10];
10462521d698Sbellard 
10472521d698Sbellard 	long long	st_size;
1048992f48a0Sblueswir1 	abi_ulong	st_blksize;
10492521d698Sbellard 
1050992f48a0Sblueswir1 	abi_ulong	st_blocks;	/* Number 512-byte blocks allocated. */
1051992f48a0Sblueswir1 	abi_ulong	__pad4;		/* future possible st_blocks high bits */
10522521d698Sbellard 
1053992f48a0Sblueswir1 	abi_ulong	target_st_atime;
1054992f48a0Sblueswir1 	abi_ulong	__pad5;
10552521d698Sbellard 
1056992f48a0Sblueswir1 	abi_ulong	target_st_mtime;
1057992f48a0Sblueswir1 	abi_ulong	__pad6;
10582521d698Sbellard 
1059992f48a0Sblueswir1 	abi_ulong	target_st_ctime;
1060992f48a0Sblueswir1 	abi_ulong	__pad7;		/* will be high 32 bits of ctime someday */
10612521d698Sbellard 
10622521d698Sbellard 	unsigned long long	st_ino;
10632521d698Sbellard } __attribute__((packed));
10642521d698Sbellard 
1065ce4defa0Spbrook #ifdef TARGET_ARM
1066ce4defa0Spbrook struct target_eabi_stat64 {
1067ce4defa0Spbrook         unsigned long long st_dev;
1068ce4defa0Spbrook         unsigned int    __pad1;
1069992f48a0Sblueswir1         abi_ulong    __st_ino;
1070ce4defa0Spbrook         unsigned int    st_mode;
1071ce4defa0Spbrook         unsigned int    st_nlink;
1072ce4defa0Spbrook 
1073992f48a0Sblueswir1         abi_ulong    st_uid;
1074992f48a0Sblueswir1         abi_ulong    st_gid;
1075ce4defa0Spbrook 
1076ce4defa0Spbrook         unsigned long long st_rdev;
1077ce4defa0Spbrook         unsigned int    __pad2[2];
1078ce4defa0Spbrook 
1079ce4defa0Spbrook         long long       st_size;
1080992f48a0Sblueswir1         abi_ulong    st_blksize;
1081ce4defa0Spbrook         unsigned int    __pad3;
1082ce4defa0Spbrook         unsigned long long st_blocks;
1083ce4defa0Spbrook 
1084992f48a0Sblueswir1         abi_ulong    target_st_atime;
1085992f48a0Sblueswir1         abi_ulong    target_st_atime_nsec;
1086ce4defa0Spbrook 
1087992f48a0Sblueswir1         abi_ulong    target_st_mtime;
1088992f48a0Sblueswir1         abi_ulong    target_st_mtime_nsec;
1089ce4defa0Spbrook 
1090992f48a0Sblueswir1         abi_ulong    target_st_ctime;
1091992f48a0Sblueswir1         abi_ulong    target_st_ctime_nsec;
1092ce4defa0Spbrook 
1093ce4defa0Spbrook         unsigned long long st_ino;
1094ce4defa0Spbrook } __attribute__ ((packed));
1095ce4defa0Spbrook #endif
1096ce4defa0Spbrook 
1097992f48a0Sblueswir1 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
10981b8dd648Sblueswir1 struct target_stat {
10991b8dd648Sblueswir1 	unsigned int	st_dev;
1100992f48a0Sblueswir1 	abi_ulong	st_ino;
11011b8dd648Sblueswir1 	unsigned int	st_mode;
11021b8dd648Sblueswir1 	unsigned int	st_nlink;
11031b8dd648Sblueswir1 	unsigned int	st_uid;
11041b8dd648Sblueswir1 	unsigned int	st_gid;
11051b8dd648Sblueswir1 	unsigned int	st_rdev;
1106992f48a0Sblueswir1 	abi_long	st_size;
1107992f48a0Sblueswir1 	abi_long	target_st_atime;
1108992f48a0Sblueswir1 	abi_long	target_st_mtime;
1109992f48a0Sblueswir1 	abi_long	target_st_ctime;
1110992f48a0Sblueswir1 	abi_long	st_blksize;
1111992f48a0Sblueswir1 	abi_long	st_blocks;
1112992f48a0Sblueswir1 	abi_ulong	__unused4[2];
11131b8dd648Sblueswir1 };
11141b8dd648Sblueswir1 
11151b8dd648Sblueswir1 struct target_stat64 {
11161b8dd648Sblueswir1 	unsigned char	__pad0[6];
11171b8dd648Sblueswir1 	unsigned short	st_dev;
11181b8dd648Sblueswir1 
11191b8dd648Sblueswir1 	uint64_t	st_ino;
11201b8dd648Sblueswir1 	uint64_t	st_nlink;
11211b8dd648Sblueswir1 
11221b8dd648Sblueswir1 	unsigned int	st_mode;
11231b8dd648Sblueswir1 
11241b8dd648Sblueswir1 	unsigned int	st_uid;
11251b8dd648Sblueswir1 	unsigned int	st_gid;
11261b8dd648Sblueswir1 
11271b8dd648Sblueswir1 	unsigned char	__pad2[6];
11281b8dd648Sblueswir1 	unsigned short	st_rdev;
11291b8dd648Sblueswir1 
11301b8dd648Sblueswir1         int64_t		st_size;
11311b8dd648Sblueswir1 	int64_t		st_blksize;
11321b8dd648Sblueswir1 
11331b8dd648Sblueswir1 	unsigned char	__pad4[4];
11341b8dd648Sblueswir1 	unsigned int	st_blocks;
11351b8dd648Sblueswir1 
1136992f48a0Sblueswir1 	abi_ulong	target_st_atime;
1137992f48a0Sblueswir1 	abi_ulong	__unused1;
11381b8dd648Sblueswir1 
1139992f48a0Sblueswir1 	abi_ulong	target_st_mtime;
1140992f48a0Sblueswir1 	abi_ulong	__unused2;
11411b8dd648Sblueswir1 
1142992f48a0Sblueswir1 	abi_ulong	target_st_ctime;
1143992f48a0Sblueswir1 	abi_ulong	__unused3;
11441b8dd648Sblueswir1 
1145992f48a0Sblueswir1 	abi_ulong	__unused4[3];
11461b8dd648Sblueswir1 };
11471b8dd648Sblueswir1 
11483bfd9da1Sbellard #elif defined(TARGET_SPARC)
11493bfd9da1Sbellard 
11503bfd9da1Sbellard struct target_stat {
11513bfd9da1Sbellard 	unsigned short	st_dev;
1152992f48a0Sblueswir1 	abi_ulong	st_ino;
11533bfd9da1Sbellard 	unsigned short	st_mode;
11543bfd9da1Sbellard 	short		st_nlink;
11553bfd9da1Sbellard 	unsigned short	st_uid;
11563bfd9da1Sbellard 	unsigned short	st_gid;
11573bfd9da1Sbellard 	unsigned short	st_rdev;
1158992f48a0Sblueswir1 	abi_long	st_size;
1159992f48a0Sblueswir1 	abi_long	target_st_atime;
1160992f48a0Sblueswir1 	abi_ulong	__unused1;
1161992f48a0Sblueswir1 	abi_long	target_st_mtime;
1162992f48a0Sblueswir1 	abi_ulong	__unused2;
1163992f48a0Sblueswir1 	abi_long	target_st_ctime;
1164992f48a0Sblueswir1 	abi_ulong	__unused3;
1165992f48a0Sblueswir1 	abi_long	st_blksize;
1166992f48a0Sblueswir1 	abi_long	st_blocks;
1167992f48a0Sblueswir1 	abi_ulong	__unused4[2];
11683bfd9da1Sbellard };
11693bfd9da1Sbellard 
11703bfd9da1Sbellard struct target_stat64 {
11713bfd9da1Sbellard 	unsigned char	__pad0[6];
11723bfd9da1Sbellard 	unsigned short	st_dev;
11733bfd9da1Sbellard 
11743bfd9da1Sbellard 	uint64_t st_ino;
11753bfd9da1Sbellard 
11763bfd9da1Sbellard 	unsigned int	st_mode;
11773bfd9da1Sbellard 	unsigned int	st_nlink;
11783bfd9da1Sbellard 
11793bfd9da1Sbellard 	unsigned int	st_uid;
11803bfd9da1Sbellard 	unsigned int	st_gid;
11813bfd9da1Sbellard 
11823bfd9da1Sbellard 	unsigned char	__pad2[6];
11833bfd9da1Sbellard 	unsigned short	st_rdev;
11843bfd9da1Sbellard 
11853bfd9da1Sbellard 	unsigned char	__pad3[8];
11863bfd9da1Sbellard 
11873bfd9da1Sbellard         int64_t	st_size;
11883bfd9da1Sbellard 	unsigned int	st_blksize;
11893bfd9da1Sbellard 
11903bfd9da1Sbellard 	unsigned char	__pad4[8];
11913bfd9da1Sbellard 	unsigned int	st_blocks;
11923bfd9da1Sbellard 
11933bfd9da1Sbellard 	unsigned int	target_st_atime;
11943bfd9da1Sbellard 	unsigned int	__unused1;
11953bfd9da1Sbellard 
11963bfd9da1Sbellard 	unsigned int	target_st_mtime;
11973bfd9da1Sbellard 	unsigned int	__unused2;
11983bfd9da1Sbellard 
11993bfd9da1Sbellard 	unsigned int	target_st_ctime;
12003bfd9da1Sbellard 	unsigned int	__unused3;
12013bfd9da1Sbellard 
12023bfd9da1Sbellard 	unsigned int	__unused4;
12033bfd9da1Sbellard 	unsigned int	__unused5;
12043bfd9da1Sbellard };
12053bfd9da1Sbellard 
120667867308Sbellard #elif defined(TARGET_PPC)
120767867308Sbellard 
120867867308Sbellard struct target_stat {
1209e32448e0Sj_mayer 	abi_ulong st_dev;
1210992f48a0Sblueswir1 	abi_ulong st_ino;
1211325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
1212e32448e0Sj_mayer 	abi_ulong st_nlink;
1213325e651fSj_mayer 	unsigned int st_mode;
1214325e651fSj_mayer #else
121567867308Sbellard 	unsigned int st_mode;
121667867308Sbellard 	unsigned short st_nlink;
1217325e651fSj_mayer #endif
121867867308Sbellard 	unsigned int st_uid;
121967867308Sbellard 	unsigned int st_gid;
1220e32448e0Sj_mayer 	abi_ulong  st_rdev;
1221992f48a0Sblueswir1 	abi_ulong  st_size;
1222992f48a0Sblueswir1 	abi_ulong  st_blksize;
1223992f48a0Sblueswir1 	abi_ulong  st_blocks;
1224992f48a0Sblueswir1 	abi_ulong  target_st_atime;
1225e32448e0Sj_mayer 	abi_ulong  target_st_atime_nsec;
1226992f48a0Sblueswir1 	abi_ulong  target_st_mtime;
1227e32448e0Sj_mayer 	abi_ulong  target_st_mtime_nsec;
1228992f48a0Sblueswir1 	abi_ulong  target_st_ctime;
1229e32448e0Sj_mayer 	abi_ulong  target_st_ctime_nsec;
1230992f48a0Sblueswir1 	abi_ulong  __unused4;
1231992f48a0Sblueswir1 	abi_ulong  __unused5;
1232325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
1233325e651fSj_mayer 	abi_ulong  __unused6;
1234325e651fSj_mayer #endif
123567867308Sbellard };
123667867308Sbellard 
1237e1ce5e40Saurel32 struct __attribute__((__packed__)) target_stat64 {
123867867308Sbellard 	unsigned long long st_dev;
123967867308Sbellard         unsigned long long st_ino;
124067867308Sbellard 	unsigned int st_mode;
124167867308Sbellard 	unsigned int st_nlink;
124267867308Sbellard 	unsigned int st_uid;
124367867308Sbellard 	unsigned int st_gid;
124467867308Sbellard 	unsigned long long st_rdev;
1245e1ce5e40Saurel32 	unsigned long long __pad0;
124667867308Sbellard 	long long      st_size;
1247e32448e0Sj_mayer 	int	       st_blksize;
1248e1ce5e40Saurel32 	unsigned int   __pad1;
124961322e91SMax Filippov 	long long      st_blocks;	/* Number 512-byte blocks allocated. */
1250e32448e0Sj_mayer 	int	       target_st_atime;
1251e32448e0Sj_mayer         unsigned int   target_st_atime_nsec;
1252e32448e0Sj_mayer 	int	       target_st_mtime;
1253e32448e0Sj_mayer         unsigned int   target_st_mtime_nsec;
1254e32448e0Sj_mayer 	int            target_st_ctime;
1255e32448e0Sj_mayer         unsigned int   target_st_ctime_nsec;
1256e32448e0Sj_mayer         unsigned int   __unused4;
1257e32448e0Sj_mayer         unsigned int   __unused5;
125867867308Sbellard };
125967867308Sbellard 
1260b779e29eSEdgar E. Iglesias #elif defined(TARGET_MICROBLAZE)
1261b779e29eSEdgar E. Iglesias 
1262b779e29eSEdgar E. Iglesias struct target_stat {
1263b779e29eSEdgar E. Iglesias 	abi_ulong st_dev;
1264b779e29eSEdgar E. Iglesias 	abi_ulong st_ino;
1265b779e29eSEdgar E. Iglesias 	unsigned int st_mode;
1266b779e29eSEdgar E. Iglesias 	unsigned short st_nlink;
1267b779e29eSEdgar E. Iglesias 	unsigned int st_uid;
1268b779e29eSEdgar E. Iglesias 	unsigned int st_gid;
1269b779e29eSEdgar E. Iglesias 	abi_ulong  st_rdev;
1270b779e29eSEdgar E. Iglesias 	abi_ulong  st_size;
1271b779e29eSEdgar E. Iglesias 	abi_ulong  st_blksize;
1272b779e29eSEdgar E. Iglesias 	abi_ulong  st_blocks;
1273b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_atime;
1274b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_atime_nsec;
1275b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_mtime;
1276b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_mtime_nsec;
1277b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_ctime;
1278b779e29eSEdgar E. Iglesias 	abi_ulong  target_st_ctime_nsec;
1279b779e29eSEdgar E. Iglesias 	abi_ulong  __unused4;
1280b779e29eSEdgar E. Iglesias 	abi_ulong  __unused5;
1281b779e29eSEdgar E. Iglesias };
1282b779e29eSEdgar E. Iglesias 
1283b779e29eSEdgar E. Iglesias /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout...  */
1284b779e29eSEdgar E. Iglesias struct __attribute__((__packed__)) target_stat64 {
1285b779e29eSEdgar E. Iglesias 	uint64_t st_dev;
1286a523eb06SEdgar E. Iglesias #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
1287a523eb06SEdgar E. Iglesias 	uint32_t pad0;
1288a523eb06SEdgar E. Iglesias 	uint32_t __st_ino;
1289a523eb06SEdgar E. Iglesias 
1290b779e29eSEdgar E. Iglesias 	uint32_t st_mode;
1291b779e29eSEdgar E. Iglesias 	uint32_t st_nlink;
1292b779e29eSEdgar E. Iglesias 	uint32_t st_uid;
1293b779e29eSEdgar E. Iglesias 	uint32_t st_gid;
1294b779e29eSEdgar E. Iglesias 	uint64_t st_rdev;
129521ebeb23SEdgar E. Iglesias 	uint64_t __pad1;
1296b779e29eSEdgar E. Iglesias 
1297b779e29eSEdgar E. Iglesias 	int64_t  st_size;
1298b779e29eSEdgar E. Iglesias 	int32_t  st_blksize;
129921ebeb23SEdgar E. Iglesias 	uint32_t __pad2;
1300b779e29eSEdgar E. Iglesias 	int64_t st_blocks;	/* Number 512-byte blocks allocated. */
1301b779e29eSEdgar E. Iglesias 
1302b779e29eSEdgar E. Iglesias 	int	       target_st_atime;
1303b779e29eSEdgar E. Iglesias 	unsigned int   target_st_atime_nsec;
1304b779e29eSEdgar E. Iglesias 	int	       target_st_mtime;
1305b779e29eSEdgar E. Iglesias 	unsigned int   target_st_mtime_nsec;
1306b779e29eSEdgar E. Iglesias 	int            target_st_ctime;
1307b779e29eSEdgar E. Iglesias 	unsigned int   target_st_ctime_nsec;
1308a523eb06SEdgar E. Iglesias 	uint64_t st_ino;
1309b779e29eSEdgar E. Iglesias };
1310b779e29eSEdgar E. Iglesias 
1311e6e5906bSpbrook #elif defined(TARGET_M68K)
1312e6e5906bSpbrook 
1313e6e5906bSpbrook struct target_stat {
1314e6e5906bSpbrook 	unsigned short st_dev;
1315e6e5906bSpbrook 	unsigned short __pad1;
1316992f48a0Sblueswir1 	abi_ulong st_ino;
1317e6e5906bSpbrook 	unsigned short st_mode;
1318e6e5906bSpbrook 	unsigned short st_nlink;
1319e6e5906bSpbrook 	unsigned short st_uid;
1320e6e5906bSpbrook 	unsigned short st_gid;
1321e6e5906bSpbrook 	unsigned short st_rdev;
1322e6e5906bSpbrook 	unsigned short __pad2;
1323992f48a0Sblueswir1 	abi_ulong  st_size;
1324992f48a0Sblueswir1 	abi_ulong  st_blksize;
1325992f48a0Sblueswir1 	abi_ulong  st_blocks;
1326992f48a0Sblueswir1 	abi_ulong  target_st_atime;
1327992f48a0Sblueswir1 	abi_ulong  __unused1;
1328992f48a0Sblueswir1 	abi_ulong  target_st_mtime;
1329992f48a0Sblueswir1 	abi_ulong  __unused2;
1330992f48a0Sblueswir1 	abi_ulong  target_st_ctime;
1331992f48a0Sblueswir1 	abi_ulong  __unused3;
1332992f48a0Sblueswir1 	abi_ulong  __unused4;
1333992f48a0Sblueswir1 	abi_ulong  __unused5;
1334e6e5906bSpbrook };
1335e6e5906bSpbrook 
1336e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely
1337e6e5906bSpbrook  * insane amounts of padding around dev_t's.
1338e6e5906bSpbrook  */
1339e6e5906bSpbrook struct target_stat64 {
1340e6e5906bSpbrook 	unsigned long long	st_dev;
1341e6e5906bSpbrook 	unsigned char	__pad1[2];
1342e6e5906bSpbrook 
1343e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO	1
1344992f48a0Sblueswir1 	abi_ulong	__st_ino;
1345e6e5906bSpbrook 
1346e6e5906bSpbrook 	unsigned int	st_mode;
1347e6e5906bSpbrook 	unsigned int	st_nlink;
1348e6e5906bSpbrook 
1349992f48a0Sblueswir1 	abi_ulong	st_uid;
1350992f48a0Sblueswir1 	abi_ulong	st_gid;
1351e6e5906bSpbrook 
1352e6e5906bSpbrook 	unsigned long long	st_rdev;
1353e6e5906bSpbrook 	unsigned char	__pad3[2];
1354e6e5906bSpbrook 
1355e6e5906bSpbrook 	long long	st_size;
1356992f48a0Sblueswir1 	abi_ulong	st_blksize;
1357e6e5906bSpbrook 
1358992f48a0Sblueswir1 	abi_ulong	__pad4;		/* future possible st_blocks high bits */
1359992f48a0Sblueswir1 	abi_ulong	st_blocks;	/* Number 512-byte blocks allocated. */
1360e6e5906bSpbrook 
1361992f48a0Sblueswir1 	abi_ulong	target_st_atime;
1362992f48a0Sblueswir1 	abi_ulong	target_st_atime_nsec;
1363e6e5906bSpbrook 
1364992f48a0Sblueswir1 	abi_ulong	target_st_mtime;
1365992f48a0Sblueswir1 	abi_ulong	target_st_mtime_nsec;
1366e6e5906bSpbrook 
1367992f48a0Sblueswir1 	abi_ulong	target_st_ctime;
1368992f48a0Sblueswir1 	abi_ulong	target_st_ctime_nsec;
1369e6e5906bSpbrook 
1370e6e5906bSpbrook 	unsigned long long	st_ino;
1371e6e5906bSpbrook } __attribute__((packed));
1372e6e5906bSpbrook 
1373d26bc211Sths #elif defined(TARGET_ABI_MIPSN64)
1374540635baSths 
1375540635baSths /* The memory layout is the same as of struct stat64 of the 32-bit kernel.  */
1376540635baSths struct target_stat {
1377540635baSths 	unsigned int		st_dev;
1378540635baSths 	unsigned int		st_pad0[3]; /* Reserved for st_dev expansion */
1379540635baSths 
1380992f48a0Sblueswir1 	abi_ulong		st_ino;
1381540635baSths 
1382540635baSths 	unsigned int		st_mode;
1383540635baSths 	unsigned int		st_nlink;
1384540635baSths 
1385540635baSths 	int			st_uid;
1386540635baSths 	int			st_gid;
1387540635baSths 
1388540635baSths 	unsigned int		st_rdev;
1389540635baSths 	unsigned int		st_pad1[3]; /* Reserved for st_rdev expansion */
1390540635baSths 
1391992f48a0Sblueswir1 	abi_ulong		st_size;
1392540635baSths 
1393540635baSths 	/*
1394540635baSths 	 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1395540635baSths 	 * but we don't have it under Linux.
1396540635baSths 	 */
1397540635baSths 	unsigned int		target_st_atime;
1398540635baSths 	unsigned int		target_st_atime_nsec;
1399540635baSths 
1400540635baSths 	unsigned int		target_st_mtime;
1401540635baSths 	unsigned int		target_st_mtime_nsec;
1402540635baSths 
1403540635baSths 	unsigned int		target_st_ctime;
1404540635baSths 	unsigned int		target_st_ctime_nsec;
1405540635baSths 
1406540635baSths 	unsigned int		st_blksize;
1407540635baSths 	unsigned int		st_pad2;
1408540635baSths 
1409992f48a0Sblueswir1 	abi_ulong		st_blocks;
1410540635baSths };
1411540635baSths 
1412d26bc211Sths #elif defined(TARGET_ABI_MIPSN32)
1413540635baSths 
1414540635baSths struct target_stat {
1415540635baSths 	unsigned	st_dev;
1416540635baSths 	int		st_pad1[3];		/* Reserved for network id */
1417540635baSths 	unsigned int	st_ino;
1418540635baSths 	unsigned int	st_mode;
1419540635baSths 	unsigned int	st_nlink;
1420540635baSths 	int		st_uid;
1421540635baSths 	int		st_gid;
1422540635baSths 	unsigned 	st_rdev;
1423540635baSths 	unsigned int	st_pad2[2];
1424540635baSths 	unsigned int	st_size;
1425540635baSths 	unsigned int	st_pad3;
1426540635baSths 	/*
1427540635baSths 	 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1428540635baSths 	 * but we don't have it under Linux.
1429540635baSths 	 */
1430540635baSths 	unsigned int		target_st_atime;
1431540635baSths 	unsigned int		target_st_atime_nsec;
1432540635baSths 	unsigned int		target_st_mtime;
1433540635baSths 	unsigned int		target_st_mtime_nsec;
1434540635baSths 	unsigned int		target_st_ctime;
1435540635baSths 	unsigned int		target_st_ctime_nsec;
1436540635baSths 	unsigned int		st_blksize;
1437540635baSths 	unsigned int		st_blocks;
1438540635baSths 	unsigned int		st_pad4[14];
1439540635baSths };
1440540635baSths 
1441540635baSths /*
1442540635baSths  * This matches struct stat64 in glibc2.1, hence the absolutely insane
1443540635baSths  * amounts of padding around dev_t's.  The memory layout is the same as of
1444540635baSths  * struct stat of the 64-bit kernel.
1445540635baSths  */
1446540635baSths 
1447540635baSths struct target_stat64 {
1448540635baSths 	unsigned int	st_dev;
1449540635baSths 	unsigned int	st_pad0[3];	/* Reserved for st_dev expansion  */
1450540635baSths 
1451540635baSths 	target_ulong	st_ino;
1452540635baSths 
1453540635baSths         unsigned int	st_mode;
1454540635baSths         unsigned int	st_nlink;
1455540635baSths 
1456540635baSths 	int		st_uid;
1457540635baSths 	int		st_gid;
1458540635baSths 
1459540635baSths 	unsigned int	st_rdev;
1460540635baSths 	unsigned int	st_pad1[3];	/* Reserved for st_rdev expansion  */
1461540635baSths 
1462540635baSths 	int		st_size;
1463540635baSths 
1464540635baSths 	/*
1465540635baSths 	 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1466540635baSths 	 * but we don't have it under Linux.
1467540635baSths 	 */
1468540635baSths 	int		target_st_atime;
1469540635baSths 	unsigned int	target_st_atime_nsec;	/* Reserved for st_atime expansion  */
1470540635baSths 
1471540635baSths 	int		target_st_mtime;
1472540635baSths 	unsigned int	target_st_mtime_nsec;	/* Reserved for st_mtime expansion  */
1473540635baSths 
1474540635baSths 	int		target_st_ctime;
1475540635baSths 	unsigned int	target_st_ctime_nsec;	/* Reserved for st_ctime expansion  */
1476540635baSths 
1477540635baSths 	unsigned int	st_blksize;
1478540635baSths 	unsigned int	st_pad2;
1479540635baSths 
1480540635baSths 	int		st_blocks;
1481540635baSths };
1482540635baSths 
1483d26bc211Sths #elif defined(TARGET_ABI_MIPSO32)
1484048f6b4dSbellard 
1485048f6b4dSbellard struct target_stat {
1486048f6b4dSbellard 	unsigned	st_dev;
1487992f48a0Sblueswir1 	abi_long	st_pad1[3];		/* Reserved for network id */
1488992f48a0Sblueswir1 	abi_ulong	st_ino;
1489048f6b4dSbellard 	unsigned int	st_mode;
1490048f6b4dSbellard 	unsigned int	st_nlink;
1491048f6b4dSbellard 	int		st_uid;
1492048f6b4dSbellard 	int		st_gid;
1493048f6b4dSbellard 	unsigned 	st_rdev;
1494992f48a0Sblueswir1 	abi_long	st_pad2[2];
1495992f48a0Sblueswir1 	abi_long	st_size;
1496992f48a0Sblueswir1 	abi_long	st_pad3;
1497048f6b4dSbellard 	/*
1498048f6b4dSbellard 	 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1499048f6b4dSbellard 	 * but we don't have it under Linux.
1500048f6b4dSbellard 	 */
1501992f48a0Sblueswir1 	abi_long		target_st_atime;
1502992f48a0Sblueswir1 	abi_long		target_st_atime_nsec;
1503992f48a0Sblueswir1 	abi_long		target_st_mtime;
1504992f48a0Sblueswir1 	abi_long		target_st_mtime_nsec;
1505992f48a0Sblueswir1 	abi_long		target_st_ctime;
1506992f48a0Sblueswir1 	abi_long		target_st_ctime_nsec;
1507992f48a0Sblueswir1 	abi_long		st_blksize;
1508992f48a0Sblueswir1 	abi_long		st_blocks;
1509992f48a0Sblueswir1 	abi_long		st_pad4[14];
1510048f6b4dSbellard };
1511048f6b4dSbellard 
1512048f6b4dSbellard /*
1513048f6b4dSbellard  * This matches struct stat64 in glibc2.1, hence the absolutely insane
1514048f6b4dSbellard  * amounts of padding around dev_t's.  The memory layout is the same as of
1515048f6b4dSbellard  * struct stat of the 64-bit kernel.
1516048f6b4dSbellard  */
1517048f6b4dSbellard 
1518048f6b4dSbellard struct target_stat64 {
1519992f48a0Sblueswir1 	abi_ulong	st_dev;
1520992f48a0Sblueswir1 	abi_ulong	st_pad0[3];	/* Reserved for st_dev expansion  */
1521048f6b4dSbellard 
1522048f6b4dSbellard 	uint64_t	st_ino;
1523048f6b4dSbellard 
1524048f6b4dSbellard         unsigned int	st_mode;
1525048f6b4dSbellard         unsigned int	st_nlink;
1526048f6b4dSbellard 
1527048f6b4dSbellard 	int		st_uid;
1528048f6b4dSbellard 	int		st_gid;
1529048f6b4dSbellard 
1530992f48a0Sblueswir1 	abi_ulong	st_rdev;
1531992f48a0Sblueswir1 	abi_ulong	st_pad1[3];	/* Reserved for st_rdev expansion  */
1532048f6b4dSbellard 
1533048f6b4dSbellard 	int64_t 	st_size;
1534048f6b4dSbellard 
1535048f6b4dSbellard 	/*
1536048f6b4dSbellard 	 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1537048f6b4dSbellard 	 * but we don't have it under Linux.
1538048f6b4dSbellard 	 */
1539992f48a0Sblueswir1 	abi_long	target_st_atime;
1540992f48a0Sblueswir1 	abi_ulong	target_st_atime_nsec;	/* Reserved for st_atime expansion  */
1541048f6b4dSbellard 
1542992f48a0Sblueswir1 	abi_long	target_st_mtime;
1543992f48a0Sblueswir1 	abi_ulong	target_st_mtime_nsec;	/* Reserved for st_mtime expansion  */
1544048f6b4dSbellard 
1545992f48a0Sblueswir1 	abi_long	target_st_ctime;
1546992f48a0Sblueswir1 	abi_ulong	target_st_ctime_nsec;	/* Reserved for st_ctime expansion  */
1547048f6b4dSbellard 
1548992f48a0Sblueswir1 	abi_ulong	st_blksize;
1549992f48a0Sblueswir1 	abi_ulong	st_pad2;
1550048f6b4dSbellard 
1551048f6b4dSbellard 	int64_t  	st_blocks;
1552048f6b4dSbellard };
15537a3148a9Sj_mayer 
15547a3148a9Sj_mayer #elif defined(TARGET_ALPHA)
15557a3148a9Sj_mayer 
15567a3148a9Sj_mayer struct target_stat {
15577a3148a9Sj_mayer        unsigned int    st_dev;
15587a3148a9Sj_mayer        unsigned int    st_ino;
15597a3148a9Sj_mayer        unsigned int    st_mode;
15607a3148a9Sj_mayer        unsigned int    st_nlink;
15617a3148a9Sj_mayer        unsigned int    st_uid;
15627a3148a9Sj_mayer        unsigned int    st_gid;
15637a3148a9Sj_mayer        unsigned int    st_rdev;
1564992f48a0Sblueswir1        abi_long     st_size;
1565992f48a0Sblueswir1        abi_ulong    target_st_atime;
1566992f48a0Sblueswir1        abi_ulong    target_st_mtime;
1567992f48a0Sblueswir1        abi_ulong    target_st_ctime;
15687a3148a9Sj_mayer        unsigned int    st_blksize;
15697a3148a9Sj_mayer        unsigned int    st_blocks;
15707a3148a9Sj_mayer        unsigned int    st_flags;
15717a3148a9Sj_mayer        unsigned int    st_gen;
15727a3148a9Sj_mayer };
15737a3148a9Sj_mayer 
15747a3148a9Sj_mayer struct target_stat64 {
1575992f48a0Sblueswir1        abi_ulong    st_dev;
1576992f48a0Sblueswir1        abi_ulong    st_ino;
1577992f48a0Sblueswir1        abi_ulong    st_rdev;
1578992f48a0Sblueswir1        abi_long     st_size;
1579992f48a0Sblueswir1        abi_ulong    st_blocks;
15807a3148a9Sj_mayer 
15817a3148a9Sj_mayer        unsigned int    st_mode;
15827a3148a9Sj_mayer        unsigned int    st_uid;
15837a3148a9Sj_mayer        unsigned int    st_gid;
15847a3148a9Sj_mayer        unsigned int    st_blksize;
15857a3148a9Sj_mayer        unsigned int    st_nlink;
15867a3148a9Sj_mayer        unsigned int    __pad0;
15877a3148a9Sj_mayer 
1588992f48a0Sblueswir1        abi_ulong    target_st_atime;
1589992f48a0Sblueswir1        abi_ulong    target_st_atime_nsec;
1590992f48a0Sblueswir1        abi_ulong    target_st_mtime;
1591992f48a0Sblueswir1        abi_ulong    target_st_mtime_nsec;
1592992f48a0Sblueswir1        abi_ulong    target_st_ctime;
1593992f48a0Sblueswir1        abi_ulong    target_st_ctime_nsec;
1594992f48a0Sblueswir1        abi_long     __unused[3];
15957a3148a9Sj_mayer };
15967a3148a9Sj_mayer 
15976db45e65Sths #elif defined(TARGET_SH4)
15986db45e65Sths 
15996db45e65Sths struct target_stat {
1600992f48a0Sblueswir1 	abi_ulong  st_dev;
1601992f48a0Sblueswir1 	abi_ulong  st_ino;
16026db45e65Sths 	unsigned short st_mode;
16036db45e65Sths 	unsigned short st_nlink;
16046db45e65Sths 	unsigned short st_uid;
16056db45e65Sths 	unsigned short st_gid;
1606992f48a0Sblueswir1 	abi_ulong  st_rdev;
1607992f48a0Sblueswir1 	abi_ulong  st_size;
1608992f48a0Sblueswir1 	abi_ulong  st_blksize;
1609992f48a0Sblueswir1 	abi_ulong  st_blocks;
1610992f48a0Sblueswir1 	abi_ulong  target_st_atime;
1611992f48a0Sblueswir1 	abi_ulong  target_st_atime_nsec;
1612992f48a0Sblueswir1 	abi_ulong  target_st_mtime;
1613992f48a0Sblueswir1 	abi_ulong  target_st_mtime_nsec;
1614992f48a0Sblueswir1 	abi_ulong  target_st_ctime;
1615992f48a0Sblueswir1 	abi_ulong  target_st_ctime_nsec;
1616992f48a0Sblueswir1 	abi_ulong  __unused4;
1617992f48a0Sblueswir1 	abi_ulong  __unused5;
16186db45e65Sths };
16196db45e65Sths 
16206db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely
16216db45e65Sths  * insane amounts of padding around dev_t's.
16226db45e65Sths  */
162391bd8ce9Saurel32 struct __attribute__((__packed__)) target_stat64 {
16246db45e65Sths 	unsigned long long	st_dev;
16256db45e65Sths 	unsigned char	__pad0[4];
16266db45e65Sths 
16276db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO	1
1628992f48a0Sblueswir1 	abi_ulong	__st_ino;
16296db45e65Sths 
16306db45e65Sths 	unsigned int	st_mode;
16316db45e65Sths 	unsigned int	st_nlink;
16326db45e65Sths 
1633992f48a0Sblueswir1 	abi_ulong	st_uid;
1634992f48a0Sblueswir1 	abi_ulong	st_gid;
16356db45e65Sths 
16366db45e65Sths 	unsigned long long	st_rdev;
16376db45e65Sths 	unsigned char	__pad3[4];
16386db45e65Sths 
16396db45e65Sths 	long long	st_size;
1640992f48a0Sblueswir1 	abi_ulong	st_blksize;
16416db45e65Sths 
16426db45e65Sths 	unsigned long long	st_blocks;	/* Number 512-byte blocks allocated. */
16436db45e65Sths 
1644992f48a0Sblueswir1 	abi_ulong	target_st_atime;
1645992f48a0Sblueswir1 	abi_ulong	target_st_atime_nsec;
16466db45e65Sths 
1647992f48a0Sblueswir1 	abi_ulong	target_st_mtime;
1648992f48a0Sblueswir1 	abi_ulong	target_st_mtime_nsec;
16496db45e65Sths 
1650992f48a0Sblueswir1 	abi_ulong	target_st_ctime;
1651992f48a0Sblueswir1 	abi_ulong	target_st_ctime_nsec;
16526db45e65Sths 
16536db45e65Sths 	unsigned long long	st_ino;
16546db45e65Sths };
16556db45e65Sths 
1656d2fd1af7Sbellard #elif defined(TARGET_I386) && !defined(TARGET_ABI32)
1657d2fd1af7Sbellard struct target_stat {
1658d2fd1af7Sbellard 	abi_ulong	st_dev;
1659d2fd1af7Sbellard 	abi_ulong	st_ino;
1660d2fd1af7Sbellard 	abi_ulong	st_nlink;
1661d2fd1af7Sbellard 
1662d2fd1af7Sbellard 	unsigned int	st_mode;
1663d2fd1af7Sbellard 	unsigned int	st_uid;
1664d2fd1af7Sbellard 	unsigned int	st_gid;
1665d2fd1af7Sbellard 	unsigned int	__pad0;
1666d2fd1af7Sbellard 	abi_ulong	st_rdev;
1667d2fd1af7Sbellard 	abi_long	st_size;
1668d2fd1af7Sbellard 	abi_long	st_blksize;
1669d2fd1af7Sbellard     	abi_long	st_blocks;	/* Number 512-byte blocks allocated. */
1670d2fd1af7Sbellard 
1671d2fd1af7Sbellard 	abi_ulong	target_st_atime;
1672d2fd1af7Sbellard 	abi_ulong 	target_st_atime_nsec;
1673d2fd1af7Sbellard 	abi_ulong	target_st_mtime;
1674d2fd1af7Sbellard 	abi_ulong	target_st_mtime_nsec;
1675d2fd1af7Sbellard 	abi_ulong	target_st_ctime;
1676d2fd1af7Sbellard 	abi_ulong       target_st_ctime_nsec;
1677d2fd1af7Sbellard 
1678d2fd1af7Sbellard   	abi_long	__unused[3];
1679d2fd1af7Sbellard };
1680048f6b4dSbellard #else
1681048f6b4dSbellard #error unsupported CPU
1682048f6b4dSbellard #endif
16832521d698Sbellard 
16844ce6f8deSths typedef struct {
16854ce6f8deSths         int     val[2];
1686c227f099SAnthony Liguori } target_fsid_t;
16874ce6f8deSths 
168856c8f68fSbellard #ifdef TARGET_MIPS
1689d26bc211Sths #ifdef TARGET_ABI_MIPSN32
1690540635baSths struct target_statfs {
1691540635baSths 	int32_t			f_type;
1692540635baSths 	int32_t			f_bsize;
1693540635baSths 	int32_t			f_frsize;	/* Fragment size - unsupported */
1694540635baSths 	int32_t			f_blocks;
1695540635baSths 	int32_t			f_bfree;
1696540635baSths 	int32_t			f_files;
1697540635baSths 	int32_t			f_ffree;
1698540635baSths 	int32_t			f_bavail;
1699540635baSths 
1700540635baSths 	/* Linux specials */
1701c227f099SAnthony Liguori 	target_fsid_t		f_fsid;
1702540635baSths 	int32_t			f_namelen;
1703540635baSths 	int32_t			f_spare[6];
1704540635baSths };
1705540635baSths #else
170656c8f68fSbellard struct target_statfs {
1707992f48a0Sblueswir1 	abi_long		f_type;
1708992f48a0Sblueswir1 	abi_long		f_bsize;
1709992f48a0Sblueswir1 	abi_long		f_frsize;	/* Fragment size - unsupported */
1710992f48a0Sblueswir1 	abi_long		f_blocks;
1711992f48a0Sblueswir1 	abi_long		f_bfree;
1712992f48a0Sblueswir1 	abi_long		f_files;
1713992f48a0Sblueswir1 	abi_long		f_ffree;
1714992f48a0Sblueswir1 	abi_long		f_bavail;
171556c8f68fSbellard 
171656c8f68fSbellard 	/* Linux specials */
1717c227f099SAnthony Liguori 	target_fsid_t		f_fsid;
1718992f48a0Sblueswir1 	abi_long		f_namelen;
1719992f48a0Sblueswir1 	abi_long		f_spare[6];
172056c8f68fSbellard };
1721540635baSths #endif
172256c8f68fSbellard 
172356c8f68fSbellard struct target_statfs64 {
172456c8f68fSbellard 	uint32_t	f_type;
172556c8f68fSbellard 	uint32_t	f_bsize;
172656c8f68fSbellard 	uint32_t	f_frsize;	/* Fragment size - unsupported */
172756c8f68fSbellard 	uint32_t	__pad;
172856c8f68fSbellard 	uint64_t	f_blocks;
172956c8f68fSbellard 	uint64_t	f_bfree;
173056c8f68fSbellard 	uint64_t	f_files;
173156c8f68fSbellard 	uint64_t	f_ffree;
173256c8f68fSbellard 	uint64_t	f_bavail;
1733c227f099SAnthony Liguori 	target_fsid_t	f_fsid;
173456c8f68fSbellard 	uint32_t	f_namelen;
173556c8f68fSbellard 	uint32_t	f_spare[6];
173656c8f68fSbellard };
1737c4d10628Sbalrog #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \
1738c4d10628Sbalrog        defined(TARGET_SPARC64)) && !defined(TARGET_ABI32)
1739325e651fSj_mayer struct target_statfs {
1740325e651fSj_mayer 	abi_long f_type;
1741325e651fSj_mayer 	abi_long f_bsize;
1742325e651fSj_mayer 	abi_long f_blocks;
1743325e651fSj_mayer 	abi_long f_bfree;
1744325e651fSj_mayer 	abi_long f_bavail;
1745325e651fSj_mayer 	abi_long f_files;
1746325e651fSj_mayer 	abi_long f_ffree;
1747c227f099SAnthony Liguori 	target_fsid_t f_fsid;
1748325e651fSj_mayer 	abi_long f_namelen;
1749325e651fSj_mayer 	abi_long f_frsize;
1750325e651fSj_mayer 	abi_long f_spare[5];
1751325e651fSj_mayer };
1752325e651fSj_mayer 
1753325e651fSj_mayer struct target_statfs64 {
1754325e651fSj_mayer 	abi_long f_type;
1755325e651fSj_mayer 	abi_long f_bsize;
1756325e651fSj_mayer 	abi_long f_blocks;
1757325e651fSj_mayer 	abi_long f_bfree;
1758325e651fSj_mayer 	abi_long f_bavail;
1759325e651fSj_mayer 	abi_long f_files;
1760325e651fSj_mayer 	abi_long f_ffree;
1761c227f099SAnthony Liguori 	target_fsid_t f_fsid;
1762325e651fSj_mayer 	abi_long f_namelen;
1763325e651fSj_mayer 	abi_long f_frsize;
1764325e651fSj_mayer 	abi_long f_spare[5];
1765325e651fSj_mayer };
176656c8f68fSbellard #else
176756c8f68fSbellard struct target_statfs {
176856c8f68fSbellard 	uint32_t f_type;
176956c8f68fSbellard 	uint32_t f_bsize;
177056c8f68fSbellard 	uint32_t f_blocks;
177156c8f68fSbellard 	uint32_t f_bfree;
177256c8f68fSbellard 	uint32_t f_bavail;
177356c8f68fSbellard 	uint32_t f_files;
177456c8f68fSbellard 	uint32_t f_ffree;
1775c227f099SAnthony Liguori 	target_fsid_t f_fsid;
177656c8f68fSbellard 	uint32_t f_namelen;
177756c8f68fSbellard 	uint32_t f_frsize;
177856c8f68fSbellard 	uint32_t f_spare[5];
177956c8f68fSbellard };
178056c8f68fSbellard 
178156c8f68fSbellard struct target_statfs64 {
178256c8f68fSbellard 	uint32_t f_type;
178356c8f68fSbellard 	uint32_t f_bsize;
178456c8f68fSbellard 	uint64_t f_blocks;
178556c8f68fSbellard 	uint64_t f_bfree;
178656c8f68fSbellard 	uint64_t f_bavail;
178756c8f68fSbellard 	uint64_t f_files;
178856c8f68fSbellard 	uint64_t f_ffree;
1789c227f099SAnthony Liguori 	target_fsid_t f_fsid;
179056c8f68fSbellard         uint32_t f_namelen;
179156c8f68fSbellard 	uint32_t f_frsize;
179256c8f68fSbellard 	uint32_t f_spare[5];
179356c8f68fSbellard };
179456c8f68fSbellard #endif
179556c8f68fSbellard 
179656c8f68fSbellard 
17972521d698Sbellard #define TARGET_F_DUPFD         0       /* dup */
17982521d698Sbellard #define TARGET_F_GETFD         1       /* get close_on_exec */
17992521d698Sbellard #define TARGET_F_SETFD         2       /* set/clear close_on_exec */
18002521d698Sbellard #define TARGET_F_GETFL         3       /* get file->f_flags */
18012521d698Sbellard #define TARGET_F_SETFL         4       /* set file->f_flags */
18022521d698Sbellard 
18032521d698Sbellard #if defined(TARGET_ALPHA)
18042521d698Sbellard #define TARGET_F_GETLK         7
18052521d698Sbellard #define TARGET_F_SETLK         8
18062521d698Sbellard #define TARGET_F_SETLKW        9
18072521d698Sbellard #define TARGET_F_SETOWN        5       /*  for sockets. */
18082521d698Sbellard #define TARGET_F_GETOWN        6       /*  for sockets. */
18095f106811SArnaud Patard (Rtp) #elif defined(TARGET_MIPS)
18105f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK         14
18115f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK         6
18125f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW        7
18135f106811SArnaud Patard (Rtp) #define TARGET_F_SETOWN        24       /*  for sockets. */
18145f106811SArnaud Patard (Rtp) #define TARGET_F_GETOWN        25       /*  for sockets. */
18152521d698Sbellard #else
18162521d698Sbellard #define TARGET_F_GETLK         5
18172521d698Sbellard #define TARGET_F_SETLK         6
18182521d698Sbellard #define TARGET_F_SETLKW        7
18192521d698Sbellard #define TARGET_F_SETOWN        8       /*  for sockets. */
18202521d698Sbellard #define TARGET_F_GETOWN        9       /*  for sockets. */
18212521d698Sbellard #endif
18222521d698Sbellard 
18232521d698Sbellard #define TARGET_F_SETSIG        10      /*  for sockets. */
18242521d698Sbellard #define TARGET_F_GETSIG        11      /*  for sockets. */
18252521d698Sbellard 
18265f106811SArnaud Patard (Rtp) #if defined(TARGET_MIPS)
18275f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK64       33      /*  using 'struct flock64' */
18285f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK64       34
18295f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW64      35
18305f106811SArnaud Patard (Rtp) #else
18312521d698Sbellard #define TARGET_F_GETLK64       12      /*  using 'struct flock64' */
18322521d698Sbellard #define TARGET_F_SETLK64       13
18332521d698Sbellard #define TARGET_F_SETLKW64      14
18345f106811SArnaud Patard (Rtp) #endif
18357e22e546SUlrich Hecht 
18367e22e546SUlrich Hecht #define TARGET_F_LINUX_SPECIFIC_BASE 1024
18377e22e546SUlrich Hecht #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0)
18387e22e546SUlrich Hecht #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1)
18397e22e546SUlrich Hecht #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6)
18407e22e546SUlrich Hecht #define TARGET_F_NOTIFY  (TARGET_F_LINUX_SPECIFIC_BASE+2)
18417e22e546SUlrich Hecht 
1842f09936acSbellard #if defined (TARGET_ARM)
1843f09936acSbellard #define TARGET_O_ACCMODE          0003
1844f09936acSbellard #define TARGET_O_RDONLY             00
1845f09936acSbellard #define TARGET_O_WRONLY             01
1846f09936acSbellard #define TARGET_O_RDWR               02
1847f09936acSbellard #define TARGET_O_CREAT            0100 /* not fcntl */
1848f09936acSbellard #define TARGET_O_EXCL             0200 /* not fcntl */
1849f09936acSbellard #define TARGET_O_NOCTTY           0400 /* not fcntl */
1850f09936acSbellard #define TARGET_O_TRUNC           01000 /* not fcntl */
1851f09936acSbellard #define TARGET_O_APPEND          02000
1852f09936acSbellard #define TARGET_O_NONBLOCK        04000
1853048f6b4dSbellard #define TARGET_O_NDELAY        TARGET_O_NONBLOCK
1854f09936acSbellard #define TARGET_O_SYNC           010000
1855f09936acSbellard #define TARGET_FASYNC           020000 /* fcntl, for BSD compatibility */
1856f09936acSbellard #define TARGET_O_DIRECTORY      040000 /* must be a directory */
1857f09936acSbellard #define TARGET_O_NOFOLLOW      0100000 /* don't follow links */
1858f09936acSbellard #define TARGET_O_DIRECT        0200000 /* direct disk access hint */
1859f09936acSbellard #define TARGET_O_LARGEFILE     0400000
1860f09936acSbellard #elif defined (TARGET_PPC)
1861ffa65c3bSbellard #define TARGET_O_ACCMODE          0003
1862ffa65c3bSbellard #define TARGET_O_RDONLY             00
1863ffa65c3bSbellard #define TARGET_O_WRONLY             01
1864ffa65c3bSbellard #define TARGET_O_RDWR               02
1865ffa65c3bSbellard #define TARGET_O_CREAT            0100 /* not fcntl */
1866ffa65c3bSbellard #define TARGET_O_EXCL             0200 /* not fcntl */
1867ffa65c3bSbellard #define TARGET_O_NOCTTY           0400 /* not fcntl */
1868ffa65c3bSbellard #define TARGET_O_TRUNC           01000 /* not fcntl */
1869ffa65c3bSbellard #define TARGET_O_APPEND          02000
1870ffa65c3bSbellard #define TARGET_O_NONBLOCK        04000
1871048f6b4dSbellard #define TARGET_O_NDELAY        TARGET_O_NONBLOCK
1872ffa65c3bSbellard #define TARGET_O_SYNC           010000
1873ffa65c3bSbellard #define TARGET_FASYNC           020000 /* fcntl, for BSD compatibility */
1874ffa65c3bSbellard #define TARGET_O_DIRECTORY      040000 /* must be a directory */
1875ffa65c3bSbellard #define TARGET_O_NOFOLLOW      0100000 /* don't follow links */
1876ffa65c3bSbellard #define TARGET_O_LARGEFILE     0200000
1877ffa65c3bSbellard #define TARGET_O_DIRECT        0400000 /* direct disk access hint */
1878b779e29eSEdgar E. Iglesias #elif defined (TARGET_MICROBLAZE)
1879b779e29eSEdgar E. Iglesias #define TARGET_O_ACCMODE          0003
1880b779e29eSEdgar E. Iglesias #define TARGET_O_RDONLY             00
1881b779e29eSEdgar E. Iglesias #define TARGET_O_WRONLY             01
1882b779e29eSEdgar E. Iglesias #define TARGET_O_RDWR               02
1883b779e29eSEdgar E. Iglesias #define TARGET_O_CREAT            0100 /* not fcntl */
1884b779e29eSEdgar E. Iglesias #define TARGET_O_EXCL             0200 /* not fcntl */
1885b779e29eSEdgar E. Iglesias #define TARGET_O_NOCTTY           0400 /* not fcntl */
1886b779e29eSEdgar E. Iglesias #define TARGET_O_TRUNC           01000 /* not fcntl */
1887b779e29eSEdgar E. Iglesias #define TARGET_O_APPEND          02000
1888b779e29eSEdgar E. Iglesias #define TARGET_O_NONBLOCK        04000
1889b779e29eSEdgar E. Iglesias #define TARGET_O_NDELAY        TARGET_O_NONBLOCK
1890b779e29eSEdgar E. Iglesias #define TARGET_O_SYNC           010000
1891b779e29eSEdgar E. Iglesias #define TARGET_FASYNC           020000 /* fcntl, for BSD compatibility */
1892b779e29eSEdgar E. Iglesias #define TARGET_O_DIRECTORY      040000 /* must be a directory */
1893b779e29eSEdgar E. Iglesias #define TARGET_O_NOFOLLOW      0100000 /* don't follow links */
1894b779e29eSEdgar E. Iglesias #define TARGET_O_LARGEFILE     0200000
1895b779e29eSEdgar E. Iglesias #define TARGET_O_DIRECT        0400000 /* direct disk access hint */
18966d5e216dSbellard #elif defined (TARGET_SPARC)
18976d5e216dSbellard #define TARGET_O_RDONLY        0x0000
18986d5e216dSbellard #define TARGET_O_WRONLY        0x0001
18996d5e216dSbellard #define TARGET_O_RDWR          0x0002
19006d5e216dSbellard #define TARGET_O_ACCMODE       0x0003
19016d5e216dSbellard #define TARGET_O_APPEND        0x0008
19026d5e216dSbellard #define TARGET_FASYNC          0x0040  /* fcntl, for BSD compatibility */
19036d5e216dSbellard #define TARGET_O_CREAT         0x0200  /* not fcntl */
19046d5e216dSbellard #define TARGET_O_TRUNC         0x0400  /* not fcntl */
19056d5e216dSbellard #define TARGET_O_EXCL          0x0800  /* not fcntl */
19066d5e216dSbellard #define TARGET_O_SYNC          0x2000
19076d5e216dSbellard #define TARGET_O_NONBLOCK      0x4000
1908048f6b4dSbellard #define TARGET_O_NDELAY        (0x0004 | TARGET_O_NONBLOCK)
19096d5e216dSbellard #define TARGET_O_NOCTTY        0x8000  /* not fcntl */
19106d5e216dSbellard #define TARGET_O_DIRECTORY     0x10000 /* must be a directory */
19116d5e216dSbellard #define TARGET_O_NOFOLLOW      0x20000 /* don't follow links */
19126d5e216dSbellard #define TARGET_O_LARGEFILE     0x40000
19136d5e216dSbellard #define TARGET_O_DIRECT        0x100000 /* direct disk access hint */
1914048f6b4dSbellard #elif defined(TARGET_MIPS)
1915048f6b4dSbellard #define TARGET_O_ACCMODE	0x0003
1916048f6b4dSbellard #define TARGET_O_RDONLY	0x0000
1917048f6b4dSbellard #define TARGET_O_WRONLY	0x0001
1918048f6b4dSbellard #define TARGET_O_RDWR		0x0002
1919048f6b4dSbellard #define TARGET_O_APPEND	0x0008
1920048f6b4dSbellard #define TARGET_O_SYNC		0x0010
1921048f6b4dSbellard #define TARGET_O_NONBLOCK	0x0080
1922048f6b4dSbellard #define TARGET_O_CREAT         0x0100	/* not fcntl */
1923048f6b4dSbellard #define TARGET_O_TRUNC		0x0200	/* not fcntl */
1924048f6b4dSbellard #define TARGET_O_EXCL		0x0400	/* not fcntl */
1925048f6b4dSbellard #define TARGET_O_NOCTTY	0x0800	/* not fcntl */
1926048f6b4dSbellard #define TARGET_FASYNC		0x1000	/* fcntl, for BSD compatibility */
1927048f6b4dSbellard #define TARGET_O_LARGEFILE	0x2000	/* allow large file opens */
1928048f6b4dSbellard #define TARGET_O_DIRECT	0x8000	/* direct disk access hint */
1929048f6b4dSbellard #define TARGET_O_DIRECTORY	0x10000	/* must be a directory */
1930048f6b4dSbellard #define TARGET_O_NOFOLLOW	0x20000	/* don't follow links */
1931048f6b4dSbellard #define TARGET_O_NOATIME	0x40000
1932048f6b4dSbellard #define TARGET_O_NDELAY	TARGET_O_NONBLOCK
19331f961124Saurel32 #elif defined(TARGET_ALPHA)
19341f961124Saurel32 #define TARGET_O_ACCMODE	0x0003
19351f961124Saurel32 #define TARGET_O_RDONLY	0x0000
19361f961124Saurel32 #define TARGET_O_WRONLY	0x0001
19371f961124Saurel32 #define TARGET_O_RDWR		0x0002
19381f961124Saurel32 #define TARGET_O_APPEND	0x0008
19391f961124Saurel32 #define TARGET_O_SYNC		0x4000
19401f961124Saurel32 #define TARGET_O_NONBLOCK	0x0004
19411f961124Saurel32 #define TARGET_O_CREAT         0x0200	/* not fcntl */
19421f961124Saurel32 #define TARGET_O_TRUNC		0x0400	/* not fcntl */
19431f961124Saurel32 #define TARGET_O_EXCL		0x0800	/* not fcntl */
19441f961124Saurel32 #define TARGET_O_NOCTTY	0x1000	/* not fcntl */
19451f961124Saurel32 #define TARGET_FASYNC		0x2000	/* fcntl, for BSD compatibility */
19461f961124Saurel32 #define TARGET_O_LARGEFILE	0x0000	/* not necessary, always 64-bit */
19471f961124Saurel32 #define TARGET_O_DIRECT	0x80000	/* direct disk access hint */
19481f961124Saurel32 #define TARGET_O_DIRECTORY	0x8000	/* must be a directory */
19491f961124Saurel32 #define TARGET_O_NOFOLLOW	0x10000	/* don't follow links */
19501f961124Saurel32 #define TARGET_O_NOATIME	0x100000
19511f961124Saurel32 #define TARGET_O_NDELAY	TARGET_O_NONBLOCK
1952ffa65c3bSbellard #else
1953ffa65c3bSbellard #define TARGET_O_ACCMODE          0003
1954ffa65c3bSbellard #define TARGET_O_RDONLY             00
1955ffa65c3bSbellard #define TARGET_O_WRONLY             01
1956ffa65c3bSbellard #define TARGET_O_RDWR               02
1957ffa65c3bSbellard #define TARGET_O_CREAT            0100 /* not fcntl */
1958ffa65c3bSbellard #define TARGET_O_EXCL             0200 /* not fcntl */
1959ffa65c3bSbellard #define TARGET_O_NOCTTY           0400 /* not fcntl */
1960ffa65c3bSbellard #define TARGET_O_TRUNC           01000 /* not fcntl */
1961ffa65c3bSbellard #define TARGET_O_APPEND          02000
1962ffa65c3bSbellard #define TARGET_O_NONBLOCK        04000
1963048f6b4dSbellard #define TARGET_O_NDELAY        TARGET_O_NONBLOCK
1964ffa65c3bSbellard #define TARGET_O_SYNC           010000
1965ffa65c3bSbellard #define TARGET_FASYNC           020000 /* fcntl, for BSD compatibility */
1966ffa65c3bSbellard #define TARGET_O_DIRECT         040000 /* direct disk access hint */
1967ffa65c3bSbellard #define TARGET_O_LARGEFILE     0100000
1968ffa65c3bSbellard #define TARGET_O_DIRECTORY     0200000 /* must be a directory */
1969ffa65c3bSbellard #define TARGET_O_NOFOLLOW      0400000 /* don't follow links */
1970ffa65c3bSbellard #endif
1971ffa65c3bSbellard 
19722521d698Sbellard struct target_flock {
19732521d698Sbellard 	short l_type;
19742521d698Sbellard 	short l_whence;
1975992f48a0Sblueswir1 	abi_ulong l_start;
1976992f48a0Sblueswir1 	abi_ulong l_len;
19772521d698Sbellard 	int l_pid;
19782521d698Sbellard };
19792521d698Sbellard 
19802521d698Sbellard struct target_flock64 {
19812521d698Sbellard 	short  l_type;
19822521d698Sbellard 	short  l_whence;
1983b779e29eSEdgar E. Iglesias #if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) || defined(TARGET_SPARC) || defined(TARGET_HPPA) || defined (TARGET_MICROBLAZE)
1984ce3f0e2fSaurel32         int __pad;
1985ce3f0e2fSaurel32 #endif
19862521d698Sbellard 	unsigned long long l_start;
19872521d698Sbellard 	unsigned long long l_len;
19882521d698Sbellard 	int  l_pid;
1989ce4defa0Spbrook }__attribute__((packed));
19902521d698Sbellard 
1991ce4defa0Spbrook #ifdef TARGET_ARM
1992ce4defa0Spbrook struct target_eabi_flock64 {
1993ce4defa0Spbrook 	short  l_type;
1994ce4defa0Spbrook 	short  l_whence;
1995ce4defa0Spbrook         int __pad;
1996ce4defa0Spbrook 	unsigned long long l_start;
1997ce4defa0Spbrook 	unsigned long long l_len;
1998ce4defa0Spbrook 	int  l_pid;
1999ce4defa0Spbrook }__attribute__((packed));
2000ce4defa0Spbrook #endif
20012521d698Sbellard 
20022521d698Sbellard /* soundcard defines */
20032521d698Sbellard /* XXX: convert them all to arch indepedent entries */
20042521d698Sbellard #define TARGET_SNDCTL_COPR_HALT           TARGET_IOWR('C',  7, int);
20052521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD           0xcfb04301
20062521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE          0xc0144303
20072521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG         0x8fa44309
20082521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA          0xc0144302
20092521d698Sbellard #define TARGET_SNDCTL_COPR_RESET          0x00004300
20102521d698Sbellard #define TARGET_SNDCTL_COPR_RUN            0xc0144306
20112521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG        0xcfa44308
20122521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE          0x40144305
20132521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA          0x40144304
20142521d698Sbellard #define TARGET_SNDCTL_DSP_RESET           TARGET_IO('P', 0)
20152521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC            TARGET_IO('P', 1)
20162521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED           TARGET_IOWR('P', 2, int)
20172521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO          TARGET_IOWR('P', 3, int)
20182521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE      TARGET_IOWR('P', 4, int)
20192521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT          TARGET_IOWR('P', 5, int)
20202521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS        TARGET_IOWR('P', 6, int)
20212521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER     TARGET_IOWR('P', 7, int)
20222521d698Sbellard #define TARGET_SNDCTL_DSP_POST            TARGET_IO('P', 8)
20232521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE       TARGET_IOWR('P', 9, int)
20242521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT     TARGET_IOWR('P',10, int)
20252521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS         TARGET_IOR('P', 11, int)
20262521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE       TARGET_IORU('P',12)
20272521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE       TARGET_IORU('P',13)
20282521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS         TARGET_IOR('P', 15, int)
20292521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER      TARGET_IOR('P',16, int)
20302521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR         TARGET_IORU('P',17)
20312521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR         TARGET_IORU('P',18)
20322521d698Sbellard #define TARGET_SNDCTL_DSP_MAPINBUF        0x80085013
20332521d698Sbellard #define TARGET_SNDCTL_DSP_MAPOUTBUF       0x80085014
20342521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK        0x0000500e
20352521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE      0xc0045005
20362521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX       0x00005016
20372521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO       0x00005015
20382521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER      0x40045010
20392521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE       0x4004510f
20402521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR       0x40285107
20412521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO           0xc074510c
20422521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD         0xc0216d02
20432521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE        0xc0046d01
20442521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME        0xc0046d00
20452521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS         0xcfb85110
20462521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE          0xcfb85001
20472521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE        0xc0045103
20482521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT      0x80045105
20492521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT     0x80045104
20502521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS         0x8004510b
20512521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS        0x8004510a
20522521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND       0x40085112
20532521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC           0x00005111
20542521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE        0x40045106
20552521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET           0x00005100
20562521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES    0x40045109
20572521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC            0x00005101
20582521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI        0x40045108
20592521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD       0x4004510d
20602521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD        0x4004510d
20612521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO          0xc08c5102
20622521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL        0xc004510e
20632521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE        0x00005404
20642521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME       0x40045407
20652521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT          0x40045408
20662521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE          0xc0045406
20672521d698Sbellard #define TARGET_SNDCTL_TMR_START           0x00005402
20682521d698Sbellard #define TARGET_SNDCTL_TMR_STOP            0x00005403
20692521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO           0xc0045405
20702521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE        0xc0045401
20712521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE        0x80045002
20722521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS    0x80045006
20732521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS        0x80045005
20742521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER      0x80045007
20752521d698Sbellard #define TARGET_SOUND_MIXER_INFO           TARGET_IOR ('M', 101, mixer_info)
20762521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS         0xc0804d66
20772521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1       TARGET_IOWR('M', 111, int)
20782521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2       TARGET_IOWR('M', 112, int)
20792521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3       TARGET_IOWR('M', 113, int)
20802521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4       TARGET_IOWR('M', 114, int)
20812521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5       TARGET_IOWR('M', 115, int)
20822521d698Sbellard 
20832521d698Sbellard #define TARGET_MIXER_READ(dev)	TARGET_IOR('M', dev, int)
20842521d698Sbellard 
20852521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME		TARGET_MIXER_READ(SOUND_MIXER_VOLUME)
20862521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS		TARGET_MIXER_READ(SOUND_MIXER_BASS)
20872521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE		TARGET_MIXER_READ(SOUND_MIXER_TREBLE)
20882521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH		TARGET_MIXER_READ(SOUND_MIXER_SYNTH)
20892521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM		TARGET_MIXER_READ(SOUND_MIXER_PCM)
20902521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER	        TARGET_MIXER_READ(SOUND_MIXER_SPEAKER)
20912521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE		TARGET_MIXER_READ(SOUND_MIXER_LINE)
20922521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC		TARGET_MIXER_READ(SOUND_MIXER_MIC)
20932521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD		TARGET_MIXER_READ(SOUND_MIXER_CD)
20942521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX		TARGET_MIXER_READ(SOUND_MIXER_IMIX)
20952521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM		TARGET_MIXER_READ(SOUND_MIXER_ALTPCM)
20962521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV		TARGET_MIXER_READ(SOUND_MIXER_RECLEV)
20972521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN		TARGET_MIXER_READ(SOUND_MIXER_IGAIN)
20982521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN		TARGET_MIXER_READ(SOUND_MIXER_OGAIN)
20992521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1		TARGET_MIXER_READ(SOUND_MIXER_LINE1)
21002521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2		TARGET_MIXER_READ(SOUND_MIXER_LINE2)
21012521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3		TARGET_MIXER_READ(SOUND_MIXER_LINE3)
21022521d698Sbellard 
21032521d698Sbellard /* Obsolete macros */
21042521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE		TARGET_MIXER_READ(SOUND_MIXER_MUTE)
21052521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE	        TARGET_MIXER_READ(SOUND_MIXER_ENHANCE)
21062521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD		TARGET_MIXER_READ(SOUND_MIXER_LOUD)
21072521d698Sbellard 
21082521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC		TARGET_MIXER_READ(SOUND_MIXER_RECSRC)
21092521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK	        TARGET_MIXER_READ(SOUND_MIXER_DEVMASK)
21102521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK	        TARGET_MIXER_READ(SOUND_MIXER_RECMASK)
21112521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS	TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS)
21122521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS		TARGET_MIXER_READ(SOUND_MIXER_CAPS)
21132521d698Sbellard 
21142521d698Sbellard #define TARGET_MIXER_WRITE(dev)		TARGET_IOWR('M', dev, int)
21152521d698Sbellard 
21162521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME	TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME)
21172521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS		TARGET_MIXER_WRITE(SOUND_MIXER_BASS)
21182521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE	TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE)
21192521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH		TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH)
21202521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM		TARGET_MIXER_WRITE(SOUND_MIXER_PCM)
21212521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER	TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER)
21222521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE		TARGET_MIXER_WRITE(SOUND_MIXER_LINE)
21232521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC		TARGET_MIXER_WRITE(SOUND_MIXER_MIC)
21242521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD		TARGET_MIXER_WRITE(SOUND_MIXER_CD)
21252521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX		TARGET_MIXER_WRITE(SOUND_MIXER_IMIX)
21262521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM	TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM)
21272521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV	TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV)
21282521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN		TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN)
21292521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN		TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN)
21302521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1		TARGET_MIXER_WRITE(SOUND_MIXER_LINE1)
21312521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2		TARGET_MIXER_WRITE(SOUND_MIXER_LINE2)
21322521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3		TARGET_MIXER_WRITE(SOUND_MIXER_LINE3)
21332521d698Sbellard 
21342521d698Sbellard /* Obsolete macros */
21352521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE		TARGET_MIXER_WRITE(SOUND_MIXER_MUTE)
21362521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE	TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE)
21372521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD		TARGET_MIXER_WRITE(SOUND_MIXER_LOUD)
21382521d698Sbellard 
21392521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC	TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC)
21402521d698Sbellard 
21412521d698Sbellard /* vfat ioctls */
21422521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH    TARGET_IORU('r', 1)
21432521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT   TARGET_IORU('r', 2)
2144a5448a7dSbellard 
21458fbd6b52Sbalrog #define TARGET_MTIOCTOP        TARGET_IOW('m', 1, struct mtop)
21468fbd6b52Sbalrog #define TARGET_MTIOCGET        TARGET_IOR('m', 2, struct mtget)
21478fbd6b52Sbalrog #define TARGET_MTIOCPOS        TARGET_IOR('m', 3, struct mtpos)
21488fbd6b52Sbalrog 
2149a5448a7dSbellard struct target_sysinfo {
2150992f48a0Sblueswir1     abi_long uptime;                /* Seconds since boot */
2151992f48a0Sblueswir1     abi_ulong loads[3];             /* 1, 5, and 15 minute load averages */
2152992f48a0Sblueswir1     abi_ulong totalram;             /* Total usable main memory size */
2153992f48a0Sblueswir1     abi_ulong freeram;              /* Available memory size */
2154992f48a0Sblueswir1     abi_ulong sharedram;            /* Amount of shared memory */
2155992f48a0Sblueswir1     abi_ulong bufferram;            /* Memory used by buffers */
2156992f48a0Sblueswir1     abi_ulong totalswap;            /* Total swap space size */
2157992f48a0Sblueswir1     abi_ulong freeswap;             /* swap space still available */
2158a5448a7dSbellard     unsigned short procs;           /* Number of current processes */
2159a5448a7dSbellard     unsigned short pad;             /* explicit padding for m68k */
2160992f48a0Sblueswir1     abi_ulong totalhigh;            /* Total high memory size */
2161992f48a0Sblueswir1     abi_ulong freehigh;             /* Available high memory size */
2162a5448a7dSbellard     unsigned int mem_unit;          /* Memory unit size in bytes */
2163992f48a0Sblueswir1     char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */
2164a5448a7dSbellard };
21653532fa74Sbellard 
21666556a833Saurel32 struct linux_dirent {
21676556a833Saurel32     long            d_ino;
21686556a833Saurel32     unsigned long   d_off;
21696556a833Saurel32     unsigned short  d_reclen;
21706556a833Saurel32     char            d_name[256]; /* We must not include limits.h! */
21716556a833Saurel32 };
21726556a833Saurel32 
21736556a833Saurel32 struct linux_dirent64 {
21746556a833Saurel32     uint64_t        d_ino;
21756556a833Saurel32     int64_t         d_off;
21766556a833Saurel32     unsigned short  d_reclen;
21776556a833Saurel32     unsigned char   d_type;
21786556a833Saurel32     char            d_name[256];
21796556a833Saurel32 };
21806556a833Saurel32 
218124e1003aSaurel32 struct target_mq_attr {
218224e1003aSaurel32     abi_long mq_flags;
218324e1003aSaurel32     abi_long mq_maxmsg;
218424e1003aSaurel32     abi_long mq_msgsize;
218524e1003aSaurel32     abi_long mq_curmsgs;
218624e1003aSaurel32 };
218724e1003aSaurel32 
21883532fa74Sbellard #include "socket.h"
2189637947f1Sths 
2190637947f1Sths #include "errno_defs.h"
219103dfe9f8SRiku Voipio 
219203dfe9f8SRiku Voipio #define FUTEX_WAIT              0
219303dfe9f8SRiku Voipio #define FUTEX_WAKE              1
219403dfe9f8SRiku Voipio #define FUTEX_FD                2
219503dfe9f8SRiku Voipio #define FUTEX_REQUEUE           3
219603dfe9f8SRiku Voipio #define FUTEX_CMP_REQUEUE       4
219703dfe9f8SRiku Voipio #define FUTEX_WAKE_OP           5
219803dfe9f8SRiku Voipio #define FUTEX_LOCK_PI           6
219903dfe9f8SRiku Voipio #define FUTEX_UNLOCK_PI         7
220003dfe9f8SRiku Voipio #define FUTEX_TRYLOCK_PI        8
220103dfe9f8SRiku Voipio #define FUTEX_WAIT_BITSET       9
220203dfe9f8SRiku Voipio #define FUTEX_WAKE_BITSET       10
220303dfe9f8SRiku Voipio 
220403dfe9f8SRiku Voipio #define FUTEX_PRIVATE_FLAG      128
220503dfe9f8SRiku Voipio #define FUTEX_CLOCK_REALTIME    256
220603dfe9f8SRiku Voipio #define FUTEX_CMD_MASK          ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)
220703dfe9f8SRiku Voipio 
2208