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) \ 67*b16189b2SChen Gang || defined(TARGET_M68K) || defined(TARGET_CRIS) \ 68*b16189b2SChen Gang || defined(TARGET_UNICORE32) || defined(TARGET_S390X) \ 69*b16189b2SChen Gang || defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) 702521d698Sbellard 712521d698Sbellard #define TARGET_IOC_SIZEBITS 14 722521d698Sbellard #define TARGET_IOC_DIRBITS 2 732521d698Sbellard 742521d698Sbellard #define TARGET_IOC_NONE 0U 752521d698Sbellard #define TARGET_IOC_WRITE 1U 762521d698Sbellard #define TARGET_IOC_READ 2U 772521d698Sbellard 78048f6b4dSbellard #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ 79b779e29eSEdgar E. Iglesias defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \ 80b779e29eSEdgar E. Iglesias defined(TARGET_MIPS) 812521d698Sbellard 822521d698Sbellard #define TARGET_IOC_SIZEBITS 13 832521d698Sbellard #define TARGET_IOC_DIRBITS 3 842521d698Sbellard 852521d698Sbellard #define TARGET_IOC_NONE 1U 862521d698Sbellard #define TARGET_IOC_READ 2U 872521d698Sbellard #define TARGET_IOC_WRITE 4U 882521d698Sbellard 892521d698Sbellard #else 902521d698Sbellard #error unsupported CPU 912521d698Sbellard #endif 922521d698Sbellard 932521d698Sbellard #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) 942521d698Sbellard #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) 952521d698Sbellard #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) 962521d698Sbellard #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) 972521d698Sbellard 982521d698Sbellard #define TARGET_IOC_NRSHIFT 0 992521d698Sbellard #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) 1002521d698Sbellard #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) 1012521d698Sbellard #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) 1022521d698Sbellard 1032521d698Sbellard #define TARGET_IOC(dir,type,nr,size) \ 1042521d698Sbellard (((dir) << TARGET_IOC_DIRSHIFT) | \ 1052521d698Sbellard ((type) << TARGET_IOC_TYPESHIFT) | \ 1062521d698Sbellard ((nr) << TARGET_IOC_NRSHIFT) | \ 1072521d698Sbellard ((size) << TARGET_IOC_SIZESHIFT)) 1082521d698Sbellard 1092521d698Sbellard /* used to create numbers */ 1102521d698Sbellard #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) 1112521d698Sbellard #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) 1122521d698Sbellard #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1132521d698Sbellard #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1142521d698Sbellard 1152521d698Sbellard /* the size is automatically computed for these defines */ 1162521d698Sbellard #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) 1172521d698Sbellard #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1182521d698Sbellard #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1192521d698Sbellard 1207854b056Sbellard struct target_sockaddr { 1217854b056Sbellard uint16_t sa_family; 1227854b056Sbellard uint8_t sa_data[14]; 1237854b056Sbellard }; 1247854b056Sbellard 12533a29b51SJoakim Tjernlund struct target_sockaddr_ll { 12633a29b51SJoakim Tjernlund uint16_t sll_family; /* Always AF_PACKET */ 12733a29b51SJoakim Tjernlund uint16_t sll_protocol; /* Physical layer protocol */ 12833a29b51SJoakim Tjernlund int sll_ifindex; /* Interface number */ 12933a29b51SJoakim Tjernlund uint16_t sll_hatype; /* ARP hardware type */ 13033a29b51SJoakim Tjernlund uint8_t sll_pkttype; /* Packet type */ 13133a29b51SJoakim Tjernlund uint8_t sll_halen; /* Length of address */ 13233a29b51SJoakim Tjernlund uint8_t sll_addr[8]; /* Physical layer address */ 13333a29b51SJoakim Tjernlund }; 13433a29b51SJoakim Tjernlund 135f57d4192SLaurent Vivier struct target_sock_filter { 136f57d4192SLaurent Vivier abi_ushort code; 137f57d4192SLaurent Vivier uint8_t jt; 138f57d4192SLaurent Vivier uint8_t jf; 139f57d4192SLaurent Vivier abi_uint k; 140f57d4192SLaurent Vivier }; 141f57d4192SLaurent Vivier 142f57d4192SLaurent Vivier struct target_sock_fprog { 143f57d4192SLaurent Vivier abi_ushort len; 144f57d4192SLaurent Vivier abi_ulong filter; 145f57d4192SLaurent Vivier }; 146f57d4192SLaurent Vivier 147b975b83bSLionel Landwerlin struct target_in_addr { 148b975b83bSLionel Landwerlin uint32_t s_addr; /* big endian */ 149b975b83bSLionel Landwerlin }; 150b975b83bSLionel Landwerlin 151b975b83bSLionel Landwerlin struct target_ip_mreq { 152b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 153b975b83bSLionel Landwerlin struct target_in_addr imr_address; 154b975b83bSLionel Landwerlin }; 155b975b83bSLionel Landwerlin 156b975b83bSLionel Landwerlin struct target_ip_mreqn { 157b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 158b975b83bSLionel Landwerlin struct target_in_addr imr_address; 159b975b83bSLionel Landwerlin abi_long imr_ifindex; 160b975b83bSLionel Landwerlin }; 161b975b83bSLionel Landwerlin 1626e3cb58fSLionel Landwerlin struct target_ip_mreq_source { 1636e3cb58fSLionel Landwerlin /* big endian */ 1646e3cb58fSLionel Landwerlin uint32_t imr_multiaddr; 1656e3cb58fSLionel Landwerlin uint32_t imr_interface; 1666e3cb58fSLionel Landwerlin uint32_t imr_sourceaddr; 1676e3cb58fSLionel Landwerlin }; 1686e3cb58fSLionel Landwerlin 16931e31b8aSbellard struct target_timeval { 170992f48a0Sblueswir1 abi_long tv_sec; 171992f48a0Sblueswir1 abi_long tv_usec; 17231e31b8aSbellard }; 17331e31b8aSbellard 1741b6b029eSbellard struct target_timespec { 175992f48a0Sblueswir1 abi_long tv_sec; 176992f48a0Sblueswir1 abi_long tv_nsec; 1771b6b029eSbellard }; 1781b6b029eSbellard 179ef4467e9SPaul Burton struct target_timezone { 180ef4467e9SPaul Burton abi_int tz_minuteswest; 181ef4467e9SPaul Burton abi_int tz_dsttime; 182ef4467e9SPaul Burton }; 183ef4467e9SPaul Burton 18466fb9763Sbellard struct target_itimerval { 18566fb9763Sbellard struct target_timeval it_interval; 18666fb9763Sbellard struct target_timeval it_value; 18766fb9763Sbellard }; 18866fb9763Sbellard 189905bba13SErik de Castro Lopo struct target_itimerspec { 190905bba13SErik de Castro Lopo struct target_timespec it_interval; 191905bba13SErik de Castro Lopo struct target_timespec it_value; 192905bba13SErik de Castro Lopo }; 193905bba13SErik de Castro Lopo 194c227f099SAnthony Liguori typedef abi_long target_clock_t; 19532f36bceSbellard 196c596ed17Sbellard #define TARGET_HZ 100 197c596ed17Sbellard 19832f36bceSbellard struct target_tms { 199c227f099SAnthony Liguori target_clock_t tms_utime; 200c227f099SAnthony Liguori target_clock_t tms_stime; 201c227f099SAnthony Liguori target_clock_t tms_cutime; 202c227f099SAnthony Liguori target_clock_t tms_cstime; 20332f36bceSbellard }; 20432f36bceSbellard 2056180a181Sbellard struct target_utimbuf { 206992f48a0Sblueswir1 abi_long actime; 207992f48a0Sblueswir1 abi_long modtime; 2086180a181Sbellard }; 2096180a181Sbellard 210f2674e31Sbellard struct target_sel_arg_struct { 211992f48a0Sblueswir1 abi_long n; 212992f48a0Sblueswir1 abi_long inp, outp, exp; 213992f48a0Sblueswir1 abi_long tvp; 214f2674e31Sbellard }; 215f2674e31Sbellard 21631e31b8aSbellard struct target_iovec { 217992f48a0Sblueswir1 abi_long iov_base; /* Starting address */ 218992f48a0Sblueswir1 abi_long iov_len; /* Number of bytes */ 21931e31b8aSbellard }; 22031e31b8aSbellard 2211a9353d2Sbellard struct target_msghdr { 222992f48a0Sblueswir1 abi_long msg_name; /* Socket name */ 2231a9353d2Sbellard int msg_namelen; /* Length of name */ 224992f48a0Sblueswir1 abi_long msg_iov; /* Data blocks */ 225992f48a0Sblueswir1 abi_long msg_iovlen; /* Number of blocks */ 226992f48a0Sblueswir1 abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ 227992f48a0Sblueswir1 abi_long msg_controllen; /* Length of cmsg list */ 2281a9353d2Sbellard unsigned int msg_flags; 2291a9353d2Sbellard }; 2301a9353d2Sbellard 2317854b056Sbellard struct target_cmsghdr { 232992f48a0Sblueswir1 abi_long cmsg_len; 2337854b056Sbellard int cmsg_level; 2347854b056Sbellard int cmsg_type; 2357854b056Sbellard }; 2367854b056Sbellard 2377854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) 2387854b056Sbellard #define TARGET_CMSG_NXTHDR(mhdr, cmsg) __target_cmsg_nxthdr (mhdr, cmsg) 239992f48a0Sblueswir1 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ 240992f48a0Sblueswir1 & (size_t) ~(sizeof (abi_long) - 1)) 2417854b056Sbellard #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \ 2427854b056Sbellard + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr))) 2437854b056Sbellard #define TARGET_CMSG_LEN(len) (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len)) 2447854b056Sbellard 2457854b056Sbellard static __inline__ struct target_cmsghdr * 2467854b056Sbellard __target_cmsg_nxthdr (struct target_msghdr *__mhdr, struct target_cmsghdr *__cmsg) 2477854b056Sbellard { 2482b8bdefcSths struct target_cmsghdr *__ptr; 2497854b056Sbellard 2502b8bdefcSths __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg 251cbb21eedSMatthias Braun + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len))); 252cbb21eedSMatthias Braun if ((unsigned long)((char *)(__ptr+1) - (char *)(size_t)tswapal(__mhdr->msg_control)) 253cbb21eedSMatthias Braun > tswapal(__mhdr->msg_controllen)) 2547854b056Sbellard /* No more entries. */ 2552b8bdefcSths return (struct target_cmsghdr *)0; 2567854b056Sbellard return __cmsg; 2577854b056Sbellard } 2587854b056Sbellard 259f19e00d7SAlexander Graf struct target_mmsghdr { 260f19e00d7SAlexander Graf struct target_msghdr msg_hdr; /* Message header */ 261f19e00d7SAlexander Graf unsigned int msg_len; /* Number of bytes transmitted */ 262f19e00d7SAlexander Graf }; 2637854b056Sbellard 26431e31b8aSbellard struct target_rusage { 26531e31b8aSbellard struct target_timeval ru_utime; /* user time used */ 26631e31b8aSbellard struct target_timeval ru_stime; /* system time used */ 267992f48a0Sblueswir1 abi_long ru_maxrss; /* maximum resident set size */ 268992f48a0Sblueswir1 abi_long ru_ixrss; /* integral shared memory size */ 269992f48a0Sblueswir1 abi_long ru_idrss; /* integral unshared data size */ 270992f48a0Sblueswir1 abi_long ru_isrss; /* integral unshared stack size */ 271992f48a0Sblueswir1 abi_long ru_minflt; /* page reclaims */ 272992f48a0Sblueswir1 abi_long ru_majflt; /* page faults */ 273992f48a0Sblueswir1 abi_long ru_nswap; /* swaps */ 274992f48a0Sblueswir1 abi_long ru_inblock; /* block input operations */ 275992f48a0Sblueswir1 abi_long ru_oublock; /* block output operations */ 276992f48a0Sblueswir1 abi_long ru_msgsnd; /* messages sent */ 277992f48a0Sblueswir1 abi_long ru_msgrcv; /* messages received */ 278992f48a0Sblueswir1 abi_long ru_nsignals; /* signals received */ 279992f48a0Sblueswir1 abi_long ru_nvcsw; /* voluntary context switches */ 280992f48a0Sblueswir1 abi_long ru_nivcsw; /* involuntary " */ 28131e31b8aSbellard }; 28231e31b8aSbellard 28331e31b8aSbellard typedef struct { 28431e31b8aSbellard int val[2]; 285c227f099SAnthony Liguori } kernel_fsid_t; 28631e31b8aSbellard 28772f03900Sbellard struct kernel_statfs { 28831e31b8aSbellard int f_type; 28931e31b8aSbellard int f_bsize; 29031e31b8aSbellard int f_blocks; 29131e31b8aSbellard int f_bfree; 29231e31b8aSbellard int f_bavail; 29331e31b8aSbellard int f_files; 29431e31b8aSbellard int f_ffree; 295c227f099SAnthony Liguori kernel_fsid_t f_fsid; 29631e31b8aSbellard int f_namelen; 29731e31b8aSbellard int f_spare[6]; 29831e31b8aSbellard }; 29931e31b8aSbellard 300dab2ed99Sbellard struct target_dirent { 301992f48a0Sblueswir1 abi_long d_ino; 302992f48a0Sblueswir1 abi_long d_off; 303dab2ed99Sbellard unsigned short d_reclen; 304333858b7SDmitry V. Levin char d_name[]; 305dab2ed99Sbellard }; 306dab2ed99Sbellard 307dab2ed99Sbellard struct target_dirent64 { 308dab2ed99Sbellard uint64_t d_ino; 309dab2ed99Sbellard int64_t d_off; 310dab2ed99Sbellard unsigned short d_reclen; 311dab2ed99Sbellard unsigned char d_type; 312dab2ed99Sbellard char d_name[256]; 313dab2ed99Sbellard }; 314dab2ed99Sbellard 315dab2ed99Sbellard 31631e31b8aSbellard /* mostly generic signal stuff */ 317992f48a0Sblueswir1 #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ 318992f48a0Sblueswir1 #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ 319992f48a0Sblueswir1 #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ 32031e31b8aSbellard 32131e31b8aSbellard #ifdef TARGET_MIPS 32231e31b8aSbellard #define TARGET_NSIG 128 32331e31b8aSbellard #else 32431e31b8aSbellard #define TARGET_NSIG 64 32531e31b8aSbellard #endif 326992f48a0Sblueswir1 #define TARGET_NSIG_BPW TARGET_ABI_BITS 32731e31b8aSbellard #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) 32831e31b8aSbellard 32931e31b8aSbellard typedef struct { 330992f48a0Sblueswir1 abi_ulong sig[TARGET_NSIG_WORDS]; 331c227f099SAnthony Liguori } target_sigset_t; 33231e31b8aSbellard 33366fb9763Sbellard #ifdef BSWAP_NEEDED 334c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 33566fb9763Sbellard { 33666fb9763Sbellard int i; 33766fb9763Sbellard for(i = 0;i < TARGET_NSIG_WORDS; i++) 338cbb21eedSMatthias Braun d->sig[i] = tswapal(s->sig[i]); 33966fb9763Sbellard } 34066fb9763Sbellard #else 341c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 34266fb9763Sbellard { 34366fb9763Sbellard *d = *s; 34466fb9763Sbellard } 34566fb9763Sbellard #endif 34666fb9763Sbellard 347c227f099SAnthony Liguori static inline void target_siginitset(target_sigset_t *d, abi_ulong set) 34866fb9763Sbellard { 34966fb9763Sbellard int i; 35066fb9763Sbellard d->sig[0] = set; 35166fb9763Sbellard for(i = 1;i < TARGET_NSIG_WORDS; i++) 35266fb9763Sbellard d->sig[i] = 0; 35366fb9763Sbellard } 35466fb9763Sbellard 355c227f099SAnthony Liguori void host_to_target_sigset(target_sigset_t *d, const sigset_t *s); 356c227f099SAnthony Liguori void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); 357992f48a0Sblueswir1 void host_to_target_old_sigset(abi_ulong *old_sigset, 35866fb9763Sbellard const sigset_t *sigset); 35966fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset, 360992f48a0Sblueswir1 const abi_ulong *old_sigset); 36166fb9763Sbellard struct target_sigaction; 36266fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act, 36366fb9763Sbellard struct target_sigaction *oact); 36466fb9763Sbellard 365d2fbca94SGuan Xuetao #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \ 366d2fbca94SGuan Xuetao || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined(TARGET_SH4) \ 367d2fbca94SGuan Xuetao || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) \ 368a4c075f1SUlrich Hecht || defined(TARGET_MICROBLAZE) || defined(TARGET_UNICORE32) \ 369*b16189b2SChen Gang || defined(TARGET_S390X) || defined(TARGET_OPENRISC) \ 370*b16189b2SChen Gang || defined(TARGET_TILEGX) 3712521d698Sbellard 372048f6b4dSbellard #if defined(TARGET_SPARC) 373048f6b4dSbellard #define TARGET_SA_NOCLDSTOP 8u 374048f6b4dSbellard #define TARGET_SA_NOCLDWAIT 0x100u 375048f6b4dSbellard #define TARGET_SA_SIGINFO 0x200u 376048f6b4dSbellard #define TARGET_SA_ONSTACK 1u 377048f6b4dSbellard #define TARGET_SA_RESTART 2u 378048f6b4dSbellard #define TARGET_SA_NODEFER 0x20u 379048f6b4dSbellard #define TARGET_SA_RESETHAND 4u 380048f6b4dSbellard #elif defined(TARGET_MIPS) 381048f6b4dSbellard #define TARGET_SA_NOCLDSTOP 0x00000001 382048f6b4dSbellard #define TARGET_SA_NOCLDWAIT 0x00010000 383048f6b4dSbellard #define TARGET_SA_SIGINFO 0x00000008 384048f6b4dSbellard #define TARGET_SA_ONSTACK 0x08000000 385048f6b4dSbellard #define TARGET_SA_NODEFER 0x40000000 386048f6b4dSbellard #define TARGET_SA_RESTART 0x10000000 387048f6b4dSbellard #define TARGET_SA_RESETHAND 0x80000000 388d26bc211Sths #if !defined(TARGET_ABI_MIPSN32) && !defined(TARGET_ABI_MIPSN64) 389d26bc211Sths #define TARGET_SA_RESTORER 0x04000000 /* Only for O32 */ 390540635baSths #endif 391d962783eSJia Liu #elif defined(TARGET_OPENRISC) 392d962783eSJia Liu #define TARGET_SA_NOCLDSTOP 0x00000001 393d962783eSJia Liu #define TARGET_SA_NOCLDWAIT 0x00000002 394d962783eSJia Liu #define TARGET_SA_SIGINFO 0x00000004 395d962783eSJia Liu #define TARGET_SA_ONSTACK 0x08000000 396d962783eSJia Liu #define TARGET_SA_RESTART 0x10000000 397d962783eSJia Liu #define TARGET_SA_NODEFER 0x40000000 398d962783eSJia Liu #define TARGET_SA_RESETHAND 0x80000000 39957f18a95SRichard Henderson #elif defined(TARGET_ALPHA) 40057f18a95SRichard Henderson #define TARGET_SA_ONSTACK 0x00000001 40157f18a95SRichard Henderson #define TARGET_SA_RESTART 0x00000002 40257f18a95SRichard Henderson #define TARGET_SA_NOCLDSTOP 0x00000004 40357f18a95SRichard Henderson #define TARGET_SA_NODEFER 0x00000008 40457f18a95SRichard Henderson #define TARGET_SA_RESETHAND 0x00000010 40557f18a95SRichard Henderson #define TARGET_SA_NOCLDWAIT 0x00000020 /* not supported yet */ 40657f18a95SRichard Henderson #define TARGET_SA_SIGINFO 0x00000040 407048f6b4dSbellard #else 4082521d698Sbellard #define TARGET_SA_NOCLDSTOP 0x00000001 4092521d698Sbellard #define TARGET_SA_NOCLDWAIT 0x00000002 /* not supported yet */ 4102521d698Sbellard #define TARGET_SA_SIGINFO 0x00000004 4112521d698Sbellard #define TARGET_SA_ONSTACK 0x08000000 4122521d698Sbellard #define TARGET_SA_RESTART 0x10000000 4132521d698Sbellard #define TARGET_SA_NODEFER 0x40000000 4142521d698Sbellard #define TARGET_SA_RESETHAND 0x80000000 4152521d698Sbellard #define TARGET_SA_RESTORER 0x04000000 4166d5e216dSbellard #endif 4176d5e216dSbellard 418d0f20495SRichard Henderson #if defined(TARGET_ALPHA) 419d0f20495SRichard Henderson 420d0f20495SRichard Henderson #define TARGET_SIGHUP 1 421d0f20495SRichard Henderson #define TARGET_SIGINT 2 422d0f20495SRichard Henderson #define TARGET_SIGQUIT 3 423d0f20495SRichard Henderson #define TARGET_SIGILL 4 424d0f20495SRichard Henderson #define TARGET_SIGTRAP 5 425d0f20495SRichard Henderson #define TARGET_SIGABRT 6 426d0f20495SRichard Henderson #define TARGET_SIGSTKFLT 7 /* actually SIGEMT */ 427d0f20495SRichard Henderson #define TARGET_SIGFPE 8 428d0f20495SRichard Henderson #define TARGET_SIGKILL 9 429d0f20495SRichard Henderson #define TARGET_SIGBUS 10 430d0f20495SRichard Henderson #define TARGET_SIGSEGV 11 431d0f20495SRichard Henderson #define TARGET_SIGSYS 12 432d0f20495SRichard Henderson #define TARGET_SIGPIPE 13 433d0f20495SRichard Henderson #define TARGET_SIGALRM 14 434d0f20495SRichard Henderson #define TARGET_SIGTERM 15 435d0f20495SRichard Henderson #define TARGET_SIGURG 16 436d0f20495SRichard Henderson #define TARGET_SIGSTOP 17 437d0f20495SRichard Henderson #define TARGET_SIGTSTP 18 438d0f20495SRichard Henderson #define TARGET_SIGCONT 19 439d0f20495SRichard Henderson #define TARGET_SIGCHLD 20 440d0f20495SRichard Henderson #define TARGET_SIGTTIN 21 441d0f20495SRichard Henderson #define TARGET_SIGTTOU 22 442d0f20495SRichard Henderson #define TARGET_SIGIO 23 443d0f20495SRichard Henderson #define TARGET_SIGXCPU 24 444d0f20495SRichard Henderson #define TARGET_SIGXFSZ 25 445d0f20495SRichard Henderson #define TARGET_SIGVTALRM 26 446d0f20495SRichard Henderson #define TARGET_SIGPROF 27 447d0f20495SRichard Henderson #define TARGET_SIGWINCH 28 448d0f20495SRichard Henderson #define TARGET_SIGPWR 29 /* actually SIGINFO */ 449d0f20495SRichard Henderson #define TARGET_SIGUSR1 30 450d0f20495SRichard Henderson #define TARGET_SIGUSR2 31 451d0f20495SRichard Henderson #define TARGET_SIGRTMIN 32 452d0f20495SRichard Henderson 453d0f20495SRichard Henderson #define TARGET_SIG_BLOCK 1 454d0f20495SRichard Henderson #define TARGET_SIG_UNBLOCK 2 455d0f20495SRichard Henderson #define TARGET_SIG_SETMASK 3 456d0f20495SRichard Henderson 457d0f20495SRichard Henderson #elif defined(TARGET_SPARC) 4586d5e216dSbellard 4596d5e216dSbellard #define TARGET_SIGHUP 1 4606d5e216dSbellard #define TARGET_SIGINT 2 4616d5e216dSbellard #define TARGET_SIGQUIT 3 4626d5e216dSbellard #define TARGET_SIGILL 4 4636d5e216dSbellard #define TARGET_SIGTRAP 5 4646d5e216dSbellard #define TARGET_SIGABRT 6 4656d5e216dSbellard #define TARGET_SIGIOT 6 4666d5e216dSbellard #define TARGET_SIGSTKFLT 7 /* actually EMT */ 4676d5e216dSbellard #define TARGET_SIGFPE 8 4686d5e216dSbellard #define TARGET_SIGKILL 9 4696d5e216dSbellard #define TARGET_SIGBUS 10 4706d5e216dSbellard #define TARGET_SIGSEGV 11 4716d5e216dSbellard #define TARGET_SIGSYS 12 4726d5e216dSbellard #define TARGET_SIGPIPE 13 4736d5e216dSbellard #define TARGET_SIGALRM 14 4746d5e216dSbellard #define TARGET_SIGTERM 15 4756d5e216dSbellard #define TARGET_SIGURG 16 4766d5e216dSbellard #define TARGET_SIGSTOP 17 4776d5e216dSbellard #define TARGET_SIGTSTP 18 4786d5e216dSbellard #define TARGET_SIGCONT 19 4796d5e216dSbellard #define TARGET_SIGCHLD 20 4806d5e216dSbellard #define TARGET_SIGTTIN 21 4816d5e216dSbellard #define TARGET_SIGTTOU 22 4826d5e216dSbellard #define TARGET_SIGIO 23 4836d5e216dSbellard #define TARGET_SIGXCPU 24 4846d5e216dSbellard #define TARGET_SIGXFSZ 25 4856d5e216dSbellard #define TARGET_SIGVTALRM 26 4866d5e216dSbellard #define TARGET_SIGPROF 27 4876d5e216dSbellard #define TARGET_SIGWINCH 28 4886d5e216dSbellard #define TARGET_SIGPWR 29 4896d5e216dSbellard #define TARGET_SIGUSR1 30 4906d5e216dSbellard #define TARGET_SIGUSR2 31 4916d5e216dSbellard #define TARGET_SIGRTMIN 32 4926d5e216dSbellard 4936d5e216dSbellard #define TARGET_SIG_BLOCK 0x01 /* for blocking signals */ 4946d5e216dSbellard #define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */ 4956d5e216dSbellard #define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */ 4966d5e216dSbellard 497048f6b4dSbellard #elif defined(TARGET_MIPS) 498048f6b4dSbellard 499048f6b4dSbellard #define TARGET_SIGHUP 1 /* Hangup (POSIX). */ 500048f6b4dSbellard #define TARGET_SIGINT 2 /* Interrupt (ANSI). */ 501048f6b4dSbellard #define TARGET_SIGQUIT 3 /* Quit (POSIX). */ 502048f6b4dSbellard #define TARGET_SIGILL 4 /* Illegal instruction (ANSI). */ 503048f6b4dSbellard #define TARGET_SIGTRAP 5 /* Trace trap (POSIX). */ 504048f6b4dSbellard #define TARGET_SIGIOT 6 /* IOT trap (4.2 BSD). */ 505048f6b4dSbellard #define TARGET_SIGABRT TARGET_SIGIOT /* Abort (ANSI). */ 506048f6b4dSbellard #define TARGET_SIGEMT 7 507048f6b4dSbellard #define TARGET_SIGSTKFLT 7 /* XXX: incorrect */ 508048f6b4dSbellard #define TARGET_SIGFPE 8 /* Floating-point exception (ANSI). */ 509048f6b4dSbellard #define TARGET_SIGKILL 9 /* Kill, unblockable (POSIX). */ 510048f6b4dSbellard #define TARGET_SIGBUS 10 /* BUS error (4.2 BSD). */ 511048f6b4dSbellard #define TARGET_SIGSEGV 11 /* Segmentation violation (ANSI). */ 512048f6b4dSbellard #define TARGET_SIGSYS 12 513048f6b4dSbellard #define TARGET_SIGPIPE 13 /* Broken pipe (POSIX). */ 514048f6b4dSbellard #define TARGET_SIGALRM 14 /* Alarm clock (POSIX). */ 515048f6b4dSbellard #define TARGET_SIGTERM 15 /* Termination (ANSI). */ 516048f6b4dSbellard #define TARGET_SIGUSR1 16 /* User-defined signal 1 (POSIX). */ 517048f6b4dSbellard #define TARGET_SIGUSR2 17 /* User-defined signal 2 (POSIX). */ 518048f6b4dSbellard #define TARGET_SIGCHLD 18 /* Child status has changed (POSIX). */ 519048f6b4dSbellard #define TARGET_SIGCLD TARGET_SIGCHLD /* Same as TARGET_SIGCHLD (System V). */ 520048f6b4dSbellard #define TARGET_SIGPWR 19 /* Power failure restart (System V). */ 521048f6b4dSbellard #define TARGET_SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */ 522048f6b4dSbellard #define TARGET_SIGURG 21 /* Urgent condition on socket (4.2 BSD). */ 523048f6b4dSbellard #define TARGET_SIGIO 22 /* I/O now possible (4.2 BSD). */ 524048f6b4dSbellard #define TARGET_SIGPOLL TARGET_SIGIO /* Pollable event occurred (System V). */ 525048f6b4dSbellard #define TARGET_SIGSTOP 23 /* Stop, unblockable (POSIX). */ 526048f6b4dSbellard #define TARGET_SIGTSTP 24 /* Keyboard stop (POSIX). */ 527048f6b4dSbellard #define TARGET_SIGCONT 25 /* Continue (POSIX). */ 528048f6b4dSbellard #define TARGET_SIGTTIN 26 /* Background read from tty (POSIX). */ 529048f6b4dSbellard #define TARGET_SIGTTOU 27 /* Background write to tty (POSIX). */ 530048f6b4dSbellard #define TARGET_SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */ 531048f6b4dSbellard #define TARGET_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */ 532048f6b4dSbellard #define TARGET_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ 533048f6b4dSbellard #define TARGET_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ 534048f6b4dSbellard #define TARGET_SIGRTMIN 32 535048f6b4dSbellard 536048f6b4dSbellard #define TARGET_SIG_BLOCK 1 /* for blocking signals */ 537048f6b4dSbellard #define TARGET_SIG_UNBLOCK 2 /* for unblocking signals */ 538048f6b4dSbellard #define TARGET_SIG_SETMASK 3 /* for setting the signal mask */ 539048f6b4dSbellard 5406d5e216dSbellard #else 5412521d698Sbellard 542d962783eSJia Liu /* OpenRISC Using the general signals */ 5432521d698Sbellard #define TARGET_SIGHUP 1 5442521d698Sbellard #define TARGET_SIGINT 2 5452521d698Sbellard #define TARGET_SIGQUIT 3 5462521d698Sbellard #define TARGET_SIGILL 4 5472521d698Sbellard #define TARGET_SIGTRAP 5 5482521d698Sbellard #define TARGET_SIGABRT 6 5492521d698Sbellard #define TARGET_SIGIOT 6 5502521d698Sbellard #define TARGET_SIGBUS 7 5512521d698Sbellard #define TARGET_SIGFPE 8 5522521d698Sbellard #define TARGET_SIGKILL 9 5532521d698Sbellard #define TARGET_SIGUSR1 10 5542521d698Sbellard #define TARGET_SIGSEGV 11 5552521d698Sbellard #define TARGET_SIGUSR2 12 5562521d698Sbellard #define TARGET_SIGPIPE 13 5572521d698Sbellard #define TARGET_SIGALRM 14 5582521d698Sbellard #define TARGET_SIGTERM 15 5592521d698Sbellard #define TARGET_SIGSTKFLT 16 5602521d698Sbellard #define TARGET_SIGCHLD 17 5612521d698Sbellard #define TARGET_SIGCONT 18 5622521d698Sbellard #define TARGET_SIGSTOP 19 5632521d698Sbellard #define TARGET_SIGTSTP 20 5642521d698Sbellard #define TARGET_SIGTTIN 21 5652521d698Sbellard #define TARGET_SIGTTOU 22 5662521d698Sbellard #define TARGET_SIGURG 23 5672521d698Sbellard #define TARGET_SIGXCPU 24 5682521d698Sbellard #define TARGET_SIGXFSZ 25 5692521d698Sbellard #define TARGET_SIGVTALRM 26 5702521d698Sbellard #define TARGET_SIGPROF 27 5712521d698Sbellard #define TARGET_SIGWINCH 28 5722521d698Sbellard #define TARGET_SIGIO 29 573c596ed17Sbellard #define TARGET_SIGPWR 30 574c596ed17Sbellard #define TARGET_SIGSYS 31 5752521d698Sbellard #define TARGET_SIGRTMIN 32 5762521d698Sbellard 5772521d698Sbellard #define TARGET_SIG_BLOCK 0 /* for blocking signals */ 5782521d698Sbellard #define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */ 5792521d698Sbellard #define TARGET_SIG_SETMASK 2 /* for setting the signal mask */ 5802521d698Sbellard 5816d5e216dSbellard #endif 5826d5e216dSbellard 5836049f4f8SRichard Henderson #if defined(TARGET_ALPHA) 5846049f4f8SRichard Henderson struct target_old_sigaction { 5856049f4f8SRichard Henderson abi_ulong _sa_handler; 5866049f4f8SRichard Henderson abi_ulong sa_mask; 587d2565875SRichard Henderson int32_t sa_flags; 5886049f4f8SRichard Henderson }; 589106ec879Sbellard 5906049f4f8SRichard Henderson struct target_rt_sigaction { 5916049f4f8SRichard Henderson abi_ulong _sa_handler; 5926049f4f8SRichard Henderson abi_ulong sa_flags; 5936049f4f8SRichard Henderson target_sigset_t sa_mask; 5946049f4f8SRichard Henderson }; 5956049f4f8SRichard Henderson 5966049f4f8SRichard Henderson /* This is the struct used inside the kernel. The ka_restorer 5976049f4f8SRichard Henderson field comes from the 5th argument to sys_rt_sigaction. */ 5986049f4f8SRichard Henderson struct target_sigaction { 5996049f4f8SRichard Henderson abi_ulong _sa_handler; 6006049f4f8SRichard Henderson abi_ulong sa_flags; 6016049f4f8SRichard Henderson target_sigset_t sa_mask; 6026049f4f8SRichard Henderson abi_ulong sa_restorer; 6036049f4f8SRichard Henderson }; 6046049f4f8SRichard Henderson #elif defined(TARGET_MIPS) 605106ec879Sbellard struct target_sigaction { 606540635baSths uint32_t sa_flags; 607d26bc211Sths #if defined(TARGET_ABI_MIPSN32) 608540635baSths uint32_t _sa_handler; 609540635baSths #else 610992f48a0Sblueswir1 abi_ulong _sa_handler; 611540635baSths #endif 612c227f099SAnthony Liguori target_sigset_t sa_mask; 613106ec879Sbellard }; 614106ec879Sbellard #else 6152521d698Sbellard struct target_old_sigaction { 616992f48a0Sblueswir1 abi_ulong _sa_handler; 617992f48a0Sblueswir1 abi_ulong sa_mask; 618992f48a0Sblueswir1 abi_ulong sa_flags; 619992f48a0Sblueswir1 abi_ulong sa_restorer; 6202521d698Sbellard }; 6212521d698Sbellard 6222521d698Sbellard struct target_sigaction { 623992f48a0Sblueswir1 abi_ulong _sa_handler; 624992f48a0Sblueswir1 abi_ulong sa_flags; 625992f48a0Sblueswir1 abi_ulong sa_restorer; 626c227f099SAnthony Liguori target_sigset_t sa_mask; 6272521d698Sbellard }; 628106ec879Sbellard #endif 6292521d698Sbellard 6302521d698Sbellard typedef union target_sigval { 6312521d698Sbellard int sival_int; 632992f48a0Sblueswir1 abi_ulong sival_ptr; 633c227f099SAnthony Liguori } target_sigval_t; 6346d5e216dSbellard #if 0 6356d5e216dSbellard #if defined (TARGET_SPARC) 6366d5e216dSbellard typedef struct { 6376d5e216dSbellard struct { 638992f48a0Sblueswir1 abi_ulong psr; 639992f48a0Sblueswir1 abi_ulong pc; 640992f48a0Sblueswir1 abi_ulong npc; 641992f48a0Sblueswir1 abi_ulong y; 642992f48a0Sblueswir1 abi_ulong u_regs[16]; /* globals and ins */ 6436d5e216dSbellard } si_regs; 6446d5e216dSbellard int si_mask; 6456d5e216dSbellard } __siginfo_t; 6466d5e216dSbellard 6476d5e216dSbellard typedef struct { 6486d5e216dSbellard unsigned long si_float_regs [32]; 6496d5e216dSbellard unsigned long si_fsr; 6506d5e216dSbellard unsigned long si_fpqdepth; 6516d5e216dSbellard struct { 6526d5e216dSbellard unsigned long *insn_addr; 6536d5e216dSbellard unsigned long insn; 6546d5e216dSbellard } si_fpqueue [16]; 6556d5e216dSbellard } __siginfo_fpu_t; 6566d5e216dSbellard #endif 6576d5e216dSbellard #endif 6582521d698Sbellard 6592521d698Sbellard #define TARGET_SI_MAX_SIZE 128 660aa5e03d2SMaxim Ostapenko 661aa5e03d2SMaxim Ostapenko #if TARGET_ABI_BITS == 32 662aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int)) 663aa5e03d2SMaxim Ostapenko #else 664aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int)) 665aa5e03d2SMaxim Ostapenko #endif 666aa5e03d2SMaxim Ostapenko 667aa5e03d2SMaxim Ostapenko #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int)) 6682521d698Sbellard 6692521d698Sbellard typedef struct target_siginfo { 6703f53d546Spbrook #ifdef TARGET_MIPS 6713f53d546Spbrook int si_signo; 6723f53d546Spbrook int si_code; 6733f53d546Spbrook int si_errno; 6743f53d546Spbrook #else 6752521d698Sbellard int si_signo; 6762521d698Sbellard int si_errno; 6772521d698Sbellard int si_code; 6783f53d546Spbrook #endif 6792521d698Sbellard 6802521d698Sbellard union { 6812521d698Sbellard int _pad[TARGET_SI_PAD_SIZE]; 6822521d698Sbellard 6832521d698Sbellard /* kill() */ 6842521d698Sbellard struct { 6852521d698Sbellard pid_t _pid; /* sender's pid */ 6862521d698Sbellard uid_t _uid; /* sender's uid */ 6872521d698Sbellard } _kill; 6882521d698Sbellard 6892521d698Sbellard /* POSIX.1b timers */ 6902521d698Sbellard struct { 6912521d698Sbellard unsigned int _timer1; 6922521d698Sbellard unsigned int _timer2; 6932521d698Sbellard } _timer; 6942521d698Sbellard 6952521d698Sbellard /* POSIX.1b signals */ 6962521d698Sbellard struct { 6972521d698Sbellard pid_t _pid; /* sender's pid */ 6982521d698Sbellard uid_t _uid; /* sender's uid */ 699c227f099SAnthony Liguori target_sigval_t _sigval; 7002521d698Sbellard } _rt; 7012521d698Sbellard 7022521d698Sbellard /* SIGCHLD */ 7032521d698Sbellard struct { 7042521d698Sbellard pid_t _pid; /* which child */ 7052521d698Sbellard uid_t _uid; /* sender's uid */ 7062521d698Sbellard int _status; /* exit code */ 707c227f099SAnthony Liguori target_clock_t _utime; 708c227f099SAnthony Liguori target_clock_t _stime; 7092521d698Sbellard } _sigchld; 7102521d698Sbellard 7112521d698Sbellard /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 7122521d698Sbellard struct { 713992f48a0Sblueswir1 abi_ulong _addr; /* faulting insn/memory ref. */ 7142521d698Sbellard } _sigfault; 7152521d698Sbellard 7162521d698Sbellard /* SIGPOLL */ 7172521d698Sbellard struct { 7182521d698Sbellard int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 7192521d698Sbellard int _fd; 7202521d698Sbellard } _sigpoll; 7212521d698Sbellard } _sifields; 722c227f099SAnthony Liguori } target_siginfo_t; 7232521d698Sbellard 7242521d698Sbellard /* 7252521d698Sbellard * si_code values 7262521d698Sbellard * Digital reserves positive values for kernel-generated signals. 7272521d698Sbellard */ 7282521d698Sbellard #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ 7292521d698Sbellard #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 7302521d698Sbellard #define TARGET_SI_QUEUE -1 /* sent by sigqueue */ 7312521d698Sbellard #define TARGET_SI_TIMER -2 /* sent by timer expiration */ 7322521d698Sbellard #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ 7332521d698Sbellard #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ 7342521d698Sbellard #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ 7352521d698Sbellard 7362521d698Sbellard /* 7372521d698Sbellard * SIGILL si_codes 7382521d698Sbellard */ 739ffa65c3bSbellard #define TARGET_ILL_ILLOPC (1) /* illegal opcode */ 7402521d698Sbellard #define TARGET_ILL_ILLOPN (2) /* illegal operand */ 741ffa65c3bSbellard #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ 742ffa65c3bSbellard #define TARGET_ILL_ILLTRP (4) /* illegal trap */ 743ffa65c3bSbellard #define TARGET_ILL_PRVOPC (5) /* privileged opcode */ 744ffa65c3bSbellard #define TARGET_ILL_PRVREG (6) /* privileged register */ 745ffa65c3bSbellard #define TARGET_ILL_COPROC (7) /* coprocessor error */ 746ffa65c3bSbellard #define TARGET_ILL_BADSTK (8) /* internal stack error */ 7472521d698Sbellard 7482521d698Sbellard /* 7492521d698Sbellard * SIGFPE si_codes 7502521d698Sbellard */ 7512521d698Sbellard #define TARGET_FPE_INTDIV (1) /* integer divide by zero */ 7522521d698Sbellard #define TARGET_FPE_INTOVF (2) /* integer overflow */ 7532521d698Sbellard #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ 7542521d698Sbellard #define TARGET_FPE_FLTOVF (4) /* floating point overflow */ 7552521d698Sbellard #define TARGET_FPE_FLTUND (5) /* floating point underflow */ 7562521d698Sbellard #define TARGET_FPE_FLTRES (6) /* floating point inexact result */ 7572521d698Sbellard #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ 7582521d698Sbellard #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ 7592521d698Sbellard #define TARGET_NSIGFPE 8 7602521d698Sbellard 7612521d698Sbellard /* 7622521d698Sbellard * SIGSEGV si_codes 7632521d698Sbellard */ 7642521d698Sbellard #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ 7652521d698Sbellard #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ 7662521d698Sbellard 7672521d698Sbellard /* 768ffa65c3bSbellard * SIGBUS si_codes 769ffa65c3bSbellard */ 770ffa65c3bSbellard #define TARGET_BUS_ADRALN (1) /* invalid address alignment */ 771b4916d7bSDong Xu Wang #define TARGET_BUS_ADRERR (2) /* non-existent physical address */ 772ffa65c3bSbellard #define TARGET_BUS_OBJERR (3) /* object specific hardware error */ 773ffa65c3bSbellard 774ffa65c3bSbellard /* 7752521d698Sbellard * SIGTRAP si_codes 7762521d698Sbellard */ 7772521d698Sbellard #define TARGET_TRAP_BRKPT (1) /* process breakpoint */ 7782521d698Sbellard #define TARGET_TRAP_TRACE (2) /* process trace trap */ 7792521d698Sbellard 7802521d698Sbellard #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */ 7812521d698Sbellard 7829de5e440Sbellard struct target_rlimit { 783992f48a0Sblueswir1 abi_ulong rlim_cur; 784992f48a0Sblueswir1 abi_ulong rlim_max; 7859de5e440Sbellard }; 7869de5e440Sbellard 78781bbe906Stakasi-y@ops.dti.ne.jp #if defined(TARGET_ALPHA) 788e476492eSAurelien Jarno #define TARGET_RLIM_INFINITY 0x7fffffffffffffffull 7896cafd027SMatthias Braun #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32) 79081bbe906Stakasi-y@ops.dti.ne.jp #define TARGET_RLIM_INFINITY 0x7fffffffUL 79181bbe906Stakasi-y@ops.dti.ne.jp #else 79226b746dbSMatthias Braun #define TARGET_RLIM_INFINITY ((abi_ulong)-1) 79381bbe906Stakasi-y@ops.dti.ne.jp #endif 79481bbe906Stakasi-y@ops.dti.ne.jp 795e22b7015SWesley W. Terpstra #if defined(TARGET_MIPS) 796e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 797e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 798e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 799e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 800e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 801e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 7 802e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 8 803e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 5 804e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 9 805e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 6 806e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 807e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 808e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 809e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 810e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 811e22b7015SWesley W. Terpstra #else 812e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 813e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 814e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 815e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 816e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 817e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 5 8186cafd027SMatthias Braun #if defined(TARGET_SPARC) 8196cafd027SMatthias Braun #define TARGET_RLIMIT_NOFILE 6 8206cafd027SMatthias Braun #define TARGET_RLIMIT_NPROC 7 8216cafd027SMatthias Braun #else 822e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 6 823e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 7 8246cafd027SMatthias Braun #endif 825e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 8 826e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 9 827e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 828e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 829e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 830e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 831e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 832e22b7015SWesley W. Terpstra #endif 833e22b7015SWesley W. Terpstra 8349de5e440Sbellard struct target_pollfd { 8359de5e440Sbellard int fd; /* file descriptor */ 8369de5e440Sbellard short events; /* requested events */ 8379de5e440Sbellard short revents; /* returned events */ 8389de5e440Sbellard }; 8399de5e440Sbellard 8408e5a0667Sbellard /* virtual terminal ioctls */ 8410221cfcdSbellard #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ 8420221cfcdSbellard #define TARGET_KDMKTONE 0x4B30 /* generate tone */ 8438e5a0667Sbellard #define TARGET_KDGKBTYPE 0x4b33 844f7680a55SUlrich Hecht #define TARGET_KDSETMODE 0x4b3a 845f7680a55SUlrich Hecht #define TARGET_KDGKBMODE 0x4b44 846f7680a55SUlrich Hecht #define TARGET_KDSKBMODE 0x4b45 8470221cfcdSbellard #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ 8480221cfcdSbellard #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ 849e6fe18fbSCédric VINCENT #define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ 850e6fe18fbSCédric VINCENT #define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ 851e6fe18fbSCédric VINCENT #define TARGET_KDGETLED 0x4B31 /* return current led state */ 852e6fe18fbSCédric VINCENT #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */ 853ca56f5b5SPaul Burton #define TARGET_KDSIGACCEPT 0x4B4E 8548e5a0667Sbellard 8552521d698Sbellard #define TARGET_SIOCATMARK 0x8905 8562521d698Sbellard 85731e31b8aSbellard /* Networking ioctls */ 85831e31b8aSbellard #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ 85931e31b8aSbellard #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ 86031e31b8aSbellard #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ 86131e31b8aSbellard #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ 86231e31b8aSbellard #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ 86331e31b8aSbellard #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ 86431e31b8aSbellard #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ 86531e31b8aSbellard #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ 86631e31b8aSbellard #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ 86731e31b8aSbellard #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ 86831e31b8aSbellard #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ 86931e31b8aSbellard #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ 87031e31b8aSbellard #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ 87131e31b8aSbellard #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ 87231e31b8aSbellard #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ 87331e31b8aSbellard #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ 87431e31b8aSbellard #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ 87531e31b8aSbellard #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ 87631e31b8aSbellard #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ 87731e31b8aSbellard #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ 87831e31b8aSbellard #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ 87931e31b8aSbellard #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ 88031e31b8aSbellard #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ 88131e31b8aSbellard #define TARGET_SIOCSIFENCAP 0x8926 88231e31b8aSbellard #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ 88331e31b8aSbellard #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ 88431e31b8aSbellard #define TARGET_SIOCSIFSLAVE 0x8930 88531e31b8aSbellard #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ 88631e31b8aSbellard #define TARGET_SIOCDELMULTI 0x8932 887f63eb01aSPaul Burton #define TARGET_SIOCGIFINDEX 0x8933 88831e31b8aSbellard 88931e31b8aSbellard /* Bridging control calls */ 89031e31b8aSbellard #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ 89131e31b8aSbellard #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ 89231e31b8aSbellard 89331e31b8aSbellard #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ 89431e31b8aSbellard #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ 89531e31b8aSbellard 89631e31b8aSbellard /* ARP cache control calls. */ 89731e31b8aSbellard #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ 89831e31b8aSbellard #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ 89931e31b8aSbellard #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ 90031e31b8aSbellard #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ 90131e31b8aSbellard #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ 90231e31b8aSbellard #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ 90331e31b8aSbellard 90431e31b8aSbellard /* RARP cache control calls. */ 90531e31b8aSbellard #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ 90631e31b8aSbellard #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ 90731e31b8aSbellard #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ 90831e31b8aSbellard 90931e31b8aSbellard /* Driver configuration calls */ 91031e31b8aSbellard #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ 91131e31b8aSbellard #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ 91231e31b8aSbellard 91331e31b8aSbellard /* DLCI configuration calls */ 91431e31b8aSbellard #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ 91531e31b8aSbellard #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ 91631e31b8aSbellard 91786fcd946SLaurent Vivier /* From <linux/wireless.h> */ 91886fcd946SLaurent Vivier 91986fcd946SLaurent Vivier #define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ 92031e31b8aSbellard 92131e31b8aSbellard /* From <linux/fs.h> */ 92231e31b8aSbellard 92331e31b8aSbellard #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ 92431e31b8aSbellard #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ 92531e31b8aSbellard #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ 92631e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ 92731e31b8aSbellard #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ 92831e31b8aSbellard #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ 92931e31b8aSbellard #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ 93031e31b8aSbellard #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ 93131e31b8aSbellard #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ 93231e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ 93331e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ 93431e31b8aSbellard #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ 935fff8c539SAndreas Färber #define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */ 93631e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */ 937c8b0bf54SPeter Maydell #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong) 938c8b0bf54SPeter Maydell #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong) 939edafea13SAlexander Graf #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) 940edafea13SAlexander Graf /* return device size in bytes 941edafea13SAlexander Graf (u64 *arg) */ 94231e31b8aSbellard #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ 94331e31b8aSbellard #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ 944285da2b9SPeter Maydell #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) 94531e31b8aSbellard 94631e31b8aSbellard /* cdrom commands */ 94731e31b8aSbellard #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ 94831e31b8aSbellard #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ 94931e31b8aSbellard #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ 95031e31b8aSbellard #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index 95131e31b8aSbellard (struct cdrom_ti) */ 95231e31b8aSbellard #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header 95331e31b8aSbellard (struct cdrom_tochdr) */ 95431e31b8aSbellard #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry 95531e31b8aSbellard (struct cdrom_tocentry) */ 95631e31b8aSbellard #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ 95731e31b8aSbellard #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ 95831e31b8aSbellard #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ 95931e31b8aSbellard #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume 96031e31b8aSbellard (struct cdrom_volctrl) */ 96131e31b8aSbellard #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data 96231e31b8aSbellard (struct cdrom_subchnl) */ 96331e31b8aSbellard #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) 96431e31b8aSbellard (struct cdrom_read) */ 96531e31b8aSbellard #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) 96631e31b8aSbellard (struct cdrom_read) */ 96731e31b8aSbellard #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ 96831e31b8aSbellard #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ 96931e31b8aSbellard #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session 97031e31b8aSbellard address of multi session disks 97131e31b8aSbellard (struct cdrom_multisession) */ 97231e31b8aSbellard #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" 97331e31b8aSbellard if available (struct cdrom_mcn) */ 97467cc32ebSVeres Lajos #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is deprecated, 975b4916d7bSDong Xu Wang but here anyway for compatibility */ 97631e31b8aSbellard #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ 97731e31b8aSbellard #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting 97831e31b8aSbellard (struct cdrom_volctrl) */ 97931e31b8aSbellard #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) 98031e31b8aSbellard (struct cdrom_read) */ 98131e31b8aSbellard /* 98231e31b8aSbellard * These ioctls are used only used in aztcd.c and optcd.c 98331e31b8aSbellard */ 98431e31b8aSbellard #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ 98531e31b8aSbellard #define TARGET_CDROMSEEK 0x5316 /* seek msf address */ 98631e31b8aSbellard 98731e31b8aSbellard /* 98831e31b8aSbellard * This ioctl is only used by the scsi-cd driver. 98931e31b8aSbellard It is for playing audio in logical block addressing mode. 99031e31b8aSbellard */ 99131e31b8aSbellard #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ 99231e31b8aSbellard 99331e31b8aSbellard /* 99431e31b8aSbellard * These ioctls are only used in optcd.c 99531e31b8aSbellard */ 99631e31b8aSbellard #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ 99731e31b8aSbellard 99831e31b8aSbellard /* 99931e31b8aSbellard * These ioctls are (now) only in ide-cd.c for controlling 100031e31b8aSbellard * drive spindown time. They should be implemented in the 100131e31b8aSbellard * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, 100231e31b8aSbellard * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... 100331e31b8aSbellard * -Erik 100431e31b8aSbellard */ 100531e31b8aSbellard #define TARGET_CDROMGETSPINDOWN 0x531d 100631e31b8aSbellard #define TARGET_CDROMSETSPINDOWN 0x531e 100731e31b8aSbellard 100831e31b8aSbellard /* 100931e31b8aSbellard * These ioctls are implemented through the uniform CD-ROM driver 101031e31b8aSbellard * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM 101131e31b8aSbellard * drivers are eventually ported to the uniform CD-ROM driver interface. 101231e31b8aSbellard */ 101331e31b8aSbellard #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ 101431e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ 101531e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ 101631e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ 101731e31b8aSbellard #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ 101831e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ 101931e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ 102031e31b8aSbellard #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ 102131e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ 102231e31b8aSbellard #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ 102331e31b8aSbellard #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ 102431e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ 102531e31b8aSbellard 102631e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. 102731e31b8aSbellard * Future CDROM ioctls should be kept below 0x537F 102831e31b8aSbellard */ 102931e31b8aSbellard 103031e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */ 103131e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ 103231e31b8aSbellard /* conflict with SCSI_IOCTL_GET_IDLUN */ 103331e31b8aSbellard 103431e31b8aSbellard /* DVD-ROM Specific ioctls */ 103531e31b8aSbellard #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ 103631e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ 103731e31b8aSbellard #define TARGET_DVD_AUTH 0x5392 /* Authentication */ 103831e31b8aSbellard 103931e31b8aSbellard #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ 104031e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ 104131e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ 104231e31b8aSbellard 104331e31b8aSbellard /* HD commands */ 104431e31b8aSbellard 104531e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ 104631e31b8aSbellard #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ 104731e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ 104831e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ 104931e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ 105031e31b8aSbellard #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ 105131e31b8aSbellard #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ 105231e31b8aSbellard #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ 10532521d698Sbellard #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ 105431e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ 105531e31b8aSbellard 105631e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ 105731e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ 105831e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ 105931e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ 106031e31b8aSbellard #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ 106131e31b8aSbellard #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ 106231e31b8aSbellard #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ 106331e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ 10642521d698Sbellard 1065b8005914Sbalrog /* loop ioctls */ 1066b8005914Sbalrog #define TARGET_LOOP_SET_FD 0x4C00 1067b8005914Sbalrog #define TARGET_LOOP_CLR_FD 0x4C01 1068b8005914Sbalrog #define TARGET_LOOP_SET_STATUS 0x4C02 1069b8005914Sbalrog #define TARGET_LOOP_GET_STATUS 0x4C03 1070b8005914Sbalrog #define TARGET_LOOP_SET_STATUS64 0x4C04 1071b8005914Sbalrog #define TARGET_LOOP_GET_STATUS64 0x4C05 1072b8005914Sbalrog #define TARGET_LOOP_CHANGE_FD 0x4C06 10732521d698Sbellard 1074f7680a55SUlrich Hecht /* fb ioctls */ 1075f7680a55SUlrich Hecht #define TARGET_FBIOGET_VSCREENINFO 0x4600 1076f7680a55SUlrich Hecht #define TARGET_FBIOPUT_VSCREENINFO 0x4601 1077f7680a55SUlrich Hecht #define TARGET_FBIOGET_FSCREENINFO 0x4602 107812b81b71SCédric VINCENT #define TARGET_FBIOGETCMAP 0x4604 107912b81b71SCédric VINCENT #define TARGET_FBIOPUTCMAP 0x4605 108012b81b71SCédric VINCENT #define TARGET_FBIOPAN_DISPLAY 0x4606 108112b81b71SCédric VINCENT #define TARGET_FBIOGET_CON2FBMAP 0x460F 108212b81b71SCédric VINCENT #define TARGET_FBIOPUT_CON2FBMAP 0x4610 1083f7680a55SUlrich Hecht 1084f7680a55SUlrich Hecht /* vt ioctls */ 1085f7680a55SUlrich Hecht #define TARGET_VT_OPENQRY 0x5600 1086f7680a55SUlrich Hecht #define TARGET_VT_GETSTATE 0x5603 1087f7680a55SUlrich Hecht #define TARGET_VT_ACTIVATE 0x5606 1088f7680a55SUlrich Hecht #define TARGET_VT_WAITACTIVE 0x5607 1089f7680a55SUlrich Hecht #define TARGET_VT_LOCKSWITCH 0x560b 1090f7680a55SUlrich Hecht #define TARGET_VT_UNLOCKSWITCH 0x560c 1091774750c0SCédric VINCENT #define TARGET_VT_GETMODE 0x5601 1092774750c0SCédric VINCENT #define TARGET_VT_SETMODE 0x5602 1093774750c0SCédric VINCENT #define TARGET_VT_RELDISP 0x5605 1094774750c0SCédric VINCENT #define TARGET_VT_DISALLOCATE 0x5608 1095f7680a55SUlrich Hecht 109656e904ecSAlexander Graf /* device mapper */ 109756e904ecSAlexander Graf #define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00) 109856e904ecSAlexander Graf #define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01) 109956e904ecSAlexander Graf #define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02) 110056e904ecSAlexander Graf #define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03) 110156e904ecSAlexander Graf #define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04) 110256e904ecSAlexander Graf #define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05) 110356e904ecSAlexander Graf #define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06) 110456e904ecSAlexander Graf #define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07) 110556e904ecSAlexander Graf #define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08) 110656e904ecSAlexander Graf #define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09) 110756e904ecSAlexander Graf #define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a) 110856e904ecSAlexander Graf #define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b) 110956e904ecSAlexander Graf #define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c) 111056e904ecSAlexander Graf #define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d) 111156e904ecSAlexander Graf #define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e) 111256e904ecSAlexander Graf #define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f) 111356e904ecSAlexander Graf 11142521d698Sbellard /* from asm/termbits.h */ 11152521d698Sbellard 11163bfd9da1Sbellard #define TARGET_NCC 8 11173bfd9da1Sbellard struct target_termio { 11183bfd9da1Sbellard unsigned short c_iflag; /* input mode flags */ 11193bfd9da1Sbellard unsigned short c_oflag; /* output mode flags */ 11203bfd9da1Sbellard unsigned short c_cflag; /* control mode flags */ 11213bfd9da1Sbellard unsigned short c_lflag; /* local mode flags */ 11222521d698Sbellard unsigned char c_line; /* line discipline */ 11233bfd9da1Sbellard unsigned char c_cc[TARGET_NCC]; /* control characters */ 11242521d698Sbellard }; 11252521d698Sbellard 11263bfd9da1Sbellard struct target_winsize { 11273bfd9da1Sbellard unsigned short ws_row; 11283bfd9da1Sbellard unsigned short ws_col; 11293bfd9da1Sbellard unsigned short ws_xpixel; 11303bfd9da1Sbellard unsigned short ws_ypixel; 11313bfd9da1Sbellard }; 11322521d698Sbellard 11333bfd9da1Sbellard #include "termbits.h" 11342521d698Sbellard 11359e0b74a4SPaul Brook #if defined(TARGET_MIPS) 11369e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x10 11379e0b74a4SPaul Brook #else 11389e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x08 11399e0b74a4SPaul Brook #endif 11409e0b74a4SPaul Brook 1141e44a3e79Saurel32 /* Common */ 11422521d698Sbellard #define TARGET_MAP_SHARED 0x01 /* Share changes */ 11432521d698Sbellard #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ 11442521d698Sbellard #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ 1145e44a3e79Saurel32 1146e44a3e79Saurel32 /* Target specific */ 1147048f6b4dSbellard #if defined(TARGET_MIPS) 1148e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1149048f6b4dSbellard #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 1150048f6b4dSbellard #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 1151048f6b4dSbellard #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 1152048f6b4dSbellard #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 1153048f6b4dSbellard #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 1154048f6b4dSbellard #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 1155540635baSths #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 1156540635baSths #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1157e44a3e79Saurel32 #elif defined(TARGET_PPC) 1158e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 11592521d698Sbellard #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 11602521d698Sbellard #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 11612521d698Sbellard #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 11622521d698Sbellard #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 11637ec93196Sj_mayer #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ 11647ec93196Sj_mayer #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ 1165e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1166e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1167e44a3e79Saurel32 #elif defined(TARGET_ALPHA) 1168e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1169e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ 1170e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ 1171e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ 1172e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ 1173e44a3e79Saurel32 #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ 1174e44a3e79Saurel32 #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ 1175e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ 1176e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ 11777ec93196Sj_mayer #else 1178e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1179e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 1180e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 1181e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 1182e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 11832521d698Sbellard #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ 11842521d698Sbellard #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ 1185540635baSths #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1186540635baSths #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1187906c1b8eSMike Frysinger #define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ 11887ec93196Sj_mayer #endif 11892521d698Sbellard 119009701199SAlexander Graf #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 119109701199SAlexander Graf || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 1192c7819dfbSPeter Maydell || defined(TARGET_CRIS) || defined(TARGET_UNICORE32) 11932521d698Sbellard struct target_stat { 11942521d698Sbellard unsigned short st_dev; 11952521d698Sbellard unsigned short __pad1; 1196992f48a0Sblueswir1 abi_ulong st_ino; 11972521d698Sbellard unsigned short st_mode; 11982521d698Sbellard unsigned short st_nlink; 11992521d698Sbellard unsigned short st_uid; 12002521d698Sbellard unsigned short st_gid; 12012521d698Sbellard unsigned short st_rdev; 12022521d698Sbellard unsigned short __pad2; 1203992f48a0Sblueswir1 abi_ulong st_size; 1204992f48a0Sblueswir1 abi_ulong st_blksize; 1205992f48a0Sblueswir1 abi_ulong st_blocks; 1206992f48a0Sblueswir1 abi_ulong target_st_atime; 1207992f48a0Sblueswir1 abi_ulong __unused1; 1208992f48a0Sblueswir1 abi_ulong target_st_mtime; 1209992f48a0Sblueswir1 abi_ulong __unused2; 1210992f48a0Sblueswir1 abi_ulong target_st_ctime; 1211992f48a0Sblueswir1 abi_ulong __unused3; 1212992f48a0Sblueswir1 abi_ulong __unused4; 1213992f48a0Sblueswir1 abi_ulong __unused5; 12142521d698Sbellard }; 12152521d698Sbellard 12162521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely 12172521d698Sbellard * insane amounts of padding around dev_t's. 12182521d698Sbellard */ 121920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 12202521d698Sbellard struct target_stat64 { 12212521d698Sbellard unsigned short st_dev; 12222521d698Sbellard unsigned char __pad0[10]; 12232521d698Sbellard 12242521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1225992f48a0Sblueswir1 abi_ulong __st_ino; 12262521d698Sbellard 12272521d698Sbellard unsigned int st_mode; 12282521d698Sbellard unsigned int st_nlink; 12292521d698Sbellard 1230992f48a0Sblueswir1 abi_ulong st_uid; 1231992f48a0Sblueswir1 abi_ulong st_gid; 12322521d698Sbellard 12332521d698Sbellard unsigned short st_rdev; 12342521d698Sbellard unsigned char __pad3[10]; 12352521d698Sbellard 12362521d698Sbellard long long st_size; 1237992f48a0Sblueswir1 abi_ulong st_blksize; 12382521d698Sbellard 1239992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1240992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 12412521d698Sbellard 1242992f48a0Sblueswir1 abi_ulong target_st_atime; 1243992f48a0Sblueswir1 abi_ulong __pad5; 12442521d698Sbellard 1245992f48a0Sblueswir1 abi_ulong target_st_mtime; 1246992f48a0Sblueswir1 abi_ulong __pad6; 12472521d698Sbellard 1248992f48a0Sblueswir1 abi_ulong target_st_ctime; 1249992f48a0Sblueswir1 abi_ulong __pad7; /* will be high 32 bits of ctime someday */ 12502521d698Sbellard 12512521d698Sbellard unsigned long long st_ino; 1252541dc0d4SStefan Weil } QEMU_PACKED; 12532521d698Sbellard 1254ce4defa0Spbrook #ifdef TARGET_ARM 125520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1256ce4defa0Spbrook struct target_eabi_stat64 { 1257ce4defa0Spbrook unsigned long long st_dev; 1258ce4defa0Spbrook unsigned int __pad1; 1259992f48a0Sblueswir1 abi_ulong __st_ino; 1260ce4defa0Spbrook unsigned int st_mode; 1261ce4defa0Spbrook unsigned int st_nlink; 1262ce4defa0Spbrook 1263992f48a0Sblueswir1 abi_ulong st_uid; 1264992f48a0Sblueswir1 abi_ulong st_gid; 1265ce4defa0Spbrook 1266ce4defa0Spbrook unsigned long long st_rdev; 1267ce4defa0Spbrook unsigned int __pad2[2]; 1268ce4defa0Spbrook 1269ce4defa0Spbrook long long st_size; 1270992f48a0Sblueswir1 abi_ulong st_blksize; 1271ce4defa0Spbrook unsigned int __pad3; 1272ce4defa0Spbrook unsigned long long st_blocks; 1273ce4defa0Spbrook 1274992f48a0Sblueswir1 abi_ulong target_st_atime; 1275992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1276ce4defa0Spbrook 1277992f48a0Sblueswir1 abi_ulong target_st_mtime; 1278992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1279ce4defa0Spbrook 1280992f48a0Sblueswir1 abi_ulong target_st_ctime; 1281992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1282ce4defa0Spbrook 1283ce4defa0Spbrook unsigned long long st_ino; 1284541dc0d4SStefan Weil } QEMU_PACKED; 1285ce4defa0Spbrook #endif 1286ce4defa0Spbrook 1287992f48a0Sblueswir1 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 12881b8dd648Sblueswir1 struct target_stat { 12891b8dd648Sblueswir1 unsigned int st_dev; 1290992f48a0Sblueswir1 abi_ulong st_ino; 12911b8dd648Sblueswir1 unsigned int st_mode; 12921b8dd648Sblueswir1 unsigned int st_nlink; 12931b8dd648Sblueswir1 unsigned int st_uid; 12941b8dd648Sblueswir1 unsigned int st_gid; 12951b8dd648Sblueswir1 unsigned int st_rdev; 1296992f48a0Sblueswir1 abi_long st_size; 1297992f48a0Sblueswir1 abi_long target_st_atime; 1298992f48a0Sblueswir1 abi_long target_st_mtime; 1299992f48a0Sblueswir1 abi_long target_st_ctime; 1300992f48a0Sblueswir1 abi_long st_blksize; 1301992f48a0Sblueswir1 abi_long st_blocks; 1302992f48a0Sblueswir1 abi_ulong __unused4[2]; 13031b8dd648Sblueswir1 }; 13041b8dd648Sblueswir1 130520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 13061b8dd648Sblueswir1 struct target_stat64 { 13071b8dd648Sblueswir1 unsigned char __pad0[6]; 13081b8dd648Sblueswir1 unsigned short st_dev; 13091b8dd648Sblueswir1 13101b8dd648Sblueswir1 uint64_t st_ino; 13111b8dd648Sblueswir1 uint64_t st_nlink; 13121b8dd648Sblueswir1 13131b8dd648Sblueswir1 unsigned int st_mode; 13141b8dd648Sblueswir1 13151b8dd648Sblueswir1 unsigned int st_uid; 13161b8dd648Sblueswir1 unsigned int st_gid; 13171b8dd648Sblueswir1 13181b8dd648Sblueswir1 unsigned char __pad2[6]; 13191b8dd648Sblueswir1 unsigned short st_rdev; 13201b8dd648Sblueswir1 13211b8dd648Sblueswir1 int64_t st_size; 13221b8dd648Sblueswir1 int64_t st_blksize; 13231b8dd648Sblueswir1 13241b8dd648Sblueswir1 unsigned char __pad4[4]; 13251b8dd648Sblueswir1 unsigned int st_blocks; 13261b8dd648Sblueswir1 1327992f48a0Sblueswir1 abi_ulong target_st_atime; 1328992f48a0Sblueswir1 abi_ulong __unused1; 13291b8dd648Sblueswir1 1330992f48a0Sblueswir1 abi_ulong target_st_mtime; 1331992f48a0Sblueswir1 abi_ulong __unused2; 13321b8dd648Sblueswir1 1333992f48a0Sblueswir1 abi_ulong target_st_ctime; 1334992f48a0Sblueswir1 abi_ulong __unused3; 13351b8dd648Sblueswir1 1336992f48a0Sblueswir1 abi_ulong __unused4[3]; 13371b8dd648Sblueswir1 }; 13381b8dd648Sblueswir1 13393bfd9da1Sbellard #elif defined(TARGET_SPARC) 13403bfd9da1Sbellard 13413bfd9da1Sbellard struct target_stat { 13423bfd9da1Sbellard unsigned short st_dev; 1343992f48a0Sblueswir1 abi_ulong st_ino; 13443bfd9da1Sbellard unsigned short st_mode; 13453bfd9da1Sbellard short st_nlink; 13463bfd9da1Sbellard unsigned short st_uid; 13473bfd9da1Sbellard unsigned short st_gid; 13483bfd9da1Sbellard unsigned short st_rdev; 1349992f48a0Sblueswir1 abi_long st_size; 1350992f48a0Sblueswir1 abi_long target_st_atime; 1351992f48a0Sblueswir1 abi_ulong __unused1; 1352992f48a0Sblueswir1 abi_long target_st_mtime; 1353992f48a0Sblueswir1 abi_ulong __unused2; 1354992f48a0Sblueswir1 abi_long target_st_ctime; 1355992f48a0Sblueswir1 abi_ulong __unused3; 1356992f48a0Sblueswir1 abi_long st_blksize; 1357992f48a0Sblueswir1 abi_long st_blocks; 1358992f48a0Sblueswir1 abi_ulong __unused4[2]; 13593bfd9da1Sbellard }; 13603bfd9da1Sbellard 136120d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 13623bfd9da1Sbellard struct target_stat64 { 13633bfd9da1Sbellard unsigned char __pad0[6]; 13643bfd9da1Sbellard unsigned short st_dev; 13653bfd9da1Sbellard 13663bfd9da1Sbellard uint64_t st_ino; 13673bfd9da1Sbellard 13683bfd9da1Sbellard unsigned int st_mode; 13693bfd9da1Sbellard unsigned int st_nlink; 13703bfd9da1Sbellard 13713bfd9da1Sbellard unsigned int st_uid; 13723bfd9da1Sbellard unsigned int st_gid; 13733bfd9da1Sbellard 13743bfd9da1Sbellard unsigned char __pad2[6]; 13753bfd9da1Sbellard unsigned short st_rdev; 13763bfd9da1Sbellard 13773bfd9da1Sbellard unsigned char __pad3[8]; 13783bfd9da1Sbellard 13793bfd9da1Sbellard int64_t st_size; 13803bfd9da1Sbellard unsigned int st_blksize; 13813bfd9da1Sbellard 13823bfd9da1Sbellard unsigned char __pad4[8]; 13833bfd9da1Sbellard unsigned int st_blocks; 13843bfd9da1Sbellard 13853bfd9da1Sbellard unsigned int target_st_atime; 13863bfd9da1Sbellard unsigned int __unused1; 13873bfd9da1Sbellard 13883bfd9da1Sbellard unsigned int target_st_mtime; 13893bfd9da1Sbellard unsigned int __unused2; 13903bfd9da1Sbellard 13913bfd9da1Sbellard unsigned int target_st_ctime; 13923bfd9da1Sbellard unsigned int __unused3; 13933bfd9da1Sbellard 13943bfd9da1Sbellard unsigned int __unused4; 13953bfd9da1Sbellard unsigned int __unused5; 13963bfd9da1Sbellard }; 13973bfd9da1Sbellard 139867867308Sbellard #elif defined(TARGET_PPC) 139967867308Sbellard 140067867308Sbellard struct target_stat { 1401e32448e0Sj_mayer abi_ulong st_dev; 1402992f48a0Sblueswir1 abi_ulong st_ino; 1403325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1404e32448e0Sj_mayer abi_ulong st_nlink; 1405325e651fSj_mayer unsigned int st_mode; 1406325e651fSj_mayer #else 140767867308Sbellard unsigned int st_mode; 140867867308Sbellard unsigned short st_nlink; 1409325e651fSj_mayer #endif 141067867308Sbellard unsigned int st_uid; 141167867308Sbellard unsigned int st_gid; 1412e32448e0Sj_mayer abi_ulong st_rdev; 1413992f48a0Sblueswir1 abi_ulong st_size; 1414992f48a0Sblueswir1 abi_ulong st_blksize; 1415992f48a0Sblueswir1 abi_ulong st_blocks; 1416992f48a0Sblueswir1 abi_ulong target_st_atime; 1417e32448e0Sj_mayer abi_ulong target_st_atime_nsec; 1418992f48a0Sblueswir1 abi_ulong target_st_mtime; 1419e32448e0Sj_mayer abi_ulong target_st_mtime_nsec; 1420992f48a0Sblueswir1 abi_ulong target_st_ctime; 1421e32448e0Sj_mayer abi_ulong target_st_ctime_nsec; 1422992f48a0Sblueswir1 abi_ulong __unused4; 1423992f48a0Sblueswir1 abi_ulong __unused5; 1424325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1425325e651fSj_mayer abi_ulong __unused6; 1426325e651fSj_mayer #endif 142767867308Sbellard }; 142867867308Sbellard 142920d155bcSStefan Weil #if !defined(TARGET_PPC64) || defined(TARGET_ABI32) 143020d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1431541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 143267867308Sbellard unsigned long long st_dev; 143367867308Sbellard unsigned long long st_ino; 143467867308Sbellard unsigned int st_mode; 143567867308Sbellard unsigned int st_nlink; 143667867308Sbellard unsigned int st_uid; 143767867308Sbellard unsigned int st_gid; 143867867308Sbellard unsigned long long st_rdev; 1439e1ce5e40Saurel32 unsigned long long __pad0; 144067867308Sbellard long long st_size; 1441e32448e0Sj_mayer int st_blksize; 1442e1ce5e40Saurel32 unsigned int __pad1; 144361322e91SMax Filippov long long st_blocks; /* Number 512-byte blocks allocated. */ 1444e32448e0Sj_mayer int target_st_atime; 1445e32448e0Sj_mayer unsigned int target_st_atime_nsec; 1446e32448e0Sj_mayer int target_st_mtime; 1447e32448e0Sj_mayer unsigned int target_st_mtime_nsec; 1448e32448e0Sj_mayer int target_st_ctime; 1449e32448e0Sj_mayer unsigned int target_st_ctime_nsec; 1450e32448e0Sj_mayer unsigned int __unused4; 1451e32448e0Sj_mayer unsigned int __unused5; 145267867308Sbellard }; 145320d155bcSStefan Weil #endif 145467867308Sbellard 1455b779e29eSEdgar E. Iglesias #elif defined(TARGET_MICROBLAZE) 1456b779e29eSEdgar E. Iglesias 1457b779e29eSEdgar E. Iglesias struct target_stat { 1458b779e29eSEdgar E. Iglesias abi_ulong st_dev; 1459b779e29eSEdgar E. Iglesias abi_ulong st_ino; 1460b779e29eSEdgar E. Iglesias unsigned int st_mode; 1461b779e29eSEdgar E. Iglesias unsigned short st_nlink; 1462b779e29eSEdgar E. Iglesias unsigned int st_uid; 1463b779e29eSEdgar E. Iglesias unsigned int st_gid; 1464b779e29eSEdgar E. Iglesias abi_ulong st_rdev; 1465b779e29eSEdgar E. Iglesias abi_ulong st_size; 1466b779e29eSEdgar E. Iglesias abi_ulong st_blksize; 1467b779e29eSEdgar E. Iglesias abi_ulong st_blocks; 1468b779e29eSEdgar E. Iglesias abi_ulong target_st_atime; 1469b779e29eSEdgar E. Iglesias abi_ulong target_st_atime_nsec; 1470b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime; 1471b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime_nsec; 1472b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime; 1473b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime_nsec; 1474b779e29eSEdgar E. Iglesias abi_ulong __unused4; 1475b779e29eSEdgar E. Iglesias abi_ulong __unused5; 1476b779e29eSEdgar E. Iglesias }; 1477b779e29eSEdgar E. Iglesias 1478b779e29eSEdgar E. Iglesias /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ 147920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1480541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 1481b779e29eSEdgar E. Iglesias uint64_t st_dev; 1482a523eb06SEdgar E. Iglesias #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1483a523eb06SEdgar E. Iglesias uint32_t pad0; 1484a523eb06SEdgar E. Iglesias uint32_t __st_ino; 1485a523eb06SEdgar E. Iglesias 1486b779e29eSEdgar E. Iglesias uint32_t st_mode; 1487b779e29eSEdgar E. Iglesias uint32_t st_nlink; 1488b779e29eSEdgar E. Iglesias uint32_t st_uid; 1489b779e29eSEdgar E. Iglesias uint32_t st_gid; 1490b779e29eSEdgar E. Iglesias uint64_t st_rdev; 149121ebeb23SEdgar E. Iglesias uint64_t __pad1; 1492b779e29eSEdgar E. Iglesias 1493b779e29eSEdgar E. Iglesias int64_t st_size; 1494b779e29eSEdgar E. Iglesias int32_t st_blksize; 149521ebeb23SEdgar E. Iglesias uint32_t __pad2; 1496b779e29eSEdgar E. Iglesias int64_t st_blocks; /* Number 512-byte blocks allocated. */ 1497b779e29eSEdgar E. Iglesias 1498b779e29eSEdgar E. Iglesias int target_st_atime; 1499b779e29eSEdgar E. Iglesias unsigned int target_st_atime_nsec; 1500b779e29eSEdgar E. Iglesias int target_st_mtime; 1501b779e29eSEdgar E. Iglesias unsigned int target_st_mtime_nsec; 1502b779e29eSEdgar E. Iglesias int target_st_ctime; 1503b779e29eSEdgar E. Iglesias unsigned int target_st_ctime_nsec; 1504a523eb06SEdgar E. Iglesias uint64_t st_ino; 1505b779e29eSEdgar E. Iglesias }; 1506b779e29eSEdgar E. Iglesias 1507e6e5906bSpbrook #elif defined(TARGET_M68K) 1508e6e5906bSpbrook 1509e6e5906bSpbrook struct target_stat { 1510e6e5906bSpbrook unsigned short st_dev; 1511e6e5906bSpbrook unsigned short __pad1; 1512992f48a0Sblueswir1 abi_ulong st_ino; 1513e6e5906bSpbrook unsigned short st_mode; 1514e6e5906bSpbrook unsigned short st_nlink; 1515e6e5906bSpbrook unsigned short st_uid; 1516e6e5906bSpbrook unsigned short st_gid; 1517e6e5906bSpbrook unsigned short st_rdev; 1518e6e5906bSpbrook unsigned short __pad2; 1519992f48a0Sblueswir1 abi_ulong st_size; 1520992f48a0Sblueswir1 abi_ulong st_blksize; 1521992f48a0Sblueswir1 abi_ulong st_blocks; 1522992f48a0Sblueswir1 abi_ulong target_st_atime; 1523992f48a0Sblueswir1 abi_ulong __unused1; 1524992f48a0Sblueswir1 abi_ulong target_st_mtime; 1525992f48a0Sblueswir1 abi_ulong __unused2; 1526992f48a0Sblueswir1 abi_ulong target_st_ctime; 1527992f48a0Sblueswir1 abi_ulong __unused3; 1528992f48a0Sblueswir1 abi_ulong __unused4; 1529992f48a0Sblueswir1 abi_ulong __unused5; 1530e6e5906bSpbrook }; 1531e6e5906bSpbrook 1532e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely 1533e6e5906bSpbrook * insane amounts of padding around dev_t's. 1534e6e5906bSpbrook */ 153520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1536e6e5906bSpbrook struct target_stat64 { 1537e6e5906bSpbrook unsigned long long st_dev; 1538e6e5906bSpbrook unsigned char __pad1[2]; 1539e6e5906bSpbrook 1540e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1541992f48a0Sblueswir1 abi_ulong __st_ino; 1542e6e5906bSpbrook 1543e6e5906bSpbrook unsigned int st_mode; 1544e6e5906bSpbrook unsigned int st_nlink; 1545e6e5906bSpbrook 1546992f48a0Sblueswir1 abi_ulong st_uid; 1547992f48a0Sblueswir1 abi_ulong st_gid; 1548e6e5906bSpbrook 1549e6e5906bSpbrook unsigned long long st_rdev; 1550e6e5906bSpbrook unsigned char __pad3[2]; 1551e6e5906bSpbrook 1552e6e5906bSpbrook long long st_size; 1553992f48a0Sblueswir1 abi_ulong st_blksize; 1554e6e5906bSpbrook 1555992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 1556992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1557e6e5906bSpbrook 1558992f48a0Sblueswir1 abi_ulong target_st_atime; 1559992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1560e6e5906bSpbrook 1561992f48a0Sblueswir1 abi_ulong target_st_mtime; 1562992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1563e6e5906bSpbrook 1564992f48a0Sblueswir1 abi_ulong target_st_ctime; 1565992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1566e6e5906bSpbrook 1567e6e5906bSpbrook unsigned long long st_ino; 1568541dc0d4SStefan Weil } QEMU_PACKED; 1569e6e5906bSpbrook 1570d26bc211Sths #elif defined(TARGET_ABI_MIPSN64) 1571540635baSths 1572540635baSths /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ 1573540635baSths struct target_stat { 1574540635baSths unsigned int st_dev; 1575540635baSths unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ 1576540635baSths 1577992f48a0Sblueswir1 abi_ulong st_ino; 1578540635baSths 1579540635baSths unsigned int st_mode; 1580540635baSths unsigned int st_nlink; 1581540635baSths 1582540635baSths int st_uid; 1583540635baSths int st_gid; 1584540635baSths 1585540635baSths unsigned int st_rdev; 1586540635baSths unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ 1587540635baSths 1588992f48a0Sblueswir1 abi_ulong st_size; 1589540635baSths 1590540635baSths /* 1591540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1592540635baSths * but we don't have it under Linux. 1593540635baSths */ 1594540635baSths unsigned int target_st_atime; 1595540635baSths unsigned int target_st_atime_nsec; 1596540635baSths 1597540635baSths unsigned int target_st_mtime; 1598540635baSths unsigned int target_st_mtime_nsec; 1599540635baSths 1600540635baSths unsigned int target_st_ctime; 1601540635baSths unsigned int target_st_ctime_nsec; 1602540635baSths 1603540635baSths unsigned int st_blksize; 1604540635baSths unsigned int st_pad2; 1605540635baSths 1606992f48a0Sblueswir1 abi_ulong st_blocks; 1607540635baSths }; 1608540635baSths 1609d26bc211Sths #elif defined(TARGET_ABI_MIPSN32) 1610540635baSths 1611540635baSths struct target_stat { 16121ab2aea2SLeon Alrae abi_ulong st_dev; 16131ab2aea2SLeon Alrae abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 16141ab2aea2SLeon Alrae uint64_t st_ino; 1615540635baSths unsigned int st_mode; 1616540635baSths unsigned int st_nlink; 1617540635baSths int st_uid; 1618540635baSths int st_gid; 16191ab2aea2SLeon Alrae abi_ulong st_rdev; 16201ab2aea2SLeon Alrae abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 16211ab2aea2SLeon Alrae int64_t st_size; 16221ab2aea2SLeon Alrae abi_long target_st_atime; 16231ab2aea2SLeon Alrae abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 16241ab2aea2SLeon Alrae abi_long target_st_mtime; 16251ab2aea2SLeon Alrae abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 16261ab2aea2SLeon Alrae abi_long target_st_ctime; 16271ab2aea2SLeon Alrae abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 16281ab2aea2SLeon Alrae abi_ulong st_blksize; 16291ab2aea2SLeon Alrae abi_ulong st_pad2; 16301ab2aea2SLeon Alrae int64_t st_blocks; 1631540635baSths }; 1632540635baSths 1633d26bc211Sths #elif defined(TARGET_ABI_MIPSO32) 1634048f6b4dSbellard 1635048f6b4dSbellard struct target_stat { 1636048f6b4dSbellard unsigned st_dev; 1637992f48a0Sblueswir1 abi_long st_pad1[3]; /* Reserved for network id */ 1638992f48a0Sblueswir1 abi_ulong st_ino; 1639048f6b4dSbellard unsigned int st_mode; 1640048f6b4dSbellard unsigned int st_nlink; 1641048f6b4dSbellard int st_uid; 1642048f6b4dSbellard int st_gid; 1643048f6b4dSbellard unsigned st_rdev; 1644992f48a0Sblueswir1 abi_long st_pad2[2]; 1645992f48a0Sblueswir1 abi_long st_size; 1646992f48a0Sblueswir1 abi_long st_pad3; 1647048f6b4dSbellard /* 1648048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1649048f6b4dSbellard * but we don't have it under Linux. 1650048f6b4dSbellard */ 1651992f48a0Sblueswir1 abi_long target_st_atime; 1652992f48a0Sblueswir1 abi_long target_st_atime_nsec; 1653992f48a0Sblueswir1 abi_long target_st_mtime; 1654992f48a0Sblueswir1 abi_long target_st_mtime_nsec; 1655992f48a0Sblueswir1 abi_long target_st_ctime; 1656992f48a0Sblueswir1 abi_long target_st_ctime_nsec; 1657992f48a0Sblueswir1 abi_long st_blksize; 1658992f48a0Sblueswir1 abi_long st_blocks; 1659992f48a0Sblueswir1 abi_long st_pad4[14]; 1660048f6b4dSbellard }; 1661048f6b4dSbellard 1662048f6b4dSbellard /* 1663048f6b4dSbellard * This matches struct stat64 in glibc2.1, hence the absolutely insane 1664048f6b4dSbellard * amounts of padding around dev_t's. The memory layout is the same as of 1665048f6b4dSbellard * struct stat of the 64-bit kernel. 1666048f6b4dSbellard */ 1667048f6b4dSbellard 166820d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1669048f6b4dSbellard struct target_stat64 { 1670992f48a0Sblueswir1 abi_ulong st_dev; 1671992f48a0Sblueswir1 abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 1672048f6b4dSbellard 1673048f6b4dSbellard uint64_t st_ino; 1674048f6b4dSbellard 1675048f6b4dSbellard unsigned int st_mode; 1676048f6b4dSbellard unsigned int st_nlink; 1677048f6b4dSbellard 1678048f6b4dSbellard int st_uid; 1679048f6b4dSbellard int st_gid; 1680048f6b4dSbellard 1681992f48a0Sblueswir1 abi_ulong st_rdev; 1682992f48a0Sblueswir1 abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 1683048f6b4dSbellard 1684048f6b4dSbellard int64_t st_size; 1685048f6b4dSbellard 1686048f6b4dSbellard /* 1687048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1688048f6b4dSbellard * but we don't have it under Linux. 1689048f6b4dSbellard */ 1690992f48a0Sblueswir1 abi_long target_st_atime; 1691992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 1692048f6b4dSbellard 1693992f48a0Sblueswir1 abi_long target_st_mtime; 1694992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 1695048f6b4dSbellard 1696992f48a0Sblueswir1 abi_long target_st_ctime; 1697992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 1698048f6b4dSbellard 1699992f48a0Sblueswir1 abi_ulong st_blksize; 1700992f48a0Sblueswir1 abi_ulong st_pad2; 1701048f6b4dSbellard 1702048f6b4dSbellard int64_t st_blocks; 1703048f6b4dSbellard }; 17047a3148a9Sj_mayer 17057a3148a9Sj_mayer #elif defined(TARGET_ALPHA) 17067a3148a9Sj_mayer 17077a3148a9Sj_mayer struct target_stat { 17087a3148a9Sj_mayer unsigned int st_dev; 17097a3148a9Sj_mayer unsigned int st_ino; 17107a3148a9Sj_mayer unsigned int st_mode; 17117a3148a9Sj_mayer unsigned int st_nlink; 17127a3148a9Sj_mayer unsigned int st_uid; 17137a3148a9Sj_mayer unsigned int st_gid; 17147a3148a9Sj_mayer unsigned int st_rdev; 1715992f48a0Sblueswir1 abi_long st_size; 1716992f48a0Sblueswir1 abi_ulong target_st_atime; 1717992f48a0Sblueswir1 abi_ulong target_st_mtime; 1718992f48a0Sblueswir1 abi_ulong target_st_ctime; 17197a3148a9Sj_mayer unsigned int st_blksize; 17207a3148a9Sj_mayer unsigned int st_blocks; 17217a3148a9Sj_mayer unsigned int st_flags; 17227a3148a9Sj_mayer unsigned int st_gen; 17237a3148a9Sj_mayer }; 17247a3148a9Sj_mayer 172520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 17267a3148a9Sj_mayer struct target_stat64 { 1727992f48a0Sblueswir1 abi_ulong st_dev; 1728992f48a0Sblueswir1 abi_ulong st_ino; 1729992f48a0Sblueswir1 abi_ulong st_rdev; 1730992f48a0Sblueswir1 abi_long st_size; 1731992f48a0Sblueswir1 abi_ulong st_blocks; 17327a3148a9Sj_mayer 17337a3148a9Sj_mayer unsigned int st_mode; 17347a3148a9Sj_mayer unsigned int st_uid; 17357a3148a9Sj_mayer unsigned int st_gid; 17367a3148a9Sj_mayer unsigned int st_blksize; 17377a3148a9Sj_mayer unsigned int st_nlink; 17387a3148a9Sj_mayer unsigned int __pad0; 17397a3148a9Sj_mayer 1740992f48a0Sblueswir1 abi_ulong target_st_atime; 1741992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1742992f48a0Sblueswir1 abi_ulong target_st_mtime; 1743992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1744992f48a0Sblueswir1 abi_ulong target_st_ctime; 1745992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1746992f48a0Sblueswir1 abi_long __unused[3]; 17477a3148a9Sj_mayer }; 17487a3148a9Sj_mayer 17496db45e65Sths #elif defined(TARGET_SH4) 17506db45e65Sths 17516db45e65Sths struct target_stat { 1752992f48a0Sblueswir1 abi_ulong st_dev; 1753992f48a0Sblueswir1 abi_ulong st_ino; 17546db45e65Sths unsigned short st_mode; 17556db45e65Sths unsigned short st_nlink; 17566db45e65Sths unsigned short st_uid; 17576db45e65Sths unsigned short st_gid; 1758992f48a0Sblueswir1 abi_ulong st_rdev; 1759992f48a0Sblueswir1 abi_ulong st_size; 1760992f48a0Sblueswir1 abi_ulong st_blksize; 1761992f48a0Sblueswir1 abi_ulong st_blocks; 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_ulong __unused4; 1769992f48a0Sblueswir1 abi_ulong __unused5; 17706db45e65Sths }; 17716db45e65Sths 17726db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely 17736db45e65Sths * insane amounts of padding around dev_t's. 17746db45e65Sths */ 177520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1776541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 17776db45e65Sths unsigned long long st_dev; 17786db45e65Sths unsigned char __pad0[4]; 17796db45e65Sths 17806db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1781992f48a0Sblueswir1 abi_ulong __st_ino; 17826db45e65Sths 17836db45e65Sths unsigned int st_mode; 17846db45e65Sths unsigned int st_nlink; 17856db45e65Sths 1786992f48a0Sblueswir1 abi_ulong st_uid; 1787992f48a0Sblueswir1 abi_ulong st_gid; 17886db45e65Sths 17896db45e65Sths unsigned long long st_rdev; 17906db45e65Sths unsigned char __pad3[4]; 17916db45e65Sths 17926db45e65Sths long long st_size; 1793992f48a0Sblueswir1 abi_ulong st_blksize; 17946db45e65Sths 17956db45e65Sths unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ 17966db45e65Sths 1797992f48a0Sblueswir1 abi_ulong target_st_atime; 1798992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 17996db45e65Sths 1800992f48a0Sblueswir1 abi_ulong target_st_mtime; 1801992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 18026db45e65Sths 1803992f48a0Sblueswir1 abi_ulong target_st_ctime; 1804992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 18056db45e65Sths 18066db45e65Sths unsigned long long st_ino; 18076db45e65Sths }; 18086db45e65Sths 1809d2fd1af7Sbellard #elif defined(TARGET_I386) && !defined(TARGET_ABI32) 1810d2fd1af7Sbellard struct target_stat { 1811d2fd1af7Sbellard abi_ulong st_dev; 1812d2fd1af7Sbellard abi_ulong st_ino; 1813d2fd1af7Sbellard abi_ulong st_nlink; 1814d2fd1af7Sbellard 1815d2fd1af7Sbellard unsigned int st_mode; 1816d2fd1af7Sbellard unsigned int st_uid; 1817d2fd1af7Sbellard unsigned int st_gid; 1818d2fd1af7Sbellard unsigned int __pad0; 1819d2fd1af7Sbellard abi_ulong st_rdev; 1820d2fd1af7Sbellard abi_long st_size; 1821d2fd1af7Sbellard abi_long st_blksize; 1822d2fd1af7Sbellard abi_long st_blocks; /* Number 512-byte blocks allocated. */ 1823d2fd1af7Sbellard 1824d2fd1af7Sbellard abi_ulong target_st_atime; 1825d2fd1af7Sbellard abi_ulong target_st_atime_nsec; 1826d2fd1af7Sbellard abi_ulong target_st_mtime; 1827d2fd1af7Sbellard abi_ulong target_st_mtime_nsec; 1828d2fd1af7Sbellard abi_ulong target_st_ctime; 1829d2fd1af7Sbellard abi_ulong target_st_ctime_nsec; 1830d2fd1af7Sbellard 1831d2fd1af7Sbellard abi_long __unused[3]; 1832d2fd1af7Sbellard }; 1833a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 1834a4c075f1SUlrich Hecht struct target_stat { 1835a4c075f1SUlrich Hecht abi_ulong st_dev; 1836a4c075f1SUlrich Hecht abi_ulong st_ino; 1837a4c075f1SUlrich Hecht abi_ulong st_nlink; 1838a4c075f1SUlrich Hecht unsigned int st_mode; 1839a4c075f1SUlrich Hecht unsigned int st_uid; 1840a4c075f1SUlrich Hecht unsigned int st_gid; 1841a4c075f1SUlrich Hecht unsigned int __pad1; 1842a4c075f1SUlrich Hecht abi_ulong st_rdev; 1843a4c075f1SUlrich Hecht abi_ulong st_size; 1844a4c075f1SUlrich Hecht abi_ulong target_st_atime; 1845a4c075f1SUlrich Hecht abi_ulong target_st_atime_nsec; 1846a4c075f1SUlrich Hecht abi_ulong target_st_mtime; 1847a4c075f1SUlrich Hecht abi_ulong target_st_mtime_nsec; 1848a4c075f1SUlrich Hecht abi_ulong target_st_ctime; 1849a4c075f1SUlrich Hecht abi_ulong target_st_ctime_nsec; 1850a4c075f1SUlrich Hecht abi_ulong st_blksize; 1851a4c075f1SUlrich Hecht abi_long st_blocks; 1852a4c075f1SUlrich Hecht abi_ulong __unused[3]; 1853a4c075f1SUlrich Hecht }; 185409701199SAlexander Graf #elif defined(TARGET_AARCH64) 185509701199SAlexander Graf struct target_stat { 185609701199SAlexander Graf abi_ulong st_dev; 185709701199SAlexander Graf abi_ulong st_ino; 185809701199SAlexander Graf unsigned int st_mode; 185909701199SAlexander Graf unsigned int st_nlink; 186009701199SAlexander Graf unsigned int st_uid; 186109701199SAlexander Graf unsigned int st_gid; 186209701199SAlexander Graf abi_ulong st_rdev; 186309701199SAlexander Graf abi_ulong _pad1; 186409701199SAlexander Graf abi_long st_size; 186509701199SAlexander Graf int st_blksize; 186609701199SAlexander Graf int __pad2; 186709701199SAlexander Graf abi_long st_blocks; 186809701199SAlexander Graf abi_long target_st_atime; 186909701199SAlexander Graf abi_ulong target_st_atime_nsec; 187009701199SAlexander Graf abi_long target_st_mtime; 187109701199SAlexander Graf abi_ulong target_st_mtime_nsec; 187209701199SAlexander Graf abi_long target_st_ctime; 187309701199SAlexander Graf abi_ulong target_st_ctime_nsec; 187409701199SAlexander Graf unsigned int __unused[2]; 187509701199SAlexander Graf }; 1876*b16189b2SChen Gang #elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) 1877c7819dfbSPeter Maydell 1878c7819dfbSPeter Maydell /* These are the asm-generic versions of the stat and stat64 structures */ 1879c7819dfbSPeter Maydell 1880d962783eSJia Liu struct target_stat { 1881d962783eSJia Liu abi_ulong st_dev; 1882d962783eSJia Liu abi_ulong st_ino; 1883d962783eSJia Liu unsigned int st_mode; 1884c7819dfbSPeter Maydell unsigned int st_nlink; 1885d962783eSJia Liu unsigned int st_uid; 1886d962783eSJia Liu unsigned int st_gid; 1887d962783eSJia Liu abi_ulong st_rdev; 1888c7819dfbSPeter Maydell abi_ulong __pad1; 1889d962783eSJia Liu abi_long st_size; 1890c7819dfbSPeter Maydell int st_blksize; 1891c7819dfbSPeter Maydell int __pad2; 1892c7819dfbSPeter Maydell abi_long st_blocks; 1893c7819dfbSPeter Maydell abi_long target_st_atime; 1894d962783eSJia Liu abi_ulong target_st_atime_nsec; 1895c7819dfbSPeter Maydell abi_long target_st_mtime; 1896d962783eSJia Liu abi_ulong target_st_mtime_nsec; 1897c7819dfbSPeter Maydell abi_long target_st_ctime; 1898d962783eSJia Liu abi_ulong target_st_ctime_nsec; 1899c7819dfbSPeter Maydell unsigned int __unused4; 1900c7819dfbSPeter Maydell unsigned int __unused5; 1901d962783eSJia Liu }; 1902c7819dfbSPeter Maydell 190320d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1904c7819dfbSPeter Maydell struct target_stat64 { 1905c7819dfbSPeter Maydell uint64_t st_dev; 1906c7819dfbSPeter Maydell uint64_t st_ino; 1907c7819dfbSPeter Maydell unsigned int st_mode; 1908c7819dfbSPeter Maydell unsigned int st_nlink; 1909c7819dfbSPeter Maydell unsigned int st_uid; 1910c7819dfbSPeter Maydell unsigned int st_gid; 1911c7819dfbSPeter Maydell uint64_t st_rdev; 1912c7819dfbSPeter Maydell uint64_t __pad1; 1913c7819dfbSPeter Maydell int64_t st_size; 1914c7819dfbSPeter Maydell int st_blksize; 1915c7819dfbSPeter Maydell int __pad2; 1916c7819dfbSPeter Maydell int64_t st_blocks; 1917c7819dfbSPeter Maydell int target_st_atime; 1918c7819dfbSPeter Maydell unsigned int target_st_atime_nsec; 1919c7819dfbSPeter Maydell int target_st_mtime; 1920c7819dfbSPeter Maydell unsigned int target_st_mtime_nsec; 1921c7819dfbSPeter Maydell int target_st_ctime; 1922c7819dfbSPeter Maydell unsigned int target_st_ctime_nsec; 1923c7819dfbSPeter Maydell unsigned int __unused4; 1924c7819dfbSPeter Maydell unsigned int __unused5; 1925c7819dfbSPeter Maydell }; 1926c7819dfbSPeter Maydell 1927048f6b4dSbellard #else 1928048f6b4dSbellard #error unsupported CPU 1929048f6b4dSbellard #endif 19302521d698Sbellard 19314ce6f8deSths typedef struct { 19324ce6f8deSths int val[2]; 1933c227f099SAnthony Liguori } target_fsid_t; 19344ce6f8deSths 193556c8f68fSbellard #ifdef TARGET_MIPS 1936d26bc211Sths #ifdef TARGET_ABI_MIPSN32 1937540635baSths struct target_statfs { 1938540635baSths int32_t f_type; 1939540635baSths int32_t f_bsize; 1940540635baSths int32_t f_frsize; /* Fragment size - unsupported */ 1941540635baSths int32_t f_blocks; 1942540635baSths int32_t f_bfree; 1943540635baSths int32_t f_files; 1944540635baSths int32_t f_ffree; 1945540635baSths int32_t f_bavail; 1946540635baSths 1947540635baSths /* Linux specials */ 1948c227f099SAnthony Liguori target_fsid_t f_fsid; 1949540635baSths int32_t f_namelen; 1950540635baSths int32_t f_spare[6]; 1951540635baSths }; 1952540635baSths #else 195356c8f68fSbellard struct target_statfs { 1954992f48a0Sblueswir1 abi_long f_type; 1955992f48a0Sblueswir1 abi_long f_bsize; 1956992f48a0Sblueswir1 abi_long f_frsize; /* Fragment size - unsupported */ 1957992f48a0Sblueswir1 abi_long f_blocks; 1958992f48a0Sblueswir1 abi_long f_bfree; 1959992f48a0Sblueswir1 abi_long f_files; 1960992f48a0Sblueswir1 abi_long f_ffree; 1961992f48a0Sblueswir1 abi_long f_bavail; 196256c8f68fSbellard 196356c8f68fSbellard /* Linux specials */ 1964c227f099SAnthony Liguori target_fsid_t f_fsid; 1965992f48a0Sblueswir1 abi_long f_namelen; 1966992f48a0Sblueswir1 abi_long f_spare[6]; 196756c8f68fSbellard }; 1968540635baSths #endif 196956c8f68fSbellard 197056c8f68fSbellard struct target_statfs64 { 197156c8f68fSbellard uint32_t f_type; 197256c8f68fSbellard uint32_t f_bsize; 197356c8f68fSbellard uint32_t f_frsize; /* Fragment size - unsupported */ 197456c8f68fSbellard uint32_t __pad; 197556c8f68fSbellard uint64_t f_blocks; 197656c8f68fSbellard uint64_t f_bfree; 197756c8f68fSbellard uint64_t f_files; 197856c8f68fSbellard uint64_t f_ffree; 197956c8f68fSbellard uint64_t f_bavail; 1980c227f099SAnthony Liguori target_fsid_t f_fsid; 198156c8f68fSbellard uint32_t f_namelen; 198256c8f68fSbellard uint32_t f_spare[6]; 198356c8f68fSbellard }; 1984c4d10628Sbalrog #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ 198509701199SAlexander Graf defined(TARGET_SPARC64) || defined(TARGET_AARCH64)) && \ 198609701199SAlexander Graf !defined(TARGET_ABI32) 1987325e651fSj_mayer struct target_statfs { 1988325e651fSj_mayer abi_long f_type; 1989325e651fSj_mayer abi_long f_bsize; 1990325e651fSj_mayer abi_long f_blocks; 1991325e651fSj_mayer abi_long f_bfree; 1992325e651fSj_mayer abi_long f_bavail; 1993325e651fSj_mayer abi_long f_files; 1994325e651fSj_mayer abi_long f_ffree; 1995c227f099SAnthony Liguori target_fsid_t f_fsid; 1996325e651fSj_mayer abi_long f_namelen; 1997325e651fSj_mayer abi_long f_frsize; 1998325e651fSj_mayer abi_long f_spare[5]; 1999325e651fSj_mayer }; 2000325e651fSj_mayer 2001325e651fSj_mayer struct target_statfs64 { 2002325e651fSj_mayer abi_long f_type; 2003325e651fSj_mayer abi_long f_bsize; 2004325e651fSj_mayer abi_long f_blocks; 2005325e651fSj_mayer abi_long f_bfree; 2006325e651fSj_mayer abi_long f_bavail; 2007325e651fSj_mayer abi_long f_files; 2008325e651fSj_mayer abi_long f_ffree; 2009c227f099SAnthony Liguori target_fsid_t f_fsid; 2010325e651fSj_mayer abi_long f_namelen; 2011325e651fSj_mayer abi_long f_frsize; 2012325e651fSj_mayer abi_long f_spare[5]; 2013325e651fSj_mayer }; 2014a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 2015a4c075f1SUlrich Hecht struct target_statfs { 2016a4c075f1SUlrich Hecht int32_t f_type; 2017a4c075f1SUlrich Hecht int32_t f_bsize; 2018a4c075f1SUlrich Hecht abi_long f_blocks; 2019a4c075f1SUlrich Hecht abi_long f_bfree; 2020a4c075f1SUlrich Hecht abi_long f_bavail; 2021a4c075f1SUlrich Hecht abi_long f_files; 2022a4c075f1SUlrich Hecht abi_long f_ffree; 2023a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2024a4c075f1SUlrich Hecht int32_t f_namelen; 2025a4c075f1SUlrich Hecht int32_t f_frsize; 2026a4c075f1SUlrich Hecht int32_t f_spare[5]; 2027a4c075f1SUlrich Hecht }; 2028a4c075f1SUlrich Hecht 2029a4c075f1SUlrich Hecht struct target_statfs64 { 2030a4c075f1SUlrich Hecht int32_t f_type; 2031a4c075f1SUlrich Hecht int32_t f_bsize; 2032a4c075f1SUlrich Hecht abi_long f_blocks; 2033a4c075f1SUlrich Hecht abi_long f_bfree; 2034a4c075f1SUlrich Hecht abi_long f_bavail; 2035a4c075f1SUlrich Hecht abi_long f_files; 2036a4c075f1SUlrich Hecht abi_long f_ffree; 2037a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2038a4c075f1SUlrich Hecht int32_t f_namelen; 2039a4c075f1SUlrich Hecht int32_t f_frsize; 2040a4c075f1SUlrich Hecht int32_t f_spare[5]; 2041a4c075f1SUlrich Hecht }; 204256c8f68fSbellard #else 204356c8f68fSbellard struct target_statfs { 204456c8f68fSbellard uint32_t f_type; 204556c8f68fSbellard uint32_t f_bsize; 204656c8f68fSbellard uint32_t f_blocks; 204756c8f68fSbellard uint32_t f_bfree; 204856c8f68fSbellard uint32_t f_bavail; 204956c8f68fSbellard uint32_t f_files; 205056c8f68fSbellard uint32_t f_ffree; 2051c227f099SAnthony Liguori target_fsid_t f_fsid; 205256c8f68fSbellard uint32_t f_namelen; 205356c8f68fSbellard uint32_t f_frsize; 205456c8f68fSbellard uint32_t f_spare[5]; 205556c8f68fSbellard }; 205656c8f68fSbellard 205756c8f68fSbellard struct target_statfs64 { 205856c8f68fSbellard uint32_t f_type; 205956c8f68fSbellard uint32_t f_bsize; 206056c8f68fSbellard uint64_t f_blocks; 206156c8f68fSbellard uint64_t f_bfree; 206256c8f68fSbellard uint64_t f_bavail; 206356c8f68fSbellard uint64_t f_files; 206456c8f68fSbellard uint64_t f_ffree; 2065c227f099SAnthony Liguori target_fsid_t f_fsid; 206656c8f68fSbellard uint32_t f_namelen; 206756c8f68fSbellard uint32_t f_frsize; 206856c8f68fSbellard uint32_t f_spare[5]; 206956c8f68fSbellard }; 207056c8f68fSbellard #endif 207156c8f68fSbellard 207256c8f68fSbellard 20732521d698Sbellard #define TARGET_F_DUPFD 0 /* dup */ 20742521d698Sbellard #define TARGET_F_GETFD 1 /* get close_on_exec */ 20752521d698Sbellard #define TARGET_F_SETFD 2 /* set/clear close_on_exec */ 20762521d698Sbellard #define TARGET_F_GETFL 3 /* get file->f_flags */ 20772521d698Sbellard #define TARGET_F_SETFL 4 /* set file->f_flags */ 20782521d698Sbellard 20792521d698Sbellard #if defined(TARGET_ALPHA) 20802521d698Sbellard #define TARGET_F_GETLK 7 20812521d698Sbellard #define TARGET_F_SETLK 8 20822521d698Sbellard #define TARGET_F_SETLKW 9 20832521d698Sbellard #define TARGET_F_SETOWN 5 /* for sockets. */ 20842521d698Sbellard #define TARGET_F_GETOWN 6 /* for sockets. */ 20852ba7f730SLaurent Vivier 20862ba7f730SLaurent Vivier #define TARGET_F_RDLCK 1 20872ba7f730SLaurent Vivier #define TARGET_F_WRLCK 2 20882ba7f730SLaurent Vivier #define TARGET_F_UNLCK 8 20892ba7f730SLaurent Vivier #define TARGET_F_EXLCK 16 20902ba7f730SLaurent Vivier #define TARGET_F_SHLCK 32 20915f106811SArnaud Patard (Rtp) #elif defined(TARGET_MIPS) 20925f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK 14 20935f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK 6 20945f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW 7 20955f106811SArnaud Patard (Rtp) #define TARGET_F_SETOWN 24 /* for sockets. */ 20965f106811SArnaud Patard (Rtp) #define TARGET_F_GETOWN 25 /* for sockets. */ 20972521d698Sbellard #else 20982521d698Sbellard #define TARGET_F_GETLK 5 20992521d698Sbellard #define TARGET_F_SETLK 6 21002521d698Sbellard #define TARGET_F_SETLKW 7 21012521d698Sbellard #define TARGET_F_SETOWN 8 /* for sockets. */ 21022521d698Sbellard #define TARGET_F_GETOWN 9 /* for sockets. */ 21032521d698Sbellard #endif 21048d5d3004SAndreas Schwab #define TARGET_F_SETOWN_EX 15 21058d5d3004SAndreas Schwab #define TARGET_F_GETOWN_EX 16 21062521d698Sbellard 21072ba7f730SLaurent Vivier #ifndef TARGET_F_RDLCK 21082ba7f730SLaurent Vivier #define TARGET_F_RDLCK 0 21092ba7f730SLaurent Vivier #define TARGET_F_WRLCK 1 21102ba7f730SLaurent Vivier #define TARGET_F_UNLCK 2 21112ba7f730SLaurent Vivier #endif 21122ba7f730SLaurent Vivier 21132ba7f730SLaurent Vivier #ifndef TARGET_F_EXLCK 21142ba7f730SLaurent Vivier #define TARGET_F_EXLCK 4 21152ba7f730SLaurent Vivier #define TARGET_F_SHLCK 8 21162ba7f730SLaurent Vivier #endif 21172ba7f730SLaurent Vivier 21182ba7f730SLaurent Vivier 21192521d698Sbellard #define TARGET_F_SETSIG 10 /* for sockets. */ 21202521d698Sbellard #define TARGET_F_GETSIG 11 /* for sockets. */ 21212521d698Sbellard 21225f106811SArnaud Patard (Rtp) #if defined(TARGET_MIPS) 21235f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK64 33 /* using 'struct flock64' */ 21245f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK64 34 21255f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW64 35 21265f106811SArnaud Patard (Rtp) #else 21272521d698Sbellard #define TARGET_F_GETLK64 12 /* using 'struct flock64' */ 21282521d698Sbellard #define TARGET_F_SETLK64 13 21292521d698Sbellard #define TARGET_F_SETLKW64 14 21305f106811SArnaud Patard (Rtp) #endif 21317e22e546SUlrich Hecht 21327e22e546SUlrich Hecht #define TARGET_F_LINUX_SPECIFIC_BASE 1024 21337e22e546SUlrich Hecht #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0) 21347e22e546SUlrich Hecht #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1) 21357e22e546SUlrich Hecht #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) 21367e22e546SUlrich Hecht #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2) 21377e22e546SUlrich Hecht 21384eeea4f3SRichard Henderson #if defined(TARGET_ALPHA) 21394eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK 04 21404eeea4f3SRichard Henderson #define TARGET_O_APPEND 010 21414eeea4f3SRichard Henderson #define TARGET_O_CREAT 01000 /* not fcntl */ 21424eeea4f3SRichard Henderson #define TARGET_O_TRUNC 02000 /* not fcntl */ 21434eeea4f3SRichard Henderson #define TARGET_O_EXCL 04000 /* not fcntl */ 21444eeea4f3SRichard Henderson #define TARGET_O_NOCTTY 010000 /* not fcntl */ 21454eeea4f3SRichard Henderson #define TARGET_O_DSYNC 040000 21464eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0 /* not necessary, always 64-bit */ 21474eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY 0100000 /* must be a directory */ 21484eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW 0200000 /* don't follow links */ 21494eeea4f3SRichard Henderson #define TARGET_O_DIRECT 02000000 /* direct disk access hint */ 21504eeea4f3SRichard Henderson #define TARGET_O_NOATIME 04000000 21514eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 010000000 21524eeea4f3SRichard Henderson #define TARGET___O_SYNC 020000000 21534eeea4f3SRichard Henderson #define TARGET_O_PATH 040000000 21544eeea4f3SRichard Henderson #elif defined(TARGET_ARM) || defined(TARGET_M68K) 2155f09936acSbellard #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 2156f09936acSbellard #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 2157f09936acSbellard #define TARGET_O_DIRECT 0200000 /* direct disk access hint */ 2158f09936acSbellard #define TARGET_O_LARGEFILE 0400000 2159048f6b4dSbellard #elif defined(TARGET_MIPS) 2160048f6b4dSbellard #define TARGET_O_APPEND 0x0008 21614eeea4f3SRichard Henderson #define TARGET_O_DSYNC 0x0010 2162048f6b4dSbellard #define TARGET_O_NONBLOCK 0x0080 2163048f6b4dSbellard #define TARGET_O_CREAT 0x0100 /* not fcntl */ 2164048f6b4dSbellard #define TARGET_O_TRUNC 0x0200 /* not fcntl */ 2165048f6b4dSbellard #define TARGET_O_EXCL 0x0400 /* not fcntl */ 2166048f6b4dSbellard #define TARGET_O_NOCTTY 0x0800 /* not fcntl */ 2167048f6b4dSbellard #define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */ 2168048f6b4dSbellard #define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */ 21694eeea4f3SRichard Henderson #define TARGET___O_SYNC 0x4000 2170048f6b4dSbellard #define TARGET_O_DIRECT 0x8000 /* direct disk access hint */ 21714eeea4f3SRichard Henderson #elif defined (TARGET_PPC) 21724eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 21734eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 21744eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0200000 21754eeea4f3SRichard Henderson #define TARGET_O_DIRECT 0400000 /* direct disk access hint */ 21764eeea4f3SRichard Henderson #elif defined (TARGET_SPARC) 21771f961124Saurel32 #define TARGET_O_APPEND 0x0008 21784eeea4f3SRichard Henderson #define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */ 21791f961124Saurel32 #define TARGET_O_CREAT 0x0200 /* not fcntl */ 21801f961124Saurel32 #define TARGET_O_TRUNC 0x0400 /* not fcntl */ 21811f961124Saurel32 #define TARGET_O_EXCL 0x0800 /* not fcntl */ 21824eeea4f3SRichard Henderson #define TARGET_O_DSYNC 0x2000 21834eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK 0x4000 21844eeea4f3SRichard Henderson # ifdef TARGET_SPARC64 21854eeea4f3SRichard Henderson # define TARGET_O_NDELAY 0x0004 2186ffa65c3bSbellard # else 21874eeea4f3SRichard Henderson # define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK) 21884eeea4f3SRichard Henderson # endif 21894eeea4f3SRichard Henderson #define TARGET_O_NOCTTY 0x8000 /* not fcntl */ 21904eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0x40000 21914eeea4f3SRichard Henderson #define TARGET_O_DIRECT 0x100000 /* direct disk access hint */ 21924eeea4f3SRichard Henderson #define TARGET_O_NOATIME 0x200000 21934eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 0x400000 21944eeea4f3SRichard Henderson #define TARGET___O_SYNC 0x800000 21954eeea4f3SRichard Henderson #define TARGET_O_PATH 0x1000000 21964eeea4f3SRichard Henderson #endif 21974eeea4f3SRichard Henderson 21984eeea4f3SRichard Henderson /* <asm-generic/fcntl.h> values follow. */ 2199ffa65c3bSbellard #define TARGET_O_ACCMODE 0003 2200ffa65c3bSbellard #define TARGET_O_RDONLY 00 2201ffa65c3bSbellard #define TARGET_O_WRONLY 01 2202ffa65c3bSbellard #define TARGET_O_RDWR 02 22034eeea4f3SRichard Henderson #ifndef TARGET_O_CREAT 2204ffa65c3bSbellard #define TARGET_O_CREAT 0100 /* not fcntl */ 22054eeea4f3SRichard Henderson #endif 22064eeea4f3SRichard Henderson #ifndef TARGET_O_EXCL 2207ffa65c3bSbellard #define TARGET_O_EXCL 0200 /* not fcntl */ 22084eeea4f3SRichard Henderson #endif 22094eeea4f3SRichard Henderson #ifndef TARGET_O_NOCTTY 2210ffa65c3bSbellard #define TARGET_O_NOCTTY 0400 /* not fcntl */ 22114eeea4f3SRichard Henderson #endif 22124eeea4f3SRichard Henderson #ifndef TARGET_O_TRUNC 2213ffa65c3bSbellard #define TARGET_O_TRUNC 01000 /* not fcntl */ 22144eeea4f3SRichard Henderson #endif 22154eeea4f3SRichard Henderson #ifndef TARGET_O_APPEND 2216ffa65c3bSbellard #define TARGET_O_APPEND 02000 22174eeea4f3SRichard Henderson #endif 22184eeea4f3SRichard Henderson #ifndef TARGET_O_NONBLOCK 2219ffa65c3bSbellard #define TARGET_O_NONBLOCK 04000 22204eeea4f3SRichard Henderson #endif 22214eeea4f3SRichard Henderson #ifndef TARGET_O_DSYNC 22224eeea4f3SRichard Henderson #define TARGET_O_DSYNC 010000 22234eeea4f3SRichard Henderson #endif 22244eeea4f3SRichard Henderson #ifndef TARGET_FASYNC 2225ffa65c3bSbellard #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ 22264eeea4f3SRichard Henderson #endif 22274eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECT 2228ffa65c3bSbellard #define TARGET_O_DIRECT 040000 /* direct disk access hint */ 22294eeea4f3SRichard Henderson #endif 22304eeea4f3SRichard Henderson #ifndef TARGET_O_LARGEFILE 2231ffa65c3bSbellard #define TARGET_O_LARGEFILE 0100000 22324eeea4f3SRichard Henderson #endif 22334eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECTORY 2234ffa65c3bSbellard #define TARGET_O_DIRECTORY 0200000 /* must be a directory */ 22354eeea4f3SRichard Henderson #endif 22364eeea4f3SRichard Henderson #ifndef TARGET_O_NOFOLLOW 2237ffa65c3bSbellard #define TARGET_O_NOFOLLOW 0400000 /* don't follow links */ 2238ffa65c3bSbellard #endif 22394eeea4f3SRichard Henderson #ifndef TARGET_O_NOATIME 22404eeea4f3SRichard Henderson #define TARGET_O_NOATIME 01000000 22414eeea4f3SRichard Henderson #endif 22424eeea4f3SRichard Henderson #ifndef TARGET_O_CLOEXEC 22434eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 02000000 22444eeea4f3SRichard Henderson #endif 22454eeea4f3SRichard Henderson #ifndef TARGET___O_SYNC 22464eeea4f3SRichard Henderson #define TARGET___O_SYNC 04000000 22474eeea4f3SRichard Henderson #endif 22484eeea4f3SRichard Henderson #ifndef TARGET_O_PATH 22494eeea4f3SRichard Henderson #define TARGET_O_PATH 010000000 22504eeea4f3SRichard Henderson #endif 22514eeea4f3SRichard Henderson #ifndef TARGET_O_NDELAY 22524eeea4f3SRichard Henderson #define TARGET_O_NDELAY TARGET_O_NONBLOCK 22534eeea4f3SRichard Henderson #endif 22544eeea4f3SRichard Henderson #ifndef TARGET_O_SYNC 22554eeea4f3SRichard Henderson #define TARGET_O_SYNC (TARGET___O_SYNC | TARGET_O_DSYNC) 22564eeea4f3SRichard Henderson #endif 2257ffa65c3bSbellard 22582521d698Sbellard struct target_flock { 22592521d698Sbellard short l_type; 22602521d698Sbellard short l_whence; 2261992f48a0Sblueswir1 abi_ulong l_start; 2262992f48a0Sblueswir1 abi_ulong l_len; 22632521d698Sbellard int l_pid; 22642521d698Sbellard }; 22652521d698Sbellard 22662521d698Sbellard struct target_flock64 { 22672521d698Sbellard short l_type; 22682521d698Sbellard short l_whence; 2269*b16189b2SChen Gang #if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) \ 2270*b16189b2SChen Gang || defined(TARGET_SPARC) || defined(TARGET_HPPA) \ 2271*b16189b2SChen Gang || defined(TARGET_MICROBLAZE) || defined(TARGET_TILEGX) 2272ce3f0e2fSaurel32 int __pad; 2273ce3f0e2fSaurel32 #endif 22742521d698Sbellard unsigned long long l_start; 22752521d698Sbellard unsigned long long l_len; 22762521d698Sbellard int l_pid; 2277541dc0d4SStefan Weil } QEMU_PACKED; 22782521d698Sbellard 2279ce4defa0Spbrook #ifdef TARGET_ARM 2280ce4defa0Spbrook struct target_eabi_flock64 { 2281ce4defa0Spbrook short l_type; 2282ce4defa0Spbrook short l_whence; 2283ce4defa0Spbrook int __pad; 2284ce4defa0Spbrook unsigned long long l_start; 2285ce4defa0Spbrook unsigned long long l_len; 2286ce4defa0Spbrook int l_pid; 2287541dc0d4SStefan Weil } QEMU_PACKED; 2288ce4defa0Spbrook #endif 22892521d698Sbellard 22908d5d3004SAndreas Schwab struct target_f_owner_ex { 22918d5d3004SAndreas Schwab int type; /* Owner type of ID. */ 22928d5d3004SAndreas Schwab int pid; /* ID of owner. */ 22938d5d3004SAndreas Schwab }; 22948d5d3004SAndreas Schwab 22952521d698Sbellard /* soundcard defines */ 229667cc32ebSVeres Lajos /* XXX: convert them all to arch independent entries */ 22972521d698Sbellard #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); 22982521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 22992521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 23002521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 23012521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA 0xc0144302 23022521d698Sbellard #define TARGET_SNDCTL_COPR_RESET 0x00004300 23032521d698Sbellard #define TARGET_SNDCTL_COPR_RUN 0xc0144306 23042521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 23052521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE 0x40144305 23062521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA 0x40144304 23072521d698Sbellard #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) 23082521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) 23092521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) 23102521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) 23112521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) 23122521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) 23132521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) 23142521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) 23152521d698Sbellard #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) 23162521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) 23172521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) 23182521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) 23192521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) 23202521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) 23212521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) 23222521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) 23232521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) 23242521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) 23255f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19) 23265f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20) 23272521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e 23282521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 23292521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 23302521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 23312521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 23322521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f 23332521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 23342521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO 0xc074510c 23352521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 23362521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 23372521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 23382521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 23392521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 23402521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 23412521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 23422521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 23432521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b 23442521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a 23452521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 23462521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC 0x00005111 23472521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 23482521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET 0x00005100 23492521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 23502521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC 0x00005101 23512521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 23522521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d 23532521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d 23542521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 23552521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e 23562521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 23572521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME 0x40045407 23582521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT 0x40045408 23592521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 23602521d698Sbellard #define TARGET_SNDCTL_TMR_START 0x00005402 23612521d698Sbellard #define TARGET_SNDCTL_TMR_STOP 0x00005403 23622521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 23632521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 23642521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE 0x80045002 23652521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 23662521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS 0x80045005 23672521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 23682521d698Sbellard #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) 23692521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 23702521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) 23712521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) 23722521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) 23732521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) 23742521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) 23752521d698Sbellard 23762521d698Sbellard #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) 23772521d698Sbellard 23782521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) 23792521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) 23802521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) 23812521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) 23822521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) 23832521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) 23842521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) 23852521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) 23862521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) 23872521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) 23882521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) 23892521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) 23902521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) 23912521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) 23922521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) 23932521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) 23942521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) 23952521d698Sbellard 23962521d698Sbellard /* Obsolete macros */ 23972521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) 23982521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) 23992521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) 24002521d698Sbellard 24012521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) 24022521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) 24032521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) 24042521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) 24052521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) 24062521d698Sbellard 24072521d698Sbellard #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) 24082521d698Sbellard 24092521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) 24102521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) 24112521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) 24122521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) 24132521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) 24142521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) 24152521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) 24162521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) 24172521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) 24182521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) 24192521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) 24202521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) 24212521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) 24222521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) 24232521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) 24242521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) 24252521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) 24262521d698Sbellard 24272521d698Sbellard /* Obsolete macros */ 24282521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) 24292521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) 24302521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) 24312521d698Sbellard 24322521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) 24332521d698Sbellard 24342521d698Sbellard /* vfat ioctls */ 24352521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) 24362521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) 2437a5448a7dSbellard 24388fbd6b52Sbalrog #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct mtop) 24398fbd6b52Sbalrog #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct mtget) 24408fbd6b52Sbalrog #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct mtpos) 24418fbd6b52Sbalrog 2442a5448a7dSbellard struct target_sysinfo { 2443992f48a0Sblueswir1 abi_long uptime; /* Seconds since boot */ 2444992f48a0Sblueswir1 abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */ 2445992f48a0Sblueswir1 abi_ulong totalram; /* Total usable main memory size */ 2446992f48a0Sblueswir1 abi_ulong freeram; /* Available memory size */ 2447992f48a0Sblueswir1 abi_ulong sharedram; /* Amount of shared memory */ 2448992f48a0Sblueswir1 abi_ulong bufferram; /* Memory used by buffers */ 2449992f48a0Sblueswir1 abi_ulong totalswap; /* Total swap space size */ 2450992f48a0Sblueswir1 abi_ulong freeswap; /* swap space still available */ 2451a5448a7dSbellard unsigned short procs; /* Number of current processes */ 2452a5448a7dSbellard unsigned short pad; /* explicit padding for m68k */ 2453992f48a0Sblueswir1 abi_ulong totalhigh; /* Total high memory size */ 2454992f48a0Sblueswir1 abi_ulong freehigh; /* Available high memory size */ 2455a5448a7dSbellard unsigned int mem_unit; /* Memory unit size in bytes */ 2456992f48a0Sblueswir1 char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 2457a5448a7dSbellard }; 24583532fa74Sbellard 24596556a833Saurel32 struct linux_dirent { 24606556a833Saurel32 long d_ino; 24616556a833Saurel32 unsigned long d_off; 24626556a833Saurel32 unsigned short d_reclen; 24636556a833Saurel32 char d_name[256]; /* We must not include limits.h! */ 24646556a833Saurel32 }; 24656556a833Saurel32 24666556a833Saurel32 struct linux_dirent64 { 24676556a833Saurel32 uint64_t d_ino; 24686556a833Saurel32 int64_t d_off; 24696556a833Saurel32 unsigned short d_reclen; 24706556a833Saurel32 unsigned char d_type; 24716556a833Saurel32 char d_name[256]; 24726556a833Saurel32 }; 24736556a833Saurel32 247424e1003aSaurel32 struct target_mq_attr { 247524e1003aSaurel32 abi_long mq_flags; 247624e1003aSaurel32 abi_long mq_maxmsg; 247724e1003aSaurel32 abi_long mq_msgsize; 247824e1003aSaurel32 abi_long mq_curmsgs; 247924e1003aSaurel32 }; 248024e1003aSaurel32 24813532fa74Sbellard #include "socket.h" 2482637947f1Sths 2483637947f1Sths #include "errno_defs.h" 248403dfe9f8SRiku Voipio 248503dfe9f8SRiku Voipio #define FUTEX_WAIT 0 248603dfe9f8SRiku Voipio #define FUTEX_WAKE 1 248703dfe9f8SRiku Voipio #define FUTEX_FD 2 248803dfe9f8SRiku Voipio #define FUTEX_REQUEUE 3 248903dfe9f8SRiku Voipio #define FUTEX_CMP_REQUEUE 4 249003dfe9f8SRiku Voipio #define FUTEX_WAKE_OP 5 249103dfe9f8SRiku Voipio #define FUTEX_LOCK_PI 6 249203dfe9f8SRiku Voipio #define FUTEX_UNLOCK_PI 7 249303dfe9f8SRiku Voipio #define FUTEX_TRYLOCK_PI 8 249403dfe9f8SRiku Voipio #define FUTEX_WAIT_BITSET 9 249503dfe9f8SRiku Voipio #define FUTEX_WAKE_BITSET 10 249603dfe9f8SRiku Voipio 249703dfe9f8SRiku Voipio #define FUTEX_PRIVATE_FLAG 128 249803dfe9f8SRiku Voipio #define FUTEX_CLOCK_REALTIME 256 249903dfe9f8SRiku Voipio #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) 250003dfe9f8SRiku Voipio 25013b6edd16SPeter Maydell #ifdef CONFIG_EPOLL 25023b6edd16SPeter Maydell typedef union target_epoll_data { 25033b6edd16SPeter Maydell abi_ulong ptr; 25043b6edd16SPeter Maydell abi_ulong fd; 25053b6edd16SPeter Maydell uint32_t u32; 25063b6edd16SPeter Maydell uint64_t u64; 25073b6edd16SPeter Maydell } target_epoll_data_t; 25083b6edd16SPeter Maydell 25093b6edd16SPeter Maydell struct target_epoll_event { 25103b6edd16SPeter Maydell uint32_t events; 2511fd767832SPaul Burton #if defined(TARGET_ARM) || defined(TARGET_MIPS) || defined(TARGET_MIPS64) 2512ddaa7e5aSAlexander Graf uint32_t __pad; 2513ddaa7e5aSAlexander Graf #endif 25143b6edd16SPeter Maydell target_epoll_data_t data; 2515ddaa7e5aSAlexander Graf } QEMU_PACKED; 25163b6edd16SPeter Maydell #endif 2517163a05a8SPeter Maydell struct target_rlimit64 { 2518163a05a8SPeter Maydell uint64_t rlim_cur; 2519163a05a8SPeter Maydell uint64_t rlim_max; 2520163a05a8SPeter Maydell }; 2521583359a6SAkos PASZTORY 2522583359a6SAkos PASZTORY struct target_ucred { 2523583359a6SAkos PASZTORY uint32_t pid; 2524583359a6SAkos PASZTORY uint32_t uid; 2525583359a6SAkos PASZTORY uint32_t gid; 2526583359a6SAkos PASZTORY }; 2527cb9c377fSPaolo Bonzini 2528cb9c377fSPaolo Bonzini #endif 2529905bba13SErik de Castro Lopo 2530aecc8861SAlexander Graf typedef int32_t target_timer_t; 2531905bba13SErik de Castro Lopo 253234d60862SNatanael Copa #define TARGET_SIGEV_MAX_SIZE 64 253334d60862SNatanael Copa 253434d60862SNatanael Copa /* This is architecture-specific but most architectures use the default */ 253534d60862SNatanael Copa #ifdef TARGET_MIPS 253634d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long)) 253734d60862SNatanael Copa #else 253834d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ 253934d60862SNatanael Copa + sizeof(target_sigval_t)) 254034d60862SNatanael Copa #endif 254134d60862SNatanael Copa 254234d60862SNatanael Copa #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ 254334d60862SNatanael Copa - TARGET_SIGEV_PREAMBLE_SIZE) \ 254434d60862SNatanael Copa / sizeof(int32_t)) 254534d60862SNatanael Copa 2546905bba13SErik de Castro Lopo struct target_sigevent { 2547905bba13SErik de Castro Lopo target_sigval_t sigev_value; 2548905bba13SErik de Castro Lopo int32_t sigev_signo; 2549905bba13SErik de Castro Lopo int32_t sigev_notify; 2550905bba13SErik de Castro Lopo union { 255134d60862SNatanael Copa int32_t _pad[TARGET_SIGEV_PAD_SIZE]; 2552905bba13SErik de Castro Lopo int32_t _tid; 2553905bba13SErik de Castro Lopo 2554905bba13SErik de Castro Lopo struct { 2555905bba13SErik de Castro Lopo void (*_function)(sigval_t); 2556905bba13SErik de Castro Lopo void *_attribute; 2557905bba13SErik de Castro Lopo } _sigev_thread; 2558905bba13SErik de Castro Lopo } _sigev_un; 2559905bba13SErik de Castro Lopo }; 2560e0eb210eSPeter Maydell 2561e0eb210eSPeter Maydell struct target_user_cap_header { 2562e0eb210eSPeter Maydell uint32_t version; 2563e0eb210eSPeter Maydell int pid; 2564e0eb210eSPeter Maydell }; 2565e0eb210eSPeter Maydell 2566e0eb210eSPeter Maydell struct target_user_cap_data { 2567e0eb210eSPeter Maydell uint32_t effective; 2568e0eb210eSPeter Maydell uint32_t permitted; 2569e0eb210eSPeter Maydell uint32_t inheritable; 2570e0eb210eSPeter Maydell }; 2571