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) \ 5274d753acSMika Westerberg || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) 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 339048f6b4dSbellard #else 3402521d698Sbellard #define TARGET_SA_NOCLDSTOP 0x00000001 3412521d698Sbellard #define TARGET_SA_NOCLDWAIT 0x00000002 /* not supported yet */ 3422521d698Sbellard #define TARGET_SA_SIGINFO 0x00000004 3432521d698Sbellard #define TARGET_SA_ONSTACK 0x08000000 3442521d698Sbellard #define TARGET_SA_RESTART 0x10000000 3452521d698Sbellard #define TARGET_SA_NODEFER 0x40000000 3462521d698Sbellard #define TARGET_SA_RESETHAND 0x80000000 3472521d698Sbellard #define TARGET_SA_RESTORER 0x04000000 3486d5e216dSbellard #endif 3496d5e216dSbellard 3506d5e216dSbellard #if defined(TARGET_SPARC) 3516d5e216dSbellard 3526d5e216dSbellard #define TARGET_SIGHUP 1 3536d5e216dSbellard #define TARGET_SIGINT 2 3546d5e216dSbellard #define TARGET_SIGQUIT 3 3556d5e216dSbellard #define TARGET_SIGILL 4 3566d5e216dSbellard #define TARGET_SIGTRAP 5 3576d5e216dSbellard #define TARGET_SIGABRT 6 3586d5e216dSbellard #define TARGET_SIGIOT 6 3596d5e216dSbellard #define TARGET_SIGSTKFLT 7 /* actually EMT */ 3606d5e216dSbellard #define TARGET_SIGFPE 8 3616d5e216dSbellard #define TARGET_SIGKILL 9 3626d5e216dSbellard #define TARGET_SIGBUS 10 3636d5e216dSbellard #define TARGET_SIGSEGV 11 3646d5e216dSbellard #define TARGET_SIGSYS 12 3656d5e216dSbellard #define TARGET_SIGPIPE 13 3666d5e216dSbellard #define TARGET_SIGALRM 14 3676d5e216dSbellard #define TARGET_SIGTERM 15 3686d5e216dSbellard #define TARGET_SIGURG 16 3696d5e216dSbellard #define TARGET_SIGSTOP 17 3706d5e216dSbellard #define TARGET_SIGTSTP 18 3716d5e216dSbellard #define TARGET_SIGCONT 19 3726d5e216dSbellard #define TARGET_SIGCHLD 20 3736d5e216dSbellard #define TARGET_SIGTTIN 21 3746d5e216dSbellard #define TARGET_SIGTTOU 22 3756d5e216dSbellard #define TARGET_SIGIO 23 3766d5e216dSbellard #define TARGET_SIGXCPU 24 3776d5e216dSbellard #define TARGET_SIGXFSZ 25 3786d5e216dSbellard #define TARGET_SIGVTALRM 26 3796d5e216dSbellard #define TARGET_SIGPROF 27 3806d5e216dSbellard #define TARGET_SIGWINCH 28 3816d5e216dSbellard #define TARGET_SIGPWR 29 3826d5e216dSbellard #define TARGET_SIGUSR1 30 3836d5e216dSbellard #define TARGET_SIGUSR2 31 3846d5e216dSbellard #define TARGET_SIGRTMIN 32 3856d5e216dSbellard 3866d5e216dSbellard #define TARGET_SIG_BLOCK 0x01 /* for blocking signals */ 3876d5e216dSbellard #define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */ 3886d5e216dSbellard #define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */ 3896d5e216dSbellard 390048f6b4dSbellard #elif defined(TARGET_MIPS) 391048f6b4dSbellard 392048f6b4dSbellard #define TARGET_SIGHUP 1 /* Hangup (POSIX). */ 393048f6b4dSbellard #define TARGET_SIGINT 2 /* Interrupt (ANSI). */ 394048f6b4dSbellard #define TARGET_SIGQUIT 3 /* Quit (POSIX). */ 395048f6b4dSbellard #define TARGET_SIGILL 4 /* Illegal instruction (ANSI). */ 396048f6b4dSbellard #define TARGET_SIGTRAP 5 /* Trace trap (POSIX). */ 397048f6b4dSbellard #define TARGET_SIGIOT 6 /* IOT trap (4.2 BSD). */ 398048f6b4dSbellard #define TARGET_SIGABRT TARGET_SIGIOT /* Abort (ANSI). */ 399048f6b4dSbellard #define TARGET_SIGEMT 7 400048f6b4dSbellard #define TARGET_SIGSTKFLT 7 /* XXX: incorrect */ 401048f6b4dSbellard #define TARGET_SIGFPE 8 /* Floating-point exception (ANSI). */ 402048f6b4dSbellard #define TARGET_SIGKILL 9 /* Kill, unblockable (POSIX). */ 403048f6b4dSbellard #define TARGET_SIGBUS 10 /* BUS error (4.2 BSD). */ 404048f6b4dSbellard #define TARGET_SIGSEGV 11 /* Segmentation violation (ANSI). */ 405048f6b4dSbellard #define TARGET_SIGSYS 12 406048f6b4dSbellard #define TARGET_SIGPIPE 13 /* Broken pipe (POSIX). */ 407048f6b4dSbellard #define TARGET_SIGALRM 14 /* Alarm clock (POSIX). */ 408048f6b4dSbellard #define TARGET_SIGTERM 15 /* Termination (ANSI). */ 409048f6b4dSbellard #define TARGET_SIGUSR1 16 /* User-defined signal 1 (POSIX). */ 410048f6b4dSbellard #define TARGET_SIGUSR2 17 /* User-defined signal 2 (POSIX). */ 411048f6b4dSbellard #define TARGET_SIGCHLD 18 /* Child status has changed (POSIX). */ 412048f6b4dSbellard #define TARGET_SIGCLD TARGET_SIGCHLD /* Same as TARGET_SIGCHLD (System V). */ 413048f6b4dSbellard #define TARGET_SIGPWR 19 /* Power failure restart (System V). */ 414048f6b4dSbellard #define TARGET_SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */ 415048f6b4dSbellard #define TARGET_SIGURG 21 /* Urgent condition on socket (4.2 BSD). */ 416048f6b4dSbellard #define TARGET_SIGIO 22 /* I/O now possible (4.2 BSD). */ 417048f6b4dSbellard #define TARGET_SIGPOLL TARGET_SIGIO /* Pollable event occurred (System V). */ 418048f6b4dSbellard #define TARGET_SIGSTOP 23 /* Stop, unblockable (POSIX). */ 419048f6b4dSbellard #define TARGET_SIGTSTP 24 /* Keyboard stop (POSIX). */ 420048f6b4dSbellard #define TARGET_SIGCONT 25 /* Continue (POSIX). */ 421048f6b4dSbellard #define TARGET_SIGTTIN 26 /* Background read from tty (POSIX). */ 422048f6b4dSbellard #define TARGET_SIGTTOU 27 /* Background write to tty (POSIX). */ 423048f6b4dSbellard #define TARGET_SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */ 424048f6b4dSbellard #define TARGET_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */ 425048f6b4dSbellard #define TARGET_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ 426048f6b4dSbellard #define TARGET_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ 427048f6b4dSbellard #define TARGET_SIGRTMIN 32 428048f6b4dSbellard 429048f6b4dSbellard #define TARGET_SIG_BLOCK 1 /* for blocking signals */ 430048f6b4dSbellard #define TARGET_SIG_UNBLOCK 2 /* for unblocking signals */ 431048f6b4dSbellard #define TARGET_SIG_SETMASK 3 /* for setting the signal mask */ 432048f6b4dSbellard 4336d5e216dSbellard #else 4342521d698Sbellard 4352521d698Sbellard #define TARGET_SIGHUP 1 4362521d698Sbellard #define TARGET_SIGINT 2 4372521d698Sbellard #define TARGET_SIGQUIT 3 4382521d698Sbellard #define TARGET_SIGILL 4 4392521d698Sbellard #define TARGET_SIGTRAP 5 4402521d698Sbellard #define TARGET_SIGABRT 6 4412521d698Sbellard #define TARGET_SIGIOT 6 4422521d698Sbellard #define TARGET_SIGBUS 7 4432521d698Sbellard #define TARGET_SIGFPE 8 4442521d698Sbellard #define TARGET_SIGKILL 9 4452521d698Sbellard #define TARGET_SIGUSR1 10 4462521d698Sbellard #define TARGET_SIGSEGV 11 4472521d698Sbellard #define TARGET_SIGUSR2 12 4482521d698Sbellard #define TARGET_SIGPIPE 13 4492521d698Sbellard #define TARGET_SIGALRM 14 4502521d698Sbellard #define TARGET_SIGTERM 15 4512521d698Sbellard #define TARGET_SIGSTKFLT 16 4522521d698Sbellard #define TARGET_SIGCHLD 17 4532521d698Sbellard #define TARGET_SIGCONT 18 4542521d698Sbellard #define TARGET_SIGSTOP 19 4552521d698Sbellard #define TARGET_SIGTSTP 20 4562521d698Sbellard #define TARGET_SIGTTIN 21 4572521d698Sbellard #define TARGET_SIGTTOU 22 4582521d698Sbellard #define TARGET_SIGURG 23 4592521d698Sbellard #define TARGET_SIGXCPU 24 4602521d698Sbellard #define TARGET_SIGXFSZ 25 4612521d698Sbellard #define TARGET_SIGVTALRM 26 4622521d698Sbellard #define TARGET_SIGPROF 27 4632521d698Sbellard #define TARGET_SIGWINCH 28 4642521d698Sbellard #define TARGET_SIGIO 29 465c596ed17Sbellard #define TARGET_SIGPWR 30 466c596ed17Sbellard #define TARGET_SIGSYS 31 4672521d698Sbellard #define TARGET_SIGRTMIN 32 4682521d698Sbellard 4692521d698Sbellard #define TARGET_SIG_BLOCK 0 /* for blocking signals */ 4702521d698Sbellard #define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */ 4712521d698Sbellard #define TARGET_SIG_SETMASK 2 /* for setting the signal mask */ 4722521d698Sbellard 4736d5e216dSbellard #endif 4746d5e216dSbellard 475106ec879Sbellard #if defined(TARGET_MIPS) 476106ec879Sbellard 477106ec879Sbellard struct target_sigaction { 478540635baSths uint32_t sa_flags; 479d26bc211Sths #if defined(TARGET_ABI_MIPSN32) 480540635baSths uint32_t _sa_handler; 481540635baSths #else 482992f48a0Sblueswir1 abi_ulong _sa_handler; 483540635baSths #endif 484c227f099SAnthony Liguori target_sigset_t sa_mask; 485106ec879Sbellard }; 486106ec879Sbellard 487106ec879Sbellard #else 4882521d698Sbellard struct target_old_sigaction { 489992f48a0Sblueswir1 abi_ulong _sa_handler; 490992f48a0Sblueswir1 abi_ulong sa_mask; 491992f48a0Sblueswir1 abi_ulong sa_flags; 492992f48a0Sblueswir1 abi_ulong sa_restorer; 4932521d698Sbellard }; 4942521d698Sbellard 4952521d698Sbellard struct target_sigaction { 496992f48a0Sblueswir1 abi_ulong _sa_handler; 497992f48a0Sblueswir1 abi_ulong sa_flags; 498992f48a0Sblueswir1 abi_ulong sa_restorer; 499c227f099SAnthony Liguori target_sigset_t sa_mask; 5002521d698Sbellard }; 501106ec879Sbellard #endif 5022521d698Sbellard 5032521d698Sbellard typedef union target_sigval { 5042521d698Sbellard int sival_int; 505992f48a0Sblueswir1 abi_ulong sival_ptr; 506c227f099SAnthony Liguori } target_sigval_t; 5076d5e216dSbellard #if 0 5086d5e216dSbellard #if defined (TARGET_SPARC) 5096d5e216dSbellard typedef struct { 5106d5e216dSbellard struct { 511992f48a0Sblueswir1 abi_ulong psr; 512992f48a0Sblueswir1 abi_ulong pc; 513992f48a0Sblueswir1 abi_ulong npc; 514992f48a0Sblueswir1 abi_ulong y; 515992f48a0Sblueswir1 abi_ulong u_regs[16]; /* globals and ins */ 5166d5e216dSbellard } si_regs; 5176d5e216dSbellard int si_mask; 5186d5e216dSbellard } __siginfo_t; 5196d5e216dSbellard 5206d5e216dSbellard typedef struct { 5216d5e216dSbellard unsigned long si_float_regs [32]; 5226d5e216dSbellard unsigned long si_fsr; 5236d5e216dSbellard unsigned long si_fpqdepth; 5246d5e216dSbellard struct { 5256d5e216dSbellard unsigned long *insn_addr; 5266d5e216dSbellard unsigned long insn; 5276d5e216dSbellard } si_fpqueue [16]; 5286d5e216dSbellard } __siginfo_fpu_t; 5296d5e216dSbellard #endif 5306d5e216dSbellard #endif 5312521d698Sbellard 5322521d698Sbellard #define TARGET_SI_MAX_SIZE 128 5332521d698Sbellard #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE/sizeof(int)) - 3) 5342521d698Sbellard 5352521d698Sbellard typedef struct target_siginfo { 5363f53d546Spbrook #ifdef TARGET_MIPS 5373f53d546Spbrook int si_signo; 5383f53d546Spbrook int si_code; 5393f53d546Spbrook int si_errno; 5403f53d546Spbrook #else 5412521d698Sbellard int si_signo; 5422521d698Sbellard int si_errno; 5432521d698Sbellard int si_code; 5443f53d546Spbrook #endif 5452521d698Sbellard 5462521d698Sbellard union { 5472521d698Sbellard int _pad[TARGET_SI_PAD_SIZE]; 5482521d698Sbellard 5492521d698Sbellard /* kill() */ 5502521d698Sbellard struct { 5512521d698Sbellard pid_t _pid; /* sender's pid */ 5522521d698Sbellard uid_t _uid; /* sender's uid */ 5532521d698Sbellard } _kill; 5542521d698Sbellard 5552521d698Sbellard /* POSIX.1b timers */ 5562521d698Sbellard struct { 5572521d698Sbellard unsigned int _timer1; 5582521d698Sbellard unsigned int _timer2; 5592521d698Sbellard } _timer; 5602521d698Sbellard 5612521d698Sbellard /* POSIX.1b signals */ 5622521d698Sbellard struct { 5632521d698Sbellard pid_t _pid; /* sender's pid */ 5642521d698Sbellard uid_t _uid; /* sender's uid */ 565c227f099SAnthony Liguori target_sigval_t _sigval; 5662521d698Sbellard } _rt; 5672521d698Sbellard 5682521d698Sbellard /* SIGCHLD */ 5692521d698Sbellard struct { 5702521d698Sbellard pid_t _pid; /* which child */ 5712521d698Sbellard uid_t _uid; /* sender's uid */ 5722521d698Sbellard int _status; /* exit code */ 573c227f099SAnthony Liguori target_clock_t _utime; 574c227f099SAnthony Liguori target_clock_t _stime; 5752521d698Sbellard } _sigchld; 5762521d698Sbellard 5772521d698Sbellard /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 5782521d698Sbellard struct { 579992f48a0Sblueswir1 abi_ulong _addr; /* faulting insn/memory ref. */ 5802521d698Sbellard } _sigfault; 5812521d698Sbellard 5822521d698Sbellard /* SIGPOLL */ 5832521d698Sbellard struct { 5842521d698Sbellard int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 5852521d698Sbellard int _fd; 5862521d698Sbellard } _sigpoll; 5872521d698Sbellard } _sifields; 588c227f099SAnthony Liguori } target_siginfo_t; 5892521d698Sbellard 5902521d698Sbellard /* 5912521d698Sbellard * si_code values 5922521d698Sbellard * Digital reserves positive values for kernel-generated signals. 5932521d698Sbellard */ 5942521d698Sbellard #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ 5952521d698Sbellard #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 5962521d698Sbellard #define TARGET_SI_QUEUE -1 /* sent by sigqueue */ 5972521d698Sbellard #define TARGET_SI_TIMER -2 /* sent by timer expiration */ 5982521d698Sbellard #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ 5992521d698Sbellard #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ 6002521d698Sbellard #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ 6012521d698Sbellard 6022521d698Sbellard /* 6032521d698Sbellard * SIGILL si_codes 6042521d698Sbellard */ 605ffa65c3bSbellard #define TARGET_ILL_ILLOPC (1) /* illegal opcode */ 6062521d698Sbellard #define TARGET_ILL_ILLOPN (2) /* illegal operand */ 607ffa65c3bSbellard #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ 608ffa65c3bSbellard #define TARGET_ILL_ILLTRP (4) /* illegal trap */ 609ffa65c3bSbellard #define TARGET_ILL_PRVOPC (5) /* privileged opcode */ 610ffa65c3bSbellard #define TARGET_ILL_PRVREG (6) /* privileged register */ 611ffa65c3bSbellard #define TARGET_ILL_COPROC (7) /* coprocessor error */ 612ffa65c3bSbellard #define TARGET_ILL_BADSTK (8) /* internal stack error */ 6132521d698Sbellard 6142521d698Sbellard /* 6152521d698Sbellard * SIGFPE si_codes 6162521d698Sbellard */ 6172521d698Sbellard #define TARGET_FPE_INTDIV (1) /* integer divide by zero */ 6182521d698Sbellard #define TARGET_FPE_INTOVF (2) /* integer overflow */ 6192521d698Sbellard #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ 6202521d698Sbellard #define TARGET_FPE_FLTOVF (4) /* floating point overflow */ 6212521d698Sbellard #define TARGET_FPE_FLTUND (5) /* floating point underflow */ 6222521d698Sbellard #define TARGET_FPE_FLTRES (6) /* floating point inexact result */ 6232521d698Sbellard #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ 6242521d698Sbellard #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ 6252521d698Sbellard #define TARGET_NSIGFPE 8 6262521d698Sbellard 6272521d698Sbellard /* 6282521d698Sbellard * SIGSEGV si_codes 6292521d698Sbellard */ 6302521d698Sbellard #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ 6312521d698Sbellard #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ 6322521d698Sbellard 6332521d698Sbellard /* 634ffa65c3bSbellard * SIGBUS si_codes 635ffa65c3bSbellard */ 636ffa65c3bSbellard #define TARGET_BUS_ADRALN (1) /* invalid address alignment */ 637ffa65c3bSbellard #define TARGET_BUS_ADRERR (2) /* non-existant physical address */ 638ffa65c3bSbellard #define TARGET_BUS_OBJERR (3) /* object specific hardware error */ 639ffa65c3bSbellard 640ffa65c3bSbellard /* 6412521d698Sbellard * SIGTRAP si_codes 6422521d698Sbellard */ 6432521d698Sbellard #define TARGET_TRAP_BRKPT (1) /* process breakpoint */ 6442521d698Sbellard #define TARGET_TRAP_TRACE (2) /* process trace trap */ 6452521d698Sbellard 6462521d698Sbellard #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */ 6472521d698Sbellard 6489de5e440Sbellard struct target_rlimit { 649992f48a0Sblueswir1 abi_ulong rlim_cur; 650992f48a0Sblueswir1 abi_ulong rlim_max; 6519de5e440Sbellard }; 6529de5e440Sbellard 6539de5e440Sbellard struct target_pollfd { 6549de5e440Sbellard int fd; /* file descriptor */ 6559de5e440Sbellard short events; /* requested events */ 6569de5e440Sbellard short revents; /* returned events */ 6579de5e440Sbellard }; 6589de5e440Sbellard 6598e5a0667Sbellard /* virtual terminal ioctls */ 6600221cfcdSbellard #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ 6610221cfcdSbellard #define TARGET_KDMKTONE 0x4B30 /* generate tone */ 6628e5a0667Sbellard #define TARGET_KDGKBTYPE 0x4b33 6630221cfcdSbellard #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ 6640221cfcdSbellard #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ 6658e5a0667Sbellard 6662521d698Sbellard #define TARGET_SIOCATMARK 0x8905 6672521d698Sbellard 66831e31b8aSbellard /* Networking ioctls */ 66931e31b8aSbellard #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ 67031e31b8aSbellard #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ 67131e31b8aSbellard #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ 67231e31b8aSbellard #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ 67331e31b8aSbellard #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ 67431e31b8aSbellard #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ 67531e31b8aSbellard #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ 67631e31b8aSbellard #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ 67731e31b8aSbellard #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ 67831e31b8aSbellard #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ 67931e31b8aSbellard #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ 68031e31b8aSbellard #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ 68131e31b8aSbellard #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ 68231e31b8aSbellard #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ 68331e31b8aSbellard #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ 68431e31b8aSbellard #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ 68531e31b8aSbellard #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ 68631e31b8aSbellard #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ 68731e31b8aSbellard #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ 68831e31b8aSbellard #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ 68931e31b8aSbellard #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ 69031e31b8aSbellard #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ 69131e31b8aSbellard #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ 69231e31b8aSbellard #define TARGET_SIOCSIFENCAP 0x8926 69331e31b8aSbellard #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ 69431e31b8aSbellard #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ 69531e31b8aSbellard #define TARGET_SIOCSIFSLAVE 0x8930 69631e31b8aSbellard #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ 69731e31b8aSbellard #define TARGET_SIOCDELMULTI 0x8932 69831e31b8aSbellard 69931e31b8aSbellard /* Bridging control calls */ 70031e31b8aSbellard #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ 70131e31b8aSbellard #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ 70231e31b8aSbellard 70331e31b8aSbellard #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ 70431e31b8aSbellard #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ 70531e31b8aSbellard 70631e31b8aSbellard /* ARP cache control calls. */ 70731e31b8aSbellard #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ 70831e31b8aSbellard #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ 70931e31b8aSbellard #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ 71031e31b8aSbellard #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ 71131e31b8aSbellard #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ 71231e31b8aSbellard #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ 71331e31b8aSbellard 71431e31b8aSbellard /* RARP cache control calls. */ 71531e31b8aSbellard #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ 71631e31b8aSbellard #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ 71731e31b8aSbellard #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ 71831e31b8aSbellard 71931e31b8aSbellard /* Driver configuration calls */ 72031e31b8aSbellard #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ 72131e31b8aSbellard #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ 72231e31b8aSbellard 72331e31b8aSbellard /* DLCI configuration calls */ 72431e31b8aSbellard #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ 72531e31b8aSbellard #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ 72631e31b8aSbellard 72731e31b8aSbellard 72831e31b8aSbellard /* From <linux/fs.h> */ 72931e31b8aSbellard 73031e31b8aSbellard #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ 73131e31b8aSbellard #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ 73231e31b8aSbellard #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ 73331e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ 73431e31b8aSbellard #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ 73531e31b8aSbellard #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ 73631e31b8aSbellard #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ 73731e31b8aSbellard #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ 73831e31b8aSbellard #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ 73931e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ 74031e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ 74131e31b8aSbellard #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ 74231e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */ 74331e31b8aSbellard #define TARGET_BLKBSZGET TARGET_IOR(0x12,112,sizeof(int)) 74431e31b8aSbellard #define TARGET_BLKBSZSET TARGET_IOW(0x12,113,sizeof(int)) 74531e31b8aSbellard #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,sizeof(uint64_t)) /* return device size in bytes (u64 *arg) */ 74631e31b8aSbellard #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ 74731e31b8aSbellard #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ 74831e31b8aSbellard 74931e31b8aSbellard /* cdrom commands */ 75031e31b8aSbellard #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ 75131e31b8aSbellard #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ 75231e31b8aSbellard #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ 75331e31b8aSbellard #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index 75431e31b8aSbellard (struct cdrom_ti) */ 75531e31b8aSbellard #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header 75631e31b8aSbellard (struct cdrom_tochdr) */ 75731e31b8aSbellard #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry 75831e31b8aSbellard (struct cdrom_tocentry) */ 75931e31b8aSbellard #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ 76031e31b8aSbellard #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ 76131e31b8aSbellard #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ 76231e31b8aSbellard #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume 76331e31b8aSbellard (struct cdrom_volctrl) */ 76431e31b8aSbellard #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data 76531e31b8aSbellard (struct cdrom_subchnl) */ 76631e31b8aSbellard #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) 76731e31b8aSbellard (struct cdrom_read) */ 76831e31b8aSbellard #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) 76931e31b8aSbellard (struct cdrom_read) */ 77031e31b8aSbellard #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ 77131e31b8aSbellard #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ 77231e31b8aSbellard #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session 77331e31b8aSbellard address of multi session disks 77431e31b8aSbellard (struct cdrom_multisession) */ 77531e31b8aSbellard #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" 77631e31b8aSbellard if available (struct cdrom_mcn) */ 77731e31b8aSbellard #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is depricated, 77831e31b8aSbellard but here anyway for compatability */ 77931e31b8aSbellard #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ 78031e31b8aSbellard #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting 78131e31b8aSbellard (struct cdrom_volctrl) */ 78231e31b8aSbellard #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) 78331e31b8aSbellard (struct cdrom_read) */ 78431e31b8aSbellard /* 78531e31b8aSbellard * These ioctls are used only used in aztcd.c and optcd.c 78631e31b8aSbellard */ 78731e31b8aSbellard #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ 78831e31b8aSbellard #define TARGET_CDROMSEEK 0x5316 /* seek msf address */ 78931e31b8aSbellard 79031e31b8aSbellard /* 79131e31b8aSbellard * This ioctl is only used by the scsi-cd driver. 79231e31b8aSbellard It is for playing audio in logical block addressing mode. 79331e31b8aSbellard */ 79431e31b8aSbellard #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ 79531e31b8aSbellard 79631e31b8aSbellard /* 79731e31b8aSbellard * These ioctls are only used in optcd.c 79831e31b8aSbellard */ 79931e31b8aSbellard #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ 80031e31b8aSbellard 80131e31b8aSbellard /* 80231e31b8aSbellard * These ioctls are (now) only in ide-cd.c for controlling 80331e31b8aSbellard * drive spindown time. They should be implemented in the 80431e31b8aSbellard * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, 80531e31b8aSbellard * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... 80631e31b8aSbellard * -Erik 80731e31b8aSbellard */ 80831e31b8aSbellard #define TARGET_CDROMGETSPINDOWN 0x531d 80931e31b8aSbellard #define TARGET_CDROMSETSPINDOWN 0x531e 81031e31b8aSbellard 81131e31b8aSbellard /* 81231e31b8aSbellard * These ioctls are implemented through the uniform CD-ROM driver 81331e31b8aSbellard * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM 81431e31b8aSbellard * drivers are eventually ported to the uniform CD-ROM driver interface. 81531e31b8aSbellard */ 81631e31b8aSbellard #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ 81731e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ 81831e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ 81931e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ 82031e31b8aSbellard #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ 82131e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ 82231e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ 82331e31b8aSbellard #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ 82431e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ 82531e31b8aSbellard #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ 82631e31b8aSbellard #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ 82731e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ 82831e31b8aSbellard 82931e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. 83031e31b8aSbellard * Future CDROM ioctls should be kept below 0x537F 83131e31b8aSbellard */ 83231e31b8aSbellard 83331e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */ 83431e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ 83531e31b8aSbellard /* conflict with SCSI_IOCTL_GET_IDLUN */ 83631e31b8aSbellard 83731e31b8aSbellard /* DVD-ROM Specific ioctls */ 83831e31b8aSbellard #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ 83931e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ 84031e31b8aSbellard #define TARGET_DVD_AUTH 0x5392 /* Authentication */ 84131e31b8aSbellard 84231e31b8aSbellard #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ 84331e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ 84431e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ 84531e31b8aSbellard 84631e31b8aSbellard /* HD commands */ 84731e31b8aSbellard 84831e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ 84931e31b8aSbellard #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ 85031e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ 85131e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ 85231e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ 85331e31b8aSbellard #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ 85431e31b8aSbellard #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ 85531e31b8aSbellard #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ 8562521d698Sbellard #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ 85731e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ 85831e31b8aSbellard 85931e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ 86031e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ 86131e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ 86231e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ 86331e31b8aSbellard #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ 86431e31b8aSbellard #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ 86531e31b8aSbellard #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ 86631e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ 8672521d698Sbellard 868b8005914Sbalrog /* loop ioctls */ 869b8005914Sbalrog #define TARGET_LOOP_SET_FD 0x4C00 870b8005914Sbalrog #define TARGET_LOOP_CLR_FD 0x4C01 871b8005914Sbalrog #define TARGET_LOOP_SET_STATUS 0x4C02 872b8005914Sbalrog #define TARGET_LOOP_GET_STATUS 0x4C03 873b8005914Sbalrog #define TARGET_LOOP_SET_STATUS64 0x4C04 874b8005914Sbalrog #define TARGET_LOOP_GET_STATUS64 0x4C05 875b8005914Sbalrog #define TARGET_LOOP_CHANGE_FD 0x4C06 8762521d698Sbellard 8772521d698Sbellard /* from asm/termbits.h */ 8782521d698Sbellard 8793bfd9da1Sbellard #define TARGET_NCC 8 8803bfd9da1Sbellard struct target_termio { 8813bfd9da1Sbellard unsigned short c_iflag; /* input mode flags */ 8823bfd9da1Sbellard unsigned short c_oflag; /* output mode flags */ 8833bfd9da1Sbellard unsigned short c_cflag; /* control mode flags */ 8843bfd9da1Sbellard unsigned short c_lflag; /* local mode flags */ 8852521d698Sbellard unsigned char c_line; /* line discipline */ 8863bfd9da1Sbellard unsigned char c_cc[TARGET_NCC]; /* control characters */ 8872521d698Sbellard }; 8882521d698Sbellard 8893bfd9da1Sbellard struct target_winsize { 8903bfd9da1Sbellard unsigned short ws_row; 8913bfd9da1Sbellard unsigned short ws_col; 8923bfd9da1Sbellard unsigned short ws_xpixel; 8933bfd9da1Sbellard unsigned short ws_ypixel; 8943bfd9da1Sbellard }; 8952521d698Sbellard 8963bfd9da1Sbellard #include "termbits.h" 8972521d698Sbellard 898e44a3e79Saurel32 /* Common */ 8992521d698Sbellard #define TARGET_MAP_SHARED 0x01 /* Share changes */ 9002521d698Sbellard #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ 9012521d698Sbellard #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ 902e44a3e79Saurel32 903e44a3e79Saurel32 /* Target specific */ 904048f6b4dSbellard #if defined(TARGET_MIPS) 905e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 906048f6b4dSbellard #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 907048f6b4dSbellard #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 908048f6b4dSbellard #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 909048f6b4dSbellard #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 910048f6b4dSbellard #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 911048f6b4dSbellard #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 912540635baSths #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 913540635baSths #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 914e44a3e79Saurel32 #elif defined(TARGET_PPC) 915e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 9162521d698Sbellard #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 9172521d698Sbellard #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 9182521d698Sbellard #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 9192521d698Sbellard #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 9207ec93196Sj_mayer #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ 9217ec93196Sj_mayer #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ 922e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 923e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 924e44a3e79Saurel32 #elif defined(TARGET_ALPHA) 925e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 926e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ 927e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ 928e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ 929e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ 930e44a3e79Saurel32 #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ 931e44a3e79Saurel32 #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ 932e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ 933e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ 9347ec93196Sj_mayer #else 935e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 936e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 937e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 938e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 939e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 9402521d698Sbellard #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ 9412521d698Sbellard #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ 942540635baSths #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 943540635baSths #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 9447ec93196Sj_mayer #endif 9452521d698Sbellard 946d2fd1af7Sbellard #if (defined(TARGET_I386) && defined(TARGET_ABI32)) || defined(TARGET_ARM) || defined(TARGET_CRIS) 9472521d698Sbellard struct target_stat { 9482521d698Sbellard unsigned short st_dev; 9492521d698Sbellard unsigned short __pad1; 950992f48a0Sblueswir1 abi_ulong st_ino; 9512521d698Sbellard unsigned short st_mode; 9522521d698Sbellard unsigned short st_nlink; 9532521d698Sbellard unsigned short st_uid; 9542521d698Sbellard unsigned short st_gid; 9552521d698Sbellard unsigned short st_rdev; 9562521d698Sbellard unsigned short __pad2; 957992f48a0Sblueswir1 abi_ulong st_size; 958992f48a0Sblueswir1 abi_ulong st_blksize; 959992f48a0Sblueswir1 abi_ulong st_blocks; 960992f48a0Sblueswir1 abi_ulong target_st_atime; 961992f48a0Sblueswir1 abi_ulong __unused1; 962992f48a0Sblueswir1 abi_ulong target_st_mtime; 963992f48a0Sblueswir1 abi_ulong __unused2; 964992f48a0Sblueswir1 abi_ulong target_st_ctime; 965992f48a0Sblueswir1 abi_ulong __unused3; 966992f48a0Sblueswir1 abi_ulong __unused4; 967992f48a0Sblueswir1 abi_ulong __unused5; 9682521d698Sbellard }; 9692521d698Sbellard 9702521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely 9712521d698Sbellard * insane amounts of padding around dev_t's. 9722521d698Sbellard */ 9732521d698Sbellard struct target_stat64 { 9742521d698Sbellard unsigned short st_dev; 9752521d698Sbellard unsigned char __pad0[10]; 9762521d698Sbellard 9772521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 978992f48a0Sblueswir1 abi_ulong __st_ino; 9792521d698Sbellard 9802521d698Sbellard unsigned int st_mode; 9812521d698Sbellard unsigned int st_nlink; 9822521d698Sbellard 983992f48a0Sblueswir1 abi_ulong st_uid; 984992f48a0Sblueswir1 abi_ulong st_gid; 9852521d698Sbellard 9862521d698Sbellard unsigned short st_rdev; 9872521d698Sbellard unsigned char __pad3[10]; 9882521d698Sbellard 9892521d698Sbellard long long st_size; 990992f48a0Sblueswir1 abi_ulong st_blksize; 9912521d698Sbellard 992992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 993992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 9942521d698Sbellard 995992f48a0Sblueswir1 abi_ulong target_st_atime; 996992f48a0Sblueswir1 abi_ulong __pad5; 9972521d698Sbellard 998992f48a0Sblueswir1 abi_ulong target_st_mtime; 999992f48a0Sblueswir1 abi_ulong __pad6; 10002521d698Sbellard 1001992f48a0Sblueswir1 abi_ulong target_st_ctime; 1002992f48a0Sblueswir1 abi_ulong __pad7; /* will be high 32 bits of ctime someday */ 10032521d698Sbellard 10042521d698Sbellard unsigned long long st_ino; 10052521d698Sbellard } __attribute__((packed)); 10062521d698Sbellard 1007ce4defa0Spbrook #ifdef TARGET_ARM 1008ce4defa0Spbrook struct target_eabi_stat64 { 1009ce4defa0Spbrook unsigned long long st_dev; 1010ce4defa0Spbrook unsigned int __pad1; 1011992f48a0Sblueswir1 abi_ulong __st_ino; 1012ce4defa0Spbrook unsigned int st_mode; 1013ce4defa0Spbrook unsigned int st_nlink; 1014ce4defa0Spbrook 1015992f48a0Sblueswir1 abi_ulong st_uid; 1016992f48a0Sblueswir1 abi_ulong st_gid; 1017ce4defa0Spbrook 1018ce4defa0Spbrook unsigned long long st_rdev; 1019ce4defa0Spbrook unsigned int __pad2[2]; 1020ce4defa0Spbrook 1021ce4defa0Spbrook long long st_size; 1022992f48a0Sblueswir1 abi_ulong st_blksize; 1023ce4defa0Spbrook unsigned int __pad3; 1024ce4defa0Spbrook unsigned long long st_blocks; 1025ce4defa0Spbrook 1026992f48a0Sblueswir1 abi_ulong target_st_atime; 1027992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1028ce4defa0Spbrook 1029992f48a0Sblueswir1 abi_ulong target_st_mtime; 1030992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1031ce4defa0Spbrook 1032992f48a0Sblueswir1 abi_ulong target_st_ctime; 1033992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1034ce4defa0Spbrook 1035ce4defa0Spbrook unsigned long long st_ino; 1036ce4defa0Spbrook } __attribute__ ((packed)); 1037ce4defa0Spbrook #endif 1038ce4defa0Spbrook 1039992f48a0Sblueswir1 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 10401b8dd648Sblueswir1 struct target_stat { 10411b8dd648Sblueswir1 unsigned int st_dev; 1042992f48a0Sblueswir1 abi_ulong st_ino; 10431b8dd648Sblueswir1 unsigned int st_mode; 10441b8dd648Sblueswir1 unsigned int st_nlink; 10451b8dd648Sblueswir1 unsigned int st_uid; 10461b8dd648Sblueswir1 unsigned int st_gid; 10471b8dd648Sblueswir1 unsigned int st_rdev; 1048992f48a0Sblueswir1 abi_long st_size; 1049992f48a0Sblueswir1 abi_long target_st_atime; 1050992f48a0Sblueswir1 abi_long target_st_mtime; 1051992f48a0Sblueswir1 abi_long target_st_ctime; 1052992f48a0Sblueswir1 abi_long st_blksize; 1053992f48a0Sblueswir1 abi_long st_blocks; 1054992f48a0Sblueswir1 abi_ulong __unused4[2]; 10551b8dd648Sblueswir1 }; 10561b8dd648Sblueswir1 10571b8dd648Sblueswir1 struct target_stat64 { 10581b8dd648Sblueswir1 unsigned char __pad0[6]; 10591b8dd648Sblueswir1 unsigned short st_dev; 10601b8dd648Sblueswir1 10611b8dd648Sblueswir1 uint64_t st_ino; 10621b8dd648Sblueswir1 uint64_t st_nlink; 10631b8dd648Sblueswir1 10641b8dd648Sblueswir1 unsigned int st_mode; 10651b8dd648Sblueswir1 10661b8dd648Sblueswir1 unsigned int st_uid; 10671b8dd648Sblueswir1 unsigned int st_gid; 10681b8dd648Sblueswir1 10691b8dd648Sblueswir1 unsigned char __pad2[6]; 10701b8dd648Sblueswir1 unsigned short st_rdev; 10711b8dd648Sblueswir1 10721b8dd648Sblueswir1 int64_t st_size; 10731b8dd648Sblueswir1 int64_t st_blksize; 10741b8dd648Sblueswir1 10751b8dd648Sblueswir1 unsigned char __pad4[4]; 10761b8dd648Sblueswir1 unsigned int st_blocks; 10771b8dd648Sblueswir1 1078992f48a0Sblueswir1 abi_ulong target_st_atime; 1079992f48a0Sblueswir1 abi_ulong __unused1; 10801b8dd648Sblueswir1 1081992f48a0Sblueswir1 abi_ulong target_st_mtime; 1082992f48a0Sblueswir1 abi_ulong __unused2; 10831b8dd648Sblueswir1 1084992f48a0Sblueswir1 abi_ulong target_st_ctime; 1085992f48a0Sblueswir1 abi_ulong __unused3; 10861b8dd648Sblueswir1 1087992f48a0Sblueswir1 abi_ulong __unused4[3]; 10881b8dd648Sblueswir1 }; 10891b8dd648Sblueswir1 10903bfd9da1Sbellard #elif defined(TARGET_SPARC) 10913bfd9da1Sbellard 10923bfd9da1Sbellard struct target_stat { 10933bfd9da1Sbellard unsigned short st_dev; 1094992f48a0Sblueswir1 abi_ulong st_ino; 10953bfd9da1Sbellard unsigned short st_mode; 10963bfd9da1Sbellard short st_nlink; 10973bfd9da1Sbellard unsigned short st_uid; 10983bfd9da1Sbellard unsigned short st_gid; 10993bfd9da1Sbellard unsigned short st_rdev; 1100992f48a0Sblueswir1 abi_long st_size; 1101992f48a0Sblueswir1 abi_long target_st_atime; 1102992f48a0Sblueswir1 abi_ulong __unused1; 1103992f48a0Sblueswir1 abi_long target_st_mtime; 1104992f48a0Sblueswir1 abi_ulong __unused2; 1105992f48a0Sblueswir1 abi_long target_st_ctime; 1106992f48a0Sblueswir1 abi_ulong __unused3; 1107992f48a0Sblueswir1 abi_long st_blksize; 1108992f48a0Sblueswir1 abi_long st_blocks; 1109992f48a0Sblueswir1 abi_ulong __unused4[2]; 11103bfd9da1Sbellard }; 11113bfd9da1Sbellard 11123bfd9da1Sbellard struct target_stat64 { 11133bfd9da1Sbellard unsigned char __pad0[6]; 11143bfd9da1Sbellard unsigned short st_dev; 11153bfd9da1Sbellard 11163bfd9da1Sbellard uint64_t st_ino; 11173bfd9da1Sbellard 11183bfd9da1Sbellard unsigned int st_mode; 11193bfd9da1Sbellard unsigned int st_nlink; 11203bfd9da1Sbellard 11213bfd9da1Sbellard unsigned int st_uid; 11223bfd9da1Sbellard unsigned int st_gid; 11233bfd9da1Sbellard 11243bfd9da1Sbellard unsigned char __pad2[6]; 11253bfd9da1Sbellard unsigned short st_rdev; 11263bfd9da1Sbellard 11273bfd9da1Sbellard unsigned char __pad3[8]; 11283bfd9da1Sbellard 11293bfd9da1Sbellard int64_t st_size; 11303bfd9da1Sbellard unsigned int st_blksize; 11313bfd9da1Sbellard 11323bfd9da1Sbellard unsigned char __pad4[8]; 11333bfd9da1Sbellard unsigned int st_blocks; 11343bfd9da1Sbellard 11353bfd9da1Sbellard unsigned int target_st_atime; 11363bfd9da1Sbellard unsigned int __unused1; 11373bfd9da1Sbellard 11383bfd9da1Sbellard unsigned int target_st_mtime; 11393bfd9da1Sbellard unsigned int __unused2; 11403bfd9da1Sbellard 11413bfd9da1Sbellard unsigned int target_st_ctime; 11423bfd9da1Sbellard unsigned int __unused3; 11433bfd9da1Sbellard 11443bfd9da1Sbellard unsigned int __unused4; 11453bfd9da1Sbellard unsigned int __unused5; 11463bfd9da1Sbellard }; 11473bfd9da1Sbellard 114867867308Sbellard #elif defined(TARGET_PPC) 114967867308Sbellard 115067867308Sbellard struct target_stat { 1151e32448e0Sj_mayer abi_ulong st_dev; 1152992f48a0Sblueswir1 abi_ulong st_ino; 1153325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1154e32448e0Sj_mayer abi_ulong st_nlink; 1155325e651fSj_mayer unsigned int st_mode; 1156325e651fSj_mayer #else 115767867308Sbellard unsigned int st_mode; 115867867308Sbellard unsigned short st_nlink; 1159325e651fSj_mayer #endif 116067867308Sbellard unsigned int st_uid; 116167867308Sbellard unsigned int st_gid; 1162e32448e0Sj_mayer abi_ulong st_rdev; 1163992f48a0Sblueswir1 abi_ulong st_size; 1164992f48a0Sblueswir1 abi_ulong st_blksize; 1165992f48a0Sblueswir1 abi_ulong st_blocks; 1166992f48a0Sblueswir1 abi_ulong target_st_atime; 1167e32448e0Sj_mayer abi_ulong target_st_atime_nsec; 1168992f48a0Sblueswir1 abi_ulong target_st_mtime; 1169e32448e0Sj_mayer abi_ulong target_st_mtime_nsec; 1170992f48a0Sblueswir1 abi_ulong target_st_ctime; 1171e32448e0Sj_mayer abi_ulong target_st_ctime_nsec; 1172992f48a0Sblueswir1 abi_ulong __unused4; 1173992f48a0Sblueswir1 abi_ulong __unused5; 1174325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1175325e651fSj_mayer abi_ulong __unused6; 1176325e651fSj_mayer #endif 117767867308Sbellard }; 117867867308Sbellard 1179e1ce5e40Saurel32 struct __attribute__((__packed__)) target_stat64 { 118067867308Sbellard unsigned long long st_dev; 118167867308Sbellard unsigned long long st_ino; 118267867308Sbellard unsigned int st_mode; 118367867308Sbellard unsigned int st_nlink; 118467867308Sbellard unsigned int st_uid; 118567867308Sbellard unsigned int st_gid; 118667867308Sbellard unsigned long long st_rdev; 1187e1ce5e40Saurel32 unsigned long long __pad0; 118867867308Sbellard long long st_size; 1189e32448e0Sj_mayer int st_blksize; 1190e1ce5e40Saurel32 unsigned int __pad1; 1191*61322e91SMax Filippov long long st_blocks; /* Number 512-byte blocks allocated. */ 1192e32448e0Sj_mayer int target_st_atime; 1193e32448e0Sj_mayer unsigned int target_st_atime_nsec; 1194e32448e0Sj_mayer int target_st_mtime; 1195e32448e0Sj_mayer unsigned int target_st_mtime_nsec; 1196e32448e0Sj_mayer int target_st_ctime; 1197e32448e0Sj_mayer unsigned int target_st_ctime_nsec; 1198e32448e0Sj_mayer unsigned int __unused4; 1199e32448e0Sj_mayer unsigned int __unused5; 120067867308Sbellard }; 120167867308Sbellard 1202b779e29eSEdgar E. Iglesias #elif defined(TARGET_MICROBLAZE) 1203b779e29eSEdgar E. Iglesias 1204b779e29eSEdgar E. Iglesias struct target_stat { 1205b779e29eSEdgar E. Iglesias abi_ulong st_dev; 1206b779e29eSEdgar E. Iglesias abi_ulong st_ino; 1207b779e29eSEdgar E. Iglesias unsigned int st_mode; 1208b779e29eSEdgar E. Iglesias unsigned short st_nlink; 1209b779e29eSEdgar E. Iglesias unsigned int st_uid; 1210b779e29eSEdgar E. Iglesias unsigned int st_gid; 1211b779e29eSEdgar E. Iglesias abi_ulong st_rdev; 1212b779e29eSEdgar E. Iglesias abi_ulong st_size; 1213b779e29eSEdgar E. Iglesias abi_ulong st_blksize; 1214b779e29eSEdgar E. Iglesias abi_ulong st_blocks; 1215b779e29eSEdgar E. Iglesias abi_ulong target_st_atime; 1216b779e29eSEdgar E. Iglesias abi_ulong target_st_atime_nsec; 1217b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime; 1218b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime_nsec; 1219b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime; 1220b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime_nsec; 1221b779e29eSEdgar E. Iglesias abi_ulong __unused4; 1222b779e29eSEdgar E. Iglesias abi_ulong __unused5; 1223b779e29eSEdgar E. Iglesias }; 1224b779e29eSEdgar E. Iglesias 1225b779e29eSEdgar E. Iglesias /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ 1226b779e29eSEdgar E. Iglesias struct __attribute__((__packed__)) target_stat64 { 1227b779e29eSEdgar E. Iglesias uint64_t st_dev; 1228b779e29eSEdgar E. Iglesias uint64_t st_ino; 1229b779e29eSEdgar E. Iglesias uint32_t st_mode; 1230b779e29eSEdgar E. Iglesias uint32_t st_nlink; 1231b779e29eSEdgar E. Iglesias uint32_t st_uid; 1232b779e29eSEdgar E. Iglesias uint32_t st_gid; 1233b779e29eSEdgar E. Iglesias uint64_t st_rdev; 123421ebeb23SEdgar E. Iglesias uint64_t __pad1; 1235b779e29eSEdgar E. Iglesias 1236b779e29eSEdgar E. Iglesias int64_t st_size; 1237b779e29eSEdgar E. Iglesias int32_t st_blksize; 123821ebeb23SEdgar E. Iglesias uint32_t __pad2; 1239b779e29eSEdgar E. Iglesias int64_t st_blocks; /* Number 512-byte blocks allocated. */ 1240b779e29eSEdgar E. Iglesias 1241b779e29eSEdgar E. Iglesias int target_st_atime; 1242b779e29eSEdgar E. Iglesias unsigned int target_st_atime_nsec; 1243b779e29eSEdgar E. Iglesias int target_st_mtime; 1244b779e29eSEdgar E. Iglesias unsigned int target_st_mtime_nsec; 1245b779e29eSEdgar E. Iglesias int target_st_ctime; 1246b779e29eSEdgar E. Iglesias unsigned int target_st_ctime_nsec; 1247b779e29eSEdgar E. Iglesias uint32_t __unused4; 1248b779e29eSEdgar E. Iglesias uint32_t __unused5; 1249b779e29eSEdgar E. Iglesias }; 1250b779e29eSEdgar E. Iglesias 1251e6e5906bSpbrook #elif defined(TARGET_M68K) 1252e6e5906bSpbrook 1253e6e5906bSpbrook struct target_stat { 1254e6e5906bSpbrook unsigned short st_dev; 1255e6e5906bSpbrook unsigned short __pad1; 1256992f48a0Sblueswir1 abi_ulong st_ino; 1257e6e5906bSpbrook unsigned short st_mode; 1258e6e5906bSpbrook unsigned short st_nlink; 1259e6e5906bSpbrook unsigned short st_uid; 1260e6e5906bSpbrook unsigned short st_gid; 1261e6e5906bSpbrook unsigned short st_rdev; 1262e6e5906bSpbrook unsigned short __pad2; 1263992f48a0Sblueswir1 abi_ulong st_size; 1264992f48a0Sblueswir1 abi_ulong st_blksize; 1265992f48a0Sblueswir1 abi_ulong st_blocks; 1266992f48a0Sblueswir1 abi_ulong target_st_atime; 1267992f48a0Sblueswir1 abi_ulong __unused1; 1268992f48a0Sblueswir1 abi_ulong target_st_mtime; 1269992f48a0Sblueswir1 abi_ulong __unused2; 1270992f48a0Sblueswir1 abi_ulong target_st_ctime; 1271992f48a0Sblueswir1 abi_ulong __unused3; 1272992f48a0Sblueswir1 abi_ulong __unused4; 1273992f48a0Sblueswir1 abi_ulong __unused5; 1274e6e5906bSpbrook }; 1275e6e5906bSpbrook 1276e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely 1277e6e5906bSpbrook * insane amounts of padding around dev_t's. 1278e6e5906bSpbrook */ 1279e6e5906bSpbrook struct target_stat64 { 1280e6e5906bSpbrook unsigned long long st_dev; 1281e6e5906bSpbrook unsigned char __pad1[2]; 1282e6e5906bSpbrook 1283e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1284992f48a0Sblueswir1 abi_ulong __st_ino; 1285e6e5906bSpbrook 1286e6e5906bSpbrook unsigned int st_mode; 1287e6e5906bSpbrook unsigned int st_nlink; 1288e6e5906bSpbrook 1289992f48a0Sblueswir1 abi_ulong st_uid; 1290992f48a0Sblueswir1 abi_ulong st_gid; 1291e6e5906bSpbrook 1292e6e5906bSpbrook unsigned long long st_rdev; 1293e6e5906bSpbrook unsigned char __pad3[2]; 1294e6e5906bSpbrook 1295e6e5906bSpbrook long long st_size; 1296992f48a0Sblueswir1 abi_ulong st_blksize; 1297e6e5906bSpbrook 1298992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 1299992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1300e6e5906bSpbrook 1301992f48a0Sblueswir1 abi_ulong target_st_atime; 1302992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1303e6e5906bSpbrook 1304992f48a0Sblueswir1 abi_ulong target_st_mtime; 1305992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1306e6e5906bSpbrook 1307992f48a0Sblueswir1 abi_ulong target_st_ctime; 1308992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1309e6e5906bSpbrook 1310e6e5906bSpbrook unsigned long long st_ino; 1311e6e5906bSpbrook } __attribute__((packed)); 1312e6e5906bSpbrook 1313d26bc211Sths #elif defined(TARGET_ABI_MIPSN64) 1314540635baSths 1315540635baSths /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ 1316540635baSths struct target_stat { 1317540635baSths unsigned int st_dev; 1318540635baSths unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ 1319540635baSths 1320992f48a0Sblueswir1 abi_ulong st_ino; 1321540635baSths 1322540635baSths unsigned int st_mode; 1323540635baSths unsigned int st_nlink; 1324540635baSths 1325540635baSths int st_uid; 1326540635baSths int st_gid; 1327540635baSths 1328540635baSths unsigned int st_rdev; 1329540635baSths unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ 1330540635baSths 1331992f48a0Sblueswir1 abi_ulong st_size; 1332540635baSths 1333540635baSths /* 1334540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1335540635baSths * but we don't have it under Linux. 1336540635baSths */ 1337540635baSths unsigned int target_st_atime; 1338540635baSths unsigned int target_st_atime_nsec; 1339540635baSths 1340540635baSths unsigned int target_st_mtime; 1341540635baSths unsigned int target_st_mtime_nsec; 1342540635baSths 1343540635baSths unsigned int target_st_ctime; 1344540635baSths unsigned int target_st_ctime_nsec; 1345540635baSths 1346540635baSths unsigned int st_blksize; 1347540635baSths unsigned int st_pad2; 1348540635baSths 1349992f48a0Sblueswir1 abi_ulong st_blocks; 1350540635baSths }; 1351540635baSths 1352d26bc211Sths #elif defined(TARGET_ABI_MIPSN32) 1353540635baSths 1354540635baSths struct target_stat { 1355540635baSths unsigned st_dev; 1356540635baSths int st_pad1[3]; /* Reserved for network id */ 1357540635baSths unsigned int st_ino; 1358540635baSths unsigned int st_mode; 1359540635baSths unsigned int st_nlink; 1360540635baSths int st_uid; 1361540635baSths int st_gid; 1362540635baSths unsigned st_rdev; 1363540635baSths unsigned int st_pad2[2]; 1364540635baSths unsigned int st_size; 1365540635baSths unsigned int st_pad3; 1366540635baSths /* 1367540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1368540635baSths * but we don't have it under Linux. 1369540635baSths */ 1370540635baSths unsigned int target_st_atime; 1371540635baSths unsigned int target_st_atime_nsec; 1372540635baSths unsigned int target_st_mtime; 1373540635baSths unsigned int target_st_mtime_nsec; 1374540635baSths unsigned int target_st_ctime; 1375540635baSths unsigned int target_st_ctime_nsec; 1376540635baSths unsigned int st_blksize; 1377540635baSths unsigned int st_blocks; 1378540635baSths unsigned int st_pad4[14]; 1379540635baSths }; 1380540635baSths 1381540635baSths /* 1382540635baSths * This matches struct stat64 in glibc2.1, hence the absolutely insane 1383540635baSths * amounts of padding around dev_t's. The memory layout is the same as of 1384540635baSths * struct stat of the 64-bit kernel. 1385540635baSths */ 1386540635baSths 1387540635baSths struct target_stat64 { 1388540635baSths unsigned int st_dev; 1389540635baSths unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ 1390540635baSths 1391540635baSths target_ulong st_ino; 1392540635baSths 1393540635baSths unsigned int st_mode; 1394540635baSths unsigned int st_nlink; 1395540635baSths 1396540635baSths int st_uid; 1397540635baSths int st_gid; 1398540635baSths 1399540635baSths unsigned int st_rdev; 1400540635baSths unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ 1401540635baSths 1402540635baSths int st_size; 1403540635baSths 1404540635baSths /* 1405540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1406540635baSths * but we don't have it under Linux. 1407540635baSths */ 1408540635baSths int target_st_atime; 1409540635baSths unsigned int target_st_atime_nsec; /* Reserved for st_atime expansion */ 1410540635baSths 1411540635baSths int target_st_mtime; 1412540635baSths unsigned int target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 1413540635baSths 1414540635baSths int target_st_ctime; 1415540635baSths unsigned int target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 1416540635baSths 1417540635baSths unsigned int st_blksize; 1418540635baSths unsigned int st_pad2; 1419540635baSths 1420540635baSths int st_blocks; 1421540635baSths }; 1422540635baSths 1423d26bc211Sths #elif defined(TARGET_ABI_MIPSO32) 1424048f6b4dSbellard 1425048f6b4dSbellard struct target_stat { 1426048f6b4dSbellard unsigned st_dev; 1427992f48a0Sblueswir1 abi_long st_pad1[3]; /* Reserved for network id */ 1428992f48a0Sblueswir1 abi_ulong st_ino; 1429048f6b4dSbellard unsigned int st_mode; 1430048f6b4dSbellard unsigned int st_nlink; 1431048f6b4dSbellard int st_uid; 1432048f6b4dSbellard int st_gid; 1433048f6b4dSbellard unsigned st_rdev; 1434992f48a0Sblueswir1 abi_long st_pad2[2]; 1435992f48a0Sblueswir1 abi_long st_size; 1436992f48a0Sblueswir1 abi_long st_pad3; 1437048f6b4dSbellard /* 1438048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1439048f6b4dSbellard * but we don't have it under Linux. 1440048f6b4dSbellard */ 1441992f48a0Sblueswir1 abi_long target_st_atime; 1442992f48a0Sblueswir1 abi_long target_st_atime_nsec; 1443992f48a0Sblueswir1 abi_long target_st_mtime; 1444992f48a0Sblueswir1 abi_long target_st_mtime_nsec; 1445992f48a0Sblueswir1 abi_long target_st_ctime; 1446992f48a0Sblueswir1 abi_long target_st_ctime_nsec; 1447992f48a0Sblueswir1 abi_long st_blksize; 1448992f48a0Sblueswir1 abi_long st_blocks; 1449992f48a0Sblueswir1 abi_long st_pad4[14]; 1450048f6b4dSbellard }; 1451048f6b4dSbellard 1452048f6b4dSbellard /* 1453048f6b4dSbellard * This matches struct stat64 in glibc2.1, hence the absolutely insane 1454048f6b4dSbellard * amounts of padding around dev_t's. The memory layout is the same as of 1455048f6b4dSbellard * struct stat of the 64-bit kernel. 1456048f6b4dSbellard */ 1457048f6b4dSbellard 1458048f6b4dSbellard struct target_stat64 { 1459992f48a0Sblueswir1 abi_ulong st_dev; 1460992f48a0Sblueswir1 abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 1461048f6b4dSbellard 1462048f6b4dSbellard uint64_t st_ino; 1463048f6b4dSbellard 1464048f6b4dSbellard unsigned int st_mode; 1465048f6b4dSbellard unsigned int st_nlink; 1466048f6b4dSbellard 1467048f6b4dSbellard int st_uid; 1468048f6b4dSbellard int st_gid; 1469048f6b4dSbellard 1470992f48a0Sblueswir1 abi_ulong st_rdev; 1471992f48a0Sblueswir1 abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 1472048f6b4dSbellard 1473048f6b4dSbellard int64_t st_size; 1474048f6b4dSbellard 1475048f6b4dSbellard /* 1476048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1477048f6b4dSbellard * but we don't have it under Linux. 1478048f6b4dSbellard */ 1479992f48a0Sblueswir1 abi_long target_st_atime; 1480992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 1481048f6b4dSbellard 1482992f48a0Sblueswir1 abi_long target_st_mtime; 1483992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 1484048f6b4dSbellard 1485992f48a0Sblueswir1 abi_long target_st_ctime; 1486992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 1487048f6b4dSbellard 1488992f48a0Sblueswir1 abi_ulong st_blksize; 1489992f48a0Sblueswir1 abi_ulong st_pad2; 1490048f6b4dSbellard 1491048f6b4dSbellard int64_t st_blocks; 1492048f6b4dSbellard }; 14937a3148a9Sj_mayer 14947a3148a9Sj_mayer #elif defined(TARGET_ALPHA) 14957a3148a9Sj_mayer 14967a3148a9Sj_mayer struct target_stat { 14977a3148a9Sj_mayer unsigned int st_dev; 14987a3148a9Sj_mayer unsigned int st_ino; 14997a3148a9Sj_mayer unsigned int st_mode; 15007a3148a9Sj_mayer unsigned int st_nlink; 15017a3148a9Sj_mayer unsigned int st_uid; 15027a3148a9Sj_mayer unsigned int st_gid; 15037a3148a9Sj_mayer unsigned int st_rdev; 1504992f48a0Sblueswir1 abi_long st_size; 1505992f48a0Sblueswir1 abi_ulong target_st_atime; 1506992f48a0Sblueswir1 abi_ulong target_st_mtime; 1507992f48a0Sblueswir1 abi_ulong target_st_ctime; 15087a3148a9Sj_mayer unsigned int st_blksize; 15097a3148a9Sj_mayer unsigned int st_blocks; 15107a3148a9Sj_mayer unsigned int st_flags; 15117a3148a9Sj_mayer unsigned int st_gen; 15127a3148a9Sj_mayer }; 15137a3148a9Sj_mayer 15147a3148a9Sj_mayer struct target_stat64 { 1515992f48a0Sblueswir1 abi_ulong st_dev; 1516992f48a0Sblueswir1 abi_ulong st_ino; 1517992f48a0Sblueswir1 abi_ulong st_rdev; 1518992f48a0Sblueswir1 abi_long st_size; 1519992f48a0Sblueswir1 abi_ulong st_blocks; 15207a3148a9Sj_mayer 15217a3148a9Sj_mayer unsigned int st_mode; 15227a3148a9Sj_mayer unsigned int st_uid; 15237a3148a9Sj_mayer unsigned int st_gid; 15247a3148a9Sj_mayer unsigned int st_blksize; 15257a3148a9Sj_mayer unsigned int st_nlink; 15267a3148a9Sj_mayer unsigned int __pad0; 15277a3148a9Sj_mayer 1528992f48a0Sblueswir1 abi_ulong target_st_atime; 1529992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1530992f48a0Sblueswir1 abi_ulong target_st_mtime; 1531992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1532992f48a0Sblueswir1 abi_ulong target_st_ctime; 1533992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1534992f48a0Sblueswir1 abi_long __unused[3]; 15357a3148a9Sj_mayer }; 15367a3148a9Sj_mayer 15376db45e65Sths #elif defined(TARGET_SH4) 15386db45e65Sths 15396db45e65Sths struct target_stat { 1540992f48a0Sblueswir1 abi_ulong st_dev; 1541992f48a0Sblueswir1 abi_ulong st_ino; 15426db45e65Sths unsigned short st_mode; 15436db45e65Sths unsigned short st_nlink; 15446db45e65Sths unsigned short st_uid; 15456db45e65Sths unsigned short st_gid; 1546992f48a0Sblueswir1 abi_ulong st_rdev; 1547992f48a0Sblueswir1 abi_ulong st_size; 1548992f48a0Sblueswir1 abi_ulong st_blksize; 1549992f48a0Sblueswir1 abi_ulong st_blocks; 1550992f48a0Sblueswir1 abi_ulong target_st_atime; 1551992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1552992f48a0Sblueswir1 abi_ulong target_st_mtime; 1553992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1554992f48a0Sblueswir1 abi_ulong target_st_ctime; 1555992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1556992f48a0Sblueswir1 abi_ulong __unused4; 1557992f48a0Sblueswir1 abi_ulong __unused5; 15586db45e65Sths }; 15596db45e65Sths 15606db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely 15616db45e65Sths * insane amounts of padding around dev_t's. 15626db45e65Sths */ 156391bd8ce9Saurel32 struct __attribute__((__packed__)) target_stat64 { 15646db45e65Sths unsigned long long st_dev; 15656db45e65Sths unsigned char __pad0[4]; 15666db45e65Sths 15676db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1568992f48a0Sblueswir1 abi_ulong __st_ino; 15696db45e65Sths 15706db45e65Sths unsigned int st_mode; 15716db45e65Sths unsigned int st_nlink; 15726db45e65Sths 1573992f48a0Sblueswir1 abi_ulong st_uid; 1574992f48a0Sblueswir1 abi_ulong st_gid; 15756db45e65Sths 15766db45e65Sths unsigned long long st_rdev; 15776db45e65Sths unsigned char __pad3[4]; 15786db45e65Sths 15796db45e65Sths long long st_size; 1580992f48a0Sblueswir1 abi_ulong st_blksize; 15816db45e65Sths 15826db45e65Sths unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ 15836db45e65Sths 1584992f48a0Sblueswir1 abi_ulong target_st_atime; 1585992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 15866db45e65Sths 1587992f48a0Sblueswir1 abi_ulong target_st_mtime; 1588992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 15896db45e65Sths 1590992f48a0Sblueswir1 abi_ulong target_st_ctime; 1591992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 15926db45e65Sths 15936db45e65Sths unsigned long long st_ino; 15946db45e65Sths }; 15956db45e65Sths 1596d2fd1af7Sbellard #elif defined(TARGET_I386) && !defined(TARGET_ABI32) 1597d2fd1af7Sbellard struct target_stat { 1598d2fd1af7Sbellard abi_ulong st_dev; 1599d2fd1af7Sbellard abi_ulong st_ino; 1600d2fd1af7Sbellard abi_ulong st_nlink; 1601d2fd1af7Sbellard 1602d2fd1af7Sbellard unsigned int st_mode; 1603d2fd1af7Sbellard unsigned int st_uid; 1604d2fd1af7Sbellard unsigned int st_gid; 1605d2fd1af7Sbellard unsigned int __pad0; 1606d2fd1af7Sbellard abi_ulong st_rdev; 1607d2fd1af7Sbellard abi_long st_size; 1608d2fd1af7Sbellard abi_long st_blksize; 1609d2fd1af7Sbellard abi_long st_blocks; /* Number 512-byte blocks allocated. */ 1610d2fd1af7Sbellard 1611d2fd1af7Sbellard abi_ulong target_st_atime; 1612d2fd1af7Sbellard abi_ulong target_st_atime_nsec; 1613d2fd1af7Sbellard abi_ulong target_st_mtime; 1614d2fd1af7Sbellard abi_ulong target_st_mtime_nsec; 1615d2fd1af7Sbellard abi_ulong target_st_ctime; 1616d2fd1af7Sbellard abi_ulong target_st_ctime_nsec; 1617d2fd1af7Sbellard 1618d2fd1af7Sbellard abi_long __unused[3]; 1619d2fd1af7Sbellard }; 1620048f6b4dSbellard #else 1621048f6b4dSbellard #error unsupported CPU 1622048f6b4dSbellard #endif 16232521d698Sbellard 16244ce6f8deSths typedef struct { 16254ce6f8deSths int val[2]; 1626c227f099SAnthony Liguori } target_fsid_t; 16274ce6f8deSths 162856c8f68fSbellard #ifdef TARGET_MIPS 1629d26bc211Sths #ifdef TARGET_ABI_MIPSN32 1630540635baSths struct target_statfs { 1631540635baSths int32_t f_type; 1632540635baSths int32_t f_bsize; 1633540635baSths int32_t f_frsize; /* Fragment size - unsupported */ 1634540635baSths int32_t f_blocks; 1635540635baSths int32_t f_bfree; 1636540635baSths int32_t f_files; 1637540635baSths int32_t f_ffree; 1638540635baSths int32_t f_bavail; 1639540635baSths 1640540635baSths /* Linux specials */ 1641c227f099SAnthony Liguori target_fsid_t f_fsid; 1642540635baSths int32_t f_namelen; 1643540635baSths int32_t f_spare[6]; 1644540635baSths }; 1645540635baSths #else 164656c8f68fSbellard struct target_statfs { 1647992f48a0Sblueswir1 abi_long f_type; 1648992f48a0Sblueswir1 abi_long f_bsize; 1649992f48a0Sblueswir1 abi_long f_frsize; /* Fragment size - unsupported */ 1650992f48a0Sblueswir1 abi_long f_blocks; 1651992f48a0Sblueswir1 abi_long f_bfree; 1652992f48a0Sblueswir1 abi_long f_files; 1653992f48a0Sblueswir1 abi_long f_ffree; 1654992f48a0Sblueswir1 abi_long f_bavail; 165556c8f68fSbellard 165656c8f68fSbellard /* Linux specials */ 1657c227f099SAnthony Liguori target_fsid_t f_fsid; 1658992f48a0Sblueswir1 abi_long f_namelen; 1659992f48a0Sblueswir1 abi_long f_spare[6]; 166056c8f68fSbellard }; 1661540635baSths #endif 166256c8f68fSbellard 166356c8f68fSbellard struct target_statfs64 { 166456c8f68fSbellard uint32_t f_type; 166556c8f68fSbellard uint32_t f_bsize; 166656c8f68fSbellard uint32_t f_frsize; /* Fragment size - unsupported */ 166756c8f68fSbellard uint32_t __pad; 166856c8f68fSbellard uint64_t f_blocks; 166956c8f68fSbellard uint64_t f_bfree; 167056c8f68fSbellard uint64_t f_files; 167156c8f68fSbellard uint64_t f_ffree; 167256c8f68fSbellard uint64_t f_bavail; 1673c227f099SAnthony Liguori target_fsid_t f_fsid; 167456c8f68fSbellard uint32_t f_namelen; 167556c8f68fSbellard uint32_t f_spare[6]; 167656c8f68fSbellard }; 1677c4d10628Sbalrog #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ 1678c4d10628Sbalrog defined(TARGET_SPARC64)) && !defined(TARGET_ABI32) 1679325e651fSj_mayer struct target_statfs { 1680325e651fSj_mayer abi_long f_type; 1681325e651fSj_mayer abi_long f_bsize; 1682325e651fSj_mayer abi_long f_blocks; 1683325e651fSj_mayer abi_long f_bfree; 1684325e651fSj_mayer abi_long f_bavail; 1685325e651fSj_mayer abi_long f_files; 1686325e651fSj_mayer abi_long f_ffree; 1687c227f099SAnthony Liguori target_fsid_t f_fsid; 1688325e651fSj_mayer abi_long f_namelen; 1689325e651fSj_mayer abi_long f_frsize; 1690325e651fSj_mayer abi_long f_spare[5]; 1691325e651fSj_mayer }; 1692325e651fSj_mayer 1693325e651fSj_mayer struct target_statfs64 { 1694325e651fSj_mayer abi_long f_type; 1695325e651fSj_mayer abi_long f_bsize; 1696325e651fSj_mayer abi_long f_blocks; 1697325e651fSj_mayer abi_long f_bfree; 1698325e651fSj_mayer abi_long f_bavail; 1699325e651fSj_mayer abi_long f_files; 1700325e651fSj_mayer abi_long f_ffree; 1701c227f099SAnthony Liguori target_fsid_t f_fsid; 1702325e651fSj_mayer abi_long f_namelen; 1703325e651fSj_mayer abi_long f_frsize; 1704325e651fSj_mayer abi_long f_spare[5]; 1705325e651fSj_mayer }; 170656c8f68fSbellard #else 170756c8f68fSbellard struct target_statfs { 170856c8f68fSbellard uint32_t f_type; 170956c8f68fSbellard uint32_t f_bsize; 171056c8f68fSbellard uint32_t f_blocks; 171156c8f68fSbellard uint32_t f_bfree; 171256c8f68fSbellard uint32_t f_bavail; 171356c8f68fSbellard uint32_t f_files; 171456c8f68fSbellard uint32_t f_ffree; 1715c227f099SAnthony Liguori target_fsid_t f_fsid; 171656c8f68fSbellard uint32_t f_namelen; 171756c8f68fSbellard uint32_t f_frsize; 171856c8f68fSbellard uint32_t f_spare[5]; 171956c8f68fSbellard }; 172056c8f68fSbellard 172156c8f68fSbellard struct target_statfs64 { 172256c8f68fSbellard uint32_t f_type; 172356c8f68fSbellard uint32_t f_bsize; 172456c8f68fSbellard uint64_t f_blocks; 172556c8f68fSbellard uint64_t f_bfree; 172656c8f68fSbellard uint64_t f_bavail; 172756c8f68fSbellard uint64_t f_files; 172856c8f68fSbellard uint64_t f_ffree; 1729c227f099SAnthony Liguori target_fsid_t f_fsid; 173056c8f68fSbellard uint32_t f_namelen; 173156c8f68fSbellard uint32_t f_frsize; 173256c8f68fSbellard uint32_t f_spare[5]; 173356c8f68fSbellard }; 173456c8f68fSbellard #endif 173556c8f68fSbellard 173656c8f68fSbellard 17372521d698Sbellard #define TARGET_F_DUPFD 0 /* dup */ 17382521d698Sbellard #define TARGET_F_GETFD 1 /* get close_on_exec */ 17392521d698Sbellard #define TARGET_F_SETFD 2 /* set/clear close_on_exec */ 17402521d698Sbellard #define TARGET_F_GETFL 3 /* get file->f_flags */ 17412521d698Sbellard #define TARGET_F_SETFL 4 /* set file->f_flags */ 17422521d698Sbellard 17432521d698Sbellard #if defined(TARGET_ALPHA) 17442521d698Sbellard #define TARGET_F_GETLK 7 17452521d698Sbellard #define TARGET_F_SETLK 8 17462521d698Sbellard #define TARGET_F_SETLKW 9 17472521d698Sbellard #define TARGET_F_SETOWN 5 /* for sockets. */ 17482521d698Sbellard #define TARGET_F_GETOWN 6 /* for sockets. */ 17495f106811SArnaud Patard (Rtp) #elif defined(TARGET_MIPS) 17505f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK 14 17515f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK 6 17525f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW 7 17535f106811SArnaud Patard (Rtp) #define TARGET_F_SETOWN 24 /* for sockets. */ 17545f106811SArnaud Patard (Rtp) #define TARGET_F_GETOWN 25 /* for sockets. */ 17552521d698Sbellard #else 17562521d698Sbellard #define TARGET_F_GETLK 5 17572521d698Sbellard #define TARGET_F_SETLK 6 17582521d698Sbellard #define TARGET_F_SETLKW 7 17592521d698Sbellard #define TARGET_F_SETOWN 8 /* for sockets. */ 17602521d698Sbellard #define TARGET_F_GETOWN 9 /* for sockets. */ 17612521d698Sbellard #endif 17622521d698Sbellard 17632521d698Sbellard #define TARGET_F_SETSIG 10 /* for sockets. */ 17642521d698Sbellard #define TARGET_F_GETSIG 11 /* for sockets. */ 17652521d698Sbellard 17665f106811SArnaud Patard (Rtp) #if defined(TARGET_MIPS) 17675f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK64 33 /* using 'struct flock64' */ 17685f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK64 34 17695f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW64 35 17705f106811SArnaud Patard (Rtp) #else 17712521d698Sbellard #define TARGET_F_GETLK64 12 /* using 'struct flock64' */ 17722521d698Sbellard #define TARGET_F_SETLK64 13 17732521d698Sbellard #define TARGET_F_SETLKW64 14 17745f106811SArnaud Patard (Rtp) #endif 17757e22e546SUlrich Hecht 17767e22e546SUlrich Hecht #define TARGET_F_LINUX_SPECIFIC_BASE 1024 17777e22e546SUlrich Hecht #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0) 17787e22e546SUlrich Hecht #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1) 17797e22e546SUlrich Hecht #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) 17807e22e546SUlrich Hecht #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2) 17817e22e546SUlrich Hecht 1782f09936acSbellard #if defined (TARGET_ARM) 1783f09936acSbellard #define TARGET_O_ACCMODE 0003 1784f09936acSbellard #define TARGET_O_RDONLY 00 1785f09936acSbellard #define TARGET_O_WRONLY 01 1786f09936acSbellard #define TARGET_O_RDWR 02 1787f09936acSbellard #define TARGET_O_CREAT 0100 /* not fcntl */ 1788f09936acSbellard #define TARGET_O_EXCL 0200 /* not fcntl */ 1789f09936acSbellard #define TARGET_O_NOCTTY 0400 /* not fcntl */ 1790f09936acSbellard #define TARGET_O_TRUNC 01000 /* not fcntl */ 1791f09936acSbellard #define TARGET_O_APPEND 02000 1792f09936acSbellard #define TARGET_O_NONBLOCK 04000 1793048f6b4dSbellard #define TARGET_O_NDELAY TARGET_O_NONBLOCK 1794f09936acSbellard #define TARGET_O_SYNC 010000 1795f09936acSbellard #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ 1796f09936acSbellard #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 1797f09936acSbellard #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 1798f09936acSbellard #define TARGET_O_DIRECT 0200000 /* direct disk access hint */ 1799f09936acSbellard #define TARGET_O_LARGEFILE 0400000 1800f09936acSbellard #elif defined (TARGET_PPC) 1801ffa65c3bSbellard #define TARGET_O_ACCMODE 0003 1802ffa65c3bSbellard #define TARGET_O_RDONLY 00 1803ffa65c3bSbellard #define TARGET_O_WRONLY 01 1804ffa65c3bSbellard #define TARGET_O_RDWR 02 1805ffa65c3bSbellard #define TARGET_O_CREAT 0100 /* not fcntl */ 1806ffa65c3bSbellard #define TARGET_O_EXCL 0200 /* not fcntl */ 1807ffa65c3bSbellard #define TARGET_O_NOCTTY 0400 /* not fcntl */ 1808ffa65c3bSbellard #define TARGET_O_TRUNC 01000 /* not fcntl */ 1809ffa65c3bSbellard #define TARGET_O_APPEND 02000 1810ffa65c3bSbellard #define TARGET_O_NONBLOCK 04000 1811048f6b4dSbellard #define TARGET_O_NDELAY TARGET_O_NONBLOCK 1812ffa65c3bSbellard #define TARGET_O_SYNC 010000 1813ffa65c3bSbellard #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ 1814ffa65c3bSbellard #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 1815ffa65c3bSbellard #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 1816ffa65c3bSbellard #define TARGET_O_LARGEFILE 0200000 1817ffa65c3bSbellard #define TARGET_O_DIRECT 0400000 /* direct disk access hint */ 1818b779e29eSEdgar E. Iglesias #elif defined (TARGET_MICROBLAZE) 1819b779e29eSEdgar E. Iglesias #define TARGET_O_ACCMODE 0003 1820b779e29eSEdgar E. Iglesias #define TARGET_O_RDONLY 00 1821b779e29eSEdgar E. Iglesias #define TARGET_O_WRONLY 01 1822b779e29eSEdgar E. Iglesias #define TARGET_O_RDWR 02 1823b779e29eSEdgar E. Iglesias #define TARGET_O_CREAT 0100 /* not fcntl */ 1824b779e29eSEdgar E. Iglesias #define TARGET_O_EXCL 0200 /* not fcntl */ 1825b779e29eSEdgar E. Iglesias #define TARGET_O_NOCTTY 0400 /* not fcntl */ 1826b779e29eSEdgar E. Iglesias #define TARGET_O_TRUNC 01000 /* not fcntl */ 1827b779e29eSEdgar E. Iglesias #define TARGET_O_APPEND 02000 1828b779e29eSEdgar E. Iglesias #define TARGET_O_NONBLOCK 04000 1829b779e29eSEdgar E. Iglesias #define TARGET_O_NDELAY TARGET_O_NONBLOCK 1830b779e29eSEdgar E. Iglesias #define TARGET_O_SYNC 010000 1831b779e29eSEdgar E. Iglesias #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ 1832b779e29eSEdgar E. Iglesias #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 1833b779e29eSEdgar E. Iglesias #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 1834b779e29eSEdgar E. Iglesias #define TARGET_O_LARGEFILE 0200000 1835b779e29eSEdgar E. Iglesias #define TARGET_O_DIRECT 0400000 /* direct disk access hint */ 18366d5e216dSbellard #elif defined (TARGET_SPARC) 18376d5e216dSbellard #define TARGET_O_RDONLY 0x0000 18386d5e216dSbellard #define TARGET_O_WRONLY 0x0001 18396d5e216dSbellard #define TARGET_O_RDWR 0x0002 18406d5e216dSbellard #define TARGET_O_ACCMODE 0x0003 18416d5e216dSbellard #define TARGET_O_APPEND 0x0008 18426d5e216dSbellard #define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */ 18436d5e216dSbellard #define TARGET_O_CREAT 0x0200 /* not fcntl */ 18446d5e216dSbellard #define TARGET_O_TRUNC 0x0400 /* not fcntl */ 18456d5e216dSbellard #define TARGET_O_EXCL 0x0800 /* not fcntl */ 18466d5e216dSbellard #define TARGET_O_SYNC 0x2000 18476d5e216dSbellard #define TARGET_O_NONBLOCK 0x4000 1848048f6b4dSbellard #define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK) 18496d5e216dSbellard #define TARGET_O_NOCTTY 0x8000 /* not fcntl */ 18506d5e216dSbellard #define TARGET_O_DIRECTORY 0x10000 /* must be a directory */ 18516d5e216dSbellard #define TARGET_O_NOFOLLOW 0x20000 /* don't follow links */ 18526d5e216dSbellard #define TARGET_O_LARGEFILE 0x40000 18536d5e216dSbellard #define TARGET_O_DIRECT 0x100000 /* direct disk access hint */ 1854048f6b4dSbellard #elif defined(TARGET_MIPS) 1855048f6b4dSbellard #define TARGET_O_ACCMODE 0x0003 1856048f6b4dSbellard #define TARGET_O_RDONLY 0x0000 1857048f6b4dSbellard #define TARGET_O_WRONLY 0x0001 1858048f6b4dSbellard #define TARGET_O_RDWR 0x0002 1859048f6b4dSbellard #define TARGET_O_APPEND 0x0008 1860048f6b4dSbellard #define TARGET_O_SYNC 0x0010 1861048f6b4dSbellard #define TARGET_O_NONBLOCK 0x0080 1862048f6b4dSbellard #define TARGET_O_CREAT 0x0100 /* not fcntl */ 1863048f6b4dSbellard #define TARGET_O_TRUNC 0x0200 /* not fcntl */ 1864048f6b4dSbellard #define TARGET_O_EXCL 0x0400 /* not fcntl */ 1865048f6b4dSbellard #define TARGET_O_NOCTTY 0x0800 /* not fcntl */ 1866048f6b4dSbellard #define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */ 1867048f6b4dSbellard #define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */ 1868048f6b4dSbellard #define TARGET_O_DIRECT 0x8000 /* direct disk access hint */ 1869048f6b4dSbellard #define TARGET_O_DIRECTORY 0x10000 /* must be a directory */ 1870048f6b4dSbellard #define TARGET_O_NOFOLLOW 0x20000 /* don't follow links */ 1871048f6b4dSbellard #define TARGET_O_NOATIME 0x40000 1872048f6b4dSbellard #define TARGET_O_NDELAY TARGET_O_NONBLOCK 18731f961124Saurel32 #elif defined(TARGET_ALPHA) 18741f961124Saurel32 #define TARGET_O_ACCMODE 0x0003 18751f961124Saurel32 #define TARGET_O_RDONLY 0x0000 18761f961124Saurel32 #define TARGET_O_WRONLY 0x0001 18771f961124Saurel32 #define TARGET_O_RDWR 0x0002 18781f961124Saurel32 #define TARGET_O_APPEND 0x0008 18791f961124Saurel32 #define TARGET_O_SYNC 0x4000 18801f961124Saurel32 #define TARGET_O_NONBLOCK 0x0004 18811f961124Saurel32 #define TARGET_O_CREAT 0x0200 /* not fcntl */ 18821f961124Saurel32 #define TARGET_O_TRUNC 0x0400 /* not fcntl */ 18831f961124Saurel32 #define TARGET_O_EXCL 0x0800 /* not fcntl */ 18841f961124Saurel32 #define TARGET_O_NOCTTY 0x1000 /* not fcntl */ 18851f961124Saurel32 #define TARGET_FASYNC 0x2000 /* fcntl, for BSD compatibility */ 18861f961124Saurel32 #define TARGET_O_LARGEFILE 0x0000 /* not necessary, always 64-bit */ 18871f961124Saurel32 #define TARGET_O_DIRECT 0x80000 /* direct disk access hint */ 18881f961124Saurel32 #define TARGET_O_DIRECTORY 0x8000 /* must be a directory */ 18891f961124Saurel32 #define TARGET_O_NOFOLLOW 0x10000 /* don't follow links */ 18901f961124Saurel32 #define TARGET_O_NOATIME 0x100000 18911f961124Saurel32 #define TARGET_O_NDELAY TARGET_O_NONBLOCK 1892ffa65c3bSbellard #else 1893ffa65c3bSbellard #define TARGET_O_ACCMODE 0003 1894ffa65c3bSbellard #define TARGET_O_RDONLY 00 1895ffa65c3bSbellard #define TARGET_O_WRONLY 01 1896ffa65c3bSbellard #define TARGET_O_RDWR 02 1897ffa65c3bSbellard #define TARGET_O_CREAT 0100 /* not fcntl */ 1898ffa65c3bSbellard #define TARGET_O_EXCL 0200 /* not fcntl */ 1899ffa65c3bSbellard #define TARGET_O_NOCTTY 0400 /* not fcntl */ 1900ffa65c3bSbellard #define TARGET_O_TRUNC 01000 /* not fcntl */ 1901ffa65c3bSbellard #define TARGET_O_APPEND 02000 1902ffa65c3bSbellard #define TARGET_O_NONBLOCK 04000 1903048f6b4dSbellard #define TARGET_O_NDELAY TARGET_O_NONBLOCK 1904ffa65c3bSbellard #define TARGET_O_SYNC 010000 1905ffa65c3bSbellard #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ 1906ffa65c3bSbellard #define TARGET_O_DIRECT 040000 /* direct disk access hint */ 1907ffa65c3bSbellard #define TARGET_O_LARGEFILE 0100000 1908ffa65c3bSbellard #define TARGET_O_DIRECTORY 0200000 /* must be a directory */ 1909ffa65c3bSbellard #define TARGET_O_NOFOLLOW 0400000 /* don't follow links */ 1910ffa65c3bSbellard #endif 1911ffa65c3bSbellard 19122521d698Sbellard struct target_flock { 19132521d698Sbellard short l_type; 19142521d698Sbellard short l_whence; 1915992f48a0Sblueswir1 abi_ulong l_start; 1916992f48a0Sblueswir1 abi_ulong l_len; 19172521d698Sbellard int l_pid; 19182521d698Sbellard }; 19192521d698Sbellard 19202521d698Sbellard struct target_flock64 { 19212521d698Sbellard short l_type; 19222521d698Sbellard short l_whence; 1923b779e29eSEdgar E. Iglesias #if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) || defined(TARGET_SPARC) || defined(TARGET_HPPA) || defined (TARGET_MICROBLAZE) 1924ce3f0e2fSaurel32 int __pad; 1925ce3f0e2fSaurel32 #endif 19262521d698Sbellard unsigned long long l_start; 19272521d698Sbellard unsigned long long l_len; 19282521d698Sbellard int l_pid; 1929ce4defa0Spbrook }__attribute__((packed)); 19302521d698Sbellard 1931ce4defa0Spbrook #ifdef TARGET_ARM 1932ce4defa0Spbrook struct target_eabi_flock64 { 1933ce4defa0Spbrook short l_type; 1934ce4defa0Spbrook short l_whence; 1935ce4defa0Spbrook int __pad; 1936ce4defa0Spbrook unsigned long long l_start; 1937ce4defa0Spbrook unsigned long long l_len; 1938ce4defa0Spbrook int l_pid; 1939ce4defa0Spbrook }__attribute__((packed)); 1940ce4defa0Spbrook #endif 19412521d698Sbellard 19422521d698Sbellard /* soundcard defines */ 19432521d698Sbellard /* XXX: convert them all to arch indepedent entries */ 19442521d698Sbellard #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); 19452521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 19462521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 19472521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 19482521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA 0xc0144302 19492521d698Sbellard #define TARGET_SNDCTL_COPR_RESET 0x00004300 19502521d698Sbellard #define TARGET_SNDCTL_COPR_RUN 0xc0144306 19512521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 19522521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE 0x40144305 19532521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA 0x40144304 19542521d698Sbellard #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) 19552521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) 19562521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) 19572521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) 19582521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) 19592521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) 19602521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) 19612521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) 19622521d698Sbellard #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) 19632521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) 19642521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) 19652521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) 19662521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) 19672521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) 19682521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) 19692521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) 19702521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) 19712521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) 19722521d698Sbellard #define TARGET_SNDCTL_DSP_MAPINBUF 0x80085013 19732521d698Sbellard #define TARGET_SNDCTL_DSP_MAPOUTBUF 0x80085014 19742521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e 19752521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 19762521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 19772521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 19782521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 19792521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f 19802521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 19812521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO 0xc074510c 19822521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 19832521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 19842521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 19852521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 19862521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 19872521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 19882521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 19892521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 19902521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b 19912521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a 19922521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 19932521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC 0x00005111 19942521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 19952521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET 0x00005100 19962521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 19972521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC 0x00005101 19982521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 19992521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d 20002521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d 20012521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 20022521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e 20032521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 20042521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME 0x40045407 20052521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT 0x40045408 20062521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 20072521d698Sbellard #define TARGET_SNDCTL_TMR_START 0x00005402 20082521d698Sbellard #define TARGET_SNDCTL_TMR_STOP 0x00005403 20092521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 20102521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 20112521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE 0x80045002 20122521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 20132521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS 0x80045005 20142521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 20152521d698Sbellard #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) 20162521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 20172521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) 20182521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) 20192521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) 20202521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) 20212521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) 20222521d698Sbellard 20232521d698Sbellard #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) 20242521d698Sbellard 20252521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) 20262521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) 20272521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) 20282521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) 20292521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) 20302521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) 20312521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) 20322521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) 20332521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) 20342521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) 20352521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) 20362521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) 20372521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) 20382521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) 20392521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) 20402521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) 20412521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) 20422521d698Sbellard 20432521d698Sbellard /* Obsolete macros */ 20442521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) 20452521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) 20462521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) 20472521d698Sbellard 20482521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) 20492521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) 20502521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) 20512521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) 20522521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) 20532521d698Sbellard 20542521d698Sbellard #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) 20552521d698Sbellard 20562521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) 20572521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) 20582521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) 20592521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) 20602521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) 20612521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) 20622521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) 20632521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) 20642521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) 20652521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) 20662521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) 20672521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) 20682521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) 20692521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) 20702521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) 20712521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) 20722521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) 20732521d698Sbellard 20742521d698Sbellard /* Obsolete macros */ 20752521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) 20762521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) 20772521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) 20782521d698Sbellard 20792521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) 20802521d698Sbellard 20812521d698Sbellard /* vfat ioctls */ 20822521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) 20832521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) 2084a5448a7dSbellard 20858fbd6b52Sbalrog #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct mtop) 20868fbd6b52Sbalrog #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct mtget) 20878fbd6b52Sbalrog #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct mtpos) 20888fbd6b52Sbalrog 2089a5448a7dSbellard struct target_sysinfo { 2090992f48a0Sblueswir1 abi_long uptime; /* Seconds since boot */ 2091992f48a0Sblueswir1 abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */ 2092992f48a0Sblueswir1 abi_ulong totalram; /* Total usable main memory size */ 2093992f48a0Sblueswir1 abi_ulong freeram; /* Available memory size */ 2094992f48a0Sblueswir1 abi_ulong sharedram; /* Amount of shared memory */ 2095992f48a0Sblueswir1 abi_ulong bufferram; /* Memory used by buffers */ 2096992f48a0Sblueswir1 abi_ulong totalswap; /* Total swap space size */ 2097992f48a0Sblueswir1 abi_ulong freeswap; /* swap space still available */ 2098a5448a7dSbellard unsigned short procs; /* Number of current processes */ 2099a5448a7dSbellard unsigned short pad; /* explicit padding for m68k */ 2100992f48a0Sblueswir1 abi_ulong totalhigh; /* Total high memory size */ 2101992f48a0Sblueswir1 abi_ulong freehigh; /* Available high memory size */ 2102a5448a7dSbellard unsigned int mem_unit; /* Memory unit size in bytes */ 2103992f48a0Sblueswir1 char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 2104a5448a7dSbellard }; 21053532fa74Sbellard 21066556a833Saurel32 struct linux_dirent { 21076556a833Saurel32 long d_ino; 21086556a833Saurel32 unsigned long d_off; 21096556a833Saurel32 unsigned short d_reclen; 21106556a833Saurel32 char d_name[256]; /* We must not include limits.h! */ 21116556a833Saurel32 }; 21126556a833Saurel32 21136556a833Saurel32 struct linux_dirent64 { 21146556a833Saurel32 uint64_t d_ino; 21156556a833Saurel32 int64_t d_off; 21166556a833Saurel32 unsigned short d_reclen; 21176556a833Saurel32 unsigned char d_type; 21186556a833Saurel32 char d_name[256]; 21196556a833Saurel32 }; 21206556a833Saurel32 212124e1003aSaurel32 struct target_mq_attr { 212224e1003aSaurel32 abi_long mq_flags; 212324e1003aSaurel32 abi_long mq_maxmsg; 212424e1003aSaurel32 abi_long mq_msgsize; 212524e1003aSaurel32 abi_long mq_curmsgs; 212624e1003aSaurel32 }; 212724e1003aSaurel32 21283532fa74Sbellard #include "socket.h" 2129637947f1Sths 2130637947f1Sths #include "errno_defs.h" 213103dfe9f8SRiku Voipio 213203dfe9f8SRiku Voipio #define FUTEX_WAIT 0 213303dfe9f8SRiku Voipio #define FUTEX_WAKE 1 213403dfe9f8SRiku Voipio #define FUTEX_FD 2 213503dfe9f8SRiku Voipio #define FUTEX_REQUEUE 3 213603dfe9f8SRiku Voipio #define FUTEX_CMP_REQUEUE 4 213703dfe9f8SRiku Voipio #define FUTEX_WAKE_OP 5 213803dfe9f8SRiku Voipio #define FUTEX_LOCK_PI 6 213903dfe9f8SRiku Voipio #define FUTEX_UNLOCK_PI 7 214003dfe9f8SRiku Voipio #define FUTEX_TRYLOCK_PI 8 214103dfe9f8SRiku Voipio #define FUTEX_WAIT_BITSET 9 214203dfe9f8SRiku Voipio #define FUTEX_WAKE_BITSET 10 214303dfe9f8SRiku Voipio 214403dfe9f8SRiku Voipio #define FUTEX_PRIVATE_FLAG 128 214503dfe9f8SRiku Voipio #define FUTEX_CLOCK_REALTIME 256 214603dfe9f8SRiku Voipio #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) 214703dfe9f8SRiku Voipio 2148