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 { 1379a68960dSPhilippe Mathieu-Daudé abi_ushort sa_family; 1387854b056Sbellard uint8_t sa_data[14]; 1397854b056Sbellard }; 1407854b056Sbellard 14133a29b51SJoakim Tjernlund struct target_sockaddr_ll { 1429a68960dSPhilippe Mathieu-Daudé abi_ushort sll_family; /* Always AF_PACKET */ 1439a68960dSPhilippe Mathieu-Daudé abi_ushort sll_protocol; /* Physical layer protocol */ 1449a68960dSPhilippe Mathieu-Daudé abi_int sll_ifindex; /* Interface number */ 1459a68960dSPhilippe Mathieu-Daudé abi_ushort 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 { 1529a68960dSPhilippe Mathieu-Daudé abi_ushort su_family; 153fb3aabf3SLaurent Vivier uint8_t sun_path[108]; 154fb3aabf3SLaurent Vivier }; 155fb3aabf3SLaurent Vivier 156a47401bcSPhilippe Mathieu-Daudé struct target_sockaddr_nl { 157a47401bcSPhilippe Mathieu-Daudé abi_ushort nl_family; /* AF_NETLINK */ 158a47401bcSPhilippe Mathieu-Daudé abi_ushort __pad; 159a47401bcSPhilippe Mathieu-Daudé abi_uint nl_pid; 160a47401bcSPhilippe Mathieu-Daudé abi_uint nl_groups; 161a47401bcSPhilippe Mathieu-Daudé }; 162a47401bcSPhilippe Mathieu-Daudé 163fb3aabf3SLaurent Vivier struct target_in_addr { 1649a68960dSPhilippe Mathieu-Daudé abi_uint s_addr; /* big endian */ 165fb3aabf3SLaurent Vivier }; 166fb3aabf3SLaurent Vivier 167fb3aabf3SLaurent Vivier struct target_sockaddr_in { 1689a68960dSPhilippe Mathieu-Daudé abi_ushort sin_family; 1699a68960dSPhilippe Mathieu-Daudé abi_short sin_port; /* big endian */ 170fb3aabf3SLaurent Vivier struct target_in_addr sin_addr; 171fb3aabf3SLaurent Vivier uint8_t __pad[sizeof(struct target_sockaddr) - 1729a68960dSPhilippe Mathieu-Daudé sizeof(abi_ushort) - sizeof(abi_short) - 173fb3aabf3SLaurent Vivier sizeof(struct target_in_addr)]; 174fb3aabf3SLaurent Vivier }; 175fb3aabf3SLaurent Vivier 176ee1ac3a1SHelge Deller struct target_sockaddr_in6 { 1779a68960dSPhilippe Mathieu-Daudé abi_ushort sin6_family; 1789a68960dSPhilippe Mathieu-Daudé abi_ushort sin6_port; /* big endian */ 1799a68960dSPhilippe Mathieu-Daudé abi_uint sin6_flowinfo; /* big endian */ 180ee1ac3a1SHelge Deller struct in6_addr sin6_addr; /* IPv6 address, big endian */ 1819a68960dSPhilippe Mathieu-Daudé abi_uint sin6_scope_id; 182ee1ac3a1SHelge Deller }; 183ee1ac3a1SHelge Deller 184f57d4192SLaurent Vivier struct target_sock_filter { 185f57d4192SLaurent Vivier abi_ushort code; 186f57d4192SLaurent Vivier uint8_t jt; 187f57d4192SLaurent Vivier uint8_t jf; 188f57d4192SLaurent Vivier abi_uint k; 189f57d4192SLaurent Vivier }; 190f57d4192SLaurent Vivier 191f57d4192SLaurent Vivier struct target_sock_fprog { 192f57d4192SLaurent Vivier abi_ushort len; 193f57d4192SLaurent Vivier abi_ulong filter; 194f57d4192SLaurent Vivier }; 195f57d4192SLaurent Vivier 196b975b83bSLionel Landwerlin struct target_ip_mreq { 197b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 198b975b83bSLionel Landwerlin struct target_in_addr imr_address; 199b975b83bSLionel Landwerlin }; 200b975b83bSLionel Landwerlin 201b975b83bSLionel Landwerlin struct target_ip_mreqn { 202b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 203b975b83bSLionel Landwerlin struct target_in_addr imr_address; 204b975b83bSLionel Landwerlin abi_long imr_ifindex; 205b975b83bSLionel Landwerlin }; 206b975b83bSLionel Landwerlin 2076e3cb58fSLionel Landwerlin struct target_ip_mreq_source { 2086e3cb58fSLionel Landwerlin /* big endian */ 2096e3cb58fSLionel Landwerlin uint32_t imr_multiaddr; 2106e3cb58fSLionel Landwerlin uint32_t imr_interface; 2116e3cb58fSLionel Landwerlin uint32_t imr_sourceaddr; 2126e3cb58fSLionel Landwerlin }; 2136e3cb58fSLionel Landwerlin 21483eb6e50SCarlo Marcelo Arenas Belón struct target_linger { 21583eb6e50SCarlo Marcelo Arenas Belón abi_int l_onoff; /* Linger active */ 21683eb6e50SCarlo Marcelo Arenas Belón abi_int l_linger; /* How long to linger for */ 21783eb6e50SCarlo Marcelo Arenas Belón }; 21883eb6e50SCarlo Marcelo Arenas Belón 2196d5d5ddeSDaniel P. Berrangé #if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 2206d5d5ddeSDaniel P. Berrangé struct target_timeval { 2216d5d5ddeSDaniel P. Berrangé abi_long tv_sec; 2226d5d5ddeSDaniel P. Berrangé abi_int tv_usec; 2236d5d5ddeSDaniel P. Berrangé }; 2246d5d5ddeSDaniel P. Berrangé #define target__kernel_sock_timeval target_timeval 2256d5d5ddeSDaniel P. Berrangé #else 22631e31b8aSbellard struct target_timeval { 227992f48a0Sblueswir1 abi_long tv_sec; 228992f48a0Sblueswir1 abi_long tv_usec; 22931e31b8aSbellard }; 23031e31b8aSbellard 2316d5d5ddeSDaniel P. Berrangé struct target__kernel_sock_timeval { 2326d5d5ddeSDaniel P. Berrangé abi_llong tv_sec; 2336d5d5ddeSDaniel P. Berrangé abi_llong tv_usec; 2346d5d5ddeSDaniel P. Berrangé }; 2356d5d5ddeSDaniel P. Berrangé #endif 2366d5d5ddeSDaniel P. Berrangé 2371b6b029eSbellard struct target_timespec { 238992f48a0Sblueswir1 abi_long tv_sec; 239992f48a0Sblueswir1 abi_long tv_nsec; 2401b6b029eSbellard }; 2411b6b029eSbellard 2426d5d5ddeSDaniel P. Berrangé struct target__kernel_timespec { 2436d5d5ddeSDaniel P. Berrangé abi_llong tv_sec; 2446d5d5ddeSDaniel P. Berrangé abi_llong tv_nsec; 2456d5d5ddeSDaniel P. Berrangé }; 2466d5d5ddeSDaniel P. Berrangé 247ef4467e9SPaul Burton struct target_timezone { 248ef4467e9SPaul Burton abi_int tz_minuteswest; 249ef4467e9SPaul Burton abi_int tz_dsttime; 250ef4467e9SPaul Burton }; 251ef4467e9SPaul Burton 25266fb9763Sbellard struct target_itimerval { 25366fb9763Sbellard struct target_timeval it_interval; 25466fb9763Sbellard struct target_timeval it_value; 25566fb9763Sbellard }; 25666fb9763Sbellard 257905bba13SErik de Castro Lopo struct target_itimerspec { 258905bba13SErik de Castro Lopo struct target_timespec it_interval; 259905bba13SErik de Castro Lopo struct target_timespec it_value; 260905bba13SErik de Castro Lopo }; 261905bba13SErik de Castro Lopo 26219f59bceSAleksandar Markovic struct target_timex { 26319f59bceSAleksandar Markovic abi_uint modes; /* Mode selector */ 26419f59bceSAleksandar Markovic abi_long offset; /* Time offset */ 26519f59bceSAleksandar Markovic abi_long freq; /* Frequency offset */ 26619f59bceSAleksandar Markovic abi_long maxerror; /* Maximum error (microseconds) */ 26719f59bceSAleksandar Markovic abi_long esterror; /* Estimated error (microseconds) */ 26819f59bceSAleksandar Markovic abi_int status; /* Clock command/status */ 26919f59bceSAleksandar Markovic abi_long constant; /* PLL (phase-locked loop) time constant */ 27019f59bceSAleksandar Markovic abi_long precision; /* Clock precision (microseconds, ro) */ 27119f59bceSAleksandar Markovic abi_long tolerance; /* Clock freq. tolerance (ppm, ro) */ 27219f59bceSAleksandar Markovic struct target_timeval time; /* Current time */ 27319f59bceSAleksandar Markovic abi_long tick; /* Microseconds between clock ticks */ 27419f59bceSAleksandar Markovic abi_long ppsfreq; /* PPS (pulse per second) frequency */ 27519f59bceSAleksandar Markovic abi_long jitter; /* PPS jitter (ro); nanoseconds */ 27619f59bceSAleksandar Markovic abi_int shift; /* PPS interval duration (seconds) */ 27719f59bceSAleksandar Markovic abi_long stabil; /* PPS stability */ 27819f59bceSAleksandar Markovic abi_long jitcnt; /* PPS jitter limit exceeded (ro) */ 27919f59bceSAleksandar Markovic abi_long calcnt; /* PPS calibration intervals */ 28019f59bceSAleksandar Markovic abi_long errcnt; /* PPS calibration errors */ 28119f59bceSAleksandar Markovic abi_long stbcnt; /* PPS stability limit exceeded */ 28219f59bceSAleksandar Markovic abi_int tai; /* TAI offset */ 28319f59bceSAleksandar Markovic 28419f59bceSAleksandar Markovic /* Further padding bytes to allow for future expansion */ 28519f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; abi_int:32; 28619f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; abi_int:32; 28719f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; 28819f59bceSAleksandar Markovic }; 28919f59bceSAleksandar Markovic 290c227f099SAnthony Liguori typedef abi_long target_clock_t; 29132f36bceSbellard 292c596ed17Sbellard #define TARGET_HZ 100 293c596ed17Sbellard 29432f36bceSbellard struct target_tms { 295c227f099SAnthony Liguori target_clock_t tms_utime; 296c227f099SAnthony Liguori target_clock_t tms_stime; 297c227f099SAnthony Liguori target_clock_t tms_cutime; 298c227f099SAnthony Liguori target_clock_t tms_cstime; 29932f36bceSbellard }; 30032f36bceSbellard 3016180a181Sbellard struct target_utimbuf { 302992f48a0Sblueswir1 abi_long actime; 303992f48a0Sblueswir1 abi_long modtime; 3046180a181Sbellard }; 3056180a181Sbellard 306f2674e31Sbellard struct target_sel_arg_struct { 307992f48a0Sblueswir1 abi_long n; 308992f48a0Sblueswir1 abi_long inp, outp, exp; 309992f48a0Sblueswir1 abi_long tvp; 310f2674e31Sbellard }; 311f2674e31Sbellard 31231e31b8aSbellard struct target_iovec { 313992f48a0Sblueswir1 abi_long iov_base; /* Starting address */ 314992f48a0Sblueswir1 abi_long iov_len; /* Number of bytes */ 31531e31b8aSbellard }; 31631e31b8aSbellard 3171a9353d2Sbellard struct target_msghdr { 318992f48a0Sblueswir1 abi_long msg_name; /* Socket name */ 3191a9353d2Sbellard int msg_namelen; /* Length of name */ 320992f48a0Sblueswir1 abi_long msg_iov; /* Data blocks */ 321992f48a0Sblueswir1 abi_long msg_iovlen; /* Number of blocks */ 322992f48a0Sblueswir1 abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ 323992f48a0Sblueswir1 abi_long msg_controllen; /* Length of cmsg list */ 3241a9353d2Sbellard unsigned int msg_flags; 3251a9353d2Sbellard }; 3261a9353d2Sbellard 3277854b056Sbellard struct target_cmsghdr { 328992f48a0Sblueswir1 abi_long cmsg_len; 3297854b056Sbellard int cmsg_level; 3307854b056Sbellard int cmsg_type; 3317854b056Sbellard }; 3327854b056Sbellard 3337854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) 334ee104587SJonathan Neuschäfer #define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \ 335ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start) 336992f48a0Sblueswir1 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ 337992f48a0Sblueswir1 & (size_t) ~(sizeof (abi_long) - 1)) 338ad762b99SPeter Maydell #define TARGET_CMSG_SPACE(len) (sizeof(struct target_cmsghdr) + \ 339ad762b99SPeter Maydell TARGET_CMSG_ALIGN(len)) 340ad762b99SPeter Maydell #define TARGET_CMSG_LEN(len) (sizeof(struct target_cmsghdr) + (len)) 3417854b056Sbellard 3427854b056Sbellard static __inline__ struct target_cmsghdr * 343ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(struct target_msghdr *__mhdr, 344ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg, 345ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg_start) 3467854b056Sbellard { 3472b8bdefcSths struct target_cmsghdr *__ptr; 3487854b056Sbellard 3492b8bdefcSths __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg 350cbb21eedSMatthias Braun + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len))); 351ee104587SJonathan Neuschäfer if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start) 352ee104587SJonathan Neuschäfer > tswapal(__mhdr->msg_controllen)) { 3537854b056Sbellard /* No more entries. */ 3542b8bdefcSths return (struct target_cmsghdr *)0; 355ee104587SJonathan Neuschäfer } 356ee104587SJonathan Neuschäfer return __ptr; 3577854b056Sbellard } 3587854b056Sbellard 359f19e00d7SAlexander Graf struct target_mmsghdr { 360f19e00d7SAlexander Graf struct target_msghdr msg_hdr; /* Message header */ 361f19e00d7SAlexander Graf unsigned int msg_len; /* Number of bytes transmitted */ 362f19e00d7SAlexander Graf }; 3637854b056Sbellard 36431e31b8aSbellard struct target_rusage { 36531e31b8aSbellard struct target_timeval ru_utime; /* user time used */ 36631e31b8aSbellard struct target_timeval ru_stime; /* system time used */ 367992f48a0Sblueswir1 abi_long ru_maxrss; /* maximum resident set size */ 368992f48a0Sblueswir1 abi_long ru_ixrss; /* integral shared memory size */ 369992f48a0Sblueswir1 abi_long ru_idrss; /* integral unshared data size */ 370992f48a0Sblueswir1 abi_long ru_isrss; /* integral unshared stack size */ 371992f48a0Sblueswir1 abi_long ru_minflt; /* page reclaims */ 372992f48a0Sblueswir1 abi_long ru_majflt; /* page faults */ 373992f48a0Sblueswir1 abi_long ru_nswap; /* swaps */ 374992f48a0Sblueswir1 abi_long ru_inblock; /* block input operations */ 375992f48a0Sblueswir1 abi_long ru_oublock; /* block output operations */ 376992f48a0Sblueswir1 abi_long ru_msgsnd; /* messages sent */ 377992f48a0Sblueswir1 abi_long ru_msgrcv; /* messages received */ 378992f48a0Sblueswir1 abi_long ru_nsignals; /* signals received */ 379992f48a0Sblueswir1 abi_long ru_nvcsw; /* voluntary context switches */ 380992f48a0Sblueswir1 abi_long ru_nivcsw; /* involuntary " */ 38131e31b8aSbellard }; 38231e31b8aSbellard 38331e31b8aSbellard typedef struct { 38431e31b8aSbellard int val[2]; 385c227f099SAnthony Liguori } kernel_fsid_t; 38631e31b8aSbellard 387dab2ed99Sbellard struct target_dirent { 388992f48a0Sblueswir1 abi_long d_ino; 389992f48a0Sblueswir1 abi_long d_off; 390dab2ed99Sbellard unsigned short d_reclen; 391333858b7SDmitry V. Levin char d_name[]; 392dab2ed99Sbellard }; 393dab2ed99Sbellard 394dab2ed99Sbellard struct target_dirent64 { 395dab2ed99Sbellard uint64_t d_ino; 396dab2ed99Sbellard int64_t d_off; 397dab2ed99Sbellard unsigned short d_reclen; 398dab2ed99Sbellard unsigned char d_type; 399dab2ed99Sbellard char d_name[256]; 400dab2ed99Sbellard }; 401dab2ed99Sbellard 402dab2ed99Sbellard 40331e31b8aSbellard /* mostly generic signal stuff */ 404992f48a0Sblueswir1 #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ 405992f48a0Sblueswir1 #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ 406992f48a0Sblueswir1 #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ 40731e31b8aSbellard 40831e31b8aSbellard #ifdef TARGET_MIPS 40931e31b8aSbellard #define TARGET_NSIG 128 41031e31b8aSbellard #else 41131e31b8aSbellard #define TARGET_NSIG 64 41231e31b8aSbellard #endif 413992f48a0Sblueswir1 #define TARGET_NSIG_BPW TARGET_ABI_BITS 41431e31b8aSbellard #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) 41531e31b8aSbellard 41631e31b8aSbellard typedef struct { 417992f48a0Sblueswir1 abi_ulong sig[TARGET_NSIG_WORDS]; 418c227f099SAnthony Liguori } target_sigset_t; 41931e31b8aSbellard 42066fb9763Sbellard #ifdef BSWAP_NEEDED 421c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 42266fb9763Sbellard { 42366fb9763Sbellard int i; 42466fb9763Sbellard for(i = 0;i < TARGET_NSIG_WORDS; i++) 425cbb21eedSMatthias Braun d->sig[i] = tswapal(s->sig[i]); 42666fb9763Sbellard } 42766fb9763Sbellard #else 428c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 42966fb9763Sbellard { 43066fb9763Sbellard *d = *s; 43166fb9763Sbellard } 43266fb9763Sbellard #endif 43366fb9763Sbellard 434c227f099SAnthony Liguori static inline void target_siginitset(target_sigset_t *d, abi_ulong set) 43566fb9763Sbellard { 43666fb9763Sbellard int i; 43766fb9763Sbellard d->sig[0] = set; 43866fb9763Sbellard for(i = 1;i < TARGET_NSIG_WORDS; i++) 43966fb9763Sbellard d->sig[i] = 0; 44066fb9763Sbellard } 44166fb9763Sbellard 442c227f099SAnthony Liguori void host_to_target_sigset(target_sigset_t *d, const sigset_t *s); 443c227f099SAnthony Liguori void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); 444992f48a0Sblueswir1 void host_to_target_old_sigset(abi_ulong *old_sigset, 44566fb9763Sbellard const sigset_t *sigset); 44666fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset, 447992f48a0Sblueswir1 const abi_ulong *old_sigset); 44866fb9763Sbellard struct target_sigaction; 44966fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act, 45066fb9763Sbellard struct target_sigaction *oact); 45166fb9763Sbellard 4529850f9f6SLaurent Vivier #include "target_signal.h" 4539850f9f6SLaurent Vivier 4547f047de1SRichard Henderson #ifdef TARGET_SA_RESTORER 4557f047de1SRichard Henderson #define TARGET_ARCH_HAS_SA_RESTORER 1 4567f047de1SRichard Henderson #endif 4577f047de1SRichard Henderson 4586049f4f8SRichard Henderson #if defined(TARGET_ALPHA) 4596049f4f8SRichard Henderson struct target_old_sigaction { 4606049f4f8SRichard Henderson abi_ulong _sa_handler; 4616049f4f8SRichard Henderson abi_ulong sa_mask; 462d2565875SRichard Henderson int32_t sa_flags; 4636049f4f8SRichard Henderson }; 464106ec879Sbellard 4656049f4f8SRichard Henderson struct target_rt_sigaction { 4666049f4f8SRichard Henderson abi_ulong _sa_handler; 4676049f4f8SRichard Henderson abi_ulong sa_flags; 4686049f4f8SRichard Henderson target_sigset_t sa_mask; 4696049f4f8SRichard Henderson }; 4706049f4f8SRichard Henderson 4716049f4f8SRichard Henderson /* This is the struct used inside the kernel. The ka_restorer 4726049f4f8SRichard Henderson field comes from the 5th argument to sys_rt_sigaction. */ 4736049f4f8SRichard Henderson struct target_sigaction { 4746049f4f8SRichard Henderson abi_ulong _sa_handler; 4756049f4f8SRichard Henderson abi_ulong sa_flags; 4766049f4f8SRichard Henderson target_sigset_t sa_mask; 4776049f4f8SRichard Henderson abi_ulong sa_restorer; 4786049f4f8SRichard Henderson }; 4796049f4f8SRichard Henderson #elif defined(TARGET_MIPS) 480106ec879Sbellard struct target_sigaction { 481540635baSths uint32_t sa_flags; 482d26bc211Sths #if defined(TARGET_ABI_MIPSN32) 483540635baSths uint32_t _sa_handler; 484540635baSths #else 485992f48a0Sblueswir1 abi_ulong _sa_handler; 486540635baSths #endif 487c227f099SAnthony Liguori target_sigset_t sa_mask; 4887f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 4897f047de1SRichard Henderson /* ??? This is always present, but ignored unless O32. */ 4907f047de1SRichard Henderson abi_ulong sa_restorer; 4917f047de1SRichard Henderson #endif 492106ec879Sbellard }; 493106ec879Sbellard #else 4942521d698Sbellard struct target_old_sigaction { 495992f48a0Sblueswir1 abi_ulong _sa_handler; 496992f48a0Sblueswir1 abi_ulong sa_mask; 497992f48a0Sblueswir1 abi_ulong sa_flags; 4987f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 499992f48a0Sblueswir1 abi_ulong sa_restorer; 5007f047de1SRichard Henderson #endif 5012521d698Sbellard }; 5022521d698Sbellard 5032521d698Sbellard struct target_sigaction { 504992f48a0Sblueswir1 abi_ulong _sa_handler; 505992f48a0Sblueswir1 abi_ulong sa_flags; 5067f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 507992f48a0Sblueswir1 abi_ulong sa_restorer; 5087f047de1SRichard Henderson #endif 509c227f099SAnthony Liguori target_sigset_t sa_mask; 5105de154e8SLaurent Vivier #ifdef TARGET_ARCH_HAS_KA_RESTORER 5115de154e8SLaurent Vivier abi_ulong ka_restorer; 5125de154e8SLaurent Vivier #endif 5132521d698Sbellard }; 514106ec879Sbellard #endif 5152521d698Sbellard 5162521d698Sbellard typedef union target_sigval { 5172521d698Sbellard int sival_int; 518992f48a0Sblueswir1 abi_ulong sival_ptr; 519c227f099SAnthony Liguori } target_sigval_t; 5206d5e216dSbellard #if 0 5216d5e216dSbellard #if defined (TARGET_SPARC) 5226d5e216dSbellard typedef struct { 5236d5e216dSbellard struct { 524992f48a0Sblueswir1 abi_ulong psr; 525992f48a0Sblueswir1 abi_ulong pc; 526992f48a0Sblueswir1 abi_ulong npc; 527992f48a0Sblueswir1 abi_ulong y; 528992f48a0Sblueswir1 abi_ulong u_regs[16]; /* globals and ins */ 5296d5e216dSbellard } si_regs; 5306d5e216dSbellard int si_mask; 5316d5e216dSbellard } __siginfo_t; 5326d5e216dSbellard 5336d5e216dSbellard typedef struct { 5346d5e216dSbellard unsigned long si_float_regs [32]; 5356d5e216dSbellard unsigned long si_fsr; 5366d5e216dSbellard unsigned long si_fpqdepth; 5376d5e216dSbellard struct { 5386d5e216dSbellard unsigned long *insn_addr; 5396d5e216dSbellard unsigned long insn; 5406d5e216dSbellard } si_fpqueue [16]; 5416d5e216dSbellard } __siginfo_fpu_t; 5426d5e216dSbellard #endif 5436d5e216dSbellard #endif 5442521d698Sbellard 5452521d698Sbellard #define TARGET_SI_MAX_SIZE 128 546aa5e03d2SMaxim Ostapenko 547aa5e03d2SMaxim Ostapenko #if TARGET_ABI_BITS == 32 548aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int)) 549aa5e03d2SMaxim Ostapenko #else 550aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int)) 551aa5e03d2SMaxim Ostapenko #endif 552aa5e03d2SMaxim Ostapenko 553aa5e03d2SMaxim Ostapenko #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int)) 5542521d698Sbellard 555a70dadc7SPeter Maydell /* Within QEMU the top 16 bits of si_code indicate which of the parts of 556a70dadc7SPeter Maydell * the union in target_siginfo is valid. This only applies between 557a70dadc7SPeter Maydell * host_to_target_siginfo_noswap() and tswap_siginfo(); it does not 558a70dadc7SPeter Maydell * appear either within host siginfo_t or in target_siginfo structures 559a70dadc7SPeter Maydell * which we get from the guest userspace program. (The Linux kernel 560a70dadc7SPeter Maydell * does a similar thing with using the top bits for its own internal 561a70dadc7SPeter Maydell * purposes but not letting them be visible to userspace.) 562a70dadc7SPeter Maydell */ 563a70dadc7SPeter Maydell #define QEMU_SI_KILL 0 564a70dadc7SPeter Maydell #define QEMU_SI_TIMER 1 565a70dadc7SPeter Maydell #define QEMU_SI_POLL 2 566a70dadc7SPeter Maydell #define QEMU_SI_FAULT 3 567a70dadc7SPeter Maydell #define QEMU_SI_CHLD 4 568a70dadc7SPeter Maydell #define QEMU_SI_RT 5 569a70dadc7SPeter Maydell 5702521d698Sbellard typedef struct target_siginfo { 5713f53d546Spbrook #ifdef TARGET_MIPS 5723f53d546Spbrook int si_signo; 5733f53d546Spbrook int si_code; 5743f53d546Spbrook int si_errno; 5753f53d546Spbrook #else 5762521d698Sbellard int si_signo; 5772521d698Sbellard int si_errno; 5782521d698Sbellard int si_code; 5793f53d546Spbrook #endif 5802521d698Sbellard 5812521d698Sbellard union { 5822521d698Sbellard int _pad[TARGET_SI_PAD_SIZE]; 5832521d698Sbellard 5842521d698Sbellard /* kill() */ 5852521d698Sbellard struct { 5862521d698Sbellard pid_t _pid; /* sender's pid */ 5872521d698Sbellard uid_t _uid; /* sender's uid */ 5882521d698Sbellard } _kill; 5892521d698Sbellard 5902521d698Sbellard /* POSIX.1b timers */ 5912521d698Sbellard struct { 5922521d698Sbellard unsigned int _timer1; 5932521d698Sbellard unsigned int _timer2; 5942521d698Sbellard } _timer; 5952521d698Sbellard 5962521d698Sbellard /* POSIX.1b signals */ 5972521d698Sbellard struct { 5982521d698Sbellard pid_t _pid; /* sender's pid */ 5992521d698Sbellard uid_t _uid; /* sender's uid */ 600c227f099SAnthony Liguori target_sigval_t _sigval; 6012521d698Sbellard } _rt; 6022521d698Sbellard 6032521d698Sbellard /* SIGCHLD */ 6042521d698Sbellard struct { 6052521d698Sbellard pid_t _pid; /* which child */ 6062521d698Sbellard uid_t _uid; /* sender's uid */ 6072521d698Sbellard int _status; /* exit code */ 608c227f099SAnthony Liguori target_clock_t _utime; 609c227f099SAnthony Liguori target_clock_t _stime; 6102521d698Sbellard } _sigchld; 6112521d698Sbellard 6122521d698Sbellard /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 6132521d698Sbellard struct { 614992f48a0Sblueswir1 abi_ulong _addr; /* faulting insn/memory ref. */ 6152521d698Sbellard } _sigfault; 6162521d698Sbellard 6172521d698Sbellard /* SIGPOLL */ 6182521d698Sbellard struct { 6192521d698Sbellard int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 6202521d698Sbellard int _fd; 6212521d698Sbellard } _sigpoll; 6222521d698Sbellard } _sifields; 623c227f099SAnthony Liguori } target_siginfo_t; 6242521d698Sbellard 6252521d698Sbellard /* 6262521d698Sbellard * si_code values 6272521d698Sbellard * Digital reserves positive values for kernel-generated signals. 6282521d698Sbellard */ 6292521d698Sbellard #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ 6302521d698Sbellard #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 6312521d698Sbellard #define TARGET_SI_QUEUE -1 /* sent by sigqueue */ 6322521d698Sbellard #define TARGET_SI_TIMER -2 /* sent by timer expiration */ 6332521d698Sbellard #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ 6342521d698Sbellard #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ 6352521d698Sbellard #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ 6362521d698Sbellard 6372521d698Sbellard /* 6382521d698Sbellard * SIGILL si_codes 6392521d698Sbellard */ 640ffa65c3bSbellard #define TARGET_ILL_ILLOPC (1) /* illegal opcode */ 6412521d698Sbellard #define TARGET_ILL_ILLOPN (2) /* illegal operand */ 642ffa65c3bSbellard #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ 643ffa65c3bSbellard #define TARGET_ILL_ILLTRP (4) /* illegal trap */ 644ffa65c3bSbellard #define TARGET_ILL_PRVOPC (5) /* privileged opcode */ 645ffa65c3bSbellard #define TARGET_ILL_PRVREG (6) /* privileged register */ 646ffa65c3bSbellard #define TARGET_ILL_COPROC (7) /* coprocessor error */ 647ffa65c3bSbellard #define TARGET_ILL_BADSTK (8) /* internal stack error */ 648de2fdd56SChen Gang #ifdef TARGET_TILEGX 649de2fdd56SChen Gang #define TARGET_ILL_DBLFLT (9) /* double fault */ 650de2fdd56SChen Gang #define TARGET_ILL_HARDWALL (10) /* user networks hardwall violation */ 651de2fdd56SChen Gang #endif 6522521d698Sbellard 6532521d698Sbellard /* 6542521d698Sbellard * SIGFPE si_codes 6552521d698Sbellard */ 6562521d698Sbellard #define TARGET_FPE_INTDIV (1) /* integer divide by zero */ 6572521d698Sbellard #define TARGET_FPE_INTOVF (2) /* integer overflow */ 6582521d698Sbellard #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ 6592521d698Sbellard #define TARGET_FPE_FLTOVF (4) /* floating point overflow */ 6602521d698Sbellard #define TARGET_FPE_FLTUND (5) /* floating point underflow */ 6612521d698Sbellard #define TARGET_FPE_FLTRES (6) /* floating point inexact result */ 6622521d698Sbellard #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ 6632521d698Sbellard #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ 66421ba8564SRichard Henderson #define TARGET_FPE_FLTUNK (14) /* undiagnosed fp exception */ 66521ba8564SRichard Henderson #define TARGET_NSIGFPE 15 6662521d698Sbellard 6672521d698Sbellard /* 6682521d698Sbellard * SIGSEGV si_codes 6692521d698Sbellard */ 6702521d698Sbellard #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ 6712521d698Sbellard #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ 672de2fdd56SChen Gang #define TARGET_SEGV_BNDERR (3) /* failed address bound checks */ 6732521d698Sbellard 6742521d698Sbellard /* 675ffa65c3bSbellard * SIGBUS si_codes 676ffa65c3bSbellard */ 677ffa65c3bSbellard #define TARGET_BUS_ADRALN (1) /* invalid address alignment */ 678b4916d7bSDong Xu Wang #define TARGET_BUS_ADRERR (2) /* non-existent physical address */ 679ffa65c3bSbellard #define TARGET_BUS_OBJERR (3) /* object specific hardware error */ 680de2fdd56SChen Gang /* hardware memory error consumed on a machine check: action required */ 681de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AR (4) 682de2fdd56SChen Gang /* hardware memory error detected in process but not consumed: action optional*/ 683de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AO (5) 684ffa65c3bSbellard 685ffa65c3bSbellard /* 6862521d698Sbellard * SIGTRAP si_codes 6872521d698Sbellard */ 6882521d698Sbellard #define TARGET_TRAP_BRKPT (1) /* process breakpoint */ 6892521d698Sbellard #define TARGET_TRAP_TRACE (2) /* process trace trap */ 690de2fdd56SChen Gang #define TARGET_TRAP_BRANCH (3) /* process taken branch trap */ 691de2fdd56SChen Gang #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */ 6922521d698Sbellard 6939de5e440Sbellard struct target_rlimit { 694992f48a0Sblueswir1 abi_ulong rlim_cur; 695992f48a0Sblueswir1 abi_ulong rlim_max; 6969de5e440Sbellard }; 6979de5e440Sbellard 69881bbe906Stakasi-y@ops.dti.ne.jp #if defined(TARGET_ALPHA) 699e476492eSAurelien Jarno #define TARGET_RLIM_INFINITY 0x7fffffffffffffffull 7006cafd027SMatthias Braun #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32) 70181bbe906Stakasi-y@ops.dti.ne.jp #define TARGET_RLIM_INFINITY 0x7fffffffUL 70281bbe906Stakasi-y@ops.dti.ne.jp #else 70326b746dbSMatthias Braun #define TARGET_RLIM_INFINITY ((abi_ulong)-1) 70481bbe906Stakasi-y@ops.dti.ne.jp #endif 70581bbe906Stakasi-y@ops.dti.ne.jp 706e22b7015SWesley W. Terpstra #if defined(TARGET_MIPS) 707e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 708e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 709e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 710e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 711e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 712e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 7 713e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 8 714e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 5 715e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 9 716e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 6 717e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 718e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 719e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 720e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 721e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 722e22b7015SWesley W. Terpstra #else 723e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 724e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 725e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 726e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 727e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 728e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 5 7296cafd027SMatthias Braun #if defined(TARGET_SPARC) 7306cafd027SMatthias Braun #define TARGET_RLIMIT_NOFILE 6 7316cafd027SMatthias Braun #define TARGET_RLIMIT_NPROC 7 7326cafd027SMatthias Braun #else 733e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 6 734e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 7 7356cafd027SMatthias Braun #endif 736e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 8 737e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 9 738e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 739e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 740e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 741e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 742e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 743e22b7015SWesley W. Terpstra #endif 744e22b7015SWesley W. Terpstra 7459de5e440Sbellard struct target_pollfd { 7469de5e440Sbellard int fd; /* file descriptor */ 7479de5e440Sbellard short events; /* requested events */ 7489de5e440Sbellard short revents; /* returned events */ 7499de5e440Sbellard }; 7509de5e440Sbellard 7518e5a0667Sbellard /* virtual terminal ioctls */ 7520221cfcdSbellard #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ 7530221cfcdSbellard #define TARGET_KDMKTONE 0x4B30 /* generate tone */ 7548e5a0667Sbellard #define TARGET_KDGKBTYPE 0x4b33 755f7680a55SUlrich Hecht #define TARGET_KDSETMODE 0x4b3a 756f7680a55SUlrich Hecht #define TARGET_KDGKBMODE 0x4b44 757f7680a55SUlrich Hecht #define TARGET_KDSKBMODE 0x4b45 7580221cfcdSbellard #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ 7590221cfcdSbellard #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ 760e6fe18fbSCédric VINCENT #define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ 761e6fe18fbSCédric VINCENT #define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ 762e6fe18fbSCédric VINCENT #define TARGET_KDGETLED 0x4B31 /* return current led state */ 763e6fe18fbSCédric VINCENT #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */ 764ca56f5b5SPaul Burton #define TARGET_KDSIGACCEPT 0x4B4E 7658e5a0667Sbellard 76668365f96SFilip Bozuta /* real time clock ioctls */ 76768365f96SFilip Bozuta #define TARGET_RTC_AIE_ON TARGET_IO('p', 0x01) 76868365f96SFilip Bozuta #define TARGET_RTC_AIE_OFF TARGET_IO('p', 0x02) 76968365f96SFilip Bozuta #define TARGET_RTC_UIE_ON TARGET_IO('p', 0x03) 77068365f96SFilip Bozuta #define TARGET_RTC_UIE_OFF TARGET_IO('p', 0x04) 77168365f96SFilip Bozuta #define TARGET_RTC_PIE_ON TARGET_IO('p', 0x05) 77268365f96SFilip Bozuta #define TARGET_RTC_PIE_OFF TARGET_IO('p', 0x06) 77368365f96SFilip Bozuta #define TARGET_RTC_WIE_ON TARGET_IO('p', 0x0f) 77468365f96SFilip Bozuta #define TARGET_RTC_WIE_OFF TARGET_IO('p', 0x10) 775178b14a0SFilip Bozuta #define TARGET_RTC_ALM_READ TARGET_IOR('p', 0x08, struct rtc_time) 776178b14a0SFilip Bozuta #define TARGET_RTC_ALM_SET TARGET_IOW('p', 0x07, struct rtc_time) 777178b14a0SFilip Bozuta #define TARGET_RTC_RD_TIME TARGET_IOR('p', 0x09, struct rtc_time) 778178b14a0SFilip Bozuta #define TARGET_RTC_SET_TIME TARGET_IOW('p', 0x0a, struct rtc_time) 779*fa857eb5SFilip Bozuta #define TARGET_RTC_IRQP_READ TARGET_IOR('p', 0x0b, abi_ulong) 780*fa857eb5SFilip Bozuta #define TARGET_RTC_IRQP_SET TARGET_IOW('p', 0x0c, abi_ulong) 781*fa857eb5SFilip Bozuta #define TARGET_RTC_EPOCH_READ TARGET_IOR('p', 0x0d, abi_ulong) 782*fa857eb5SFilip Bozuta #define TARGET_RTC_EPOCH_SET TARGET_IOW('p', 0x0e, abi_ulong) 78368365f96SFilip Bozuta 784d14eabbeSAleksandar Markovic #if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) || \ 785d14eabbeSAleksandar Markovic defined(TARGET_XTENSA) 7864e4b173fSAleksandar Markovic #define TARGET_FIOGETOWN TARGET_IOR('f', 123, int) 7874e4b173fSAleksandar Markovic #define TARGET_FIOSETOWN TARGET_IOW('f', 124, int) 788e1be1606SAleksandar Markovic #define TARGET_SIOCATMARK TARGET_IOR('s', 7, int) 789c495a793SAleksandar Markovic #define TARGET_SIOCSPGRP TARGET_IOW('s', 8, pid_t) 790405b4915SHelge Deller #define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t) 791e1be1606SAleksandar Markovic #else 7924e4b173fSAleksandar Markovic #define TARGET_FIOGETOWN 0x8903 7934e4b173fSAleksandar Markovic #define TARGET_FIOSETOWN 0x8901 7942521d698Sbellard #define TARGET_SIOCATMARK 0x8905 795c495a793SAleksandar Markovic #define TARGET_SIOCSPGRP 0x8902 796405b4915SHelge Deller #define TARGET_SIOCGPGRP 0x8904 797e1be1606SAleksandar Markovic #endif 798c495a793SAleksandar Markovic 7996d5d5ddeSDaniel P. Berrangé #if defined(TARGET_SH4) 8006d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMP_OLD TARGET_IOR('s', 100, struct target_timeval) 8016d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMPNS_OLD TARGET_IOR('s', 101, struct target_timespec) 8026d5d5ddeSDaniel P. Berrangé #else 8036d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMP_OLD 0x8906 8046d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMPNS_OLD 0x8907 8056d5d5ddeSDaniel P. Berrangé #endif 8066d5d5ddeSDaniel P. Berrangé 8076d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMP_NEW TARGET_IOR(0x89, 0x06, abi_llong[2]) 8086d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMPNS_NEW TARGET_IOR(0x89, 0x07, abi_llong[2]) 8092521d698Sbellard 81031e31b8aSbellard /* Networking ioctls */ 81131e31b8aSbellard #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ 81231e31b8aSbellard #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ 81331e31b8aSbellard #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ 81431e31b8aSbellard #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ 81531e31b8aSbellard #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ 81631e31b8aSbellard #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ 81731e31b8aSbellard #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ 81831e31b8aSbellard #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ 81931e31b8aSbellard #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ 82031e31b8aSbellard #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ 82131e31b8aSbellard #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ 82231e31b8aSbellard #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ 82331e31b8aSbellard #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ 82431e31b8aSbellard #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ 82531e31b8aSbellard #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ 82631e31b8aSbellard #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ 82731e31b8aSbellard #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ 82831e31b8aSbellard #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ 82931e31b8aSbellard #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ 83031e31b8aSbellard #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ 83131e31b8aSbellard #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ 83231e31b8aSbellard #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ 83331e31b8aSbellard #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ 83431e31b8aSbellard #define TARGET_SIOCSIFENCAP 0x8926 83531e31b8aSbellard #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ 83631e31b8aSbellard #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ 83731e31b8aSbellard #define TARGET_SIOCSIFSLAVE 0x8930 83831e31b8aSbellard #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ 83931e31b8aSbellard #define TARGET_SIOCDELMULTI 0x8932 840f63eb01aSPaul Burton #define TARGET_SIOCGIFINDEX 0x8933 8414bdcd79eSNeng Chen #define TARGET_SIOCSIFPFLAGS 0x8934 /* set extended flags */ 8424bdcd79eSNeng Chen #define TARGET_SIOCGIFPFLAGS 0x8935 /* get extended flags */ 84331e31b8aSbellard 84431e31b8aSbellard /* Bridging control calls */ 84531e31b8aSbellard #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ 84631e31b8aSbellard #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ 84731e31b8aSbellard 84831e31b8aSbellard #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ 84931e31b8aSbellard #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ 85031e31b8aSbellard 85131e31b8aSbellard /* ARP cache control calls. */ 85231e31b8aSbellard #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ 85331e31b8aSbellard #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ 85431e31b8aSbellard #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ 85531e31b8aSbellard #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ 85631e31b8aSbellard #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ 85731e31b8aSbellard #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ 85831e31b8aSbellard 85931e31b8aSbellard /* RARP cache control calls. */ 86031e31b8aSbellard #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ 86131e31b8aSbellard #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ 86231e31b8aSbellard #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ 86331e31b8aSbellard 86431e31b8aSbellard /* Driver configuration calls */ 86531e31b8aSbellard #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ 86631e31b8aSbellard #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ 86731e31b8aSbellard 86831e31b8aSbellard /* DLCI configuration calls */ 86931e31b8aSbellard #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ 87031e31b8aSbellard #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ 87131e31b8aSbellard 87286fcd946SLaurent Vivier /* From <linux/wireless.h> */ 87386fcd946SLaurent Vivier 87486fcd946SLaurent Vivier #define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ 87531e31b8aSbellard 876d6d6d6feSMarco A L Barbosa /* From <linux/random.h> */ 877d6d6d6feSMarco A L Barbosa 878d6d6d6feSMarco A L Barbosa #define TARGET_RNDGETENTCNT TARGET_IOR('R', 0x00, int) 879d6d6d6feSMarco A L Barbosa #define TARGET_RNDADDTOENTCNT TARGET_IOW('R', 0x01, int) 880d6d6d6feSMarco A L Barbosa #define TARGET_RNDZAPENTCNT TARGET_IO('R', 0x04) 881d6d6d6feSMarco A L Barbosa #define TARGET_RNDCLEARPOOL TARGET_IO('R', 0x06) 88292c096f0SAleksandar Markovic #define TARGET_RNDRESEEDCRNG TARGET_IO('R', 0x07) 883d6d6d6feSMarco A L Barbosa 88431e31b8aSbellard /* From <linux/fs.h> */ 88531e31b8aSbellard 88631e31b8aSbellard #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ 88731e31b8aSbellard #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ 88831e31b8aSbellard #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ 88931e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ 89031e31b8aSbellard #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ 89131e31b8aSbellard #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ 89231e31b8aSbellard #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ 89331e31b8aSbellard #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ 89431e31b8aSbellard #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ 89531e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ 89631e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ 89731e31b8aSbellard #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ 898fff8c539SAndreas Färber #define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */ 89931e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */ 900c8b0bf54SPeter Maydell #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong) 901c8b0bf54SPeter Maydell #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong) 902edafea13SAlexander Graf #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) 903edafea13SAlexander Graf /* return device size in bytes 904edafea13SAlexander Graf (u64 *arg) */ 9054715856aSPeter Maydell 9064715856aSPeter Maydell #define TARGET_BLKDISCARD TARGET_IO(0x12, 119) 9074715856aSPeter Maydell #define TARGET_BLKIOMIN TARGET_IO(0x12, 120) 9084715856aSPeter Maydell #define TARGET_BLKIOOPT TARGET_IO(0x12, 121) 9094715856aSPeter Maydell #define TARGET_BLKALIGNOFF TARGET_IO(0x12, 122) 9104715856aSPeter Maydell #define TARGET_BLKPBSZGET TARGET_IO(0x12, 123) 9114715856aSPeter Maydell #define TARGET_BLKDISCARDZEROES TARGET_IO(0x12, 124) 9124715856aSPeter Maydell #define TARGET_BLKSECDISCARD TARGET_IO(0x12, 125) 9134715856aSPeter Maydell #define TARGET_BLKROTATIONAL TARGET_IO(0x12, 126) 9144715856aSPeter Maydell #define TARGET_BLKZEROOUT TARGET_IO(0x12, 127) 9154715856aSPeter Maydell 916ab22b4ddSYunqiang Su /* From <linux/fd.h> */ 917ab22b4ddSYunqiang Su 9187e35fc8bSAleksandar Markovic #define TARGET_FDMSGON TARGET_IO(2, 0x45) 9197e35fc8bSAleksandar Markovic #define TARGET_FDMSGOFF TARGET_IO(2, 0x46) 92008e3ce59SAleksandar Markovic #define TARGET_FDFMTBEG TARGET_IO(2, 0x47) 92108e3ce59SAleksandar Markovic #define TARGET_FDFMTTRK TARGET_IOW(2, 0x48, struct format_descr) 92208e3ce59SAleksandar Markovic #define TARGET_FDFMTEND TARGET_IO(2, 0x49) 92381eb1a36SAleksandar Markovic #define TARGET_FDSETEMSGTRESH TARGET_IO(2, 0x4a) 924ab22b4ddSYunqiang Su #define TARGET_FDFLUSH TARGET_IO(2, 0x4b) 92581eb1a36SAleksandar Markovic #define TARGET_FDSETMAXERRS TARGET_IOW(2, 0x4c, struct floppy_max_errors) 92681eb1a36SAleksandar Markovic #define TARGET_FDGETMAXERRS TARGET_IOR(2, 0x0e, struct floppy_max_errors) 9275eea9429SAleksandar Markovic #define TARGET_FDRESET TARGET_IO(2, 0x54) 9285eea9429SAleksandar Markovic #define TARGET_FDRAWCMD TARGET_IO(2, 0x58) 9295eea9429SAleksandar Markovic #define TARGET_FDTWADDLE TARGET_IO(2, 0x59) 9305eea9429SAleksandar Markovic #define TARGET_FDEJECT TARGET_IO(2, 0x5a) 931ab22b4ddSYunqiang Su 93231e31b8aSbellard #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ 93331e31b8aSbellard #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ 93421992cb6SHelge Deller 93521992cb6SHelge Deller #define TARGET_FICLONE TARGET_IOW(0x94, 9, int) 93621992cb6SHelge Deller #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range) 93721992cb6SHelge Deller 9385ae774a9SAleksandar Markovic /* 9395ae774a9SAleksandar Markovic * Note that the ioctl numbers for FS_IOC_<GET|SET><FLAGS|VERSION> 9405ae774a9SAleksandar Markovic * claim type "long" but the actual type used by the kernel is "int". 94160807231SPeter Maydell */ 9421847b7baSPeter Maydell #define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, abi_long) 9431847b7baSPeter Maydell #define TARGET_FS_IOC_SETFLAGS TARGET_IOW('f', 2, abi_long) 9445ae774a9SAleksandar Markovic #define TARGET_FS_IOC_GETVERSION TARGET_IOR('v', 1, abi_long) 9455ae774a9SAleksandar Markovic #define TARGET_FS_IOC_SETVERSION TARGET_IOW('v', 2, abi_long) 946285da2b9SPeter Maydell #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) 9470b471ba6SAleksandar Markovic #define TARGET_FS_IOC32_GETFLAGS TARGET_IOR('f', 1, int) 9480b471ba6SAleksandar Markovic #define TARGET_FS_IOC32_SETFLAGS TARGET_IOW('f', 2, int) 9490d899cd6SAleksandar Markovic #define TARGET_FS_IOC32_GETVERSION TARGET_IOR('v', 1, int) 9500d899cd6SAleksandar Markovic #define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, int) 95131e31b8aSbellard 9526c753a63SCortland Tölva /* usb ioctls */ 9536c753a63SCortland Tölva #define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0) 9546c753a63SCortland Tölva #define TARGET_USBDEVFS_BULK TARGET_IOWRU('U', 2) 9556c753a63SCortland Tölva #define TARGET_USBDEVFS_RESETEP TARGET_IORU('U', 3) 9566c753a63SCortland Tölva #define TARGET_USBDEVFS_SETINTERFACE TARGET_IORU('U', 4) 9576c753a63SCortland Tölva #define TARGET_USBDEVFS_SETCONFIGURATION TARGET_IORU('U', 5) 9586c753a63SCortland Tölva #define TARGET_USBDEVFS_GETDRIVER TARGET_IOWU('U', 8) 959a133367eSCortland Tölva #define TARGET_USBDEVFS_SUBMITURB TARGET_IORU('U', 10) 960a133367eSCortland Tölva #define TARGET_USBDEVFS_DISCARDURB TARGET_IO('U', 11) 961a133367eSCortland Tölva #define TARGET_USBDEVFS_REAPURB TARGET_IOWU('U', 12) 962a133367eSCortland Tölva #define TARGET_USBDEVFS_REAPURBNDELAY TARGET_IOWU('U', 13) 9636c753a63SCortland Tölva #define TARGET_USBDEVFS_DISCSIGNAL TARGET_IORU('U', 14) 9646c753a63SCortland Tölva #define TARGET_USBDEVFS_CLAIMINTERFACE TARGET_IORU('U', 15) 9656c753a63SCortland Tölva #define TARGET_USBDEVFS_RELEASEINTERFACE TARGET_IORU('U', 16) 9666c753a63SCortland Tölva #define TARGET_USBDEVFS_CONNECTINFO TARGET_IOWU('U', 17) 9676c753a63SCortland Tölva #define TARGET_USBDEVFS_IOCTL TARGET_IOWRU('U', 18) 9686c753a63SCortland Tölva #define TARGET_USBDEVFS_HUB_PORTINFO TARGET_IORU('U', 19) 9696c753a63SCortland Tölva #define TARGET_USBDEVFS_RESET TARGET_IO('U', 20) 9706c753a63SCortland Tölva #define TARGET_USBDEVFS_CLEAR_HALT TARGET_IORU('U', 21) 9716c753a63SCortland Tölva #define TARGET_USBDEVFS_DISCONNECT TARGET_IO('U', 22) 9726c753a63SCortland Tölva #define TARGET_USBDEVFS_CONNECT TARGET_IO('U', 23) 9736c753a63SCortland Tölva #define TARGET_USBDEVFS_CLAIM_PORT TARGET_IORU('U', 24) 9746c753a63SCortland Tölva #define TARGET_USBDEVFS_RELEASE_PORT TARGET_IORU('U', 25) 9756c753a63SCortland Tölva #define TARGET_USBDEVFS_GET_CAPABILITIES TARGET_IORU('U', 26) 9766c753a63SCortland Tölva #define TARGET_USBDEVFS_DISCONNECT_CLAIM TARGET_IORU('U', 27) 9776c753a63SCortland Tölva #define TARGET_USBDEVFS_DROP_PRIVILEGES TARGET_IOWU('U', 30) 9786c753a63SCortland Tölva #define TARGET_USBDEVFS_GET_SPEED TARGET_IO('U', 31) 9796c753a63SCortland Tölva 98031e31b8aSbellard /* cdrom commands */ 98131e31b8aSbellard #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ 98231e31b8aSbellard #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ 98331e31b8aSbellard #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ 98431e31b8aSbellard #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index 98531e31b8aSbellard (struct cdrom_ti) */ 98631e31b8aSbellard #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header 98731e31b8aSbellard (struct cdrom_tochdr) */ 98831e31b8aSbellard #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry 98931e31b8aSbellard (struct cdrom_tocentry) */ 99031e31b8aSbellard #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ 99131e31b8aSbellard #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ 99231e31b8aSbellard #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ 99331e31b8aSbellard #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume 99431e31b8aSbellard (struct cdrom_volctrl) */ 99531e31b8aSbellard #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data 99631e31b8aSbellard (struct cdrom_subchnl) */ 99731e31b8aSbellard #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) 99831e31b8aSbellard (struct cdrom_read) */ 99931e31b8aSbellard #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) 100031e31b8aSbellard (struct cdrom_read) */ 100131e31b8aSbellard #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ 100231e31b8aSbellard #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ 100331e31b8aSbellard #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session 100431e31b8aSbellard address of multi session disks 100531e31b8aSbellard (struct cdrom_multisession) */ 100631e31b8aSbellard #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" 100731e31b8aSbellard if available (struct cdrom_mcn) */ 100867cc32ebSVeres Lajos #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is deprecated, 1009b4916d7bSDong Xu Wang but here anyway for compatibility */ 101031e31b8aSbellard #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ 101131e31b8aSbellard #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting 101231e31b8aSbellard (struct cdrom_volctrl) */ 101331e31b8aSbellard #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) 101431e31b8aSbellard (struct cdrom_read) */ 101531e31b8aSbellard /* 101631e31b8aSbellard * These ioctls are used only used in aztcd.c and optcd.c 101731e31b8aSbellard */ 101831e31b8aSbellard #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ 101931e31b8aSbellard #define TARGET_CDROMSEEK 0x5316 /* seek msf address */ 102031e31b8aSbellard 102131e31b8aSbellard /* 102231e31b8aSbellard * This ioctl is only used by the scsi-cd driver. 102331e31b8aSbellard It is for playing audio in logical block addressing mode. 102431e31b8aSbellard */ 102531e31b8aSbellard #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ 102631e31b8aSbellard 102731e31b8aSbellard /* 102831e31b8aSbellard * These ioctls are only used in optcd.c 102931e31b8aSbellard */ 103031e31b8aSbellard #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ 103131e31b8aSbellard 103231e31b8aSbellard /* 103331e31b8aSbellard * These ioctls are (now) only in ide-cd.c for controlling 103431e31b8aSbellard * drive spindown time. They should be implemented in the 103531e31b8aSbellard * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, 103631e31b8aSbellard * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... 103731e31b8aSbellard * -Erik 103831e31b8aSbellard */ 103931e31b8aSbellard #define TARGET_CDROMGETSPINDOWN 0x531d 104031e31b8aSbellard #define TARGET_CDROMSETSPINDOWN 0x531e 104131e31b8aSbellard 104231e31b8aSbellard /* 104331e31b8aSbellard * These ioctls are implemented through the uniform CD-ROM driver 104431e31b8aSbellard * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM 104531e31b8aSbellard * drivers are eventually ported to the uniform CD-ROM driver interface. 104631e31b8aSbellard */ 104731e31b8aSbellard #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ 104831e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ 104931e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ 105031e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ 105131e31b8aSbellard #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ 105231e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ 105331e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ 105431e31b8aSbellard #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ 105531e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ 105631e31b8aSbellard #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ 105731e31b8aSbellard #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ 105831e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ 105931e31b8aSbellard 106031e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. 106131e31b8aSbellard * Future CDROM ioctls should be kept below 0x537F 106231e31b8aSbellard */ 106331e31b8aSbellard 106431e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */ 106531e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ 106631e31b8aSbellard /* conflict with SCSI_IOCTL_GET_IDLUN */ 106731e31b8aSbellard 106831e31b8aSbellard /* DVD-ROM Specific ioctls */ 106931e31b8aSbellard #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ 107031e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ 107131e31b8aSbellard #define TARGET_DVD_AUTH 0x5392 /* Authentication */ 107231e31b8aSbellard 107331e31b8aSbellard #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ 107431e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ 107531e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ 107631e31b8aSbellard 107731e31b8aSbellard /* HD commands */ 107831e31b8aSbellard 107931e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ 108031e31b8aSbellard #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ 108131e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ 108231e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ 108331e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ 108431e31b8aSbellard #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ 108531e31b8aSbellard #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ 108631e31b8aSbellard #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ 10872521d698Sbellard #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ 108831e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ 108931e31b8aSbellard 109031e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ 109131e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ 109231e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ 109331e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ 109431e31b8aSbellard #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ 109531e31b8aSbellard #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ 109631e31b8aSbellard #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ 109731e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ 10982521d698Sbellard 1099b8005914Sbalrog /* loop ioctls */ 1100b8005914Sbalrog #define TARGET_LOOP_SET_FD 0x4C00 1101b8005914Sbalrog #define TARGET_LOOP_CLR_FD 0x4C01 1102b8005914Sbalrog #define TARGET_LOOP_SET_STATUS 0x4C02 1103b8005914Sbalrog #define TARGET_LOOP_GET_STATUS 0x4C03 1104b8005914Sbalrog #define TARGET_LOOP_SET_STATUS64 0x4C04 1105b8005914Sbalrog #define TARGET_LOOP_GET_STATUS64 0x4C05 1106b8005914Sbalrog #define TARGET_LOOP_CHANGE_FD 0x4C06 11072521d698Sbellard 1108884cdc48SPeter Maydell #define TARGET_LOOP_CTL_ADD 0x4C80 1109884cdc48SPeter Maydell #define TARGET_LOOP_CTL_REMOVE 0x4C81 1110884cdc48SPeter Maydell #define TARGET_LOOP_CTL_GET_FREE 0x4C82 1111884cdc48SPeter Maydell 1112f7680a55SUlrich Hecht /* fb ioctls */ 1113f7680a55SUlrich Hecht #define TARGET_FBIOGET_VSCREENINFO 0x4600 1114f7680a55SUlrich Hecht #define TARGET_FBIOPUT_VSCREENINFO 0x4601 1115f7680a55SUlrich Hecht #define TARGET_FBIOGET_FSCREENINFO 0x4602 111612b81b71SCédric VINCENT #define TARGET_FBIOGETCMAP 0x4604 111712b81b71SCédric VINCENT #define TARGET_FBIOPUTCMAP 0x4605 111812b81b71SCédric VINCENT #define TARGET_FBIOPAN_DISPLAY 0x4606 111912b81b71SCédric VINCENT #define TARGET_FBIOGET_CON2FBMAP 0x460F 112012b81b71SCédric VINCENT #define TARGET_FBIOPUT_CON2FBMAP 0x4610 1121f7680a55SUlrich Hecht 1122f7680a55SUlrich Hecht /* vt ioctls */ 1123f7680a55SUlrich Hecht #define TARGET_VT_OPENQRY 0x5600 1124f7680a55SUlrich Hecht #define TARGET_VT_GETSTATE 0x5603 1125f7680a55SUlrich Hecht #define TARGET_VT_ACTIVATE 0x5606 1126f7680a55SUlrich Hecht #define TARGET_VT_WAITACTIVE 0x5607 1127f7680a55SUlrich Hecht #define TARGET_VT_LOCKSWITCH 0x560b 1128f7680a55SUlrich Hecht #define TARGET_VT_UNLOCKSWITCH 0x560c 1129774750c0SCédric VINCENT #define TARGET_VT_GETMODE 0x5601 1130774750c0SCédric VINCENT #define TARGET_VT_SETMODE 0x5602 1131774750c0SCédric VINCENT #define TARGET_VT_RELDISP 0x5605 1132774750c0SCédric VINCENT #define TARGET_VT_DISALLOCATE 0x5608 1133f7680a55SUlrich Hecht 113456e904ecSAlexander Graf /* device mapper */ 113556e904ecSAlexander Graf #define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00) 113656e904ecSAlexander Graf #define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01) 113756e904ecSAlexander Graf #define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02) 113856e904ecSAlexander Graf #define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03) 113956e904ecSAlexander Graf #define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04) 114056e904ecSAlexander Graf #define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05) 114156e904ecSAlexander Graf #define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06) 114256e904ecSAlexander Graf #define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07) 114356e904ecSAlexander Graf #define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08) 114456e904ecSAlexander Graf #define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09) 114556e904ecSAlexander Graf #define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a) 114656e904ecSAlexander Graf #define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b) 114756e904ecSAlexander Graf #define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c) 114856e904ecSAlexander Graf #define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d) 114956e904ecSAlexander Graf #define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e) 115056e904ecSAlexander Graf #define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f) 115156e904ecSAlexander Graf 11522521d698Sbellard /* from asm/termbits.h */ 11532521d698Sbellard 11543bfd9da1Sbellard #define TARGET_NCC 8 11553bfd9da1Sbellard struct target_termio { 11563bfd9da1Sbellard unsigned short c_iflag; /* input mode flags */ 11573bfd9da1Sbellard unsigned short c_oflag; /* output mode flags */ 11583bfd9da1Sbellard unsigned short c_cflag; /* control mode flags */ 11593bfd9da1Sbellard unsigned short c_lflag; /* local mode flags */ 11602521d698Sbellard unsigned char c_line; /* line discipline */ 11613bfd9da1Sbellard unsigned char c_cc[TARGET_NCC]; /* control characters */ 11622521d698Sbellard }; 11632521d698Sbellard 11643bfd9da1Sbellard struct target_winsize { 11653bfd9da1Sbellard unsigned short ws_row; 11663bfd9da1Sbellard unsigned short ws_col; 11673bfd9da1Sbellard unsigned short ws_xpixel; 11683bfd9da1Sbellard unsigned short ws_ypixel; 11693bfd9da1Sbellard }; 11702521d698Sbellard 11713bfd9da1Sbellard #include "termbits.h" 11722521d698Sbellard 11739e0b74a4SPaul Brook #if defined(TARGET_MIPS) 11749e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x10 11759e0b74a4SPaul Brook #else 11769e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x08 11779e0b74a4SPaul Brook #endif 11789e0b74a4SPaul Brook 1179e44a3e79Saurel32 /* Common */ 11802521d698Sbellard #define TARGET_MAP_SHARED 0x01 /* Share changes */ 11812521d698Sbellard #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ 1182e65be6a7SHelge Deller #if defined(TARGET_HPPA) 1183e65be6a7SHelge Deller #define TARGET_MAP_TYPE 0x03 /* Mask for type of mapping */ 1184e65be6a7SHelge Deller #else 11852521d698Sbellard #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ 1186e65be6a7SHelge Deller #endif 1187e44a3e79Saurel32 1188e44a3e79Saurel32 /* Target specific */ 1189048f6b4dSbellard #if defined(TARGET_MIPS) 1190e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1191048f6b4dSbellard #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 1192048f6b4dSbellard #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 1193048f6b4dSbellard #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 1194048f6b4dSbellard #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 1195048f6b4dSbellard #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 1196048f6b4dSbellard #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 1197540635baSths #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 1198540635baSths #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1199541e1690SHelge Deller #define TARGET_MAP_STACK 0x40000 /* ignored */ 1200541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ 1201e44a3e79Saurel32 #elif defined(TARGET_PPC) 1202e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 12032521d698Sbellard #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 12042521d698Sbellard #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 12052521d698Sbellard #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 12062521d698Sbellard #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 12077ec93196Sj_mayer #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ 12087ec93196Sj_mayer #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ 1209e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1210e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1211541e1690SHelge Deller #define TARGET_MAP_STACK 0x20000 /* ignored */ 1212541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ 1213e44a3e79Saurel32 #elif defined(TARGET_ALPHA) 1214e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1215e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ 1216e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ 1217e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ 1218e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ 1219e44a3e79Saurel32 #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ 1220e44a3e79Saurel32 #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ 1221e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ 1222e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ 1223541e1690SHelge Deller #define TARGET_MAP_STACK 0x80000 /* ignored */ 1224541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x100000 /* create a huge page mapping */ 1225a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 1226a10d1e50SRichard Henderson #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1227a10d1e50SRichard Henderson #define TARGET_MAP_FIXED 0x04 /* Interpret addr exactly */ 1228a10d1e50SRichard Henderson #define TARGET_MAP_GROWSDOWN 0x08000 /* stack-like segment */ 1229a10d1e50SRichard Henderson #define TARGET_MAP_DENYWRITE 0x00800 /* ETXTBSY */ 1230a10d1e50SRichard Henderson #define TARGET_MAP_EXECUTABLE 0x01000 /* mark it as an executable */ 1231a10d1e50SRichard Henderson #define TARGET_MAP_LOCKED 0x02000 /* lock the mapping */ 1232a10d1e50SRichard Henderson #define TARGET_MAP_NORESERVE 0x04000 /* no check for reservations */ 1233a10d1e50SRichard Henderson #define TARGET_MAP_POPULATE 0x10000 /* pop (prefault) pagetables */ 1234a10d1e50SRichard Henderson #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1235541e1690SHelge Deller #define TARGET_MAP_STACK 0x40000 /* ignored */ 1236541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ 1237ba7651fbSMax Filippov #elif defined(TARGET_XTENSA) 1238ba7651fbSMax Filippov #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1239ba7651fbSMax Filippov #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 1240ba7651fbSMax Filippov #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 1241ba7651fbSMax Filippov #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 1242ba7651fbSMax Filippov #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 1243ba7651fbSMax Filippov #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 1244ba7651fbSMax Filippov #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 1245ba7651fbSMax Filippov #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 1246ba7651fbSMax Filippov #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1247ba7651fbSMax Filippov #define TARGET_MAP_STACK 0x40000 1248ba7651fbSMax Filippov #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ 12497ec93196Sj_mayer #else 1250e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1251e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 1252e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 1253e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 1254e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 12552521d698Sbellard #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ 12562521d698Sbellard #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ 1257540635baSths #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1258540635baSths #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1259541e1690SHelge Deller #define TARGET_MAP_STACK 0x20000 /* ignored */ 1260541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ 1261906c1b8eSMike Frysinger #define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ 12627ec93196Sj_mayer #endif 12632521d698Sbellard 126409701199SAlexander Graf #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 126509701199SAlexander Graf || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 1266daa4374aSPeter Maydell || defined(TARGET_CRIS) 12675f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 12682521d698Sbellard struct target_stat { 12692521d698Sbellard unsigned short st_dev; 12702521d698Sbellard unsigned short __pad1; 1271992f48a0Sblueswir1 abi_ulong st_ino; 12722521d698Sbellard unsigned short st_mode; 12732521d698Sbellard unsigned short st_nlink; 12742521d698Sbellard unsigned short st_uid; 12752521d698Sbellard unsigned short st_gid; 12762521d698Sbellard unsigned short st_rdev; 12772521d698Sbellard unsigned short __pad2; 1278992f48a0Sblueswir1 abi_ulong st_size; 1279992f48a0Sblueswir1 abi_ulong st_blksize; 1280992f48a0Sblueswir1 abi_ulong st_blocks; 1281992f48a0Sblueswir1 abi_ulong target_st_atime; 12825f992db6SChen-Yu Tsai abi_ulong target_st_atime_nsec; 1283992f48a0Sblueswir1 abi_ulong target_st_mtime; 12845f992db6SChen-Yu Tsai abi_ulong target_st_mtime_nsec; 1285992f48a0Sblueswir1 abi_ulong target_st_ctime; 12865f992db6SChen-Yu Tsai abi_ulong target_st_ctime_nsec; 1287992f48a0Sblueswir1 abi_ulong __unused4; 1288992f48a0Sblueswir1 abi_ulong __unused5; 12892521d698Sbellard }; 12902521d698Sbellard 12912521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely 12922521d698Sbellard * insane amounts of padding around dev_t's. 12932521d698Sbellard */ 129420d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 12952521d698Sbellard struct target_stat64 { 12962521d698Sbellard unsigned short st_dev; 12972521d698Sbellard unsigned char __pad0[10]; 12982521d698Sbellard 12992521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1300992f48a0Sblueswir1 abi_ulong __st_ino; 13012521d698Sbellard 13022521d698Sbellard unsigned int st_mode; 13032521d698Sbellard unsigned int st_nlink; 13042521d698Sbellard 1305992f48a0Sblueswir1 abi_ulong st_uid; 1306992f48a0Sblueswir1 abi_ulong st_gid; 13072521d698Sbellard 13082521d698Sbellard unsigned short st_rdev; 13092521d698Sbellard unsigned char __pad3[10]; 13102521d698Sbellard 13112521d698Sbellard long long st_size; 1312992f48a0Sblueswir1 abi_ulong st_blksize; 13132521d698Sbellard 1314992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1315992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 13162521d698Sbellard 1317992f48a0Sblueswir1 abi_ulong target_st_atime; 13185f992db6SChen-Yu Tsai abi_ulong target_st_atime_nsec; 13192521d698Sbellard 1320992f48a0Sblueswir1 abi_ulong target_st_mtime; 13215f992db6SChen-Yu Tsai abi_ulong target_st_mtime_nsec; 13222521d698Sbellard 1323992f48a0Sblueswir1 abi_ulong target_st_ctime; 13245f992db6SChen-Yu Tsai abi_ulong target_st_ctime_nsec; 13252521d698Sbellard 13262521d698Sbellard unsigned long long st_ino; 1327541dc0d4SStefan Weil } QEMU_PACKED; 13282521d698Sbellard 1329ce4defa0Spbrook #ifdef TARGET_ARM 133020d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1331ce4defa0Spbrook struct target_eabi_stat64 { 1332ce4defa0Spbrook unsigned long long st_dev; 1333ce4defa0Spbrook unsigned int __pad1; 1334992f48a0Sblueswir1 abi_ulong __st_ino; 1335ce4defa0Spbrook unsigned int st_mode; 1336ce4defa0Spbrook unsigned int st_nlink; 1337ce4defa0Spbrook 1338992f48a0Sblueswir1 abi_ulong st_uid; 1339992f48a0Sblueswir1 abi_ulong st_gid; 1340ce4defa0Spbrook 1341ce4defa0Spbrook unsigned long long st_rdev; 1342ce4defa0Spbrook unsigned int __pad2[2]; 1343ce4defa0Spbrook 1344ce4defa0Spbrook long long st_size; 1345992f48a0Sblueswir1 abi_ulong st_blksize; 1346ce4defa0Spbrook unsigned int __pad3; 1347ce4defa0Spbrook unsigned long long st_blocks; 1348ce4defa0Spbrook 1349992f48a0Sblueswir1 abi_ulong target_st_atime; 1350992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1351ce4defa0Spbrook 1352992f48a0Sblueswir1 abi_ulong target_st_mtime; 1353992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1354ce4defa0Spbrook 1355992f48a0Sblueswir1 abi_ulong target_st_ctime; 1356992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1357ce4defa0Spbrook 1358ce4defa0Spbrook unsigned long long st_ino; 1359541dc0d4SStefan Weil } QEMU_PACKED; 1360ce4defa0Spbrook #endif 1361ce4defa0Spbrook 1362992f48a0Sblueswir1 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 13631b8dd648Sblueswir1 struct target_stat { 13641b8dd648Sblueswir1 unsigned int st_dev; 1365992f48a0Sblueswir1 abi_ulong st_ino; 13661b8dd648Sblueswir1 unsigned int st_mode; 13671b8dd648Sblueswir1 unsigned int st_nlink; 13681b8dd648Sblueswir1 unsigned int st_uid; 13691b8dd648Sblueswir1 unsigned int st_gid; 13701b8dd648Sblueswir1 unsigned int st_rdev; 1371992f48a0Sblueswir1 abi_long st_size; 1372992f48a0Sblueswir1 abi_long target_st_atime; 1373992f48a0Sblueswir1 abi_long target_st_mtime; 1374992f48a0Sblueswir1 abi_long target_st_ctime; 1375992f48a0Sblueswir1 abi_long st_blksize; 1376992f48a0Sblueswir1 abi_long st_blocks; 1377992f48a0Sblueswir1 abi_ulong __unused4[2]; 13781b8dd648Sblueswir1 }; 13791b8dd648Sblueswir1 138020d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 13811b8dd648Sblueswir1 struct target_stat64 { 13821b8dd648Sblueswir1 unsigned char __pad0[6]; 13831b8dd648Sblueswir1 unsigned short st_dev; 13841b8dd648Sblueswir1 13851b8dd648Sblueswir1 uint64_t st_ino; 13861b8dd648Sblueswir1 uint64_t st_nlink; 13871b8dd648Sblueswir1 13881b8dd648Sblueswir1 unsigned int st_mode; 13891b8dd648Sblueswir1 13901b8dd648Sblueswir1 unsigned int st_uid; 13911b8dd648Sblueswir1 unsigned int st_gid; 13921b8dd648Sblueswir1 13931b8dd648Sblueswir1 unsigned char __pad2[6]; 13941b8dd648Sblueswir1 unsigned short st_rdev; 13951b8dd648Sblueswir1 13961b8dd648Sblueswir1 int64_t st_size; 13971b8dd648Sblueswir1 int64_t st_blksize; 13981b8dd648Sblueswir1 13991b8dd648Sblueswir1 unsigned char __pad4[4]; 14001b8dd648Sblueswir1 unsigned int st_blocks; 14011b8dd648Sblueswir1 1402992f48a0Sblueswir1 abi_ulong target_st_atime; 14035f992db6SChen-Yu Tsai abi_ulong target_st_atime_nsec; 14041b8dd648Sblueswir1 1405992f48a0Sblueswir1 abi_ulong target_st_mtime; 14065f992db6SChen-Yu Tsai abi_ulong target_st_mtime_nsec; 14071b8dd648Sblueswir1 1408992f48a0Sblueswir1 abi_ulong target_st_ctime; 14095f992db6SChen-Yu Tsai abi_ulong target_st_ctime_nsec; 14101b8dd648Sblueswir1 1411992f48a0Sblueswir1 abi_ulong __unused4[3]; 14121b8dd648Sblueswir1 }; 14131b8dd648Sblueswir1 14143bfd9da1Sbellard #elif defined(TARGET_SPARC) 14153bfd9da1Sbellard 14165f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 14173bfd9da1Sbellard struct target_stat { 14183bfd9da1Sbellard unsigned short st_dev; 1419992f48a0Sblueswir1 abi_ulong st_ino; 14203bfd9da1Sbellard unsigned short st_mode; 14213bfd9da1Sbellard short st_nlink; 14223bfd9da1Sbellard unsigned short st_uid; 14233bfd9da1Sbellard unsigned short st_gid; 14243bfd9da1Sbellard unsigned short st_rdev; 1425992f48a0Sblueswir1 abi_long st_size; 1426992f48a0Sblueswir1 abi_long target_st_atime; 14275f992db6SChen-Yu Tsai abi_ulong target_st_atime_nsec; 1428992f48a0Sblueswir1 abi_long target_st_mtime; 14295f992db6SChen-Yu Tsai abi_ulong target_st_mtime_nsec; 1430992f48a0Sblueswir1 abi_long target_st_ctime; 14315f992db6SChen-Yu Tsai abi_ulong target_st_ctime_nsec; 1432992f48a0Sblueswir1 abi_long st_blksize; 1433992f48a0Sblueswir1 abi_long st_blocks; 14345f992db6SChen-Yu Tsai abi_ulong __unused1[2]; 14353bfd9da1Sbellard }; 14363bfd9da1Sbellard 143720d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 14383bfd9da1Sbellard struct target_stat64 { 14393bfd9da1Sbellard unsigned char __pad0[6]; 14403bfd9da1Sbellard unsigned short st_dev; 14413bfd9da1Sbellard 14423bfd9da1Sbellard uint64_t st_ino; 14433bfd9da1Sbellard 14443bfd9da1Sbellard unsigned int st_mode; 14453bfd9da1Sbellard unsigned int st_nlink; 14463bfd9da1Sbellard 14473bfd9da1Sbellard unsigned int st_uid; 14483bfd9da1Sbellard unsigned int st_gid; 14493bfd9da1Sbellard 14503bfd9da1Sbellard unsigned char __pad2[6]; 14513bfd9da1Sbellard unsigned short st_rdev; 14523bfd9da1Sbellard 14533bfd9da1Sbellard unsigned char __pad3[8]; 14543bfd9da1Sbellard 14553bfd9da1Sbellard int64_t st_size; 14563bfd9da1Sbellard unsigned int st_blksize; 14573bfd9da1Sbellard 14583bfd9da1Sbellard unsigned char __pad4[8]; 14593bfd9da1Sbellard unsigned int st_blocks; 14603bfd9da1Sbellard 14613bfd9da1Sbellard unsigned int target_st_atime; 14625f992db6SChen-Yu Tsai unsigned int target_st_atime_nsec; 14633bfd9da1Sbellard 14643bfd9da1Sbellard unsigned int target_st_mtime; 14655f992db6SChen-Yu Tsai unsigned int target_st_mtime_nsec; 14663bfd9da1Sbellard 14673bfd9da1Sbellard unsigned int target_st_ctime; 14685f992db6SChen-Yu Tsai unsigned int target_st_ctime_nsec; 14693bfd9da1Sbellard 14705f992db6SChen-Yu Tsai unsigned int __unused1; 14715f992db6SChen-Yu Tsai unsigned int __unused2; 14723bfd9da1Sbellard }; 14733bfd9da1Sbellard 147467867308Sbellard #elif defined(TARGET_PPC) 147567867308Sbellard 14765f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 147767867308Sbellard struct target_stat { 1478e32448e0Sj_mayer abi_ulong st_dev; 1479992f48a0Sblueswir1 abi_ulong st_ino; 1480325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1481e32448e0Sj_mayer abi_ulong st_nlink; 1482325e651fSj_mayer unsigned int st_mode; 1483325e651fSj_mayer #else 148467867308Sbellard unsigned int st_mode; 148567867308Sbellard unsigned short st_nlink; 1486325e651fSj_mayer #endif 148767867308Sbellard unsigned int st_uid; 148867867308Sbellard unsigned int st_gid; 1489e32448e0Sj_mayer abi_ulong st_rdev; 1490992f48a0Sblueswir1 abi_ulong st_size; 1491992f48a0Sblueswir1 abi_ulong st_blksize; 1492992f48a0Sblueswir1 abi_ulong st_blocks; 1493992f48a0Sblueswir1 abi_ulong target_st_atime; 1494e32448e0Sj_mayer abi_ulong target_st_atime_nsec; 1495992f48a0Sblueswir1 abi_ulong target_st_mtime; 1496e32448e0Sj_mayer abi_ulong target_st_mtime_nsec; 1497992f48a0Sblueswir1 abi_ulong target_st_ctime; 1498e32448e0Sj_mayer abi_ulong target_st_ctime_nsec; 1499992f48a0Sblueswir1 abi_ulong __unused4; 1500992f48a0Sblueswir1 abi_ulong __unused5; 1501325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1502325e651fSj_mayer abi_ulong __unused6; 1503325e651fSj_mayer #endif 150467867308Sbellard }; 150567867308Sbellard 150620d155bcSStefan Weil #if !defined(TARGET_PPC64) || defined(TARGET_ABI32) 150720d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1508541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 150967867308Sbellard unsigned long long st_dev; 151067867308Sbellard unsigned long long st_ino; 151167867308Sbellard unsigned int st_mode; 151267867308Sbellard unsigned int st_nlink; 151367867308Sbellard unsigned int st_uid; 151467867308Sbellard unsigned int st_gid; 151567867308Sbellard unsigned long long st_rdev; 1516e1ce5e40Saurel32 unsigned long long __pad0; 151767867308Sbellard long long st_size; 1518e32448e0Sj_mayer int st_blksize; 1519e1ce5e40Saurel32 unsigned int __pad1; 152061322e91SMax Filippov long long st_blocks; /* Number 512-byte blocks allocated. */ 1521e32448e0Sj_mayer int target_st_atime; 1522e32448e0Sj_mayer unsigned int target_st_atime_nsec; 1523e32448e0Sj_mayer int target_st_mtime; 1524e32448e0Sj_mayer unsigned int target_st_mtime_nsec; 1525e32448e0Sj_mayer int target_st_ctime; 1526e32448e0Sj_mayer unsigned int target_st_ctime_nsec; 1527e32448e0Sj_mayer unsigned int __unused4; 1528e32448e0Sj_mayer unsigned int __unused5; 152967867308Sbellard }; 153020d155bcSStefan Weil #endif 153167867308Sbellard 1532b779e29eSEdgar E. Iglesias #elif defined(TARGET_MICROBLAZE) 1533b779e29eSEdgar E. Iglesias 15345f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1535b779e29eSEdgar E. Iglesias struct target_stat { 1536b779e29eSEdgar E. Iglesias abi_ulong st_dev; 1537b779e29eSEdgar E. Iglesias abi_ulong st_ino; 1538b779e29eSEdgar E. Iglesias unsigned int st_mode; 1539b779e29eSEdgar E. Iglesias unsigned short st_nlink; 1540b779e29eSEdgar E. Iglesias unsigned int st_uid; 1541b779e29eSEdgar E. Iglesias unsigned int st_gid; 1542b779e29eSEdgar E. Iglesias abi_ulong st_rdev; 1543b779e29eSEdgar E. Iglesias abi_ulong st_size; 1544b779e29eSEdgar E. Iglesias abi_ulong st_blksize; 1545b779e29eSEdgar E. Iglesias abi_ulong st_blocks; 1546b779e29eSEdgar E. Iglesias abi_ulong target_st_atime; 1547b779e29eSEdgar E. Iglesias abi_ulong target_st_atime_nsec; 1548b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime; 1549b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime_nsec; 1550b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime; 1551b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime_nsec; 1552b779e29eSEdgar E. Iglesias abi_ulong __unused4; 1553b779e29eSEdgar E. Iglesias abi_ulong __unused5; 1554b779e29eSEdgar E. Iglesias }; 1555b779e29eSEdgar E. Iglesias 1556b779e29eSEdgar E. Iglesias /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ 155720d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1558541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 1559b779e29eSEdgar E. Iglesias uint64_t st_dev; 1560a523eb06SEdgar E. Iglesias #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1561a523eb06SEdgar E. Iglesias uint32_t pad0; 1562a523eb06SEdgar E. Iglesias uint32_t __st_ino; 1563a523eb06SEdgar E. Iglesias 1564b779e29eSEdgar E. Iglesias uint32_t st_mode; 1565b779e29eSEdgar E. Iglesias uint32_t st_nlink; 1566b779e29eSEdgar E. Iglesias uint32_t st_uid; 1567b779e29eSEdgar E. Iglesias uint32_t st_gid; 1568b779e29eSEdgar E. Iglesias uint64_t st_rdev; 156921ebeb23SEdgar E. Iglesias uint64_t __pad1; 1570b779e29eSEdgar E. Iglesias 1571b779e29eSEdgar E. Iglesias int64_t st_size; 1572b779e29eSEdgar E. Iglesias int32_t st_blksize; 157321ebeb23SEdgar E. Iglesias uint32_t __pad2; 1574b779e29eSEdgar E. Iglesias int64_t st_blocks; /* Number 512-byte blocks allocated. */ 1575b779e29eSEdgar E. Iglesias 1576b779e29eSEdgar E. Iglesias int target_st_atime; 1577b779e29eSEdgar E. Iglesias unsigned int target_st_atime_nsec; 1578b779e29eSEdgar E. Iglesias int target_st_mtime; 1579b779e29eSEdgar E. Iglesias unsigned int target_st_mtime_nsec; 1580b779e29eSEdgar E. Iglesias int target_st_ctime; 1581b779e29eSEdgar E. Iglesias unsigned int target_st_ctime_nsec; 1582a523eb06SEdgar E. Iglesias uint64_t st_ino; 1583b779e29eSEdgar E. Iglesias }; 1584b779e29eSEdgar E. Iglesias 1585e6e5906bSpbrook #elif defined(TARGET_M68K) 1586e6e5906bSpbrook 1587e6e5906bSpbrook struct target_stat { 1588e6e5906bSpbrook unsigned short st_dev; 1589e6e5906bSpbrook unsigned short __pad1; 1590992f48a0Sblueswir1 abi_ulong st_ino; 1591e6e5906bSpbrook unsigned short st_mode; 1592e6e5906bSpbrook unsigned short st_nlink; 1593e6e5906bSpbrook unsigned short st_uid; 1594e6e5906bSpbrook unsigned short st_gid; 1595e6e5906bSpbrook unsigned short st_rdev; 1596e6e5906bSpbrook unsigned short __pad2; 1597992f48a0Sblueswir1 abi_ulong st_size; 1598992f48a0Sblueswir1 abi_ulong st_blksize; 1599992f48a0Sblueswir1 abi_ulong st_blocks; 1600992f48a0Sblueswir1 abi_ulong target_st_atime; 1601992f48a0Sblueswir1 abi_ulong __unused1; 1602992f48a0Sblueswir1 abi_ulong target_st_mtime; 1603992f48a0Sblueswir1 abi_ulong __unused2; 1604992f48a0Sblueswir1 abi_ulong target_st_ctime; 1605992f48a0Sblueswir1 abi_ulong __unused3; 1606992f48a0Sblueswir1 abi_ulong __unused4; 1607992f48a0Sblueswir1 abi_ulong __unused5; 1608e6e5906bSpbrook }; 1609e6e5906bSpbrook 1610e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely 1611e6e5906bSpbrook * insane amounts of padding around dev_t's. 1612e6e5906bSpbrook */ 161320d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1614e6e5906bSpbrook struct target_stat64 { 1615e6e5906bSpbrook unsigned long long st_dev; 1616e6e5906bSpbrook unsigned char __pad1[2]; 1617e6e5906bSpbrook 1618e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1619992f48a0Sblueswir1 abi_ulong __st_ino; 1620e6e5906bSpbrook 1621e6e5906bSpbrook unsigned int st_mode; 1622e6e5906bSpbrook unsigned int st_nlink; 1623e6e5906bSpbrook 1624992f48a0Sblueswir1 abi_ulong st_uid; 1625992f48a0Sblueswir1 abi_ulong st_gid; 1626e6e5906bSpbrook 1627e6e5906bSpbrook unsigned long long st_rdev; 1628e6e5906bSpbrook unsigned char __pad3[2]; 1629e6e5906bSpbrook 1630e6e5906bSpbrook long long st_size; 1631992f48a0Sblueswir1 abi_ulong st_blksize; 1632e6e5906bSpbrook 1633992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 1634992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1635e6e5906bSpbrook 1636992f48a0Sblueswir1 abi_ulong target_st_atime; 1637992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1638e6e5906bSpbrook 1639992f48a0Sblueswir1 abi_ulong target_st_mtime; 1640992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1641e6e5906bSpbrook 1642992f48a0Sblueswir1 abi_ulong target_st_ctime; 1643992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1644e6e5906bSpbrook 1645e6e5906bSpbrook unsigned long long st_ino; 1646541dc0d4SStefan Weil } QEMU_PACKED; 1647e6e5906bSpbrook 1648d26bc211Sths #elif defined(TARGET_ABI_MIPSN64) 1649540635baSths 16505f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1651540635baSths /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ 1652540635baSths struct target_stat { 1653540635baSths unsigned int st_dev; 1654540635baSths unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ 1655540635baSths 1656992f48a0Sblueswir1 abi_ulong st_ino; 1657540635baSths 1658540635baSths unsigned int st_mode; 1659540635baSths unsigned int st_nlink; 1660540635baSths 1661540635baSths int st_uid; 1662540635baSths int st_gid; 1663540635baSths 1664540635baSths unsigned int st_rdev; 1665540635baSths unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ 1666540635baSths 1667992f48a0Sblueswir1 abi_ulong st_size; 1668540635baSths 1669540635baSths /* 1670540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1671540635baSths * but we don't have it under Linux. 1672540635baSths */ 1673540635baSths unsigned int target_st_atime; 1674540635baSths unsigned int target_st_atime_nsec; 1675540635baSths 1676540635baSths unsigned int target_st_mtime; 1677540635baSths unsigned int target_st_mtime_nsec; 1678540635baSths 1679540635baSths unsigned int target_st_ctime; 1680540635baSths unsigned int target_st_ctime_nsec; 1681540635baSths 1682540635baSths unsigned int st_blksize; 1683540635baSths unsigned int st_pad2; 1684540635baSths 1685992f48a0Sblueswir1 abi_ulong st_blocks; 1686540635baSths }; 1687540635baSths 1688d26bc211Sths #elif defined(TARGET_ABI_MIPSN32) 1689540635baSths 16905f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1691540635baSths struct target_stat { 16921ab2aea2SLeon Alrae abi_ulong st_dev; 16931ab2aea2SLeon Alrae abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 16941ab2aea2SLeon Alrae uint64_t st_ino; 1695540635baSths unsigned int st_mode; 1696540635baSths unsigned int st_nlink; 1697540635baSths int st_uid; 1698540635baSths int st_gid; 16991ab2aea2SLeon Alrae abi_ulong st_rdev; 17001ab2aea2SLeon Alrae abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 17011ab2aea2SLeon Alrae int64_t st_size; 17021ab2aea2SLeon Alrae abi_long target_st_atime; 17031ab2aea2SLeon Alrae abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 17041ab2aea2SLeon Alrae abi_long target_st_mtime; 17051ab2aea2SLeon Alrae abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 17061ab2aea2SLeon Alrae abi_long target_st_ctime; 17071ab2aea2SLeon Alrae abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 17081ab2aea2SLeon Alrae abi_ulong st_blksize; 17091ab2aea2SLeon Alrae abi_ulong st_pad2; 17101ab2aea2SLeon Alrae int64_t st_blocks; 1711540635baSths }; 1712540635baSths 1713d26bc211Sths #elif defined(TARGET_ABI_MIPSO32) 1714048f6b4dSbellard 17155f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1716048f6b4dSbellard struct target_stat { 1717048f6b4dSbellard unsigned st_dev; 1718992f48a0Sblueswir1 abi_long st_pad1[3]; /* Reserved for network id */ 1719992f48a0Sblueswir1 abi_ulong st_ino; 1720048f6b4dSbellard unsigned int st_mode; 1721048f6b4dSbellard unsigned int st_nlink; 1722048f6b4dSbellard int st_uid; 1723048f6b4dSbellard int st_gid; 1724048f6b4dSbellard unsigned st_rdev; 1725992f48a0Sblueswir1 abi_long st_pad2[2]; 1726992f48a0Sblueswir1 abi_long st_size; 1727992f48a0Sblueswir1 abi_long st_pad3; 1728048f6b4dSbellard /* 1729048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1730048f6b4dSbellard * but we don't have it under Linux. 1731048f6b4dSbellard */ 1732992f48a0Sblueswir1 abi_long target_st_atime; 1733992f48a0Sblueswir1 abi_long target_st_atime_nsec; 1734992f48a0Sblueswir1 abi_long target_st_mtime; 1735992f48a0Sblueswir1 abi_long target_st_mtime_nsec; 1736992f48a0Sblueswir1 abi_long target_st_ctime; 1737992f48a0Sblueswir1 abi_long target_st_ctime_nsec; 1738992f48a0Sblueswir1 abi_long st_blksize; 1739992f48a0Sblueswir1 abi_long st_blocks; 1740992f48a0Sblueswir1 abi_long st_pad4[14]; 1741048f6b4dSbellard }; 1742048f6b4dSbellard 1743048f6b4dSbellard /* 1744048f6b4dSbellard * This matches struct stat64 in glibc2.1, hence the absolutely insane 1745048f6b4dSbellard * amounts of padding around dev_t's. The memory layout is the same as of 1746048f6b4dSbellard * struct stat of the 64-bit kernel. 1747048f6b4dSbellard */ 1748048f6b4dSbellard 174920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1750048f6b4dSbellard struct target_stat64 { 1751992f48a0Sblueswir1 abi_ulong st_dev; 1752992f48a0Sblueswir1 abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 1753048f6b4dSbellard 1754048f6b4dSbellard uint64_t st_ino; 1755048f6b4dSbellard 1756048f6b4dSbellard unsigned int st_mode; 1757048f6b4dSbellard unsigned int st_nlink; 1758048f6b4dSbellard 1759048f6b4dSbellard int st_uid; 1760048f6b4dSbellard int st_gid; 1761048f6b4dSbellard 1762992f48a0Sblueswir1 abi_ulong st_rdev; 1763992f48a0Sblueswir1 abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 1764048f6b4dSbellard 1765048f6b4dSbellard int64_t st_size; 1766048f6b4dSbellard 1767048f6b4dSbellard /* 1768048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1769048f6b4dSbellard * but we don't have it under Linux. 1770048f6b4dSbellard */ 1771992f48a0Sblueswir1 abi_long target_st_atime; 1772992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 1773048f6b4dSbellard 1774992f48a0Sblueswir1 abi_long target_st_mtime; 1775992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 1776048f6b4dSbellard 1777992f48a0Sblueswir1 abi_long target_st_ctime; 1778992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 1779048f6b4dSbellard 1780992f48a0Sblueswir1 abi_ulong st_blksize; 1781992f48a0Sblueswir1 abi_ulong st_pad2; 1782048f6b4dSbellard 1783048f6b4dSbellard int64_t st_blocks; 1784048f6b4dSbellard }; 17857a3148a9Sj_mayer 17867a3148a9Sj_mayer #elif defined(TARGET_ALPHA) 17877a3148a9Sj_mayer 17887a3148a9Sj_mayer struct target_stat { 17897a3148a9Sj_mayer unsigned int st_dev; 17907a3148a9Sj_mayer unsigned int st_ino; 17917a3148a9Sj_mayer unsigned int st_mode; 17927a3148a9Sj_mayer unsigned int st_nlink; 17937a3148a9Sj_mayer unsigned int st_uid; 17947a3148a9Sj_mayer unsigned int st_gid; 17957a3148a9Sj_mayer unsigned int st_rdev; 1796992f48a0Sblueswir1 abi_long st_size; 1797992f48a0Sblueswir1 abi_ulong target_st_atime; 1798992f48a0Sblueswir1 abi_ulong target_st_mtime; 1799992f48a0Sblueswir1 abi_ulong target_st_ctime; 18007a3148a9Sj_mayer unsigned int st_blksize; 18017a3148a9Sj_mayer unsigned int st_blocks; 18027a3148a9Sj_mayer unsigned int st_flags; 18037a3148a9Sj_mayer unsigned int st_gen; 18047a3148a9Sj_mayer }; 18057a3148a9Sj_mayer 180620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 18077a3148a9Sj_mayer struct target_stat64 { 1808992f48a0Sblueswir1 abi_ulong st_dev; 1809992f48a0Sblueswir1 abi_ulong st_ino; 1810992f48a0Sblueswir1 abi_ulong st_rdev; 1811992f48a0Sblueswir1 abi_long st_size; 1812992f48a0Sblueswir1 abi_ulong st_blocks; 18137a3148a9Sj_mayer 18147a3148a9Sj_mayer unsigned int st_mode; 18157a3148a9Sj_mayer unsigned int st_uid; 18167a3148a9Sj_mayer unsigned int st_gid; 18177a3148a9Sj_mayer unsigned int st_blksize; 18187a3148a9Sj_mayer unsigned int st_nlink; 18197a3148a9Sj_mayer unsigned int __pad0; 18207a3148a9Sj_mayer 1821992f48a0Sblueswir1 abi_ulong target_st_atime; 1822992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1823992f48a0Sblueswir1 abi_ulong target_st_mtime; 1824992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1825992f48a0Sblueswir1 abi_ulong target_st_ctime; 1826992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1827992f48a0Sblueswir1 abi_long __unused[3]; 18287a3148a9Sj_mayer }; 18297a3148a9Sj_mayer 18306db45e65Sths #elif defined(TARGET_SH4) 18316db45e65Sths 18325f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 18336db45e65Sths struct target_stat { 1834992f48a0Sblueswir1 abi_ulong st_dev; 1835992f48a0Sblueswir1 abi_ulong st_ino; 18366db45e65Sths unsigned short st_mode; 18376db45e65Sths unsigned short st_nlink; 18386db45e65Sths unsigned short st_uid; 18396db45e65Sths unsigned short st_gid; 1840992f48a0Sblueswir1 abi_ulong st_rdev; 1841992f48a0Sblueswir1 abi_ulong st_size; 1842992f48a0Sblueswir1 abi_ulong st_blksize; 1843992f48a0Sblueswir1 abi_ulong st_blocks; 1844992f48a0Sblueswir1 abi_ulong target_st_atime; 1845992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1846992f48a0Sblueswir1 abi_ulong target_st_mtime; 1847992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1848992f48a0Sblueswir1 abi_ulong target_st_ctime; 1849992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1850992f48a0Sblueswir1 abi_ulong __unused4; 1851992f48a0Sblueswir1 abi_ulong __unused5; 18526db45e65Sths }; 18536db45e65Sths 18546db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely 18556db45e65Sths * insane amounts of padding around dev_t's. 18566db45e65Sths */ 185720d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1858541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 18596db45e65Sths unsigned long long st_dev; 18606db45e65Sths unsigned char __pad0[4]; 18616db45e65Sths 18626db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1863992f48a0Sblueswir1 abi_ulong __st_ino; 18646db45e65Sths 18656db45e65Sths unsigned int st_mode; 18666db45e65Sths unsigned int st_nlink; 18676db45e65Sths 1868992f48a0Sblueswir1 abi_ulong st_uid; 1869992f48a0Sblueswir1 abi_ulong st_gid; 18706db45e65Sths 18716db45e65Sths unsigned long long st_rdev; 18726db45e65Sths unsigned char __pad3[4]; 18736db45e65Sths 18746db45e65Sths long long st_size; 1875992f48a0Sblueswir1 abi_ulong st_blksize; 18766db45e65Sths 18776db45e65Sths unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ 18786db45e65Sths 1879992f48a0Sblueswir1 abi_ulong target_st_atime; 1880992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 18816db45e65Sths 1882992f48a0Sblueswir1 abi_ulong target_st_mtime; 1883992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 18846db45e65Sths 1885992f48a0Sblueswir1 abi_ulong target_st_ctime; 1886992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 18876db45e65Sths 18886db45e65Sths unsigned long long st_ino; 18896db45e65Sths }; 18906db45e65Sths 1891d2fd1af7Sbellard #elif defined(TARGET_I386) && !defined(TARGET_ABI32) 18925f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1893d2fd1af7Sbellard struct target_stat { 1894d2fd1af7Sbellard abi_ulong st_dev; 1895d2fd1af7Sbellard abi_ulong st_ino; 1896d2fd1af7Sbellard abi_ulong st_nlink; 1897d2fd1af7Sbellard 1898d2fd1af7Sbellard unsigned int st_mode; 1899d2fd1af7Sbellard unsigned int st_uid; 1900d2fd1af7Sbellard unsigned int st_gid; 1901d2fd1af7Sbellard unsigned int __pad0; 1902d2fd1af7Sbellard abi_ulong st_rdev; 1903d2fd1af7Sbellard abi_long st_size; 1904d2fd1af7Sbellard abi_long st_blksize; 1905d2fd1af7Sbellard abi_long st_blocks; /* Number 512-byte blocks allocated. */ 1906d2fd1af7Sbellard 1907d2fd1af7Sbellard abi_ulong target_st_atime; 1908d2fd1af7Sbellard abi_ulong target_st_atime_nsec; 1909d2fd1af7Sbellard abi_ulong target_st_mtime; 1910d2fd1af7Sbellard abi_ulong target_st_mtime_nsec; 1911d2fd1af7Sbellard abi_ulong target_st_ctime; 1912d2fd1af7Sbellard abi_ulong target_st_ctime_nsec; 1913d2fd1af7Sbellard 1914d2fd1af7Sbellard abi_long __unused[3]; 1915d2fd1af7Sbellard }; 1916a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 1917a4c075f1SUlrich Hecht struct target_stat { 1918a4c075f1SUlrich Hecht abi_ulong st_dev; 1919a4c075f1SUlrich Hecht abi_ulong st_ino; 1920a4c075f1SUlrich Hecht abi_ulong st_nlink; 1921a4c075f1SUlrich Hecht unsigned int st_mode; 1922a4c075f1SUlrich Hecht unsigned int st_uid; 1923a4c075f1SUlrich Hecht unsigned int st_gid; 1924a4c075f1SUlrich Hecht unsigned int __pad1; 1925a4c075f1SUlrich Hecht abi_ulong st_rdev; 1926a4c075f1SUlrich Hecht abi_ulong st_size; 1927a4c075f1SUlrich Hecht abi_ulong target_st_atime; 1928a4c075f1SUlrich Hecht abi_ulong target_st_atime_nsec; 1929a4c075f1SUlrich Hecht abi_ulong target_st_mtime; 1930a4c075f1SUlrich Hecht abi_ulong target_st_mtime_nsec; 1931a4c075f1SUlrich Hecht abi_ulong target_st_ctime; 1932a4c075f1SUlrich Hecht abi_ulong target_st_ctime_nsec; 1933a4c075f1SUlrich Hecht abi_ulong st_blksize; 1934a4c075f1SUlrich Hecht abi_long st_blocks; 1935a4c075f1SUlrich Hecht abi_ulong __unused[3]; 1936a4c075f1SUlrich Hecht }; 193709701199SAlexander Graf #elif defined(TARGET_AARCH64) 19385f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 193909701199SAlexander Graf struct target_stat { 194009701199SAlexander Graf abi_ulong st_dev; 194109701199SAlexander Graf abi_ulong st_ino; 194209701199SAlexander Graf unsigned int st_mode; 194309701199SAlexander Graf unsigned int st_nlink; 194409701199SAlexander Graf unsigned int st_uid; 194509701199SAlexander Graf unsigned int st_gid; 194609701199SAlexander Graf abi_ulong st_rdev; 194709701199SAlexander Graf abi_ulong _pad1; 194809701199SAlexander Graf abi_long st_size; 194909701199SAlexander Graf int st_blksize; 195009701199SAlexander Graf int __pad2; 195109701199SAlexander Graf abi_long st_blocks; 195209701199SAlexander Graf abi_long target_st_atime; 195309701199SAlexander Graf abi_ulong target_st_atime_nsec; 195409701199SAlexander Graf abi_long target_st_mtime; 195509701199SAlexander Graf abi_ulong target_st_mtime_nsec; 195609701199SAlexander Graf abi_long target_st_ctime; 195709701199SAlexander Graf abi_ulong target_st_ctime_nsec; 195809701199SAlexander Graf unsigned int __unused[2]; 195909701199SAlexander Graf }; 1960ba7651fbSMax Filippov #elif defined(TARGET_XTENSA) 19615f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1962ba7651fbSMax Filippov struct target_stat { 1963ba7651fbSMax Filippov abi_ulong st_dev; 1964ba7651fbSMax Filippov abi_ulong st_ino; 1965ba7651fbSMax Filippov unsigned int st_mode; 1966ba7651fbSMax Filippov unsigned int st_nlink; 1967ba7651fbSMax Filippov unsigned int st_uid; 1968ba7651fbSMax Filippov unsigned int st_gid; 1969ba7651fbSMax Filippov abi_ulong st_rdev; 1970ba7651fbSMax Filippov abi_long st_size; 1971ba7651fbSMax Filippov abi_ulong st_blksize; 1972ba7651fbSMax Filippov abi_ulong st_blocks; 1973ba7651fbSMax Filippov abi_ulong target_st_atime; 1974ba7651fbSMax Filippov abi_ulong target_st_atime_nsec; 1975ba7651fbSMax Filippov abi_ulong target_st_mtime; 1976ba7651fbSMax Filippov abi_ulong target_st_mtime_nsec; 1977ba7651fbSMax Filippov abi_ulong target_st_ctime; 1978ba7651fbSMax Filippov abi_ulong target_st_ctime_nsec; 1979ba7651fbSMax Filippov abi_ulong __unused4; 1980ba7651fbSMax Filippov abi_ulong __unused5; 1981ba7651fbSMax Filippov }; 1982ba7651fbSMax Filippov 1983ba7651fbSMax Filippov #define TARGET_HAS_STRUCT_STAT64 1984ba7651fbSMax Filippov struct target_stat64 { 1985ba7651fbSMax Filippov uint64_t st_dev; /* Device */ 1986ba7651fbSMax Filippov uint64_t st_ino; /* File serial number */ 1987ba7651fbSMax Filippov unsigned int st_mode; /* File mode. */ 1988ba7651fbSMax Filippov unsigned int st_nlink; /* Link count. */ 1989ba7651fbSMax Filippov unsigned int st_uid; /* User ID of the file's owner. */ 1990ba7651fbSMax Filippov unsigned int st_gid; /* Group ID of the file's group. */ 1991ba7651fbSMax Filippov uint64_t st_rdev; /* Device number, if device. */ 1992ba7651fbSMax Filippov int64_t st_size; /* Size of file, in bytes. */ 1993ba7651fbSMax Filippov abi_ulong st_blksize; /* Optimal block size for I/O. */ 1994ba7651fbSMax Filippov abi_ulong __unused2; 1995ba7651fbSMax Filippov uint64_t st_blocks; /* Number 512-byte blocks allocated. */ 1996ba7651fbSMax Filippov abi_ulong target_st_atime; /* Time of last access. */ 1997ba7651fbSMax Filippov abi_ulong target_st_atime_nsec; 1998ba7651fbSMax Filippov abi_ulong target_st_mtime; /* Time of last modification. */ 1999ba7651fbSMax Filippov abi_ulong target_st_mtime_nsec; 2000ba7651fbSMax Filippov abi_ulong target_st_ctime; /* Time of last status change. */ 2001ba7651fbSMax Filippov abi_ulong target_st_ctime_nsec; 2002ba7651fbSMax Filippov abi_ulong __unused4; 2003ba7651fbSMax Filippov abi_ulong __unused5; 2004ba7651fbSMax Filippov }; 2005ba7651fbSMax Filippov 2006a0a839b6SMarek Vasut #elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) || \ 200747ae93cdSMichael Clark defined(TARGET_NIOS2) || defined(TARGET_RISCV) 2008c7819dfbSPeter Maydell 2009c7819dfbSPeter Maydell /* These are the asm-generic versions of the stat and stat64 structures */ 2010c7819dfbSPeter Maydell 20115f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 2012d962783eSJia Liu struct target_stat { 2013d962783eSJia Liu abi_ulong st_dev; 2014d962783eSJia Liu abi_ulong st_ino; 2015d962783eSJia Liu unsigned int st_mode; 2016c7819dfbSPeter Maydell unsigned int st_nlink; 2017d962783eSJia Liu unsigned int st_uid; 2018d962783eSJia Liu unsigned int st_gid; 2019d962783eSJia Liu abi_ulong st_rdev; 2020c7819dfbSPeter Maydell abi_ulong __pad1; 2021d962783eSJia Liu abi_long st_size; 2022c7819dfbSPeter Maydell int st_blksize; 2023c7819dfbSPeter Maydell int __pad2; 2024c7819dfbSPeter Maydell abi_long st_blocks; 2025c7819dfbSPeter Maydell abi_long target_st_atime; 2026d962783eSJia Liu abi_ulong target_st_atime_nsec; 2027c7819dfbSPeter Maydell abi_long target_st_mtime; 2028d962783eSJia Liu abi_ulong target_st_mtime_nsec; 2029c7819dfbSPeter Maydell abi_long target_st_ctime; 2030d962783eSJia Liu abi_ulong target_st_ctime_nsec; 2031c7819dfbSPeter Maydell unsigned int __unused4; 2032c7819dfbSPeter Maydell unsigned int __unused5; 2033d962783eSJia Liu }; 2034c7819dfbSPeter Maydell 203547ae93cdSMichael Clark #if !defined(TARGET_RISCV64) 203620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 2037c7819dfbSPeter Maydell struct target_stat64 { 2038c7819dfbSPeter Maydell uint64_t st_dev; 2039c7819dfbSPeter Maydell uint64_t st_ino; 2040c7819dfbSPeter Maydell unsigned int st_mode; 2041c7819dfbSPeter Maydell unsigned int st_nlink; 2042c7819dfbSPeter Maydell unsigned int st_uid; 2043c7819dfbSPeter Maydell unsigned int st_gid; 2044c7819dfbSPeter Maydell uint64_t st_rdev; 2045c7819dfbSPeter Maydell uint64_t __pad1; 2046c7819dfbSPeter Maydell int64_t st_size; 2047c7819dfbSPeter Maydell int st_blksize; 2048c7819dfbSPeter Maydell int __pad2; 2049c7819dfbSPeter Maydell int64_t st_blocks; 2050c7819dfbSPeter Maydell int target_st_atime; 2051c7819dfbSPeter Maydell unsigned int target_st_atime_nsec; 2052c7819dfbSPeter Maydell int target_st_mtime; 2053c7819dfbSPeter Maydell unsigned int target_st_mtime_nsec; 2054c7819dfbSPeter Maydell int target_st_ctime; 2055c7819dfbSPeter Maydell unsigned int target_st_ctime_nsec; 2056c7819dfbSPeter Maydell unsigned int __unused4; 2057c7819dfbSPeter Maydell unsigned int __unused5; 2058c7819dfbSPeter Maydell }; 205947ae93cdSMichael Clark #endif 2060c7819dfbSPeter Maydell 2061a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 2062a10d1e50SRichard Henderson 20635f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 2064a10d1e50SRichard Henderson struct target_stat { 2065a10d1e50SRichard Henderson abi_uint st_dev; 2066a10d1e50SRichard Henderson abi_uint st_ino; 2067a10d1e50SRichard Henderson abi_ushort st_mode; 2068a10d1e50SRichard Henderson abi_ushort st_nlink; 2069a10d1e50SRichard Henderson abi_ushort _res1; 2070a10d1e50SRichard Henderson abi_ushort _res2; 2071a10d1e50SRichard Henderson abi_uint st_rdev; 2072a10d1e50SRichard Henderson abi_int st_size; 2073a10d1e50SRichard Henderson abi_int target_st_atime; 2074a10d1e50SRichard Henderson abi_uint target_st_atime_nsec; 2075a10d1e50SRichard Henderson abi_int target_st_mtime; 2076a10d1e50SRichard Henderson abi_uint target_st_mtime_nsec; 2077a10d1e50SRichard Henderson abi_int target_st_ctime; 2078a10d1e50SRichard Henderson abi_uint target_st_ctime_nsec; 2079a10d1e50SRichard Henderson abi_int st_blksize; 2080a10d1e50SRichard Henderson abi_int st_blocks; 2081a10d1e50SRichard Henderson abi_uint _unused1; 2082a10d1e50SRichard Henderson abi_uint _unused2; 2083a10d1e50SRichard Henderson abi_uint _unused3; 2084a10d1e50SRichard Henderson abi_uint _unused4; 2085a10d1e50SRichard Henderson abi_ushort _unused5; 2086a10d1e50SRichard Henderson abi_short st_fstype; 2087a10d1e50SRichard Henderson abi_uint st_realdev; 2088a10d1e50SRichard Henderson abi_ushort st_basemode; 2089a10d1e50SRichard Henderson abi_ushort _unused6; 2090a10d1e50SRichard Henderson abi_uint st_uid; 2091a10d1e50SRichard Henderson abi_uint st_gid; 2092a10d1e50SRichard Henderson abi_uint _unused7[3]; 2093a10d1e50SRichard Henderson }; 2094a10d1e50SRichard Henderson 2095a10d1e50SRichard Henderson #define TARGET_HAS_STRUCT_STAT64 2096a10d1e50SRichard Henderson struct target_stat64 { 2097a10d1e50SRichard Henderson uint64_t st_dev; 2098a10d1e50SRichard Henderson abi_uint _pad1; 2099a10d1e50SRichard Henderson abi_uint _res1; 2100a10d1e50SRichard Henderson abi_uint st_mode; 2101a10d1e50SRichard Henderson abi_uint st_nlink; 2102a10d1e50SRichard Henderson abi_uint st_uid; 2103a10d1e50SRichard Henderson abi_uint st_gid; 2104a10d1e50SRichard Henderson uint64_t st_rdev; 2105a10d1e50SRichard Henderson abi_uint _pad2; 2106a10d1e50SRichard Henderson int64_t st_size; 2107a10d1e50SRichard Henderson abi_int st_blksize; 2108a10d1e50SRichard Henderson int64_t st_blocks; 2109a10d1e50SRichard Henderson abi_int target_st_atime; 2110a10d1e50SRichard Henderson abi_uint target_st_atime_nsec; 2111a10d1e50SRichard Henderson abi_int target_st_mtime; 2112a10d1e50SRichard Henderson abi_uint target_st_mtime_nsec; 2113a10d1e50SRichard Henderson abi_int target_st_ctime; 2114a10d1e50SRichard Henderson abi_uint target_st_ctime_nsec; 2115a10d1e50SRichard Henderson uint64_t st_ino; 2116a10d1e50SRichard Henderson }; 2117a10d1e50SRichard Henderson 2118048f6b4dSbellard #else 2119048f6b4dSbellard #error unsupported CPU 2120048f6b4dSbellard #endif 21212521d698Sbellard 21224ce6f8deSths typedef struct { 21234ce6f8deSths int val[2]; 2124c227f099SAnthony Liguori } target_fsid_t; 21254ce6f8deSths 212656c8f68fSbellard #ifdef TARGET_MIPS 2127d26bc211Sths #ifdef TARGET_ABI_MIPSN32 2128540635baSths struct target_statfs { 2129540635baSths int32_t f_type; 2130540635baSths int32_t f_bsize; 2131540635baSths int32_t f_frsize; /* Fragment size - unsupported */ 2132540635baSths int32_t f_blocks; 2133540635baSths int32_t f_bfree; 2134540635baSths int32_t f_files; 2135540635baSths int32_t f_ffree; 2136540635baSths int32_t f_bavail; 2137540635baSths 2138540635baSths /* Linux specials */ 2139c227f099SAnthony Liguori target_fsid_t f_fsid; 2140540635baSths int32_t f_namelen; 2141d4247ec2SShea Levy int32_t f_flags; 2142d4247ec2SShea Levy int32_t f_spare[5]; 2143540635baSths }; 2144540635baSths #else 214556c8f68fSbellard struct target_statfs { 2146992f48a0Sblueswir1 abi_long f_type; 2147992f48a0Sblueswir1 abi_long f_bsize; 2148992f48a0Sblueswir1 abi_long f_frsize; /* Fragment size - unsupported */ 2149992f48a0Sblueswir1 abi_long f_blocks; 2150992f48a0Sblueswir1 abi_long f_bfree; 2151992f48a0Sblueswir1 abi_long f_files; 2152992f48a0Sblueswir1 abi_long f_ffree; 2153992f48a0Sblueswir1 abi_long f_bavail; 215456c8f68fSbellard 215556c8f68fSbellard /* Linux specials */ 2156c227f099SAnthony Liguori target_fsid_t f_fsid; 2157992f48a0Sblueswir1 abi_long f_namelen; 2158d4247ec2SShea Levy abi_long f_flags; 2159d4247ec2SShea Levy abi_long f_spare[5]; 216056c8f68fSbellard }; 2161540635baSths #endif 216256c8f68fSbellard 216356c8f68fSbellard struct target_statfs64 { 216456c8f68fSbellard uint32_t f_type; 216556c8f68fSbellard uint32_t f_bsize; 216656c8f68fSbellard uint32_t f_frsize; /* Fragment size - unsupported */ 216756c8f68fSbellard uint32_t __pad; 216856c8f68fSbellard uint64_t f_blocks; 216956c8f68fSbellard uint64_t f_bfree; 217056c8f68fSbellard uint64_t f_files; 217156c8f68fSbellard uint64_t f_ffree; 217256c8f68fSbellard uint64_t f_bavail; 2173c227f099SAnthony Liguori target_fsid_t f_fsid; 217456c8f68fSbellard uint32_t f_namelen; 2175d4247ec2SShea Levy uint32_t f_flags; 2176d4247ec2SShea Levy uint32_t f_spare[5]; 217756c8f68fSbellard }; 2178c4d10628Sbalrog #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ 217947ae93cdSMichael Clark defined(TARGET_SPARC64) || defined(TARGET_AARCH64) || \ 218047ae93cdSMichael Clark defined(TARGET_RISCV)) && !defined(TARGET_ABI32) 2181325e651fSj_mayer struct target_statfs { 2182325e651fSj_mayer abi_long f_type; 2183325e651fSj_mayer abi_long f_bsize; 2184325e651fSj_mayer abi_long f_blocks; 2185325e651fSj_mayer abi_long f_bfree; 2186325e651fSj_mayer abi_long f_bavail; 2187325e651fSj_mayer abi_long f_files; 2188325e651fSj_mayer abi_long f_ffree; 2189c227f099SAnthony Liguori target_fsid_t f_fsid; 2190325e651fSj_mayer abi_long f_namelen; 2191325e651fSj_mayer abi_long f_frsize; 2192d4247ec2SShea Levy abi_long f_flags; 2193d4247ec2SShea Levy abi_long f_spare[4]; 2194325e651fSj_mayer }; 2195325e651fSj_mayer 2196325e651fSj_mayer struct target_statfs64 { 2197325e651fSj_mayer abi_long f_type; 2198325e651fSj_mayer abi_long f_bsize; 2199325e651fSj_mayer abi_long f_blocks; 2200325e651fSj_mayer abi_long f_bfree; 2201325e651fSj_mayer abi_long f_bavail; 2202325e651fSj_mayer abi_long f_files; 2203325e651fSj_mayer abi_long f_ffree; 2204c227f099SAnthony Liguori target_fsid_t f_fsid; 2205325e651fSj_mayer abi_long f_namelen; 2206325e651fSj_mayer abi_long f_frsize; 2207d4247ec2SShea Levy abi_long f_flags; 2208d4247ec2SShea Levy abi_long f_spare[4]; 2209325e651fSj_mayer }; 2210a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 2211a4c075f1SUlrich Hecht struct target_statfs { 2212a4c075f1SUlrich Hecht int32_t f_type; 2213a4c075f1SUlrich Hecht int32_t f_bsize; 2214a4c075f1SUlrich Hecht abi_long f_blocks; 2215a4c075f1SUlrich Hecht abi_long f_bfree; 2216a4c075f1SUlrich Hecht abi_long f_bavail; 2217a4c075f1SUlrich Hecht abi_long f_files; 2218a4c075f1SUlrich Hecht abi_long f_ffree; 2219a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2220a4c075f1SUlrich Hecht int32_t f_namelen; 2221a4c075f1SUlrich Hecht int32_t f_frsize; 2222d4247ec2SShea Levy int32_t f_flags; 2223d4247ec2SShea Levy int32_t f_spare[4]; 2224d4247ec2SShea Levy 2225a4c075f1SUlrich Hecht }; 2226a4c075f1SUlrich Hecht 2227a4c075f1SUlrich Hecht struct target_statfs64 { 2228a4c075f1SUlrich Hecht int32_t f_type; 2229a4c075f1SUlrich Hecht int32_t f_bsize; 2230a4c075f1SUlrich Hecht abi_long f_blocks; 2231a4c075f1SUlrich Hecht abi_long f_bfree; 2232a4c075f1SUlrich Hecht abi_long f_bavail; 2233a4c075f1SUlrich Hecht abi_long f_files; 2234a4c075f1SUlrich Hecht abi_long f_ffree; 2235a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2236a4c075f1SUlrich Hecht int32_t f_namelen; 2237a4c075f1SUlrich Hecht int32_t f_frsize; 2238d4247ec2SShea Levy int32_t f_flags; 2239d4247ec2SShea Levy int32_t f_spare[4]; 2240a4c075f1SUlrich Hecht }; 224156c8f68fSbellard #else 224256c8f68fSbellard struct target_statfs { 224356c8f68fSbellard uint32_t f_type; 224456c8f68fSbellard uint32_t f_bsize; 224556c8f68fSbellard uint32_t f_blocks; 224656c8f68fSbellard uint32_t f_bfree; 224756c8f68fSbellard uint32_t f_bavail; 224856c8f68fSbellard uint32_t f_files; 224956c8f68fSbellard uint32_t f_ffree; 2250c227f099SAnthony Liguori target_fsid_t f_fsid; 225156c8f68fSbellard uint32_t f_namelen; 225256c8f68fSbellard uint32_t f_frsize; 2253d4247ec2SShea Levy uint32_t f_flags; 2254d4247ec2SShea Levy uint32_t f_spare[4]; 225556c8f68fSbellard }; 225656c8f68fSbellard 225756c8f68fSbellard struct target_statfs64 { 225856c8f68fSbellard uint32_t f_type; 225956c8f68fSbellard uint32_t f_bsize; 226056c8f68fSbellard uint64_t f_blocks; 226156c8f68fSbellard uint64_t f_bfree; 226256c8f68fSbellard uint64_t f_bavail; 226356c8f68fSbellard uint64_t f_files; 226456c8f68fSbellard uint64_t f_ffree; 2265c227f099SAnthony Liguori target_fsid_t f_fsid; 226656c8f68fSbellard uint32_t f_namelen; 226756c8f68fSbellard uint32_t f_frsize; 2268d4247ec2SShea Levy uint32_t f_flags; 2269d4247ec2SShea Levy uint32_t f_spare[4]; 227056c8f68fSbellard }; 227156c8f68fSbellard #endif 227256c8f68fSbellard 22737e22e546SUlrich Hecht #define TARGET_F_LINUX_SPECIFIC_BASE 1024 22747e22e546SUlrich Hecht #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0) 22757e22e546SUlrich Hecht #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1) 22767e22e546SUlrich Hecht #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) 22777e3b92ecSPeter Maydell #define TARGET_F_SETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 7) 22787e3b92ecSPeter Maydell #define TARGET_F_GETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 8) 22797e22e546SUlrich Hecht #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2) 22807e22e546SUlrich Hecht 22815de7706eSLaurent Vivier #include "target_fcntl.h" 22828d5d3004SAndreas Schwab 22832521d698Sbellard /* soundcard defines */ 228467cc32ebSVeres Lajos /* XXX: convert them all to arch independent entries */ 22852521d698Sbellard #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); 22862521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 22872521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 22882521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 22892521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA 0xc0144302 22902521d698Sbellard #define TARGET_SNDCTL_COPR_RESET 0x00004300 22912521d698Sbellard #define TARGET_SNDCTL_COPR_RUN 0xc0144306 22922521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 22932521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE 0x40144305 22942521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA 0x40144304 22952521d698Sbellard #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) 22962521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) 22972521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) 22982521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) 22992521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) 23002521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) 23012521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) 23022521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) 23032521d698Sbellard #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) 23042521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) 23052521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) 23062521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) 23072521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) 23082521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) 23092521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) 23102521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) 23112521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) 23122521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) 23135f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19) 23145f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20) 23152521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e 23162521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 23172521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 23182521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 23192521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 23202521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f 23212521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 23222521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO 0xc074510c 23232521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 23242521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 23252521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 23262521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 23272521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 23282521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 23292521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 23302521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 23312521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b 23322521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a 23332521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 23342521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC 0x00005111 23352521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 23362521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET 0x00005100 23372521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 23382521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC 0x00005101 23392521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 23402521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d 23412521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d 23422521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 23432521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e 23442521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 23452521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME 0x40045407 23462521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT 0x40045408 23472521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 23482521d698Sbellard #define TARGET_SNDCTL_TMR_START 0x00005402 23492521d698Sbellard #define TARGET_SNDCTL_TMR_STOP 0x00005403 23502521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 23512521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 23522521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE 0x80045002 23532521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 23542521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS 0x80045005 23552521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 23562521d698Sbellard #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) 23572521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 23582521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) 23592521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) 23602521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) 23612521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) 23622521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) 23632521d698Sbellard 23642521d698Sbellard #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) 23652521d698Sbellard 23662521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) 23672521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) 23682521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) 23692521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) 23702521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) 23712521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) 23722521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) 23732521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) 23742521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) 23752521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) 23762521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) 23772521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) 23782521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) 23792521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) 23802521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) 23812521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) 23822521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) 23832521d698Sbellard 23842521d698Sbellard /* Obsolete macros */ 23852521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) 23862521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) 23872521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) 23882521d698Sbellard 23892521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) 23902521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) 23912521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) 23922521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) 23932521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) 23942521d698Sbellard 23952521d698Sbellard #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) 23962521d698Sbellard 23972521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) 23982521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) 23992521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) 24002521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) 24012521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) 24022521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) 24032521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) 24042521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) 24052521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) 24062521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) 24072521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) 24082521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) 24092521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) 24102521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) 24112521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) 24122521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) 24132521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) 24142521d698Sbellard 24152521d698Sbellard /* Obsolete macros */ 24162521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) 24172521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) 24182521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) 24192521d698Sbellard 24202521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) 24212521d698Sbellard 24222521d698Sbellard /* vfat ioctls */ 24232521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) 24242521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) 2425a5448a7dSbellard 2426f443e396SPeter Maydell struct target_mtop { 2427f443e396SPeter Maydell abi_short mt_op; 2428f443e396SPeter Maydell abi_int mt_count; 2429f443e396SPeter Maydell }; 2430f443e396SPeter Maydell 2431f443e396SPeter Maydell #if defined(TARGET_SPARC) || defined(TARGET_MIPS) 2432f443e396SPeter Maydell typedef abi_long target_kernel_daddr_t; 2433f443e396SPeter Maydell #else 2434f443e396SPeter Maydell typedef abi_int target_kernel_daddr_t; 2435f443e396SPeter Maydell #endif 2436f443e396SPeter Maydell 2437f443e396SPeter Maydell struct target_mtget { 2438f443e396SPeter Maydell abi_long mt_type; 2439f443e396SPeter Maydell abi_long mt_resid; 2440f443e396SPeter Maydell abi_long mt_dsreg; 2441f443e396SPeter Maydell abi_long mt_gstat; 2442f443e396SPeter Maydell abi_long mt_erreg; 2443f443e396SPeter Maydell target_kernel_daddr_t mt_fileno; 2444f443e396SPeter Maydell target_kernel_daddr_t mt_blkno; 2445f443e396SPeter Maydell }; 2446f443e396SPeter Maydell 2447f443e396SPeter Maydell struct target_mtpos { 2448f443e396SPeter Maydell abi_long mt_blkno; 2449f443e396SPeter Maydell }; 2450f443e396SPeter Maydell 2451f443e396SPeter Maydell #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct target_mtop) 2452f443e396SPeter Maydell #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct target_mtget) 2453f443e396SPeter Maydell #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct target_mtpos) 24548fbd6b52Sbalrog 2455bd27e675SAleksandar Markovic /* kcov ioctls */ 2456bd27e675SAleksandar Markovic #define TARGET_KCOV_ENABLE TARGET_IO('c', 100) 2457bd27e675SAleksandar Markovic #define TARGET_KCOV_DISABLE TARGET_IO('c', 101) 2458f7dbd8feSAleksandar Markovic #define TARGET_KCOV_INIT_TRACE TARGET_IOR('c', 1, abi_ulong) 2459bd27e675SAleksandar Markovic 2460a5448a7dSbellard struct target_sysinfo { 2461992f48a0Sblueswir1 abi_long uptime; /* Seconds since boot */ 2462992f48a0Sblueswir1 abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */ 2463992f48a0Sblueswir1 abi_ulong totalram; /* Total usable main memory size */ 2464992f48a0Sblueswir1 abi_ulong freeram; /* Available memory size */ 2465992f48a0Sblueswir1 abi_ulong sharedram; /* Amount of shared memory */ 2466992f48a0Sblueswir1 abi_ulong bufferram; /* Memory used by buffers */ 2467992f48a0Sblueswir1 abi_ulong totalswap; /* Total swap space size */ 2468992f48a0Sblueswir1 abi_ulong freeswap; /* swap space still available */ 2469a5448a7dSbellard unsigned short procs; /* Number of current processes */ 2470a5448a7dSbellard unsigned short pad; /* explicit padding for m68k */ 2471992f48a0Sblueswir1 abi_ulong totalhigh; /* Total high memory size */ 2472992f48a0Sblueswir1 abi_ulong freehigh; /* Available high memory size */ 2473a5448a7dSbellard unsigned int mem_unit; /* Memory unit size in bytes */ 2474992f48a0Sblueswir1 char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 2475a5448a7dSbellard }; 24763532fa74Sbellard 24776556a833Saurel32 struct linux_dirent { 24786556a833Saurel32 long d_ino; 24796556a833Saurel32 unsigned long d_off; 24806556a833Saurel32 unsigned short d_reclen; 24816556a833Saurel32 char d_name[256]; /* We must not include limits.h! */ 24826556a833Saurel32 }; 24836556a833Saurel32 24846556a833Saurel32 struct linux_dirent64 { 24856556a833Saurel32 uint64_t d_ino; 24866556a833Saurel32 int64_t d_off; 24876556a833Saurel32 unsigned short d_reclen; 24886556a833Saurel32 unsigned char d_type; 24896556a833Saurel32 char d_name[256]; 24906556a833Saurel32 }; 24916556a833Saurel32 249224e1003aSaurel32 struct target_mq_attr { 249324e1003aSaurel32 abi_long mq_flags; 249424e1003aSaurel32 abi_long mq_maxmsg; 249524e1003aSaurel32 abi_long mq_msgsize; 249624e1003aSaurel32 abi_long mq_curmsgs; 249724e1003aSaurel32 }; 249824e1003aSaurel32 24993532fa74Sbellard #include "socket.h" 2500637947f1Sths 2501637947f1Sths #include "errno_defs.h" 250203dfe9f8SRiku Voipio 250303dfe9f8SRiku Voipio #define FUTEX_WAIT 0 250403dfe9f8SRiku Voipio #define FUTEX_WAKE 1 250503dfe9f8SRiku Voipio #define FUTEX_FD 2 250603dfe9f8SRiku Voipio #define FUTEX_REQUEUE 3 250703dfe9f8SRiku Voipio #define FUTEX_CMP_REQUEUE 4 250803dfe9f8SRiku Voipio #define FUTEX_WAKE_OP 5 250903dfe9f8SRiku Voipio #define FUTEX_LOCK_PI 6 251003dfe9f8SRiku Voipio #define FUTEX_UNLOCK_PI 7 251103dfe9f8SRiku Voipio #define FUTEX_TRYLOCK_PI 8 251203dfe9f8SRiku Voipio #define FUTEX_WAIT_BITSET 9 251303dfe9f8SRiku Voipio #define FUTEX_WAKE_BITSET 10 251403dfe9f8SRiku Voipio 251503dfe9f8SRiku Voipio #define FUTEX_PRIVATE_FLAG 128 251603dfe9f8SRiku Voipio #define FUTEX_CLOCK_REALTIME 256 251703dfe9f8SRiku Voipio #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) 251803dfe9f8SRiku Voipio 25193b6edd16SPeter Maydell #ifdef CONFIG_EPOLL 2520928bed6aSLaurent Vivier #if defined(TARGET_X86_64) 2521928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED QEMU_PACKED 2522928bed6aSLaurent Vivier #else 2523928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED 2524928bed6aSLaurent Vivier #endif 2525928bed6aSLaurent Vivier 25263b6edd16SPeter Maydell typedef union target_epoll_data { 25273b6edd16SPeter Maydell abi_ulong ptr; 2528928bed6aSLaurent Vivier abi_int fd; 2529928bed6aSLaurent Vivier abi_uint u32; 2530928bed6aSLaurent Vivier abi_ullong u64; 25313b6edd16SPeter Maydell } target_epoll_data_t; 25323b6edd16SPeter Maydell 25333b6edd16SPeter Maydell struct target_epoll_event { 2534928bed6aSLaurent Vivier abi_uint events; 25353b6edd16SPeter Maydell target_epoll_data_t data; 2536928bed6aSLaurent Vivier } TARGET_EPOLL_PACKED; 25372ba7fae3SPeter Maydell 25382ba7fae3SPeter Maydell #define TARGET_EP_MAX_EVENTS (INT_MAX / sizeof(struct target_epoll_event)) 25392ba7fae3SPeter Maydell 25403b6edd16SPeter Maydell #endif 2541163a05a8SPeter Maydell struct target_rlimit64 { 2542163a05a8SPeter Maydell uint64_t rlim_cur; 2543163a05a8SPeter Maydell uint64_t rlim_max; 2544163a05a8SPeter Maydell }; 2545583359a6SAkos PASZTORY 2546583359a6SAkos PASZTORY struct target_ucred { 2547583359a6SAkos PASZTORY uint32_t pid; 2548583359a6SAkos PASZTORY uint32_t uid; 2549583359a6SAkos PASZTORY uint32_t gid; 2550583359a6SAkos PASZTORY }; 2551cb9c377fSPaolo Bonzini 2552aecc8861SAlexander Graf typedef int32_t target_timer_t; 2553905bba13SErik de Castro Lopo 255434d60862SNatanael Copa #define TARGET_SIGEV_MAX_SIZE 64 255534d60862SNatanael Copa 255634d60862SNatanael Copa /* This is architecture-specific but most architectures use the default */ 255734d60862SNatanael Copa #ifdef TARGET_MIPS 255834d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long)) 255934d60862SNatanael Copa #else 256034d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ 256134d60862SNatanael Copa + sizeof(target_sigval_t)) 256234d60862SNatanael Copa #endif 256334d60862SNatanael Copa 256434d60862SNatanael Copa #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ 256534d60862SNatanael Copa - TARGET_SIGEV_PREAMBLE_SIZE) \ 256634d60862SNatanael Copa / sizeof(int32_t)) 256734d60862SNatanael Copa 2568905bba13SErik de Castro Lopo struct target_sigevent { 2569905bba13SErik de Castro Lopo target_sigval_t sigev_value; 257017351c3fSPeter Maydell abi_int sigev_signo; 257117351c3fSPeter Maydell abi_int sigev_notify; 2572905bba13SErik de Castro Lopo union { 257317351c3fSPeter Maydell abi_int _pad[TARGET_SIGEV_PAD_SIZE]; 257417351c3fSPeter Maydell abi_int _tid; 2575905bba13SErik de Castro Lopo 257617351c3fSPeter Maydell /* The kernel (and thus QEMU) never looks at these; 257717351c3fSPeter Maydell * they're only used as part of the ABI between a 257817351c3fSPeter Maydell * userspace program and libc. 257917351c3fSPeter Maydell */ 2580905bba13SErik de Castro Lopo struct { 258117351c3fSPeter Maydell abi_ulong _function; 258217351c3fSPeter Maydell abi_ulong _attribute; 2583905bba13SErik de Castro Lopo } _sigev_thread; 2584905bba13SErik de Castro Lopo } _sigev_un; 2585905bba13SErik de Castro Lopo }; 2586e0eb210eSPeter Maydell 2587e0eb210eSPeter Maydell struct target_user_cap_header { 2588e0eb210eSPeter Maydell uint32_t version; 2589e0eb210eSPeter Maydell int pid; 2590e0eb210eSPeter Maydell }; 2591e0eb210eSPeter Maydell 2592e0eb210eSPeter Maydell struct target_user_cap_data { 2593e0eb210eSPeter Maydell uint32_t effective; 2594e0eb210eSPeter Maydell uint32_t permitted; 2595e0eb210eSPeter Maydell uint32_t inheritable; 2596e0eb210eSPeter Maydell }; 25971b3c4fdfSMarkus Armbruster 2598da2c8ad7SAleksandar Markovic /* from kernel's include/linux/syslog.h */ 2599da2c8ad7SAleksandar Markovic 2600da2c8ad7SAleksandar Markovic /* Close the log. Currently a NOP. */ 2601da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CLOSE 0 2602da2c8ad7SAleksandar Markovic /* Open the log. Currently a NOP. */ 2603da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_OPEN 1 2604da2c8ad7SAleksandar Markovic /* Read from the log. */ 2605da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ 2 2606da2c8ad7SAleksandar Markovic /* Read all messages remaining in the ring buffer. */ 2607da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ_ALL 3 2608da2c8ad7SAleksandar Markovic /* Read and clear all messages remaining in the ring buffer */ 2609da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ_CLEAR 4 2610da2c8ad7SAleksandar Markovic /* Clear ring buffer. */ 2611da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CLEAR 5 2612da2c8ad7SAleksandar Markovic /* Disable printk's to console */ 2613da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_OFF 6 2614da2c8ad7SAleksandar Markovic /* Enable printk's to console */ 2615da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_ON 7 2616da2c8ad7SAleksandar Markovic /* Set level of messages printed to console */ 2617da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_LEVEL 8 2618da2c8ad7SAleksandar Markovic /* Return number of unread characters in the log buffer */ 2619da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_SIZE_UNREAD 9 2620da2c8ad7SAleksandar Markovic /* Return size of the log buffer */ 2621da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10 2622da2c8ad7SAleksandar Markovic 2623efa92184SAleksandar Rikalo struct target_statx_timestamp { 2624efa92184SAleksandar Rikalo int64_t tv_sec; 2625efa92184SAleksandar Rikalo uint32_t tv_nsec; 2626efa92184SAleksandar Rikalo int32_t __reserved; 2627efa92184SAleksandar Rikalo }; 2628efa92184SAleksandar Rikalo 2629efa92184SAleksandar Rikalo struct target_statx { 2630efa92184SAleksandar Rikalo /* 0x00 */ 2631efa92184SAleksandar Rikalo uint32_t stx_mask; /* What results were written [uncond] */ 2632efa92184SAleksandar Rikalo uint32_t stx_blksize; /* Preferred general I/O size [uncond] */ 2633efa92184SAleksandar Rikalo uint64_t stx_attributes; /* Flags conveying information about the file */ 2634efa92184SAleksandar Rikalo /* 0x10 */ 2635efa92184SAleksandar Rikalo uint32_t stx_nlink; /* Number of hard links */ 2636efa92184SAleksandar Rikalo uint32_t stx_uid; /* User ID of owner */ 2637efa92184SAleksandar Rikalo uint32_t stx_gid; /* Group ID of owner */ 2638efa92184SAleksandar Rikalo uint16_t stx_mode; /* File mode */ 2639efa92184SAleksandar Rikalo uint16_t __spare0[1]; 2640efa92184SAleksandar Rikalo /* 0x20 */ 2641efa92184SAleksandar Rikalo uint64_t stx_ino; /* Inode number */ 2642efa92184SAleksandar Rikalo uint64_t stx_size; /* File size */ 2643efa92184SAleksandar Rikalo uint64_t stx_blocks; /* Number of 512-byte blocks allocated */ 2644efa92184SAleksandar Rikalo uint64_t stx_attributes_mask; /* Mask to show what is supported */ 2645efa92184SAleksandar Rikalo /* 0x40 */ 2646efa92184SAleksandar Rikalo struct target_statx_timestamp stx_atime; /* Last access time */ 2647efa92184SAleksandar Rikalo struct target_statx_timestamp stx_btime; /* File creation time */ 2648efa92184SAleksandar Rikalo struct target_statx_timestamp stx_ctime; /* Last attribute change time */ 2649efa92184SAleksandar Rikalo struct target_statx_timestamp stx_mtime; /* Last data modification time */ 2650efa92184SAleksandar Rikalo /* 0x80 */ 2651efa92184SAleksandar Rikalo uint32_t stx_rdev_major; /* Device ID of special file [if bdev/cdev] */ 2652efa92184SAleksandar Rikalo uint32_t stx_rdev_minor; 2653efa92184SAleksandar Rikalo uint32_t stx_dev_major; /* ID of device containing file [uncond] */ 2654efa92184SAleksandar Rikalo uint32_t stx_dev_minor; 2655efa92184SAleksandar Rikalo /* 0x90 */ 2656efa92184SAleksandar Rikalo uint64_t __spare2[14]; /* Spare space for future expansion */ 2657efa92184SAleksandar Rikalo /* 0x100 */ 2658efa92184SAleksandar Rikalo }; 2659efa92184SAleksandar Rikalo 26601b3c4fdfSMarkus Armbruster #endif 2661