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 81b3c4fdfSMarkus Armbruster #define SYSCALL_DEFS_H 9cb9c377fSPaolo Bonzini 106180a181Sbellard #include "syscall_nr.h" 112521d698Sbellard 12ff71a454SAleksandar Markovic 13ff71a454SAleksandar Markovic /* socket operations for socketcall() */ 14ff71a454SAleksandar Markovic #define TARGET_SYS_SOCKET 1 /* socket() */ 15ff71a454SAleksandar Markovic #define TARGET_SYS_BIND 2 /* bind() */ 16ff71a454SAleksandar Markovic #define TARGET_SYS_CONNECT 3 /* connect() */ 17ff71a454SAleksandar Markovic #define TARGET_SYS_LISTEN 4 /* listen() */ 18ff71a454SAleksandar Markovic #define TARGET_SYS_ACCEPT 5 /* accept() */ 19ff71a454SAleksandar Markovic #define TARGET_SYS_GETSOCKNAME 6 /* getsockname() */ 20ff71a454SAleksandar Markovic #define TARGET_SYS_GETPEERNAME 7 /* getpeername() */ 21ff71a454SAleksandar Markovic #define TARGET_SYS_SOCKETPAIR 8 /* socketpair() */ 22ff71a454SAleksandar Markovic #define TARGET_SYS_SEND 9 /* send() */ 23ff71a454SAleksandar Markovic #define TARGET_SYS_RECV 10 /* recv() */ 24ff71a454SAleksandar Markovic #define TARGET_SYS_SENDTO 11 /* sendto() */ 25ff71a454SAleksandar Markovic #define TARGET_SYS_RECVFROM 12 /* recvfrom() */ 26ff71a454SAleksandar Markovic #define TARGET_SYS_SHUTDOWN 13 /* shutdown() */ 27ff71a454SAleksandar Markovic #define TARGET_SYS_SETSOCKOPT 14 /* setsockopt() */ 28ff71a454SAleksandar Markovic #define TARGET_SYS_GETSOCKOPT 15 /* getsockopt() */ 29ff71a454SAleksandar Markovic #define TARGET_SYS_SENDMSG 16 /* sendmsg() */ 30ff71a454SAleksandar Markovic #define TARGET_SYS_RECVMSG 17 /* recvmsg() */ 31ff71a454SAleksandar Markovic #define TARGET_SYS_ACCEPT4 18 /* accept4() */ 32ff71a454SAleksandar Markovic #define TARGET_SYS_RECVMMSG 19 /* recvmmsg() */ 33ff71a454SAleksandar Markovic #define TARGET_SYS_SENDMMSG 20 /* sendmmsg() */ 3431e31b8aSbellard 35524fa340SLaurent Vivier #define IPCOP_CALL(VERSION, OP) ((VERSION) << 16 | (OP)) 368853f86eSbellard #define IPCOP_semop 1 378853f86eSbellard #define IPCOP_semget 2 388853f86eSbellard #define IPCOP_semctl 3 398853f86eSbellard #define IPCOP_semtimedop 4 408853f86eSbellard #define IPCOP_msgsnd 11 418853f86eSbellard #define IPCOP_msgrcv 12 428853f86eSbellard #define IPCOP_msgget 13 438853f86eSbellard #define IPCOP_msgctl 14 448853f86eSbellard #define IPCOP_shmat 21 458853f86eSbellard #define IPCOP_shmdt 22 468853f86eSbellard #define IPCOP_shmget 23 478853f86eSbellard #define IPCOP_shmctl 24 488853f86eSbellard 492521d698Sbellard /* 502521d698Sbellard * The following is for compatibility across the various Linux 512521d698Sbellard * platforms. The i386 ioctl numbering scheme doesn't really enforce 522521d698Sbellard * a type field. De facto, however, the top 8 bits of the lower 16 532521d698Sbellard * bits are indeed used as a type field, so we might just as well make 542521d698Sbellard * this explicit here. Please be sure to use the decoding macros 552521d698Sbellard * below from now on. 562521d698Sbellard */ 572521d698Sbellard #define TARGET_IOC_NRBITS 8 582521d698Sbellard #define TARGET_IOC_TYPEBITS 8 592521d698Sbellard 60716f3fbeSPeter Maydell #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 61716f3fbeSPeter Maydell || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 62cd98d390SAndreas Schwab || defined(TARGET_SPARC) \ 630c866a7eSRiku Voipio || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) 6474d753acSMika Westerberg /* 16 bit uid wrappers emulation */ 6574d753acSMika Westerberg #define USE_UID16 660c866a7eSRiku Voipio #define target_id uint16_t 670c866a7eSRiku Voipio #else 680c866a7eSRiku Voipio #define target_id uint32_t 6974d753acSMika Westerberg #endif 7074d753acSMika Westerberg 71e6e5906bSpbrook #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ 72b16189b2SChen Gang || defined(TARGET_M68K) || defined(TARGET_CRIS) \ 73daa4374aSPeter Maydell || defined(TARGET_S390X) \ 74a0a839b6SMarek Vasut || defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) \ 75ba7651fbSMax Filippov || defined(TARGET_NIOS2) || defined(TARGET_RISCV) \ 76ba7651fbSMax Filippov || defined(TARGET_XTENSA) 772521d698Sbellard 782521d698Sbellard #define TARGET_IOC_SIZEBITS 14 792521d698Sbellard #define TARGET_IOC_DIRBITS 2 802521d698Sbellard 812521d698Sbellard #define TARGET_IOC_NONE 0U 822521d698Sbellard #define TARGET_IOC_WRITE 1U 832521d698Sbellard #define TARGET_IOC_READ 2U 842521d698Sbellard 85048f6b4dSbellard #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ 86b779e29eSEdgar E. Iglesias defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \ 87b779e29eSEdgar E. Iglesias defined(TARGET_MIPS) 882521d698Sbellard 892521d698Sbellard #define TARGET_IOC_SIZEBITS 13 902521d698Sbellard #define TARGET_IOC_DIRBITS 3 912521d698Sbellard 922521d698Sbellard #define TARGET_IOC_NONE 1U 932521d698Sbellard #define TARGET_IOC_READ 2U 942521d698Sbellard #define TARGET_IOC_WRITE 4U 952521d698Sbellard 96a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 97a10d1e50SRichard Henderson 98a10d1e50SRichard Henderson #define TARGET_IOC_SIZEBITS 14 99a10d1e50SRichard Henderson #define TARGET_IOC_DIRBITS 2 100a10d1e50SRichard Henderson 101a10d1e50SRichard Henderson #define TARGET_IOC_NONE 0U 102a10d1e50SRichard Henderson #define TARGET_IOC_WRITE 2U 103a10d1e50SRichard Henderson #define TARGET_IOC_READ 1U 104a10d1e50SRichard Henderson 1052521d698Sbellard #else 1062521d698Sbellard #error unsupported CPU 1072521d698Sbellard #endif 1082521d698Sbellard 1092521d698Sbellard #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) 1102521d698Sbellard #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) 1112521d698Sbellard #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) 1122521d698Sbellard #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) 1132521d698Sbellard 1142521d698Sbellard #define TARGET_IOC_NRSHIFT 0 1152521d698Sbellard #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) 1162521d698Sbellard #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) 1172521d698Sbellard #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) 1182521d698Sbellard 1192521d698Sbellard #define TARGET_IOC(dir,type,nr,size) \ 1202521d698Sbellard (((dir) << TARGET_IOC_DIRSHIFT) | \ 1212521d698Sbellard ((type) << TARGET_IOC_TYPESHIFT) | \ 1222521d698Sbellard ((nr) << TARGET_IOC_NRSHIFT) | \ 1232521d698Sbellard ((size) << TARGET_IOC_SIZESHIFT)) 1242521d698Sbellard 1252521d698Sbellard /* used to create numbers */ 1262521d698Sbellard #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) 1272521d698Sbellard #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) 1282521d698Sbellard #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1292521d698Sbellard #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1302521d698Sbellard 1312521d698Sbellard /* the size is automatically computed for these defines */ 1322521d698Sbellard #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) 1332521d698Sbellard #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1342521d698Sbellard #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1352521d698Sbellard 1367854b056Sbellard struct target_sockaddr { 1377854b056Sbellard uint16_t sa_family; 1387854b056Sbellard uint8_t sa_data[14]; 1397854b056Sbellard }; 1407854b056Sbellard 14133a29b51SJoakim Tjernlund struct target_sockaddr_ll { 14233a29b51SJoakim Tjernlund uint16_t sll_family; /* Always AF_PACKET */ 14333a29b51SJoakim Tjernlund uint16_t sll_protocol; /* Physical layer protocol */ 14433a29b51SJoakim Tjernlund int sll_ifindex; /* Interface number */ 14533a29b51SJoakim Tjernlund uint16_t sll_hatype; /* ARP hardware type */ 14633a29b51SJoakim Tjernlund uint8_t sll_pkttype; /* Packet type */ 14733a29b51SJoakim Tjernlund uint8_t sll_halen; /* Length of address */ 14833a29b51SJoakim Tjernlund uint8_t sll_addr[8]; /* Physical layer address */ 14933a29b51SJoakim Tjernlund }; 15033a29b51SJoakim Tjernlund 151fb3aabf3SLaurent Vivier struct target_sockaddr_un { 152fb3aabf3SLaurent Vivier uint16_t su_family; 153fb3aabf3SLaurent Vivier uint8_t sun_path[108]; 154fb3aabf3SLaurent Vivier }; 155fb3aabf3SLaurent Vivier 156fb3aabf3SLaurent Vivier struct target_in_addr { 157fb3aabf3SLaurent Vivier uint32_t s_addr; /* big endian */ 158fb3aabf3SLaurent Vivier }; 159fb3aabf3SLaurent Vivier 160fb3aabf3SLaurent Vivier struct target_sockaddr_in { 161fb3aabf3SLaurent Vivier uint16_t sin_family; 162fb3aabf3SLaurent Vivier int16_t sin_port; /* big endian */ 163fb3aabf3SLaurent Vivier struct target_in_addr sin_addr; 164fb3aabf3SLaurent Vivier uint8_t __pad[sizeof(struct target_sockaddr) - 165fb3aabf3SLaurent Vivier sizeof(uint16_t) - sizeof(int16_t) - 166fb3aabf3SLaurent Vivier sizeof(struct target_in_addr)]; 167fb3aabf3SLaurent Vivier }; 168fb3aabf3SLaurent Vivier 169ee1ac3a1SHelge Deller struct target_sockaddr_in6 { 170ee1ac3a1SHelge Deller uint16_t sin6_family; 171ee1ac3a1SHelge Deller uint16_t sin6_port; /* big endian */ 172ee1ac3a1SHelge Deller uint32_t sin6_flowinfo; /* big endian */ 173ee1ac3a1SHelge Deller struct in6_addr sin6_addr; /* IPv6 address, big endian */ 174ee1ac3a1SHelge Deller uint32_t sin6_scope_id; 175ee1ac3a1SHelge Deller }; 176ee1ac3a1SHelge Deller 177f57d4192SLaurent Vivier struct target_sock_filter { 178f57d4192SLaurent Vivier abi_ushort code; 179f57d4192SLaurent Vivier uint8_t jt; 180f57d4192SLaurent Vivier uint8_t jf; 181f57d4192SLaurent Vivier abi_uint k; 182f57d4192SLaurent Vivier }; 183f57d4192SLaurent Vivier 184f57d4192SLaurent Vivier struct target_sock_fprog { 185f57d4192SLaurent Vivier abi_ushort len; 186f57d4192SLaurent Vivier abi_ulong filter; 187f57d4192SLaurent Vivier }; 188f57d4192SLaurent Vivier 189b975b83bSLionel Landwerlin struct target_ip_mreq { 190b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 191b975b83bSLionel Landwerlin struct target_in_addr imr_address; 192b975b83bSLionel Landwerlin }; 193b975b83bSLionel Landwerlin 194b975b83bSLionel Landwerlin struct target_ip_mreqn { 195b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 196b975b83bSLionel Landwerlin struct target_in_addr imr_address; 197b975b83bSLionel Landwerlin abi_long imr_ifindex; 198b975b83bSLionel Landwerlin }; 199b975b83bSLionel Landwerlin 2006e3cb58fSLionel Landwerlin struct target_ip_mreq_source { 2016e3cb58fSLionel Landwerlin /* big endian */ 2026e3cb58fSLionel Landwerlin uint32_t imr_multiaddr; 2036e3cb58fSLionel Landwerlin uint32_t imr_interface; 2046e3cb58fSLionel Landwerlin uint32_t imr_sourceaddr; 2056e3cb58fSLionel Landwerlin }; 2066e3cb58fSLionel Landwerlin 20783eb6e50SCarlo Marcelo Arenas Belón struct target_linger { 20883eb6e50SCarlo Marcelo Arenas Belón abi_int l_onoff; /* Linger active */ 20983eb6e50SCarlo Marcelo Arenas Belón abi_int l_linger; /* How long to linger for */ 21083eb6e50SCarlo Marcelo Arenas Belón }; 21183eb6e50SCarlo Marcelo Arenas Belón 2126d5d5ddeSDaniel P. Berrangé #if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 2136d5d5ddeSDaniel P. Berrangé struct target_timeval { 2146d5d5ddeSDaniel P. Berrangé abi_long tv_sec; 2156d5d5ddeSDaniel P. Berrangé abi_int tv_usec; 2166d5d5ddeSDaniel P. Berrangé }; 2176d5d5ddeSDaniel P. Berrangé #define target__kernel_sock_timeval target_timeval 2186d5d5ddeSDaniel P. Berrangé #else 21931e31b8aSbellard struct target_timeval { 220992f48a0Sblueswir1 abi_long tv_sec; 221992f48a0Sblueswir1 abi_long tv_usec; 22231e31b8aSbellard }; 22331e31b8aSbellard 2246d5d5ddeSDaniel P. Berrangé struct target__kernel_sock_timeval { 2256d5d5ddeSDaniel P. Berrangé abi_llong tv_sec; 2266d5d5ddeSDaniel P. Berrangé abi_llong tv_usec; 2276d5d5ddeSDaniel P. Berrangé }; 2286d5d5ddeSDaniel P. Berrangé #endif 2296d5d5ddeSDaniel P. Berrangé 2301b6b029eSbellard struct target_timespec { 231992f48a0Sblueswir1 abi_long tv_sec; 232992f48a0Sblueswir1 abi_long tv_nsec; 2331b6b029eSbellard }; 2341b6b029eSbellard 2356d5d5ddeSDaniel P. Berrangé struct target__kernel_timespec { 2366d5d5ddeSDaniel P. Berrangé abi_llong tv_sec; 2376d5d5ddeSDaniel P. Berrangé abi_llong tv_nsec; 2386d5d5ddeSDaniel P. Berrangé }; 2396d5d5ddeSDaniel P. Berrangé 240ef4467e9SPaul Burton struct target_timezone { 241ef4467e9SPaul Burton abi_int tz_minuteswest; 242ef4467e9SPaul Burton abi_int tz_dsttime; 243ef4467e9SPaul Burton }; 244ef4467e9SPaul Burton 24566fb9763Sbellard struct target_itimerval { 24666fb9763Sbellard struct target_timeval it_interval; 24766fb9763Sbellard struct target_timeval it_value; 24866fb9763Sbellard }; 24966fb9763Sbellard 250905bba13SErik de Castro Lopo struct target_itimerspec { 251905bba13SErik de Castro Lopo struct target_timespec it_interval; 252905bba13SErik de Castro Lopo struct target_timespec it_value; 253905bba13SErik de Castro Lopo }; 254905bba13SErik de Castro Lopo 25519f59bceSAleksandar Markovic struct target_timex { 25619f59bceSAleksandar Markovic abi_uint modes; /* Mode selector */ 25719f59bceSAleksandar Markovic abi_long offset; /* Time offset */ 25819f59bceSAleksandar Markovic abi_long freq; /* Frequency offset */ 25919f59bceSAleksandar Markovic abi_long maxerror; /* Maximum error (microseconds) */ 26019f59bceSAleksandar Markovic abi_long esterror; /* Estimated error (microseconds) */ 26119f59bceSAleksandar Markovic abi_int status; /* Clock command/status */ 26219f59bceSAleksandar Markovic abi_long constant; /* PLL (phase-locked loop) time constant */ 26319f59bceSAleksandar Markovic abi_long precision; /* Clock precision (microseconds, ro) */ 26419f59bceSAleksandar Markovic abi_long tolerance; /* Clock freq. tolerance (ppm, ro) */ 26519f59bceSAleksandar Markovic struct target_timeval time; /* Current time */ 26619f59bceSAleksandar Markovic abi_long tick; /* Microseconds between clock ticks */ 26719f59bceSAleksandar Markovic abi_long ppsfreq; /* PPS (pulse per second) frequency */ 26819f59bceSAleksandar Markovic abi_long jitter; /* PPS jitter (ro); nanoseconds */ 26919f59bceSAleksandar Markovic abi_int shift; /* PPS interval duration (seconds) */ 27019f59bceSAleksandar Markovic abi_long stabil; /* PPS stability */ 27119f59bceSAleksandar Markovic abi_long jitcnt; /* PPS jitter limit exceeded (ro) */ 27219f59bceSAleksandar Markovic abi_long calcnt; /* PPS calibration intervals */ 27319f59bceSAleksandar Markovic abi_long errcnt; /* PPS calibration errors */ 27419f59bceSAleksandar Markovic abi_long stbcnt; /* PPS stability limit exceeded */ 27519f59bceSAleksandar Markovic abi_int tai; /* TAI offset */ 27619f59bceSAleksandar Markovic 27719f59bceSAleksandar Markovic /* Further padding bytes to allow for future expansion */ 27819f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; abi_int:32; 27919f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; abi_int:32; 28019f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; 28119f59bceSAleksandar Markovic }; 28219f59bceSAleksandar Markovic 283c227f099SAnthony Liguori typedef abi_long target_clock_t; 28432f36bceSbellard 285c596ed17Sbellard #define TARGET_HZ 100 286c596ed17Sbellard 28732f36bceSbellard struct target_tms { 288c227f099SAnthony Liguori target_clock_t tms_utime; 289c227f099SAnthony Liguori target_clock_t tms_stime; 290c227f099SAnthony Liguori target_clock_t tms_cutime; 291c227f099SAnthony Liguori target_clock_t tms_cstime; 29232f36bceSbellard }; 29332f36bceSbellard 2946180a181Sbellard struct target_utimbuf { 295992f48a0Sblueswir1 abi_long actime; 296992f48a0Sblueswir1 abi_long modtime; 2976180a181Sbellard }; 2986180a181Sbellard 299f2674e31Sbellard struct target_sel_arg_struct { 300992f48a0Sblueswir1 abi_long n; 301992f48a0Sblueswir1 abi_long inp, outp, exp; 302992f48a0Sblueswir1 abi_long tvp; 303f2674e31Sbellard }; 304f2674e31Sbellard 30531e31b8aSbellard struct target_iovec { 306992f48a0Sblueswir1 abi_long iov_base; /* Starting address */ 307992f48a0Sblueswir1 abi_long iov_len; /* Number of bytes */ 30831e31b8aSbellard }; 30931e31b8aSbellard 3101a9353d2Sbellard struct target_msghdr { 311992f48a0Sblueswir1 abi_long msg_name; /* Socket name */ 3121a9353d2Sbellard int msg_namelen; /* Length of name */ 313992f48a0Sblueswir1 abi_long msg_iov; /* Data blocks */ 314992f48a0Sblueswir1 abi_long msg_iovlen; /* Number of blocks */ 315992f48a0Sblueswir1 abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ 316992f48a0Sblueswir1 abi_long msg_controllen; /* Length of cmsg list */ 3171a9353d2Sbellard unsigned int msg_flags; 3181a9353d2Sbellard }; 3191a9353d2Sbellard 3207854b056Sbellard struct target_cmsghdr { 321992f48a0Sblueswir1 abi_long cmsg_len; 3227854b056Sbellard int cmsg_level; 3237854b056Sbellard int cmsg_type; 3247854b056Sbellard }; 3257854b056Sbellard 3267854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) 327ee104587SJonathan Neuschäfer #define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \ 328ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start) 329992f48a0Sblueswir1 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ 330992f48a0Sblueswir1 & (size_t) ~(sizeof (abi_long) - 1)) 331ad762b99SPeter Maydell #define TARGET_CMSG_SPACE(len) (sizeof(struct target_cmsghdr) + \ 332ad762b99SPeter Maydell TARGET_CMSG_ALIGN(len)) 333ad762b99SPeter Maydell #define TARGET_CMSG_LEN(len) (sizeof(struct target_cmsghdr) + (len)) 3347854b056Sbellard 3357854b056Sbellard static __inline__ struct target_cmsghdr * 336ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(struct target_msghdr *__mhdr, 337ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg, 338ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg_start) 3397854b056Sbellard { 3402b8bdefcSths struct target_cmsghdr *__ptr; 3417854b056Sbellard 3422b8bdefcSths __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg 343cbb21eedSMatthias Braun + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len))); 344ee104587SJonathan Neuschäfer if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start) 345ee104587SJonathan Neuschäfer > tswapal(__mhdr->msg_controllen)) { 3467854b056Sbellard /* No more entries. */ 3472b8bdefcSths return (struct target_cmsghdr *)0; 348ee104587SJonathan Neuschäfer } 349ee104587SJonathan Neuschäfer return __ptr; 3507854b056Sbellard } 3517854b056Sbellard 352f19e00d7SAlexander Graf struct target_mmsghdr { 353f19e00d7SAlexander Graf struct target_msghdr msg_hdr; /* Message header */ 354f19e00d7SAlexander Graf unsigned int msg_len; /* Number of bytes transmitted */ 355f19e00d7SAlexander Graf }; 3567854b056Sbellard 35731e31b8aSbellard struct target_rusage { 35831e31b8aSbellard struct target_timeval ru_utime; /* user time used */ 35931e31b8aSbellard struct target_timeval ru_stime; /* system time used */ 360992f48a0Sblueswir1 abi_long ru_maxrss; /* maximum resident set size */ 361992f48a0Sblueswir1 abi_long ru_ixrss; /* integral shared memory size */ 362992f48a0Sblueswir1 abi_long ru_idrss; /* integral unshared data size */ 363992f48a0Sblueswir1 abi_long ru_isrss; /* integral unshared stack size */ 364992f48a0Sblueswir1 abi_long ru_minflt; /* page reclaims */ 365992f48a0Sblueswir1 abi_long ru_majflt; /* page faults */ 366992f48a0Sblueswir1 abi_long ru_nswap; /* swaps */ 367992f48a0Sblueswir1 abi_long ru_inblock; /* block input operations */ 368992f48a0Sblueswir1 abi_long ru_oublock; /* block output operations */ 369992f48a0Sblueswir1 abi_long ru_msgsnd; /* messages sent */ 370992f48a0Sblueswir1 abi_long ru_msgrcv; /* messages received */ 371992f48a0Sblueswir1 abi_long ru_nsignals; /* signals received */ 372992f48a0Sblueswir1 abi_long ru_nvcsw; /* voluntary context switches */ 373992f48a0Sblueswir1 abi_long ru_nivcsw; /* involuntary " */ 37431e31b8aSbellard }; 37531e31b8aSbellard 37631e31b8aSbellard typedef struct { 37731e31b8aSbellard int val[2]; 378c227f099SAnthony Liguori } kernel_fsid_t; 37931e31b8aSbellard 380dab2ed99Sbellard struct target_dirent { 381992f48a0Sblueswir1 abi_long d_ino; 382992f48a0Sblueswir1 abi_long d_off; 383dab2ed99Sbellard unsigned short d_reclen; 384333858b7SDmitry V. Levin char d_name[]; 385dab2ed99Sbellard }; 386dab2ed99Sbellard 387dab2ed99Sbellard struct target_dirent64 { 388dab2ed99Sbellard uint64_t d_ino; 389dab2ed99Sbellard int64_t d_off; 390dab2ed99Sbellard unsigned short d_reclen; 391dab2ed99Sbellard unsigned char d_type; 392dab2ed99Sbellard char d_name[256]; 393dab2ed99Sbellard }; 394dab2ed99Sbellard 395dab2ed99Sbellard 39631e31b8aSbellard /* mostly generic signal stuff */ 397992f48a0Sblueswir1 #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ 398992f48a0Sblueswir1 #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ 399992f48a0Sblueswir1 #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ 40031e31b8aSbellard 40131e31b8aSbellard #ifdef TARGET_MIPS 40231e31b8aSbellard #define TARGET_NSIG 128 40331e31b8aSbellard #else 40431e31b8aSbellard #define TARGET_NSIG 64 40531e31b8aSbellard #endif 406992f48a0Sblueswir1 #define TARGET_NSIG_BPW TARGET_ABI_BITS 40731e31b8aSbellard #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) 40831e31b8aSbellard 40931e31b8aSbellard typedef struct { 410992f48a0Sblueswir1 abi_ulong sig[TARGET_NSIG_WORDS]; 411c227f099SAnthony Liguori } target_sigset_t; 41231e31b8aSbellard 41366fb9763Sbellard #ifdef BSWAP_NEEDED 414c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 41566fb9763Sbellard { 41666fb9763Sbellard int i; 41766fb9763Sbellard for(i = 0;i < TARGET_NSIG_WORDS; i++) 418cbb21eedSMatthias Braun d->sig[i] = tswapal(s->sig[i]); 41966fb9763Sbellard } 42066fb9763Sbellard #else 421c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 42266fb9763Sbellard { 42366fb9763Sbellard *d = *s; 42466fb9763Sbellard } 42566fb9763Sbellard #endif 42666fb9763Sbellard 427c227f099SAnthony Liguori static inline void target_siginitset(target_sigset_t *d, abi_ulong set) 42866fb9763Sbellard { 42966fb9763Sbellard int i; 43066fb9763Sbellard d->sig[0] = set; 43166fb9763Sbellard for(i = 1;i < TARGET_NSIG_WORDS; i++) 43266fb9763Sbellard d->sig[i] = 0; 43366fb9763Sbellard } 43466fb9763Sbellard 435c227f099SAnthony Liguori void host_to_target_sigset(target_sigset_t *d, const sigset_t *s); 436c227f099SAnthony Liguori void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); 437992f48a0Sblueswir1 void host_to_target_old_sigset(abi_ulong *old_sigset, 43866fb9763Sbellard const sigset_t *sigset); 43966fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset, 440992f48a0Sblueswir1 const abi_ulong *old_sigset); 44166fb9763Sbellard struct target_sigaction; 44266fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act, 44366fb9763Sbellard struct target_sigaction *oact); 44466fb9763Sbellard 4459850f9f6SLaurent Vivier #include "target_signal.h" 4469850f9f6SLaurent Vivier 4477f047de1SRichard Henderson #ifdef TARGET_SA_RESTORER 4487f047de1SRichard Henderson #define TARGET_ARCH_HAS_SA_RESTORER 1 4497f047de1SRichard Henderson #endif 4507f047de1SRichard Henderson 4516049f4f8SRichard Henderson #if defined(TARGET_ALPHA) 4526049f4f8SRichard Henderson struct target_old_sigaction { 4536049f4f8SRichard Henderson abi_ulong _sa_handler; 4546049f4f8SRichard Henderson abi_ulong sa_mask; 455d2565875SRichard Henderson int32_t sa_flags; 4566049f4f8SRichard Henderson }; 457106ec879Sbellard 4586049f4f8SRichard Henderson struct target_rt_sigaction { 4596049f4f8SRichard Henderson abi_ulong _sa_handler; 4606049f4f8SRichard Henderson abi_ulong sa_flags; 4616049f4f8SRichard Henderson target_sigset_t sa_mask; 4626049f4f8SRichard Henderson }; 4636049f4f8SRichard Henderson 4646049f4f8SRichard Henderson /* This is the struct used inside the kernel. The ka_restorer 4656049f4f8SRichard Henderson field comes from the 5th argument to sys_rt_sigaction. */ 4666049f4f8SRichard Henderson struct target_sigaction { 4676049f4f8SRichard Henderson abi_ulong _sa_handler; 4686049f4f8SRichard Henderson abi_ulong sa_flags; 4696049f4f8SRichard Henderson target_sigset_t sa_mask; 4706049f4f8SRichard Henderson abi_ulong sa_restorer; 4716049f4f8SRichard Henderson }; 4726049f4f8SRichard Henderson #elif defined(TARGET_MIPS) 473106ec879Sbellard struct target_sigaction { 474540635baSths uint32_t sa_flags; 475d26bc211Sths #if defined(TARGET_ABI_MIPSN32) 476540635baSths uint32_t _sa_handler; 477540635baSths #else 478992f48a0Sblueswir1 abi_ulong _sa_handler; 479540635baSths #endif 480c227f099SAnthony Liguori target_sigset_t sa_mask; 4817f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 4827f047de1SRichard Henderson /* ??? This is always present, but ignored unless O32. */ 4837f047de1SRichard Henderson abi_ulong sa_restorer; 4847f047de1SRichard Henderson #endif 485106ec879Sbellard }; 486106ec879Sbellard #else 4872521d698Sbellard struct target_old_sigaction { 488992f48a0Sblueswir1 abi_ulong _sa_handler; 489992f48a0Sblueswir1 abi_ulong sa_mask; 490992f48a0Sblueswir1 abi_ulong sa_flags; 4917f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 492992f48a0Sblueswir1 abi_ulong sa_restorer; 4937f047de1SRichard Henderson #endif 4942521d698Sbellard }; 4952521d698Sbellard 4962521d698Sbellard struct target_sigaction { 497992f48a0Sblueswir1 abi_ulong _sa_handler; 498992f48a0Sblueswir1 abi_ulong sa_flags; 4997f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 500992f48a0Sblueswir1 abi_ulong sa_restorer; 5017f047de1SRichard Henderson #endif 502c227f099SAnthony Liguori target_sigset_t sa_mask; 5035de154e8SLaurent Vivier #ifdef TARGET_ARCH_HAS_KA_RESTORER 5045de154e8SLaurent Vivier abi_ulong ka_restorer; 5055de154e8SLaurent Vivier #endif 5062521d698Sbellard }; 507106ec879Sbellard #endif 5082521d698Sbellard 5092521d698Sbellard typedef union target_sigval { 5102521d698Sbellard int sival_int; 511992f48a0Sblueswir1 abi_ulong sival_ptr; 512c227f099SAnthony Liguori } target_sigval_t; 5136d5e216dSbellard #if 0 5146d5e216dSbellard #if defined (TARGET_SPARC) 5156d5e216dSbellard typedef struct { 5166d5e216dSbellard struct { 517992f48a0Sblueswir1 abi_ulong psr; 518992f48a0Sblueswir1 abi_ulong pc; 519992f48a0Sblueswir1 abi_ulong npc; 520992f48a0Sblueswir1 abi_ulong y; 521992f48a0Sblueswir1 abi_ulong u_regs[16]; /* globals and ins */ 5226d5e216dSbellard } si_regs; 5236d5e216dSbellard int si_mask; 5246d5e216dSbellard } __siginfo_t; 5256d5e216dSbellard 5266d5e216dSbellard typedef struct { 5276d5e216dSbellard unsigned long si_float_regs [32]; 5286d5e216dSbellard unsigned long si_fsr; 5296d5e216dSbellard unsigned long si_fpqdepth; 5306d5e216dSbellard struct { 5316d5e216dSbellard unsigned long *insn_addr; 5326d5e216dSbellard unsigned long insn; 5336d5e216dSbellard } si_fpqueue [16]; 5346d5e216dSbellard } __siginfo_fpu_t; 5356d5e216dSbellard #endif 5366d5e216dSbellard #endif 5372521d698Sbellard 5382521d698Sbellard #define TARGET_SI_MAX_SIZE 128 539aa5e03d2SMaxim Ostapenko 540aa5e03d2SMaxim Ostapenko #if TARGET_ABI_BITS == 32 541aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int)) 542aa5e03d2SMaxim Ostapenko #else 543aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int)) 544aa5e03d2SMaxim Ostapenko #endif 545aa5e03d2SMaxim Ostapenko 546aa5e03d2SMaxim Ostapenko #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int)) 5472521d698Sbellard 548a70dadc7SPeter Maydell /* Within QEMU the top 16 bits of si_code indicate which of the parts of 549a70dadc7SPeter Maydell * the union in target_siginfo is valid. This only applies between 550a70dadc7SPeter Maydell * host_to_target_siginfo_noswap() and tswap_siginfo(); it does not 551a70dadc7SPeter Maydell * appear either within host siginfo_t or in target_siginfo structures 552a70dadc7SPeter Maydell * which we get from the guest userspace program. (The Linux kernel 553a70dadc7SPeter Maydell * does a similar thing with using the top bits for its own internal 554a70dadc7SPeter Maydell * purposes but not letting them be visible to userspace.) 555a70dadc7SPeter Maydell */ 556a70dadc7SPeter Maydell #define QEMU_SI_KILL 0 557a70dadc7SPeter Maydell #define QEMU_SI_TIMER 1 558a70dadc7SPeter Maydell #define QEMU_SI_POLL 2 559a70dadc7SPeter Maydell #define QEMU_SI_FAULT 3 560a70dadc7SPeter Maydell #define QEMU_SI_CHLD 4 561a70dadc7SPeter Maydell #define QEMU_SI_RT 5 562a70dadc7SPeter Maydell 5632521d698Sbellard typedef struct target_siginfo { 5643f53d546Spbrook #ifdef TARGET_MIPS 5653f53d546Spbrook int si_signo; 5663f53d546Spbrook int si_code; 5673f53d546Spbrook int si_errno; 5683f53d546Spbrook #else 5692521d698Sbellard int si_signo; 5702521d698Sbellard int si_errno; 5712521d698Sbellard int si_code; 5723f53d546Spbrook #endif 5732521d698Sbellard 5742521d698Sbellard union { 5752521d698Sbellard int _pad[TARGET_SI_PAD_SIZE]; 5762521d698Sbellard 5772521d698Sbellard /* kill() */ 5782521d698Sbellard struct { 5792521d698Sbellard pid_t _pid; /* sender's pid */ 5802521d698Sbellard uid_t _uid; /* sender's uid */ 5812521d698Sbellard } _kill; 5822521d698Sbellard 5832521d698Sbellard /* POSIX.1b timers */ 5842521d698Sbellard struct { 5852521d698Sbellard unsigned int _timer1; 5862521d698Sbellard unsigned int _timer2; 5872521d698Sbellard } _timer; 5882521d698Sbellard 5892521d698Sbellard /* POSIX.1b signals */ 5902521d698Sbellard struct { 5912521d698Sbellard pid_t _pid; /* sender's pid */ 5922521d698Sbellard uid_t _uid; /* sender's uid */ 593c227f099SAnthony Liguori target_sigval_t _sigval; 5942521d698Sbellard } _rt; 5952521d698Sbellard 5962521d698Sbellard /* SIGCHLD */ 5972521d698Sbellard struct { 5982521d698Sbellard pid_t _pid; /* which child */ 5992521d698Sbellard uid_t _uid; /* sender's uid */ 6002521d698Sbellard int _status; /* exit code */ 601c227f099SAnthony Liguori target_clock_t _utime; 602c227f099SAnthony Liguori target_clock_t _stime; 6032521d698Sbellard } _sigchld; 6042521d698Sbellard 6052521d698Sbellard /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 6062521d698Sbellard struct { 607992f48a0Sblueswir1 abi_ulong _addr; /* faulting insn/memory ref. */ 6082521d698Sbellard } _sigfault; 6092521d698Sbellard 6102521d698Sbellard /* SIGPOLL */ 6112521d698Sbellard struct { 6122521d698Sbellard int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 6132521d698Sbellard int _fd; 6142521d698Sbellard } _sigpoll; 6152521d698Sbellard } _sifields; 616c227f099SAnthony Liguori } target_siginfo_t; 6172521d698Sbellard 6182521d698Sbellard /* 6192521d698Sbellard * si_code values 6202521d698Sbellard * Digital reserves positive values for kernel-generated signals. 6212521d698Sbellard */ 6222521d698Sbellard #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ 6232521d698Sbellard #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 6242521d698Sbellard #define TARGET_SI_QUEUE -1 /* sent by sigqueue */ 6252521d698Sbellard #define TARGET_SI_TIMER -2 /* sent by timer expiration */ 6262521d698Sbellard #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ 6272521d698Sbellard #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ 6282521d698Sbellard #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ 6292521d698Sbellard 6302521d698Sbellard /* 6312521d698Sbellard * SIGILL si_codes 6322521d698Sbellard */ 633ffa65c3bSbellard #define TARGET_ILL_ILLOPC (1) /* illegal opcode */ 6342521d698Sbellard #define TARGET_ILL_ILLOPN (2) /* illegal operand */ 635ffa65c3bSbellard #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ 636ffa65c3bSbellard #define TARGET_ILL_ILLTRP (4) /* illegal trap */ 637ffa65c3bSbellard #define TARGET_ILL_PRVOPC (5) /* privileged opcode */ 638ffa65c3bSbellard #define TARGET_ILL_PRVREG (6) /* privileged register */ 639ffa65c3bSbellard #define TARGET_ILL_COPROC (7) /* coprocessor error */ 640ffa65c3bSbellard #define TARGET_ILL_BADSTK (8) /* internal stack error */ 641de2fdd56SChen Gang #ifdef TARGET_TILEGX 642de2fdd56SChen Gang #define TARGET_ILL_DBLFLT (9) /* double fault */ 643de2fdd56SChen Gang #define TARGET_ILL_HARDWALL (10) /* user networks hardwall violation */ 644de2fdd56SChen Gang #endif 6452521d698Sbellard 6462521d698Sbellard /* 6472521d698Sbellard * SIGFPE si_codes 6482521d698Sbellard */ 6492521d698Sbellard #define TARGET_FPE_INTDIV (1) /* integer divide by zero */ 6502521d698Sbellard #define TARGET_FPE_INTOVF (2) /* integer overflow */ 6512521d698Sbellard #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ 6522521d698Sbellard #define TARGET_FPE_FLTOVF (4) /* floating point overflow */ 6532521d698Sbellard #define TARGET_FPE_FLTUND (5) /* floating point underflow */ 6542521d698Sbellard #define TARGET_FPE_FLTRES (6) /* floating point inexact result */ 6552521d698Sbellard #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ 6562521d698Sbellard #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ 65721ba8564SRichard Henderson #define TARGET_FPE_FLTUNK (14) /* undiagnosed fp exception */ 65821ba8564SRichard Henderson #define TARGET_NSIGFPE 15 6592521d698Sbellard 6602521d698Sbellard /* 6612521d698Sbellard * SIGSEGV si_codes 6622521d698Sbellard */ 6632521d698Sbellard #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ 6642521d698Sbellard #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ 665de2fdd56SChen Gang #define TARGET_SEGV_BNDERR (3) /* failed address bound checks */ 6662521d698Sbellard 6672521d698Sbellard /* 668ffa65c3bSbellard * SIGBUS si_codes 669ffa65c3bSbellard */ 670ffa65c3bSbellard #define TARGET_BUS_ADRALN (1) /* invalid address alignment */ 671b4916d7bSDong Xu Wang #define TARGET_BUS_ADRERR (2) /* non-existent physical address */ 672ffa65c3bSbellard #define TARGET_BUS_OBJERR (3) /* object specific hardware error */ 673de2fdd56SChen Gang /* hardware memory error consumed on a machine check: action required */ 674de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AR (4) 675de2fdd56SChen Gang /* hardware memory error detected in process but not consumed: action optional*/ 676de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AO (5) 677ffa65c3bSbellard 678ffa65c3bSbellard /* 6792521d698Sbellard * SIGTRAP si_codes 6802521d698Sbellard */ 6812521d698Sbellard #define TARGET_TRAP_BRKPT (1) /* process breakpoint */ 6822521d698Sbellard #define TARGET_TRAP_TRACE (2) /* process trace trap */ 683de2fdd56SChen Gang #define TARGET_TRAP_BRANCH (3) /* process taken branch trap */ 684de2fdd56SChen Gang #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */ 6852521d698Sbellard 6869de5e440Sbellard struct target_rlimit { 687992f48a0Sblueswir1 abi_ulong rlim_cur; 688992f48a0Sblueswir1 abi_ulong rlim_max; 6899de5e440Sbellard }; 6909de5e440Sbellard 69181bbe906Stakasi-y@ops.dti.ne.jp #if defined(TARGET_ALPHA) 692e476492eSAurelien Jarno #define TARGET_RLIM_INFINITY 0x7fffffffffffffffull 6936cafd027SMatthias Braun #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32) 69481bbe906Stakasi-y@ops.dti.ne.jp #define TARGET_RLIM_INFINITY 0x7fffffffUL 69581bbe906Stakasi-y@ops.dti.ne.jp #else 69626b746dbSMatthias Braun #define TARGET_RLIM_INFINITY ((abi_ulong)-1) 69781bbe906Stakasi-y@ops.dti.ne.jp #endif 69881bbe906Stakasi-y@ops.dti.ne.jp 699e22b7015SWesley W. Terpstra #if defined(TARGET_MIPS) 700e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 701e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 702e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 703e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 704e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 705e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 7 706e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 8 707e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 5 708e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 9 709e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 6 710e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 711e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 712e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 713e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 714e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 715e22b7015SWesley W. Terpstra #else 716e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 717e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 718e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 719e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 720e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 721e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 5 7226cafd027SMatthias Braun #if defined(TARGET_SPARC) 7236cafd027SMatthias Braun #define TARGET_RLIMIT_NOFILE 6 7246cafd027SMatthias Braun #define TARGET_RLIMIT_NPROC 7 7256cafd027SMatthias Braun #else 726e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 6 727e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 7 7286cafd027SMatthias Braun #endif 729e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 8 730e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 9 731e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 732e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 733e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 734e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 735e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 736e22b7015SWesley W. Terpstra #endif 737e22b7015SWesley W. Terpstra 7389de5e440Sbellard struct target_pollfd { 7399de5e440Sbellard int fd; /* file descriptor */ 7409de5e440Sbellard short events; /* requested events */ 7419de5e440Sbellard short revents; /* returned events */ 7429de5e440Sbellard }; 7439de5e440Sbellard 7448e5a0667Sbellard /* virtual terminal ioctls */ 7450221cfcdSbellard #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ 7460221cfcdSbellard #define TARGET_KDMKTONE 0x4B30 /* generate tone */ 7478e5a0667Sbellard #define TARGET_KDGKBTYPE 0x4b33 748f7680a55SUlrich Hecht #define TARGET_KDSETMODE 0x4b3a 749f7680a55SUlrich Hecht #define TARGET_KDGKBMODE 0x4b44 750f7680a55SUlrich Hecht #define TARGET_KDSKBMODE 0x4b45 7510221cfcdSbellard #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ 7520221cfcdSbellard #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ 753e6fe18fbSCédric VINCENT #define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ 754e6fe18fbSCédric VINCENT #define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ 755e6fe18fbSCédric VINCENT #define TARGET_KDGETLED 0x4B31 /* return current led state */ 756e6fe18fbSCédric VINCENT #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */ 757ca56f5b5SPaul Burton #define TARGET_KDSIGACCEPT 0x4B4E 7588e5a0667Sbellard 759d14eabbeSAleksandar Markovic #if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) || \ 760d14eabbeSAleksandar Markovic defined(TARGET_XTENSA) 761e1be1606SAleksandar Markovic #define TARGET_SIOCATMARK TARGET_IOR('s', 7, int) 762c495a793SAleksandar Markovic #define TARGET_SIOCSPGRP TARGET_IOW('s', 8, pid_t) 763405b4915SHelge Deller #define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t) 764e1be1606SAleksandar Markovic #else 7652521d698Sbellard #define TARGET_SIOCATMARK 0x8905 766c495a793SAleksandar Markovic #define TARGET_SIOCSPGRP 0x8902 767405b4915SHelge Deller #define TARGET_SIOCGPGRP 0x8904 768e1be1606SAleksandar Markovic #endif 769c495a793SAleksandar Markovic 7706d5d5ddeSDaniel P. Berrangé #if defined(TARGET_SH4) 7716d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMP_OLD TARGET_IOR('s', 100, struct target_timeval) 7726d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMPNS_OLD TARGET_IOR('s', 101, struct target_timespec) 7736d5d5ddeSDaniel P. Berrangé #else 7746d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMP_OLD 0x8906 7756d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMPNS_OLD 0x8907 7766d5d5ddeSDaniel P. Berrangé #endif 7776d5d5ddeSDaniel P. Berrangé 7786d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMP_NEW TARGET_IOR(0x89, 0x06, abi_llong[2]) 7796d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMPNS_NEW TARGET_IOR(0x89, 0x07, abi_llong[2]) 7802521d698Sbellard 78131e31b8aSbellard /* Networking ioctls */ 78231e31b8aSbellard #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ 78331e31b8aSbellard #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ 78431e31b8aSbellard #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ 78531e31b8aSbellard #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ 78631e31b8aSbellard #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ 78731e31b8aSbellard #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ 78831e31b8aSbellard #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ 78931e31b8aSbellard #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ 79031e31b8aSbellard #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ 79131e31b8aSbellard #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ 79231e31b8aSbellard #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ 79331e31b8aSbellard #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ 79431e31b8aSbellard #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ 79531e31b8aSbellard #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ 79631e31b8aSbellard #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ 79731e31b8aSbellard #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ 79831e31b8aSbellard #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ 79931e31b8aSbellard #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ 80031e31b8aSbellard #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ 80131e31b8aSbellard #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ 80231e31b8aSbellard #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ 80331e31b8aSbellard #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ 80431e31b8aSbellard #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ 80531e31b8aSbellard #define TARGET_SIOCSIFENCAP 0x8926 80631e31b8aSbellard #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ 80731e31b8aSbellard #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ 80831e31b8aSbellard #define TARGET_SIOCSIFSLAVE 0x8930 80931e31b8aSbellard #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ 81031e31b8aSbellard #define TARGET_SIOCDELMULTI 0x8932 811f63eb01aSPaul Burton #define TARGET_SIOCGIFINDEX 0x8933 8124bdcd79eSNeng Chen #define TARGET_SIOCSIFPFLAGS 0x8934 /* set extended flags */ 8134bdcd79eSNeng Chen #define TARGET_SIOCGIFPFLAGS 0x8935 /* get extended flags */ 81431e31b8aSbellard 81531e31b8aSbellard /* Bridging control calls */ 81631e31b8aSbellard #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ 81731e31b8aSbellard #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ 81831e31b8aSbellard 81931e31b8aSbellard #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ 82031e31b8aSbellard #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ 82131e31b8aSbellard 82231e31b8aSbellard /* ARP cache control calls. */ 82331e31b8aSbellard #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ 82431e31b8aSbellard #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ 82531e31b8aSbellard #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ 82631e31b8aSbellard #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ 82731e31b8aSbellard #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ 82831e31b8aSbellard #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ 82931e31b8aSbellard 83031e31b8aSbellard /* RARP cache control calls. */ 83131e31b8aSbellard #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ 83231e31b8aSbellard #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ 83331e31b8aSbellard #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ 83431e31b8aSbellard 83531e31b8aSbellard /* Driver configuration calls */ 83631e31b8aSbellard #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ 83731e31b8aSbellard #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ 83831e31b8aSbellard 83931e31b8aSbellard /* DLCI configuration calls */ 84031e31b8aSbellard #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ 84131e31b8aSbellard #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ 84231e31b8aSbellard 84386fcd946SLaurent Vivier /* From <linux/wireless.h> */ 84486fcd946SLaurent Vivier 84586fcd946SLaurent Vivier #define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ 84631e31b8aSbellard 847d6d6d6feSMarco A L Barbosa /* From <linux/random.h> */ 848d6d6d6feSMarco A L Barbosa 849d6d6d6feSMarco A L Barbosa #define TARGET_RNDGETENTCNT TARGET_IOR('R', 0x00, int) 850d6d6d6feSMarco A L Barbosa #define TARGET_RNDADDTOENTCNT TARGET_IOW('R', 0x01, int) 851d6d6d6feSMarco A L Barbosa #define TARGET_RNDZAPENTCNT TARGET_IO('R', 0x04) 852d6d6d6feSMarco A L Barbosa #define TARGET_RNDCLEARPOOL TARGET_IO('R', 0x06) 853*92c096f0SAleksandar Markovic #define TARGET_RNDRESEEDCRNG TARGET_IO('R', 0x07) 854d6d6d6feSMarco A L Barbosa 85531e31b8aSbellard /* From <linux/fs.h> */ 85631e31b8aSbellard 85731e31b8aSbellard #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ 85831e31b8aSbellard #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ 85931e31b8aSbellard #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ 86031e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ 86131e31b8aSbellard #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ 86231e31b8aSbellard #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ 86331e31b8aSbellard #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ 86431e31b8aSbellard #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ 86531e31b8aSbellard #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ 86631e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ 86731e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ 86831e31b8aSbellard #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ 869fff8c539SAndreas Färber #define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */ 87031e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */ 871c8b0bf54SPeter Maydell #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong) 872c8b0bf54SPeter Maydell #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong) 873edafea13SAlexander Graf #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) 874edafea13SAlexander Graf /* return device size in bytes 875edafea13SAlexander Graf (u64 *arg) */ 8764715856aSPeter Maydell 8774715856aSPeter Maydell #define TARGET_BLKDISCARD TARGET_IO(0x12, 119) 8784715856aSPeter Maydell #define TARGET_BLKIOMIN TARGET_IO(0x12, 120) 8794715856aSPeter Maydell #define TARGET_BLKIOOPT TARGET_IO(0x12, 121) 8804715856aSPeter Maydell #define TARGET_BLKALIGNOFF TARGET_IO(0x12, 122) 8814715856aSPeter Maydell #define TARGET_BLKPBSZGET TARGET_IO(0x12, 123) 8824715856aSPeter Maydell #define TARGET_BLKDISCARDZEROES TARGET_IO(0x12, 124) 8834715856aSPeter Maydell #define TARGET_BLKSECDISCARD TARGET_IO(0x12, 125) 8844715856aSPeter Maydell #define TARGET_BLKROTATIONAL TARGET_IO(0x12, 126) 8854715856aSPeter Maydell #define TARGET_BLKZEROOUT TARGET_IO(0x12, 127) 8864715856aSPeter Maydell 88731e31b8aSbellard #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ 88831e31b8aSbellard #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ 88921992cb6SHelge Deller 89021992cb6SHelge Deller #define TARGET_FICLONE TARGET_IOW(0x94, 9, int) 89121992cb6SHelge Deller #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range) 89221992cb6SHelge Deller 89360807231SPeter Maydell /* Note that the ioctl numbers claim type "long" but the actual type 89460807231SPeter Maydell * used by the kernel is "int". 89560807231SPeter Maydell */ 8961847b7baSPeter Maydell #define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, abi_long) 8971847b7baSPeter Maydell #define TARGET_FS_IOC_SETFLAGS TARGET_IOW('f', 2, abi_long) 89860807231SPeter Maydell 899285da2b9SPeter Maydell #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) 90031e31b8aSbellard 9016c753a63SCortland Tölva /* usb ioctls */ 9026c753a63SCortland Tölva #define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0) 9036c753a63SCortland Tölva #define TARGET_USBDEVFS_BULK TARGET_IOWRU('U', 2) 9046c753a63SCortland Tölva #define TARGET_USBDEVFS_RESETEP TARGET_IORU('U', 3) 9056c753a63SCortland Tölva #define TARGET_USBDEVFS_SETINTERFACE TARGET_IORU('U', 4) 9066c753a63SCortland Tölva #define TARGET_USBDEVFS_SETCONFIGURATION TARGET_IORU('U', 5) 9076c753a63SCortland Tölva #define TARGET_USBDEVFS_GETDRIVER TARGET_IOWU('U', 8) 908a133367eSCortland Tölva #define TARGET_USBDEVFS_SUBMITURB TARGET_IORU('U', 10) 909a133367eSCortland Tölva #define TARGET_USBDEVFS_DISCARDURB TARGET_IO('U', 11) 910a133367eSCortland Tölva #define TARGET_USBDEVFS_REAPURB TARGET_IOWU('U', 12) 911a133367eSCortland Tölva #define TARGET_USBDEVFS_REAPURBNDELAY TARGET_IOWU('U', 13) 9126c753a63SCortland Tölva #define TARGET_USBDEVFS_DISCSIGNAL TARGET_IORU('U', 14) 9136c753a63SCortland Tölva #define TARGET_USBDEVFS_CLAIMINTERFACE TARGET_IORU('U', 15) 9146c753a63SCortland Tölva #define TARGET_USBDEVFS_RELEASEINTERFACE TARGET_IORU('U', 16) 9156c753a63SCortland Tölva #define TARGET_USBDEVFS_CONNECTINFO TARGET_IOWU('U', 17) 9166c753a63SCortland Tölva #define TARGET_USBDEVFS_IOCTL TARGET_IOWRU('U', 18) 9176c753a63SCortland Tölva #define TARGET_USBDEVFS_HUB_PORTINFO TARGET_IORU('U', 19) 9186c753a63SCortland Tölva #define TARGET_USBDEVFS_RESET TARGET_IO('U', 20) 9196c753a63SCortland Tölva #define TARGET_USBDEVFS_CLEAR_HALT TARGET_IORU('U', 21) 9206c753a63SCortland Tölva #define TARGET_USBDEVFS_DISCONNECT TARGET_IO('U', 22) 9216c753a63SCortland Tölva #define TARGET_USBDEVFS_CONNECT TARGET_IO('U', 23) 9226c753a63SCortland Tölva #define TARGET_USBDEVFS_CLAIM_PORT TARGET_IORU('U', 24) 9236c753a63SCortland Tölva #define TARGET_USBDEVFS_RELEASE_PORT TARGET_IORU('U', 25) 9246c753a63SCortland Tölva #define TARGET_USBDEVFS_GET_CAPABILITIES TARGET_IORU('U', 26) 9256c753a63SCortland Tölva #define TARGET_USBDEVFS_DISCONNECT_CLAIM TARGET_IORU('U', 27) 9266c753a63SCortland Tölva #define TARGET_USBDEVFS_DROP_PRIVILEGES TARGET_IOWU('U', 30) 9276c753a63SCortland Tölva #define TARGET_USBDEVFS_GET_SPEED TARGET_IO('U', 31) 9286c753a63SCortland Tölva 92931e31b8aSbellard /* cdrom commands */ 93031e31b8aSbellard #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ 93131e31b8aSbellard #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ 93231e31b8aSbellard #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ 93331e31b8aSbellard #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index 93431e31b8aSbellard (struct cdrom_ti) */ 93531e31b8aSbellard #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header 93631e31b8aSbellard (struct cdrom_tochdr) */ 93731e31b8aSbellard #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry 93831e31b8aSbellard (struct cdrom_tocentry) */ 93931e31b8aSbellard #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ 94031e31b8aSbellard #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ 94131e31b8aSbellard #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ 94231e31b8aSbellard #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume 94331e31b8aSbellard (struct cdrom_volctrl) */ 94431e31b8aSbellard #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data 94531e31b8aSbellard (struct cdrom_subchnl) */ 94631e31b8aSbellard #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) 94731e31b8aSbellard (struct cdrom_read) */ 94831e31b8aSbellard #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) 94931e31b8aSbellard (struct cdrom_read) */ 95031e31b8aSbellard #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ 95131e31b8aSbellard #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ 95231e31b8aSbellard #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session 95331e31b8aSbellard address of multi session disks 95431e31b8aSbellard (struct cdrom_multisession) */ 95531e31b8aSbellard #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" 95631e31b8aSbellard if available (struct cdrom_mcn) */ 95767cc32ebSVeres Lajos #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is deprecated, 958b4916d7bSDong Xu Wang but here anyway for compatibility */ 95931e31b8aSbellard #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ 96031e31b8aSbellard #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting 96131e31b8aSbellard (struct cdrom_volctrl) */ 96231e31b8aSbellard #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) 96331e31b8aSbellard (struct cdrom_read) */ 96431e31b8aSbellard /* 96531e31b8aSbellard * These ioctls are used only used in aztcd.c and optcd.c 96631e31b8aSbellard */ 96731e31b8aSbellard #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ 96831e31b8aSbellard #define TARGET_CDROMSEEK 0x5316 /* seek msf address */ 96931e31b8aSbellard 97031e31b8aSbellard /* 97131e31b8aSbellard * This ioctl is only used by the scsi-cd driver. 97231e31b8aSbellard It is for playing audio in logical block addressing mode. 97331e31b8aSbellard */ 97431e31b8aSbellard #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ 97531e31b8aSbellard 97631e31b8aSbellard /* 97731e31b8aSbellard * These ioctls are only used in optcd.c 97831e31b8aSbellard */ 97931e31b8aSbellard #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ 98031e31b8aSbellard 98131e31b8aSbellard /* 98231e31b8aSbellard * These ioctls are (now) only in ide-cd.c for controlling 98331e31b8aSbellard * drive spindown time. They should be implemented in the 98431e31b8aSbellard * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, 98531e31b8aSbellard * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... 98631e31b8aSbellard * -Erik 98731e31b8aSbellard */ 98831e31b8aSbellard #define TARGET_CDROMGETSPINDOWN 0x531d 98931e31b8aSbellard #define TARGET_CDROMSETSPINDOWN 0x531e 99031e31b8aSbellard 99131e31b8aSbellard /* 99231e31b8aSbellard * These ioctls are implemented through the uniform CD-ROM driver 99331e31b8aSbellard * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM 99431e31b8aSbellard * drivers are eventually ported to the uniform CD-ROM driver interface. 99531e31b8aSbellard */ 99631e31b8aSbellard #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ 99731e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ 99831e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ 99931e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ 100031e31b8aSbellard #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ 100131e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ 100231e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ 100331e31b8aSbellard #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ 100431e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ 100531e31b8aSbellard #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ 100631e31b8aSbellard #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ 100731e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ 100831e31b8aSbellard 100931e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. 101031e31b8aSbellard * Future CDROM ioctls should be kept below 0x537F 101131e31b8aSbellard */ 101231e31b8aSbellard 101331e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */ 101431e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ 101531e31b8aSbellard /* conflict with SCSI_IOCTL_GET_IDLUN */ 101631e31b8aSbellard 101731e31b8aSbellard /* DVD-ROM Specific ioctls */ 101831e31b8aSbellard #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ 101931e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ 102031e31b8aSbellard #define TARGET_DVD_AUTH 0x5392 /* Authentication */ 102131e31b8aSbellard 102231e31b8aSbellard #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ 102331e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ 102431e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ 102531e31b8aSbellard 102631e31b8aSbellard /* HD commands */ 102731e31b8aSbellard 102831e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ 102931e31b8aSbellard #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ 103031e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ 103131e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ 103231e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ 103331e31b8aSbellard #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ 103431e31b8aSbellard #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ 103531e31b8aSbellard #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ 10362521d698Sbellard #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ 103731e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ 103831e31b8aSbellard 103931e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ 104031e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ 104131e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ 104231e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ 104331e31b8aSbellard #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ 104431e31b8aSbellard #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ 104531e31b8aSbellard #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ 104631e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ 10472521d698Sbellard 1048b8005914Sbalrog /* loop ioctls */ 1049b8005914Sbalrog #define TARGET_LOOP_SET_FD 0x4C00 1050b8005914Sbalrog #define TARGET_LOOP_CLR_FD 0x4C01 1051b8005914Sbalrog #define TARGET_LOOP_SET_STATUS 0x4C02 1052b8005914Sbalrog #define TARGET_LOOP_GET_STATUS 0x4C03 1053b8005914Sbalrog #define TARGET_LOOP_SET_STATUS64 0x4C04 1054b8005914Sbalrog #define TARGET_LOOP_GET_STATUS64 0x4C05 1055b8005914Sbalrog #define TARGET_LOOP_CHANGE_FD 0x4C06 10562521d698Sbellard 1057884cdc48SPeter Maydell #define TARGET_LOOP_CTL_ADD 0x4C80 1058884cdc48SPeter Maydell #define TARGET_LOOP_CTL_REMOVE 0x4C81 1059884cdc48SPeter Maydell #define TARGET_LOOP_CTL_GET_FREE 0x4C82 1060884cdc48SPeter Maydell 1061f7680a55SUlrich Hecht /* fb ioctls */ 1062f7680a55SUlrich Hecht #define TARGET_FBIOGET_VSCREENINFO 0x4600 1063f7680a55SUlrich Hecht #define TARGET_FBIOPUT_VSCREENINFO 0x4601 1064f7680a55SUlrich Hecht #define TARGET_FBIOGET_FSCREENINFO 0x4602 106512b81b71SCédric VINCENT #define TARGET_FBIOGETCMAP 0x4604 106612b81b71SCédric VINCENT #define TARGET_FBIOPUTCMAP 0x4605 106712b81b71SCédric VINCENT #define TARGET_FBIOPAN_DISPLAY 0x4606 106812b81b71SCédric VINCENT #define TARGET_FBIOGET_CON2FBMAP 0x460F 106912b81b71SCédric VINCENT #define TARGET_FBIOPUT_CON2FBMAP 0x4610 1070f7680a55SUlrich Hecht 1071f7680a55SUlrich Hecht /* vt ioctls */ 1072f7680a55SUlrich Hecht #define TARGET_VT_OPENQRY 0x5600 1073f7680a55SUlrich Hecht #define TARGET_VT_GETSTATE 0x5603 1074f7680a55SUlrich Hecht #define TARGET_VT_ACTIVATE 0x5606 1075f7680a55SUlrich Hecht #define TARGET_VT_WAITACTIVE 0x5607 1076f7680a55SUlrich Hecht #define TARGET_VT_LOCKSWITCH 0x560b 1077f7680a55SUlrich Hecht #define TARGET_VT_UNLOCKSWITCH 0x560c 1078774750c0SCédric VINCENT #define TARGET_VT_GETMODE 0x5601 1079774750c0SCédric VINCENT #define TARGET_VT_SETMODE 0x5602 1080774750c0SCédric VINCENT #define TARGET_VT_RELDISP 0x5605 1081774750c0SCédric VINCENT #define TARGET_VT_DISALLOCATE 0x5608 1082f7680a55SUlrich Hecht 108356e904ecSAlexander Graf /* device mapper */ 108456e904ecSAlexander Graf #define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00) 108556e904ecSAlexander Graf #define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01) 108656e904ecSAlexander Graf #define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02) 108756e904ecSAlexander Graf #define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03) 108856e904ecSAlexander Graf #define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04) 108956e904ecSAlexander Graf #define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05) 109056e904ecSAlexander Graf #define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06) 109156e904ecSAlexander Graf #define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07) 109256e904ecSAlexander Graf #define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08) 109356e904ecSAlexander Graf #define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09) 109456e904ecSAlexander Graf #define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a) 109556e904ecSAlexander Graf #define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b) 109656e904ecSAlexander Graf #define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c) 109756e904ecSAlexander Graf #define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d) 109856e904ecSAlexander Graf #define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e) 109956e904ecSAlexander Graf #define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f) 110056e904ecSAlexander Graf 11012521d698Sbellard /* from asm/termbits.h */ 11022521d698Sbellard 11033bfd9da1Sbellard #define TARGET_NCC 8 11043bfd9da1Sbellard struct target_termio { 11053bfd9da1Sbellard unsigned short c_iflag; /* input mode flags */ 11063bfd9da1Sbellard unsigned short c_oflag; /* output mode flags */ 11073bfd9da1Sbellard unsigned short c_cflag; /* control mode flags */ 11083bfd9da1Sbellard unsigned short c_lflag; /* local mode flags */ 11092521d698Sbellard unsigned char c_line; /* line discipline */ 11103bfd9da1Sbellard unsigned char c_cc[TARGET_NCC]; /* control characters */ 11112521d698Sbellard }; 11122521d698Sbellard 11133bfd9da1Sbellard struct target_winsize { 11143bfd9da1Sbellard unsigned short ws_row; 11153bfd9da1Sbellard unsigned short ws_col; 11163bfd9da1Sbellard unsigned short ws_xpixel; 11173bfd9da1Sbellard unsigned short ws_ypixel; 11183bfd9da1Sbellard }; 11192521d698Sbellard 11203bfd9da1Sbellard #include "termbits.h" 11212521d698Sbellard 11229e0b74a4SPaul Brook #if defined(TARGET_MIPS) 11239e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x10 11249e0b74a4SPaul Brook #else 11259e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x08 11269e0b74a4SPaul Brook #endif 11279e0b74a4SPaul Brook 1128e44a3e79Saurel32 /* Common */ 11292521d698Sbellard #define TARGET_MAP_SHARED 0x01 /* Share changes */ 11302521d698Sbellard #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ 1131e65be6a7SHelge Deller #if defined(TARGET_HPPA) 1132e65be6a7SHelge Deller #define TARGET_MAP_TYPE 0x03 /* Mask for type of mapping */ 1133e65be6a7SHelge Deller #else 11342521d698Sbellard #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ 1135e65be6a7SHelge Deller #endif 1136e44a3e79Saurel32 1137e44a3e79Saurel32 /* Target specific */ 1138048f6b4dSbellard #if defined(TARGET_MIPS) 1139e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1140048f6b4dSbellard #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 1141048f6b4dSbellard #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 1142048f6b4dSbellard #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 1143048f6b4dSbellard #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 1144048f6b4dSbellard #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 1145048f6b4dSbellard #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 1146540635baSths #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 1147540635baSths #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1148541e1690SHelge Deller #define TARGET_MAP_STACK 0x40000 /* ignored */ 1149541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ 1150e44a3e79Saurel32 #elif defined(TARGET_PPC) 1151e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 11522521d698Sbellard #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 11532521d698Sbellard #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 11542521d698Sbellard #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 11552521d698Sbellard #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 11567ec93196Sj_mayer #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ 11577ec93196Sj_mayer #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ 1158e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1159e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1160541e1690SHelge Deller #define TARGET_MAP_STACK 0x20000 /* ignored */ 1161541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ 1162e44a3e79Saurel32 #elif defined(TARGET_ALPHA) 1163e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1164e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ 1165e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ 1166e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ 1167e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ 1168e44a3e79Saurel32 #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ 1169e44a3e79Saurel32 #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ 1170e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ 1171e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ 1172541e1690SHelge Deller #define TARGET_MAP_STACK 0x80000 /* ignored */ 1173541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x100000 /* create a huge page mapping */ 1174a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 1175a10d1e50SRichard Henderson #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1176a10d1e50SRichard Henderson #define TARGET_MAP_FIXED 0x04 /* Interpret addr exactly */ 1177a10d1e50SRichard Henderson #define TARGET_MAP_GROWSDOWN 0x08000 /* stack-like segment */ 1178a10d1e50SRichard Henderson #define TARGET_MAP_DENYWRITE 0x00800 /* ETXTBSY */ 1179a10d1e50SRichard Henderson #define TARGET_MAP_EXECUTABLE 0x01000 /* mark it as an executable */ 1180a10d1e50SRichard Henderson #define TARGET_MAP_LOCKED 0x02000 /* lock the mapping */ 1181a10d1e50SRichard Henderson #define TARGET_MAP_NORESERVE 0x04000 /* no check for reservations */ 1182a10d1e50SRichard Henderson #define TARGET_MAP_POPULATE 0x10000 /* pop (prefault) pagetables */ 1183a10d1e50SRichard Henderson #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1184541e1690SHelge Deller #define TARGET_MAP_STACK 0x40000 /* ignored */ 1185541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ 1186ba7651fbSMax Filippov #elif defined(TARGET_XTENSA) 1187ba7651fbSMax Filippov #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1188ba7651fbSMax Filippov #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 1189ba7651fbSMax Filippov #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 1190ba7651fbSMax Filippov #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 1191ba7651fbSMax Filippov #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 1192ba7651fbSMax Filippov #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 1193ba7651fbSMax Filippov #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 1194ba7651fbSMax Filippov #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 1195ba7651fbSMax Filippov #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1196ba7651fbSMax Filippov #define TARGET_MAP_STACK 0x40000 1197ba7651fbSMax Filippov #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ 11987ec93196Sj_mayer #else 1199e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1200e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 1201e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 1202e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 1203e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 12042521d698Sbellard #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ 12052521d698Sbellard #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ 1206540635baSths #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1207540635baSths #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1208541e1690SHelge Deller #define TARGET_MAP_STACK 0x20000 /* ignored */ 1209541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ 1210906c1b8eSMike Frysinger #define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ 12117ec93196Sj_mayer #endif 12122521d698Sbellard 121309701199SAlexander Graf #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 121409701199SAlexander Graf || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 1215daa4374aSPeter Maydell || defined(TARGET_CRIS) 12165f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 12172521d698Sbellard struct target_stat { 12182521d698Sbellard unsigned short st_dev; 12192521d698Sbellard unsigned short __pad1; 1220992f48a0Sblueswir1 abi_ulong st_ino; 12212521d698Sbellard unsigned short st_mode; 12222521d698Sbellard unsigned short st_nlink; 12232521d698Sbellard unsigned short st_uid; 12242521d698Sbellard unsigned short st_gid; 12252521d698Sbellard unsigned short st_rdev; 12262521d698Sbellard unsigned short __pad2; 1227992f48a0Sblueswir1 abi_ulong st_size; 1228992f48a0Sblueswir1 abi_ulong st_blksize; 1229992f48a0Sblueswir1 abi_ulong st_blocks; 1230992f48a0Sblueswir1 abi_ulong target_st_atime; 12315f992db6SChen-Yu Tsai abi_ulong target_st_atime_nsec; 1232992f48a0Sblueswir1 abi_ulong target_st_mtime; 12335f992db6SChen-Yu Tsai abi_ulong target_st_mtime_nsec; 1234992f48a0Sblueswir1 abi_ulong target_st_ctime; 12355f992db6SChen-Yu Tsai abi_ulong target_st_ctime_nsec; 1236992f48a0Sblueswir1 abi_ulong __unused4; 1237992f48a0Sblueswir1 abi_ulong __unused5; 12382521d698Sbellard }; 12392521d698Sbellard 12402521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely 12412521d698Sbellard * insane amounts of padding around dev_t's. 12422521d698Sbellard */ 124320d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 12442521d698Sbellard struct target_stat64 { 12452521d698Sbellard unsigned short st_dev; 12462521d698Sbellard unsigned char __pad0[10]; 12472521d698Sbellard 12482521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1249992f48a0Sblueswir1 abi_ulong __st_ino; 12502521d698Sbellard 12512521d698Sbellard unsigned int st_mode; 12522521d698Sbellard unsigned int st_nlink; 12532521d698Sbellard 1254992f48a0Sblueswir1 abi_ulong st_uid; 1255992f48a0Sblueswir1 abi_ulong st_gid; 12562521d698Sbellard 12572521d698Sbellard unsigned short st_rdev; 12582521d698Sbellard unsigned char __pad3[10]; 12592521d698Sbellard 12602521d698Sbellard long long st_size; 1261992f48a0Sblueswir1 abi_ulong st_blksize; 12622521d698Sbellard 1263992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1264992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 12652521d698Sbellard 1266992f48a0Sblueswir1 abi_ulong target_st_atime; 12675f992db6SChen-Yu Tsai abi_ulong target_st_atime_nsec; 12682521d698Sbellard 1269992f48a0Sblueswir1 abi_ulong target_st_mtime; 12705f992db6SChen-Yu Tsai abi_ulong target_st_mtime_nsec; 12712521d698Sbellard 1272992f48a0Sblueswir1 abi_ulong target_st_ctime; 12735f992db6SChen-Yu Tsai abi_ulong target_st_ctime_nsec; 12742521d698Sbellard 12752521d698Sbellard unsigned long long st_ino; 1276541dc0d4SStefan Weil } QEMU_PACKED; 12772521d698Sbellard 1278ce4defa0Spbrook #ifdef TARGET_ARM 127920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1280ce4defa0Spbrook struct target_eabi_stat64 { 1281ce4defa0Spbrook unsigned long long st_dev; 1282ce4defa0Spbrook unsigned int __pad1; 1283992f48a0Sblueswir1 abi_ulong __st_ino; 1284ce4defa0Spbrook unsigned int st_mode; 1285ce4defa0Spbrook unsigned int st_nlink; 1286ce4defa0Spbrook 1287992f48a0Sblueswir1 abi_ulong st_uid; 1288992f48a0Sblueswir1 abi_ulong st_gid; 1289ce4defa0Spbrook 1290ce4defa0Spbrook unsigned long long st_rdev; 1291ce4defa0Spbrook unsigned int __pad2[2]; 1292ce4defa0Spbrook 1293ce4defa0Spbrook long long st_size; 1294992f48a0Sblueswir1 abi_ulong st_blksize; 1295ce4defa0Spbrook unsigned int __pad3; 1296ce4defa0Spbrook unsigned long long st_blocks; 1297ce4defa0Spbrook 1298992f48a0Sblueswir1 abi_ulong target_st_atime; 1299992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1300ce4defa0Spbrook 1301992f48a0Sblueswir1 abi_ulong target_st_mtime; 1302992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1303ce4defa0Spbrook 1304992f48a0Sblueswir1 abi_ulong target_st_ctime; 1305992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1306ce4defa0Spbrook 1307ce4defa0Spbrook unsigned long long st_ino; 1308541dc0d4SStefan Weil } QEMU_PACKED; 1309ce4defa0Spbrook #endif 1310ce4defa0Spbrook 1311992f48a0Sblueswir1 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 13121b8dd648Sblueswir1 struct target_stat { 13131b8dd648Sblueswir1 unsigned int st_dev; 1314992f48a0Sblueswir1 abi_ulong st_ino; 13151b8dd648Sblueswir1 unsigned int st_mode; 13161b8dd648Sblueswir1 unsigned int st_nlink; 13171b8dd648Sblueswir1 unsigned int st_uid; 13181b8dd648Sblueswir1 unsigned int st_gid; 13191b8dd648Sblueswir1 unsigned int st_rdev; 1320992f48a0Sblueswir1 abi_long st_size; 1321992f48a0Sblueswir1 abi_long target_st_atime; 1322992f48a0Sblueswir1 abi_long target_st_mtime; 1323992f48a0Sblueswir1 abi_long target_st_ctime; 1324992f48a0Sblueswir1 abi_long st_blksize; 1325992f48a0Sblueswir1 abi_long st_blocks; 1326992f48a0Sblueswir1 abi_ulong __unused4[2]; 13271b8dd648Sblueswir1 }; 13281b8dd648Sblueswir1 132920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 13301b8dd648Sblueswir1 struct target_stat64 { 13311b8dd648Sblueswir1 unsigned char __pad0[6]; 13321b8dd648Sblueswir1 unsigned short st_dev; 13331b8dd648Sblueswir1 13341b8dd648Sblueswir1 uint64_t st_ino; 13351b8dd648Sblueswir1 uint64_t st_nlink; 13361b8dd648Sblueswir1 13371b8dd648Sblueswir1 unsigned int st_mode; 13381b8dd648Sblueswir1 13391b8dd648Sblueswir1 unsigned int st_uid; 13401b8dd648Sblueswir1 unsigned int st_gid; 13411b8dd648Sblueswir1 13421b8dd648Sblueswir1 unsigned char __pad2[6]; 13431b8dd648Sblueswir1 unsigned short st_rdev; 13441b8dd648Sblueswir1 13451b8dd648Sblueswir1 int64_t st_size; 13461b8dd648Sblueswir1 int64_t st_blksize; 13471b8dd648Sblueswir1 13481b8dd648Sblueswir1 unsigned char __pad4[4]; 13491b8dd648Sblueswir1 unsigned int st_blocks; 13501b8dd648Sblueswir1 1351992f48a0Sblueswir1 abi_ulong target_st_atime; 13525f992db6SChen-Yu Tsai abi_ulong target_st_atime_nsec; 13531b8dd648Sblueswir1 1354992f48a0Sblueswir1 abi_ulong target_st_mtime; 13555f992db6SChen-Yu Tsai abi_ulong target_st_mtime_nsec; 13561b8dd648Sblueswir1 1357992f48a0Sblueswir1 abi_ulong target_st_ctime; 13585f992db6SChen-Yu Tsai abi_ulong target_st_ctime_nsec; 13591b8dd648Sblueswir1 1360992f48a0Sblueswir1 abi_ulong __unused4[3]; 13611b8dd648Sblueswir1 }; 13621b8dd648Sblueswir1 13633bfd9da1Sbellard #elif defined(TARGET_SPARC) 13643bfd9da1Sbellard 13655f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 13663bfd9da1Sbellard struct target_stat { 13673bfd9da1Sbellard unsigned short st_dev; 1368992f48a0Sblueswir1 abi_ulong st_ino; 13693bfd9da1Sbellard unsigned short st_mode; 13703bfd9da1Sbellard short st_nlink; 13713bfd9da1Sbellard unsigned short st_uid; 13723bfd9da1Sbellard unsigned short st_gid; 13733bfd9da1Sbellard unsigned short st_rdev; 1374992f48a0Sblueswir1 abi_long st_size; 1375992f48a0Sblueswir1 abi_long target_st_atime; 13765f992db6SChen-Yu Tsai abi_ulong target_st_atime_nsec; 1377992f48a0Sblueswir1 abi_long target_st_mtime; 13785f992db6SChen-Yu Tsai abi_ulong target_st_mtime_nsec; 1379992f48a0Sblueswir1 abi_long target_st_ctime; 13805f992db6SChen-Yu Tsai abi_ulong target_st_ctime_nsec; 1381992f48a0Sblueswir1 abi_long st_blksize; 1382992f48a0Sblueswir1 abi_long st_blocks; 13835f992db6SChen-Yu Tsai abi_ulong __unused1[2]; 13843bfd9da1Sbellard }; 13853bfd9da1Sbellard 138620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 13873bfd9da1Sbellard struct target_stat64 { 13883bfd9da1Sbellard unsigned char __pad0[6]; 13893bfd9da1Sbellard unsigned short st_dev; 13903bfd9da1Sbellard 13913bfd9da1Sbellard uint64_t st_ino; 13923bfd9da1Sbellard 13933bfd9da1Sbellard unsigned int st_mode; 13943bfd9da1Sbellard unsigned int st_nlink; 13953bfd9da1Sbellard 13963bfd9da1Sbellard unsigned int st_uid; 13973bfd9da1Sbellard unsigned int st_gid; 13983bfd9da1Sbellard 13993bfd9da1Sbellard unsigned char __pad2[6]; 14003bfd9da1Sbellard unsigned short st_rdev; 14013bfd9da1Sbellard 14023bfd9da1Sbellard unsigned char __pad3[8]; 14033bfd9da1Sbellard 14043bfd9da1Sbellard int64_t st_size; 14053bfd9da1Sbellard unsigned int st_blksize; 14063bfd9da1Sbellard 14073bfd9da1Sbellard unsigned char __pad4[8]; 14083bfd9da1Sbellard unsigned int st_blocks; 14093bfd9da1Sbellard 14103bfd9da1Sbellard unsigned int target_st_atime; 14115f992db6SChen-Yu Tsai unsigned int target_st_atime_nsec; 14123bfd9da1Sbellard 14133bfd9da1Sbellard unsigned int target_st_mtime; 14145f992db6SChen-Yu Tsai unsigned int target_st_mtime_nsec; 14153bfd9da1Sbellard 14163bfd9da1Sbellard unsigned int target_st_ctime; 14175f992db6SChen-Yu Tsai unsigned int target_st_ctime_nsec; 14183bfd9da1Sbellard 14195f992db6SChen-Yu Tsai unsigned int __unused1; 14205f992db6SChen-Yu Tsai unsigned int __unused2; 14213bfd9da1Sbellard }; 14223bfd9da1Sbellard 142367867308Sbellard #elif defined(TARGET_PPC) 142467867308Sbellard 14255f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 142667867308Sbellard struct target_stat { 1427e32448e0Sj_mayer abi_ulong st_dev; 1428992f48a0Sblueswir1 abi_ulong st_ino; 1429325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1430e32448e0Sj_mayer abi_ulong st_nlink; 1431325e651fSj_mayer unsigned int st_mode; 1432325e651fSj_mayer #else 143367867308Sbellard unsigned int st_mode; 143467867308Sbellard unsigned short st_nlink; 1435325e651fSj_mayer #endif 143667867308Sbellard unsigned int st_uid; 143767867308Sbellard unsigned int st_gid; 1438e32448e0Sj_mayer abi_ulong st_rdev; 1439992f48a0Sblueswir1 abi_ulong st_size; 1440992f48a0Sblueswir1 abi_ulong st_blksize; 1441992f48a0Sblueswir1 abi_ulong st_blocks; 1442992f48a0Sblueswir1 abi_ulong target_st_atime; 1443e32448e0Sj_mayer abi_ulong target_st_atime_nsec; 1444992f48a0Sblueswir1 abi_ulong target_st_mtime; 1445e32448e0Sj_mayer abi_ulong target_st_mtime_nsec; 1446992f48a0Sblueswir1 abi_ulong target_st_ctime; 1447e32448e0Sj_mayer abi_ulong target_st_ctime_nsec; 1448992f48a0Sblueswir1 abi_ulong __unused4; 1449992f48a0Sblueswir1 abi_ulong __unused5; 1450325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1451325e651fSj_mayer abi_ulong __unused6; 1452325e651fSj_mayer #endif 145367867308Sbellard }; 145467867308Sbellard 145520d155bcSStefan Weil #if !defined(TARGET_PPC64) || defined(TARGET_ABI32) 145620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1457541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 145867867308Sbellard unsigned long long st_dev; 145967867308Sbellard unsigned long long st_ino; 146067867308Sbellard unsigned int st_mode; 146167867308Sbellard unsigned int st_nlink; 146267867308Sbellard unsigned int st_uid; 146367867308Sbellard unsigned int st_gid; 146467867308Sbellard unsigned long long st_rdev; 1465e1ce5e40Saurel32 unsigned long long __pad0; 146667867308Sbellard long long st_size; 1467e32448e0Sj_mayer int st_blksize; 1468e1ce5e40Saurel32 unsigned int __pad1; 146961322e91SMax Filippov long long st_blocks; /* Number 512-byte blocks allocated. */ 1470e32448e0Sj_mayer int target_st_atime; 1471e32448e0Sj_mayer unsigned int target_st_atime_nsec; 1472e32448e0Sj_mayer int target_st_mtime; 1473e32448e0Sj_mayer unsigned int target_st_mtime_nsec; 1474e32448e0Sj_mayer int target_st_ctime; 1475e32448e0Sj_mayer unsigned int target_st_ctime_nsec; 1476e32448e0Sj_mayer unsigned int __unused4; 1477e32448e0Sj_mayer unsigned int __unused5; 147867867308Sbellard }; 147920d155bcSStefan Weil #endif 148067867308Sbellard 1481b779e29eSEdgar E. Iglesias #elif defined(TARGET_MICROBLAZE) 1482b779e29eSEdgar E. Iglesias 14835f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1484b779e29eSEdgar E. Iglesias struct target_stat { 1485b779e29eSEdgar E. Iglesias abi_ulong st_dev; 1486b779e29eSEdgar E. Iglesias abi_ulong st_ino; 1487b779e29eSEdgar E. Iglesias unsigned int st_mode; 1488b779e29eSEdgar E. Iglesias unsigned short st_nlink; 1489b779e29eSEdgar E. Iglesias unsigned int st_uid; 1490b779e29eSEdgar E. Iglesias unsigned int st_gid; 1491b779e29eSEdgar E. Iglesias abi_ulong st_rdev; 1492b779e29eSEdgar E. Iglesias abi_ulong st_size; 1493b779e29eSEdgar E. Iglesias abi_ulong st_blksize; 1494b779e29eSEdgar E. Iglesias abi_ulong st_blocks; 1495b779e29eSEdgar E. Iglesias abi_ulong target_st_atime; 1496b779e29eSEdgar E. Iglesias abi_ulong target_st_atime_nsec; 1497b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime; 1498b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime_nsec; 1499b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime; 1500b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime_nsec; 1501b779e29eSEdgar E. Iglesias abi_ulong __unused4; 1502b779e29eSEdgar E. Iglesias abi_ulong __unused5; 1503b779e29eSEdgar E. Iglesias }; 1504b779e29eSEdgar E. Iglesias 1505b779e29eSEdgar E. Iglesias /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ 150620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1507541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 1508b779e29eSEdgar E. Iglesias uint64_t st_dev; 1509a523eb06SEdgar E. Iglesias #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1510a523eb06SEdgar E. Iglesias uint32_t pad0; 1511a523eb06SEdgar E. Iglesias uint32_t __st_ino; 1512a523eb06SEdgar E. Iglesias 1513b779e29eSEdgar E. Iglesias uint32_t st_mode; 1514b779e29eSEdgar E. Iglesias uint32_t st_nlink; 1515b779e29eSEdgar E. Iglesias uint32_t st_uid; 1516b779e29eSEdgar E. Iglesias uint32_t st_gid; 1517b779e29eSEdgar E. Iglesias uint64_t st_rdev; 151821ebeb23SEdgar E. Iglesias uint64_t __pad1; 1519b779e29eSEdgar E. Iglesias 1520b779e29eSEdgar E. Iglesias int64_t st_size; 1521b779e29eSEdgar E. Iglesias int32_t st_blksize; 152221ebeb23SEdgar E. Iglesias uint32_t __pad2; 1523b779e29eSEdgar E. Iglesias int64_t st_blocks; /* Number 512-byte blocks allocated. */ 1524b779e29eSEdgar E. Iglesias 1525b779e29eSEdgar E. Iglesias int target_st_atime; 1526b779e29eSEdgar E. Iglesias unsigned int target_st_atime_nsec; 1527b779e29eSEdgar E. Iglesias int target_st_mtime; 1528b779e29eSEdgar E. Iglesias unsigned int target_st_mtime_nsec; 1529b779e29eSEdgar E. Iglesias int target_st_ctime; 1530b779e29eSEdgar E. Iglesias unsigned int target_st_ctime_nsec; 1531a523eb06SEdgar E. Iglesias uint64_t st_ino; 1532b779e29eSEdgar E. Iglesias }; 1533b779e29eSEdgar E. Iglesias 1534e6e5906bSpbrook #elif defined(TARGET_M68K) 1535e6e5906bSpbrook 1536e6e5906bSpbrook struct target_stat { 1537e6e5906bSpbrook unsigned short st_dev; 1538e6e5906bSpbrook unsigned short __pad1; 1539992f48a0Sblueswir1 abi_ulong st_ino; 1540e6e5906bSpbrook unsigned short st_mode; 1541e6e5906bSpbrook unsigned short st_nlink; 1542e6e5906bSpbrook unsigned short st_uid; 1543e6e5906bSpbrook unsigned short st_gid; 1544e6e5906bSpbrook unsigned short st_rdev; 1545e6e5906bSpbrook unsigned short __pad2; 1546992f48a0Sblueswir1 abi_ulong st_size; 1547992f48a0Sblueswir1 abi_ulong st_blksize; 1548992f48a0Sblueswir1 abi_ulong st_blocks; 1549992f48a0Sblueswir1 abi_ulong target_st_atime; 1550992f48a0Sblueswir1 abi_ulong __unused1; 1551992f48a0Sblueswir1 abi_ulong target_st_mtime; 1552992f48a0Sblueswir1 abi_ulong __unused2; 1553992f48a0Sblueswir1 abi_ulong target_st_ctime; 1554992f48a0Sblueswir1 abi_ulong __unused3; 1555992f48a0Sblueswir1 abi_ulong __unused4; 1556992f48a0Sblueswir1 abi_ulong __unused5; 1557e6e5906bSpbrook }; 1558e6e5906bSpbrook 1559e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely 1560e6e5906bSpbrook * insane amounts of padding around dev_t's. 1561e6e5906bSpbrook */ 156220d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1563e6e5906bSpbrook struct target_stat64 { 1564e6e5906bSpbrook unsigned long long st_dev; 1565e6e5906bSpbrook unsigned char __pad1[2]; 1566e6e5906bSpbrook 1567e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1568992f48a0Sblueswir1 abi_ulong __st_ino; 1569e6e5906bSpbrook 1570e6e5906bSpbrook unsigned int st_mode; 1571e6e5906bSpbrook unsigned int st_nlink; 1572e6e5906bSpbrook 1573992f48a0Sblueswir1 abi_ulong st_uid; 1574992f48a0Sblueswir1 abi_ulong st_gid; 1575e6e5906bSpbrook 1576e6e5906bSpbrook unsigned long long st_rdev; 1577e6e5906bSpbrook unsigned char __pad3[2]; 1578e6e5906bSpbrook 1579e6e5906bSpbrook long long st_size; 1580992f48a0Sblueswir1 abi_ulong st_blksize; 1581e6e5906bSpbrook 1582992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 1583992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1584e6e5906bSpbrook 1585992f48a0Sblueswir1 abi_ulong target_st_atime; 1586992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1587e6e5906bSpbrook 1588992f48a0Sblueswir1 abi_ulong target_st_mtime; 1589992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1590e6e5906bSpbrook 1591992f48a0Sblueswir1 abi_ulong target_st_ctime; 1592992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1593e6e5906bSpbrook 1594e6e5906bSpbrook unsigned long long st_ino; 1595541dc0d4SStefan Weil } QEMU_PACKED; 1596e6e5906bSpbrook 1597d26bc211Sths #elif defined(TARGET_ABI_MIPSN64) 1598540635baSths 15995f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1600540635baSths /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ 1601540635baSths struct target_stat { 1602540635baSths unsigned int st_dev; 1603540635baSths unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ 1604540635baSths 1605992f48a0Sblueswir1 abi_ulong st_ino; 1606540635baSths 1607540635baSths unsigned int st_mode; 1608540635baSths unsigned int st_nlink; 1609540635baSths 1610540635baSths int st_uid; 1611540635baSths int st_gid; 1612540635baSths 1613540635baSths unsigned int st_rdev; 1614540635baSths unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ 1615540635baSths 1616992f48a0Sblueswir1 abi_ulong st_size; 1617540635baSths 1618540635baSths /* 1619540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1620540635baSths * but we don't have it under Linux. 1621540635baSths */ 1622540635baSths unsigned int target_st_atime; 1623540635baSths unsigned int target_st_atime_nsec; 1624540635baSths 1625540635baSths unsigned int target_st_mtime; 1626540635baSths unsigned int target_st_mtime_nsec; 1627540635baSths 1628540635baSths unsigned int target_st_ctime; 1629540635baSths unsigned int target_st_ctime_nsec; 1630540635baSths 1631540635baSths unsigned int st_blksize; 1632540635baSths unsigned int st_pad2; 1633540635baSths 1634992f48a0Sblueswir1 abi_ulong st_blocks; 1635540635baSths }; 1636540635baSths 1637d26bc211Sths #elif defined(TARGET_ABI_MIPSN32) 1638540635baSths 16395f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1640540635baSths struct target_stat { 16411ab2aea2SLeon Alrae abi_ulong st_dev; 16421ab2aea2SLeon Alrae abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 16431ab2aea2SLeon Alrae uint64_t st_ino; 1644540635baSths unsigned int st_mode; 1645540635baSths unsigned int st_nlink; 1646540635baSths int st_uid; 1647540635baSths int st_gid; 16481ab2aea2SLeon Alrae abi_ulong st_rdev; 16491ab2aea2SLeon Alrae abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 16501ab2aea2SLeon Alrae int64_t st_size; 16511ab2aea2SLeon Alrae abi_long target_st_atime; 16521ab2aea2SLeon Alrae abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 16531ab2aea2SLeon Alrae abi_long target_st_mtime; 16541ab2aea2SLeon Alrae abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 16551ab2aea2SLeon Alrae abi_long target_st_ctime; 16561ab2aea2SLeon Alrae abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 16571ab2aea2SLeon Alrae abi_ulong st_blksize; 16581ab2aea2SLeon Alrae abi_ulong st_pad2; 16591ab2aea2SLeon Alrae int64_t st_blocks; 1660540635baSths }; 1661540635baSths 1662d26bc211Sths #elif defined(TARGET_ABI_MIPSO32) 1663048f6b4dSbellard 16645f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1665048f6b4dSbellard struct target_stat { 1666048f6b4dSbellard unsigned st_dev; 1667992f48a0Sblueswir1 abi_long st_pad1[3]; /* Reserved for network id */ 1668992f48a0Sblueswir1 abi_ulong st_ino; 1669048f6b4dSbellard unsigned int st_mode; 1670048f6b4dSbellard unsigned int st_nlink; 1671048f6b4dSbellard int st_uid; 1672048f6b4dSbellard int st_gid; 1673048f6b4dSbellard unsigned st_rdev; 1674992f48a0Sblueswir1 abi_long st_pad2[2]; 1675992f48a0Sblueswir1 abi_long st_size; 1676992f48a0Sblueswir1 abi_long st_pad3; 1677048f6b4dSbellard /* 1678048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1679048f6b4dSbellard * but we don't have it under Linux. 1680048f6b4dSbellard */ 1681992f48a0Sblueswir1 abi_long target_st_atime; 1682992f48a0Sblueswir1 abi_long target_st_atime_nsec; 1683992f48a0Sblueswir1 abi_long target_st_mtime; 1684992f48a0Sblueswir1 abi_long target_st_mtime_nsec; 1685992f48a0Sblueswir1 abi_long target_st_ctime; 1686992f48a0Sblueswir1 abi_long target_st_ctime_nsec; 1687992f48a0Sblueswir1 abi_long st_blksize; 1688992f48a0Sblueswir1 abi_long st_blocks; 1689992f48a0Sblueswir1 abi_long st_pad4[14]; 1690048f6b4dSbellard }; 1691048f6b4dSbellard 1692048f6b4dSbellard /* 1693048f6b4dSbellard * This matches struct stat64 in glibc2.1, hence the absolutely insane 1694048f6b4dSbellard * amounts of padding around dev_t's. The memory layout is the same as of 1695048f6b4dSbellard * struct stat of the 64-bit kernel. 1696048f6b4dSbellard */ 1697048f6b4dSbellard 169820d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1699048f6b4dSbellard struct target_stat64 { 1700992f48a0Sblueswir1 abi_ulong st_dev; 1701992f48a0Sblueswir1 abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 1702048f6b4dSbellard 1703048f6b4dSbellard uint64_t st_ino; 1704048f6b4dSbellard 1705048f6b4dSbellard unsigned int st_mode; 1706048f6b4dSbellard unsigned int st_nlink; 1707048f6b4dSbellard 1708048f6b4dSbellard int st_uid; 1709048f6b4dSbellard int st_gid; 1710048f6b4dSbellard 1711992f48a0Sblueswir1 abi_ulong st_rdev; 1712992f48a0Sblueswir1 abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 1713048f6b4dSbellard 1714048f6b4dSbellard int64_t st_size; 1715048f6b4dSbellard 1716048f6b4dSbellard /* 1717048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1718048f6b4dSbellard * but we don't have it under Linux. 1719048f6b4dSbellard */ 1720992f48a0Sblueswir1 abi_long target_st_atime; 1721992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 1722048f6b4dSbellard 1723992f48a0Sblueswir1 abi_long target_st_mtime; 1724992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 1725048f6b4dSbellard 1726992f48a0Sblueswir1 abi_long target_st_ctime; 1727992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 1728048f6b4dSbellard 1729992f48a0Sblueswir1 abi_ulong st_blksize; 1730992f48a0Sblueswir1 abi_ulong st_pad2; 1731048f6b4dSbellard 1732048f6b4dSbellard int64_t st_blocks; 1733048f6b4dSbellard }; 17347a3148a9Sj_mayer 17357a3148a9Sj_mayer #elif defined(TARGET_ALPHA) 17367a3148a9Sj_mayer 17377a3148a9Sj_mayer struct target_stat { 17387a3148a9Sj_mayer unsigned int st_dev; 17397a3148a9Sj_mayer unsigned int st_ino; 17407a3148a9Sj_mayer unsigned int st_mode; 17417a3148a9Sj_mayer unsigned int st_nlink; 17427a3148a9Sj_mayer unsigned int st_uid; 17437a3148a9Sj_mayer unsigned int st_gid; 17447a3148a9Sj_mayer unsigned int st_rdev; 1745992f48a0Sblueswir1 abi_long st_size; 1746992f48a0Sblueswir1 abi_ulong target_st_atime; 1747992f48a0Sblueswir1 abi_ulong target_st_mtime; 1748992f48a0Sblueswir1 abi_ulong target_st_ctime; 17497a3148a9Sj_mayer unsigned int st_blksize; 17507a3148a9Sj_mayer unsigned int st_blocks; 17517a3148a9Sj_mayer unsigned int st_flags; 17527a3148a9Sj_mayer unsigned int st_gen; 17537a3148a9Sj_mayer }; 17547a3148a9Sj_mayer 175520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 17567a3148a9Sj_mayer struct target_stat64 { 1757992f48a0Sblueswir1 abi_ulong st_dev; 1758992f48a0Sblueswir1 abi_ulong st_ino; 1759992f48a0Sblueswir1 abi_ulong st_rdev; 1760992f48a0Sblueswir1 abi_long st_size; 1761992f48a0Sblueswir1 abi_ulong st_blocks; 17627a3148a9Sj_mayer 17637a3148a9Sj_mayer unsigned int st_mode; 17647a3148a9Sj_mayer unsigned int st_uid; 17657a3148a9Sj_mayer unsigned int st_gid; 17667a3148a9Sj_mayer unsigned int st_blksize; 17677a3148a9Sj_mayer unsigned int st_nlink; 17687a3148a9Sj_mayer unsigned int __pad0; 17697a3148a9Sj_mayer 1770992f48a0Sblueswir1 abi_ulong target_st_atime; 1771992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1772992f48a0Sblueswir1 abi_ulong target_st_mtime; 1773992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1774992f48a0Sblueswir1 abi_ulong target_st_ctime; 1775992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1776992f48a0Sblueswir1 abi_long __unused[3]; 17777a3148a9Sj_mayer }; 17787a3148a9Sj_mayer 17796db45e65Sths #elif defined(TARGET_SH4) 17806db45e65Sths 17815f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 17826db45e65Sths struct target_stat { 1783992f48a0Sblueswir1 abi_ulong st_dev; 1784992f48a0Sblueswir1 abi_ulong st_ino; 17856db45e65Sths unsigned short st_mode; 17866db45e65Sths unsigned short st_nlink; 17876db45e65Sths unsigned short st_uid; 17886db45e65Sths unsigned short st_gid; 1789992f48a0Sblueswir1 abi_ulong st_rdev; 1790992f48a0Sblueswir1 abi_ulong st_size; 1791992f48a0Sblueswir1 abi_ulong st_blksize; 1792992f48a0Sblueswir1 abi_ulong st_blocks; 1793992f48a0Sblueswir1 abi_ulong target_st_atime; 1794992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1795992f48a0Sblueswir1 abi_ulong target_st_mtime; 1796992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1797992f48a0Sblueswir1 abi_ulong target_st_ctime; 1798992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1799992f48a0Sblueswir1 abi_ulong __unused4; 1800992f48a0Sblueswir1 abi_ulong __unused5; 18016db45e65Sths }; 18026db45e65Sths 18036db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely 18046db45e65Sths * insane amounts of padding around dev_t's. 18056db45e65Sths */ 180620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1807541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 18086db45e65Sths unsigned long long st_dev; 18096db45e65Sths unsigned char __pad0[4]; 18106db45e65Sths 18116db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1812992f48a0Sblueswir1 abi_ulong __st_ino; 18136db45e65Sths 18146db45e65Sths unsigned int st_mode; 18156db45e65Sths unsigned int st_nlink; 18166db45e65Sths 1817992f48a0Sblueswir1 abi_ulong st_uid; 1818992f48a0Sblueswir1 abi_ulong st_gid; 18196db45e65Sths 18206db45e65Sths unsigned long long st_rdev; 18216db45e65Sths unsigned char __pad3[4]; 18226db45e65Sths 18236db45e65Sths long long st_size; 1824992f48a0Sblueswir1 abi_ulong st_blksize; 18256db45e65Sths 18266db45e65Sths unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ 18276db45e65Sths 1828992f48a0Sblueswir1 abi_ulong target_st_atime; 1829992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 18306db45e65Sths 1831992f48a0Sblueswir1 abi_ulong target_st_mtime; 1832992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 18336db45e65Sths 1834992f48a0Sblueswir1 abi_ulong target_st_ctime; 1835992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 18366db45e65Sths 18376db45e65Sths unsigned long long st_ino; 18386db45e65Sths }; 18396db45e65Sths 1840d2fd1af7Sbellard #elif defined(TARGET_I386) && !defined(TARGET_ABI32) 18415f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1842d2fd1af7Sbellard struct target_stat { 1843d2fd1af7Sbellard abi_ulong st_dev; 1844d2fd1af7Sbellard abi_ulong st_ino; 1845d2fd1af7Sbellard abi_ulong st_nlink; 1846d2fd1af7Sbellard 1847d2fd1af7Sbellard unsigned int st_mode; 1848d2fd1af7Sbellard unsigned int st_uid; 1849d2fd1af7Sbellard unsigned int st_gid; 1850d2fd1af7Sbellard unsigned int __pad0; 1851d2fd1af7Sbellard abi_ulong st_rdev; 1852d2fd1af7Sbellard abi_long st_size; 1853d2fd1af7Sbellard abi_long st_blksize; 1854d2fd1af7Sbellard abi_long st_blocks; /* Number 512-byte blocks allocated. */ 1855d2fd1af7Sbellard 1856d2fd1af7Sbellard abi_ulong target_st_atime; 1857d2fd1af7Sbellard abi_ulong target_st_atime_nsec; 1858d2fd1af7Sbellard abi_ulong target_st_mtime; 1859d2fd1af7Sbellard abi_ulong target_st_mtime_nsec; 1860d2fd1af7Sbellard abi_ulong target_st_ctime; 1861d2fd1af7Sbellard abi_ulong target_st_ctime_nsec; 1862d2fd1af7Sbellard 1863d2fd1af7Sbellard abi_long __unused[3]; 1864d2fd1af7Sbellard }; 1865a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 1866a4c075f1SUlrich Hecht struct target_stat { 1867a4c075f1SUlrich Hecht abi_ulong st_dev; 1868a4c075f1SUlrich Hecht abi_ulong st_ino; 1869a4c075f1SUlrich Hecht abi_ulong st_nlink; 1870a4c075f1SUlrich Hecht unsigned int st_mode; 1871a4c075f1SUlrich Hecht unsigned int st_uid; 1872a4c075f1SUlrich Hecht unsigned int st_gid; 1873a4c075f1SUlrich Hecht unsigned int __pad1; 1874a4c075f1SUlrich Hecht abi_ulong st_rdev; 1875a4c075f1SUlrich Hecht abi_ulong st_size; 1876a4c075f1SUlrich Hecht abi_ulong target_st_atime; 1877a4c075f1SUlrich Hecht abi_ulong target_st_atime_nsec; 1878a4c075f1SUlrich Hecht abi_ulong target_st_mtime; 1879a4c075f1SUlrich Hecht abi_ulong target_st_mtime_nsec; 1880a4c075f1SUlrich Hecht abi_ulong target_st_ctime; 1881a4c075f1SUlrich Hecht abi_ulong target_st_ctime_nsec; 1882a4c075f1SUlrich Hecht abi_ulong st_blksize; 1883a4c075f1SUlrich Hecht abi_long st_blocks; 1884a4c075f1SUlrich Hecht abi_ulong __unused[3]; 1885a4c075f1SUlrich Hecht }; 188609701199SAlexander Graf #elif defined(TARGET_AARCH64) 18875f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 188809701199SAlexander Graf struct target_stat { 188909701199SAlexander Graf abi_ulong st_dev; 189009701199SAlexander Graf abi_ulong st_ino; 189109701199SAlexander Graf unsigned int st_mode; 189209701199SAlexander Graf unsigned int st_nlink; 189309701199SAlexander Graf unsigned int st_uid; 189409701199SAlexander Graf unsigned int st_gid; 189509701199SAlexander Graf abi_ulong st_rdev; 189609701199SAlexander Graf abi_ulong _pad1; 189709701199SAlexander Graf abi_long st_size; 189809701199SAlexander Graf int st_blksize; 189909701199SAlexander Graf int __pad2; 190009701199SAlexander Graf abi_long st_blocks; 190109701199SAlexander Graf abi_long target_st_atime; 190209701199SAlexander Graf abi_ulong target_st_atime_nsec; 190309701199SAlexander Graf abi_long target_st_mtime; 190409701199SAlexander Graf abi_ulong target_st_mtime_nsec; 190509701199SAlexander Graf abi_long target_st_ctime; 190609701199SAlexander Graf abi_ulong target_st_ctime_nsec; 190709701199SAlexander Graf unsigned int __unused[2]; 190809701199SAlexander Graf }; 1909ba7651fbSMax Filippov #elif defined(TARGET_XTENSA) 19105f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1911ba7651fbSMax Filippov struct target_stat { 1912ba7651fbSMax Filippov abi_ulong st_dev; 1913ba7651fbSMax Filippov abi_ulong st_ino; 1914ba7651fbSMax Filippov unsigned int st_mode; 1915ba7651fbSMax Filippov unsigned int st_nlink; 1916ba7651fbSMax Filippov unsigned int st_uid; 1917ba7651fbSMax Filippov unsigned int st_gid; 1918ba7651fbSMax Filippov abi_ulong st_rdev; 1919ba7651fbSMax Filippov abi_long st_size; 1920ba7651fbSMax Filippov abi_ulong st_blksize; 1921ba7651fbSMax Filippov abi_ulong st_blocks; 1922ba7651fbSMax Filippov abi_ulong target_st_atime; 1923ba7651fbSMax Filippov abi_ulong target_st_atime_nsec; 1924ba7651fbSMax Filippov abi_ulong target_st_mtime; 1925ba7651fbSMax Filippov abi_ulong target_st_mtime_nsec; 1926ba7651fbSMax Filippov abi_ulong target_st_ctime; 1927ba7651fbSMax Filippov abi_ulong target_st_ctime_nsec; 1928ba7651fbSMax Filippov abi_ulong __unused4; 1929ba7651fbSMax Filippov abi_ulong __unused5; 1930ba7651fbSMax Filippov }; 1931ba7651fbSMax Filippov 1932ba7651fbSMax Filippov #define TARGET_HAS_STRUCT_STAT64 1933ba7651fbSMax Filippov struct target_stat64 { 1934ba7651fbSMax Filippov uint64_t st_dev; /* Device */ 1935ba7651fbSMax Filippov uint64_t st_ino; /* File serial number */ 1936ba7651fbSMax Filippov unsigned int st_mode; /* File mode. */ 1937ba7651fbSMax Filippov unsigned int st_nlink; /* Link count. */ 1938ba7651fbSMax Filippov unsigned int st_uid; /* User ID of the file's owner. */ 1939ba7651fbSMax Filippov unsigned int st_gid; /* Group ID of the file's group. */ 1940ba7651fbSMax Filippov uint64_t st_rdev; /* Device number, if device. */ 1941ba7651fbSMax Filippov int64_t st_size; /* Size of file, in bytes. */ 1942ba7651fbSMax Filippov abi_ulong st_blksize; /* Optimal block size for I/O. */ 1943ba7651fbSMax Filippov abi_ulong __unused2; 1944ba7651fbSMax Filippov uint64_t st_blocks; /* Number 512-byte blocks allocated. */ 1945ba7651fbSMax Filippov abi_ulong target_st_atime; /* Time of last access. */ 1946ba7651fbSMax Filippov abi_ulong target_st_atime_nsec; 1947ba7651fbSMax Filippov abi_ulong target_st_mtime; /* Time of last modification. */ 1948ba7651fbSMax Filippov abi_ulong target_st_mtime_nsec; 1949ba7651fbSMax Filippov abi_ulong target_st_ctime; /* Time of last status change. */ 1950ba7651fbSMax Filippov abi_ulong target_st_ctime_nsec; 1951ba7651fbSMax Filippov abi_ulong __unused4; 1952ba7651fbSMax Filippov abi_ulong __unused5; 1953ba7651fbSMax Filippov }; 1954ba7651fbSMax Filippov 1955a0a839b6SMarek Vasut #elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) || \ 195647ae93cdSMichael Clark defined(TARGET_NIOS2) || defined(TARGET_RISCV) 1957c7819dfbSPeter Maydell 1958c7819dfbSPeter Maydell /* These are the asm-generic versions of the stat and stat64 structures */ 1959c7819dfbSPeter Maydell 19605f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1961d962783eSJia Liu struct target_stat { 1962d962783eSJia Liu abi_ulong st_dev; 1963d962783eSJia Liu abi_ulong st_ino; 1964d962783eSJia Liu unsigned int st_mode; 1965c7819dfbSPeter Maydell unsigned int st_nlink; 1966d962783eSJia Liu unsigned int st_uid; 1967d962783eSJia Liu unsigned int st_gid; 1968d962783eSJia Liu abi_ulong st_rdev; 1969c7819dfbSPeter Maydell abi_ulong __pad1; 1970d962783eSJia Liu abi_long st_size; 1971c7819dfbSPeter Maydell int st_blksize; 1972c7819dfbSPeter Maydell int __pad2; 1973c7819dfbSPeter Maydell abi_long st_blocks; 1974c7819dfbSPeter Maydell abi_long target_st_atime; 1975d962783eSJia Liu abi_ulong target_st_atime_nsec; 1976c7819dfbSPeter Maydell abi_long target_st_mtime; 1977d962783eSJia Liu abi_ulong target_st_mtime_nsec; 1978c7819dfbSPeter Maydell abi_long target_st_ctime; 1979d962783eSJia Liu abi_ulong target_st_ctime_nsec; 1980c7819dfbSPeter Maydell unsigned int __unused4; 1981c7819dfbSPeter Maydell unsigned int __unused5; 1982d962783eSJia Liu }; 1983c7819dfbSPeter Maydell 198447ae93cdSMichael Clark #if !defined(TARGET_RISCV64) 198520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1986c7819dfbSPeter Maydell struct target_stat64 { 1987c7819dfbSPeter Maydell uint64_t st_dev; 1988c7819dfbSPeter Maydell uint64_t st_ino; 1989c7819dfbSPeter Maydell unsigned int st_mode; 1990c7819dfbSPeter Maydell unsigned int st_nlink; 1991c7819dfbSPeter Maydell unsigned int st_uid; 1992c7819dfbSPeter Maydell unsigned int st_gid; 1993c7819dfbSPeter Maydell uint64_t st_rdev; 1994c7819dfbSPeter Maydell uint64_t __pad1; 1995c7819dfbSPeter Maydell int64_t st_size; 1996c7819dfbSPeter Maydell int st_blksize; 1997c7819dfbSPeter Maydell int __pad2; 1998c7819dfbSPeter Maydell int64_t st_blocks; 1999c7819dfbSPeter Maydell int target_st_atime; 2000c7819dfbSPeter Maydell unsigned int target_st_atime_nsec; 2001c7819dfbSPeter Maydell int target_st_mtime; 2002c7819dfbSPeter Maydell unsigned int target_st_mtime_nsec; 2003c7819dfbSPeter Maydell int target_st_ctime; 2004c7819dfbSPeter Maydell unsigned int target_st_ctime_nsec; 2005c7819dfbSPeter Maydell unsigned int __unused4; 2006c7819dfbSPeter Maydell unsigned int __unused5; 2007c7819dfbSPeter Maydell }; 200847ae93cdSMichael Clark #endif 2009c7819dfbSPeter Maydell 2010a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 2011a10d1e50SRichard Henderson 20125f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 2013a10d1e50SRichard Henderson struct target_stat { 2014a10d1e50SRichard Henderson abi_uint st_dev; 2015a10d1e50SRichard Henderson abi_uint st_ino; 2016a10d1e50SRichard Henderson abi_ushort st_mode; 2017a10d1e50SRichard Henderson abi_ushort st_nlink; 2018a10d1e50SRichard Henderson abi_ushort _res1; 2019a10d1e50SRichard Henderson abi_ushort _res2; 2020a10d1e50SRichard Henderson abi_uint st_rdev; 2021a10d1e50SRichard Henderson abi_int st_size; 2022a10d1e50SRichard Henderson abi_int target_st_atime; 2023a10d1e50SRichard Henderson abi_uint target_st_atime_nsec; 2024a10d1e50SRichard Henderson abi_int target_st_mtime; 2025a10d1e50SRichard Henderson abi_uint target_st_mtime_nsec; 2026a10d1e50SRichard Henderson abi_int target_st_ctime; 2027a10d1e50SRichard Henderson abi_uint target_st_ctime_nsec; 2028a10d1e50SRichard Henderson abi_int st_blksize; 2029a10d1e50SRichard Henderson abi_int st_blocks; 2030a10d1e50SRichard Henderson abi_uint _unused1; 2031a10d1e50SRichard Henderson abi_uint _unused2; 2032a10d1e50SRichard Henderson abi_uint _unused3; 2033a10d1e50SRichard Henderson abi_uint _unused4; 2034a10d1e50SRichard Henderson abi_ushort _unused5; 2035a10d1e50SRichard Henderson abi_short st_fstype; 2036a10d1e50SRichard Henderson abi_uint st_realdev; 2037a10d1e50SRichard Henderson abi_ushort st_basemode; 2038a10d1e50SRichard Henderson abi_ushort _unused6; 2039a10d1e50SRichard Henderson abi_uint st_uid; 2040a10d1e50SRichard Henderson abi_uint st_gid; 2041a10d1e50SRichard Henderson abi_uint _unused7[3]; 2042a10d1e50SRichard Henderson }; 2043a10d1e50SRichard Henderson 2044a10d1e50SRichard Henderson #define TARGET_HAS_STRUCT_STAT64 2045a10d1e50SRichard Henderson struct target_stat64 { 2046a10d1e50SRichard Henderson uint64_t st_dev; 2047a10d1e50SRichard Henderson abi_uint _pad1; 2048a10d1e50SRichard Henderson abi_uint _res1; 2049a10d1e50SRichard Henderson abi_uint st_mode; 2050a10d1e50SRichard Henderson abi_uint st_nlink; 2051a10d1e50SRichard Henderson abi_uint st_uid; 2052a10d1e50SRichard Henderson abi_uint st_gid; 2053a10d1e50SRichard Henderson uint64_t st_rdev; 2054a10d1e50SRichard Henderson abi_uint _pad2; 2055a10d1e50SRichard Henderson int64_t st_size; 2056a10d1e50SRichard Henderson abi_int st_blksize; 2057a10d1e50SRichard Henderson int64_t st_blocks; 2058a10d1e50SRichard Henderson abi_int target_st_atime; 2059a10d1e50SRichard Henderson abi_uint target_st_atime_nsec; 2060a10d1e50SRichard Henderson abi_int target_st_mtime; 2061a10d1e50SRichard Henderson abi_uint target_st_mtime_nsec; 2062a10d1e50SRichard Henderson abi_int target_st_ctime; 2063a10d1e50SRichard Henderson abi_uint target_st_ctime_nsec; 2064a10d1e50SRichard Henderson uint64_t st_ino; 2065a10d1e50SRichard Henderson }; 2066a10d1e50SRichard Henderson 2067048f6b4dSbellard #else 2068048f6b4dSbellard #error unsupported CPU 2069048f6b4dSbellard #endif 20702521d698Sbellard 20714ce6f8deSths typedef struct { 20724ce6f8deSths int val[2]; 2073c227f099SAnthony Liguori } target_fsid_t; 20744ce6f8deSths 207556c8f68fSbellard #ifdef TARGET_MIPS 2076d26bc211Sths #ifdef TARGET_ABI_MIPSN32 2077540635baSths struct target_statfs { 2078540635baSths int32_t f_type; 2079540635baSths int32_t f_bsize; 2080540635baSths int32_t f_frsize; /* Fragment size - unsupported */ 2081540635baSths int32_t f_blocks; 2082540635baSths int32_t f_bfree; 2083540635baSths int32_t f_files; 2084540635baSths int32_t f_ffree; 2085540635baSths int32_t f_bavail; 2086540635baSths 2087540635baSths /* Linux specials */ 2088c227f099SAnthony Liguori target_fsid_t f_fsid; 2089540635baSths int32_t f_namelen; 2090d4247ec2SShea Levy int32_t f_flags; 2091d4247ec2SShea Levy int32_t f_spare[5]; 2092540635baSths }; 2093540635baSths #else 209456c8f68fSbellard struct target_statfs { 2095992f48a0Sblueswir1 abi_long f_type; 2096992f48a0Sblueswir1 abi_long f_bsize; 2097992f48a0Sblueswir1 abi_long f_frsize; /* Fragment size - unsupported */ 2098992f48a0Sblueswir1 abi_long f_blocks; 2099992f48a0Sblueswir1 abi_long f_bfree; 2100992f48a0Sblueswir1 abi_long f_files; 2101992f48a0Sblueswir1 abi_long f_ffree; 2102992f48a0Sblueswir1 abi_long f_bavail; 210356c8f68fSbellard 210456c8f68fSbellard /* Linux specials */ 2105c227f099SAnthony Liguori target_fsid_t f_fsid; 2106992f48a0Sblueswir1 abi_long f_namelen; 2107d4247ec2SShea Levy abi_long f_flags; 2108d4247ec2SShea Levy abi_long f_spare[5]; 210956c8f68fSbellard }; 2110540635baSths #endif 211156c8f68fSbellard 211256c8f68fSbellard struct target_statfs64 { 211356c8f68fSbellard uint32_t f_type; 211456c8f68fSbellard uint32_t f_bsize; 211556c8f68fSbellard uint32_t f_frsize; /* Fragment size - unsupported */ 211656c8f68fSbellard uint32_t __pad; 211756c8f68fSbellard uint64_t f_blocks; 211856c8f68fSbellard uint64_t f_bfree; 211956c8f68fSbellard uint64_t f_files; 212056c8f68fSbellard uint64_t f_ffree; 212156c8f68fSbellard uint64_t f_bavail; 2122c227f099SAnthony Liguori target_fsid_t f_fsid; 212356c8f68fSbellard uint32_t f_namelen; 2124d4247ec2SShea Levy uint32_t f_flags; 2125d4247ec2SShea Levy uint32_t f_spare[5]; 212656c8f68fSbellard }; 2127c4d10628Sbalrog #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ 212847ae93cdSMichael Clark defined(TARGET_SPARC64) || defined(TARGET_AARCH64) || \ 212947ae93cdSMichael Clark defined(TARGET_RISCV)) && !defined(TARGET_ABI32) 2130325e651fSj_mayer struct target_statfs { 2131325e651fSj_mayer abi_long f_type; 2132325e651fSj_mayer abi_long f_bsize; 2133325e651fSj_mayer abi_long f_blocks; 2134325e651fSj_mayer abi_long f_bfree; 2135325e651fSj_mayer abi_long f_bavail; 2136325e651fSj_mayer abi_long f_files; 2137325e651fSj_mayer abi_long f_ffree; 2138c227f099SAnthony Liguori target_fsid_t f_fsid; 2139325e651fSj_mayer abi_long f_namelen; 2140325e651fSj_mayer abi_long f_frsize; 2141d4247ec2SShea Levy abi_long f_flags; 2142d4247ec2SShea Levy abi_long f_spare[4]; 2143325e651fSj_mayer }; 2144325e651fSj_mayer 2145325e651fSj_mayer struct target_statfs64 { 2146325e651fSj_mayer abi_long f_type; 2147325e651fSj_mayer abi_long f_bsize; 2148325e651fSj_mayer abi_long f_blocks; 2149325e651fSj_mayer abi_long f_bfree; 2150325e651fSj_mayer abi_long f_bavail; 2151325e651fSj_mayer abi_long f_files; 2152325e651fSj_mayer abi_long f_ffree; 2153c227f099SAnthony Liguori target_fsid_t f_fsid; 2154325e651fSj_mayer abi_long f_namelen; 2155325e651fSj_mayer abi_long f_frsize; 2156d4247ec2SShea Levy abi_long f_flags; 2157d4247ec2SShea Levy abi_long f_spare[4]; 2158325e651fSj_mayer }; 2159a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 2160a4c075f1SUlrich Hecht struct target_statfs { 2161a4c075f1SUlrich Hecht int32_t f_type; 2162a4c075f1SUlrich Hecht int32_t f_bsize; 2163a4c075f1SUlrich Hecht abi_long f_blocks; 2164a4c075f1SUlrich Hecht abi_long f_bfree; 2165a4c075f1SUlrich Hecht abi_long f_bavail; 2166a4c075f1SUlrich Hecht abi_long f_files; 2167a4c075f1SUlrich Hecht abi_long f_ffree; 2168a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2169a4c075f1SUlrich Hecht int32_t f_namelen; 2170a4c075f1SUlrich Hecht int32_t f_frsize; 2171d4247ec2SShea Levy int32_t f_flags; 2172d4247ec2SShea Levy int32_t f_spare[4]; 2173d4247ec2SShea Levy 2174a4c075f1SUlrich Hecht }; 2175a4c075f1SUlrich Hecht 2176a4c075f1SUlrich Hecht struct target_statfs64 { 2177a4c075f1SUlrich Hecht int32_t f_type; 2178a4c075f1SUlrich Hecht int32_t f_bsize; 2179a4c075f1SUlrich Hecht abi_long f_blocks; 2180a4c075f1SUlrich Hecht abi_long f_bfree; 2181a4c075f1SUlrich Hecht abi_long f_bavail; 2182a4c075f1SUlrich Hecht abi_long f_files; 2183a4c075f1SUlrich Hecht abi_long f_ffree; 2184a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2185a4c075f1SUlrich Hecht int32_t f_namelen; 2186a4c075f1SUlrich Hecht int32_t f_frsize; 2187d4247ec2SShea Levy int32_t f_flags; 2188d4247ec2SShea Levy int32_t f_spare[4]; 2189a4c075f1SUlrich Hecht }; 219056c8f68fSbellard #else 219156c8f68fSbellard struct target_statfs { 219256c8f68fSbellard uint32_t f_type; 219356c8f68fSbellard uint32_t f_bsize; 219456c8f68fSbellard uint32_t f_blocks; 219556c8f68fSbellard uint32_t f_bfree; 219656c8f68fSbellard uint32_t f_bavail; 219756c8f68fSbellard uint32_t f_files; 219856c8f68fSbellard uint32_t f_ffree; 2199c227f099SAnthony Liguori target_fsid_t f_fsid; 220056c8f68fSbellard uint32_t f_namelen; 220156c8f68fSbellard uint32_t f_frsize; 2202d4247ec2SShea Levy uint32_t f_flags; 2203d4247ec2SShea Levy uint32_t f_spare[4]; 220456c8f68fSbellard }; 220556c8f68fSbellard 220656c8f68fSbellard struct target_statfs64 { 220756c8f68fSbellard uint32_t f_type; 220856c8f68fSbellard uint32_t f_bsize; 220956c8f68fSbellard uint64_t f_blocks; 221056c8f68fSbellard uint64_t f_bfree; 221156c8f68fSbellard uint64_t f_bavail; 221256c8f68fSbellard uint64_t f_files; 221356c8f68fSbellard uint64_t f_ffree; 2214c227f099SAnthony Liguori target_fsid_t f_fsid; 221556c8f68fSbellard uint32_t f_namelen; 221656c8f68fSbellard uint32_t f_frsize; 2217d4247ec2SShea Levy uint32_t f_flags; 2218d4247ec2SShea Levy uint32_t f_spare[4]; 221956c8f68fSbellard }; 222056c8f68fSbellard #endif 222156c8f68fSbellard 22227e22e546SUlrich Hecht #define TARGET_F_LINUX_SPECIFIC_BASE 1024 22237e22e546SUlrich Hecht #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0) 22247e22e546SUlrich Hecht #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1) 22257e22e546SUlrich Hecht #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) 22267e3b92ecSPeter Maydell #define TARGET_F_SETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 7) 22277e3b92ecSPeter Maydell #define TARGET_F_GETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 8) 22287e22e546SUlrich Hecht #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2) 22297e22e546SUlrich Hecht 22305de7706eSLaurent Vivier #include "target_fcntl.h" 22318d5d3004SAndreas Schwab 22322521d698Sbellard /* soundcard defines */ 223367cc32ebSVeres Lajos /* XXX: convert them all to arch independent entries */ 22342521d698Sbellard #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); 22352521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 22362521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 22372521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 22382521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA 0xc0144302 22392521d698Sbellard #define TARGET_SNDCTL_COPR_RESET 0x00004300 22402521d698Sbellard #define TARGET_SNDCTL_COPR_RUN 0xc0144306 22412521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 22422521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE 0x40144305 22432521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA 0x40144304 22442521d698Sbellard #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) 22452521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) 22462521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) 22472521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) 22482521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) 22492521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) 22502521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) 22512521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) 22522521d698Sbellard #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) 22532521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) 22542521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) 22552521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) 22562521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) 22572521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) 22582521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) 22592521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) 22602521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) 22612521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) 22625f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19) 22635f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20) 22642521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e 22652521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 22662521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 22672521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 22682521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 22692521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f 22702521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 22712521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO 0xc074510c 22722521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 22732521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 22742521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 22752521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 22762521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 22772521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 22782521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 22792521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 22802521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b 22812521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a 22822521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 22832521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC 0x00005111 22842521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 22852521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET 0x00005100 22862521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 22872521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC 0x00005101 22882521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 22892521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d 22902521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d 22912521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 22922521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e 22932521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 22942521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME 0x40045407 22952521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT 0x40045408 22962521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 22972521d698Sbellard #define TARGET_SNDCTL_TMR_START 0x00005402 22982521d698Sbellard #define TARGET_SNDCTL_TMR_STOP 0x00005403 22992521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 23002521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 23012521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE 0x80045002 23022521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 23032521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS 0x80045005 23042521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 23052521d698Sbellard #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) 23062521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 23072521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) 23082521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) 23092521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) 23102521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) 23112521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) 23122521d698Sbellard 23132521d698Sbellard #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) 23142521d698Sbellard 23152521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) 23162521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) 23172521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) 23182521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) 23192521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) 23202521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) 23212521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) 23222521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) 23232521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) 23242521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) 23252521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) 23262521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) 23272521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) 23282521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) 23292521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) 23302521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) 23312521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) 23322521d698Sbellard 23332521d698Sbellard /* Obsolete macros */ 23342521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) 23352521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) 23362521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) 23372521d698Sbellard 23382521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) 23392521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) 23402521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) 23412521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) 23422521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) 23432521d698Sbellard 23442521d698Sbellard #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) 23452521d698Sbellard 23462521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) 23472521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) 23482521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) 23492521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) 23502521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) 23512521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) 23522521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) 23532521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) 23542521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) 23552521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) 23562521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) 23572521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) 23582521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) 23592521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) 23602521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) 23612521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) 23622521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) 23632521d698Sbellard 23642521d698Sbellard /* Obsolete macros */ 23652521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) 23662521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) 23672521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) 23682521d698Sbellard 23692521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) 23702521d698Sbellard 23712521d698Sbellard /* vfat ioctls */ 23722521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) 23732521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) 2374a5448a7dSbellard 2375f443e396SPeter Maydell struct target_mtop { 2376f443e396SPeter Maydell abi_short mt_op; 2377f443e396SPeter Maydell abi_int mt_count; 2378f443e396SPeter Maydell }; 2379f443e396SPeter Maydell 2380f443e396SPeter Maydell #if defined(TARGET_SPARC) || defined(TARGET_MIPS) 2381f443e396SPeter Maydell typedef abi_long target_kernel_daddr_t; 2382f443e396SPeter Maydell #else 2383f443e396SPeter Maydell typedef abi_int target_kernel_daddr_t; 2384f443e396SPeter Maydell #endif 2385f443e396SPeter Maydell 2386f443e396SPeter Maydell struct target_mtget { 2387f443e396SPeter Maydell abi_long mt_type; 2388f443e396SPeter Maydell abi_long mt_resid; 2389f443e396SPeter Maydell abi_long mt_dsreg; 2390f443e396SPeter Maydell abi_long mt_gstat; 2391f443e396SPeter Maydell abi_long mt_erreg; 2392f443e396SPeter Maydell target_kernel_daddr_t mt_fileno; 2393f443e396SPeter Maydell target_kernel_daddr_t mt_blkno; 2394f443e396SPeter Maydell }; 2395f443e396SPeter Maydell 2396f443e396SPeter Maydell struct target_mtpos { 2397f443e396SPeter Maydell abi_long mt_blkno; 2398f443e396SPeter Maydell }; 2399f443e396SPeter Maydell 2400f443e396SPeter Maydell #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct target_mtop) 2401f443e396SPeter Maydell #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct target_mtget) 2402f443e396SPeter Maydell #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct target_mtpos) 24038fbd6b52Sbalrog 2404a5448a7dSbellard struct target_sysinfo { 2405992f48a0Sblueswir1 abi_long uptime; /* Seconds since boot */ 2406992f48a0Sblueswir1 abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */ 2407992f48a0Sblueswir1 abi_ulong totalram; /* Total usable main memory size */ 2408992f48a0Sblueswir1 abi_ulong freeram; /* Available memory size */ 2409992f48a0Sblueswir1 abi_ulong sharedram; /* Amount of shared memory */ 2410992f48a0Sblueswir1 abi_ulong bufferram; /* Memory used by buffers */ 2411992f48a0Sblueswir1 abi_ulong totalswap; /* Total swap space size */ 2412992f48a0Sblueswir1 abi_ulong freeswap; /* swap space still available */ 2413a5448a7dSbellard unsigned short procs; /* Number of current processes */ 2414a5448a7dSbellard unsigned short pad; /* explicit padding for m68k */ 2415992f48a0Sblueswir1 abi_ulong totalhigh; /* Total high memory size */ 2416992f48a0Sblueswir1 abi_ulong freehigh; /* Available high memory size */ 2417a5448a7dSbellard unsigned int mem_unit; /* Memory unit size in bytes */ 2418992f48a0Sblueswir1 char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 2419a5448a7dSbellard }; 24203532fa74Sbellard 24216556a833Saurel32 struct linux_dirent { 24226556a833Saurel32 long d_ino; 24236556a833Saurel32 unsigned long d_off; 24246556a833Saurel32 unsigned short d_reclen; 24256556a833Saurel32 char d_name[256]; /* We must not include limits.h! */ 24266556a833Saurel32 }; 24276556a833Saurel32 24286556a833Saurel32 struct linux_dirent64 { 24296556a833Saurel32 uint64_t d_ino; 24306556a833Saurel32 int64_t d_off; 24316556a833Saurel32 unsigned short d_reclen; 24326556a833Saurel32 unsigned char d_type; 24336556a833Saurel32 char d_name[256]; 24346556a833Saurel32 }; 24356556a833Saurel32 243624e1003aSaurel32 struct target_mq_attr { 243724e1003aSaurel32 abi_long mq_flags; 243824e1003aSaurel32 abi_long mq_maxmsg; 243924e1003aSaurel32 abi_long mq_msgsize; 244024e1003aSaurel32 abi_long mq_curmsgs; 244124e1003aSaurel32 }; 244224e1003aSaurel32 24433532fa74Sbellard #include "socket.h" 2444637947f1Sths 2445637947f1Sths #include "errno_defs.h" 244603dfe9f8SRiku Voipio 244703dfe9f8SRiku Voipio #define FUTEX_WAIT 0 244803dfe9f8SRiku Voipio #define FUTEX_WAKE 1 244903dfe9f8SRiku Voipio #define FUTEX_FD 2 245003dfe9f8SRiku Voipio #define FUTEX_REQUEUE 3 245103dfe9f8SRiku Voipio #define FUTEX_CMP_REQUEUE 4 245203dfe9f8SRiku Voipio #define FUTEX_WAKE_OP 5 245303dfe9f8SRiku Voipio #define FUTEX_LOCK_PI 6 245403dfe9f8SRiku Voipio #define FUTEX_UNLOCK_PI 7 245503dfe9f8SRiku Voipio #define FUTEX_TRYLOCK_PI 8 245603dfe9f8SRiku Voipio #define FUTEX_WAIT_BITSET 9 245703dfe9f8SRiku Voipio #define FUTEX_WAKE_BITSET 10 245803dfe9f8SRiku Voipio 245903dfe9f8SRiku Voipio #define FUTEX_PRIVATE_FLAG 128 246003dfe9f8SRiku Voipio #define FUTEX_CLOCK_REALTIME 256 246103dfe9f8SRiku Voipio #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) 246203dfe9f8SRiku Voipio 24633b6edd16SPeter Maydell #ifdef CONFIG_EPOLL 2464928bed6aSLaurent Vivier #if defined(TARGET_X86_64) 2465928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED QEMU_PACKED 2466928bed6aSLaurent Vivier #else 2467928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED 2468928bed6aSLaurent Vivier #endif 2469928bed6aSLaurent Vivier 24703b6edd16SPeter Maydell typedef union target_epoll_data { 24713b6edd16SPeter Maydell abi_ulong ptr; 2472928bed6aSLaurent Vivier abi_int fd; 2473928bed6aSLaurent Vivier abi_uint u32; 2474928bed6aSLaurent Vivier abi_ullong u64; 24753b6edd16SPeter Maydell } target_epoll_data_t; 24763b6edd16SPeter Maydell 24773b6edd16SPeter Maydell struct target_epoll_event { 2478928bed6aSLaurent Vivier abi_uint events; 24793b6edd16SPeter Maydell target_epoll_data_t data; 2480928bed6aSLaurent Vivier } TARGET_EPOLL_PACKED; 24812ba7fae3SPeter Maydell 24822ba7fae3SPeter Maydell #define TARGET_EP_MAX_EVENTS (INT_MAX / sizeof(struct target_epoll_event)) 24832ba7fae3SPeter Maydell 24843b6edd16SPeter Maydell #endif 2485163a05a8SPeter Maydell struct target_rlimit64 { 2486163a05a8SPeter Maydell uint64_t rlim_cur; 2487163a05a8SPeter Maydell uint64_t rlim_max; 2488163a05a8SPeter Maydell }; 2489583359a6SAkos PASZTORY 2490583359a6SAkos PASZTORY struct target_ucred { 2491583359a6SAkos PASZTORY uint32_t pid; 2492583359a6SAkos PASZTORY uint32_t uid; 2493583359a6SAkos PASZTORY uint32_t gid; 2494583359a6SAkos PASZTORY }; 2495cb9c377fSPaolo Bonzini 2496aecc8861SAlexander Graf typedef int32_t target_timer_t; 2497905bba13SErik de Castro Lopo 249834d60862SNatanael Copa #define TARGET_SIGEV_MAX_SIZE 64 249934d60862SNatanael Copa 250034d60862SNatanael Copa /* This is architecture-specific but most architectures use the default */ 250134d60862SNatanael Copa #ifdef TARGET_MIPS 250234d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long)) 250334d60862SNatanael Copa #else 250434d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ 250534d60862SNatanael Copa + sizeof(target_sigval_t)) 250634d60862SNatanael Copa #endif 250734d60862SNatanael Copa 250834d60862SNatanael Copa #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ 250934d60862SNatanael Copa - TARGET_SIGEV_PREAMBLE_SIZE) \ 251034d60862SNatanael Copa / sizeof(int32_t)) 251134d60862SNatanael Copa 2512905bba13SErik de Castro Lopo struct target_sigevent { 2513905bba13SErik de Castro Lopo target_sigval_t sigev_value; 251417351c3fSPeter Maydell abi_int sigev_signo; 251517351c3fSPeter Maydell abi_int sigev_notify; 2516905bba13SErik de Castro Lopo union { 251717351c3fSPeter Maydell abi_int _pad[TARGET_SIGEV_PAD_SIZE]; 251817351c3fSPeter Maydell abi_int _tid; 2519905bba13SErik de Castro Lopo 252017351c3fSPeter Maydell /* The kernel (and thus QEMU) never looks at these; 252117351c3fSPeter Maydell * they're only used as part of the ABI between a 252217351c3fSPeter Maydell * userspace program and libc. 252317351c3fSPeter Maydell */ 2524905bba13SErik de Castro Lopo struct { 252517351c3fSPeter Maydell abi_ulong _function; 252617351c3fSPeter Maydell abi_ulong _attribute; 2527905bba13SErik de Castro Lopo } _sigev_thread; 2528905bba13SErik de Castro Lopo } _sigev_un; 2529905bba13SErik de Castro Lopo }; 2530e0eb210eSPeter Maydell 2531e0eb210eSPeter Maydell struct target_user_cap_header { 2532e0eb210eSPeter Maydell uint32_t version; 2533e0eb210eSPeter Maydell int pid; 2534e0eb210eSPeter Maydell }; 2535e0eb210eSPeter Maydell 2536e0eb210eSPeter Maydell struct target_user_cap_data { 2537e0eb210eSPeter Maydell uint32_t effective; 2538e0eb210eSPeter Maydell uint32_t permitted; 2539e0eb210eSPeter Maydell uint32_t inheritable; 2540e0eb210eSPeter Maydell }; 25411b3c4fdfSMarkus Armbruster 2542da2c8ad7SAleksandar Markovic /* from kernel's include/linux/syslog.h */ 2543da2c8ad7SAleksandar Markovic 2544da2c8ad7SAleksandar Markovic /* Close the log. Currently a NOP. */ 2545da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CLOSE 0 2546da2c8ad7SAleksandar Markovic /* Open the log. Currently a NOP. */ 2547da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_OPEN 1 2548da2c8ad7SAleksandar Markovic /* Read from the log. */ 2549da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ 2 2550da2c8ad7SAleksandar Markovic /* Read all messages remaining in the ring buffer. */ 2551da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ_ALL 3 2552da2c8ad7SAleksandar Markovic /* Read and clear all messages remaining in the ring buffer */ 2553da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ_CLEAR 4 2554da2c8ad7SAleksandar Markovic /* Clear ring buffer. */ 2555da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CLEAR 5 2556da2c8ad7SAleksandar Markovic /* Disable printk's to console */ 2557da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_OFF 6 2558da2c8ad7SAleksandar Markovic /* Enable printk's to console */ 2559da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_ON 7 2560da2c8ad7SAleksandar Markovic /* Set level of messages printed to console */ 2561da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_LEVEL 8 2562da2c8ad7SAleksandar Markovic /* Return number of unread characters in the log buffer */ 2563da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_SIZE_UNREAD 9 2564da2c8ad7SAleksandar Markovic /* Return size of the log buffer */ 2565da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10 2566da2c8ad7SAleksandar Markovic 2567efa92184SAleksandar Rikalo struct target_statx_timestamp { 2568efa92184SAleksandar Rikalo int64_t tv_sec; 2569efa92184SAleksandar Rikalo uint32_t tv_nsec; 2570efa92184SAleksandar Rikalo int32_t __reserved; 2571efa92184SAleksandar Rikalo }; 2572efa92184SAleksandar Rikalo 2573efa92184SAleksandar Rikalo struct target_statx { 2574efa92184SAleksandar Rikalo /* 0x00 */ 2575efa92184SAleksandar Rikalo uint32_t stx_mask; /* What results were written [uncond] */ 2576efa92184SAleksandar Rikalo uint32_t stx_blksize; /* Preferred general I/O size [uncond] */ 2577efa92184SAleksandar Rikalo uint64_t stx_attributes; /* Flags conveying information about the file */ 2578efa92184SAleksandar Rikalo /* 0x10 */ 2579efa92184SAleksandar Rikalo uint32_t stx_nlink; /* Number of hard links */ 2580efa92184SAleksandar Rikalo uint32_t stx_uid; /* User ID of owner */ 2581efa92184SAleksandar Rikalo uint32_t stx_gid; /* Group ID of owner */ 2582efa92184SAleksandar Rikalo uint16_t stx_mode; /* File mode */ 2583efa92184SAleksandar Rikalo uint16_t __spare0[1]; 2584efa92184SAleksandar Rikalo /* 0x20 */ 2585efa92184SAleksandar Rikalo uint64_t stx_ino; /* Inode number */ 2586efa92184SAleksandar Rikalo uint64_t stx_size; /* File size */ 2587efa92184SAleksandar Rikalo uint64_t stx_blocks; /* Number of 512-byte blocks allocated */ 2588efa92184SAleksandar Rikalo uint64_t stx_attributes_mask; /* Mask to show what is supported */ 2589efa92184SAleksandar Rikalo /* 0x40 */ 2590efa92184SAleksandar Rikalo struct target_statx_timestamp stx_atime; /* Last access time */ 2591efa92184SAleksandar Rikalo struct target_statx_timestamp stx_btime; /* File creation time */ 2592efa92184SAleksandar Rikalo struct target_statx_timestamp stx_ctime; /* Last attribute change time */ 2593efa92184SAleksandar Rikalo struct target_statx_timestamp stx_mtime; /* Last data modification time */ 2594efa92184SAleksandar Rikalo /* 0x80 */ 2595efa92184SAleksandar Rikalo uint32_t stx_rdev_major; /* Device ID of special file [if bdev/cdev] */ 2596efa92184SAleksandar Rikalo uint32_t stx_rdev_minor; 2597efa92184SAleksandar Rikalo uint32_t stx_dev_major; /* ID of device containing file [uncond] */ 2598efa92184SAleksandar Rikalo uint32_t stx_dev_minor; 2599efa92184SAleksandar Rikalo /* 0x90 */ 2600efa92184SAleksandar Rikalo uint64_t __spare2[14]; /* Spare space for future expansion */ 2601efa92184SAleksandar Rikalo /* 0x100 */ 2602efa92184SAleksandar Rikalo }; 2603efa92184SAleksandar Rikalo 26041b3c4fdfSMarkus Armbruster #endif 2605