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 30b9d36eb2SAndré Hentschel #define SOCKOP_accept4 18 3131e31b8aSbellard 328853f86eSbellard #define IPCOP_semop 1 338853f86eSbellard #define IPCOP_semget 2 348853f86eSbellard #define IPCOP_semctl 3 358853f86eSbellard #define IPCOP_semtimedop 4 368853f86eSbellard #define IPCOP_msgsnd 11 378853f86eSbellard #define IPCOP_msgrcv 12 388853f86eSbellard #define IPCOP_msgget 13 398853f86eSbellard #define IPCOP_msgctl 14 408853f86eSbellard #define IPCOP_shmat 21 418853f86eSbellard #define IPCOP_shmdt 22 428853f86eSbellard #define IPCOP_shmget 23 438853f86eSbellard #define IPCOP_shmctl 24 448853f86eSbellard 452521d698Sbellard /* 462521d698Sbellard * The following is for compatibility across the various Linux 472521d698Sbellard * platforms. The i386 ioctl numbering scheme doesn't really enforce 482521d698Sbellard * a type field. De facto, however, the top 8 bits of the lower 16 492521d698Sbellard * bits are indeed used as a type field, so we might just as well make 502521d698Sbellard * this explicit here. Please be sure to use the decoding macros 512521d698Sbellard * below from now on. 522521d698Sbellard */ 532521d698Sbellard #define TARGET_IOC_NRBITS 8 542521d698Sbellard #define TARGET_IOC_TYPEBITS 8 552521d698Sbellard 56cd98d390SAndreas Schwab #if defined(TARGET_I386) || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 57cd98d390SAndreas Schwab || defined(TARGET_SPARC) \ 580c866a7eSRiku Voipio || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) 5974d753acSMika Westerberg /* 16 bit uid wrappers emulation */ 6074d753acSMika Westerberg #define USE_UID16 610c866a7eSRiku Voipio #define target_id uint16_t 620c866a7eSRiku Voipio #else 630c866a7eSRiku Voipio #define target_id uint32_t 6474d753acSMika Westerberg #endif 6574d753acSMika Westerberg 66e6e5906bSpbrook #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ 67a4c075f1SUlrich Hecht || defined(TARGET_M68K) || defined(TARGET_CRIS) || defined(TARGET_UNICORE32) \ 68d962783eSJia Liu || defined(TARGET_S390X) || defined(TARGET_OPENRISC) 692521d698Sbellard 702521d698Sbellard #define TARGET_IOC_SIZEBITS 14 712521d698Sbellard #define TARGET_IOC_DIRBITS 2 722521d698Sbellard 732521d698Sbellard #define TARGET_IOC_NONE 0U 742521d698Sbellard #define TARGET_IOC_WRITE 1U 752521d698Sbellard #define TARGET_IOC_READ 2U 762521d698Sbellard 77048f6b4dSbellard #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ 78b779e29eSEdgar E. Iglesias defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \ 79b779e29eSEdgar E. Iglesias defined(TARGET_MIPS) 802521d698Sbellard 812521d698Sbellard #define TARGET_IOC_SIZEBITS 13 822521d698Sbellard #define TARGET_IOC_DIRBITS 3 832521d698Sbellard 842521d698Sbellard #define TARGET_IOC_NONE 1U 852521d698Sbellard #define TARGET_IOC_READ 2U 862521d698Sbellard #define TARGET_IOC_WRITE 4U 872521d698Sbellard 882521d698Sbellard #else 892521d698Sbellard #error unsupported CPU 902521d698Sbellard #endif 912521d698Sbellard 922521d698Sbellard #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) 932521d698Sbellard #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) 942521d698Sbellard #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) 952521d698Sbellard #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) 962521d698Sbellard 972521d698Sbellard #define TARGET_IOC_NRSHIFT 0 982521d698Sbellard #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) 992521d698Sbellard #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) 1002521d698Sbellard #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) 1012521d698Sbellard 1022521d698Sbellard #define TARGET_IOC(dir,type,nr,size) \ 1032521d698Sbellard (((dir) << TARGET_IOC_DIRSHIFT) | \ 1042521d698Sbellard ((type) << TARGET_IOC_TYPESHIFT) | \ 1052521d698Sbellard ((nr) << TARGET_IOC_NRSHIFT) | \ 1062521d698Sbellard ((size) << TARGET_IOC_SIZESHIFT)) 1072521d698Sbellard 1082521d698Sbellard /* used to create numbers */ 1092521d698Sbellard #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) 1102521d698Sbellard #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) 1112521d698Sbellard #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1122521d698Sbellard #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1132521d698Sbellard 1142521d698Sbellard /* the size is automatically computed for these defines */ 1152521d698Sbellard #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) 1162521d698Sbellard #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1172521d698Sbellard #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1182521d698Sbellard 1197854b056Sbellard struct target_sockaddr { 1207854b056Sbellard uint16_t sa_family; 1217854b056Sbellard uint8_t sa_data[14]; 1227854b056Sbellard }; 1237854b056Sbellard 124f57d4192SLaurent Vivier struct target_sock_filter { 125f57d4192SLaurent Vivier abi_ushort code; 126f57d4192SLaurent Vivier uint8_t jt; 127f57d4192SLaurent Vivier uint8_t jf; 128f57d4192SLaurent Vivier abi_uint k; 129f57d4192SLaurent Vivier }; 130f57d4192SLaurent Vivier 131f57d4192SLaurent Vivier struct target_sock_fprog { 132f57d4192SLaurent Vivier abi_ushort len; 133f57d4192SLaurent Vivier abi_ulong filter; 134f57d4192SLaurent Vivier }; 135f57d4192SLaurent Vivier 136b975b83bSLionel Landwerlin struct target_in_addr { 137b975b83bSLionel Landwerlin uint32_t s_addr; /* big endian */ 138b975b83bSLionel Landwerlin }; 139b975b83bSLionel Landwerlin 140b975b83bSLionel Landwerlin struct target_ip_mreq { 141b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 142b975b83bSLionel Landwerlin struct target_in_addr imr_address; 143b975b83bSLionel Landwerlin }; 144b975b83bSLionel Landwerlin 145b975b83bSLionel Landwerlin struct target_ip_mreqn { 146b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 147b975b83bSLionel Landwerlin struct target_in_addr imr_address; 148b975b83bSLionel Landwerlin abi_long imr_ifindex; 149b975b83bSLionel Landwerlin }; 150b975b83bSLionel Landwerlin 1516e3cb58fSLionel Landwerlin struct target_ip_mreq_source { 1526e3cb58fSLionel Landwerlin /* big endian */ 1536e3cb58fSLionel Landwerlin uint32_t imr_multiaddr; 1546e3cb58fSLionel Landwerlin uint32_t imr_interface; 1556e3cb58fSLionel Landwerlin uint32_t imr_sourceaddr; 1566e3cb58fSLionel Landwerlin }; 1576e3cb58fSLionel Landwerlin 15831e31b8aSbellard struct target_timeval { 159992f48a0Sblueswir1 abi_long tv_sec; 160992f48a0Sblueswir1 abi_long tv_usec; 16131e31b8aSbellard }; 16231e31b8aSbellard 1631b6b029eSbellard struct target_timespec { 164992f48a0Sblueswir1 abi_long tv_sec; 165992f48a0Sblueswir1 abi_long tv_nsec; 1661b6b029eSbellard }; 1671b6b029eSbellard 16866fb9763Sbellard struct target_itimerval { 16966fb9763Sbellard struct target_timeval it_interval; 17066fb9763Sbellard struct target_timeval it_value; 17166fb9763Sbellard }; 17266fb9763Sbellard 173905bba13SErik de Castro Lopo struct target_itimerspec { 174905bba13SErik de Castro Lopo struct target_timespec it_interval; 175905bba13SErik de Castro Lopo struct target_timespec it_value; 176905bba13SErik de Castro Lopo }; 177905bba13SErik de Castro Lopo 178c227f099SAnthony Liguori typedef abi_long target_clock_t; 17932f36bceSbellard 180c596ed17Sbellard #define TARGET_HZ 100 181c596ed17Sbellard 18232f36bceSbellard struct target_tms { 183c227f099SAnthony Liguori target_clock_t tms_utime; 184c227f099SAnthony Liguori target_clock_t tms_stime; 185c227f099SAnthony Liguori target_clock_t tms_cutime; 186c227f099SAnthony Liguori target_clock_t tms_cstime; 18732f36bceSbellard }; 18832f36bceSbellard 1896180a181Sbellard struct target_utimbuf { 190992f48a0Sblueswir1 abi_long actime; 191992f48a0Sblueswir1 abi_long modtime; 1926180a181Sbellard }; 1936180a181Sbellard 194f2674e31Sbellard struct target_sel_arg_struct { 195992f48a0Sblueswir1 abi_long n; 196992f48a0Sblueswir1 abi_long inp, outp, exp; 197992f48a0Sblueswir1 abi_long tvp; 198f2674e31Sbellard }; 199f2674e31Sbellard 20031e31b8aSbellard struct target_iovec { 201992f48a0Sblueswir1 abi_long iov_base; /* Starting address */ 202992f48a0Sblueswir1 abi_long iov_len; /* Number of bytes */ 20331e31b8aSbellard }; 20431e31b8aSbellard 2051a9353d2Sbellard struct target_msghdr { 206992f48a0Sblueswir1 abi_long msg_name; /* Socket name */ 2071a9353d2Sbellard int msg_namelen; /* Length of name */ 208992f48a0Sblueswir1 abi_long msg_iov; /* Data blocks */ 209992f48a0Sblueswir1 abi_long msg_iovlen; /* Number of blocks */ 210992f48a0Sblueswir1 abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ 211992f48a0Sblueswir1 abi_long msg_controllen; /* Length of cmsg list */ 2121a9353d2Sbellard unsigned int msg_flags; 2131a9353d2Sbellard }; 2141a9353d2Sbellard 2157854b056Sbellard struct target_cmsghdr { 216992f48a0Sblueswir1 abi_long cmsg_len; 2177854b056Sbellard int cmsg_level; 2187854b056Sbellard int cmsg_type; 2197854b056Sbellard }; 2207854b056Sbellard 2217854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) 2227854b056Sbellard #define TARGET_CMSG_NXTHDR(mhdr, cmsg) __target_cmsg_nxthdr (mhdr, cmsg) 223992f48a0Sblueswir1 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ 224992f48a0Sblueswir1 & (size_t) ~(sizeof (abi_long) - 1)) 2257854b056Sbellard #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \ 2267854b056Sbellard + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr))) 2277854b056Sbellard #define TARGET_CMSG_LEN(len) (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len)) 2287854b056Sbellard 2297854b056Sbellard static __inline__ struct target_cmsghdr * 2307854b056Sbellard __target_cmsg_nxthdr (struct target_msghdr *__mhdr, struct target_cmsghdr *__cmsg) 2317854b056Sbellard { 2322b8bdefcSths struct target_cmsghdr *__ptr; 2337854b056Sbellard 2342b8bdefcSths __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg 235cbb21eedSMatthias Braun + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len))); 236cbb21eedSMatthias Braun if ((unsigned long)((char *)(__ptr+1) - (char *)(size_t)tswapal(__mhdr->msg_control)) 237cbb21eedSMatthias Braun > tswapal(__mhdr->msg_controllen)) 2387854b056Sbellard /* No more entries. */ 2392b8bdefcSths return (struct target_cmsghdr *)0; 2407854b056Sbellard return __cmsg; 2417854b056Sbellard } 2427854b056Sbellard 243*f19e00d7SAlexander Graf struct target_mmsghdr { 244*f19e00d7SAlexander Graf struct target_msghdr msg_hdr; /* Message header */ 245*f19e00d7SAlexander Graf unsigned int msg_len; /* Number of bytes transmitted */ 246*f19e00d7SAlexander Graf }; 2477854b056Sbellard 24831e31b8aSbellard struct target_rusage { 24931e31b8aSbellard struct target_timeval ru_utime; /* user time used */ 25031e31b8aSbellard struct target_timeval ru_stime; /* system time used */ 251992f48a0Sblueswir1 abi_long ru_maxrss; /* maximum resident set size */ 252992f48a0Sblueswir1 abi_long ru_ixrss; /* integral shared memory size */ 253992f48a0Sblueswir1 abi_long ru_idrss; /* integral unshared data size */ 254992f48a0Sblueswir1 abi_long ru_isrss; /* integral unshared stack size */ 255992f48a0Sblueswir1 abi_long ru_minflt; /* page reclaims */ 256992f48a0Sblueswir1 abi_long ru_majflt; /* page faults */ 257992f48a0Sblueswir1 abi_long ru_nswap; /* swaps */ 258992f48a0Sblueswir1 abi_long ru_inblock; /* block input operations */ 259992f48a0Sblueswir1 abi_long ru_oublock; /* block output operations */ 260992f48a0Sblueswir1 abi_long ru_msgsnd; /* messages sent */ 261992f48a0Sblueswir1 abi_long ru_msgrcv; /* messages received */ 262992f48a0Sblueswir1 abi_long ru_nsignals; /* signals received */ 263992f48a0Sblueswir1 abi_long ru_nvcsw; /* voluntary context switches */ 264992f48a0Sblueswir1 abi_long ru_nivcsw; /* involuntary " */ 26531e31b8aSbellard }; 26631e31b8aSbellard 26731e31b8aSbellard typedef struct { 26831e31b8aSbellard int val[2]; 269c227f099SAnthony Liguori } kernel_fsid_t; 27031e31b8aSbellard 27172f03900Sbellard struct kernel_statfs { 27231e31b8aSbellard int f_type; 27331e31b8aSbellard int f_bsize; 27431e31b8aSbellard int f_blocks; 27531e31b8aSbellard int f_bfree; 27631e31b8aSbellard int f_bavail; 27731e31b8aSbellard int f_files; 27831e31b8aSbellard int f_ffree; 279c227f099SAnthony Liguori kernel_fsid_t f_fsid; 28031e31b8aSbellard int f_namelen; 28131e31b8aSbellard int f_spare[6]; 28231e31b8aSbellard }; 28331e31b8aSbellard 284dab2ed99Sbellard struct target_dirent { 285992f48a0Sblueswir1 abi_long d_ino; 286992f48a0Sblueswir1 abi_long d_off; 287dab2ed99Sbellard unsigned short d_reclen; 288333858b7SDmitry V. Levin char d_name[]; 289dab2ed99Sbellard }; 290dab2ed99Sbellard 291dab2ed99Sbellard struct target_dirent64 { 292dab2ed99Sbellard uint64_t d_ino; 293dab2ed99Sbellard int64_t d_off; 294dab2ed99Sbellard unsigned short d_reclen; 295dab2ed99Sbellard unsigned char d_type; 296dab2ed99Sbellard char d_name[256]; 297dab2ed99Sbellard }; 298dab2ed99Sbellard 299dab2ed99Sbellard 30031e31b8aSbellard /* mostly generic signal stuff */ 301992f48a0Sblueswir1 #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ 302992f48a0Sblueswir1 #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ 303992f48a0Sblueswir1 #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ 30431e31b8aSbellard 30531e31b8aSbellard #ifdef TARGET_MIPS 30631e31b8aSbellard #define TARGET_NSIG 128 30731e31b8aSbellard #else 30831e31b8aSbellard #define TARGET_NSIG 64 30931e31b8aSbellard #endif 310992f48a0Sblueswir1 #define TARGET_NSIG_BPW TARGET_ABI_BITS 31131e31b8aSbellard #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) 31231e31b8aSbellard 31331e31b8aSbellard typedef struct { 314992f48a0Sblueswir1 abi_ulong sig[TARGET_NSIG_WORDS]; 315c227f099SAnthony Liguori } target_sigset_t; 31631e31b8aSbellard 31766fb9763Sbellard #ifdef BSWAP_NEEDED 318c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 31966fb9763Sbellard { 32066fb9763Sbellard int i; 32166fb9763Sbellard for(i = 0;i < TARGET_NSIG_WORDS; i++) 322cbb21eedSMatthias Braun d->sig[i] = tswapal(s->sig[i]); 32366fb9763Sbellard } 32466fb9763Sbellard #else 325c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 32666fb9763Sbellard { 32766fb9763Sbellard *d = *s; 32866fb9763Sbellard } 32966fb9763Sbellard #endif 33066fb9763Sbellard 331c227f099SAnthony Liguori static inline void target_siginitset(target_sigset_t *d, abi_ulong set) 33266fb9763Sbellard { 33366fb9763Sbellard int i; 33466fb9763Sbellard d->sig[0] = set; 33566fb9763Sbellard for(i = 1;i < TARGET_NSIG_WORDS; i++) 33666fb9763Sbellard d->sig[i] = 0; 33766fb9763Sbellard } 33866fb9763Sbellard 339c227f099SAnthony Liguori void host_to_target_sigset(target_sigset_t *d, const sigset_t *s); 340c227f099SAnthony Liguori void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); 341992f48a0Sblueswir1 void host_to_target_old_sigset(abi_ulong *old_sigset, 34266fb9763Sbellard const sigset_t *sigset); 34366fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset, 344992f48a0Sblueswir1 const abi_ulong *old_sigset); 34566fb9763Sbellard struct target_sigaction; 34666fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act, 34766fb9763Sbellard struct target_sigaction *oact); 34866fb9763Sbellard 349d2fbca94SGuan Xuetao #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \ 350d2fbca94SGuan Xuetao || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined(TARGET_SH4) \ 351d2fbca94SGuan Xuetao || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) \ 352a4c075f1SUlrich Hecht || defined(TARGET_MICROBLAZE) || defined(TARGET_UNICORE32) \ 353d962783eSJia Liu || defined(TARGET_S390X) || defined(TARGET_OPENRISC) 3542521d698Sbellard 355048f6b4dSbellard #if defined(TARGET_SPARC) 356048f6b4dSbellard #define TARGET_SA_NOCLDSTOP 8u 357048f6b4dSbellard #define TARGET_SA_NOCLDWAIT 0x100u 358048f6b4dSbellard #define TARGET_SA_SIGINFO 0x200u 359048f6b4dSbellard #define TARGET_SA_ONSTACK 1u 360048f6b4dSbellard #define TARGET_SA_RESTART 2u 361048f6b4dSbellard #define TARGET_SA_NODEFER 0x20u 362048f6b4dSbellard #define TARGET_SA_RESETHAND 4u 363048f6b4dSbellard #elif defined(TARGET_MIPS) 364048f6b4dSbellard #define TARGET_SA_NOCLDSTOP 0x00000001 365048f6b4dSbellard #define TARGET_SA_NOCLDWAIT 0x00010000 366048f6b4dSbellard #define TARGET_SA_SIGINFO 0x00000008 367048f6b4dSbellard #define TARGET_SA_ONSTACK 0x08000000 368048f6b4dSbellard #define TARGET_SA_NODEFER 0x40000000 369048f6b4dSbellard #define TARGET_SA_RESTART 0x10000000 370048f6b4dSbellard #define TARGET_SA_RESETHAND 0x80000000 371d26bc211Sths #if !defined(TARGET_ABI_MIPSN32) && !defined(TARGET_ABI_MIPSN64) 372d26bc211Sths #define TARGET_SA_RESTORER 0x04000000 /* Only for O32 */ 373540635baSths #endif 374d962783eSJia Liu #elif defined(TARGET_OPENRISC) 375d962783eSJia Liu #define TARGET_SA_NOCLDSTOP 0x00000001 376d962783eSJia Liu #define TARGET_SA_NOCLDWAIT 0x00000002 377d962783eSJia Liu #define TARGET_SA_SIGINFO 0x00000004 378d962783eSJia Liu #define TARGET_SA_ONSTACK 0x08000000 379d962783eSJia Liu #define TARGET_SA_RESTART 0x10000000 380d962783eSJia Liu #define TARGET_SA_NODEFER 0x40000000 381d962783eSJia Liu #define TARGET_SA_RESETHAND 0x80000000 38257f18a95SRichard Henderson #elif defined(TARGET_ALPHA) 38357f18a95SRichard Henderson #define TARGET_SA_ONSTACK 0x00000001 38457f18a95SRichard Henderson #define TARGET_SA_RESTART 0x00000002 38557f18a95SRichard Henderson #define TARGET_SA_NOCLDSTOP 0x00000004 38657f18a95SRichard Henderson #define TARGET_SA_NODEFER 0x00000008 38757f18a95SRichard Henderson #define TARGET_SA_RESETHAND 0x00000010 38857f18a95SRichard Henderson #define TARGET_SA_NOCLDWAIT 0x00000020 /* not supported yet */ 38957f18a95SRichard Henderson #define TARGET_SA_SIGINFO 0x00000040 390048f6b4dSbellard #else 3912521d698Sbellard #define TARGET_SA_NOCLDSTOP 0x00000001 3922521d698Sbellard #define TARGET_SA_NOCLDWAIT 0x00000002 /* not supported yet */ 3932521d698Sbellard #define TARGET_SA_SIGINFO 0x00000004 3942521d698Sbellard #define TARGET_SA_ONSTACK 0x08000000 3952521d698Sbellard #define TARGET_SA_RESTART 0x10000000 3962521d698Sbellard #define TARGET_SA_NODEFER 0x40000000 3972521d698Sbellard #define TARGET_SA_RESETHAND 0x80000000 3982521d698Sbellard #define TARGET_SA_RESTORER 0x04000000 3996d5e216dSbellard #endif 4006d5e216dSbellard 401d0f20495SRichard Henderson #if defined(TARGET_ALPHA) 402d0f20495SRichard Henderson 403d0f20495SRichard Henderson #define TARGET_SIGHUP 1 404d0f20495SRichard Henderson #define TARGET_SIGINT 2 405d0f20495SRichard Henderson #define TARGET_SIGQUIT 3 406d0f20495SRichard Henderson #define TARGET_SIGILL 4 407d0f20495SRichard Henderson #define TARGET_SIGTRAP 5 408d0f20495SRichard Henderson #define TARGET_SIGABRT 6 409d0f20495SRichard Henderson #define TARGET_SIGSTKFLT 7 /* actually SIGEMT */ 410d0f20495SRichard Henderson #define TARGET_SIGFPE 8 411d0f20495SRichard Henderson #define TARGET_SIGKILL 9 412d0f20495SRichard Henderson #define TARGET_SIGBUS 10 413d0f20495SRichard Henderson #define TARGET_SIGSEGV 11 414d0f20495SRichard Henderson #define TARGET_SIGSYS 12 415d0f20495SRichard Henderson #define TARGET_SIGPIPE 13 416d0f20495SRichard Henderson #define TARGET_SIGALRM 14 417d0f20495SRichard Henderson #define TARGET_SIGTERM 15 418d0f20495SRichard Henderson #define TARGET_SIGURG 16 419d0f20495SRichard Henderson #define TARGET_SIGSTOP 17 420d0f20495SRichard Henderson #define TARGET_SIGTSTP 18 421d0f20495SRichard Henderson #define TARGET_SIGCONT 19 422d0f20495SRichard Henderson #define TARGET_SIGCHLD 20 423d0f20495SRichard Henderson #define TARGET_SIGTTIN 21 424d0f20495SRichard Henderson #define TARGET_SIGTTOU 22 425d0f20495SRichard Henderson #define TARGET_SIGIO 23 426d0f20495SRichard Henderson #define TARGET_SIGXCPU 24 427d0f20495SRichard Henderson #define TARGET_SIGXFSZ 25 428d0f20495SRichard Henderson #define TARGET_SIGVTALRM 26 429d0f20495SRichard Henderson #define TARGET_SIGPROF 27 430d0f20495SRichard Henderson #define TARGET_SIGWINCH 28 431d0f20495SRichard Henderson #define TARGET_SIGPWR 29 /* actually SIGINFO */ 432d0f20495SRichard Henderson #define TARGET_SIGUSR1 30 433d0f20495SRichard Henderson #define TARGET_SIGUSR2 31 434d0f20495SRichard Henderson #define TARGET_SIGRTMIN 32 435d0f20495SRichard Henderson 436d0f20495SRichard Henderson #define TARGET_SIG_BLOCK 1 437d0f20495SRichard Henderson #define TARGET_SIG_UNBLOCK 2 438d0f20495SRichard Henderson #define TARGET_SIG_SETMASK 3 439d0f20495SRichard Henderson 440d0f20495SRichard Henderson #elif defined(TARGET_SPARC) 4416d5e216dSbellard 4426d5e216dSbellard #define TARGET_SIGHUP 1 4436d5e216dSbellard #define TARGET_SIGINT 2 4446d5e216dSbellard #define TARGET_SIGQUIT 3 4456d5e216dSbellard #define TARGET_SIGILL 4 4466d5e216dSbellard #define TARGET_SIGTRAP 5 4476d5e216dSbellard #define TARGET_SIGABRT 6 4486d5e216dSbellard #define TARGET_SIGIOT 6 4496d5e216dSbellard #define TARGET_SIGSTKFLT 7 /* actually EMT */ 4506d5e216dSbellard #define TARGET_SIGFPE 8 4516d5e216dSbellard #define TARGET_SIGKILL 9 4526d5e216dSbellard #define TARGET_SIGBUS 10 4536d5e216dSbellard #define TARGET_SIGSEGV 11 4546d5e216dSbellard #define TARGET_SIGSYS 12 4556d5e216dSbellard #define TARGET_SIGPIPE 13 4566d5e216dSbellard #define TARGET_SIGALRM 14 4576d5e216dSbellard #define TARGET_SIGTERM 15 4586d5e216dSbellard #define TARGET_SIGURG 16 4596d5e216dSbellard #define TARGET_SIGSTOP 17 4606d5e216dSbellard #define TARGET_SIGTSTP 18 4616d5e216dSbellard #define TARGET_SIGCONT 19 4626d5e216dSbellard #define TARGET_SIGCHLD 20 4636d5e216dSbellard #define TARGET_SIGTTIN 21 4646d5e216dSbellard #define TARGET_SIGTTOU 22 4656d5e216dSbellard #define TARGET_SIGIO 23 4666d5e216dSbellard #define TARGET_SIGXCPU 24 4676d5e216dSbellard #define TARGET_SIGXFSZ 25 4686d5e216dSbellard #define TARGET_SIGVTALRM 26 4696d5e216dSbellard #define TARGET_SIGPROF 27 4706d5e216dSbellard #define TARGET_SIGWINCH 28 4716d5e216dSbellard #define TARGET_SIGPWR 29 4726d5e216dSbellard #define TARGET_SIGUSR1 30 4736d5e216dSbellard #define TARGET_SIGUSR2 31 4746d5e216dSbellard #define TARGET_SIGRTMIN 32 4756d5e216dSbellard 4766d5e216dSbellard #define TARGET_SIG_BLOCK 0x01 /* for blocking signals */ 4776d5e216dSbellard #define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */ 4786d5e216dSbellard #define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */ 4796d5e216dSbellard 480048f6b4dSbellard #elif defined(TARGET_MIPS) 481048f6b4dSbellard 482048f6b4dSbellard #define TARGET_SIGHUP 1 /* Hangup (POSIX). */ 483048f6b4dSbellard #define TARGET_SIGINT 2 /* Interrupt (ANSI). */ 484048f6b4dSbellard #define TARGET_SIGQUIT 3 /* Quit (POSIX). */ 485048f6b4dSbellard #define TARGET_SIGILL 4 /* Illegal instruction (ANSI). */ 486048f6b4dSbellard #define TARGET_SIGTRAP 5 /* Trace trap (POSIX). */ 487048f6b4dSbellard #define TARGET_SIGIOT 6 /* IOT trap (4.2 BSD). */ 488048f6b4dSbellard #define TARGET_SIGABRT TARGET_SIGIOT /* Abort (ANSI). */ 489048f6b4dSbellard #define TARGET_SIGEMT 7 490048f6b4dSbellard #define TARGET_SIGSTKFLT 7 /* XXX: incorrect */ 491048f6b4dSbellard #define TARGET_SIGFPE 8 /* Floating-point exception (ANSI). */ 492048f6b4dSbellard #define TARGET_SIGKILL 9 /* Kill, unblockable (POSIX). */ 493048f6b4dSbellard #define TARGET_SIGBUS 10 /* BUS error (4.2 BSD). */ 494048f6b4dSbellard #define TARGET_SIGSEGV 11 /* Segmentation violation (ANSI). */ 495048f6b4dSbellard #define TARGET_SIGSYS 12 496048f6b4dSbellard #define TARGET_SIGPIPE 13 /* Broken pipe (POSIX). */ 497048f6b4dSbellard #define TARGET_SIGALRM 14 /* Alarm clock (POSIX). */ 498048f6b4dSbellard #define TARGET_SIGTERM 15 /* Termination (ANSI). */ 499048f6b4dSbellard #define TARGET_SIGUSR1 16 /* User-defined signal 1 (POSIX). */ 500048f6b4dSbellard #define TARGET_SIGUSR2 17 /* User-defined signal 2 (POSIX). */ 501048f6b4dSbellard #define TARGET_SIGCHLD 18 /* Child status has changed (POSIX). */ 502048f6b4dSbellard #define TARGET_SIGCLD TARGET_SIGCHLD /* Same as TARGET_SIGCHLD (System V). */ 503048f6b4dSbellard #define TARGET_SIGPWR 19 /* Power failure restart (System V). */ 504048f6b4dSbellard #define TARGET_SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */ 505048f6b4dSbellard #define TARGET_SIGURG 21 /* Urgent condition on socket (4.2 BSD). */ 506048f6b4dSbellard #define TARGET_SIGIO 22 /* I/O now possible (4.2 BSD). */ 507048f6b4dSbellard #define TARGET_SIGPOLL TARGET_SIGIO /* Pollable event occurred (System V). */ 508048f6b4dSbellard #define TARGET_SIGSTOP 23 /* Stop, unblockable (POSIX). */ 509048f6b4dSbellard #define TARGET_SIGTSTP 24 /* Keyboard stop (POSIX). */ 510048f6b4dSbellard #define TARGET_SIGCONT 25 /* Continue (POSIX). */ 511048f6b4dSbellard #define TARGET_SIGTTIN 26 /* Background read from tty (POSIX). */ 512048f6b4dSbellard #define TARGET_SIGTTOU 27 /* Background write to tty (POSIX). */ 513048f6b4dSbellard #define TARGET_SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */ 514048f6b4dSbellard #define TARGET_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */ 515048f6b4dSbellard #define TARGET_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ 516048f6b4dSbellard #define TARGET_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ 517048f6b4dSbellard #define TARGET_SIGRTMIN 32 518048f6b4dSbellard 519048f6b4dSbellard #define TARGET_SIG_BLOCK 1 /* for blocking signals */ 520048f6b4dSbellard #define TARGET_SIG_UNBLOCK 2 /* for unblocking signals */ 521048f6b4dSbellard #define TARGET_SIG_SETMASK 3 /* for setting the signal mask */ 522048f6b4dSbellard 5236d5e216dSbellard #else 5242521d698Sbellard 525d962783eSJia Liu /* OpenRISC Using the general signals */ 5262521d698Sbellard #define TARGET_SIGHUP 1 5272521d698Sbellard #define TARGET_SIGINT 2 5282521d698Sbellard #define TARGET_SIGQUIT 3 5292521d698Sbellard #define TARGET_SIGILL 4 5302521d698Sbellard #define TARGET_SIGTRAP 5 5312521d698Sbellard #define TARGET_SIGABRT 6 5322521d698Sbellard #define TARGET_SIGIOT 6 5332521d698Sbellard #define TARGET_SIGBUS 7 5342521d698Sbellard #define TARGET_SIGFPE 8 5352521d698Sbellard #define TARGET_SIGKILL 9 5362521d698Sbellard #define TARGET_SIGUSR1 10 5372521d698Sbellard #define TARGET_SIGSEGV 11 5382521d698Sbellard #define TARGET_SIGUSR2 12 5392521d698Sbellard #define TARGET_SIGPIPE 13 5402521d698Sbellard #define TARGET_SIGALRM 14 5412521d698Sbellard #define TARGET_SIGTERM 15 5422521d698Sbellard #define TARGET_SIGSTKFLT 16 5432521d698Sbellard #define TARGET_SIGCHLD 17 5442521d698Sbellard #define TARGET_SIGCONT 18 5452521d698Sbellard #define TARGET_SIGSTOP 19 5462521d698Sbellard #define TARGET_SIGTSTP 20 5472521d698Sbellard #define TARGET_SIGTTIN 21 5482521d698Sbellard #define TARGET_SIGTTOU 22 5492521d698Sbellard #define TARGET_SIGURG 23 5502521d698Sbellard #define TARGET_SIGXCPU 24 5512521d698Sbellard #define TARGET_SIGXFSZ 25 5522521d698Sbellard #define TARGET_SIGVTALRM 26 5532521d698Sbellard #define TARGET_SIGPROF 27 5542521d698Sbellard #define TARGET_SIGWINCH 28 5552521d698Sbellard #define TARGET_SIGIO 29 556c596ed17Sbellard #define TARGET_SIGPWR 30 557c596ed17Sbellard #define TARGET_SIGSYS 31 5582521d698Sbellard #define TARGET_SIGRTMIN 32 5592521d698Sbellard 5602521d698Sbellard #define TARGET_SIG_BLOCK 0 /* for blocking signals */ 5612521d698Sbellard #define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */ 5622521d698Sbellard #define TARGET_SIG_SETMASK 2 /* for setting the signal mask */ 5632521d698Sbellard 5646d5e216dSbellard #endif 5656d5e216dSbellard 5666049f4f8SRichard Henderson #if defined(TARGET_ALPHA) 5676049f4f8SRichard Henderson struct target_old_sigaction { 5686049f4f8SRichard Henderson abi_ulong _sa_handler; 5696049f4f8SRichard Henderson abi_ulong sa_mask; 570d2565875SRichard Henderson int32_t sa_flags; 5716049f4f8SRichard Henderson }; 572106ec879Sbellard 5736049f4f8SRichard Henderson struct target_rt_sigaction { 5746049f4f8SRichard Henderson abi_ulong _sa_handler; 5756049f4f8SRichard Henderson abi_ulong sa_flags; 5766049f4f8SRichard Henderson target_sigset_t sa_mask; 5776049f4f8SRichard Henderson }; 5786049f4f8SRichard Henderson 5796049f4f8SRichard Henderson /* This is the struct used inside the kernel. The ka_restorer 5806049f4f8SRichard Henderson field comes from the 5th argument to sys_rt_sigaction. */ 5816049f4f8SRichard Henderson struct target_sigaction { 5826049f4f8SRichard Henderson abi_ulong _sa_handler; 5836049f4f8SRichard Henderson abi_ulong sa_flags; 5846049f4f8SRichard Henderson target_sigset_t sa_mask; 5856049f4f8SRichard Henderson abi_ulong sa_restorer; 5866049f4f8SRichard Henderson }; 5876049f4f8SRichard Henderson #elif defined(TARGET_MIPS) 588106ec879Sbellard struct target_sigaction { 589540635baSths uint32_t sa_flags; 590d26bc211Sths #if defined(TARGET_ABI_MIPSN32) 591540635baSths uint32_t _sa_handler; 592540635baSths #else 593992f48a0Sblueswir1 abi_ulong _sa_handler; 594540635baSths #endif 595c227f099SAnthony Liguori target_sigset_t sa_mask; 596106ec879Sbellard }; 597106ec879Sbellard #else 5982521d698Sbellard struct target_old_sigaction { 599992f48a0Sblueswir1 abi_ulong _sa_handler; 600992f48a0Sblueswir1 abi_ulong sa_mask; 601992f48a0Sblueswir1 abi_ulong sa_flags; 602992f48a0Sblueswir1 abi_ulong sa_restorer; 6032521d698Sbellard }; 6042521d698Sbellard 6052521d698Sbellard struct target_sigaction { 606992f48a0Sblueswir1 abi_ulong _sa_handler; 607992f48a0Sblueswir1 abi_ulong sa_flags; 608992f48a0Sblueswir1 abi_ulong sa_restorer; 609c227f099SAnthony Liguori target_sigset_t sa_mask; 6102521d698Sbellard }; 611106ec879Sbellard #endif 6122521d698Sbellard 6132521d698Sbellard typedef union target_sigval { 6142521d698Sbellard int sival_int; 615992f48a0Sblueswir1 abi_ulong sival_ptr; 616c227f099SAnthony Liguori } target_sigval_t; 6176d5e216dSbellard #if 0 6186d5e216dSbellard #if defined (TARGET_SPARC) 6196d5e216dSbellard typedef struct { 6206d5e216dSbellard struct { 621992f48a0Sblueswir1 abi_ulong psr; 622992f48a0Sblueswir1 abi_ulong pc; 623992f48a0Sblueswir1 abi_ulong npc; 624992f48a0Sblueswir1 abi_ulong y; 625992f48a0Sblueswir1 abi_ulong u_regs[16]; /* globals and ins */ 6266d5e216dSbellard } si_regs; 6276d5e216dSbellard int si_mask; 6286d5e216dSbellard } __siginfo_t; 6296d5e216dSbellard 6306d5e216dSbellard typedef struct { 6316d5e216dSbellard unsigned long si_float_regs [32]; 6326d5e216dSbellard unsigned long si_fsr; 6336d5e216dSbellard unsigned long si_fpqdepth; 6346d5e216dSbellard struct { 6356d5e216dSbellard unsigned long *insn_addr; 6366d5e216dSbellard unsigned long insn; 6376d5e216dSbellard } si_fpqueue [16]; 6386d5e216dSbellard } __siginfo_fpu_t; 6396d5e216dSbellard #endif 6406d5e216dSbellard #endif 6412521d698Sbellard 6422521d698Sbellard #define TARGET_SI_MAX_SIZE 128 6432521d698Sbellard #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE/sizeof(int)) - 3) 6442521d698Sbellard 6452521d698Sbellard typedef struct target_siginfo { 6463f53d546Spbrook #ifdef TARGET_MIPS 6473f53d546Spbrook int si_signo; 6483f53d546Spbrook int si_code; 6493f53d546Spbrook int si_errno; 6503f53d546Spbrook #else 6512521d698Sbellard int si_signo; 6522521d698Sbellard int si_errno; 6532521d698Sbellard int si_code; 6543f53d546Spbrook #endif 6552521d698Sbellard 6562521d698Sbellard union { 6572521d698Sbellard int _pad[TARGET_SI_PAD_SIZE]; 6582521d698Sbellard 6592521d698Sbellard /* kill() */ 6602521d698Sbellard struct { 6612521d698Sbellard pid_t _pid; /* sender's pid */ 6622521d698Sbellard uid_t _uid; /* sender's uid */ 6632521d698Sbellard } _kill; 6642521d698Sbellard 6652521d698Sbellard /* POSIX.1b timers */ 6662521d698Sbellard struct { 6672521d698Sbellard unsigned int _timer1; 6682521d698Sbellard unsigned int _timer2; 6692521d698Sbellard } _timer; 6702521d698Sbellard 6712521d698Sbellard /* POSIX.1b signals */ 6722521d698Sbellard struct { 6732521d698Sbellard pid_t _pid; /* sender's pid */ 6742521d698Sbellard uid_t _uid; /* sender's uid */ 675c227f099SAnthony Liguori target_sigval_t _sigval; 6762521d698Sbellard } _rt; 6772521d698Sbellard 6782521d698Sbellard /* SIGCHLD */ 6792521d698Sbellard struct { 6802521d698Sbellard pid_t _pid; /* which child */ 6812521d698Sbellard uid_t _uid; /* sender's uid */ 6822521d698Sbellard int _status; /* exit code */ 683c227f099SAnthony Liguori target_clock_t _utime; 684c227f099SAnthony Liguori target_clock_t _stime; 6852521d698Sbellard } _sigchld; 6862521d698Sbellard 6872521d698Sbellard /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 6882521d698Sbellard struct { 689992f48a0Sblueswir1 abi_ulong _addr; /* faulting insn/memory ref. */ 6902521d698Sbellard } _sigfault; 6912521d698Sbellard 6922521d698Sbellard /* SIGPOLL */ 6932521d698Sbellard struct { 6942521d698Sbellard int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 6952521d698Sbellard int _fd; 6962521d698Sbellard } _sigpoll; 6972521d698Sbellard } _sifields; 698c227f099SAnthony Liguori } target_siginfo_t; 6992521d698Sbellard 7002521d698Sbellard /* 7012521d698Sbellard * si_code values 7022521d698Sbellard * Digital reserves positive values for kernel-generated signals. 7032521d698Sbellard */ 7042521d698Sbellard #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ 7052521d698Sbellard #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 7062521d698Sbellard #define TARGET_SI_QUEUE -1 /* sent by sigqueue */ 7072521d698Sbellard #define TARGET_SI_TIMER -2 /* sent by timer expiration */ 7082521d698Sbellard #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ 7092521d698Sbellard #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ 7102521d698Sbellard #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ 7112521d698Sbellard 7122521d698Sbellard /* 7132521d698Sbellard * SIGILL si_codes 7142521d698Sbellard */ 715ffa65c3bSbellard #define TARGET_ILL_ILLOPC (1) /* illegal opcode */ 7162521d698Sbellard #define TARGET_ILL_ILLOPN (2) /* illegal operand */ 717ffa65c3bSbellard #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ 718ffa65c3bSbellard #define TARGET_ILL_ILLTRP (4) /* illegal trap */ 719ffa65c3bSbellard #define TARGET_ILL_PRVOPC (5) /* privileged opcode */ 720ffa65c3bSbellard #define TARGET_ILL_PRVREG (6) /* privileged register */ 721ffa65c3bSbellard #define TARGET_ILL_COPROC (7) /* coprocessor error */ 722ffa65c3bSbellard #define TARGET_ILL_BADSTK (8) /* internal stack error */ 7232521d698Sbellard 7242521d698Sbellard /* 7252521d698Sbellard * SIGFPE si_codes 7262521d698Sbellard */ 7272521d698Sbellard #define TARGET_FPE_INTDIV (1) /* integer divide by zero */ 7282521d698Sbellard #define TARGET_FPE_INTOVF (2) /* integer overflow */ 7292521d698Sbellard #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ 7302521d698Sbellard #define TARGET_FPE_FLTOVF (4) /* floating point overflow */ 7312521d698Sbellard #define TARGET_FPE_FLTUND (5) /* floating point underflow */ 7322521d698Sbellard #define TARGET_FPE_FLTRES (6) /* floating point inexact result */ 7332521d698Sbellard #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ 7342521d698Sbellard #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ 7352521d698Sbellard #define TARGET_NSIGFPE 8 7362521d698Sbellard 7372521d698Sbellard /* 7382521d698Sbellard * SIGSEGV si_codes 7392521d698Sbellard */ 7402521d698Sbellard #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ 7412521d698Sbellard #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ 7422521d698Sbellard 7432521d698Sbellard /* 744ffa65c3bSbellard * SIGBUS si_codes 745ffa65c3bSbellard */ 746ffa65c3bSbellard #define TARGET_BUS_ADRALN (1) /* invalid address alignment */ 747b4916d7bSDong Xu Wang #define TARGET_BUS_ADRERR (2) /* non-existent physical address */ 748ffa65c3bSbellard #define TARGET_BUS_OBJERR (3) /* object specific hardware error */ 749ffa65c3bSbellard 750ffa65c3bSbellard /* 7512521d698Sbellard * SIGTRAP si_codes 7522521d698Sbellard */ 7532521d698Sbellard #define TARGET_TRAP_BRKPT (1) /* process breakpoint */ 7542521d698Sbellard #define TARGET_TRAP_TRACE (2) /* process trace trap */ 7552521d698Sbellard 7562521d698Sbellard #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */ 7572521d698Sbellard 7589de5e440Sbellard struct target_rlimit { 759992f48a0Sblueswir1 abi_ulong rlim_cur; 760992f48a0Sblueswir1 abi_ulong rlim_max; 7619de5e440Sbellard }; 7629de5e440Sbellard 76381bbe906Stakasi-y@ops.dti.ne.jp #if defined(TARGET_ALPHA) 764e476492eSAurelien Jarno #define TARGET_RLIM_INFINITY 0x7fffffffffffffffull 7656cafd027SMatthias Braun #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32) 76681bbe906Stakasi-y@ops.dti.ne.jp #define TARGET_RLIM_INFINITY 0x7fffffffUL 76781bbe906Stakasi-y@ops.dti.ne.jp #else 76826b746dbSMatthias Braun #define TARGET_RLIM_INFINITY ((abi_ulong)-1) 76981bbe906Stakasi-y@ops.dti.ne.jp #endif 77081bbe906Stakasi-y@ops.dti.ne.jp 771e22b7015SWesley W. Terpstra #if defined(TARGET_MIPS) 772e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 773e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 774e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 775e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 776e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 777e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 7 778e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 8 779e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 5 780e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 9 781e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 6 782e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 783e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 784e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 785e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 786e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 787e22b7015SWesley W. Terpstra #else 788e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 789e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 790e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 791e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 792e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 793e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 5 7946cafd027SMatthias Braun #if defined(TARGET_SPARC) 7956cafd027SMatthias Braun #define TARGET_RLIMIT_NOFILE 6 7966cafd027SMatthias Braun #define TARGET_RLIMIT_NPROC 7 7976cafd027SMatthias Braun #else 798e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 6 799e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 7 8006cafd027SMatthias Braun #endif 801e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 8 802e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 9 803e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 804e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 805e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 806e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 807e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 808e22b7015SWesley W. Terpstra #endif 809e22b7015SWesley W. Terpstra 8109de5e440Sbellard struct target_pollfd { 8119de5e440Sbellard int fd; /* file descriptor */ 8129de5e440Sbellard short events; /* requested events */ 8139de5e440Sbellard short revents; /* returned events */ 8149de5e440Sbellard }; 8159de5e440Sbellard 8168e5a0667Sbellard /* virtual terminal ioctls */ 8170221cfcdSbellard #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ 8180221cfcdSbellard #define TARGET_KDMKTONE 0x4B30 /* generate tone */ 8198e5a0667Sbellard #define TARGET_KDGKBTYPE 0x4b33 820f7680a55SUlrich Hecht #define TARGET_KDSETMODE 0x4b3a 821f7680a55SUlrich Hecht #define TARGET_KDGKBMODE 0x4b44 822f7680a55SUlrich Hecht #define TARGET_KDSKBMODE 0x4b45 8230221cfcdSbellard #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ 8240221cfcdSbellard #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ 825e6fe18fbSCédric VINCENT #define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ 826e6fe18fbSCédric VINCENT #define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ 827e6fe18fbSCédric VINCENT #define TARGET_KDGETLED 0x4B31 /* return current led state */ 828e6fe18fbSCédric VINCENT #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */ 8298e5a0667Sbellard 8302521d698Sbellard #define TARGET_SIOCATMARK 0x8905 8312521d698Sbellard 83231e31b8aSbellard /* Networking ioctls */ 83331e31b8aSbellard #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ 83431e31b8aSbellard #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ 83531e31b8aSbellard #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ 83631e31b8aSbellard #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ 83731e31b8aSbellard #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ 83831e31b8aSbellard #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ 83931e31b8aSbellard #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ 84031e31b8aSbellard #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ 84131e31b8aSbellard #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ 84231e31b8aSbellard #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ 84331e31b8aSbellard #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ 84431e31b8aSbellard #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ 84531e31b8aSbellard #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ 84631e31b8aSbellard #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ 84731e31b8aSbellard #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ 84831e31b8aSbellard #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ 84931e31b8aSbellard #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ 85031e31b8aSbellard #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ 85131e31b8aSbellard #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ 85231e31b8aSbellard #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ 85331e31b8aSbellard #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ 85431e31b8aSbellard #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ 85531e31b8aSbellard #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ 85631e31b8aSbellard #define TARGET_SIOCSIFENCAP 0x8926 85731e31b8aSbellard #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ 85831e31b8aSbellard #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ 85931e31b8aSbellard #define TARGET_SIOCSIFSLAVE 0x8930 86031e31b8aSbellard #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ 86131e31b8aSbellard #define TARGET_SIOCDELMULTI 0x8932 86231e31b8aSbellard 86331e31b8aSbellard /* Bridging control calls */ 86431e31b8aSbellard #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ 86531e31b8aSbellard #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ 86631e31b8aSbellard 86731e31b8aSbellard #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ 86831e31b8aSbellard #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ 86931e31b8aSbellard 87031e31b8aSbellard /* ARP cache control calls. */ 87131e31b8aSbellard #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ 87231e31b8aSbellard #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ 87331e31b8aSbellard #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ 87431e31b8aSbellard #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ 87531e31b8aSbellard #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ 87631e31b8aSbellard #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ 87731e31b8aSbellard 87831e31b8aSbellard /* RARP cache control calls. */ 87931e31b8aSbellard #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ 88031e31b8aSbellard #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ 88131e31b8aSbellard #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ 88231e31b8aSbellard 88331e31b8aSbellard /* Driver configuration calls */ 88431e31b8aSbellard #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ 88531e31b8aSbellard #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ 88631e31b8aSbellard 88731e31b8aSbellard /* DLCI configuration calls */ 88831e31b8aSbellard #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ 88931e31b8aSbellard #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ 89031e31b8aSbellard 89186fcd946SLaurent Vivier /* From <linux/wireless.h> */ 89286fcd946SLaurent Vivier 89386fcd946SLaurent Vivier #define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ 89431e31b8aSbellard 89531e31b8aSbellard /* From <linux/fs.h> */ 89631e31b8aSbellard 89731e31b8aSbellard #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ 89831e31b8aSbellard #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ 89931e31b8aSbellard #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ 90031e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ 90131e31b8aSbellard #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ 90231e31b8aSbellard #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ 90331e31b8aSbellard #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ 90431e31b8aSbellard #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ 90531e31b8aSbellard #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ 90631e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ 90731e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ 90831e31b8aSbellard #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ 909fff8c539SAndreas Färber #define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */ 91031e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */ 911c8b0bf54SPeter Maydell #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong) 912c8b0bf54SPeter Maydell #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong) 913edafea13SAlexander Graf #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) 914edafea13SAlexander Graf /* return device size in bytes 915edafea13SAlexander Graf (u64 *arg) */ 91631e31b8aSbellard #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ 91731e31b8aSbellard #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ 918285da2b9SPeter Maydell #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) 91931e31b8aSbellard 92031e31b8aSbellard /* cdrom commands */ 92131e31b8aSbellard #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ 92231e31b8aSbellard #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ 92331e31b8aSbellard #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ 92431e31b8aSbellard #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index 92531e31b8aSbellard (struct cdrom_ti) */ 92631e31b8aSbellard #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header 92731e31b8aSbellard (struct cdrom_tochdr) */ 92831e31b8aSbellard #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry 92931e31b8aSbellard (struct cdrom_tocentry) */ 93031e31b8aSbellard #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ 93131e31b8aSbellard #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ 93231e31b8aSbellard #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ 93331e31b8aSbellard #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume 93431e31b8aSbellard (struct cdrom_volctrl) */ 93531e31b8aSbellard #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data 93631e31b8aSbellard (struct cdrom_subchnl) */ 93731e31b8aSbellard #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) 93831e31b8aSbellard (struct cdrom_read) */ 93931e31b8aSbellard #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) 94031e31b8aSbellard (struct cdrom_read) */ 94131e31b8aSbellard #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ 94231e31b8aSbellard #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ 94331e31b8aSbellard #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session 94431e31b8aSbellard address of multi session disks 94531e31b8aSbellard (struct cdrom_multisession) */ 94631e31b8aSbellard #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" 94731e31b8aSbellard if available (struct cdrom_mcn) */ 94831e31b8aSbellard #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is depricated, 949b4916d7bSDong Xu Wang but here anyway for compatibility */ 95031e31b8aSbellard #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ 95131e31b8aSbellard #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting 95231e31b8aSbellard (struct cdrom_volctrl) */ 95331e31b8aSbellard #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) 95431e31b8aSbellard (struct cdrom_read) */ 95531e31b8aSbellard /* 95631e31b8aSbellard * These ioctls are used only used in aztcd.c and optcd.c 95731e31b8aSbellard */ 95831e31b8aSbellard #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ 95931e31b8aSbellard #define TARGET_CDROMSEEK 0x5316 /* seek msf address */ 96031e31b8aSbellard 96131e31b8aSbellard /* 96231e31b8aSbellard * This ioctl is only used by the scsi-cd driver. 96331e31b8aSbellard It is for playing audio in logical block addressing mode. 96431e31b8aSbellard */ 96531e31b8aSbellard #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ 96631e31b8aSbellard 96731e31b8aSbellard /* 96831e31b8aSbellard * These ioctls are only used in optcd.c 96931e31b8aSbellard */ 97031e31b8aSbellard #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ 97131e31b8aSbellard 97231e31b8aSbellard /* 97331e31b8aSbellard * These ioctls are (now) only in ide-cd.c for controlling 97431e31b8aSbellard * drive spindown time. They should be implemented in the 97531e31b8aSbellard * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, 97631e31b8aSbellard * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... 97731e31b8aSbellard * -Erik 97831e31b8aSbellard */ 97931e31b8aSbellard #define TARGET_CDROMGETSPINDOWN 0x531d 98031e31b8aSbellard #define TARGET_CDROMSETSPINDOWN 0x531e 98131e31b8aSbellard 98231e31b8aSbellard /* 98331e31b8aSbellard * These ioctls are implemented through the uniform CD-ROM driver 98431e31b8aSbellard * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM 98531e31b8aSbellard * drivers are eventually ported to the uniform CD-ROM driver interface. 98631e31b8aSbellard */ 98731e31b8aSbellard #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ 98831e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ 98931e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ 99031e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ 99131e31b8aSbellard #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ 99231e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ 99331e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ 99431e31b8aSbellard #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ 99531e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ 99631e31b8aSbellard #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ 99731e31b8aSbellard #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ 99831e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ 99931e31b8aSbellard 100031e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. 100131e31b8aSbellard * Future CDROM ioctls should be kept below 0x537F 100231e31b8aSbellard */ 100331e31b8aSbellard 100431e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */ 100531e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ 100631e31b8aSbellard /* conflict with SCSI_IOCTL_GET_IDLUN */ 100731e31b8aSbellard 100831e31b8aSbellard /* DVD-ROM Specific ioctls */ 100931e31b8aSbellard #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ 101031e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ 101131e31b8aSbellard #define TARGET_DVD_AUTH 0x5392 /* Authentication */ 101231e31b8aSbellard 101331e31b8aSbellard #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ 101431e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ 101531e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ 101631e31b8aSbellard 101731e31b8aSbellard /* HD commands */ 101831e31b8aSbellard 101931e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ 102031e31b8aSbellard #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ 102131e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ 102231e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ 102331e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ 102431e31b8aSbellard #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ 102531e31b8aSbellard #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ 102631e31b8aSbellard #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ 10272521d698Sbellard #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ 102831e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ 102931e31b8aSbellard 103031e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ 103131e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ 103231e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ 103331e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ 103431e31b8aSbellard #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ 103531e31b8aSbellard #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ 103631e31b8aSbellard #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ 103731e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ 10382521d698Sbellard 1039b8005914Sbalrog /* loop ioctls */ 1040b8005914Sbalrog #define TARGET_LOOP_SET_FD 0x4C00 1041b8005914Sbalrog #define TARGET_LOOP_CLR_FD 0x4C01 1042b8005914Sbalrog #define TARGET_LOOP_SET_STATUS 0x4C02 1043b8005914Sbalrog #define TARGET_LOOP_GET_STATUS 0x4C03 1044b8005914Sbalrog #define TARGET_LOOP_SET_STATUS64 0x4C04 1045b8005914Sbalrog #define TARGET_LOOP_GET_STATUS64 0x4C05 1046b8005914Sbalrog #define TARGET_LOOP_CHANGE_FD 0x4C06 10472521d698Sbellard 1048f7680a55SUlrich Hecht /* fb ioctls */ 1049f7680a55SUlrich Hecht #define TARGET_FBIOGET_VSCREENINFO 0x4600 1050f7680a55SUlrich Hecht #define TARGET_FBIOPUT_VSCREENINFO 0x4601 1051f7680a55SUlrich Hecht #define TARGET_FBIOGET_FSCREENINFO 0x4602 105212b81b71SCédric VINCENT #define TARGET_FBIOGETCMAP 0x4604 105312b81b71SCédric VINCENT #define TARGET_FBIOPUTCMAP 0x4605 105412b81b71SCédric VINCENT #define TARGET_FBIOPAN_DISPLAY 0x4606 105512b81b71SCédric VINCENT #define TARGET_FBIOGET_CON2FBMAP 0x460F 105612b81b71SCédric VINCENT #define TARGET_FBIOPUT_CON2FBMAP 0x4610 1057f7680a55SUlrich Hecht 1058f7680a55SUlrich Hecht /* vt ioctls */ 1059f7680a55SUlrich Hecht #define TARGET_VT_OPENQRY 0x5600 1060f7680a55SUlrich Hecht #define TARGET_VT_GETSTATE 0x5603 1061f7680a55SUlrich Hecht #define TARGET_VT_ACTIVATE 0x5606 1062f7680a55SUlrich Hecht #define TARGET_VT_WAITACTIVE 0x5607 1063f7680a55SUlrich Hecht #define TARGET_VT_LOCKSWITCH 0x560b 1064f7680a55SUlrich Hecht #define TARGET_VT_UNLOCKSWITCH 0x560c 1065774750c0SCédric VINCENT #define TARGET_VT_GETMODE 0x5601 1066774750c0SCédric VINCENT #define TARGET_VT_SETMODE 0x5602 1067774750c0SCédric VINCENT #define TARGET_VT_RELDISP 0x5605 1068774750c0SCédric VINCENT #define TARGET_VT_DISALLOCATE 0x5608 1069f7680a55SUlrich Hecht 107056e904ecSAlexander Graf /* device mapper */ 107156e904ecSAlexander Graf #define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00) 107256e904ecSAlexander Graf #define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01) 107356e904ecSAlexander Graf #define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02) 107456e904ecSAlexander Graf #define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03) 107556e904ecSAlexander Graf #define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04) 107656e904ecSAlexander Graf #define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05) 107756e904ecSAlexander Graf #define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06) 107856e904ecSAlexander Graf #define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07) 107956e904ecSAlexander Graf #define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08) 108056e904ecSAlexander Graf #define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09) 108156e904ecSAlexander Graf #define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a) 108256e904ecSAlexander Graf #define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b) 108356e904ecSAlexander Graf #define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c) 108456e904ecSAlexander Graf #define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d) 108556e904ecSAlexander Graf #define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e) 108656e904ecSAlexander Graf #define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f) 108756e904ecSAlexander Graf 10882521d698Sbellard /* from asm/termbits.h */ 10892521d698Sbellard 10903bfd9da1Sbellard #define TARGET_NCC 8 10913bfd9da1Sbellard struct target_termio { 10923bfd9da1Sbellard unsigned short c_iflag; /* input mode flags */ 10933bfd9da1Sbellard unsigned short c_oflag; /* output mode flags */ 10943bfd9da1Sbellard unsigned short c_cflag; /* control mode flags */ 10953bfd9da1Sbellard unsigned short c_lflag; /* local mode flags */ 10962521d698Sbellard unsigned char c_line; /* line discipline */ 10973bfd9da1Sbellard unsigned char c_cc[TARGET_NCC]; /* control characters */ 10982521d698Sbellard }; 10992521d698Sbellard 11003bfd9da1Sbellard struct target_winsize { 11013bfd9da1Sbellard unsigned short ws_row; 11023bfd9da1Sbellard unsigned short ws_col; 11033bfd9da1Sbellard unsigned short ws_xpixel; 11043bfd9da1Sbellard unsigned short ws_ypixel; 11053bfd9da1Sbellard }; 11062521d698Sbellard 11073bfd9da1Sbellard #include "termbits.h" 11082521d698Sbellard 11099e0b74a4SPaul Brook #if defined(TARGET_MIPS) 11109e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x10 11119e0b74a4SPaul Brook #else 11129e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x08 11139e0b74a4SPaul Brook #endif 11149e0b74a4SPaul Brook 1115e44a3e79Saurel32 /* Common */ 11162521d698Sbellard #define TARGET_MAP_SHARED 0x01 /* Share changes */ 11172521d698Sbellard #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ 11182521d698Sbellard #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ 1119e44a3e79Saurel32 1120e44a3e79Saurel32 /* Target specific */ 1121048f6b4dSbellard #if defined(TARGET_MIPS) 1122e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1123048f6b4dSbellard #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 1124048f6b4dSbellard #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 1125048f6b4dSbellard #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 1126048f6b4dSbellard #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 1127048f6b4dSbellard #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 1128048f6b4dSbellard #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 1129540635baSths #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 1130540635baSths #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1131e44a3e79Saurel32 #elif defined(TARGET_PPC) 1132e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 11332521d698Sbellard #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 11342521d698Sbellard #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 11352521d698Sbellard #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 11362521d698Sbellard #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 11377ec93196Sj_mayer #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ 11387ec93196Sj_mayer #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ 1139e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1140e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1141e44a3e79Saurel32 #elif defined(TARGET_ALPHA) 1142e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1143e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ 1144e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ 1145e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ 1146e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ 1147e44a3e79Saurel32 #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ 1148e44a3e79Saurel32 #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ 1149e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ 1150e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ 11517ec93196Sj_mayer #else 1152e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1153e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 1154e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 1155e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 1156e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 11572521d698Sbellard #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ 11582521d698Sbellard #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ 1159540635baSths #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1160540635baSths #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1161906c1b8eSMike Frysinger #define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ 11627ec93196Sj_mayer #endif 11632521d698Sbellard 116409701199SAlexander Graf #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 116509701199SAlexander Graf || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 1166c7819dfbSPeter Maydell || defined(TARGET_CRIS) || defined(TARGET_UNICORE32) 11672521d698Sbellard struct target_stat { 11682521d698Sbellard unsigned short st_dev; 11692521d698Sbellard unsigned short __pad1; 1170992f48a0Sblueswir1 abi_ulong st_ino; 11712521d698Sbellard unsigned short st_mode; 11722521d698Sbellard unsigned short st_nlink; 11732521d698Sbellard unsigned short st_uid; 11742521d698Sbellard unsigned short st_gid; 11752521d698Sbellard unsigned short st_rdev; 11762521d698Sbellard unsigned short __pad2; 1177992f48a0Sblueswir1 abi_ulong st_size; 1178992f48a0Sblueswir1 abi_ulong st_blksize; 1179992f48a0Sblueswir1 abi_ulong st_blocks; 1180992f48a0Sblueswir1 abi_ulong target_st_atime; 1181992f48a0Sblueswir1 abi_ulong __unused1; 1182992f48a0Sblueswir1 abi_ulong target_st_mtime; 1183992f48a0Sblueswir1 abi_ulong __unused2; 1184992f48a0Sblueswir1 abi_ulong target_st_ctime; 1185992f48a0Sblueswir1 abi_ulong __unused3; 1186992f48a0Sblueswir1 abi_ulong __unused4; 1187992f48a0Sblueswir1 abi_ulong __unused5; 11882521d698Sbellard }; 11892521d698Sbellard 11902521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely 11912521d698Sbellard * insane amounts of padding around dev_t's. 11922521d698Sbellard */ 119320d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 11942521d698Sbellard struct target_stat64 { 11952521d698Sbellard unsigned short st_dev; 11962521d698Sbellard unsigned char __pad0[10]; 11972521d698Sbellard 11982521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1199992f48a0Sblueswir1 abi_ulong __st_ino; 12002521d698Sbellard 12012521d698Sbellard unsigned int st_mode; 12022521d698Sbellard unsigned int st_nlink; 12032521d698Sbellard 1204992f48a0Sblueswir1 abi_ulong st_uid; 1205992f48a0Sblueswir1 abi_ulong st_gid; 12062521d698Sbellard 12072521d698Sbellard unsigned short st_rdev; 12082521d698Sbellard unsigned char __pad3[10]; 12092521d698Sbellard 12102521d698Sbellard long long st_size; 1211992f48a0Sblueswir1 abi_ulong st_blksize; 12122521d698Sbellard 1213992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1214992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 12152521d698Sbellard 1216992f48a0Sblueswir1 abi_ulong target_st_atime; 1217992f48a0Sblueswir1 abi_ulong __pad5; 12182521d698Sbellard 1219992f48a0Sblueswir1 abi_ulong target_st_mtime; 1220992f48a0Sblueswir1 abi_ulong __pad6; 12212521d698Sbellard 1222992f48a0Sblueswir1 abi_ulong target_st_ctime; 1223992f48a0Sblueswir1 abi_ulong __pad7; /* will be high 32 bits of ctime someday */ 12242521d698Sbellard 12252521d698Sbellard unsigned long long st_ino; 1226541dc0d4SStefan Weil } QEMU_PACKED; 12272521d698Sbellard 1228ce4defa0Spbrook #ifdef TARGET_ARM 122920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1230ce4defa0Spbrook struct target_eabi_stat64 { 1231ce4defa0Spbrook unsigned long long st_dev; 1232ce4defa0Spbrook unsigned int __pad1; 1233992f48a0Sblueswir1 abi_ulong __st_ino; 1234ce4defa0Spbrook unsigned int st_mode; 1235ce4defa0Spbrook unsigned int st_nlink; 1236ce4defa0Spbrook 1237992f48a0Sblueswir1 abi_ulong st_uid; 1238992f48a0Sblueswir1 abi_ulong st_gid; 1239ce4defa0Spbrook 1240ce4defa0Spbrook unsigned long long st_rdev; 1241ce4defa0Spbrook unsigned int __pad2[2]; 1242ce4defa0Spbrook 1243ce4defa0Spbrook long long st_size; 1244992f48a0Sblueswir1 abi_ulong st_blksize; 1245ce4defa0Spbrook unsigned int __pad3; 1246ce4defa0Spbrook unsigned long long st_blocks; 1247ce4defa0Spbrook 1248992f48a0Sblueswir1 abi_ulong target_st_atime; 1249992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1250ce4defa0Spbrook 1251992f48a0Sblueswir1 abi_ulong target_st_mtime; 1252992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1253ce4defa0Spbrook 1254992f48a0Sblueswir1 abi_ulong target_st_ctime; 1255992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1256ce4defa0Spbrook 1257ce4defa0Spbrook unsigned long long st_ino; 1258541dc0d4SStefan Weil } QEMU_PACKED; 1259ce4defa0Spbrook #endif 1260ce4defa0Spbrook 1261992f48a0Sblueswir1 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 12621b8dd648Sblueswir1 struct target_stat { 12631b8dd648Sblueswir1 unsigned int st_dev; 1264992f48a0Sblueswir1 abi_ulong st_ino; 12651b8dd648Sblueswir1 unsigned int st_mode; 12661b8dd648Sblueswir1 unsigned int st_nlink; 12671b8dd648Sblueswir1 unsigned int st_uid; 12681b8dd648Sblueswir1 unsigned int st_gid; 12691b8dd648Sblueswir1 unsigned int st_rdev; 1270992f48a0Sblueswir1 abi_long st_size; 1271992f48a0Sblueswir1 abi_long target_st_atime; 1272992f48a0Sblueswir1 abi_long target_st_mtime; 1273992f48a0Sblueswir1 abi_long target_st_ctime; 1274992f48a0Sblueswir1 abi_long st_blksize; 1275992f48a0Sblueswir1 abi_long st_blocks; 1276992f48a0Sblueswir1 abi_ulong __unused4[2]; 12771b8dd648Sblueswir1 }; 12781b8dd648Sblueswir1 127920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 12801b8dd648Sblueswir1 struct target_stat64 { 12811b8dd648Sblueswir1 unsigned char __pad0[6]; 12821b8dd648Sblueswir1 unsigned short st_dev; 12831b8dd648Sblueswir1 12841b8dd648Sblueswir1 uint64_t st_ino; 12851b8dd648Sblueswir1 uint64_t st_nlink; 12861b8dd648Sblueswir1 12871b8dd648Sblueswir1 unsigned int st_mode; 12881b8dd648Sblueswir1 12891b8dd648Sblueswir1 unsigned int st_uid; 12901b8dd648Sblueswir1 unsigned int st_gid; 12911b8dd648Sblueswir1 12921b8dd648Sblueswir1 unsigned char __pad2[6]; 12931b8dd648Sblueswir1 unsigned short st_rdev; 12941b8dd648Sblueswir1 12951b8dd648Sblueswir1 int64_t st_size; 12961b8dd648Sblueswir1 int64_t st_blksize; 12971b8dd648Sblueswir1 12981b8dd648Sblueswir1 unsigned char __pad4[4]; 12991b8dd648Sblueswir1 unsigned int st_blocks; 13001b8dd648Sblueswir1 1301992f48a0Sblueswir1 abi_ulong target_st_atime; 1302992f48a0Sblueswir1 abi_ulong __unused1; 13031b8dd648Sblueswir1 1304992f48a0Sblueswir1 abi_ulong target_st_mtime; 1305992f48a0Sblueswir1 abi_ulong __unused2; 13061b8dd648Sblueswir1 1307992f48a0Sblueswir1 abi_ulong target_st_ctime; 1308992f48a0Sblueswir1 abi_ulong __unused3; 13091b8dd648Sblueswir1 1310992f48a0Sblueswir1 abi_ulong __unused4[3]; 13111b8dd648Sblueswir1 }; 13121b8dd648Sblueswir1 13133bfd9da1Sbellard #elif defined(TARGET_SPARC) 13143bfd9da1Sbellard 13153bfd9da1Sbellard struct target_stat { 13163bfd9da1Sbellard unsigned short st_dev; 1317992f48a0Sblueswir1 abi_ulong st_ino; 13183bfd9da1Sbellard unsigned short st_mode; 13193bfd9da1Sbellard short st_nlink; 13203bfd9da1Sbellard unsigned short st_uid; 13213bfd9da1Sbellard unsigned short st_gid; 13223bfd9da1Sbellard unsigned short st_rdev; 1323992f48a0Sblueswir1 abi_long st_size; 1324992f48a0Sblueswir1 abi_long target_st_atime; 1325992f48a0Sblueswir1 abi_ulong __unused1; 1326992f48a0Sblueswir1 abi_long target_st_mtime; 1327992f48a0Sblueswir1 abi_ulong __unused2; 1328992f48a0Sblueswir1 abi_long target_st_ctime; 1329992f48a0Sblueswir1 abi_ulong __unused3; 1330992f48a0Sblueswir1 abi_long st_blksize; 1331992f48a0Sblueswir1 abi_long st_blocks; 1332992f48a0Sblueswir1 abi_ulong __unused4[2]; 13333bfd9da1Sbellard }; 13343bfd9da1Sbellard 133520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 13363bfd9da1Sbellard struct target_stat64 { 13373bfd9da1Sbellard unsigned char __pad0[6]; 13383bfd9da1Sbellard unsigned short st_dev; 13393bfd9da1Sbellard 13403bfd9da1Sbellard uint64_t st_ino; 13413bfd9da1Sbellard 13423bfd9da1Sbellard unsigned int st_mode; 13433bfd9da1Sbellard unsigned int st_nlink; 13443bfd9da1Sbellard 13453bfd9da1Sbellard unsigned int st_uid; 13463bfd9da1Sbellard unsigned int st_gid; 13473bfd9da1Sbellard 13483bfd9da1Sbellard unsigned char __pad2[6]; 13493bfd9da1Sbellard unsigned short st_rdev; 13503bfd9da1Sbellard 13513bfd9da1Sbellard unsigned char __pad3[8]; 13523bfd9da1Sbellard 13533bfd9da1Sbellard int64_t st_size; 13543bfd9da1Sbellard unsigned int st_blksize; 13553bfd9da1Sbellard 13563bfd9da1Sbellard unsigned char __pad4[8]; 13573bfd9da1Sbellard unsigned int st_blocks; 13583bfd9da1Sbellard 13593bfd9da1Sbellard unsigned int target_st_atime; 13603bfd9da1Sbellard unsigned int __unused1; 13613bfd9da1Sbellard 13623bfd9da1Sbellard unsigned int target_st_mtime; 13633bfd9da1Sbellard unsigned int __unused2; 13643bfd9da1Sbellard 13653bfd9da1Sbellard unsigned int target_st_ctime; 13663bfd9da1Sbellard unsigned int __unused3; 13673bfd9da1Sbellard 13683bfd9da1Sbellard unsigned int __unused4; 13693bfd9da1Sbellard unsigned int __unused5; 13703bfd9da1Sbellard }; 13713bfd9da1Sbellard 137267867308Sbellard #elif defined(TARGET_PPC) 137367867308Sbellard 137467867308Sbellard struct target_stat { 1375e32448e0Sj_mayer abi_ulong st_dev; 1376992f48a0Sblueswir1 abi_ulong st_ino; 1377325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1378e32448e0Sj_mayer abi_ulong st_nlink; 1379325e651fSj_mayer unsigned int st_mode; 1380325e651fSj_mayer #else 138167867308Sbellard unsigned int st_mode; 138267867308Sbellard unsigned short st_nlink; 1383325e651fSj_mayer #endif 138467867308Sbellard unsigned int st_uid; 138567867308Sbellard unsigned int st_gid; 1386e32448e0Sj_mayer abi_ulong st_rdev; 1387992f48a0Sblueswir1 abi_ulong st_size; 1388992f48a0Sblueswir1 abi_ulong st_blksize; 1389992f48a0Sblueswir1 abi_ulong st_blocks; 1390992f48a0Sblueswir1 abi_ulong target_st_atime; 1391e32448e0Sj_mayer abi_ulong target_st_atime_nsec; 1392992f48a0Sblueswir1 abi_ulong target_st_mtime; 1393e32448e0Sj_mayer abi_ulong target_st_mtime_nsec; 1394992f48a0Sblueswir1 abi_ulong target_st_ctime; 1395e32448e0Sj_mayer abi_ulong target_st_ctime_nsec; 1396992f48a0Sblueswir1 abi_ulong __unused4; 1397992f48a0Sblueswir1 abi_ulong __unused5; 1398325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1399325e651fSj_mayer abi_ulong __unused6; 1400325e651fSj_mayer #endif 140167867308Sbellard }; 140267867308Sbellard 140320d155bcSStefan Weil #if !defined(TARGET_PPC64) || defined(TARGET_ABI32) 140420d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1405541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 140667867308Sbellard unsigned long long st_dev; 140767867308Sbellard unsigned long long st_ino; 140867867308Sbellard unsigned int st_mode; 140967867308Sbellard unsigned int st_nlink; 141067867308Sbellard unsigned int st_uid; 141167867308Sbellard unsigned int st_gid; 141267867308Sbellard unsigned long long st_rdev; 1413e1ce5e40Saurel32 unsigned long long __pad0; 141467867308Sbellard long long st_size; 1415e32448e0Sj_mayer int st_blksize; 1416e1ce5e40Saurel32 unsigned int __pad1; 141761322e91SMax Filippov long long st_blocks; /* Number 512-byte blocks allocated. */ 1418e32448e0Sj_mayer int target_st_atime; 1419e32448e0Sj_mayer unsigned int target_st_atime_nsec; 1420e32448e0Sj_mayer int target_st_mtime; 1421e32448e0Sj_mayer unsigned int target_st_mtime_nsec; 1422e32448e0Sj_mayer int target_st_ctime; 1423e32448e0Sj_mayer unsigned int target_st_ctime_nsec; 1424e32448e0Sj_mayer unsigned int __unused4; 1425e32448e0Sj_mayer unsigned int __unused5; 142667867308Sbellard }; 142720d155bcSStefan Weil #endif 142867867308Sbellard 1429b779e29eSEdgar E. Iglesias #elif defined(TARGET_MICROBLAZE) 1430b779e29eSEdgar E. Iglesias 1431b779e29eSEdgar E. Iglesias struct target_stat { 1432b779e29eSEdgar E. Iglesias abi_ulong st_dev; 1433b779e29eSEdgar E. Iglesias abi_ulong st_ino; 1434b779e29eSEdgar E. Iglesias unsigned int st_mode; 1435b779e29eSEdgar E. Iglesias unsigned short st_nlink; 1436b779e29eSEdgar E. Iglesias unsigned int st_uid; 1437b779e29eSEdgar E. Iglesias unsigned int st_gid; 1438b779e29eSEdgar E. Iglesias abi_ulong st_rdev; 1439b779e29eSEdgar E. Iglesias abi_ulong st_size; 1440b779e29eSEdgar E. Iglesias abi_ulong st_blksize; 1441b779e29eSEdgar E. Iglesias abi_ulong st_blocks; 1442b779e29eSEdgar E. Iglesias abi_ulong target_st_atime; 1443b779e29eSEdgar E. Iglesias abi_ulong target_st_atime_nsec; 1444b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime; 1445b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime_nsec; 1446b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime; 1447b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime_nsec; 1448b779e29eSEdgar E. Iglesias abi_ulong __unused4; 1449b779e29eSEdgar E. Iglesias abi_ulong __unused5; 1450b779e29eSEdgar E. Iglesias }; 1451b779e29eSEdgar E. Iglesias 1452b779e29eSEdgar E. Iglesias /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ 145320d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1454541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 1455b779e29eSEdgar E. Iglesias uint64_t st_dev; 1456a523eb06SEdgar E. Iglesias #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1457a523eb06SEdgar E. Iglesias uint32_t pad0; 1458a523eb06SEdgar E. Iglesias uint32_t __st_ino; 1459a523eb06SEdgar E. Iglesias 1460b779e29eSEdgar E. Iglesias uint32_t st_mode; 1461b779e29eSEdgar E. Iglesias uint32_t st_nlink; 1462b779e29eSEdgar E. Iglesias uint32_t st_uid; 1463b779e29eSEdgar E. Iglesias uint32_t st_gid; 1464b779e29eSEdgar E. Iglesias uint64_t st_rdev; 146521ebeb23SEdgar E. Iglesias uint64_t __pad1; 1466b779e29eSEdgar E. Iglesias 1467b779e29eSEdgar E. Iglesias int64_t st_size; 1468b779e29eSEdgar E. Iglesias int32_t st_blksize; 146921ebeb23SEdgar E. Iglesias uint32_t __pad2; 1470b779e29eSEdgar E. Iglesias int64_t st_blocks; /* Number 512-byte blocks allocated. */ 1471b779e29eSEdgar E. Iglesias 1472b779e29eSEdgar E. Iglesias int target_st_atime; 1473b779e29eSEdgar E. Iglesias unsigned int target_st_atime_nsec; 1474b779e29eSEdgar E. Iglesias int target_st_mtime; 1475b779e29eSEdgar E. Iglesias unsigned int target_st_mtime_nsec; 1476b779e29eSEdgar E. Iglesias int target_st_ctime; 1477b779e29eSEdgar E. Iglesias unsigned int target_st_ctime_nsec; 1478a523eb06SEdgar E. Iglesias uint64_t st_ino; 1479b779e29eSEdgar E. Iglesias }; 1480b779e29eSEdgar E. Iglesias 1481e6e5906bSpbrook #elif defined(TARGET_M68K) 1482e6e5906bSpbrook 1483e6e5906bSpbrook struct target_stat { 1484e6e5906bSpbrook unsigned short st_dev; 1485e6e5906bSpbrook unsigned short __pad1; 1486992f48a0Sblueswir1 abi_ulong st_ino; 1487e6e5906bSpbrook unsigned short st_mode; 1488e6e5906bSpbrook unsigned short st_nlink; 1489e6e5906bSpbrook unsigned short st_uid; 1490e6e5906bSpbrook unsigned short st_gid; 1491e6e5906bSpbrook unsigned short st_rdev; 1492e6e5906bSpbrook unsigned short __pad2; 1493992f48a0Sblueswir1 abi_ulong st_size; 1494992f48a0Sblueswir1 abi_ulong st_blksize; 1495992f48a0Sblueswir1 abi_ulong st_blocks; 1496992f48a0Sblueswir1 abi_ulong target_st_atime; 1497992f48a0Sblueswir1 abi_ulong __unused1; 1498992f48a0Sblueswir1 abi_ulong target_st_mtime; 1499992f48a0Sblueswir1 abi_ulong __unused2; 1500992f48a0Sblueswir1 abi_ulong target_st_ctime; 1501992f48a0Sblueswir1 abi_ulong __unused3; 1502992f48a0Sblueswir1 abi_ulong __unused4; 1503992f48a0Sblueswir1 abi_ulong __unused5; 1504e6e5906bSpbrook }; 1505e6e5906bSpbrook 1506e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely 1507e6e5906bSpbrook * insane amounts of padding around dev_t's. 1508e6e5906bSpbrook */ 150920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1510e6e5906bSpbrook struct target_stat64 { 1511e6e5906bSpbrook unsigned long long st_dev; 1512e6e5906bSpbrook unsigned char __pad1[2]; 1513e6e5906bSpbrook 1514e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1515992f48a0Sblueswir1 abi_ulong __st_ino; 1516e6e5906bSpbrook 1517e6e5906bSpbrook unsigned int st_mode; 1518e6e5906bSpbrook unsigned int st_nlink; 1519e6e5906bSpbrook 1520992f48a0Sblueswir1 abi_ulong st_uid; 1521992f48a0Sblueswir1 abi_ulong st_gid; 1522e6e5906bSpbrook 1523e6e5906bSpbrook unsigned long long st_rdev; 1524e6e5906bSpbrook unsigned char __pad3[2]; 1525e6e5906bSpbrook 1526e6e5906bSpbrook long long st_size; 1527992f48a0Sblueswir1 abi_ulong st_blksize; 1528e6e5906bSpbrook 1529992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 1530992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1531e6e5906bSpbrook 1532992f48a0Sblueswir1 abi_ulong target_st_atime; 1533992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1534e6e5906bSpbrook 1535992f48a0Sblueswir1 abi_ulong target_st_mtime; 1536992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1537e6e5906bSpbrook 1538992f48a0Sblueswir1 abi_ulong target_st_ctime; 1539992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1540e6e5906bSpbrook 1541e6e5906bSpbrook unsigned long long st_ino; 1542541dc0d4SStefan Weil } QEMU_PACKED; 1543e6e5906bSpbrook 1544d26bc211Sths #elif defined(TARGET_ABI_MIPSN64) 1545540635baSths 1546540635baSths /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ 1547540635baSths struct target_stat { 1548540635baSths unsigned int st_dev; 1549540635baSths unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ 1550540635baSths 1551992f48a0Sblueswir1 abi_ulong st_ino; 1552540635baSths 1553540635baSths unsigned int st_mode; 1554540635baSths unsigned int st_nlink; 1555540635baSths 1556540635baSths int st_uid; 1557540635baSths int st_gid; 1558540635baSths 1559540635baSths unsigned int st_rdev; 1560540635baSths unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ 1561540635baSths 1562992f48a0Sblueswir1 abi_ulong st_size; 1563540635baSths 1564540635baSths /* 1565540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1566540635baSths * but we don't have it under Linux. 1567540635baSths */ 1568540635baSths unsigned int target_st_atime; 1569540635baSths unsigned int target_st_atime_nsec; 1570540635baSths 1571540635baSths unsigned int target_st_mtime; 1572540635baSths unsigned int target_st_mtime_nsec; 1573540635baSths 1574540635baSths unsigned int target_st_ctime; 1575540635baSths unsigned int target_st_ctime_nsec; 1576540635baSths 1577540635baSths unsigned int st_blksize; 1578540635baSths unsigned int st_pad2; 1579540635baSths 1580992f48a0Sblueswir1 abi_ulong st_blocks; 1581540635baSths }; 1582540635baSths 1583d26bc211Sths #elif defined(TARGET_ABI_MIPSN32) 1584540635baSths 1585540635baSths struct target_stat { 1586540635baSths unsigned st_dev; 1587540635baSths int st_pad1[3]; /* Reserved for network id */ 1588540635baSths unsigned int st_ino; 1589540635baSths unsigned int st_mode; 1590540635baSths unsigned int st_nlink; 1591540635baSths int st_uid; 1592540635baSths int st_gid; 1593540635baSths unsigned st_rdev; 1594540635baSths unsigned int st_pad2[2]; 1595540635baSths unsigned int st_size; 1596540635baSths unsigned int st_pad3; 1597540635baSths /* 1598540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1599540635baSths * but we don't have it under Linux. 1600540635baSths */ 1601540635baSths unsigned int target_st_atime; 1602540635baSths unsigned int target_st_atime_nsec; 1603540635baSths unsigned int target_st_mtime; 1604540635baSths unsigned int target_st_mtime_nsec; 1605540635baSths unsigned int target_st_ctime; 1606540635baSths unsigned int target_st_ctime_nsec; 1607540635baSths unsigned int st_blksize; 1608540635baSths unsigned int st_blocks; 1609540635baSths unsigned int st_pad4[14]; 1610540635baSths }; 1611540635baSths 1612540635baSths /* 1613540635baSths * This matches struct stat64 in glibc2.1, hence the absolutely insane 1614540635baSths * amounts of padding around dev_t's. The memory layout is the same as of 1615540635baSths * struct stat of the 64-bit kernel. 1616540635baSths */ 1617540635baSths 161820d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1619540635baSths struct target_stat64 { 1620540635baSths unsigned int st_dev; 1621540635baSths unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ 1622540635baSths 1623540635baSths target_ulong st_ino; 1624540635baSths 1625540635baSths unsigned int st_mode; 1626540635baSths unsigned int st_nlink; 1627540635baSths 1628540635baSths int st_uid; 1629540635baSths int st_gid; 1630540635baSths 1631540635baSths unsigned int st_rdev; 1632540635baSths unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ 1633540635baSths 1634540635baSths int st_size; 1635540635baSths 1636540635baSths /* 1637540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1638540635baSths * but we don't have it under Linux. 1639540635baSths */ 1640540635baSths int target_st_atime; 1641540635baSths unsigned int target_st_atime_nsec; /* Reserved for st_atime expansion */ 1642540635baSths 1643540635baSths int target_st_mtime; 1644540635baSths unsigned int target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 1645540635baSths 1646540635baSths int target_st_ctime; 1647540635baSths unsigned int target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 1648540635baSths 1649540635baSths unsigned int st_blksize; 1650540635baSths unsigned int st_pad2; 1651540635baSths 1652540635baSths int st_blocks; 1653540635baSths }; 1654540635baSths 1655d26bc211Sths #elif defined(TARGET_ABI_MIPSO32) 1656048f6b4dSbellard 1657048f6b4dSbellard struct target_stat { 1658048f6b4dSbellard unsigned st_dev; 1659992f48a0Sblueswir1 abi_long st_pad1[3]; /* Reserved for network id */ 1660992f48a0Sblueswir1 abi_ulong st_ino; 1661048f6b4dSbellard unsigned int st_mode; 1662048f6b4dSbellard unsigned int st_nlink; 1663048f6b4dSbellard int st_uid; 1664048f6b4dSbellard int st_gid; 1665048f6b4dSbellard unsigned st_rdev; 1666992f48a0Sblueswir1 abi_long st_pad2[2]; 1667992f48a0Sblueswir1 abi_long st_size; 1668992f48a0Sblueswir1 abi_long st_pad3; 1669048f6b4dSbellard /* 1670048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1671048f6b4dSbellard * but we don't have it under Linux. 1672048f6b4dSbellard */ 1673992f48a0Sblueswir1 abi_long target_st_atime; 1674992f48a0Sblueswir1 abi_long target_st_atime_nsec; 1675992f48a0Sblueswir1 abi_long target_st_mtime; 1676992f48a0Sblueswir1 abi_long target_st_mtime_nsec; 1677992f48a0Sblueswir1 abi_long target_st_ctime; 1678992f48a0Sblueswir1 abi_long target_st_ctime_nsec; 1679992f48a0Sblueswir1 abi_long st_blksize; 1680992f48a0Sblueswir1 abi_long st_blocks; 1681992f48a0Sblueswir1 abi_long st_pad4[14]; 1682048f6b4dSbellard }; 1683048f6b4dSbellard 1684048f6b4dSbellard /* 1685048f6b4dSbellard * This matches struct stat64 in glibc2.1, hence the absolutely insane 1686048f6b4dSbellard * amounts of padding around dev_t's. The memory layout is the same as of 1687048f6b4dSbellard * struct stat of the 64-bit kernel. 1688048f6b4dSbellard */ 1689048f6b4dSbellard 169020d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1691048f6b4dSbellard struct target_stat64 { 1692992f48a0Sblueswir1 abi_ulong st_dev; 1693992f48a0Sblueswir1 abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 1694048f6b4dSbellard 1695048f6b4dSbellard uint64_t st_ino; 1696048f6b4dSbellard 1697048f6b4dSbellard unsigned int st_mode; 1698048f6b4dSbellard unsigned int st_nlink; 1699048f6b4dSbellard 1700048f6b4dSbellard int st_uid; 1701048f6b4dSbellard int st_gid; 1702048f6b4dSbellard 1703992f48a0Sblueswir1 abi_ulong st_rdev; 1704992f48a0Sblueswir1 abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 1705048f6b4dSbellard 1706048f6b4dSbellard int64_t st_size; 1707048f6b4dSbellard 1708048f6b4dSbellard /* 1709048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1710048f6b4dSbellard * but we don't have it under Linux. 1711048f6b4dSbellard */ 1712992f48a0Sblueswir1 abi_long target_st_atime; 1713992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 1714048f6b4dSbellard 1715992f48a0Sblueswir1 abi_long target_st_mtime; 1716992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 1717048f6b4dSbellard 1718992f48a0Sblueswir1 abi_long target_st_ctime; 1719992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 1720048f6b4dSbellard 1721992f48a0Sblueswir1 abi_ulong st_blksize; 1722992f48a0Sblueswir1 abi_ulong st_pad2; 1723048f6b4dSbellard 1724048f6b4dSbellard int64_t st_blocks; 1725048f6b4dSbellard }; 17267a3148a9Sj_mayer 17277a3148a9Sj_mayer #elif defined(TARGET_ALPHA) 17287a3148a9Sj_mayer 17297a3148a9Sj_mayer struct target_stat { 17307a3148a9Sj_mayer unsigned int st_dev; 17317a3148a9Sj_mayer unsigned int st_ino; 17327a3148a9Sj_mayer unsigned int st_mode; 17337a3148a9Sj_mayer unsigned int st_nlink; 17347a3148a9Sj_mayer unsigned int st_uid; 17357a3148a9Sj_mayer unsigned int st_gid; 17367a3148a9Sj_mayer unsigned int st_rdev; 1737992f48a0Sblueswir1 abi_long st_size; 1738992f48a0Sblueswir1 abi_ulong target_st_atime; 1739992f48a0Sblueswir1 abi_ulong target_st_mtime; 1740992f48a0Sblueswir1 abi_ulong target_st_ctime; 17417a3148a9Sj_mayer unsigned int st_blksize; 17427a3148a9Sj_mayer unsigned int st_blocks; 17437a3148a9Sj_mayer unsigned int st_flags; 17447a3148a9Sj_mayer unsigned int st_gen; 17457a3148a9Sj_mayer }; 17467a3148a9Sj_mayer 174720d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 17487a3148a9Sj_mayer struct target_stat64 { 1749992f48a0Sblueswir1 abi_ulong st_dev; 1750992f48a0Sblueswir1 abi_ulong st_ino; 1751992f48a0Sblueswir1 abi_ulong st_rdev; 1752992f48a0Sblueswir1 abi_long st_size; 1753992f48a0Sblueswir1 abi_ulong st_blocks; 17547a3148a9Sj_mayer 17557a3148a9Sj_mayer unsigned int st_mode; 17567a3148a9Sj_mayer unsigned int st_uid; 17577a3148a9Sj_mayer unsigned int st_gid; 17587a3148a9Sj_mayer unsigned int st_blksize; 17597a3148a9Sj_mayer unsigned int st_nlink; 17607a3148a9Sj_mayer unsigned int __pad0; 17617a3148a9Sj_mayer 1762992f48a0Sblueswir1 abi_ulong target_st_atime; 1763992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1764992f48a0Sblueswir1 abi_ulong target_st_mtime; 1765992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1766992f48a0Sblueswir1 abi_ulong target_st_ctime; 1767992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1768992f48a0Sblueswir1 abi_long __unused[3]; 17697a3148a9Sj_mayer }; 17707a3148a9Sj_mayer 17716db45e65Sths #elif defined(TARGET_SH4) 17726db45e65Sths 17736db45e65Sths struct target_stat { 1774992f48a0Sblueswir1 abi_ulong st_dev; 1775992f48a0Sblueswir1 abi_ulong st_ino; 17766db45e65Sths unsigned short st_mode; 17776db45e65Sths unsigned short st_nlink; 17786db45e65Sths unsigned short st_uid; 17796db45e65Sths unsigned short st_gid; 1780992f48a0Sblueswir1 abi_ulong st_rdev; 1781992f48a0Sblueswir1 abi_ulong st_size; 1782992f48a0Sblueswir1 abi_ulong st_blksize; 1783992f48a0Sblueswir1 abi_ulong st_blocks; 1784992f48a0Sblueswir1 abi_ulong target_st_atime; 1785992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1786992f48a0Sblueswir1 abi_ulong target_st_mtime; 1787992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1788992f48a0Sblueswir1 abi_ulong target_st_ctime; 1789992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1790992f48a0Sblueswir1 abi_ulong __unused4; 1791992f48a0Sblueswir1 abi_ulong __unused5; 17926db45e65Sths }; 17936db45e65Sths 17946db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely 17956db45e65Sths * insane amounts of padding around dev_t's. 17966db45e65Sths */ 179720d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1798541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 17996db45e65Sths unsigned long long st_dev; 18006db45e65Sths unsigned char __pad0[4]; 18016db45e65Sths 18026db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1803992f48a0Sblueswir1 abi_ulong __st_ino; 18046db45e65Sths 18056db45e65Sths unsigned int st_mode; 18066db45e65Sths unsigned int st_nlink; 18076db45e65Sths 1808992f48a0Sblueswir1 abi_ulong st_uid; 1809992f48a0Sblueswir1 abi_ulong st_gid; 18106db45e65Sths 18116db45e65Sths unsigned long long st_rdev; 18126db45e65Sths unsigned char __pad3[4]; 18136db45e65Sths 18146db45e65Sths long long st_size; 1815992f48a0Sblueswir1 abi_ulong st_blksize; 18166db45e65Sths 18176db45e65Sths unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ 18186db45e65Sths 1819992f48a0Sblueswir1 abi_ulong target_st_atime; 1820992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 18216db45e65Sths 1822992f48a0Sblueswir1 abi_ulong target_st_mtime; 1823992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 18246db45e65Sths 1825992f48a0Sblueswir1 abi_ulong target_st_ctime; 1826992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 18276db45e65Sths 18286db45e65Sths unsigned long long st_ino; 18296db45e65Sths }; 18306db45e65Sths 1831d2fd1af7Sbellard #elif defined(TARGET_I386) && !defined(TARGET_ABI32) 1832d2fd1af7Sbellard struct target_stat { 1833d2fd1af7Sbellard abi_ulong st_dev; 1834d2fd1af7Sbellard abi_ulong st_ino; 1835d2fd1af7Sbellard abi_ulong st_nlink; 1836d2fd1af7Sbellard 1837d2fd1af7Sbellard unsigned int st_mode; 1838d2fd1af7Sbellard unsigned int st_uid; 1839d2fd1af7Sbellard unsigned int st_gid; 1840d2fd1af7Sbellard unsigned int __pad0; 1841d2fd1af7Sbellard abi_ulong st_rdev; 1842d2fd1af7Sbellard abi_long st_size; 1843d2fd1af7Sbellard abi_long st_blksize; 1844d2fd1af7Sbellard abi_long st_blocks; /* Number 512-byte blocks allocated. */ 1845d2fd1af7Sbellard 1846d2fd1af7Sbellard abi_ulong target_st_atime; 1847d2fd1af7Sbellard abi_ulong target_st_atime_nsec; 1848d2fd1af7Sbellard abi_ulong target_st_mtime; 1849d2fd1af7Sbellard abi_ulong target_st_mtime_nsec; 1850d2fd1af7Sbellard abi_ulong target_st_ctime; 1851d2fd1af7Sbellard abi_ulong target_st_ctime_nsec; 1852d2fd1af7Sbellard 1853d2fd1af7Sbellard abi_long __unused[3]; 1854d2fd1af7Sbellard }; 1855a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 1856a4c075f1SUlrich Hecht struct target_stat { 1857a4c075f1SUlrich Hecht abi_ulong st_dev; 1858a4c075f1SUlrich Hecht abi_ulong st_ino; 1859a4c075f1SUlrich Hecht abi_ulong st_nlink; 1860a4c075f1SUlrich Hecht unsigned int st_mode; 1861a4c075f1SUlrich Hecht unsigned int st_uid; 1862a4c075f1SUlrich Hecht unsigned int st_gid; 1863a4c075f1SUlrich Hecht unsigned int __pad1; 1864a4c075f1SUlrich Hecht abi_ulong st_rdev; 1865a4c075f1SUlrich Hecht abi_ulong st_size; 1866a4c075f1SUlrich Hecht abi_ulong target_st_atime; 1867a4c075f1SUlrich Hecht abi_ulong target_st_atime_nsec; 1868a4c075f1SUlrich Hecht abi_ulong target_st_mtime; 1869a4c075f1SUlrich Hecht abi_ulong target_st_mtime_nsec; 1870a4c075f1SUlrich Hecht abi_ulong target_st_ctime; 1871a4c075f1SUlrich Hecht abi_ulong target_st_ctime_nsec; 1872a4c075f1SUlrich Hecht abi_ulong st_blksize; 1873a4c075f1SUlrich Hecht abi_long st_blocks; 1874a4c075f1SUlrich Hecht abi_ulong __unused[3]; 1875a4c075f1SUlrich Hecht }; 187609701199SAlexander Graf #elif defined(TARGET_AARCH64) 187709701199SAlexander Graf struct target_stat { 187809701199SAlexander Graf abi_ulong st_dev; 187909701199SAlexander Graf abi_ulong st_ino; 188009701199SAlexander Graf unsigned int st_mode; 188109701199SAlexander Graf unsigned int st_nlink; 188209701199SAlexander Graf unsigned int st_uid; 188309701199SAlexander Graf unsigned int st_gid; 188409701199SAlexander Graf abi_ulong st_rdev; 188509701199SAlexander Graf abi_ulong _pad1; 188609701199SAlexander Graf abi_long st_size; 188709701199SAlexander Graf int st_blksize; 188809701199SAlexander Graf int __pad2; 188909701199SAlexander Graf abi_long st_blocks; 189009701199SAlexander Graf abi_long target_st_atime; 189109701199SAlexander Graf abi_ulong target_st_atime_nsec; 189209701199SAlexander Graf abi_long target_st_mtime; 189309701199SAlexander Graf abi_ulong target_st_mtime_nsec; 189409701199SAlexander Graf abi_long target_st_ctime; 189509701199SAlexander Graf abi_ulong target_st_ctime_nsec; 189609701199SAlexander Graf unsigned int __unused[2]; 189709701199SAlexander Graf }; 1898d962783eSJia Liu #elif defined(TARGET_OPENRISC) 1899c7819dfbSPeter Maydell 1900c7819dfbSPeter Maydell /* These are the asm-generic versions of the stat and stat64 structures */ 1901c7819dfbSPeter Maydell 1902d962783eSJia Liu struct target_stat { 1903d962783eSJia Liu abi_ulong st_dev; 1904d962783eSJia Liu abi_ulong st_ino; 1905d962783eSJia Liu unsigned int st_mode; 1906c7819dfbSPeter Maydell unsigned int st_nlink; 1907d962783eSJia Liu unsigned int st_uid; 1908d962783eSJia Liu unsigned int st_gid; 1909d962783eSJia Liu abi_ulong st_rdev; 1910c7819dfbSPeter Maydell abi_ulong __pad1; 1911d962783eSJia Liu abi_long st_size; 1912c7819dfbSPeter Maydell int st_blksize; 1913c7819dfbSPeter Maydell int __pad2; 1914c7819dfbSPeter Maydell abi_long st_blocks; 1915c7819dfbSPeter Maydell abi_long target_st_atime; 1916d962783eSJia Liu abi_ulong target_st_atime_nsec; 1917c7819dfbSPeter Maydell abi_long target_st_mtime; 1918d962783eSJia Liu abi_ulong target_st_mtime_nsec; 1919c7819dfbSPeter Maydell abi_long target_st_ctime; 1920d962783eSJia Liu abi_ulong target_st_ctime_nsec; 1921c7819dfbSPeter Maydell unsigned int __unused4; 1922c7819dfbSPeter Maydell unsigned int __unused5; 1923d962783eSJia Liu }; 1924c7819dfbSPeter Maydell 192520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1926c7819dfbSPeter Maydell struct target_stat64 { 1927c7819dfbSPeter Maydell uint64_t st_dev; 1928c7819dfbSPeter Maydell uint64_t st_ino; 1929c7819dfbSPeter Maydell unsigned int st_mode; 1930c7819dfbSPeter Maydell unsigned int st_nlink; 1931c7819dfbSPeter Maydell unsigned int st_uid; 1932c7819dfbSPeter Maydell unsigned int st_gid; 1933c7819dfbSPeter Maydell uint64_t st_rdev; 1934c7819dfbSPeter Maydell uint64_t __pad1; 1935c7819dfbSPeter Maydell int64_t st_size; 1936c7819dfbSPeter Maydell int st_blksize; 1937c7819dfbSPeter Maydell int __pad2; 1938c7819dfbSPeter Maydell int64_t st_blocks; 1939c7819dfbSPeter Maydell int target_st_atime; 1940c7819dfbSPeter Maydell unsigned int target_st_atime_nsec; 1941c7819dfbSPeter Maydell int target_st_mtime; 1942c7819dfbSPeter Maydell unsigned int target_st_mtime_nsec; 1943c7819dfbSPeter Maydell int target_st_ctime; 1944c7819dfbSPeter Maydell unsigned int target_st_ctime_nsec; 1945c7819dfbSPeter Maydell unsigned int __unused4; 1946c7819dfbSPeter Maydell unsigned int __unused5; 1947c7819dfbSPeter Maydell }; 1948c7819dfbSPeter Maydell 1949048f6b4dSbellard #else 1950048f6b4dSbellard #error unsupported CPU 1951048f6b4dSbellard #endif 19522521d698Sbellard 19534ce6f8deSths typedef struct { 19544ce6f8deSths int val[2]; 1955c227f099SAnthony Liguori } target_fsid_t; 19564ce6f8deSths 195756c8f68fSbellard #ifdef TARGET_MIPS 1958d26bc211Sths #ifdef TARGET_ABI_MIPSN32 1959540635baSths struct target_statfs { 1960540635baSths int32_t f_type; 1961540635baSths int32_t f_bsize; 1962540635baSths int32_t f_frsize; /* Fragment size - unsupported */ 1963540635baSths int32_t f_blocks; 1964540635baSths int32_t f_bfree; 1965540635baSths int32_t f_files; 1966540635baSths int32_t f_ffree; 1967540635baSths int32_t f_bavail; 1968540635baSths 1969540635baSths /* Linux specials */ 1970c227f099SAnthony Liguori target_fsid_t f_fsid; 1971540635baSths int32_t f_namelen; 1972540635baSths int32_t f_spare[6]; 1973540635baSths }; 1974540635baSths #else 197556c8f68fSbellard struct target_statfs { 1976992f48a0Sblueswir1 abi_long f_type; 1977992f48a0Sblueswir1 abi_long f_bsize; 1978992f48a0Sblueswir1 abi_long f_frsize; /* Fragment size - unsupported */ 1979992f48a0Sblueswir1 abi_long f_blocks; 1980992f48a0Sblueswir1 abi_long f_bfree; 1981992f48a0Sblueswir1 abi_long f_files; 1982992f48a0Sblueswir1 abi_long f_ffree; 1983992f48a0Sblueswir1 abi_long f_bavail; 198456c8f68fSbellard 198556c8f68fSbellard /* Linux specials */ 1986c227f099SAnthony Liguori target_fsid_t f_fsid; 1987992f48a0Sblueswir1 abi_long f_namelen; 1988992f48a0Sblueswir1 abi_long f_spare[6]; 198956c8f68fSbellard }; 1990540635baSths #endif 199156c8f68fSbellard 199256c8f68fSbellard struct target_statfs64 { 199356c8f68fSbellard uint32_t f_type; 199456c8f68fSbellard uint32_t f_bsize; 199556c8f68fSbellard uint32_t f_frsize; /* Fragment size - unsupported */ 199656c8f68fSbellard uint32_t __pad; 199756c8f68fSbellard uint64_t f_blocks; 199856c8f68fSbellard uint64_t f_bfree; 199956c8f68fSbellard uint64_t f_files; 200056c8f68fSbellard uint64_t f_ffree; 200156c8f68fSbellard uint64_t f_bavail; 2002c227f099SAnthony Liguori target_fsid_t f_fsid; 200356c8f68fSbellard uint32_t f_namelen; 200456c8f68fSbellard uint32_t f_spare[6]; 200556c8f68fSbellard }; 2006c4d10628Sbalrog #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ 200709701199SAlexander Graf defined(TARGET_SPARC64) || defined(TARGET_AARCH64)) && \ 200809701199SAlexander Graf !defined(TARGET_ABI32) 2009325e651fSj_mayer struct target_statfs { 2010325e651fSj_mayer abi_long f_type; 2011325e651fSj_mayer abi_long f_bsize; 2012325e651fSj_mayer abi_long f_blocks; 2013325e651fSj_mayer abi_long f_bfree; 2014325e651fSj_mayer abi_long f_bavail; 2015325e651fSj_mayer abi_long f_files; 2016325e651fSj_mayer abi_long f_ffree; 2017c227f099SAnthony Liguori target_fsid_t f_fsid; 2018325e651fSj_mayer abi_long f_namelen; 2019325e651fSj_mayer abi_long f_frsize; 2020325e651fSj_mayer abi_long f_spare[5]; 2021325e651fSj_mayer }; 2022325e651fSj_mayer 2023325e651fSj_mayer struct target_statfs64 { 2024325e651fSj_mayer abi_long f_type; 2025325e651fSj_mayer abi_long f_bsize; 2026325e651fSj_mayer abi_long f_blocks; 2027325e651fSj_mayer abi_long f_bfree; 2028325e651fSj_mayer abi_long f_bavail; 2029325e651fSj_mayer abi_long f_files; 2030325e651fSj_mayer abi_long f_ffree; 2031c227f099SAnthony Liguori target_fsid_t f_fsid; 2032325e651fSj_mayer abi_long f_namelen; 2033325e651fSj_mayer abi_long f_frsize; 2034325e651fSj_mayer abi_long f_spare[5]; 2035325e651fSj_mayer }; 2036a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 2037a4c075f1SUlrich Hecht struct target_statfs { 2038a4c075f1SUlrich Hecht int32_t f_type; 2039a4c075f1SUlrich Hecht int32_t f_bsize; 2040a4c075f1SUlrich Hecht abi_long f_blocks; 2041a4c075f1SUlrich Hecht abi_long f_bfree; 2042a4c075f1SUlrich Hecht abi_long f_bavail; 2043a4c075f1SUlrich Hecht abi_long f_files; 2044a4c075f1SUlrich Hecht abi_long f_ffree; 2045a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2046a4c075f1SUlrich Hecht int32_t f_namelen; 2047a4c075f1SUlrich Hecht int32_t f_frsize; 2048a4c075f1SUlrich Hecht int32_t f_spare[5]; 2049a4c075f1SUlrich Hecht }; 2050a4c075f1SUlrich Hecht 2051a4c075f1SUlrich Hecht struct target_statfs64 { 2052a4c075f1SUlrich Hecht int32_t f_type; 2053a4c075f1SUlrich Hecht int32_t f_bsize; 2054a4c075f1SUlrich Hecht abi_long f_blocks; 2055a4c075f1SUlrich Hecht abi_long f_bfree; 2056a4c075f1SUlrich Hecht abi_long f_bavail; 2057a4c075f1SUlrich Hecht abi_long f_files; 2058a4c075f1SUlrich Hecht abi_long f_ffree; 2059a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2060a4c075f1SUlrich Hecht int32_t f_namelen; 2061a4c075f1SUlrich Hecht int32_t f_frsize; 2062a4c075f1SUlrich Hecht int32_t f_spare[5]; 2063a4c075f1SUlrich Hecht }; 206456c8f68fSbellard #else 206556c8f68fSbellard struct target_statfs { 206656c8f68fSbellard uint32_t f_type; 206756c8f68fSbellard uint32_t f_bsize; 206856c8f68fSbellard uint32_t f_blocks; 206956c8f68fSbellard uint32_t f_bfree; 207056c8f68fSbellard uint32_t f_bavail; 207156c8f68fSbellard uint32_t f_files; 207256c8f68fSbellard uint32_t f_ffree; 2073c227f099SAnthony Liguori target_fsid_t f_fsid; 207456c8f68fSbellard uint32_t f_namelen; 207556c8f68fSbellard uint32_t f_frsize; 207656c8f68fSbellard uint32_t f_spare[5]; 207756c8f68fSbellard }; 207856c8f68fSbellard 207956c8f68fSbellard struct target_statfs64 { 208056c8f68fSbellard uint32_t f_type; 208156c8f68fSbellard uint32_t f_bsize; 208256c8f68fSbellard uint64_t f_blocks; 208356c8f68fSbellard uint64_t f_bfree; 208456c8f68fSbellard uint64_t f_bavail; 208556c8f68fSbellard uint64_t f_files; 208656c8f68fSbellard uint64_t f_ffree; 2087c227f099SAnthony Liguori target_fsid_t f_fsid; 208856c8f68fSbellard uint32_t f_namelen; 208956c8f68fSbellard uint32_t f_frsize; 209056c8f68fSbellard uint32_t f_spare[5]; 209156c8f68fSbellard }; 209256c8f68fSbellard #endif 209356c8f68fSbellard 209456c8f68fSbellard 20952521d698Sbellard #define TARGET_F_DUPFD 0 /* dup */ 20962521d698Sbellard #define TARGET_F_GETFD 1 /* get close_on_exec */ 20972521d698Sbellard #define TARGET_F_SETFD 2 /* set/clear close_on_exec */ 20982521d698Sbellard #define TARGET_F_GETFL 3 /* get file->f_flags */ 20992521d698Sbellard #define TARGET_F_SETFL 4 /* set file->f_flags */ 21002521d698Sbellard 21012521d698Sbellard #if defined(TARGET_ALPHA) 21022521d698Sbellard #define TARGET_F_GETLK 7 21032521d698Sbellard #define TARGET_F_SETLK 8 21042521d698Sbellard #define TARGET_F_SETLKW 9 21052521d698Sbellard #define TARGET_F_SETOWN 5 /* for sockets. */ 21062521d698Sbellard #define TARGET_F_GETOWN 6 /* for sockets. */ 21072ba7f730SLaurent Vivier 21082ba7f730SLaurent Vivier #define TARGET_F_RDLCK 1 21092ba7f730SLaurent Vivier #define TARGET_F_WRLCK 2 21102ba7f730SLaurent Vivier #define TARGET_F_UNLCK 8 21112ba7f730SLaurent Vivier #define TARGET_F_EXLCK 16 21122ba7f730SLaurent Vivier #define TARGET_F_SHLCK 32 21135f106811SArnaud Patard (Rtp) #elif defined(TARGET_MIPS) 21145f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK 14 21155f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK 6 21165f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW 7 21175f106811SArnaud Patard (Rtp) #define TARGET_F_SETOWN 24 /* for sockets. */ 21185f106811SArnaud Patard (Rtp) #define TARGET_F_GETOWN 25 /* for sockets. */ 21192521d698Sbellard #else 21202521d698Sbellard #define TARGET_F_GETLK 5 21212521d698Sbellard #define TARGET_F_SETLK 6 21222521d698Sbellard #define TARGET_F_SETLKW 7 21232521d698Sbellard #define TARGET_F_SETOWN 8 /* for sockets. */ 21242521d698Sbellard #define TARGET_F_GETOWN 9 /* for sockets. */ 21252521d698Sbellard #endif 21262521d698Sbellard 21272ba7f730SLaurent Vivier #ifndef TARGET_F_RDLCK 21282ba7f730SLaurent Vivier #define TARGET_F_RDLCK 0 21292ba7f730SLaurent Vivier #define TARGET_F_WRLCK 1 21302ba7f730SLaurent Vivier #define TARGET_F_UNLCK 2 21312ba7f730SLaurent Vivier #endif 21322ba7f730SLaurent Vivier 21332ba7f730SLaurent Vivier #ifndef TARGET_F_EXLCK 21342ba7f730SLaurent Vivier #define TARGET_F_EXLCK 4 21352ba7f730SLaurent Vivier #define TARGET_F_SHLCK 8 21362ba7f730SLaurent Vivier #endif 21372ba7f730SLaurent Vivier 21382ba7f730SLaurent Vivier 21392521d698Sbellard #define TARGET_F_SETSIG 10 /* for sockets. */ 21402521d698Sbellard #define TARGET_F_GETSIG 11 /* for sockets. */ 21412521d698Sbellard 21425f106811SArnaud Patard (Rtp) #if defined(TARGET_MIPS) 21435f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK64 33 /* using 'struct flock64' */ 21445f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK64 34 21455f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW64 35 21465f106811SArnaud Patard (Rtp) #else 21472521d698Sbellard #define TARGET_F_GETLK64 12 /* using 'struct flock64' */ 21482521d698Sbellard #define TARGET_F_SETLK64 13 21492521d698Sbellard #define TARGET_F_SETLKW64 14 21505f106811SArnaud Patard (Rtp) #endif 21517e22e546SUlrich Hecht 21527e22e546SUlrich Hecht #define TARGET_F_LINUX_SPECIFIC_BASE 1024 21537e22e546SUlrich Hecht #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0) 21547e22e546SUlrich Hecht #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1) 21557e22e546SUlrich Hecht #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) 21567e22e546SUlrich Hecht #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2) 21577e22e546SUlrich Hecht 21584eeea4f3SRichard Henderson #if defined(TARGET_ALPHA) 21594eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK 04 21604eeea4f3SRichard Henderson #define TARGET_O_APPEND 010 21614eeea4f3SRichard Henderson #define TARGET_O_CREAT 01000 /* not fcntl */ 21624eeea4f3SRichard Henderson #define TARGET_O_TRUNC 02000 /* not fcntl */ 21634eeea4f3SRichard Henderson #define TARGET_O_EXCL 04000 /* not fcntl */ 21644eeea4f3SRichard Henderson #define TARGET_O_NOCTTY 010000 /* not fcntl */ 21654eeea4f3SRichard Henderson #define TARGET_O_DSYNC 040000 21664eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0 /* not necessary, always 64-bit */ 21674eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY 0100000 /* must be a directory */ 21684eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW 0200000 /* don't follow links */ 21694eeea4f3SRichard Henderson #define TARGET_O_DIRECT 02000000 /* direct disk access hint */ 21704eeea4f3SRichard Henderson #define TARGET_O_NOATIME 04000000 21714eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 010000000 21724eeea4f3SRichard Henderson #define TARGET___O_SYNC 020000000 21734eeea4f3SRichard Henderson #define TARGET_O_PATH 040000000 21744eeea4f3SRichard Henderson #elif defined(TARGET_ARM) || defined(TARGET_M68K) 2175f09936acSbellard #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 2176f09936acSbellard #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 2177f09936acSbellard #define TARGET_O_DIRECT 0200000 /* direct disk access hint */ 2178f09936acSbellard #define TARGET_O_LARGEFILE 0400000 2179048f6b4dSbellard #elif defined(TARGET_MIPS) 2180048f6b4dSbellard #define TARGET_O_APPEND 0x0008 21814eeea4f3SRichard Henderson #define TARGET_O_DSYNC 0x0010 2182048f6b4dSbellard #define TARGET_O_NONBLOCK 0x0080 2183048f6b4dSbellard #define TARGET_O_CREAT 0x0100 /* not fcntl */ 2184048f6b4dSbellard #define TARGET_O_TRUNC 0x0200 /* not fcntl */ 2185048f6b4dSbellard #define TARGET_O_EXCL 0x0400 /* not fcntl */ 2186048f6b4dSbellard #define TARGET_O_NOCTTY 0x0800 /* not fcntl */ 2187048f6b4dSbellard #define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */ 2188048f6b4dSbellard #define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */ 21894eeea4f3SRichard Henderson #define TARGET___O_SYNC 0x4000 2190048f6b4dSbellard #define TARGET_O_DIRECT 0x8000 /* direct disk access hint */ 21914eeea4f3SRichard Henderson #elif defined (TARGET_PPC) 21924eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 21934eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 21944eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0200000 21954eeea4f3SRichard Henderson #define TARGET_O_DIRECT 0400000 /* direct disk access hint */ 21964eeea4f3SRichard Henderson #elif defined (TARGET_SPARC) 21971f961124Saurel32 #define TARGET_O_APPEND 0x0008 21984eeea4f3SRichard Henderson #define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */ 21991f961124Saurel32 #define TARGET_O_CREAT 0x0200 /* not fcntl */ 22001f961124Saurel32 #define TARGET_O_TRUNC 0x0400 /* not fcntl */ 22011f961124Saurel32 #define TARGET_O_EXCL 0x0800 /* not fcntl */ 22024eeea4f3SRichard Henderson #define TARGET_O_DSYNC 0x2000 22034eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK 0x4000 22044eeea4f3SRichard Henderson # ifdef TARGET_SPARC64 22054eeea4f3SRichard Henderson # define TARGET_O_NDELAY 0x0004 2206ffa65c3bSbellard # else 22074eeea4f3SRichard Henderson # define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK) 22084eeea4f3SRichard Henderson # endif 22094eeea4f3SRichard Henderson #define TARGET_O_NOCTTY 0x8000 /* not fcntl */ 22104eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0x40000 22114eeea4f3SRichard Henderson #define TARGET_O_DIRECT 0x100000 /* direct disk access hint */ 22124eeea4f3SRichard Henderson #define TARGET_O_NOATIME 0x200000 22134eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 0x400000 22144eeea4f3SRichard Henderson #define TARGET___O_SYNC 0x800000 22154eeea4f3SRichard Henderson #define TARGET_O_PATH 0x1000000 22164eeea4f3SRichard Henderson #endif 22174eeea4f3SRichard Henderson 22184eeea4f3SRichard Henderson /* <asm-generic/fcntl.h> values follow. */ 2219ffa65c3bSbellard #define TARGET_O_ACCMODE 0003 2220ffa65c3bSbellard #define TARGET_O_RDONLY 00 2221ffa65c3bSbellard #define TARGET_O_WRONLY 01 2222ffa65c3bSbellard #define TARGET_O_RDWR 02 22234eeea4f3SRichard Henderson #ifndef TARGET_O_CREAT 2224ffa65c3bSbellard #define TARGET_O_CREAT 0100 /* not fcntl */ 22254eeea4f3SRichard Henderson #endif 22264eeea4f3SRichard Henderson #ifndef TARGET_O_EXCL 2227ffa65c3bSbellard #define TARGET_O_EXCL 0200 /* not fcntl */ 22284eeea4f3SRichard Henderson #endif 22294eeea4f3SRichard Henderson #ifndef TARGET_O_NOCTTY 2230ffa65c3bSbellard #define TARGET_O_NOCTTY 0400 /* not fcntl */ 22314eeea4f3SRichard Henderson #endif 22324eeea4f3SRichard Henderson #ifndef TARGET_O_TRUNC 2233ffa65c3bSbellard #define TARGET_O_TRUNC 01000 /* not fcntl */ 22344eeea4f3SRichard Henderson #endif 22354eeea4f3SRichard Henderson #ifndef TARGET_O_APPEND 2236ffa65c3bSbellard #define TARGET_O_APPEND 02000 22374eeea4f3SRichard Henderson #endif 22384eeea4f3SRichard Henderson #ifndef TARGET_O_NONBLOCK 2239ffa65c3bSbellard #define TARGET_O_NONBLOCK 04000 22404eeea4f3SRichard Henderson #endif 22414eeea4f3SRichard Henderson #ifndef TARGET_O_DSYNC 22424eeea4f3SRichard Henderson #define TARGET_O_DSYNC 010000 22434eeea4f3SRichard Henderson #endif 22444eeea4f3SRichard Henderson #ifndef TARGET_FASYNC 2245ffa65c3bSbellard #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ 22464eeea4f3SRichard Henderson #endif 22474eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECT 2248ffa65c3bSbellard #define TARGET_O_DIRECT 040000 /* direct disk access hint */ 22494eeea4f3SRichard Henderson #endif 22504eeea4f3SRichard Henderson #ifndef TARGET_O_LARGEFILE 2251ffa65c3bSbellard #define TARGET_O_LARGEFILE 0100000 22524eeea4f3SRichard Henderson #endif 22534eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECTORY 2254ffa65c3bSbellard #define TARGET_O_DIRECTORY 0200000 /* must be a directory */ 22554eeea4f3SRichard Henderson #endif 22564eeea4f3SRichard Henderson #ifndef TARGET_O_NOFOLLOW 2257ffa65c3bSbellard #define TARGET_O_NOFOLLOW 0400000 /* don't follow links */ 2258ffa65c3bSbellard #endif 22594eeea4f3SRichard Henderson #ifndef TARGET_O_NOATIME 22604eeea4f3SRichard Henderson #define TARGET_O_NOATIME 01000000 22614eeea4f3SRichard Henderson #endif 22624eeea4f3SRichard Henderson #ifndef TARGET_O_CLOEXEC 22634eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 02000000 22644eeea4f3SRichard Henderson #endif 22654eeea4f3SRichard Henderson #ifndef TARGET___O_SYNC 22664eeea4f3SRichard Henderson #define TARGET___O_SYNC 04000000 22674eeea4f3SRichard Henderson #endif 22684eeea4f3SRichard Henderson #ifndef TARGET_O_PATH 22694eeea4f3SRichard Henderson #define TARGET_O_PATH 010000000 22704eeea4f3SRichard Henderson #endif 22714eeea4f3SRichard Henderson #ifndef TARGET_O_NDELAY 22724eeea4f3SRichard Henderson #define TARGET_O_NDELAY TARGET_O_NONBLOCK 22734eeea4f3SRichard Henderson #endif 22744eeea4f3SRichard Henderson #ifndef TARGET_O_SYNC 22754eeea4f3SRichard Henderson #define TARGET_O_SYNC (TARGET___O_SYNC | TARGET_O_DSYNC) 22764eeea4f3SRichard Henderson #endif 2277ffa65c3bSbellard 22782521d698Sbellard struct target_flock { 22792521d698Sbellard short l_type; 22802521d698Sbellard short l_whence; 2281992f48a0Sblueswir1 abi_ulong l_start; 2282992f48a0Sblueswir1 abi_ulong l_len; 22832521d698Sbellard int l_pid; 22842521d698Sbellard }; 22852521d698Sbellard 22862521d698Sbellard struct target_flock64 { 22872521d698Sbellard short l_type; 22882521d698Sbellard short l_whence; 2289b779e29eSEdgar E. Iglesias #if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) || defined(TARGET_SPARC) || defined(TARGET_HPPA) || defined (TARGET_MICROBLAZE) 2290ce3f0e2fSaurel32 int __pad; 2291ce3f0e2fSaurel32 #endif 22922521d698Sbellard unsigned long long l_start; 22932521d698Sbellard unsigned long long l_len; 22942521d698Sbellard int l_pid; 2295541dc0d4SStefan Weil } QEMU_PACKED; 22962521d698Sbellard 2297ce4defa0Spbrook #ifdef TARGET_ARM 2298ce4defa0Spbrook struct target_eabi_flock64 { 2299ce4defa0Spbrook short l_type; 2300ce4defa0Spbrook short l_whence; 2301ce4defa0Spbrook int __pad; 2302ce4defa0Spbrook unsigned long long l_start; 2303ce4defa0Spbrook unsigned long long l_len; 2304ce4defa0Spbrook int l_pid; 2305541dc0d4SStefan Weil } QEMU_PACKED; 2306ce4defa0Spbrook #endif 23072521d698Sbellard 23082521d698Sbellard /* soundcard defines */ 23092521d698Sbellard /* XXX: convert them all to arch indepedent entries */ 23102521d698Sbellard #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); 23112521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 23122521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 23132521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 23142521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA 0xc0144302 23152521d698Sbellard #define TARGET_SNDCTL_COPR_RESET 0x00004300 23162521d698Sbellard #define TARGET_SNDCTL_COPR_RUN 0xc0144306 23172521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 23182521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE 0x40144305 23192521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA 0x40144304 23202521d698Sbellard #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) 23212521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) 23222521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) 23232521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) 23242521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) 23252521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) 23262521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) 23272521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) 23282521d698Sbellard #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) 23292521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) 23302521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) 23312521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) 23322521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) 23332521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) 23342521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) 23352521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) 23362521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) 23372521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) 23385f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19) 23395f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20) 23402521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e 23412521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 23422521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 23432521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 23442521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 23452521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f 23462521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 23472521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO 0xc074510c 23482521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 23492521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 23502521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 23512521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 23522521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 23532521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 23542521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 23552521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 23562521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b 23572521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a 23582521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 23592521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC 0x00005111 23602521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 23612521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET 0x00005100 23622521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 23632521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC 0x00005101 23642521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 23652521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d 23662521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d 23672521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 23682521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e 23692521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 23702521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME 0x40045407 23712521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT 0x40045408 23722521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 23732521d698Sbellard #define TARGET_SNDCTL_TMR_START 0x00005402 23742521d698Sbellard #define TARGET_SNDCTL_TMR_STOP 0x00005403 23752521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 23762521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 23772521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE 0x80045002 23782521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 23792521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS 0x80045005 23802521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 23812521d698Sbellard #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) 23822521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 23832521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) 23842521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) 23852521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) 23862521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) 23872521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) 23882521d698Sbellard 23892521d698Sbellard #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) 23902521d698Sbellard 23912521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) 23922521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) 23932521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) 23942521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) 23952521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) 23962521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) 23972521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) 23982521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) 23992521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) 24002521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) 24012521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) 24022521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) 24032521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) 24042521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) 24052521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) 24062521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) 24072521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) 24082521d698Sbellard 24092521d698Sbellard /* Obsolete macros */ 24102521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) 24112521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) 24122521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) 24132521d698Sbellard 24142521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) 24152521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) 24162521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) 24172521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) 24182521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) 24192521d698Sbellard 24202521d698Sbellard #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) 24212521d698Sbellard 24222521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) 24232521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) 24242521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) 24252521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) 24262521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) 24272521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) 24282521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) 24292521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) 24302521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) 24312521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) 24322521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) 24332521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) 24342521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) 24352521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) 24362521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) 24372521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) 24382521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) 24392521d698Sbellard 24402521d698Sbellard /* Obsolete macros */ 24412521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) 24422521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) 24432521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) 24442521d698Sbellard 24452521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) 24462521d698Sbellard 24472521d698Sbellard /* vfat ioctls */ 24482521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) 24492521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) 2450a5448a7dSbellard 24518fbd6b52Sbalrog #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct mtop) 24528fbd6b52Sbalrog #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct mtget) 24538fbd6b52Sbalrog #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct mtpos) 24548fbd6b52Sbalrog 2455a5448a7dSbellard struct target_sysinfo { 2456992f48a0Sblueswir1 abi_long uptime; /* Seconds since boot */ 2457992f48a0Sblueswir1 abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */ 2458992f48a0Sblueswir1 abi_ulong totalram; /* Total usable main memory size */ 2459992f48a0Sblueswir1 abi_ulong freeram; /* Available memory size */ 2460992f48a0Sblueswir1 abi_ulong sharedram; /* Amount of shared memory */ 2461992f48a0Sblueswir1 abi_ulong bufferram; /* Memory used by buffers */ 2462992f48a0Sblueswir1 abi_ulong totalswap; /* Total swap space size */ 2463992f48a0Sblueswir1 abi_ulong freeswap; /* swap space still available */ 2464a5448a7dSbellard unsigned short procs; /* Number of current processes */ 2465a5448a7dSbellard unsigned short pad; /* explicit padding for m68k */ 2466992f48a0Sblueswir1 abi_ulong totalhigh; /* Total high memory size */ 2467992f48a0Sblueswir1 abi_ulong freehigh; /* Available high memory size */ 2468a5448a7dSbellard unsigned int mem_unit; /* Memory unit size in bytes */ 2469992f48a0Sblueswir1 char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 2470a5448a7dSbellard }; 24713532fa74Sbellard 24726556a833Saurel32 struct linux_dirent { 24736556a833Saurel32 long d_ino; 24746556a833Saurel32 unsigned long d_off; 24756556a833Saurel32 unsigned short d_reclen; 24766556a833Saurel32 char d_name[256]; /* We must not include limits.h! */ 24776556a833Saurel32 }; 24786556a833Saurel32 24796556a833Saurel32 struct linux_dirent64 { 24806556a833Saurel32 uint64_t d_ino; 24816556a833Saurel32 int64_t d_off; 24826556a833Saurel32 unsigned short d_reclen; 24836556a833Saurel32 unsigned char d_type; 24846556a833Saurel32 char d_name[256]; 24856556a833Saurel32 }; 24866556a833Saurel32 248724e1003aSaurel32 struct target_mq_attr { 248824e1003aSaurel32 abi_long mq_flags; 248924e1003aSaurel32 abi_long mq_maxmsg; 249024e1003aSaurel32 abi_long mq_msgsize; 249124e1003aSaurel32 abi_long mq_curmsgs; 249224e1003aSaurel32 }; 249324e1003aSaurel32 24943532fa74Sbellard #include "socket.h" 2495637947f1Sths 2496637947f1Sths #include "errno_defs.h" 249703dfe9f8SRiku Voipio 249803dfe9f8SRiku Voipio #define FUTEX_WAIT 0 249903dfe9f8SRiku Voipio #define FUTEX_WAKE 1 250003dfe9f8SRiku Voipio #define FUTEX_FD 2 250103dfe9f8SRiku Voipio #define FUTEX_REQUEUE 3 250203dfe9f8SRiku Voipio #define FUTEX_CMP_REQUEUE 4 250303dfe9f8SRiku Voipio #define FUTEX_WAKE_OP 5 250403dfe9f8SRiku Voipio #define FUTEX_LOCK_PI 6 250503dfe9f8SRiku Voipio #define FUTEX_UNLOCK_PI 7 250603dfe9f8SRiku Voipio #define FUTEX_TRYLOCK_PI 8 250703dfe9f8SRiku Voipio #define FUTEX_WAIT_BITSET 9 250803dfe9f8SRiku Voipio #define FUTEX_WAKE_BITSET 10 250903dfe9f8SRiku Voipio 251003dfe9f8SRiku Voipio #define FUTEX_PRIVATE_FLAG 128 251103dfe9f8SRiku Voipio #define FUTEX_CLOCK_REALTIME 256 251203dfe9f8SRiku Voipio #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) 251303dfe9f8SRiku Voipio 25143b6edd16SPeter Maydell #ifdef CONFIG_EPOLL 25153b6edd16SPeter Maydell typedef union target_epoll_data { 25163b6edd16SPeter Maydell abi_ulong ptr; 25173b6edd16SPeter Maydell abi_ulong fd; 25183b6edd16SPeter Maydell uint32_t u32; 25193b6edd16SPeter Maydell uint64_t u64; 25203b6edd16SPeter Maydell } target_epoll_data_t; 25213b6edd16SPeter Maydell 25223b6edd16SPeter Maydell struct target_epoll_event { 25233b6edd16SPeter Maydell uint32_t events; 2524ddaa7e5aSAlexander Graf #ifdef TARGET_ARM 2525ddaa7e5aSAlexander Graf uint32_t __pad; 2526ddaa7e5aSAlexander Graf #endif 25273b6edd16SPeter Maydell target_epoll_data_t data; 2528ddaa7e5aSAlexander Graf } QEMU_PACKED; 25293b6edd16SPeter Maydell #endif 2530163a05a8SPeter Maydell struct target_rlimit64 { 2531163a05a8SPeter Maydell uint64_t rlim_cur; 2532163a05a8SPeter Maydell uint64_t rlim_max; 2533163a05a8SPeter Maydell }; 2534583359a6SAkos PASZTORY 2535583359a6SAkos PASZTORY struct target_ucred { 2536583359a6SAkos PASZTORY uint32_t pid; 2537583359a6SAkos PASZTORY uint32_t uid; 2538583359a6SAkos PASZTORY uint32_t gid; 2539583359a6SAkos PASZTORY }; 2540cb9c377fSPaolo Bonzini 2541cb9c377fSPaolo Bonzini #endif 2542905bba13SErik de Castro Lopo 2543905bba13SErik de Castro Lopo 2544905bba13SErik de Castro Lopo struct target_timer_t { 2545905bba13SErik de Castro Lopo abi_ulong ptr; 2546905bba13SErik de Castro Lopo }; 2547905bba13SErik de Castro Lopo 2548905bba13SErik de Castro Lopo struct target_sigevent { 2549905bba13SErik de Castro Lopo target_sigval_t sigev_value; 2550905bba13SErik de Castro Lopo int32_t sigev_signo; 2551905bba13SErik de Castro Lopo int32_t sigev_notify; 2552905bba13SErik de Castro Lopo union { 2553905bba13SErik de Castro Lopo int32_t _pad[ARRAY_SIZE(((struct sigevent *)0)->_sigev_un._pad)]; 2554905bba13SErik de Castro Lopo int32_t _tid; 2555905bba13SErik de Castro Lopo 2556905bba13SErik de Castro Lopo struct { 2557905bba13SErik de Castro Lopo void (*_function)(sigval_t); 2558905bba13SErik de Castro Lopo void *_attribute; 2559905bba13SErik de Castro Lopo } _sigev_thread; 2560905bba13SErik de Castro Lopo } _sigev_un; 2561905bba13SErik de Castro Lopo }; 2562