131e31b8aSbellard /* common syscall defines for all architectures */ 231e31b8aSbellard 32521d698Sbellard /* Note: although the syscall numbers change between architectures, 4b4916d7bSDong Xu Wang most of them stay the same, so we handle it by putting ifdefs if 52521d698Sbellard necessary */ 62521d698Sbellard 7cb9c377fSPaolo Bonzini #ifndef SYSCALL_DEFS_H 8cb9c377fSPaolo Bonzini #define SYSCALL_DEFS_H 1 9cb9c377fSPaolo Bonzini 10cb9c377fSPaolo Bonzini 116180a181Sbellard #include "syscall_nr.h" 122521d698Sbellard 1331e31b8aSbellard #define SOCKOP_socket 1 1431e31b8aSbellard #define SOCKOP_bind 2 1531e31b8aSbellard #define SOCKOP_connect 3 1631e31b8aSbellard #define SOCKOP_listen 4 1731e31b8aSbellard #define SOCKOP_accept 5 1831e31b8aSbellard #define SOCKOP_getsockname 6 1931e31b8aSbellard #define SOCKOP_getpeername 7 2031e31b8aSbellard #define SOCKOP_socketpair 8 2131e31b8aSbellard #define SOCKOP_send 9 2231e31b8aSbellard #define SOCKOP_recv 10 2331e31b8aSbellard #define SOCKOP_sendto 11 2431e31b8aSbellard #define SOCKOP_recvfrom 12 2531e31b8aSbellard #define SOCKOP_shutdown 13 2631e31b8aSbellard #define SOCKOP_setsockopt 14 2731e31b8aSbellard #define SOCKOP_getsockopt 15 2831e31b8aSbellard #define SOCKOP_sendmsg 16 2931e31b8aSbellard #define SOCKOP_recvmsg 17 3031e31b8aSbellard 318853f86eSbellard #define IPCOP_semop 1 328853f86eSbellard #define IPCOP_semget 2 338853f86eSbellard #define IPCOP_semctl 3 348853f86eSbellard #define IPCOP_semtimedop 4 358853f86eSbellard #define IPCOP_msgsnd 11 368853f86eSbellard #define IPCOP_msgrcv 12 378853f86eSbellard #define IPCOP_msgget 13 388853f86eSbellard #define IPCOP_msgctl 14 398853f86eSbellard #define IPCOP_shmat 21 408853f86eSbellard #define IPCOP_shmdt 22 418853f86eSbellard #define IPCOP_shmget 23 428853f86eSbellard #define IPCOP_shmctl 24 438853f86eSbellard 442521d698Sbellard /* 452521d698Sbellard * The following is for compatibility across the various Linux 462521d698Sbellard * platforms. The i386 ioctl numbering scheme doesn't really enforce 472521d698Sbellard * a type field. De facto, however, the top 8 bits of the lower 16 482521d698Sbellard * bits are indeed used as a type field, so we might just as well make 492521d698Sbellard * this explicit here. Please be sure to use the decoding macros 502521d698Sbellard * below from now on. 512521d698Sbellard */ 522521d698Sbellard #define TARGET_IOC_NRBITS 8 532521d698Sbellard #define TARGET_IOC_TYPEBITS 8 542521d698Sbellard 5574d753acSMika Westerberg #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \ 560c866a7eSRiku Voipio || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) 5774d753acSMika Westerberg /* 16 bit uid wrappers emulation */ 5874d753acSMika Westerberg #define USE_UID16 590c866a7eSRiku Voipio #define target_id uint16_t 600c866a7eSRiku Voipio #else 610c866a7eSRiku Voipio #define target_id uint32_t 6274d753acSMika Westerberg #endif 6374d753acSMika Westerberg 64e6e5906bSpbrook #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ 65a4c075f1SUlrich Hecht || defined(TARGET_M68K) || defined(TARGET_CRIS) || defined(TARGET_UNICORE32) \ 66d962783eSJia Liu || defined(TARGET_S390X) || defined(TARGET_OPENRISC) 672521d698Sbellard 682521d698Sbellard #define TARGET_IOC_SIZEBITS 14 692521d698Sbellard #define TARGET_IOC_DIRBITS 2 702521d698Sbellard 712521d698Sbellard #define TARGET_IOC_NONE 0U 722521d698Sbellard #define TARGET_IOC_WRITE 1U 732521d698Sbellard #define TARGET_IOC_READ 2U 742521d698Sbellard 75048f6b4dSbellard #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ 76b779e29eSEdgar E. Iglesias defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \ 77b779e29eSEdgar E. Iglesias defined(TARGET_MIPS) 782521d698Sbellard 792521d698Sbellard #define TARGET_IOC_SIZEBITS 13 802521d698Sbellard #define TARGET_IOC_DIRBITS 3 812521d698Sbellard 822521d698Sbellard #define TARGET_IOC_NONE 1U 832521d698Sbellard #define TARGET_IOC_READ 2U 842521d698Sbellard #define TARGET_IOC_WRITE 4U 852521d698Sbellard 862521d698Sbellard #else 872521d698Sbellard #error unsupported CPU 882521d698Sbellard #endif 892521d698Sbellard 902521d698Sbellard #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) 912521d698Sbellard #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) 922521d698Sbellard #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) 932521d698Sbellard #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) 942521d698Sbellard 952521d698Sbellard #define TARGET_IOC_NRSHIFT 0 962521d698Sbellard #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) 972521d698Sbellard #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) 982521d698Sbellard #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) 992521d698Sbellard 1002521d698Sbellard #define TARGET_IOC(dir,type,nr,size) \ 1012521d698Sbellard (((dir) << TARGET_IOC_DIRSHIFT) | \ 1022521d698Sbellard ((type) << TARGET_IOC_TYPESHIFT) | \ 1032521d698Sbellard ((nr) << TARGET_IOC_NRSHIFT) | \ 1042521d698Sbellard ((size) << TARGET_IOC_SIZESHIFT)) 1052521d698Sbellard 1062521d698Sbellard /* used to create numbers */ 1072521d698Sbellard #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) 1082521d698Sbellard #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) 1092521d698Sbellard #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1102521d698Sbellard #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1112521d698Sbellard 1122521d698Sbellard /* the size is automatically computed for these defines */ 1132521d698Sbellard #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) 1142521d698Sbellard #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1152521d698Sbellard #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1162521d698Sbellard 1177854b056Sbellard struct target_sockaddr { 1187854b056Sbellard uint16_t sa_family; 1197854b056Sbellard uint8_t sa_data[14]; 1207854b056Sbellard }; 1217854b056Sbellard 122b975b83bSLionel Landwerlin struct target_in_addr { 123b975b83bSLionel Landwerlin uint32_t s_addr; /* big endian */ 124b975b83bSLionel Landwerlin }; 125b975b83bSLionel Landwerlin 126b975b83bSLionel Landwerlin struct target_ip_mreq { 127b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 128b975b83bSLionel Landwerlin struct target_in_addr imr_address; 129b975b83bSLionel Landwerlin }; 130b975b83bSLionel Landwerlin 131b975b83bSLionel Landwerlin struct target_ip_mreqn { 132b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 133b975b83bSLionel Landwerlin struct target_in_addr imr_address; 134b975b83bSLionel Landwerlin abi_long imr_ifindex; 135b975b83bSLionel Landwerlin }; 136b975b83bSLionel Landwerlin 1376e3cb58fSLionel Landwerlin struct target_ip_mreq_source { 1386e3cb58fSLionel Landwerlin /* big endian */ 1396e3cb58fSLionel Landwerlin uint32_t imr_multiaddr; 1406e3cb58fSLionel Landwerlin uint32_t imr_interface; 1416e3cb58fSLionel Landwerlin uint32_t imr_sourceaddr; 1426e3cb58fSLionel Landwerlin }; 1436e3cb58fSLionel Landwerlin 14431e31b8aSbellard struct target_timeval { 145992f48a0Sblueswir1 abi_long tv_sec; 146992f48a0Sblueswir1 abi_long tv_usec; 14731e31b8aSbellard }; 14831e31b8aSbellard 1491b6b029eSbellard struct target_timespec { 150992f48a0Sblueswir1 abi_long tv_sec; 151992f48a0Sblueswir1 abi_long tv_nsec; 1521b6b029eSbellard }; 1531b6b029eSbellard 15466fb9763Sbellard struct target_itimerval { 15566fb9763Sbellard struct target_timeval it_interval; 15666fb9763Sbellard struct target_timeval it_value; 15766fb9763Sbellard }; 15866fb9763Sbellard 159c227f099SAnthony Liguori typedef abi_long target_clock_t; 16032f36bceSbellard 161c596ed17Sbellard #define TARGET_HZ 100 162c596ed17Sbellard 16332f36bceSbellard struct target_tms { 164c227f099SAnthony Liguori target_clock_t tms_utime; 165c227f099SAnthony Liguori target_clock_t tms_stime; 166c227f099SAnthony Liguori target_clock_t tms_cutime; 167c227f099SAnthony Liguori target_clock_t tms_cstime; 16832f36bceSbellard }; 16932f36bceSbellard 1706180a181Sbellard struct target_utimbuf { 171992f48a0Sblueswir1 abi_long actime; 172992f48a0Sblueswir1 abi_long modtime; 1736180a181Sbellard }; 1746180a181Sbellard 175f2674e31Sbellard struct target_sel_arg_struct { 176992f48a0Sblueswir1 abi_long n; 177992f48a0Sblueswir1 abi_long inp, outp, exp; 178992f48a0Sblueswir1 abi_long tvp; 179f2674e31Sbellard }; 180f2674e31Sbellard 18131e31b8aSbellard struct target_iovec { 182992f48a0Sblueswir1 abi_long iov_base; /* Starting address */ 183992f48a0Sblueswir1 abi_long iov_len; /* Number of bytes */ 18431e31b8aSbellard }; 18531e31b8aSbellard 1861a9353d2Sbellard struct target_msghdr { 187992f48a0Sblueswir1 abi_long msg_name; /* Socket name */ 1881a9353d2Sbellard int msg_namelen; /* Length of name */ 189992f48a0Sblueswir1 abi_long msg_iov; /* Data blocks */ 190992f48a0Sblueswir1 abi_long msg_iovlen; /* Number of blocks */ 191992f48a0Sblueswir1 abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ 192992f48a0Sblueswir1 abi_long msg_controllen; /* Length of cmsg list */ 1931a9353d2Sbellard unsigned int msg_flags; 1941a9353d2Sbellard }; 1951a9353d2Sbellard 1967854b056Sbellard struct target_cmsghdr { 197992f48a0Sblueswir1 abi_long cmsg_len; 1987854b056Sbellard int cmsg_level; 1997854b056Sbellard int cmsg_type; 2007854b056Sbellard }; 2017854b056Sbellard 2027854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) 2037854b056Sbellard #define TARGET_CMSG_NXTHDR(mhdr, cmsg) __target_cmsg_nxthdr (mhdr, cmsg) 204992f48a0Sblueswir1 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ 205992f48a0Sblueswir1 & (size_t) ~(sizeof (abi_long) - 1)) 2067854b056Sbellard #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \ 2077854b056Sbellard + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr))) 2087854b056Sbellard #define TARGET_CMSG_LEN(len) (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len)) 2097854b056Sbellard 2107854b056Sbellard static __inline__ struct target_cmsghdr * 2117854b056Sbellard __target_cmsg_nxthdr (struct target_msghdr *__mhdr, struct target_cmsghdr *__cmsg) 2127854b056Sbellard { 2132b8bdefcSths struct target_cmsghdr *__ptr; 2147854b056Sbellard 2152b8bdefcSths __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg 216cbb21eedSMatthias Braun + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len))); 217cbb21eedSMatthias Braun if ((unsigned long)((char *)(__ptr+1) - (char *)(size_t)tswapal(__mhdr->msg_control)) 218cbb21eedSMatthias Braun > tswapal(__mhdr->msg_controllen)) 2197854b056Sbellard /* No more entries. */ 2202b8bdefcSths return (struct target_cmsghdr *)0; 2217854b056Sbellard return __cmsg; 2227854b056Sbellard } 2237854b056Sbellard 2247854b056Sbellard 22531e31b8aSbellard struct target_rusage { 22631e31b8aSbellard struct target_timeval ru_utime; /* user time used */ 22731e31b8aSbellard struct target_timeval ru_stime; /* system time used */ 228992f48a0Sblueswir1 abi_long ru_maxrss; /* maximum resident set size */ 229992f48a0Sblueswir1 abi_long ru_ixrss; /* integral shared memory size */ 230992f48a0Sblueswir1 abi_long ru_idrss; /* integral unshared data size */ 231992f48a0Sblueswir1 abi_long ru_isrss; /* integral unshared stack size */ 232992f48a0Sblueswir1 abi_long ru_minflt; /* page reclaims */ 233992f48a0Sblueswir1 abi_long ru_majflt; /* page faults */ 234992f48a0Sblueswir1 abi_long ru_nswap; /* swaps */ 235992f48a0Sblueswir1 abi_long ru_inblock; /* block input operations */ 236992f48a0Sblueswir1 abi_long ru_oublock; /* block output operations */ 237992f48a0Sblueswir1 abi_long ru_msgsnd; /* messages sent */ 238992f48a0Sblueswir1 abi_long ru_msgrcv; /* messages received */ 239992f48a0Sblueswir1 abi_long ru_nsignals; /* signals received */ 240992f48a0Sblueswir1 abi_long ru_nvcsw; /* voluntary context switches */ 241992f48a0Sblueswir1 abi_long ru_nivcsw; /* involuntary " */ 24231e31b8aSbellard }; 24331e31b8aSbellard 24431e31b8aSbellard typedef struct { 24531e31b8aSbellard int val[2]; 246c227f099SAnthony Liguori } kernel_fsid_t; 24731e31b8aSbellard 24872f03900Sbellard struct kernel_statfs { 24931e31b8aSbellard int f_type; 25031e31b8aSbellard int f_bsize; 25131e31b8aSbellard int f_blocks; 25231e31b8aSbellard int f_bfree; 25331e31b8aSbellard int f_bavail; 25431e31b8aSbellard int f_files; 25531e31b8aSbellard int f_ffree; 256c227f099SAnthony Liguori kernel_fsid_t f_fsid; 25731e31b8aSbellard int f_namelen; 25831e31b8aSbellard int f_spare[6]; 25931e31b8aSbellard }; 26031e31b8aSbellard 261dab2ed99Sbellard struct target_dirent { 262992f48a0Sblueswir1 abi_long d_ino; 263992f48a0Sblueswir1 abi_long d_off; 264dab2ed99Sbellard unsigned short d_reclen; 265333858b7SDmitry V. Levin char d_name[]; 266dab2ed99Sbellard }; 267dab2ed99Sbellard 268dab2ed99Sbellard struct target_dirent64 { 269dab2ed99Sbellard uint64_t d_ino; 270dab2ed99Sbellard int64_t d_off; 271dab2ed99Sbellard unsigned short d_reclen; 272dab2ed99Sbellard unsigned char d_type; 273dab2ed99Sbellard char d_name[256]; 274dab2ed99Sbellard }; 275dab2ed99Sbellard 276dab2ed99Sbellard 27731e31b8aSbellard /* mostly generic signal stuff */ 278992f48a0Sblueswir1 #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ 279992f48a0Sblueswir1 #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ 280992f48a0Sblueswir1 #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ 28131e31b8aSbellard 28231e31b8aSbellard #ifdef TARGET_MIPS 28331e31b8aSbellard #define TARGET_NSIG 128 28431e31b8aSbellard #else 28531e31b8aSbellard #define TARGET_NSIG 64 28631e31b8aSbellard #endif 287992f48a0Sblueswir1 #define TARGET_NSIG_BPW TARGET_ABI_BITS 28831e31b8aSbellard #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) 28931e31b8aSbellard 29031e31b8aSbellard typedef struct { 291992f48a0Sblueswir1 abi_ulong sig[TARGET_NSIG_WORDS]; 292c227f099SAnthony Liguori } target_sigset_t; 29331e31b8aSbellard 29466fb9763Sbellard #ifdef BSWAP_NEEDED 295c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 29666fb9763Sbellard { 29766fb9763Sbellard int i; 29866fb9763Sbellard for(i = 0;i < TARGET_NSIG_WORDS; i++) 299cbb21eedSMatthias Braun d->sig[i] = tswapal(s->sig[i]); 30066fb9763Sbellard } 30166fb9763Sbellard #else 302c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 30366fb9763Sbellard { 30466fb9763Sbellard *d = *s; 30566fb9763Sbellard } 30666fb9763Sbellard #endif 30766fb9763Sbellard 308c227f099SAnthony Liguori static inline void target_siginitset(target_sigset_t *d, abi_ulong set) 30966fb9763Sbellard { 31066fb9763Sbellard int i; 31166fb9763Sbellard d->sig[0] = set; 31266fb9763Sbellard for(i = 1;i < TARGET_NSIG_WORDS; i++) 31366fb9763Sbellard d->sig[i] = 0; 31466fb9763Sbellard } 31566fb9763Sbellard 316c227f099SAnthony Liguori void host_to_target_sigset(target_sigset_t *d, const sigset_t *s); 317c227f099SAnthony Liguori void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); 318992f48a0Sblueswir1 void host_to_target_old_sigset(abi_ulong *old_sigset, 31966fb9763Sbellard const sigset_t *sigset); 32066fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset, 321992f48a0Sblueswir1 const abi_ulong *old_sigset); 32266fb9763Sbellard struct target_sigaction; 32366fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act, 32466fb9763Sbellard struct target_sigaction *oact); 32566fb9763Sbellard 326d2fbca94SGuan Xuetao #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \ 327d2fbca94SGuan Xuetao || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined(TARGET_SH4) \ 328d2fbca94SGuan Xuetao || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) \ 329a4c075f1SUlrich Hecht || defined(TARGET_MICROBLAZE) || defined(TARGET_UNICORE32) \ 330d962783eSJia Liu || defined(TARGET_S390X) || defined(TARGET_OPENRISC) 3312521d698Sbellard 332048f6b4dSbellard #if defined(TARGET_SPARC) 333048f6b4dSbellard #define TARGET_SA_NOCLDSTOP 8u 334048f6b4dSbellard #define TARGET_SA_NOCLDWAIT 0x100u 335048f6b4dSbellard #define TARGET_SA_SIGINFO 0x200u 336048f6b4dSbellard #define TARGET_SA_ONSTACK 1u 337048f6b4dSbellard #define TARGET_SA_RESTART 2u 338048f6b4dSbellard #define TARGET_SA_NODEFER 0x20u 339048f6b4dSbellard #define TARGET_SA_RESETHAND 4u 340048f6b4dSbellard #elif defined(TARGET_MIPS) 341048f6b4dSbellard #define TARGET_SA_NOCLDSTOP 0x00000001 342048f6b4dSbellard #define TARGET_SA_NOCLDWAIT 0x00010000 343048f6b4dSbellard #define TARGET_SA_SIGINFO 0x00000008 344048f6b4dSbellard #define TARGET_SA_ONSTACK 0x08000000 345048f6b4dSbellard #define TARGET_SA_NODEFER 0x40000000 346048f6b4dSbellard #define TARGET_SA_RESTART 0x10000000 347048f6b4dSbellard #define TARGET_SA_RESETHAND 0x80000000 348d26bc211Sths #if !defined(TARGET_ABI_MIPSN32) && !defined(TARGET_ABI_MIPSN64) 349d26bc211Sths #define TARGET_SA_RESTORER 0x04000000 /* Only for O32 */ 350540635baSths #endif 351d962783eSJia Liu #elif defined(TARGET_OPENRISC) 352d962783eSJia Liu #define TARGET_SA_NOCLDSTOP 0x00000001 353d962783eSJia Liu #define TARGET_SA_NOCLDWAIT 0x00000002 354d962783eSJia Liu #define TARGET_SA_SIGINFO 0x00000004 355d962783eSJia Liu #define TARGET_SA_ONSTACK 0x08000000 356d962783eSJia Liu #define TARGET_SA_RESTART 0x10000000 357d962783eSJia Liu #define TARGET_SA_NODEFER 0x40000000 358d962783eSJia Liu #define TARGET_SA_RESETHAND 0x80000000 35957f18a95SRichard Henderson #elif defined(TARGET_ALPHA) 36057f18a95SRichard Henderson #define TARGET_SA_ONSTACK 0x00000001 36157f18a95SRichard Henderson #define TARGET_SA_RESTART 0x00000002 36257f18a95SRichard Henderson #define TARGET_SA_NOCLDSTOP 0x00000004 36357f18a95SRichard Henderson #define TARGET_SA_NODEFER 0x00000008 36457f18a95SRichard Henderson #define TARGET_SA_RESETHAND 0x00000010 36557f18a95SRichard Henderson #define TARGET_SA_NOCLDWAIT 0x00000020 /* not supported yet */ 36657f18a95SRichard Henderson #define TARGET_SA_SIGINFO 0x00000040 367048f6b4dSbellard #else 3682521d698Sbellard #define TARGET_SA_NOCLDSTOP 0x00000001 3692521d698Sbellard #define TARGET_SA_NOCLDWAIT 0x00000002 /* not supported yet */ 3702521d698Sbellard #define TARGET_SA_SIGINFO 0x00000004 3712521d698Sbellard #define TARGET_SA_ONSTACK 0x08000000 3722521d698Sbellard #define TARGET_SA_RESTART 0x10000000 3732521d698Sbellard #define TARGET_SA_NODEFER 0x40000000 3742521d698Sbellard #define TARGET_SA_RESETHAND 0x80000000 3752521d698Sbellard #define TARGET_SA_RESTORER 0x04000000 3766d5e216dSbellard #endif 3776d5e216dSbellard 378d0f20495SRichard Henderson #if defined(TARGET_ALPHA) 379d0f20495SRichard Henderson 380d0f20495SRichard Henderson #define TARGET_SIGHUP 1 381d0f20495SRichard Henderson #define TARGET_SIGINT 2 382d0f20495SRichard Henderson #define TARGET_SIGQUIT 3 383d0f20495SRichard Henderson #define TARGET_SIGILL 4 384d0f20495SRichard Henderson #define TARGET_SIGTRAP 5 385d0f20495SRichard Henderson #define TARGET_SIGABRT 6 386d0f20495SRichard Henderson #define TARGET_SIGSTKFLT 7 /* actually SIGEMT */ 387d0f20495SRichard Henderson #define TARGET_SIGFPE 8 388d0f20495SRichard Henderson #define TARGET_SIGKILL 9 389d0f20495SRichard Henderson #define TARGET_SIGBUS 10 390d0f20495SRichard Henderson #define TARGET_SIGSEGV 11 391d0f20495SRichard Henderson #define TARGET_SIGSYS 12 392d0f20495SRichard Henderson #define TARGET_SIGPIPE 13 393d0f20495SRichard Henderson #define TARGET_SIGALRM 14 394d0f20495SRichard Henderson #define TARGET_SIGTERM 15 395d0f20495SRichard Henderson #define TARGET_SIGURG 16 396d0f20495SRichard Henderson #define TARGET_SIGSTOP 17 397d0f20495SRichard Henderson #define TARGET_SIGTSTP 18 398d0f20495SRichard Henderson #define TARGET_SIGCONT 19 399d0f20495SRichard Henderson #define TARGET_SIGCHLD 20 400d0f20495SRichard Henderson #define TARGET_SIGTTIN 21 401d0f20495SRichard Henderson #define TARGET_SIGTTOU 22 402d0f20495SRichard Henderson #define TARGET_SIGIO 23 403d0f20495SRichard Henderson #define TARGET_SIGXCPU 24 404d0f20495SRichard Henderson #define TARGET_SIGXFSZ 25 405d0f20495SRichard Henderson #define TARGET_SIGVTALRM 26 406d0f20495SRichard Henderson #define TARGET_SIGPROF 27 407d0f20495SRichard Henderson #define TARGET_SIGWINCH 28 408d0f20495SRichard Henderson #define TARGET_SIGPWR 29 /* actually SIGINFO */ 409d0f20495SRichard Henderson #define TARGET_SIGUSR1 30 410d0f20495SRichard Henderson #define TARGET_SIGUSR2 31 411d0f20495SRichard Henderson #define TARGET_SIGRTMIN 32 412d0f20495SRichard Henderson 413d0f20495SRichard Henderson #define TARGET_SIG_BLOCK 1 414d0f20495SRichard Henderson #define TARGET_SIG_UNBLOCK 2 415d0f20495SRichard Henderson #define TARGET_SIG_SETMASK 3 416d0f20495SRichard Henderson 417d0f20495SRichard Henderson #elif defined(TARGET_SPARC) 4186d5e216dSbellard 4196d5e216dSbellard #define TARGET_SIGHUP 1 4206d5e216dSbellard #define TARGET_SIGINT 2 4216d5e216dSbellard #define TARGET_SIGQUIT 3 4226d5e216dSbellard #define TARGET_SIGILL 4 4236d5e216dSbellard #define TARGET_SIGTRAP 5 4246d5e216dSbellard #define TARGET_SIGABRT 6 4256d5e216dSbellard #define TARGET_SIGIOT 6 4266d5e216dSbellard #define TARGET_SIGSTKFLT 7 /* actually EMT */ 4276d5e216dSbellard #define TARGET_SIGFPE 8 4286d5e216dSbellard #define TARGET_SIGKILL 9 4296d5e216dSbellard #define TARGET_SIGBUS 10 4306d5e216dSbellard #define TARGET_SIGSEGV 11 4316d5e216dSbellard #define TARGET_SIGSYS 12 4326d5e216dSbellard #define TARGET_SIGPIPE 13 4336d5e216dSbellard #define TARGET_SIGALRM 14 4346d5e216dSbellard #define TARGET_SIGTERM 15 4356d5e216dSbellard #define TARGET_SIGURG 16 4366d5e216dSbellard #define TARGET_SIGSTOP 17 4376d5e216dSbellard #define TARGET_SIGTSTP 18 4386d5e216dSbellard #define TARGET_SIGCONT 19 4396d5e216dSbellard #define TARGET_SIGCHLD 20 4406d5e216dSbellard #define TARGET_SIGTTIN 21 4416d5e216dSbellard #define TARGET_SIGTTOU 22 4426d5e216dSbellard #define TARGET_SIGIO 23 4436d5e216dSbellard #define TARGET_SIGXCPU 24 4446d5e216dSbellard #define TARGET_SIGXFSZ 25 4456d5e216dSbellard #define TARGET_SIGVTALRM 26 4466d5e216dSbellard #define TARGET_SIGPROF 27 4476d5e216dSbellard #define TARGET_SIGWINCH 28 4486d5e216dSbellard #define TARGET_SIGPWR 29 4496d5e216dSbellard #define TARGET_SIGUSR1 30 4506d5e216dSbellard #define TARGET_SIGUSR2 31 4516d5e216dSbellard #define TARGET_SIGRTMIN 32 4526d5e216dSbellard 4536d5e216dSbellard #define TARGET_SIG_BLOCK 0x01 /* for blocking signals */ 4546d5e216dSbellard #define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */ 4556d5e216dSbellard #define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */ 4566d5e216dSbellard 457048f6b4dSbellard #elif defined(TARGET_MIPS) 458048f6b4dSbellard 459048f6b4dSbellard #define TARGET_SIGHUP 1 /* Hangup (POSIX). */ 460048f6b4dSbellard #define TARGET_SIGINT 2 /* Interrupt (ANSI). */ 461048f6b4dSbellard #define TARGET_SIGQUIT 3 /* Quit (POSIX). */ 462048f6b4dSbellard #define TARGET_SIGILL 4 /* Illegal instruction (ANSI). */ 463048f6b4dSbellard #define TARGET_SIGTRAP 5 /* Trace trap (POSIX). */ 464048f6b4dSbellard #define TARGET_SIGIOT 6 /* IOT trap (4.2 BSD). */ 465048f6b4dSbellard #define TARGET_SIGABRT TARGET_SIGIOT /* Abort (ANSI). */ 466048f6b4dSbellard #define TARGET_SIGEMT 7 467048f6b4dSbellard #define TARGET_SIGSTKFLT 7 /* XXX: incorrect */ 468048f6b4dSbellard #define TARGET_SIGFPE 8 /* Floating-point exception (ANSI). */ 469048f6b4dSbellard #define TARGET_SIGKILL 9 /* Kill, unblockable (POSIX). */ 470048f6b4dSbellard #define TARGET_SIGBUS 10 /* BUS error (4.2 BSD). */ 471048f6b4dSbellard #define TARGET_SIGSEGV 11 /* Segmentation violation (ANSI). */ 472048f6b4dSbellard #define TARGET_SIGSYS 12 473048f6b4dSbellard #define TARGET_SIGPIPE 13 /* Broken pipe (POSIX). */ 474048f6b4dSbellard #define TARGET_SIGALRM 14 /* Alarm clock (POSIX). */ 475048f6b4dSbellard #define TARGET_SIGTERM 15 /* Termination (ANSI). */ 476048f6b4dSbellard #define TARGET_SIGUSR1 16 /* User-defined signal 1 (POSIX). */ 477048f6b4dSbellard #define TARGET_SIGUSR2 17 /* User-defined signal 2 (POSIX). */ 478048f6b4dSbellard #define TARGET_SIGCHLD 18 /* Child status has changed (POSIX). */ 479048f6b4dSbellard #define TARGET_SIGCLD TARGET_SIGCHLD /* Same as TARGET_SIGCHLD (System V). */ 480048f6b4dSbellard #define TARGET_SIGPWR 19 /* Power failure restart (System V). */ 481048f6b4dSbellard #define TARGET_SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */ 482048f6b4dSbellard #define TARGET_SIGURG 21 /* Urgent condition on socket (4.2 BSD). */ 483048f6b4dSbellard #define TARGET_SIGIO 22 /* I/O now possible (4.2 BSD). */ 484048f6b4dSbellard #define TARGET_SIGPOLL TARGET_SIGIO /* Pollable event occurred (System V). */ 485048f6b4dSbellard #define TARGET_SIGSTOP 23 /* Stop, unblockable (POSIX). */ 486048f6b4dSbellard #define TARGET_SIGTSTP 24 /* Keyboard stop (POSIX). */ 487048f6b4dSbellard #define TARGET_SIGCONT 25 /* Continue (POSIX). */ 488048f6b4dSbellard #define TARGET_SIGTTIN 26 /* Background read from tty (POSIX). */ 489048f6b4dSbellard #define TARGET_SIGTTOU 27 /* Background write to tty (POSIX). */ 490048f6b4dSbellard #define TARGET_SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */ 491048f6b4dSbellard #define TARGET_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */ 492048f6b4dSbellard #define TARGET_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ 493048f6b4dSbellard #define TARGET_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ 494048f6b4dSbellard #define TARGET_SIGRTMIN 32 495048f6b4dSbellard 496048f6b4dSbellard #define TARGET_SIG_BLOCK 1 /* for blocking signals */ 497048f6b4dSbellard #define TARGET_SIG_UNBLOCK 2 /* for unblocking signals */ 498048f6b4dSbellard #define TARGET_SIG_SETMASK 3 /* for setting the signal mask */ 499048f6b4dSbellard 5006d5e216dSbellard #else 5012521d698Sbellard 502d962783eSJia Liu /* OpenRISC Using the general signals */ 5032521d698Sbellard #define TARGET_SIGHUP 1 5042521d698Sbellard #define TARGET_SIGINT 2 5052521d698Sbellard #define TARGET_SIGQUIT 3 5062521d698Sbellard #define TARGET_SIGILL 4 5072521d698Sbellard #define TARGET_SIGTRAP 5 5082521d698Sbellard #define TARGET_SIGABRT 6 5092521d698Sbellard #define TARGET_SIGIOT 6 5102521d698Sbellard #define TARGET_SIGBUS 7 5112521d698Sbellard #define TARGET_SIGFPE 8 5122521d698Sbellard #define TARGET_SIGKILL 9 5132521d698Sbellard #define TARGET_SIGUSR1 10 5142521d698Sbellard #define TARGET_SIGSEGV 11 5152521d698Sbellard #define TARGET_SIGUSR2 12 5162521d698Sbellard #define TARGET_SIGPIPE 13 5172521d698Sbellard #define TARGET_SIGALRM 14 5182521d698Sbellard #define TARGET_SIGTERM 15 5192521d698Sbellard #define TARGET_SIGSTKFLT 16 5202521d698Sbellard #define TARGET_SIGCHLD 17 5212521d698Sbellard #define TARGET_SIGCONT 18 5222521d698Sbellard #define TARGET_SIGSTOP 19 5232521d698Sbellard #define TARGET_SIGTSTP 20 5242521d698Sbellard #define TARGET_SIGTTIN 21 5252521d698Sbellard #define TARGET_SIGTTOU 22 5262521d698Sbellard #define TARGET_SIGURG 23 5272521d698Sbellard #define TARGET_SIGXCPU 24 5282521d698Sbellard #define TARGET_SIGXFSZ 25 5292521d698Sbellard #define TARGET_SIGVTALRM 26 5302521d698Sbellard #define TARGET_SIGPROF 27 5312521d698Sbellard #define TARGET_SIGWINCH 28 5322521d698Sbellard #define TARGET_SIGIO 29 533c596ed17Sbellard #define TARGET_SIGPWR 30 534c596ed17Sbellard #define TARGET_SIGSYS 31 5352521d698Sbellard #define TARGET_SIGRTMIN 32 5362521d698Sbellard 5372521d698Sbellard #define TARGET_SIG_BLOCK 0 /* for blocking signals */ 5382521d698Sbellard #define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */ 5392521d698Sbellard #define TARGET_SIG_SETMASK 2 /* for setting the signal mask */ 5402521d698Sbellard 5416d5e216dSbellard #endif 5426d5e216dSbellard 5436049f4f8SRichard Henderson #if defined(TARGET_ALPHA) 5446049f4f8SRichard Henderson struct target_old_sigaction { 5456049f4f8SRichard Henderson abi_ulong _sa_handler; 5466049f4f8SRichard Henderson abi_ulong sa_mask; 547d2565875SRichard Henderson int32_t sa_flags; 5486049f4f8SRichard Henderson }; 549106ec879Sbellard 5506049f4f8SRichard Henderson struct target_rt_sigaction { 5516049f4f8SRichard Henderson abi_ulong _sa_handler; 5526049f4f8SRichard Henderson abi_ulong sa_flags; 5536049f4f8SRichard Henderson target_sigset_t sa_mask; 5546049f4f8SRichard Henderson }; 5556049f4f8SRichard Henderson 5566049f4f8SRichard Henderson /* This is the struct used inside the kernel. The ka_restorer 5576049f4f8SRichard Henderson field comes from the 5th argument to sys_rt_sigaction. */ 5586049f4f8SRichard Henderson struct target_sigaction { 5596049f4f8SRichard Henderson abi_ulong _sa_handler; 5606049f4f8SRichard Henderson abi_ulong sa_flags; 5616049f4f8SRichard Henderson target_sigset_t sa_mask; 5626049f4f8SRichard Henderson abi_ulong sa_restorer; 5636049f4f8SRichard Henderson }; 5646049f4f8SRichard Henderson #elif defined(TARGET_MIPS) 565106ec879Sbellard struct target_sigaction { 566540635baSths uint32_t sa_flags; 567d26bc211Sths #if defined(TARGET_ABI_MIPSN32) 568540635baSths uint32_t _sa_handler; 569540635baSths #else 570992f48a0Sblueswir1 abi_ulong _sa_handler; 571540635baSths #endif 572c227f099SAnthony Liguori target_sigset_t sa_mask; 573106ec879Sbellard }; 574106ec879Sbellard #else 5752521d698Sbellard struct target_old_sigaction { 576992f48a0Sblueswir1 abi_ulong _sa_handler; 577992f48a0Sblueswir1 abi_ulong sa_mask; 578992f48a0Sblueswir1 abi_ulong sa_flags; 579992f48a0Sblueswir1 abi_ulong sa_restorer; 5802521d698Sbellard }; 5812521d698Sbellard 5822521d698Sbellard struct target_sigaction { 583992f48a0Sblueswir1 abi_ulong _sa_handler; 584992f48a0Sblueswir1 abi_ulong sa_flags; 585992f48a0Sblueswir1 abi_ulong sa_restorer; 586c227f099SAnthony Liguori target_sigset_t sa_mask; 5872521d698Sbellard }; 588106ec879Sbellard #endif 5892521d698Sbellard 5902521d698Sbellard typedef union target_sigval { 5912521d698Sbellard int sival_int; 592992f48a0Sblueswir1 abi_ulong sival_ptr; 593c227f099SAnthony Liguori } target_sigval_t; 5946d5e216dSbellard #if 0 5956d5e216dSbellard #if defined (TARGET_SPARC) 5966d5e216dSbellard typedef struct { 5976d5e216dSbellard struct { 598992f48a0Sblueswir1 abi_ulong psr; 599992f48a0Sblueswir1 abi_ulong pc; 600992f48a0Sblueswir1 abi_ulong npc; 601992f48a0Sblueswir1 abi_ulong y; 602992f48a0Sblueswir1 abi_ulong u_regs[16]; /* globals and ins */ 6036d5e216dSbellard } si_regs; 6046d5e216dSbellard int si_mask; 6056d5e216dSbellard } __siginfo_t; 6066d5e216dSbellard 6076d5e216dSbellard typedef struct { 6086d5e216dSbellard unsigned long si_float_regs [32]; 6096d5e216dSbellard unsigned long si_fsr; 6106d5e216dSbellard unsigned long si_fpqdepth; 6116d5e216dSbellard struct { 6126d5e216dSbellard unsigned long *insn_addr; 6136d5e216dSbellard unsigned long insn; 6146d5e216dSbellard } si_fpqueue [16]; 6156d5e216dSbellard } __siginfo_fpu_t; 6166d5e216dSbellard #endif 6176d5e216dSbellard #endif 6182521d698Sbellard 6192521d698Sbellard #define TARGET_SI_MAX_SIZE 128 6202521d698Sbellard #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE/sizeof(int)) - 3) 6212521d698Sbellard 6222521d698Sbellard typedef struct target_siginfo { 6233f53d546Spbrook #ifdef TARGET_MIPS 6243f53d546Spbrook int si_signo; 6253f53d546Spbrook int si_code; 6263f53d546Spbrook int si_errno; 6273f53d546Spbrook #else 6282521d698Sbellard int si_signo; 6292521d698Sbellard int si_errno; 6302521d698Sbellard int si_code; 6313f53d546Spbrook #endif 6322521d698Sbellard 6332521d698Sbellard union { 6342521d698Sbellard int _pad[TARGET_SI_PAD_SIZE]; 6352521d698Sbellard 6362521d698Sbellard /* kill() */ 6372521d698Sbellard struct { 6382521d698Sbellard pid_t _pid; /* sender's pid */ 6392521d698Sbellard uid_t _uid; /* sender's uid */ 6402521d698Sbellard } _kill; 6412521d698Sbellard 6422521d698Sbellard /* POSIX.1b timers */ 6432521d698Sbellard struct { 6442521d698Sbellard unsigned int _timer1; 6452521d698Sbellard unsigned int _timer2; 6462521d698Sbellard } _timer; 6472521d698Sbellard 6482521d698Sbellard /* POSIX.1b signals */ 6492521d698Sbellard struct { 6502521d698Sbellard pid_t _pid; /* sender's pid */ 6512521d698Sbellard uid_t _uid; /* sender's uid */ 652c227f099SAnthony Liguori target_sigval_t _sigval; 6532521d698Sbellard } _rt; 6542521d698Sbellard 6552521d698Sbellard /* SIGCHLD */ 6562521d698Sbellard struct { 6572521d698Sbellard pid_t _pid; /* which child */ 6582521d698Sbellard uid_t _uid; /* sender's uid */ 6592521d698Sbellard int _status; /* exit code */ 660c227f099SAnthony Liguori target_clock_t _utime; 661c227f099SAnthony Liguori target_clock_t _stime; 6622521d698Sbellard } _sigchld; 6632521d698Sbellard 6642521d698Sbellard /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 6652521d698Sbellard struct { 666992f48a0Sblueswir1 abi_ulong _addr; /* faulting insn/memory ref. */ 6672521d698Sbellard } _sigfault; 6682521d698Sbellard 6692521d698Sbellard /* SIGPOLL */ 6702521d698Sbellard struct { 6712521d698Sbellard int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 6722521d698Sbellard int _fd; 6732521d698Sbellard } _sigpoll; 6742521d698Sbellard } _sifields; 675c227f099SAnthony Liguori } target_siginfo_t; 6762521d698Sbellard 6772521d698Sbellard /* 6782521d698Sbellard * si_code values 6792521d698Sbellard * Digital reserves positive values for kernel-generated signals. 6802521d698Sbellard */ 6812521d698Sbellard #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ 6822521d698Sbellard #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 6832521d698Sbellard #define TARGET_SI_QUEUE -1 /* sent by sigqueue */ 6842521d698Sbellard #define TARGET_SI_TIMER -2 /* sent by timer expiration */ 6852521d698Sbellard #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ 6862521d698Sbellard #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ 6872521d698Sbellard #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ 6882521d698Sbellard 6892521d698Sbellard /* 6902521d698Sbellard * SIGILL si_codes 6912521d698Sbellard */ 692ffa65c3bSbellard #define TARGET_ILL_ILLOPC (1) /* illegal opcode */ 6932521d698Sbellard #define TARGET_ILL_ILLOPN (2) /* illegal operand */ 694ffa65c3bSbellard #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ 695ffa65c3bSbellard #define TARGET_ILL_ILLTRP (4) /* illegal trap */ 696ffa65c3bSbellard #define TARGET_ILL_PRVOPC (5) /* privileged opcode */ 697ffa65c3bSbellard #define TARGET_ILL_PRVREG (6) /* privileged register */ 698ffa65c3bSbellard #define TARGET_ILL_COPROC (7) /* coprocessor error */ 699ffa65c3bSbellard #define TARGET_ILL_BADSTK (8) /* internal stack error */ 7002521d698Sbellard 7012521d698Sbellard /* 7022521d698Sbellard * SIGFPE si_codes 7032521d698Sbellard */ 7042521d698Sbellard #define TARGET_FPE_INTDIV (1) /* integer divide by zero */ 7052521d698Sbellard #define TARGET_FPE_INTOVF (2) /* integer overflow */ 7062521d698Sbellard #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ 7072521d698Sbellard #define TARGET_FPE_FLTOVF (4) /* floating point overflow */ 7082521d698Sbellard #define TARGET_FPE_FLTUND (5) /* floating point underflow */ 7092521d698Sbellard #define TARGET_FPE_FLTRES (6) /* floating point inexact result */ 7102521d698Sbellard #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ 7112521d698Sbellard #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ 7122521d698Sbellard #define TARGET_NSIGFPE 8 7132521d698Sbellard 7142521d698Sbellard /* 7152521d698Sbellard * SIGSEGV si_codes 7162521d698Sbellard */ 7172521d698Sbellard #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ 7182521d698Sbellard #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ 7192521d698Sbellard 7202521d698Sbellard /* 721ffa65c3bSbellard * SIGBUS si_codes 722ffa65c3bSbellard */ 723ffa65c3bSbellard #define TARGET_BUS_ADRALN (1) /* invalid address alignment */ 724b4916d7bSDong Xu Wang #define TARGET_BUS_ADRERR (2) /* non-existent physical address */ 725ffa65c3bSbellard #define TARGET_BUS_OBJERR (3) /* object specific hardware error */ 726ffa65c3bSbellard 727ffa65c3bSbellard /* 7282521d698Sbellard * SIGTRAP si_codes 7292521d698Sbellard */ 7302521d698Sbellard #define TARGET_TRAP_BRKPT (1) /* process breakpoint */ 7312521d698Sbellard #define TARGET_TRAP_TRACE (2) /* process trace trap */ 7322521d698Sbellard 7332521d698Sbellard #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */ 7342521d698Sbellard 7359de5e440Sbellard struct target_rlimit { 736992f48a0Sblueswir1 abi_ulong rlim_cur; 737992f48a0Sblueswir1 abi_ulong rlim_max; 7389de5e440Sbellard }; 7399de5e440Sbellard 74081bbe906Stakasi-y@ops.dti.ne.jp #if defined(TARGET_ALPHA) 741e476492eSAurelien Jarno #define TARGET_RLIM_INFINITY 0x7fffffffffffffffull 7426cafd027SMatthias Braun #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32) 74381bbe906Stakasi-y@ops.dti.ne.jp #define TARGET_RLIM_INFINITY 0x7fffffffUL 74481bbe906Stakasi-y@ops.dti.ne.jp #else 74526b746dbSMatthias Braun #define TARGET_RLIM_INFINITY ((abi_ulong)-1) 74681bbe906Stakasi-y@ops.dti.ne.jp #endif 74781bbe906Stakasi-y@ops.dti.ne.jp 748e22b7015SWesley W. Terpstra #if defined(TARGET_MIPS) 749e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 750e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 751e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 752e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 753e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 754e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 7 755e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 8 756e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 5 757e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 9 758e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 6 759e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 760e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 761e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 762e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 763e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 764e22b7015SWesley W. Terpstra #else 765e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 766e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 767e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 768e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 769e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 770e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 5 7716cafd027SMatthias Braun #if defined(TARGET_SPARC) 7726cafd027SMatthias Braun #define TARGET_RLIMIT_NOFILE 6 7736cafd027SMatthias Braun #define TARGET_RLIMIT_NPROC 7 7746cafd027SMatthias Braun #else 775e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 6 776e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 7 7776cafd027SMatthias Braun #endif 778e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 8 779e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 9 780e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 781e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 782e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 783e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 784e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 785e22b7015SWesley W. Terpstra #endif 786e22b7015SWesley W. Terpstra 7879de5e440Sbellard struct target_pollfd { 7889de5e440Sbellard int fd; /* file descriptor */ 7899de5e440Sbellard short events; /* requested events */ 7909de5e440Sbellard short revents; /* returned events */ 7919de5e440Sbellard }; 7929de5e440Sbellard 7938e5a0667Sbellard /* virtual terminal ioctls */ 7940221cfcdSbellard #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ 7950221cfcdSbellard #define TARGET_KDMKTONE 0x4B30 /* generate tone */ 7968e5a0667Sbellard #define TARGET_KDGKBTYPE 0x4b33 797f7680a55SUlrich Hecht #define TARGET_KDSETMODE 0x4b3a 798f7680a55SUlrich Hecht #define TARGET_KDGKBMODE 0x4b44 799f7680a55SUlrich Hecht #define TARGET_KDSKBMODE 0x4b45 8000221cfcdSbellard #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ 8010221cfcdSbellard #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ 802e6fe18fbSCédric VINCENT #define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ 803e6fe18fbSCédric VINCENT #define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ 804e6fe18fbSCédric VINCENT #define TARGET_KDGETLED 0x4B31 /* return current led state */ 805e6fe18fbSCédric VINCENT #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */ 8068e5a0667Sbellard 8072521d698Sbellard #define TARGET_SIOCATMARK 0x8905 8082521d698Sbellard 80931e31b8aSbellard /* Networking ioctls */ 81031e31b8aSbellard #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ 81131e31b8aSbellard #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ 81231e31b8aSbellard #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ 81331e31b8aSbellard #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ 81431e31b8aSbellard #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ 81531e31b8aSbellard #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ 81631e31b8aSbellard #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ 81731e31b8aSbellard #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ 81831e31b8aSbellard #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ 81931e31b8aSbellard #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ 82031e31b8aSbellard #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ 82131e31b8aSbellard #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ 82231e31b8aSbellard #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ 82331e31b8aSbellard #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ 82431e31b8aSbellard #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ 82531e31b8aSbellard #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ 82631e31b8aSbellard #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ 82731e31b8aSbellard #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ 82831e31b8aSbellard #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ 82931e31b8aSbellard #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ 83031e31b8aSbellard #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ 83131e31b8aSbellard #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ 83231e31b8aSbellard #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ 83331e31b8aSbellard #define TARGET_SIOCSIFENCAP 0x8926 83431e31b8aSbellard #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ 83531e31b8aSbellard #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ 83631e31b8aSbellard #define TARGET_SIOCSIFSLAVE 0x8930 83731e31b8aSbellard #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ 83831e31b8aSbellard #define TARGET_SIOCDELMULTI 0x8932 83931e31b8aSbellard 84031e31b8aSbellard /* Bridging control calls */ 84131e31b8aSbellard #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ 84231e31b8aSbellard #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ 84331e31b8aSbellard 84431e31b8aSbellard #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ 84531e31b8aSbellard #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ 84631e31b8aSbellard 84731e31b8aSbellard /* ARP cache control calls. */ 84831e31b8aSbellard #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ 84931e31b8aSbellard #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ 85031e31b8aSbellard #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ 85131e31b8aSbellard #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ 85231e31b8aSbellard #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ 85331e31b8aSbellard #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ 85431e31b8aSbellard 85531e31b8aSbellard /* RARP cache control calls. */ 85631e31b8aSbellard #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ 85731e31b8aSbellard #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ 85831e31b8aSbellard #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ 85931e31b8aSbellard 86031e31b8aSbellard /* Driver configuration calls */ 86131e31b8aSbellard #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ 86231e31b8aSbellard #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ 86331e31b8aSbellard 86431e31b8aSbellard /* DLCI configuration calls */ 86531e31b8aSbellard #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ 86631e31b8aSbellard #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ 86731e31b8aSbellard 86886fcd946SLaurent Vivier /* From <linux/wireless.h> */ 86986fcd946SLaurent Vivier 87086fcd946SLaurent Vivier #define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ 87131e31b8aSbellard 87231e31b8aSbellard /* From <linux/fs.h> */ 87331e31b8aSbellard 87431e31b8aSbellard #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ 87531e31b8aSbellard #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ 87631e31b8aSbellard #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ 87731e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ 87831e31b8aSbellard #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ 87931e31b8aSbellard #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ 88031e31b8aSbellard #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ 88131e31b8aSbellard #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ 88231e31b8aSbellard #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ 88331e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ 88431e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ 88531e31b8aSbellard #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ 88631e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */ 887c8b0bf54SPeter Maydell #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong) 888c8b0bf54SPeter Maydell #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong) 889edafea13SAlexander Graf #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) 890edafea13SAlexander Graf /* return device size in bytes 891edafea13SAlexander Graf (u64 *arg) */ 89231e31b8aSbellard #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ 89331e31b8aSbellard #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ 894285da2b9SPeter Maydell #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) 89531e31b8aSbellard 89631e31b8aSbellard /* cdrom commands */ 89731e31b8aSbellard #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ 89831e31b8aSbellard #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ 89931e31b8aSbellard #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ 90031e31b8aSbellard #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index 90131e31b8aSbellard (struct cdrom_ti) */ 90231e31b8aSbellard #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header 90331e31b8aSbellard (struct cdrom_tochdr) */ 90431e31b8aSbellard #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry 90531e31b8aSbellard (struct cdrom_tocentry) */ 90631e31b8aSbellard #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ 90731e31b8aSbellard #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ 90831e31b8aSbellard #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ 90931e31b8aSbellard #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume 91031e31b8aSbellard (struct cdrom_volctrl) */ 91131e31b8aSbellard #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data 91231e31b8aSbellard (struct cdrom_subchnl) */ 91331e31b8aSbellard #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) 91431e31b8aSbellard (struct cdrom_read) */ 91531e31b8aSbellard #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) 91631e31b8aSbellard (struct cdrom_read) */ 91731e31b8aSbellard #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ 91831e31b8aSbellard #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ 91931e31b8aSbellard #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session 92031e31b8aSbellard address of multi session disks 92131e31b8aSbellard (struct cdrom_multisession) */ 92231e31b8aSbellard #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" 92331e31b8aSbellard if available (struct cdrom_mcn) */ 92431e31b8aSbellard #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is depricated, 925b4916d7bSDong Xu Wang but here anyway for compatibility */ 92631e31b8aSbellard #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ 92731e31b8aSbellard #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting 92831e31b8aSbellard (struct cdrom_volctrl) */ 92931e31b8aSbellard #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) 93031e31b8aSbellard (struct cdrom_read) */ 93131e31b8aSbellard /* 93231e31b8aSbellard * These ioctls are used only used in aztcd.c and optcd.c 93331e31b8aSbellard */ 93431e31b8aSbellard #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ 93531e31b8aSbellard #define TARGET_CDROMSEEK 0x5316 /* seek msf address */ 93631e31b8aSbellard 93731e31b8aSbellard /* 93831e31b8aSbellard * This ioctl is only used by the scsi-cd driver. 93931e31b8aSbellard It is for playing audio in logical block addressing mode. 94031e31b8aSbellard */ 94131e31b8aSbellard #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ 94231e31b8aSbellard 94331e31b8aSbellard /* 94431e31b8aSbellard * These ioctls are only used in optcd.c 94531e31b8aSbellard */ 94631e31b8aSbellard #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ 94731e31b8aSbellard 94831e31b8aSbellard /* 94931e31b8aSbellard * These ioctls are (now) only in ide-cd.c for controlling 95031e31b8aSbellard * drive spindown time. They should be implemented in the 95131e31b8aSbellard * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, 95231e31b8aSbellard * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... 95331e31b8aSbellard * -Erik 95431e31b8aSbellard */ 95531e31b8aSbellard #define TARGET_CDROMGETSPINDOWN 0x531d 95631e31b8aSbellard #define TARGET_CDROMSETSPINDOWN 0x531e 95731e31b8aSbellard 95831e31b8aSbellard /* 95931e31b8aSbellard * These ioctls are implemented through the uniform CD-ROM driver 96031e31b8aSbellard * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM 96131e31b8aSbellard * drivers are eventually ported to the uniform CD-ROM driver interface. 96231e31b8aSbellard */ 96331e31b8aSbellard #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ 96431e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ 96531e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ 96631e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ 96731e31b8aSbellard #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ 96831e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ 96931e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ 97031e31b8aSbellard #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ 97131e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ 97231e31b8aSbellard #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ 97331e31b8aSbellard #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ 97431e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ 97531e31b8aSbellard 97631e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. 97731e31b8aSbellard * Future CDROM ioctls should be kept below 0x537F 97831e31b8aSbellard */ 97931e31b8aSbellard 98031e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */ 98131e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ 98231e31b8aSbellard /* conflict with SCSI_IOCTL_GET_IDLUN */ 98331e31b8aSbellard 98431e31b8aSbellard /* DVD-ROM Specific ioctls */ 98531e31b8aSbellard #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ 98631e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ 98731e31b8aSbellard #define TARGET_DVD_AUTH 0x5392 /* Authentication */ 98831e31b8aSbellard 98931e31b8aSbellard #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ 99031e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ 99131e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ 99231e31b8aSbellard 99331e31b8aSbellard /* HD commands */ 99431e31b8aSbellard 99531e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ 99631e31b8aSbellard #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ 99731e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ 99831e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ 99931e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ 100031e31b8aSbellard #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ 100131e31b8aSbellard #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ 100231e31b8aSbellard #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ 10032521d698Sbellard #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ 100431e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ 100531e31b8aSbellard 100631e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ 100731e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ 100831e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ 100931e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ 101031e31b8aSbellard #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ 101131e31b8aSbellard #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ 101231e31b8aSbellard #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ 101331e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ 10142521d698Sbellard 1015b8005914Sbalrog /* loop ioctls */ 1016b8005914Sbalrog #define TARGET_LOOP_SET_FD 0x4C00 1017b8005914Sbalrog #define TARGET_LOOP_CLR_FD 0x4C01 1018b8005914Sbalrog #define TARGET_LOOP_SET_STATUS 0x4C02 1019b8005914Sbalrog #define TARGET_LOOP_GET_STATUS 0x4C03 1020b8005914Sbalrog #define TARGET_LOOP_SET_STATUS64 0x4C04 1021b8005914Sbalrog #define TARGET_LOOP_GET_STATUS64 0x4C05 1022b8005914Sbalrog #define TARGET_LOOP_CHANGE_FD 0x4C06 10232521d698Sbellard 1024f7680a55SUlrich Hecht /* fb ioctls */ 1025f7680a55SUlrich Hecht #define TARGET_FBIOGET_VSCREENINFO 0x4600 1026f7680a55SUlrich Hecht #define TARGET_FBIOPUT_VSCREENINFO 0x4601 1027f7680a55SUlrich Hecht #define TARGET_FBIOGET_FSCREENINFO 0x4602 102812b81b71SCédric VINCENT #define TARGET_FBIOGETCMAP 0x4604 102912b81b71SCédric VINCENT #define TARGET_FBIOPUTCMAP 0x4605 103012b81b71SCédric VINCENT #define TARGET_FBIOPAN_DISPLAY 0x4606 103112b81b71SCédric VINCENT #define TARGET_FBIOGET_CON2FBMAP 0x460F 103212b81b71SCédric VINCENT #define TARGET_FBIOPUT_CON2FBMAP 0x4610 1033f7680a55SUlrich Hecht 1034f7680a55SUlrich Hecht /* vt ioctls */ 1035f7680a55SUlrich Hecht #define TARGET_VT_OPENQRY 0x5600 1036f7680a55SUlrich Hecht #define TARGET_VT_GETSTATE 0x5603 1037f7680a55SUlrich Hecht #define TARGET_VT_ACTIVATE 0x5606 1038f7680a55SUlrich Hecht #define TARGET_VT_WAITACTIVE 0x5607 1039f7680a55SUlrich Hecht #define TARGET_VT_LOCKSWITCH 0x560b 1040f7680a55SUlrich Hecht #define TARGET_VT_UNLOCKSWITCH 0x560c 1041774750c0SCédric VINCENT #define TARGET_VT_GETMODE 0x5601 1042774750c0SCédric VINCENT #define TARGET_VT_SETMODE 0x5602 1043774750c0SCédric VINCENT #define TARGET_VT_RELDISP 0x5605 1044774750c0SCédric VINCENT #define TARGET_VT_DISALLOCATE 0x5608 1045f7680a55SUlrich Hecht 104656e904ecSAlexander Graf /* device mapper */ 104756e904ecSAlexander Graf #define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00) 104856e904ecSAlexander Graf #define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01) 104956e904ecSAlexander Graf #define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02) 105056e904ecSAlexander Graf #define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03) 105156e904ecSAlexander Graf #define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04) 105256e904ecSAlexander Graf #define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05) 105356e904ecSAlexander Graf #define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06) 105456e904ecSAlexander Graf #define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07) 105556e904ecSAlexander Graf #define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08) 105656e904ecSAlexander Graf #define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09) 105756e904ecSAlexander Graf #define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a) 105856e904ecSAlexander Graf #define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b) 105956e904ecSAlexander Graf #define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c) 106056e904ecSAlexander Graf #define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d) 106156e904ecSAlexander Graf #define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e) 106256e904ecSAlexander Graf #define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f) 106356e904ecSAlexander Graf 10642521d698Sbellard /* from asm/termbits.h */ 10652521d698Sbellard 10663bfd9da1Sbellard #define TARGET_NCC 8 10673bfd9da1Sbellard struct target_termio { 10683bfd9da1Sbellard unsigned short c_iflag; /* input mode flags */ 10693bfd9da1Sbellard unsigned short c_oflag; /* output mode flags */ 10703bfd9da1Sbellard unsigned short c_cflag; /* control mode flags */ 10713bfd9da1Sbellard unsigned short c_lflag; /* local mode flags */ 10722521d698Sbellard unsigned char c_line; /* line discipline */ 10733bfd9da1Sbellard unsigned char c_cc[TARGET_NCC]; /* control characters */ 10742521d698Sbellard }; 10752521d698Sbellard 10763bfd9da1Sbellard struct target_winsize { 10773bfd9da1Sbellard unsigned short ws_row; 10783bfd9da1Sbellard unsigned short ws_col; 10793bfd9da1Sbellard unsigned short ws_xpixel; 10803bfd9da1Sbellard unsigned short ws_ypixel; 10813bfd9da1Sbellard }; 10822521d698Sbellard 10833bfd9da1Sbellard #include "termbits.h" 10842521d698Sbellard 10859e0b74a4SPaul Brook #if defined(TARGET_MIPS) 10869e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x10 10879e0b74a4SPaul Brook #else 10889e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x08 10899e0b74a4SPaul Brook #endif 10909e0b74a4SPaul Brook 1091e44a3e79Saurel32 /* Common */ 10922521d698Sbellard #define TARGET_MAP_SHARED 0x01 /* Share changes */ 10932521d698Sbellard #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ 10942521d698Sbellard #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ 1095e44a3e79Saurel32 1096e44a3e79Saurel32 /* Target specific */ 1097048f6b4dSbellard #if defined(TARGET_MIPS) 1098e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1099048f6b4dSbellard #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 1100048f6b4dSbellard #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 1101048f6b4dSbellard #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 1102048f6b4dSbellard #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 1103048f6b4dSbellard #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 1104048f6b4dSbellard #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 1105540635baSths #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 1106540635baSths #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1107e44a3e79Saurel32 #elif defined(TARGET_PPC) 1108e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 11092521d698Sbellard #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 11102521d698Sbellard #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 11112521d698Sbellard #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 11122521d698Sbellard #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 11137ec93196Sj_mayer #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ 11147ec93196Sj_mayer #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ 1115e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1116e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1117e44a3e79Saurel32 #elif defined(TARGET_ALPHA) 1118e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1119e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ 1120e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ 1121e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ 1122e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ 1123e44a3e79Saurel32 #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ 1124e44a3e79Saurel32 #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ 1125e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ 1126e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ 11277ec93196Sj_mayer #else 1128e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1129e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 1130e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 1131e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 1132e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 11332521d698Sbellard #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ 11342521d698Sbellard #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ 1135540635baSths #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1136540635baSths #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1137906c1b8eSMike Frysinger #define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ 11387ec93196Sj_mayer #endif 11392521d698Sbellard 1140d2fbca94SGuan Xuetao #if (defined(TARGET_I386) && defined(TARGET_ABI32)) || defined(TARGET_ARM) \ 1141*c7819dfbSPeter Maydell || defined(TARGET_CRIS) || defined(TARGET_UNICORE32) 11422521d698Sbellard struct target_stat { 11432521d698Sbellard unsigned short st_dev; 11442521d698Sbellard unsigned short __pad1; 1145992f48a0Sblueswir1 abi_ulong st_ino; 11462521d698Sbellard unsigned short st_mode; 11472521d698Sbellard unsigned short st_nlink; 11482521d698Sbellard unsigned short st_uid; 11492521d698Sbellard unsigned short st_gid; 11502521d698Sbellard unsigned short st_rdev; 11512521d698Sbellard unsigned short __pad2; 1152992f48a0Sblueswir1 abi_ulong st_size; 1153992f48a0Sblueswir1 abi_ulong st_blksize; 1154992f48a0Sblueswir1 abi_ulong st_blocks; 1155992f48a0Sblueswir1 abi_ulong target_st_atime; 1156992f48a0Sblueswir1 abi_ulong __unused1; 1157992f48a0Sblueswir1 abi_ulong target_st_mtime; 1158992f48a0Sblueswir1 abi_ulong __unused2; 1159992f48a0Sblueswir1 abi_ulong target_st_ctime; 1160992f48a0Sblueswir1 abi_ulong __unused3; 1161992f48a0Sblueswir1 abi_ulong __unused4; 1162992f48a0Sblueswir1 abi_ulong __unused5; 11632521d698Sbellard }; 11642521d698Sbellard 11652521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely 11662521d698Sbellard * insane amounts of padding around dev_t's. 11672521d698Sbellard */ 11682521d698Sbellard struct target_stat64 { 11692521d698Sbellard unsigned short st_dev; 11702521d698Sbellard unsigned char __pad0[10]; 11712521d698Sbellard 11722521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1173992f48a0Sblueswir1 abi_ulong __st_ino; 11742521d698Sbellard 11752521d698Sbellard unsigned int st_mode; 11762521d698Sbellard unsigned int st_nlink; 11772521d698Sbellard 1178992f48a0Sblueswir1 abi_ulong st_uid; 1179992f48a0Sblueswir1 abi_ulong st_gid; 11802521d698Sbellard 11812521d698Sbellard unsigned short st_rdev; 11822521d698Sbellard unsigned char __pad3[10]; 11832521d698Sbellard 11842521d698Sbellard long long st_size; 1185992f48a0Sblueswir1 abi_ulong st_blksize; 11862521d698Sbellard 1187992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1188992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 11892521d698Sbellard 1190992f48a0Sblueswir1 abi_ulong target_st_atime; 1191992f48a0Sblueswir1 abi_ulong __pad5; 11922521d698Sbellard 1193992f48a0Sblueswir1 abi_ulong target_st_mtime; 1194992f48a0Sblueswir1 abi_ulong __pad6; 11952521d698Sbellard 1196992f48a0Sblueswir1 abi_ulong target_st_ctime; 1197992f48a0Sblueswir1 abi_ulong __pad7; /* will be high 32 bits of ctime someday */ 11982521d698Sbellard 11992521d698Sbellard unsigned long long st_ino; 1200541dc0d4SStefan Weil } QEMU_PACKED; 12012521d698Sbellard 1202ce4defa0Spbrook #ifdef TARGET_ARM 1203ce4defa0Spbrook struct target_eabi_stat64 { 1204ce4defa0Spbrook unsigned long long st_dev; 1205ce4defa0Spbrook unsigned int __pad1; 1206992f48a0Sblueswir1 abi_ulong __st_ino; 1207ce4defa0Spbrook unsigned int st_mode; 1208ce4defa0Spbrook unsigned int st_nlink; 1209ce4defa0Spbrook 1210992f48a0Sblueswir1 abi_ulong st_uid; 1211992f48a0Sblueswir1 abi_ulong st_gid; 1212ce4defa0Spbrook 1213ce4defa0Spbrook unsigned long long st_rdev; 1214ce4defa0Spbrook unsigned int __pad2[2]; 1215ce4defa0Spbrook 1216ce4defa0Spbrook long long st_size; 1217992f48a0Sblueswir1 abi_ulong st_blksize; 1218ce4defa0Spbrook unsigned int __pad3; 1219ce4defa0Spbrook unsigned long long st_blocks; 1220ce4defa0Spbrook 1221992f48a0Sblueswir1 abi_ulong target_st_atime; 1222992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1223ce4defa0Spbrook 1224992f48a0Sblueswir1 abi_ulong target_st_mtime; 1225992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1226ce4defa0Spbrook 1227992f48a0Sblueswir1 abi_ulong target_st_ctime; 1228992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1229ce4defa0Spbrook 1230ce4defa0Spbrook unsigned long long st_ino; 1231541dc0d4SStefan Weil } QEMU_PACKED; 1232ce4defa0Spbrook #endif 1233ce4defa0Spbrook 1234992f48a0Sblueswir1 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 12351b8dd648Sblueswir1 struct target_stat { 12361b8dd648Sblueswir1 unsigned int st_dev; 1237992f48a0Sblueswir1 abi_ulong st_ino; 12381b8dd648Sblueswir1 unsigned int st_mode; 12391b8dd648Sblueswir1 unsigned int st_nlink; 12401b8dd648Sblueswir1 unsigned int st_uid; 12411b8dd648Sblueswir1 unsigned int st_gid; 12421b8dd648Sblueswir1 unsigned int st_rdev; 1243992f48a0Sblueswir1 abi_long st_size; 1244992f48a0Sblueswir1 abi_long target_st_atime; 1245992f48a0Sblueswir1 abi_long target_st_mtime; 1246992f48a0Sblueswir1 abi_long target_st_ctime; 1247992f48a0Sblueswir1 abi_long st_blksize; 1248992f48a0Sblueswir1 abi_long st_blocks; 1249992f48a0Sblueswir1 abi_ulong __unused4[2]; 12501b8dd648Sblueswir1 }; 12511b8dd648Sblueswir1 12521b8dd648Sblueswir1 struct target_stat64 { 12531b8dd648Sblueswir1 unsigned char __pad0[6]; 12541b8dd648Sblueswir1 unsigned short st_dev; 12551b8dd648Sblueswir1 12561b8dd648Sblueswir1 uint64_t st_ino; 12571b8dd648Sblueswir1 uint64_t st_nlink; 12581b8dd648Sblueswir1 12591b8dd648Sblueswir1 unsigned int st_mode; 12601b8dd648Sblueswir1 12611b8dd648Sblueswir1 unsigned int st_uid; 12621b8dd648Sblueswir1 unsigned int st_gid; 12631b8dd648Sblueswir1 12641b8dd648Sblueswir1 unsigned char __pad2[6]; 12651b8dd648Sblueswir1 unsigned short st_rdev; 12661b8dd648Sblueswir1 12671b8dd648Sblueswir1 int64_t st_size; 12681b8dd648Sblueswir1 int64_t st_blksize; 12691b8dd648Sblueswir1 12701b8dd648Sblueswir1 unsigned char __pad4[4]; 12711b8dd648Sblueswir1 unsigned int st_blocks; 12721b8dd648Sblueswir1 1273992f48a0Sblueswir1 abi_ulong target_st_atime; 1274992f48a0Sblueswir1 abi_ulong __unused1; 12751b8dd648Sblueswir1 1276992f48a0Sblueswir1 abi_ulong target_st_mtime; 1277992f48a0Sblueswir1 abi_ulong __unused2; 12781b8dd648Sblueswir1 1279992f48a0Sblueswir1 abi_ulong target_st_ctime; 1280992f48a0Sblueswir1 abi_ulong __unused3; 12811b8dd648Sblueswir1 1282992f48a0Sblueswir1 abi_ulong __unused4[3]; 12831b8dd648Sblueswir1 }; 12841b8dd648Sblueswir1 12853bfd9da1Sbellard #elif defined(TARGET_SPARC) 12863bfd9da1Sbellard 12873bfd9da1Sbellard struct target_stat { 12883bfd9da1Sbellard unsigned short st_dev; 1289992f48a0Sblueswir1 abi_ulong st_ino; 12903bfd9da1Sbellard unsigned short st_mode; 12913bfd9da1Sbellard short st_nlink; 12923bfd9da1Sbellard unsigned short st_uid; 12933bfd9da1Sbellard unsigned short st_gid; 12943bfd9da1Sbellard unsigned short st_rdev; 1295992f48a0Sblueswir1 abi_long st_size; 1296992f48a0Sblueswir1 abi_long target_st_atime; 1297992f48a0Sblueswir1 abi_ulong __unused1; 1298992f48a0Sblueswir1 abi_long target_st_mtime; 1299992f48a0Sblueswir1 abi_ulong __unused2; 1300992f48a0Sblueswir1 abi_long target_st_ctime; 1301992f48a0Sblueswir1 abi_ulong __unused3; 1302992f48a0Sblueswir1 abi_long st_blksize; 1303992f48a0Sblueswir1 abi_long st_blocks; 1304992f48a0Sblueswir1 abi_ulong __unused4[2]; 13053bfd9da1Sbellard }; 13063bfd9da1Sbellard 13073bfd9da1Sbellard struct target_stat64 { 13083bfd9da1Sbellard unsigned char __pad0[6]; 13093bfd9da1Sbellard unsigned short st_dev; 13103bfd9da1Sbellard 13113bfd9da1Sbellard uint64_t st_ino; 13123bfd9da1Sbellard 13133bfd9da1Sbellard unsigned int st_mode; 13143bfd9da1Sbellard unsigned int st_nlink; 13153bfd9da1Sbellard 13163bfd9da1Sbellard unsigned int st_uid; 13173bfd9da1Sbellard unsigned int st_gid; 13183bfd9da1Sbellard 13193bfd9da1Sbellard unsigned char __pad2[6]; 13203bfd9da1Sbellard unsigned short st_rdev; 13213bfd9da1Sbellard 13223bfd9da1Sbellard unsigned char __pad3[8]; 13233bfd9da1Sbellard 13243bfd9da1Sbellard int64_t st_size; 13253bfd9da1Sbellard unsigned int st_blksize; 13263bfd9da1Sbellard 13273bfd9da1Sbellard unsigned char __pad4[8]; 13283bfd9da1Sbellard unsigned int st_blocks; 13293bfd9da1Sbellard 13303bfd9da1Sbellard unsigned int target_st_atime; 13313bfd9da1Sbellard unsigned int __unused1; 13323bfd9da1Sbellard 13333bfd9da1Sbellard unsigned int target_st_mtime; 13343bfd9da1Sbellard unsigned int __unused2; 13353bfd9da1Sbellard 13363bfd9da1Sbellard unsigned int target_st_ctime; 13373bfd9da1Sbellard unsigned int __unused3; 13383bfd9da1Sbellard 13393bfd9da1Sbellard unsigned int __unused4; 13403bfd9da1Sbellard unsigned int __unused5; 13413bfd9da1Sbellard }; 13423bfd9da1Sbellard 134367867308Sbellard #elif defined(TARGET_PPC) 134467867308Sbellard 134567867308Sbellard struct target_stat { 1346e32448e0Sj_mayer abi_ulong st_dev; 1347992f48a0Sblueswir1 abi_ulong st_ino; 1348325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1349e32448e0Sj_mayer abi_ulong st_nlink; 1350325e651fSj_mayer unsigned int st_mode; 1351325e651fSj_mayer #else 135267867308Sbellard unsigned int st_mode; 135367867308Sbellard unsigned short st_nlink; 1354325e651fSj_mayer #endif 135567867308Sbellard unsigned int st_uid; 135667867308Sbellard unsigned int st_gid; 1357e32448e0Sj_mayer abi_ulong st_rdev; 1358992f48a0Sblueswir1 abi_ulong st_size; 1359992f48a0Sblueswir1 abi_ulong st_blksize; 1360992f48a0Sblueswir1 abi_ulong st_blocks; 1361992f48a0Sblueswir1 abi_ulong target_st_atime; 1362e32448e0Sj_mayer abi_ulong target_st_atime_nsec; 1363992f48a0Sblueswir1 abi_ulong target_st_mtime; 1364e32448e0Sj_mayer abi_ulong target_st_mtime_nsec; 1365992f48a0Sblueswir1 abi_ulong target_st_ctime; 1366e32448e0Sj_mayer abi_ulong target_st_ctime_nsec; 1367992f48a0Sblueswir1 abi_ulong __unused4; 1368992f48a0Sblueswir1 abi_ulong __unused5; 1369325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1370325e651fSj_mayer abi_ulong __unused6; 1371325e651fSj_mayer #endif 137267867308Sbellard }; 137367867308Sbellard 1374541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 137567867308Sbellard unsigned long long st_dev; 137667867308Sbellard unsigned long long st_ino; 137767867308Sbellard unsigned int st_mode; 137867867308Sbellard unsigned int st_nlink; 137967867308Sbellard unsigned int st_uid; 138067867308Sbellard unsigned int st_gid; 138167867308Sbellard unsigned long long st_rdev; 1382e1ce5e40Saurel32 unsigned long long __pad0; 138367867308Sbellard long long st_size; 1384e32448e0Sj_mayer int st_blksize; 1385e1ce5e40Saurel32 unsigned int __pad1; 138661322e91SMax Filippov long long st_blocks; /* Number 512-byte blocks allocated. */ 1387e32448e0Sj_mayer int target_st_atime; 1388e32448e0Sj_mayer unsigned int target_st_atime_nsec; 1389e32448e0Sj_mayer int target_st_mtime; 1390e32448e0Sj_mayer unsigned int target_st_mtime_nsec; 1391e32448e0Sj_mayer int target_st_ctime; 1392e32448e0Sj_mayer unsigned int target_st_ctime_nsec; 1393e32448e0Sj_mayer unsigned int __unused4; 1394e32448e0Sj_mayer unsigned int __unused5; 139567867308Sbellard }; 139667867308Sbellard 1397b779e29eSEdgar E. Iglesias #elif defined(TARGET_MICROBLAZE) 1398b779e29eSEdgar E. Iglesias 1399b779e29eSEdgar E. Iglesias struct target_stat { 1400b779e29eSEdgar E. Iglesias abi_ulong st_dev; 1401b779e29eSEdgar E. Iglesias abi_ulong st_ino; 1402b779e29eSEdgar E. Iglesias unsigned int st_mode; 1403b779e29eSEdgar E. Iglesias unsigned short st_nlink; 1404b779e29eSEdgar E. Iglesias unsigned int st_uid; 1405b779e29eSEdgar E. Iglesias unsigned int st_gid; 1406b779e29eSEdgar E. Iglesias abi_ulong st_rdev; 1407b779e29eSEdgar E. Iglesias abi_ulong st_size; 1408b779e29eSEdgar E. Iglesias abi_ulong st_blksize; 1409b779e29eSEdgar E. Iglesias abi_ulong st_blocks; 1410b779e29eSEdgar E. Iglesias abi_ulong target_st_atime; 1411b779e29eSEdgar E. Iglesias abi_ulong target_st_atime_nsec; 1412b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime; 1413b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime_nsec; 1414b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime; 1415b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime_nsec; 1416b779e29eSEdgar E. Iglesias abi_ulong __unused4; 1417b779e29eSEdgar E. Iglesias abi_ulong __unused5; 1418b779e29eSEdgar E. Iglesias }; 1419b779e29eSEdgar E. Iglesias 1420b779e29eSEdgar E. Iglesias /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ 1421541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 1422b779e29eSEdgar E. Iglesias uint64_t st_dev; 1423a523eb06SEdgar E. Iglesias #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1424a523eb06SEdgar E. Iglesias uint32_t pad0; 1425a523eb06SEdgar E. Iglesias uint32_t __st_ino; 1426a523eb06SEdgar E. Iglesias 1427b779e29eSEdgar E. Iglesias uint32_t st_mode; 1428b779e29eSEdgar E. Iglesias uint32_t st_nlink; 1429b779e29eSEdgar E. Iglesias uint32_t st_uid; 1430b779e29eSEdgar E. Iglesias uint32_t st_gid; 1431b779e29eSEdgar E. Iglesias uint64_t st_rdev; 143221ebeb23SEdgar E. Iglesias uint64_t __pad1; 1433b779e29eSEdgar E. Iglesias 1434b779e29eSEdgar E. Iglesias int64_t st_size; 1435b779e29eSEdgar E. Iglesias int32_t st_blksize; 143621ebeb23SEdgar E. Iglesias uint32_t __pad2; 1437b779e29eSEdgar E. Iglesias int64_t st_blocks; /* Number 512-byte blocks allocated. */ 1438b779e29eSEdgar E. Iglesias 1439b779e29eSEdgar E. Iglesias int target_st_atime; 1440b779e29eSEdgar E. Iglesias unsigned int target_st_atime_nsec; 1441b779e29eSEdgar E. Iglesias int target_st_mtime; 1442b779e29eSEdgar E. Iglesias unsigned int target_st_mtime_nsec; 1443b779e29eSEdgar E. Iglesias int target_st_ctime; 1444b779e29eSEdgar E. Iglesias unsigned int target_st_ctime_nsec; 1445a523eb06SEdgar E. Iglesias uint64_t st_ino; 1446b779e29eSEdgar E. Iglesias }; 1447b779e29eSEdgar E. Iglesias 1448e6e5906bSpbrook #elif defined(TARGET_M68K) 1449e6e5906bSpbrook 1450e6e5906bSpbrook struct target_stat { 1451e6e5906bSpbrook unsigned short st_dev; 1452e6e5906bSpbrook unsigned short __pad1; 1453992f48a0Sblueswir1 abi_ulong st_ino; 1454e6e5906bSpbrook unsigned short st_mode; 1455e6e5906bSpbrook unsigned short st_nlink; 1456e6e5906bSpbrook unsigned short st_uid; 1457e6e5906bSpbrook unsigned short st_gid; 1458e6e5906bSpbrook unsigned short st_rdev; 1459e6e5906bSpbrook unsigned short __pad2; 1460992f48a0Sblueswir1 abi_ulong st_size; 1461992f48a0Sblueswir1 abi_ulong st_blksize; 1462992f48a0Sblueswir1 abi_ulong st_blocks; 1463992f48a0Sblueswir1 abi_ulong target_st_atime; 1464992f48a0Sblueswir1 abi_ulong __unused1; 1465992f48a0Sblueswir1 abi_ulong target_st_mtime; 1466992f48a0Sblueswir1 abi_ulong __unused2; 1467992f48a0Sblueswir1 abi_ulong target_st_ctime; 1468992f48a0Sblueswir1 abi_ulong __unused3; 1469992f48a0Sblueswir1 abi_ulong __unused4; 1470992f48a0Sblueswir1 abi_ulong __unused5; 1471e6e5906bSpbrook }; 1472e6e5906bSpbrook 1473e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely 1474e6e5906bSpbrook * insane amounts of padding around dev_t's. 1475e6e5906bSpbrook */ 1476e6e5906bSpbrook struct target_stat64 { 1477e6e5906bSpbrook unsigned long long st_dev; 1478e6e5906bSpbrook unsigned char __pad1[2]; 1479e6e5906bSpbrook 1480e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1481992f48a0Sblueswir1 abi_ulong __st_ino; 1482e6e5906bSpbrook 1483e6e5906bSpbrook unsigned int st_mode; 1484e6e5906bSpbrook unsigned int st_nlink; 1485e6e5906bSpbrook 1486992f48a0Sblueswir1 abi_ulong st_uid; 1487992f48a0Sblueswir1 abi_ulong st_gid; 1488e6e5906bSpbrook 1489e6e5906bSpbrook unsigned long long st_rdev; 1490e6e5906bSpbrook unsigned char __pad3[2]; 1491e6e5906bSpbrook 1492e6e5906bSpbrook long long st_size; 1493992f48a0Sblueswir1 abi_ulong st_blksize; 1494e6e5906bSpbrook 1495992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 1496992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1497e6e5906bSpbrook 1498992f48a0Sblueswir1 abi_ulong target_st_atime; 1499992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1500e6e5906bSpbrook 1501992f48a0Sblueswir1 abi_ulong target_st_mtime; 1502992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1503e6e5906bSpbrook 1504992f48a0Sblueswir1 abi_ulong target_st_ctime; 1505992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1506e6e5906bSpbrook 1507e6e5906bSpbrook unsigned long long st_ino; 1508541dc0d4SStefan Weil } QEMU_PACKED; 1509e6e5906bSpbrook 1510d26bc211Sths #elif defined(TARGET_ABI_MIPSN64) 1511540635baSths 1512540635baSths /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ 1513540635baSths struct target_stat { 1514540635baSths unsigned int st_dev; 1515540635baSths unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ 1516540635baSths 1517992f48a0Sblueswir1 abi_ulong st_ino; 1518540635baSths 1519540635baSths unsigned int st_mode; 1520540635baSths unsigned int st_nlink; 1521540635baSths 1522540635baSths int st_uid; 1523540635baSths int st_gid; 1524540635baSths 1525540635baSths unsigned int st_rdev; 1526540635baSths unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ 1527540635baSths 1528992f48a0Sblueswir1 abi_ulong st_size; 1529540635baSths 1530540635baSths /* 1531540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1532540635baSths * but we don't have it under Linux. 1533540635baSths */ 1534540635baSths unsigned int target_st_atime; 1535540635baSths unsigned int target_st_atime_nsec; 1536540635baSths 1537540635baSths unsigned int target_st_mtime; 1538540635baSths unsigned int target_st_mtime_nsec; 1539540635baSths 1540540635baSths unsigned int target_st_ctime; 1541540635baSths unsigned int target_st_ctime_nsec; 1542540635baSths 1543540635baSths unsigned int st_blksize; 1544540635baSths unsigned int st_pad2; 1545540635baSths 1546992f48a0Sblueswir1 abi_ulong st_blocks; 1547540635baSths }; 1548540635baSths 1549d26bc211Sths #elif defined(TARGET_ABI_MIPSN32) 1550540635baSths 1551540635baSths struct target_stat { 1552540635baSths unsigned st_dev; 1553540635baSths int st_pad1[3]; /* Reserved for network id */ 1554540635baSths unsigned int st_ino; 1555540635baSths unsigned int st_mode; 1556540635baSths unsigned int st_nlink; 1557540635baSths int st_uid; 1558540635baSths int st_gid; 1559540635baSths unsigned st_rdev; 1560540635baSths unsigned int st_pad2[2]; 1561540635baSths unsigned int st_size; 1562540635baSths unsigned int st_pad3; 1563540635baSths /* 1564540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1565540635baSths * but we don't have it under Linux. 1566540635baSths */ 1567540635baSths unsigned int target_st_atime; 1568540635baSths unsigned int target_st_atime_nsec; 1569540635baSths unsigned int target_st_mtime; 1570540635baSths unsigned int target_st_mtime_nsec; 1571540635baSths unsigned int target_st_ctime; 1572540635baSths unsigned int target_st_ctime_nsec; 1573540635baSths unsigned int st_blksize; 1574540635baSths unsigned int st_blocks; 1575540635baSths unsigned int st_pad4[14]; 1576540635baSths }; 1577540635baSths 1578540635baSths /* 1579540635baSths * This matches struct stat64 in glibc2.1, hence the absolutely insane 1580540635baSths * amounts of padding around dev_t's. The memory layout is the same as of 1581540635baSths * struct stat of the 64-bit kernel. 1582540635baSths */ 1583540635baSths 1584540635baSths struct target_stat64 { 1585540635baSths unsigned int st_dev; 1586540635baSths unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ 1587540635baSths 1588540635baSths target_ulong st_ino; 1589540635baSths 1590540635baSths unsigned int st_mode; 1591540635baSths unsigned int st_nlink; 1592540635baSths 1593540635baSths int st_uid; 1594540635baSths int st_gid; 1595540635baSths 1596540635baSths unsigned int st_rdev; 1597540635baSths unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ 1598540635baSths 1599540635baSths int st_size; 1600540635baSths 1601540635baSths /* 1602540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1603540635baSths * but we don't have it under Linux. 1604540635baSths */ 1605540635baSths int target_st_atime; 1606540635baSths unsigned int target_st_atime_nsec; /* Reserved for st_atime expansion */ 1607540635baSths 1608540635baSths int target_st_mtime; 1609540635baSths unsigned int target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 1610540635baSths 1611540635baSths int target_st_ctime; 1612540635baSths unsigned int target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 1613540635baSths 1614540635baSths unsigned int st_blksize; 1615540635baSths unsigned int st_pad2; 1616540635baSths 1617540635baSths int st_blocks; 1618540635baSths }; 1619540635baSths 1620d26bc211Sths #elif defined(TARGET_ABI_MIPSO32) 1621048f6b4dSbellard 1622048f6b4dSbellard struct target_stat { 1623048f6b4dSbellard unsigned st_dev; 1624992f48a0Sblueswir1 abi_long st_pad1[3]; /* Reserved for network id */ 1625992f48a0Sblueswir1 abi_ulong st_ino; 1626048f6b4dSbellard unsigned int st_mode; 1627048f6b4dSbellard unsigned int st_nlink; 1628048f6b4dSbellard int st_uid; 1629048f6b4dSbellard int st_gid; 1630048f6b4dSbellard unsigned st_rdev; 1631992f48a0Sblueswir1 abi_long st_pad2[2]; 1632992f48a0Sblueswir1 abi_long st_size; 1633992f48a0Sblueswir1 abi_long st_pad3; 1634048f6b4dSbellard /* 1635048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1636048f6b4dSbellard * but we don't have it under Linux. 1637048f6b4dSbellard */ 1638992f48a0Sblueswir1 abi_long target_st_atime; 1639992f48a0Sblueswir1 abi_long target_st_atime_nsec; 1640992f48a0Sblueswir1 abi_long target_st_mtime; 1641992f48a0Sblueswir1 abi_long target_st_mtime_nsec; 1642992f48a0Sblueswir1 abi_long target_st_ctime; 1643992f48a0Sblueswir1 abi_long target_st_ctime_nsec; 1644992f48a0Sblueswir1 abi_long st_blksize; 1645992f48a0Sblueswir1 abi_long st_blocks; 1646992f48a0Sblueswir1 abi_long st_pad4[14]; 1647048f6b4dSbellard }; 1648048f6b4dSbellard 1649048f6b4dSbellard /* 1650048f6b4dSbellard * This matches struct stat64 in glibc2.1, hence the absolutely insane 1651048f6b4dSbellard * amounts of padding around dev_t's. The memory layout is the same as of 1652048f6b4dSbellard * struct stat of the 64-bit kernel. 1653048f6b4dSbellard */ 1654048f6b4dSbellard 1655048f6b4dSbellard struct target_stat64 { 1656992f48a0Sblueswir1 abi_ulong st_dev; 1657992f48a0Sblueswir1 abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 1658048f6b4dSbellard 1659048f6b4dSbellard uint64_t st_ino; 1660048f6b4dSbellard 1661048f6b4dSbellard unsigned int st_mode; 1662048f6b4dSbellard unsigned int st_nlink; 1663048f6b4dSbellard 1664048f6b4dSbellard int st_uid; 1665048f6b4dSbellard int st_gid; 1666048f6b4dSbellard 1667992f48a0Sblueswir1 abi_ulong st_rdev; 1668992f48a0Sblueswir1 abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 1669048f6b4dSbellard 1670048f6b4dSbellard int64_t st_size; 1671048f6b4dSbellard 1672048f6b4dSbellard /* 1673048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1674048f6b4dSbellard * but we don't have it under Linux. 1675048f6b4dSbellard */ 1676992f48a0Sblueswir1 abi_long target_st_atime; 1677992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 1678048f6b4dSbellard 1679992f48a0Sblueswir1 abi_long target_st_mtime; 1680992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 1681048f6b4dSbellard 1682992f48a0Sblueswir1 abi_long target_st_ctime; 1683992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 1684048f6b4dSbellard 1685992f48a0Sblueswir1 abi_ulong st_blksize; 1686992f48a0Sblueswir1 abi_ulong st_pad2; 1687048f6b4dSbellard 1688048f6b4dSbellard int64_t st_blocks; 1689048f6b4dSbellard }; 16907a3148a9Sj_mayer 16917a3148a9Sj_mayer #elif defined(TARGET_ALPHA) 16927a3148a9Sj_mayer 16937a3148a9Sj_mayer struct target_stat { 16947a3148a9Sj_mayer unsigned int st_dev; 16957a3148a9Sj_mayer unsigned int st_ino; 16967a3148a9Sj_mayer unsigned int st_mode; 16977a3148a9Sj_mayer unsigned int st_nlink; 16987a3148a9Sj_mayer unsigned int st_uid; 16997a3148a9Sj_mayer unsigned int st_gid; 17007a3148a9Sj_mayer unsigned int st_rdev; 1701992f48a0Sblueswir1 abi_long st_size; 1702992f48a0Sblueswir1 abi_ulong target_st_atime; 1703992f48a0Sblueswir1 abi_ulong target_st_mtime; 1704992f48a0Sblueswir1 abi_ulong target_st_ctime; 17057a3148a9Sj_mayer unsigned int st_blksize; 17067a3148a9Sj_mayer unsigned int st_blocks; 17077a3148a9Sj_mayer unsigned int st_flags; 17087a3148a9Sj_mayer unsigned int st_gen; 17097a3148a9Sj_mayer }; 17107a3148a9Sj_mayer 17117a3148a9Sj_mayer struct target_stat64 { 1712992f48a0Sblueswir1 abi_ulong st_dev; 1713992f48a0Sblueswir1 abi_ulong st_ino; 1714992f48a0Sblueswir1 abi_ulong st_rdev; 1715992f48a0Sblueswir1 abi_long st_size; 1716992f48a0Sblueswir1 abi_ulong st_blocks; 17177a3148a9Sj_mayer 17187a3148a9Sj_mayer unsigned int st_mode; 17197a3148a9Sj_mayer unsigned int st_uid; 17207a3148a9Sj_mayer unsigned int st_gid; 17217a3148a9Sj_mayer unsigned int st_blksize; 17227a3148a9Sj_mayer unsigned int st_nlink; 17237a3148a9Sj_mayer unsigned int __pad0; 17247a3148a9Sj_mayer 1725992f48a0Sblueswir1 abi_ulong target_st_atime; 1726992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1727992f48a0Sblueswir1 abi_ulong target_st_mtime; 1728992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1729992f48a0Sblueswir1 abi_ulong target_st_ctime; 1730992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1731992f48a0Sblueswir1 abi_long __unused[3]; 17327a3148a9Sj_mayer }; 17337a3148a9Sj_mayer 17346db45e65Sths #elif defined(TARGET_SH4) 17356db45e65Sths 17366db45e65Sths struct target_stat { 1737992f48a0Sblueswir1 abi_ulong st_dev; 1738992f48a0Sblueswir1 abi_ulong st_ino; 17396db45e65Sths unsigned short st_mode; 17406db45e65Sths unsigned short st_nlink; 17416db45e65Sths unsigned short st_uid; 17426db45e65Sths unsigned short st_gid; 1743992f48a0Sblueswir1 abi_ulong st_rdev; 1744992f48a0Sblueswir1 abi_ulong st_size; 1745992f48a0Sblueswir1 abi_ulong st_blksize; 1746992f48a0Sblueswir1 abi_ulong st_blocks; 1747992f48a0Sblueswir1 abi_ulong target_st_atime; 1748992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1749992f48a0Sblueswir1 abi_ulong target_st_mtime; 1750992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1751992f48a0Sblueswir1 abi_ulong target_st_ctime; 1752992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1753992f48a0Sblueswir1 abi_ulong __unused4; 1754992f48a0Sblueswir1 abi_ulong __unused5; 17556db45e65Sths }; 17566db45e65Sths 17576db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely 17586db45e65Sths * insane amounts of padding around dev_t's. 17596db45e65Sths */ 1760541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 17616db45e65Sths unsigned long long st_dev; 17626db45e65Sths unsigned char __pad0[4]; 17636db45e65Sths 17646db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1765992f48a0Sblueswir1 abi_ulong __st_ino; 17666db45e65Sths 17676db45e65Sths unsigned int st_mode; 17686db45e65Sths unsigned int st_nlink; 17696db45e65Sths 1770992f48a0Sblueswir1 abi_ulong st_uid; 1771992f48a0Sblueswir1 abi_ulong st_gid; 17726db45e65Sths 17736db45e65Sths unsigned long long st_rdev; 17746db45e65Sths unsigned char __pad3[4]; 17756db45e65Sths 17766db45e65Sths long long st_size; 1777992f48a0Sblueswir1 abi_ulong st_blksize; 17786db45e65Sths 17796db45e65Sths unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ 17806db45e65Sths 1781992f48a0Sblueswir1 abi_ulong target_st_atime; 1782992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 17836db45e65Sths 1784992f48a0Sblueswir1 abi_ulong target_st_mtime; 1785992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 17866db45e65Sths 1787992f48a0Sblueswir1 abi_ulong target_st_ctime; 1788992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 17896db45e65Sths 17906db45e65Sths unsigned long long st_ino; 17916db45e65Sths }; 17926db45e65Sths 1793d2fd1af7Sbellard #elif defined(TARGET_I386) && !defined(TARGET_ABI32) 1794d2fd1af7Sbellard struct target_stat { 1795d2fd1af7Sbellard abi_ulong st_dev; 1796d2fd1af7Sbellard abi_ulong st_ino; 1797d2fd1af7Sbellard abi_ulong st_nlink; 1798d2fd1af7Sbellard 1799d2fd1af7Sbellard unsigned int st_mode; 1800d2fd1af7Sbellard unsigned int st_uid; 1801d2fd1af7Sbellard unsigned int st_gid; 1802d2fd1af7Sbellard unsigned int __pad0; 1803d2fd1af7Sbellard abi_ulong st_rdev; 1804d2fd1af7Sbellard abi_long st_size; 1805d2fd1af7Sbellard abi_long st_blksize; 1806d2fd1af7Sbellard abi_long st_blocks; /* Number 512-byte blocks allocated. */ 1807d2fd1af7Sbellard 1808d2fd1af7Sbellard abi_ulong target_st_atime; 1809d2fd1af7Sbellard abi_ulong target_st_atime_nsec; 1810d2fd1af7Sbellard abi_ulong target_st_mtime; 1811d2fd1af7Sbellard abi_ulong target_st_mtime_nsec; 1812d2fd1af7Sbellard abi_ulong target_st_ctime; 1813d2fd1af7Sbellard abi_ulong target_st_ctime_nsec; 1814d2fd1af7Sbellard 1815d2fd1af7Sbellard abi_long __unused[3]; 1816d2fd1af7Sbellard }; 1817a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 1818a4c075f1SUlrich Hecht struct target_stat { 1819a4c075f1SUlrich Hecht abi_ulong st_dev; 1820a4c075f1SUlrich Hecht abi_ulong st_ino; 1821a4c075f1SUlrich Hecht abi_ulong st_nlink; 1822a4c075f1SUlrich Hecht unsigned int st_mode; 1823a4c075f1SUlrich Hecht unsigned int st_uid; 1824a4c075f1SUlrich Hecht unsigned int st_gid; 1825a4c075f1SUlrich Hecht unsigned int __pad1; 1826a4c075f1SUlrich Hecht abi_ulong st_rdev; 1827a4c075f1SUlrich Hecht abi_ulong st_size; 1828a4c075f1SUlrich Hecht abi_ulong target_st_atime; 1829a4c075f1SUlrich Hecht abi_ulong target_st_atime_nsec; 1830a4c075f1SUlrich Hecht abi_ulong target_st_mtime; 1831a4c075f1SUlrich Hecht abi_ulong target_st_mtime_nsec; 1832a4c075f1SUlrich Hecht abi_ulong target_st_ctime; 1833a4c075f1SUlrich Hecht abi_ulong target_st_ctime_nsec; 1834a4c075f1SUlrich Hecht abi_ulong st_blksize; 1835a4c075f1SUlrich Hecht abi_long st_blocks; 1836a4c075f1SUlrich Hecht abi_ulong __unused[3]; 1837a4c075f1SUlrich Hecht }; 1838d962783eSJia Liu #elif defined(TARGET_OPENRISC) 1839*c7819dfbSPeter Maydell 1840*c7819dfbSPeter Maydell /* These are the asm-generic versions of the stat and stat64 structures */ 1841*c7819dfbSPeter Maydell 1842d962783eSJia Liu struct target_stat { 1843d962783eSJia Liu abi_ulong st_dev; 1844d962783eSJia Liu abi_ulong st_ino; 1845d962783eSJia Liu unsigned int st_mode; 1846*c7819dfbSPeter Maydell unsigned int st_nlink; 1847d962783eSJia Liu unsigned int st_uid; 1848d962783eSJia Liu unsigned int st_gid; 1849d962783eSJia Liu abi_ulong st_rdev; 1850*c7819dfbSPeter Maydell abi_ulong __pad1; 1851d962783eSJia Liu abi_long st_size; 1852*c7819dfbSPeter Maydell int st_blksize; 1853*c7819dfbSPeter Maydell int __pad2; 1854*c7819dfbSPeter Maydell abi_long st_blocks; 1855*c7819dfbSPeter Maydell abi_long target_st_atime; 1856d962783eSJia Liu abi_ulong target_st_atime_nsec; 1857*c7819dfbSPeter Maydell abi_long target_st_mtime; 1858d962783eSJia Liu abi_ulong target_st_mtime_nsec; 1859*c7819dfbSPeter Maydell abi_long target_st_ctime; 1860d962783eSJia Liu abi_ulong target_st_ctime_nsec; 1861*c7819dfbSPeter Maydell unsigned int __unused4; 1862*c7819dfbSPeter Maydell unsigned int __unused5; 1863d962783eSJia Liu }; 1864*c7819dfbSPeter Maydell 1865*c7819dfbSPeter Maydell struct target_stat64 { 1866*c7819dfbSPeter Maydell uint64_t st_dev; 1867*c7819dfbSPeter Maydell uint64_t st_ino; 1868*c7819dfbSPeter Maydell unsigned int st_mode; 1869*c7819dfbSPeter Maydell unsigned int st_nlink; 1870*c7819dfbSPeter Maydell unsigned int st_uid; 1871*c7819dfbSPeter Maydell unsigned int st_gid; 1872*c7819dfbSPeter Maydell uint64_t st_rdev; 1873*c7819dfbSPeter Maydell uint64_t __pad1; 1874*c7819dfbSPeter Maydell int64_t st_size; 1875*c7819dfbSPeter Maydell int st_blksize; 1876*c7819dfbSPeter Maydell int __pad2; 1877*c7819dfbSPeter Maydell int64_t st_blocks; 1878*c7819dfbSPeter Maydell int target_st_atime; 1879*c7819dfbSPeter Maydell unsigned int target_st_atime_nsec; 1880*c7819dfbSPeter Maydell int target_st_mtime; 1881*c7819dfbSPeter Maydell unsigned int target_st_mtime_nsec; 1882*c7819dfbSPeter Maydell int target_st_ctime; 1883*c7819dfbSPeter Maydell unsigned int target_st_ctime_nsec; 1884*c7819dfbSPeter Maydell unsigned int __unused4; 1885*c7819dfbSPeter Maydell unsigned int __unused5; 1886*c7819dfbSPeter Maydell }; 1887*c7819dfbSPeter Maydell 1888048f6b4dSbellard #else 1889048f6b4dSbellard #error unsupported CPU 1890048f6b4dSbellard #endif 18912521d698Sbellard 18924ce6f8deSths typedef struct { 18934ce6f8deSths int val[2]; 1894c227f099SAnthony Liguori } target_fsid_t; 18954ce6f8deSths 189656c8f68fSbellard #ifdef TARGET_MIPS 1897d26bc211Sths #ifdef TARGET_ABI_MIPSN32 1898540635baSths struct target_statfs { 1899540635baSths int32_t f_type; 1900540635baSths int32_t f_bsize; 1901540635baSths int32_t f_frsize; /* Fragment size - unsupported */ 1902540635baSths int32_t f_blocks; 1903540635baSths int32_t f_bfree; 1904540635baSths int32_t f_files; 1905540635baSths int32_t f_ffree; 1906540635baSths int32_t f_bavail; 1907540635baSths 1908540635baSths /* Linux specials */ 1909c227f099SAnthony Liguori target_fsid_t f_fsid; 1910540635baSths int32_t f_namelen; 1911540635baSths int32_t f_spare[6]; 1912540635baSths }; 1913540635baSths #else 191456c8f68fSbellard struct target_statfs { 1915992f48a0Sblueswir1 abi_long f_type; 1916992f48a0Sblueswir1 abi_long f_bsize; 1917992f48a0Sblueswir1 abi_long f_frsize; /* Fragment size - unsupported */ 1918992f48a0Sblueswir1 abi_long f_blocks; 1919992f48a0Sblueswir1 abi_long f_bfree; 1920992f48a0Sblueswir1 abi_long f_files; 1921992f48a0Sblueswir1 abi_long f_ffree; 1922992f48a0Sblueswir1 abi_long f_bavail; 192356c8f68fSbellard 192456c8f68fSbellard /* Linux specials */ 1925c227f099SAnthony Liguori target_fsid_t f_fsid; 1926992f48a0Sblueswir1 abi_long f_namelen; 1927992f48a0Sblueswir1 abi_long f_spare[6]; 192856c8f68fSbellard }; 1929540635baSths #endif 193056c8f68fSbellard 193156c8f68fSbellard struct target_statfs64 { 193256c8f68fSbellard uint32_t f_type; 193356c8f68fSbellard uint32_t f_bsize; 193456c8f68fSbellard uint32_t f_frsize; /* Fragment size - unsupported */ 193556c8f68fSbellard uint32_t __pad; 193656c8f68fSbellard uint64_t f_blocks; 193756c8f68fSbellard uint64_t f_bfree; 193856c8f68fSbellard uint64_t f_files; 193956c8f68fSbellard uint64_t f_ffree; 194056c8f68fSbellard uint64_t f_bavail; 1941c227f099SAnthony Liguori target_fsid_t f_fsid; 194256c8f68fSbellard uint32_t f_namelen; 194356c8f68fSbellard uint32_t f_spare[6]; 194456c8f68fSbellard }; 1945c4d10628Sbalrog #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ 1946c4d10628Sbalrog defined(TARGET_SPARC64)) && !defined(TARGET_ABI32) 1947325e651fSj_mayer struct target_statfs { 1948325e651fSj_mayer abi_long f_type; 1949325e651fSj_mayer abi_long f_bsize; 1950325e651fSj_mayer abi_long f_blocks; 1951325e651fSj_mayer abi_long f_bfree; 1952325e651fSj_mayer abi_long f_bavail; 1953325e651fSj_mayer abi_long f_files; 1954325e651fSj_mayer abi_long f_ffree; 1955c227f099SAnthony Liguori target_fsid_t f_fsid; 1956325e651fSj_mayer abi_long f_namelen; 1957325e651fSj_mayer abi_long f_frsize; 1958325e651fSj_mayer abi_long f_spare[5]; 1959325e651fSj_mayer }; 1960325e651fSj_mayer 1961325e651fSj_mayer struct target_statfs64 { 1962325e651fSj_mayer abi_long f_type; 1963325e651fSj_mayer abi_long f_bsize; 1964325e651fSj_mayer abi_long f_blocks; 1965325e651fSj_mayer abi_long f_bfree; 1966325e651fSj_mayer abi_long f_bavail; 1967325e651fSj_mayer abi_long f_files; 1968325e651fSj_mayer abi_long f_ffree; 1969c227f099SAnthony Liguori target_fsid_t f_fsid; 1970325e651fSj_mayer abi_long f_namelen; 1971325e651fSj_mayer abi_long f_frsize; 1972325e651fSj_mayer abi_long f_spare[5]; 1973325e651fSj_mayer }; 1974a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 1975a4c075f1SUlrich Hecht struct target_statfs { 1976a4c075f1SUlrich Hecht int32_t f_type; 1977a4c075f1SUlrich Hecht int32_t f_bsize; 1978a4c075f1SUlrich Hecht abi_long f_blocks; 1979a4c075f1SUlrich Hecht abi_long f_bfree; 1980a4c075f1SUlrich Hecht abi_long f_bavail; 1981a4c075f1SUlrich Hecht abi_long f_files; 1982a4c075f1SUlrich Hecht abi_long f_ffree; 1983a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 1984a4c075f1SUlrich Hecht int32_t f_namelen; 1985a4c075f1SUlrich Hecht int32_t f_frsize; 1986a4c075f1SUlrich Hecht int32_t f_spare[5]; 1987a4c075f1SUlrich Hecht }; 1988a4c075f1SUlrich Hecht 1989a4c075f1SUlrich Hecht struct target_statfs64 { 1990a4c075f1SUlrich Hecht int32_t f_type; 1991a4c075f1SUlrich Hecht int32_t f_bsize; 1992a4c075f1SUlrich Hecht abi_long f_blocks; 1993a4c075f1SUlrich Hecht abi_long f_bfree; 1994a4c075f1SUlrich Hecht abi_long f_bavail; 1995a4c075f1SUlrich Hecht abi_long f_files; 1996a4c075f1SUlrich Hecht abi_long f_ffree; 1997a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 1998a4c075f1SUlrich Hecht int32_t f_namelen; 1999a4c075f1SUlrich Hecht int32_t f_frsize; 2000a4c075f1SUlrich Hecht int32_t f_spare[5]; 2001a4c075f1SUlrich Hecht }; 200256c8f68fSbellard #else 200356c8f68fSbellard struct target_statfs { 200456c8f68fSbellard uint32_t f_type; 200556c8f68fSbellard uint32_t f_bsize; 200656c8f68fSbellard uint32_t f_blocks; 200756c8f68fSbellard uint32_t f_bfree; 200856c8f68fSbellard uint32_t f_bavail; 200956c8f68fSbellard uint32_t f_files; 201056c8f68fSbellard uint32_t f_ffree; 2011c227f099SAnthony Liguori target_fsid_t f_fsid; 201256c8f68fSbellard uint32_t f_namelen; 201356c8f68fSbellard uint32_t f_frsize; 201456c8f68fSbellard uint32_t f_spare[5]; 201556c8f68fSbellard }; 201656c8f68fSbellard 201756c8f68fSbellard struct target_statfs64 { 201856c8f68fSbellard uint32_t f_type; 201956c8f68fSbellard uint32_t f_bsize; 202056c8f68fSbellard uint64_t f_blocks; 202156c8f68fSbellard uint64_t f_bfree; 202256c8f68fSbellard uint64_t f_bavail; 202356c8f68fSbellard uint64_t f_files; 202456c8f68fSbellard uint64_t f_ffree; 2025c227f099SAnthony Liguori target_fsid_t f_fsid; 202656c8f68fSbellard uint32_t f_namelen; 202756c8f68fSbellard uint32_t f_frsize; 202856c8f68fSbellard uint32_t f_spare[5]; 202956c8f68fSbellard }; 203056c8f68fSbellard #endif 203156c8f68fSbellard 203256c8f68fSbellard 20332521d698Sbellard #define TARGET_F_DUPFD 0 /* dup */ 20342521d698Sbellard #define TARGET_F_GETFD 1 /* get close_on_exec */ 20352521d698Sbellard #define TARGET_F_SETFD 2 /* set/clear close_on_exec */ 20362521d698Sbellard #define TARGET_F_GETFL 3 /* get file->f_flags */ 20372521d698Sbellard #define TARGET_F_SETFL 4 /* set file->f_flags */ 20382521d698Sbellard 20392521d698Sbellard #if defined(TARGET_ALPHA) 20402521d698Sbellard #define TARGET_F_GETLK 7 20412521d698Sbellard #define TARGET_F_SETLK 8 20422521d698Sbellard #define TARGET_F_SETLKW 9 20432521d698Sbellard #define TARGET_F_SETOWN 5 /* for sockets. */ 20442521d698Sbellard #define TARGET_F_GETOWN 6 /* for sockets. */ 20452ba7f730SLaurent Vivier 20462ba7f730SLaurent Vivier #define TARGET_F_RDLCK 1 20472ba7f730SLaurent Vivier #define TARGET_F_WRLCK 2 20482ba7f730SLaurent Vivier #define TARGET_F_UNLCK 8 20492ba7f730SLaurent Vivier #define TARGET_F_EXLCK 16 20502ba7f730SLaurent Vivier #define TARGET_F_SHLCK 32 20515f106811SArnaud Patard (Rtp) #elif defined(TARGET_MIPS) 20525f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK 14 20535f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK 6 20545f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW 7 20555f106811SArnaud Patard (Rtp) #define TARGET_F_SETOWN 24 /* for sockets. */ 20565f106811SArnaud Patard (Rtp) #define TARGET_F_GETOWN 25 /* for sockets. */ 20572521d698Sbellard #else 20582521d698Sbellard #define TARGET_F_GETLK 5 20592521d698Sbellard #define TARGET_F_SETLK 6 20602521d698Sbellard #define TARGET_F_SETLKW 7 20612521d698Sbellard #define TARGET_F_SETOWN 8 /* for sockets. */ 20622521d698Sbellard #define TARGET_F_GETOWN 9 /* for sockets. */ 20632521d698Sbellard #endif 20642521d698Sbellard 20652ba7f730SLaurent Vivier #ifndef TARGET_F_RDLCK 20662ba7f730SLaurent Vivier #define TARGET_F_RDLCK 0 20672ba7f730SLaurent Vivier #define TARGET_F_WRLCK 1 20682ba7f730SLaurent Vivier #define TARGET_F_UNLCK 2 20692ba7f730SLaurent Vivier #endif 20702ba7f730SLaurent Vivier 20712ba7f730SLaurent Vivier #ifndef TARGET_F_EXLCK 20722ba7f730SLaurent Vivier #define TARGET_F_EXLCK 4 20732ba7f730SLaurent Vivier #define TARGET_F_SHLCK 8 20742ba7f730SLaurent Vivier #endif 20752ba7f730SLaurent Vivier 20762ba7f730SLaurent Vivier 20772521d698Sbellard #define TARGET_F_SETSIG 10 /* for sockets. */ 20782521d698Sbellard #define TARGET_F_GETSIG 11 /* for sockets. */ 20792521d698Sbellard 20805f106811SArnaud Patard (Rtp) #if defined(TARGET_MIPS) 20815f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK64 33 /* using 'struct flock64' */ 20825f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK64 34 20835f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW64 35 20845f106811SArnaud Patard (Rtp) #else 20852521d698Sbellard #define TARGET_F_GETLK64 12 /* using 'struct flock64' */ 20862521d698Sbellard #define TARGET_F_SETLK64 13 20872521d698Sbellard #define TARGET_F_SETLKW64 14 20885f106811SArnaud Patard (Rtp) #endif 20897e22e546SUlrich Hecht 20907e22e546SUlrich Hecht #define TARGET_F_LINUX_SPECIFIC_BASE 1024 20917e22e546SUlrich Hecht #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0) 20927e22e546SUlrich Hecht #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1) 20937e22e546SUlrich Hecht #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) 20947e22e546SUlrich Hecht #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2) 20957e22e546SUlrich Hecht 20964eeea4f3SRichard Henderson #if defined(TARGET_ALPHA) 20974eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK 04 20984eeea4f3SRichard Henderson #define TARGET_O_APPEND 010 20994eeea4f3SRichard Henderson #define TARGET_O_CREAT 01000 /* not fcntl */ 21004eeea4f3SRichard Henderson #define TARGET_O_TRUNC 02000 /* not fcntl */ 21014eeea4f3SRichard Henderson #define TARGET_O_EXCL 04000 /* not fcntl */ 21024eeea4f3SRichard Henderson #define TARGET_O_NOCTTY 010000 /* not fcntl */ 21034eeea4f3SRichard Henderson #define TARGET_O_DSYNC 040000 21044eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0 /* not necessary, always 64-bit */ 21054eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY 0100000 /* must be a directory */ 21064eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW 0200000 /* don't follow links */ 21074eeea4f3SRichard Henderson #define TARGET_O_DIRECT 02000000 /* direct disk access hint */ 21084eeea4f3SRichard Henderson #define TARGET_O_NOATIME 04000000 21094eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 010000000 21104eeea4f3SRichard Henderson #define TARGET___O_SYNC 020000000 21114eeea4f3SRichard Henderson #define TARGET_O_PATH 040000000 21124eeea4f3SRichard Henderson #elif defined(TARGET_ARM) || defined(TARGET_M68K) 2113f09936acSbellard #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 2114f09936acSbellard #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 2115f09936acSbellard #define TARGET_O_DIRECT 0200000 /* direct disk access hint */ 2116f09936acSbellard #define TARGET_O_LARGEFILE 0400000 2117048f6b4dSbellard #elif defined(TARGET_MIPS) 2118048f6b4dSbellard #define TARGET_O_APPEND 0x0008 21194eeea4f3SRichard Henderson #define TARGET_O_DSYNC 0x0010 2120048f6b4dSbellard #define TARGET_O_NONBLOCK 0x0080 2121048f6b4dSbellard #define TARGET_O_CREAT 0x0100 /* not fcntl */ 2122048f6b4dSbellard #define TARGET_O_TRUNC 0x0200 /* not fcntl */ 2123048f6b4dSbellard #define TARGET_O_EXCL 0x0400 /* not fcntl */ 2124048f6b4dSbellard #define TARGET_O_NOCTTY 0x0800 /* not fcntl */ 2125048f6b4dSbellard #define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */ 2126048f6b4dSbellard #define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */ 21274eeea4f3SRichard Henderson #define TARGET___O_SYNC 0x4000 2128048f6b4dSbellard #define TARGET_O_DIRECT 0x8000 /* direct disk access hint */ 21294eeea4f3SRichard Henderson #elif defined (TARGET_PPC) 21304eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 21314eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 21324eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0200000 21334eeea4f3SRichard Henderson #define TARGET_O_DIRECT 0400000 /* direct disk access hint */ 21344eeea4f3SRichard Henderson #elif defined (TARGET_SPARC) 21351f961124Saurel32 #define TARGET_O_APPEND 0x0008 21364eeea4f3SRichard Henderson #define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */ 21371f961124Saurel32 #define TARGET_O_CREAT 0x0200 /* not fcntl */ 21381f961124Saurel32 #define TARGET_O_TRUNC 0x0400 /* not fcntl */ 21391f961124Saurel32 #define TARGET_O_EXCL 0x0800 /* not fcntl */ 21404eeea4f3SRichard Henderson #define TARGET_O_DSYNC 0x2000 21414eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK 0x4000 21424eeea4f3SRichard Henderson # ifdef TARGET_SPARC64 21434eeea4f3SRichard Henderson # define TARGET_O_NDELAY 0x0004 2144ffa65c3bSbellard # else 21454eeea4f3SRichard Henderson # define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK) 21464eeea4f3SRichard Henderson # endif 21474eeea4f3SRichard Henderson #define TARGET_O_NOCTTY 0x8000 /* not fcntl */ 21484eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0x40000 21494eeea4f3SRichard Henderson #define TARGET_O_DIRECT 0x100000 /* direct disk access hint */ 21504eeea4f3SRichard Henderson #define TARGET_O_NOATIME 0x200000 21514eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 0x400000 21524eeea4f3SRichard Henderson #define TARGET___O_SYNC 0x800000 21534eeea4f3SRichard Henderson #define TARGET_O_PATH 0x1000000 21544eeea4f3SRichard Henderson #endif 21554eeea4f3SRichard Henderson 21564eeea4f3SRichard Henderson /* <asm-generic/fcntl.h> values follow. */ 2157ffa65c3bSbellard #define TARGET_O_ACCMODE 0003 2158ffa65c3bSbellard #define TARGET_O_RDONLY 00 2159ffa65c3bSbellard #define TARGET_O_WRONLY 01 2160ffa65c3bSbellard #define TARGET_O_RDWR 02 21614eeea4f3SRichard Henderson #ifndef TARGET_O_CREAT 2162ffa65c3bSbellard #define TARGET_O_CREAT 0100 /* not fcntl */ 21634eeea4f3SRichard Henderson #endif 21644eeea4f3SRichard Henderson #ifndef TARGET_O_EXCL 2165ffa65c3bSbellard #define TARGET_O_EXCL 0200 /* not fcntl */ 21664eeea4f3SRichard Henderson #endif 21674eeea4f3SRichard Henderson #ifndef TARGET_O_NOCTTY 2168ffa65c3bSbellard #define TARGET_O_NOCTTY 0400 /* not fcntl */ 21694eeea4f3SRichard Henderson #endif 21704eeea4f3SRichard Henderson #ifndef TARGET_O_TRUNC 2171ffa65c3bSbellard #define TARGET_O_TRUNC 01000 /* not fcntl */ 21724eeea4f3SRichard Henderson #endif 21734eeea4f3SRichard Henderson #ifndef TARGET_O_APPEND 2174ffa65c3bSbellard #define TARGET_O_APPEND 02000 21754eeea4f3SRichard Henderson #endif 21764eeea4f3SRichard Henderson #ifndef TARGET_O_NONBLOCK 2177ffa65c3bSbellard #define TARGET_O_NONBLOCK 04000 21784eeea4f3SRichard Henderson #endif 21794eeea4f3SRichard Henderson #ifndef TARGET_O_DSYNC 21804eeea4f3SRichard Henderson #define TARGET_O_DSYNC 010000 21814eeea4f3SRichard Henderson #endif 21824eeea4f3SRichard Henderson #ifndef TARGET_FASYNC 2183ffa65c3bSbellard #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ 21844eeea4f3SRichard Henderson #endif 21854eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECT 2186ffa65c3bSbellard #define TARGET_O_DIRECT 040000 /* direct disk access hint */ 21874eeea4f3SRichard Henderson #endif 21884eeea4f3SRichard Henderson #ifndef TARGET_O_LARGEFILE 2189ffa65c3bSbellard #define TARGET_O_LARGEFILE 0100000 21904eeea4f3SRichard Henderson #endif 21914eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECTORY 2192ffa65c3bSbellard #define TARGET_O_DIRECTORY 0200000 /* must be a directory */ 21934eeea4f3SRichard Henderson #endif 21944eeea4f3SRichard Henderson #ifndef TARGET_O_NOFOLLOW 2195ffa65c3bSbellard #define TARGET_O_NOFOLLOW 0400000 /* don't follow links */ 2196ffa65c3bSbellard #endif 21974eeea4f3SRichard Henderson #ifndef TARGET_O_NOATIME 21984eeea4f3SRichard Henderson #define TARGET_O_NOATIME 01000000 21994eeea4f3SRichard Henderson #endif 22004eeea4f3SRichard Henderson #ifndef TARGET_O_CLOEXEC 22014eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 02000000 22024eeea4f3SRichard Henderson #endif 22034eeea4f3SRichard Henderson #ifndef TARGET___O_SYNC 22044eeea4f3SRichard Henderson #define TARGET___O_SYNC 04000000 22054eeea4f3SRichard Henderson #endif 22064eeea4f3SRichard Henderson #ifndef TARGET_O_PATH 22074eeea4f3SRichard Henderson #define TARGET_O_PATH 010000000 22084eeea4f3SRichard Henderson #endif 22094eeea4f3SRichard Henderson #ifndef TARGET_O_NDELAY 22104eeea4f3SRichard Henderson #define TARGET_O_NDELAY TARGET_O_NONBLOCK 22114eeea4f3SRichard Henderson #endif 22124eeea4f3SRichard Henderson #ifndef TARGET_O_SYNC 22134eeea4f3SRichard Henderson #define TARGET_O_SYNC (TARGET___O_SYNC | TARGET_O_DSYNC) 22144eeea4f3SRichard Henderson #endif 2215ffa65c3bSbellard 22162521d698Sbellard struct target_flock { 22172521d698Sbellard short l_type; 22182521d698Sbellard short l_whence; 2219992f48a0Sblueswir1 abi_ulong l_start; 2220992f48a0Sblueswir1 abi_ulong l_len; 22212521d698Sbellard int l_pid; 22222521d698Sbellard }; 22232521d698Sbellard 22242521d698Sbellard struct target_flock64 { 22252521d698Sbellard short l_type; 22262521d698Sbellard short l_whence; 2227b779e29eSEdgar E. Iglesias #if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) || defined(TARGET_SPARC) || defined(TARGET_HPPA) || defined (TARGET_MICROBLAZE) 2228ce3f0e2fSaurel32 int __pad; 2229ce3f0e2fSaurel32 #endif 22302521d698Sbellard unsigned long long l_start; 22312521d698Sbellard unsigned long long l_len; 22322521d698Sbellard int l_pid; 2233541dc0d4SStefan Weil } QEMU_PACKED; 22342521d698Sbellard 2235ce4defa0Spbrook #ifdef TARGET_ARM 2236ce4defa0Spbrook struct target_eabi_flock64 { 2237ce4defa0Spbrook short l_type; 2238ce4defa0Spbrook short l_whence; 2239ce4defa0Spbrook int __pad; 2240ce4defa0Spbrook unsigned long long l_start; 2241ce4defa0Spbrook unsigned long long l_len; 2242ce4defa0Spbrook int l_pid; 2243541dc0d4SStefan Weil } QEMU_PACKED; 2244ce4defa0Spbrook #endif 22452521d698Sbellard 22462521d698Sbellard /* soundcard defines */ 22472521d698Sbellard /* XXX: convert them all to arch indepedent entries */ 22482521d698Sbellard #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); 22492521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 22502521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 22512521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 22522521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA 0xc0144302 22532521d698Sbellard #define TARGET_SNDCTL_COPR_RESET 0x00004300 22542521d698Sbellard #define TARGET_SNDCTL_COPR_RUN 0xc0144306 22552521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 22562521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE 0x40144305 22572521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA 0x40144304 22582521d698Sbellard #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) 22592521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) 22602521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) 22612521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) 22622521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) 22632521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) 22642521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) 22652521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) 22662521d698Sbellard #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) 22672521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) 22682521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) 22692521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) 22702521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) 22712521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) 22722521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) 22732521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) 22742521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) 22752521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) 22765f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19) 22775f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20) 22782521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e 22792521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 22802521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 22812521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 22822521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 22832521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f 22842521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 22852521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO 0xc074510c 22862521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 22872521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 22882521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 22892521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 22902521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 22912521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 22922521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 22932521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 22942521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b 22952521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a 22962521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 22972521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC 0x00005111 22982521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 22992521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET 0x00005100 23002521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 23012521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC 0x00005101 23022521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 23032521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d 23042521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d 23052521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 23062521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e 23072521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 23082521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME 0x40045407 23092521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT 0x40045408 23102521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 23112521d698Sbellard #define TARGET_SNDCTL_TMR_START 0x00005402 23122521d698Sbellard #define TARGET_SNDCTL_TMR_STOP 0x00005403 23132521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 23142521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 23152521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE 0x80045002 23162521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 23172521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS 0x80045005 23182521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 23192521d698Sbellard #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) 23202521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 23212521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) 23222521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) 23232521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) 23242521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) 23252521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) 23262521d698Sbellard 23272521d698Sbellard #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) 23282521d698Sbellard 23292521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) 23302521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) 23312521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) 23322521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) 23332521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) 23342521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) 23352521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) 23362521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) 23372521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) 23382521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) 23392521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) 23402521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) 23412521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) 23422521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) 23432521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) 23442521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) 23452521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) 23462521d698Sbellard 23472521d698Sbellard /* Obsolete macros */ 23482521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) 23492521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) 23502521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) 23512521d698Sbellard 23522521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) 23532521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) 23542521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) 23552521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) 23562521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) 23572521d698Sbellard 23582521d698Sbellard #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) 23592521d698Sbellard 23602521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) 23612521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) 23622521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) 23632521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) 23642521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) 23652521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) 23662521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) 23672521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) 23682521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) 23692521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) 23702521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) 23712521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) 23722521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) 23732521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) 23742521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) 23752521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) 23762521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) 23772521d698Sbellard 23782521d698Sbellard /* Obsolete macros */ 23792521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) 23802521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) 23812521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) 23822521d698Sbellard 23832521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) 23842521d698Sbellard 23852521d698Sbellard /* vfat ioctls */ 23862521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) 23872521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) 2388a5448a7dSbellard 23898fbd6b52Sbalrog #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct mtop) 23908fbd6b52Sbalrog #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct mtget) 23918fbd6b52Sbalrog #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct mtpos) 23928fbd6b52Sbalrog 2393a5448a7dSbellard struct target_sysinfo { 2394992f48a0Sblueswir1 abi_long uptime; /* Seconds since boot */ 2395992f48a0Sblueswir1 abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */ 2396992f48a0Sblueswir1 abi_ulong totalram; /* Total usable main memory size */ 2397992f48a0Sblueswir1 abi_ulong freeram; /* Available memory size */ 2398992f48a0Sblueswir1 abi_ulong sharedram; /* Amount of shared memory */ 2399992f48a0Sblueswir1 abi_ulong bufferram; /* Memory used by buffers */ 2400992f48a0Sblueswir1 abi_ulong totalswap; /* Total swap space size */ 2401992f48a0Sblueswir1 abi_ulong freeswap; /* swap space still available */ 2402a5448a7dSbellard unsigned short procs; /* Number of current processes */ 2403a5448a7dSbellard unsigned short pad; /* explicit padding for m68k */ 2404992f48a0Sblueswir1 abi_ulong totalhigh; /* Total high memory size */ 2405992f48a0Sblueswir1 abi_ulong freehigh; /* Available high memory size */ 2406a5448a7dSbellard unsigned int mem_unit; /* Memory unit size in bytes */ 2407992f48a0Sblueswir1 char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 2408a5448a7dSbellard }; 24093532fa74Sbellard 24106556a833Saurel32 struct linux_dirent { 24116556a833Saurel32 long d_ino; 24126556a833Saurel32 unsigned long d_off; 24136556a833Saurel32 unsigned short d_reclen; 24146556a833Saurel32 char d_name[256]; /* We must not include limits.h! */ 24156556a833Saurel32 }; 24166556a833Saurel32 24176556a833Saurel32 struct linux_dirent64 { 24186556a833Saurel32 uint64_t d_ino; 24196556a833Saurel32 int64_t d_off; 24206556a833Saurel32 unsigned short d_reclen; 24216556a833Saurel32 unsigned char d_type; 24226556a833Saurel32 char d_name[256]; 24236556a833Saurel32 }; 24246556a833Saurel32 242524e1003aSaurel32 struct target_mq_attr { 242624e1003aSaurel32 abi_long mq_flags; 242724e1003aSaurel32 abi_long mq_maxmsg; 242824e1003aSaurel32 abi_long mq_msgsize; 242924e1003aSaurel32 abi_long mq_curmsgs; 243024e1003aSaurel32 }; 243124e1003aSaurel32 24323532fa74Sbellard #include "socket.h" 2433637947f1Sths 2434637947f1Sths #include "errno_defs.h" 243503dfe9f8SRiku Voipio 243603dfe9f8SRiku Voipio #define FUTEX_WAIT 0 243703dfe9f8SRiku Voipio #define FUTEX_WAKE 1 243803dfe9f8SRiku Voipio #define FUTEX_FD 2 243903dfe9f8SRiku Voipio #define FUTEX_REQUEUE 3 244003dfe9f8SRiku Voipio #define FUTEX_CMP_REQUEUE 4 244103dfe9f8SRiku Voipio #define FUTEX_WAKE_OP 5 244203dfe9f8SRiku Voipio #define FUTEX_LOCK_PI 6 244303dfe9f8SRiku Voipio #define FUTEX_UNLOCK_PI 7 244403dfe9f8SRiku Voipio #define FUTEX_TRYLOCK_PI 8 244503dfe9f8SRiku Voipio #define FUTEX_WAIT_BITSET 9 244603dfe9f8SRiku Voipio #define FUTEX_WAKE_BITSET 10 244703dfe9f8SRiku Voipio 244803dfe9f8SRiku Voipio #define FUTEX_PRIVATE_FLAG 128 244903dfe9f8SRiku Voipio #define FUTEX_CLOCK_REALTIME 256 245003dfe9f8SRiku Voipio #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) 245103dfe9f8SRiku Voipio 24523b6edd16SPeter Maydell #ifdef CONFIG_EPOLL 24533b6edd16SPeter Maydell typedef union target_epoll_data { 24543b6edd16SPeter Maydell abi_ulong ptr; 24553b6edd16SPeter Maydell abi_ulong fd; 24563b6edd16SPeter Maydell uint32_t u32; 24573b6edd16SPeter Maydell uint64_t u64; 24583b6edd16SPeter Maydell } target_epoll_data_t; 24593b6edd16SPeter Maydell 24603b6edd16SPeter Maydell struct target_epoll_event { 24613b6edd16SPeter Maydell uint32_t events; 24623b6edd16SPeter Maydell target_epoll_data_t data; 24633b6edd16SPeter Maydell }; 24643b6edd16SPeter Maydell #endif 2465163a05a8SPeter Maydell struct target_rlimit64 { 2466163a05a8SPeter Maydell uint64_t rlim_cur; 2467163a05a8SPeter Maydell uint64_t rlim_max; 2468163a05a8SPeter Maydell }; 2469583359a6SAkos PASZTORY 2470583359a6SAkos PASZTORY struct target_ucred { 2471583359a6SAkos PASZTORY uint32_t pid; 2472583359a6SAkos PASZTORY uint32_t uid; 2473583359a6SAkos PASZTORY uint32_t gid; 2474583359a6SAkos PASZTORY }; 2475cb9c377fSPaolo Bonzini 2476cb9c377fSPaolo Bonzini #endif 2477