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 490a7ec849SFilip Bozuta #define TARGET_SEMOPM 500 500a7ec849SFilip Bozuta 512521d698Sbellard /* 522521d698Sbellard * The following is for compatibility across the various Linux 532521d698Sbellard * platforms. The i386 ioctl numbering scheme doesn't really enforce 542521d698Sbellard * a type field. De facto, however, the top 8 bits of the lower 16 552521d698Sbellard * bits are indeed used as a type field, so we might just as well make 562521d698Sbellard * this explicit here. Please be sure to use the decoding macros 572521d698Sbellard * below from now on. 582521d698Sbellard */ 592521d698Sbellard #define TARGET_IOC_NRBITS 8 602521d698Sbellard #define TARGET_IOC_TYPEBITS 8 612521d698Sbellard 62716f3fbeSPeter Maydell #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 63716f3fbeSPeter Maydell || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 64cd98d390SAndreas Schwab || defined(TARGET_SPARC) \ 650c866a7eSRiku Voipio || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) 6674d753acSMika Westerberg /* 16 bit uid wrappers emulation */ 6774d753acSMika Westerberg #define USE_UID16 680c866a7eSRiku Voipio #define target_id uint16_t 690c866a7eSRiku Voipio #else 700c866a7eSRiku Voipio #define target_id uint32_t 7174d753acSMika Westerberg #endif 7274d753acSMika Westerberg 73e6e5906bSpbrook #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ 74b16189b2SChen Gang || defined(TARGET_M68K) || defined(TARGET_CRIS) \ 75daa4374aSPeter Maydell || defined(TARGET_S390X) \ 76a0a839b6SMarek Vasut || defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) \ 77ba7651fbSMax Filippov || defined(TARGET_NIOS2) || defined(TARGET_RISCV) \ 78ba7651fbSMax Filippov || defined(TARGET_XTENSA) 792521d698Sbellard 802521d698Sbellard #define TARGET_IOC_SIZEBITS 14 812521d698Sbellard #define TARGET_IOC_DIRBITS 2 822521d698Sbellard 832521d698Sbellard #define TARGET_IOC_NONE 0U 842521d698Sbellard #define TARGET_IOC_WRITE 1U 852521d698Sbellard #define TARGET_IOC_READ 2U 862521d698Sbellard 87048f6b4dSbellard #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ 88b779e29eSEdgar E. Iglesias defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \ 89b779e29eSEdgar E. Iglesias defined(TARGET_MIPS) 902521d698Sbellard 912521d698Sbellard #define TARGET_IOC_SIZEBITS 13 922521d698Sbellard #define TARGET_IOC_DIRBITS 3 932521d698Sbellard 942521d698Sbellard #define TARGET_IOC_NONE 1U 952521d698Sbellard #define TARGET_IOC_READ 2U 962521d698Sbellard #define TARGET_IOC_WRITE 4U 972521d698Sbellard 98a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 99a10d1e50SRichard Henderson 100a10d1e50SRichard Henderson #define TARGET_IOC_SIZEBITS 14 101a10d1e50SRichard Henderson #define TARGET_IOC_DIRBITS 2 102a10d1e50SRichard Henderson 103a10d1e50SRichard Henderson #define TARGET_IOC_NONE 0U 104a10d1e50SRichard Henderson #define TARGET_IOC_WRITE 2U 105a10d1e50SRichard Henderson #define TARGET_IOC_READ 1U 106a10d1e50SRichard Henderson 1072521d698Sbellard #else 1082521d698Sbellard #error unsupported CPU 1092521d698Sbellard #endif 1102521d698Sbellard 1112521d698Sbellard #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) 1122521d698Sbellard #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) 1132521d698Sbellard #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) 1142521d698Sbellard #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) 1152521d698Sbellard 1162521d698Sbellard #define TARGET_IOC_NRSHIFT 0 1172521d698Sbellard #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) 1182521d698Sbellard #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) 1192521d698Sbellard #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) 1202521d698Sbellard 1212521d698Sbellard #define TARGET_IOC(dir,type,nr,size) \ 1222521d698Sbellard (((dir) << TARGET_IOC_DIRSHIFT) | \ 1232521d698Sbellard ((type) << TARGET_IOC_TYPESHIFT) | \ 1242521d698Sbellard ((nr) << TARGET_IOC_NRSHIFT) | \ 1252521d698Sbellard ((size) << TARGET_IOC_SIZESHIFT)) 1262521d698Sbellard 1272521d698Sbellard /* used to create numbers */ 1282521d698Sbellard #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) 1292521d698Sbellard #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) 1302521d698Sbellard #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1312521d698Sbellard #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1322521d698Sbellard 1332521d698Sbellard /* the size is automatically computed for these defines */ 1342521d698Sbellard #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) 1352521d698Sbellard #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1362521d698Sbellard #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1372521d698Sbellard 1387854b056Sbellard struct target_sockaddr { 1399a68960dSPhilippe Mathieu-Daudé abi_ushort sa_family; 1407854b056Sbellard uint8_t sa_data[14]; 1417854b056Sbellard }; 1427854b056Sbellard 14333a29b51SJoakim Tjernlund struct target_sockaddr_ll { 1449a68960dSPhilippe Mathieu-Daudé abi_ushort sll_family; /* Always AF_PACKET */ 1459a68960dSPhilippe Mathieu-Daudé abi_ushort sll_protocol; /* Physical layer protocol */ 1469a68960dSPhilippe Mathieu-Daudé abi_int sll_ifindex; /* Interface number */ 1479a68960dSPhilippe Mathieu-Daudé abi_ushort sll_hatype; /* ARP hardware type */ 14833a29b51SJoakim Tjernlund uint8_t sll_pkttype; /* Packet type */ 14933a29b51SJoakim Tjernlund uint8_t sll_halen; /* Length of address */ 15033a29b51SJoakim Tjernlund uint8_t sll_addr[8]; /* Physical layer address */ 15133a29b51SJoakim Tjernlund }; 15233a29b51SJoakim Tjernlund 153fb3aabf3SLaurent Vivier struct target_sockaddr_un { 1549a68960dSPhilippe Mathieu-Daudé abi_ushort su_family; 155fb3aabf3SLaurent Vivier uint8_t sun_path[108]; 156fb3aabf3SLaurent Vivier }; 157fb3aabf3SLaurent Vivier 158a47401bcSPhilippe Mathieu-Daudé struct target_sockaddr_nl { 159a47401bcSPhilippe Mathieu-Daudé abi_ushort nl_family; /* AF_NETLINK */ 160a47401bcSPhilippe Mathieu-Daudé abi_ushort __pad; 161a47401bcSPhilippe Mathieu-Daudé abi_uint nl_pid; 162a47401bcSPhilippe Mathieu-Daudé abi_uint nl_groups; 163a47401bcSPhilippe Mathieu-Daudé }; 164a47401bcSPhilippe Mathieu-Daudé 165fb3aabf3SLaurent Vivier struct target_in_addr { 1669a68960dSPhilippe Mathieu-Daudé abi_uint s_addr; /* big endian */ 167fb3aabf3SLaurent Vivier }; 168fb3aabf3SLaurent Vivier 169fb3aabf3SLaurent Vivier struct target_sockaddr_in { 1709a68960dSPhilippe Mathieu-Daudé abi_ushort sin_family; 1719a68960dSPhilippe Mathieu-Daudé abi_short sin_port; /* big endian */ 172fb3aabf3SLaurent Vivier struct target_in_addr sin_addr; 173fb3aabf3SLaurent Vivier uint8_t __pad[sizeof(struct target_sockaddr) - 1749a68960dSPhilippe Mathieu-Daudé sizeof(abi_ushort) - sizeof(abi_short) - 175fb3aabf3SLaurent Vivier sizeof(struct target_in_addr)]; 176fb3aabf3SLaurent Vivier }; 177fb3aabf3SLaurent Vivier 178ee1ac3a1SHelge Deller struct target_sockaddr_in6 { 1799a68960dSPhilippe Mathieu-Daudé abi_ushort sin6_family; 1809a68960dSPhilippe Mathieu-Daudé abi_ushort sin6_port; /* big endian */ 1819a68960dSPhilippe Mathieu-Daudé abi_uint sin6_flowinfo; /* big endian */ 182ee1ac3a1SHelge Deller struct in6_addr sin6_addr; /* IPv6 address, big endian */ 1839a68960dSPhilippe Mathieu-Daudé abi_uint sin6_scope_id; 184ee1ac3a1SHelge Deller }; 185ee1ac3a1SHelge Deller 186f57d4192SLaurent Vivier struct target_sock_filter { 187f57d4192SLaurent Vivier abi_ushort code; 188f57d4192SLaurent Vivier uint8_t jt; 189f57d4192SLaurent Vivier uint8_t jf; 190f57d4192SLaurent Vivier abi_uint k; 191f57d4192SLaurent Vivier }; 192f57d4192SLaurent Vivier 193f57d4192SLaurent Vivier struct target_sock_fprog { 194f57d4192SLaurent Vivier abi_ushort len; 195f57d4192SLaurent Vivier abi_ulong filter; 196f57d4192SLaurent Vivier }; 197f57d4192SLaurent Vivier 198b975b83bSLionel Landwerlin struct target_ip_mreq { 199b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 200b975b83bSLionel Landwerlin struct target_in_addr imr_address; 201b975b83bSLionel Landwerlin }; 202b975b83bSLionel Landwerlin 203b975b83bSLionel Landwerlin struct target_ip_mreqn { 204b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 205b975b83bSLionel Landwerlin struct target_in_addr imr_address; 206b975b83bSLionel Landwerlin abi_long imr_ifindex; 207b975b83bSLionel Landwerlin }; 208b975b83bSLionel Landwerlin 2096e3cb58fSLionel Landwerlin struct target_ip_mreq_source { 2106e3cb58fSLionel Landwerlin /* big endian */ 2116e3cb58fSLionel Landwerlin uint32_t imr_multiaddr; 2126e3cb58fSLionel Landwerlin uint32_t imr_interface; 2136e3cb58fSLionel Landwerlin uint32_t imr_sourceaddr; 2146e3cb58fSLionel Landwerlin }; 2156e3cb58fSLionel Landwerlin 21683eb6e50SCarlo Marcelo Arenas Belón struct target_linger { 21783eb6e50SCarlo Marcelo Arenas Belón abi_int l_onoff; /* Linger active */ 21883eb6e50SCarlo Marcelo Arenas Belón abi_int l_linger; /* How long to linger for */ 21983eb6e50SCarlo Marcelo Arenas Belón }; 22083eb6e50SCarlo Marcelo Arenas Belón 2216d5d5ddeSDaniel P. Berrangé #if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 2226d5d5ddeSDaniel P. Berrangé struct target_timeval { 2236d5d5ddeSDaniel P. Berrangé abi_long tv_sec; 2246d5d5ddeSDaniel P. Berrangé abi_int tv_usec; 2256d5d5ddeSDaniel P. Berrangé }; 2266d5d5ddeSDaniel P. Berrangé #define target__kernel_sock_timeval target_timeval 2276d5d5ddeSDaniel P. Berrangé #else 22831e31b8aSbellard struct target_timeval { 229992f48a0Sblueswir1 abi_long tv_sec; 230992f48a0Sblueswir1 abi_long tv_usec; 23131e31b8aSbellard }; 23231e31b8aSbellard 2336d5d5ddeSDaniel P. Berrangé struct target__kernel_sock_timeval { 2346d5d5ddeSDaniel P. Berrangé abi_llong tv_sec; 2356d5d5ddeSDaniel P. Berrangé abi_llong tv_usec; 2366d5d5ddeSDaniel P. Berrangé }; 2376d5d5ddeSDaniel P. Berrangé #endif 2386d5d5ddeSDaniel P. Berrangé 2391b6b029eSbellard struct target_timespec { 240992f48a0Sblueswir1 abi_long tv_sec; 241992f48a0Sblueswir1 abi_long tv_nsec; 2421b6b029eSbellard }; 2431b6b029eSbellard 2446d5d5ddeSDaniel P. Berrangé struct target__kernel_timespec { 2456d5d5ddeSDaniel P. Berrangé abi_llong tv_sec; 2466d5d5ddeSDaniel P. Berrangé abi_llong tv_nsec; 2476d5d5ddeSDaniel P. Berrangé }; 2486d5d5ddeSDaniel P. Berrangé 249ef4467e9SPaul Burton struct target_timezone { 250ef4467e9SPaul Burton abi_int tz_minuteswest; 251ef4467e9SPaul Burton abi_int tz_dsttime; 252ef4467e9SPaul Burton }; 253ef4467e9SPaul Burton 25466fb9763Sbellard struct target_itimerval { 25566fb9763Sbellard struct target_timeval it_interval; 25666fb9763Sbellard struct target_timeval it_value; 25766fb9763Sbellard }; 25866fb9763Sbellard 259905bba13SErik de Castro Lopo struct target_itimerspec { 260905bba13SErik de Castro Lopo struct target_timespec it_interval; 261905bba13SErik de Castro Lopo struct target_timespec it_value; 262905bba13SErik de Castro Lopo }; 263905bba13SErik de Castro Lopo 264828cb3a1SFilip Bozuta struct target__kernel_itimerspec { 265828cb3a1SFilip Bozuta struct target__kernel_timespec it_interval; 266828cb3a1SFilip Bozuta struct target__kernel_timespec it_value; 267828cb3a1SFilip Bozuta }; 268828cb3a1SFilip Bozuta 26919f59bceSAleksandar Markovic struct target_timex { 27019f59bceSAleksandar Markovic abi_uint modes; /* Mode selector */ 27119f59bceSAleksandar Markovic abi_long offset; /* Time offset */ 27219f59bceSAleksandar Markovic abi_long freq; /* Frequency offset */ 27319f59bceSAleksandar Markovic abi_long maxerror; /* Maximum error (microseconds) */ 27419f59bceSAleksandar Markovic abi_long esterror; /* Estimated error (microseconds) */ 27519f59bceSAleksandar Markovic abi_int status; /* Clock command/status */ 27619f59bceSAleksandar Markovic abi_long constant; /* PLL (phase-locked loop) time constant */ 27719f59bceSAleksandar Markovic abi_long precision; /* Clock precision (microseconds, ro) */ 27819f59bceSAleksandar Markovic abi_long tolerance; /* Clock freq. tolerance (ppm, ro) */ 27919f59bceSAleksandar Markovic struct target_timeval time; /* Current time */ 28019f59bceSAleksandar Markovic abi_long tick; /* Microseconds between clock ticks */ 28119f59bceSAleksandar Markovic abi_long ppsfreq; /* PPS (pulse per second) frequency */ 28219f59bceSAleksandar Markovic abi_long jitter; /* PPS jitter (ro); nanoseconds */ 28319f59bceSAleksandar Markovic abi_int shift; /* PPS interval duration (seconds) */ 28419f59bceSAleksandar Markovic abi_long stabil; /* PPS stability */ 28519f59bceSAleksandar Markovic abi_long jitcnt; /* PPS jitter limit exceeded (ro) */ 28619f59bceSAleksandar Markovic abi_long calcnt; /* PPS calibration intervals */ 28719f59bceSAleksandar Markovic abi_long errcnt; /* PPS calibration errors */ 28819f59bceSAleksandar Markovic abi_long stbcnt; /* PPS stability limit exceeded */ 28919f59bceSAleksandar Markovic abi_int tai; /* TAI offset */ 29019f59bceSAleksandar Markovic 29119f59bceSAleksandar Markovic /* Further padding bytes to allow for future expansion */ 29219f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; abi_int:32; 29319f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; abi_int:32; 29419f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; 29519f59bceSAleksandar Markovic }; 29619f59bceSAleksandar Markovic 2976ac03b2cSFilip Bozuta struct target__kernel_timex { 2986ac03b2cSFilip Bozuta abi_uint modes; /* Mode selector */ 2996ac03b2cSFilip Bozuta abi_int: 32; /* pad */ 3006ac03b2cSFilip Bozuta abi_llong offset; /* Time offset */ 3016ac03b2cSFilip Bozuta abi_llong freq; /* Frequency offset */ 3026ac03b2cSFilip Bozuta abi_llong maxerror; /* Maximum error (microseconds) */ 3036ac03b2cSFilip Bozuta abi_llong esterror; /* Estimated error (microseconds) */ 3046ac03b2cSFilip Bozuta abi_int status; /* Clock command/status */ 3056ac03b2cSFilip Bozuta abi_int: 32; /* pad */ 3066ac03b2cSFilip Bozuta abi_llong constant; /* PLL (phase-locked loop) time constant */ 3076ac03b2cSFilip Bozuta abi_llong precision; /* Clock precision (microseconds, ro) */ 3086ac03b2cSFilip Bozuta abi_llong tolerance; /* Clock freq. tolerance (ppm, ro) */ 3096ac03b2cSFilip Bozuta struct target__kernel_sock_timeval time; /* Current time */ 3106ac03b2cSFilip Bozuta abi_llong tick; /* Microseconds between clock ticks */ 3116ac03b2cSFilip Bozuta abi_llong ppsfreq; /* PPS (pulse per second) frequency */ 3126ac03b2cSFilip Bozuta abi_llong jitter; /* PPS jitter (ro); nanoseconds */ 3136ac03b2cSFilip Bozuta abi_int shift; /* PPS interval duration (seconds) */ 3146ac03b2cSFilip Bozuta abi_int: 32; /* pad */ 3156ac03b2cSFilip Bozuta abi_llong stabil; /* PPS stability */ 3166ac03b2cSFilip Bozuta abi_llong jitcnt; /* PPS jitter limit exceeded (ro) */ 3176ac03b2cSFilip Bozuta abi_llong calcnt; /* PPS calibration intervals */ 3186ac03b2cSFilip Bozuta abi_llong errcnt; /* PPS calibration errors */ 3196ac03b2cSFilip Bozuta abi_llong stbcnt; /* PPS stability limit exceeded */ 3206ac03b2cSFilip Bozuta abi_int tai; /* TAI offset */ 3216ac03b2cSFilip Bozuta 3226ac03b2cSFilip Bozuta /* Further padding bytes to allow for future expansion */ 3236ac03b2cSFilip Bozuta abi_int:32; abi_int:32; abi_int:32; abi_int:32; 3246ac03b2cSFilip Bozuta abi_int:32; abi_int:32; abi_int:32; abi_int:32; 3256ac03b2cSFilip Bozuta abi_int:32; abi_int:32; abi_int:32; 3266ac03b2cSFilip Bozuta }; 3276ac03b2cSFilip Bozuta 328c227f099SAnthony Liguori typedef abi_long target_clock_t; 32932f36bceSbellard 330c596ed17Sbellard #define TARGET_HZ 100 331c596ed17Sbellard 33232f36bceSbellard struct target_tms { 333c227f099SAnthony Liguori target_clock_t tms_utime; 334c227f099SAnthony Liguori target_clock_t tms_stime; 335c227f099SAnthony Liguori target_clock_t tms_cutime; 336c227f099SAnthony Liguori target_clock_t tms_cstime; 33732f36bceSbellard }; 33832f36bceSbellard 3396180a181Sbellard struct target_utimbuf { 340992f48a0Sblueswir1 abi_long actime; 341992f48a0Sblueswir1 abi_long modtime; 3426180a181Sbellard }; 3436180a181Sbellard 344f2674e31Sbellard struct target_sel_arg_struct { 345992f48a0Sblueswir1 abi_long n; 346992f48a0Sblueswir1 abi_long inp, outp, exp; 347992f48a0Sblueswir1 abi_long tvp; 348f2674e31Sbellard }; 349f2674e31Sbellard 35031e31b8aSbellard struct target_iovec { 351992f48a0Sblueswir1 abi_long iov_base; /* Starting address */ 352992f48a0Sblueswir1 abi_long iov_len; /* Number of bytes */ 35331e31b8aSbellard }; 35431e31b8aSbellard 3551a9353d2Sbellard struct target_msghdr { 356992f48a0Sblueswir1 abi_long msg_name; /* Socket name */ 3571a9353d2Sbellard int msg_namelen; /* Length of name */ 358992f48a0Sblueswir1 abi_long msg_iov; /* Data blocks */ 359992f48a0Sblueswir1 abi_long msg_iovlen; /* Number of blocks */ 360992f48a0Sblueswir1 abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ 361992f48a0Sblueswir1 abi_long msg_controllen; /* Length of cmsg list */ 3621a9353d2Sbellard unsigned int msg_flags; 3631a9353d2Sbellard }; 3641a9353d2Sbellard 3657854b056Sbellard struct target_cmsghdr { 366992f48a0Sblueswir1 abi_long cmsg_len; 3677854b056Sbellard int cmsg_level; 3687854b056Sbellard int cmsg_type; 3697854b056Sbellard }; 3707854b056Sbellard 3717854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) 372ee104587SJonathan Neuschäfer #define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \ 373ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start) 374992f48a0Sblueswir1 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ 375992f48a0Sblueswir1 & (size_t) ~(sizeof (abi_long) - 1)) 376ad762b99SPeter Maydell #define TARGET_CMSG_SPACE(len) (sizeof(struct target_cmsghdr) + \ 377ad762b99SPeter Maydell TARGET_CMSG_ALIGN(len)) 378ad762b99SPeter Maydell #define TARGET_CMSG_LEN(len) (sizeof(struct target_cmsghdr) + (len)) 3797854b056Sbellard 3807854b056Sbellard static __inline__ struct target_cmsghdr * 381ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(struct target_msghdr *__mhdr, 382ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg, 383ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg_start) 3847854b056Sbellard { 3852b8bdefcSths struct target_cmsghdr *__ptr; 3867854b056Sbellard 3872b8bdefcSths __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg 388cbb21eedSMatthias Braun + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len))); 389ee104587SJonathan Neuschäfer if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start) 390ee104587SJonathan Neuschäfer > tswapal(__mhdr->msg_controllen)) { 3917854b056Sbellard /* No more entries. */ 3922b8bdefcSths return (struct target_cmsghdr *)0; 393ee104587SJonathan Neuschäfer } 394ee104587SJonathan Neuschäfer return __ptr; 3957854b056Sbellard } 3967854b056Sbellard 397f19e00d7SAlexander Graf struct target_mmsghdr { 398f19e00d7SAlexander Graf struct target_msghdr msg_hdr; /* Message header */ 399f19e00d7SAlexander Graf unsigned int msg_len; /* Number of bytes transmitted */ 400f19e00d7SAlexander Graf }; 4017854b056Sbellard 40231e31b8aSbellard struct target_rusage { 40331e31b8aSbellard struct target_timeval ru_utime; /* user time used */ 40431e31b8aSbellard struct target_timeval ru_stime; /* system time used */ 405992f48a0Sblueswir1 abi_long ru_maxrss; /* maximum resident set size */ 406992f48a0Sblueswir1 abi_long ru_ixrss; /* integral shared memory size */ 407992f48a0Sblueswir1 abi_long ru_idrss; /* integral unshared data size */ 408992f48a0Sblueswir1 abi_long ru_isrss; /* integral unshared stack size */ 409992f48a0Sblueswir1 abi_long ru_minflt; /* page reclaims */ 410992f48a0Sblueswir1 abi_long ru_majflt; /* page faults */ 411992f48a0Sblueswir1 abi_long ru_nswap; /* swaps */ 412992f48a0Sblueswir1 abi_long ru_inblock; /* block input operations */ 413992f48a0Sblueswir1 abi_long ru_oublock; /* block output operations */ 414992f48a0Sblueswir1 abi_long ru_msgsnd; /* messages sent */ 415992f48a0Sblueswir1 abi_long ru_msgrcv; /* messages received */ 416992f48a0Sblueswir1 abi_long ru_nsignals; /* signals received */ 417992f48a0Sblueswir1 abi_long ru_nvcsw; /* voluntary context switches */ 418992f48a0Sblueswir1 abi_long ru_nivcsw; /* involuntary " */ 41931e31b8aSbellard }; 42031e31b8aSbellard 42131e31b8aSbellard typedef struct { 42231e31b8aSbellard int val[2]; 423c227f099SAnthony Liguori } kernel_fsid_t; 42431e31b8aSbellard 425dab2ed99Sbellard struct target_dirent { 426992f48a0Sblueswir1 abi_long d_ino; 427992f48a0Sblueswir1 abi_long d_off; 428dab2ed99Sbellard unsigned short d_reclen; 429333858b7SDmitry V. Levin char d_name[]; 430dab2ed99Sbellard }; 431dab2ed99Sbellard 432dab2ed99Sbellard struct target_dirent64 { 433dab2ed99Sbellard uint64_t d_ino; 434dab2ed99Sbellard int64_t d_off; 435dab2ed99Sbellard unsigned short d_reclen; 436dab2ed99Sbellard unsigned char d_type; 437dab2ed99Sbellard char d_name[256]; 438dab2ed99Sbellard }; 439dab2ed99Sbellard 440dab2ed99Sbellard 44131e31b8aSbellard /* mostly generic signal stuff */ 442992f48a0Sblueswir1 #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ 443992f48a0Sblueswir1 #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ 444992f48a0Sblueswir1 #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ 44531e31b8aSbellard 44631e31b8aSbellard #ifdef TARGET_MIPS 44731e31b8aSbellard #define TARGET_NSIG 128 44831e31b8aSbellard #else 44931e31b8aSbellard #define TARGET_NSIG 64 45031e31b8aSbellard #endif 451992f48a0Sblueswir1 #define TARGET_NSIG_BPW TARGET_ABI_BITS 45231e31b8aSbellard #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) 45331e31b8aSbellard 45431e31b8aSbellard typedef struct { 455992f48a0Sblueswir1 abi_ulong sig[TARGET_NSIG_WORDS]; 456c227f099SAnthony Liguori } target_sigset_t; 45731e31b8aSbellard 45866fb9763Sbellard #ifdef BSWAP_NEEDED 459c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 46066fb9763Sbellard { 46166fb9763Sbellard int i; 46266fb9763Sbellard for(i = 0;i < TARGET_NSIG_WORDS; i++) 463cbb21eedSMatthias Braun d->sig[i] = tswapal(s->sig[i]); 46466fb9763Sbellard } 46566fb9763Sbellard #else 466c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 46766fb9763Sbellard { 46866fb9763Sbellard *d = *s; 46966fb9763Sbellard } 47066fb9763Sbellard #endif 47166fb9763Sbellard 472c227f099SAnthony Liguori static inline void target_siginitset(target_sigset_t *d, abi_ulong set) 47366fb9763Sbellard { 47466fb9763Sbellard int i; 47566fb9763Sbellard d->sig[0] = set; 47666fb9763Sbellard for(i = 1;i < TARGET_NSIG_WORDS; i++) 47766fb9763Sbellard d->sig[i] = 0; 47866fb9763Sbellard } 47966fb9763Sbellard 480c227f099SAnthony Liguori void host_to_target_sigset(target_sigset_t *d, const sigset_t *s); 481c227f099SAnthony Liguori void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); 482992f48a0Sblueswir1 void host_to_target_old_sigset(abi_ulong *old_sigset, 48366fb9763Sbellard const sigset_t *sigset); 48466fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset, 485992f48a0Sblueswir1 const abi_ulong *old_sigset); 48666fb9763Sbellard struct target_sigaction; 48766fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act, 48866fb9763Sbellard struct target_sigaction *oact); 48966fb9763Sbellard 4909850f9f6SLaurent Vivier #include "target_signal.h" 4919850f9f6SLaurent Vivier 4927f047de1SRichard Henderson #ifdef TARGET_SA_RESTORER 4937f047de1SRichard Henderson #define TARGET_ARCH_HAS_SA_RESTORER 1 4947f047de1SRichard Henderson #endif 4957f047de1SRichard Henderson 4966049f4f8SRichard Henderson #if defined(TARGET_ALPHA) 4976049f4f8SRichard Henderson struct target_old_sigaction { 4986049f4f8SRichard Henderson abi_ulong _sa_handler; 4996049f4f8SRichard Henderson abi_ulong sa_mask; 500d2565875SRichard Henderson int32_t sa_flags; 5016049f4f8SRichard Henderson }; 502106ec879Sbellard 5036049f4f8SRichard Henderson struct target_rt_sigaction { 5046049f4f8SRichard Henderson abi_ulong _sa_handler; 5056049f4f8SRichard Henderson abi_ulong sa_flags; 5066049f4f8SRichard Henderson target_sigset_t sa_mask; 5076049f4f8SRichard Henderson }; 5086049f4f8SRichard Henderson 5096049f4f8SRichard Henderson /* This is the struct used inside the kernel. The ka_restorer 5106049f4f8SRichard Henderson field comes from the 5th argument to sys_rt_sigaction. */ 5116049f4f8SRichard Henderson struct target_sigaction { 5126049f4f8SRichard Henderson abi_ulong _sa_handler; 5136049f4f8SRichard Henderson abi_ulong sa_flags; 5146049f4f8SRichard Henderson target_sigset_t sa_mask; 5156049f4f8SRichard Henderson abi_ulong sa_restorer; 5166049f4f8SRichard Henderson }; 5176049f4f8SRichard Henderson #elif defined(TARGET_MIPS) 518106ec879Sbellard struct target_sigaction { 519540635baSths uint32_t sa_flags; 520d26bc211Sths #if defined(TARGET_ABI_MIPSN32) 521540635baSths uint32_t _sa_handler; 522540635baSths #else 523992f48a0Sblueswir1 abi_ulong _sa_handler; 524540635baSths #endif 525c227f099SAnthony Liguori target_sigset_t sa_mask; 5267f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 5277f047de1SRichard Henderson /* ??? This is always present, but ignored unless O32. */ 5287f047de1SRichard Henderson abi_ulong sa_restorer; 5297f047de1SRichard Henderson #endif 530106ec879Sbellard }; 531106ec879Sbellard #else 5322521d698Sbellard struct target_old_sigaction { 533992f48a0Sblueswir1 abi_ulong _sa_handler; 534992f48a0Sblueswir1 abi_ulong sa_mask; 535992f48a0Sblueswir1 abi_ulong sa_flags; 5367f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 537992f48a0Sblueswir1 abi_ulong sa_restorer; 5387f047de1SRichard Henderson #endif 5392521d698Sbellard }; 5402521d698Sbellard 5412521d698Sbellard struct target_sigaction { 542992f48a0Sblueswir1 abi_ulong _sa_handler; 543992f48a0Sblueswir1 abi_ulong sa_flags; 5447f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 545992f48a0Sblueswir1 abi_ulong sa_restorer; 5467f047de1SRichard Henderson #endif 547c227f099SAnthony Liguori target_sigset_t sa_mask; 5485de154e8SLaurent Vivier #ifdef TARGET_ARCH_HAS_KA_RESTORER 5495de154e8SLaurent Vivier abi_ulong ka_restorer; 5505de154e8SLaurent Vivier #endif 5512521d698Sbellard }; 552106ec879Sbellard #endif 5532521d698Sbellard 5542521d698Sbellard typedef union target_sigval { 5552521d698Sbellard int sival_int; 556992f48a0Sblueswir1 abi_ulong sival_ptr; 557c227f099SAnthony Liguori } target_sigval_t; 5586d5e216dSbellard #if 0 5596d5e216dSbellard #if defined (TARGET_SPARC) 5606d5e216dSbellard typedef struct { 5616d5e216dSbellard struct { 562992f48a0Sblueswir1 abi_ulong psr; 563992f48a0Sblueswir1 abi_ulong pc; 564992f48a0Sblueswir1 abi_ulong npc; 565992f48a0Sblueswir1 abi_ulong y; 566992f48a0Sblueswir1 abi_ulong u_regs[16]; /* globals and ins */ 5676d5e216dSbellard } si_regs; 5686d5e216dSbellard int si_mask; 5696d5e216dSbellard } __siginfo_t; 5706d5e216dSbellard 5716d5e216dSbellard typedef struct { 5726d5e216dSbellard unsigned long si_float_regs [32]; 5736d5e216dSbellard unsigned long si_fsr; 5746d5e216dSbellard unsigned long si_fpqdepth; 5756d5e216dSbellard struct { 5766d5e216dSbellard unsigned long *insn_addr; 5776d5e216dSbellard unsigned long insn; 5786d5e216dSbellard } si_fpqueue [16]; 5796d5e216dSbellard } __siginfo_fpu_t; 5806d5e216dSbellard #endif 5816d5e216dSbellard #endif 5822521d698Sbellard 5832521d698Sbellard #define TARGET_SI_MAX_SIZE 128 584aa5e03d2SMaxim Ostapenko 585aa5e03d2SMaxim Ostapenko #if TARGET_ABI_BITS == 32 586aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int)) 587aa5e03d2SMaxim Ostapenko #else 588aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int)) 589aa5e03d2SMaxim Ostapenko #endif 590aa5e03d2SMaxim Ostapenko 591aa5e03d2SMaxim Ostapenko #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int)) 5922521d698Sbellard 593a70dadc7SPeter Maydell /* Within QEMU the top 16 bits of si_code indicate which of the parts of 594a70dadc7SPeter Maydell * the union in target_siginfo is valid. This only applies between 595a70dadc7SPeter Maydell * host_to_target_siginfo_noswap() and tswap_siginfo(); it does not 596a70dadc7SPeter Maydell * appear either within host siginfo_t or in target_siginfo structures 597a70dadc7SPeter Maydell * which we get from the guest userspace program. (The Linux kernel 598a70dadc7SPeter Maydell * does a similar thing with using the top bits for its own internal 599a70dadc7SPeter Maydell * purposes but not letting them be visible to userspace.) 600a70dadc7SPeter Maydell */ 601a70dadc7SPeter Maydell #define QEMU_SI_KILL 0 602a70dadc7SPeter Maydell #define QEMU_SI_TIMER 1 603a70dadc7SPeter Maydell #define QEMU_SI_POLL 2 604a70dadc7SPeter Maydell #define QEMU_SI_FAULT 3 605a70dadc7SPeter Maydell #define QEMU_SI_CHLD 4 606a70dadc7SPeter Maydell #define QEMU_SI_RT 5 607a70dadc7SPeter Maydell 6082521d698Sbellard typedef struct target_siginfo { 6093f53d546Spbrook #ifdef TARGET_MIPS 6103f53d546Spbrook int si_signo; 6113f53d546Spbrook int si_code; 6123f53d546Spbrook int si_errno; 6133f53d546Spbrook #else 6142521d698Sbellard int si_signo; 6152521d698Sbellard int si_errno; 6162521d698Sbellard int si_code; 6173f53d546Spbrook #endif 6182521d698Sbellard 6192521d698Sbellard union { 6202521d698Sbellard int _pad[TARGET_SI_PAD_SIZE]; 6212521d698Sbellard 6222521d698Sbellard /* kill() */ 6232521d698Sbellard struct { 6242521d698Sbellard pid_t _pid; /* sender's pid */ 6252521d698Sbellard uid_t _uid; /* sender's uid */ 6262521d698Sbellard } _kill; 6272521d698Sbellard 6282521d698Sbellard /* POSIX.1b timers */ 6292521d698Sbellard struct { 6302521d698Sbellard unsigned int _timer1; 6312521d698Sbellard unsigned int _timer2; 6322521d698Sbellard } _timer; 6332521d698Sbellard 6342521d698Sbellard /* POSIX.1b signals */ 6352521d698Sbellard struct { 6362521d698Sbellard pid_t _pid; /* sender's pid */ 6372521d698Sbellard uid_t _uid; /* sender's uid */ 638c227f099SAnthony Liguori target_sigval_t _sigval; 6392521d698Sbellard } _rt; 6402521d698Sbellard 6412521d698Sbellard /* SIGCHLD */ 6422521d698Sbellard struct { 6432521d698Sbellard pid_t _pid; /* which child */ 6442521d698Sbellard uid_t _uid; /* sender's uid */ 6452521d698Sbellard int _status; /* exit code */ 646c227f099SAnthony Liguori target_clock_t _utime; 647c227f099SAnthony Liguori target_clock_t _stime; 6482521d698Sbellard } _sigchld; 6492521d698Sbellard 6502521d698Sbellard /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 6512521d698Sbellard struct { 652992f48a0Sblueswir1 abi_ulong _addr; /* faulting insn/memory ref. */ 6532521d698Sbellard } _sigfault; 6542521d698Sbellard 6552521d698Sbellard /* SIGPOLL */ 6562521d698Sbellard struct { 6572521d698Sbellard int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 6582521d698Sbellard int _fd; 6592521d698Sbellard } _sigpoll; 6602521d698Sbellard } _sifields; 661c227f099SAnthony Liguori } target_siginfo_t; 6622521d698Sbellard 6632521d698Sbellard /* 6642521d698Sbellard * si_code values 6652521d698Sbellard * Digital reserves positive values for kernel-generated signals. 6662521d698Sbellard */ 6672521d698Sbellard #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ 6682521d698Sbellard #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 6692521d698Sbellard #define TARGET_SI_QUEUE -1 /* sent by sigqueue */ 6702521d698Sbellard #define TARGET_SI_TIMER -2 /* sent by timer expiration */ 6712521d698Sbellard #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ 6722521d698Sbellard #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ 6732521d698Sbellard #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ 6742521d698Sbellard 6752521d698Sbellard /* 6762521d698Sbellard * SIGILL si_codes 6772521d698Sbellard */ 678ffa65c3bSbellard #define TARGET_ILL_ILLOPC (1) /* illegal opcode */ 6792521d698Sbellard #define TARGET_ILL_ILLOPN (2) /* illegal operand */ 680ffa65c3bSbellard #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ 681ffa65c3bSbellard #define TARGET_ILL_ILLTRP (4) /* illegal trap */ 682ffa65c3bSbellard #define TARGET_ILL_PRVOPC (5) /* privileged opcode */ 683ffa65c3bSbellard #define TARGET_ILL_PRVREG (6) /* privileged register */ 684ffa65c3bSbellard #define TARGET_ILL_COPROC (7) /* coprocessor error */ 685ffa65c3bSbellard #define TARGET_ILL_BADSTK (8) /* internal stack error */ 686de2fdd56SChen Gang #ifdef TARGET_TILEGX 687de2fdd56SChen Gang #define TARGET_ILL_DBLFLT (9) /* double fault */ 688de2fdd56SChen Gang #define TARGET_ILL_HARDWALL (10) /* user networks hardwall violation */ 689de2fdd56SChen Gang #endif 6902521d698Sbellard 6912521d698Sbellard /* 6922521d698Sbellard * SIGFPE si_codes 6932521d698Sbellard */ 6942521d698Sbellard #define TARGET_FPE_INTDIV (1) /* integer divide by zero */ 6952521d698Sbellard #define TARGET_FPE_INTOVF (2) /* integer overflow */ 6962521d698Sbellard #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ 6972521d698Sbellard #define TARGET_FPE_FLTOVF (4) /* floating point overflow */ 6982521d698Sbellard #define TARGET_FPE_FLTUND (5) /* floating point underflow */ 6992521d698Sbellard #define TARGET_FPE_FLTRES (6) /* floating point inexact result */ 7002521d698Sbellard #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ 7012521d698Sbellard #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ 70221ba8564SRichard Henderson #define TARGET_FPE_FLTUNK (14) /* undiagnosed fp exception */ 70321ba8564SRichard Henderson #define TARGET_NSIGFPE 15 7042521d698Sbellard 7052521d698Sbellard /* 7062521d698Sbellard * SIGSEGV si_codes 7072521d698Sbellard */ 7082521d698Sbellard #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ 7092521d698Sbellard #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ 710de2fdd56SChen Gang #define TARGET_SEGV_BNDERR (3) /* failed address bound checks */ 7112521d698Sbellard 7122521d698Sbellard /* 713ffa65c3bSbellard * SIGBUS si_codes 714ffa65c3bSbellard */ 715ffa65c3bSbellard #define TARGET_BUS_ADRALN (1) /* invalid address alignment */ 716b4916d7bSDong Xu Wang #define TARGET_BUS_ADRERR (2) /* non-existent physical address */ 717ffa65c3bSbellard #define TARGET_BUS_OBJERR (3) /* object specific hardware error */ 718de2fdd56SChen Gang /* hardware memory error consumed on a machine check: action required */ 719de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AR (4) 720de2fdd56SChen Gang /* hardware memory error detected in process but not consumed: action optional*/ 721de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AO (5) 722ffa65c3bSbellard 723ffa65c3bSbellard /* 7242521d698Sbellard * SIGTRAP si_codes 7252521d698Sbellard */ 7262521d698Sbellard #define TARGET_TRAP_BRKPT (1) /* process breakpoint */ 7272521d698Sbellard #define TARGET_TRAP_TRACE (2) /* process trace trap */ 728de2fdd56SChen Gang #define TARGET_TRAP_BRANCH (3) /* process taken branch trap */ 729de2fdd56SChen Gang #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */ 7302521d698Sbellard 7319de5e440Sbellard struct target_rlimit { 732992f48a0Sblueswir1 abi_ulong rlim_cur; 733992f48a0Sblueswir1 abi_ulong rlim_max; 7349de5e440Sbellard }; 7359de5e440Sbellard 73681bbe906Stakasi-y@ops.dti.ne.jp #if defined(TARGET_ALPHA) 737e476492eSAurelien Jarno #define TARGET_RLIM_INFINITY 0x7fffffffffffffffull 7386cafd027SMatthias Braun #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32) 73981bbe906Stakasi-y@ops.dti.ne.jp #define TARGET_RLIM_INFINITY 0x7fffffffUL 74081bbe906Stakasi-y@ops.dti.ne.jp #else 74126b746dbSMatthias Braun #define TARGET_RLIM_INFINITY ((abi_ulong)-1) 74281bbe906Stakasi-y@ops.dti.ne.jp #endif 74381bbe906Stakasi-y@ops.dti.ne.jp 744e22b7015SWesley W. Terpstra #if defined(TARGET_MIPS) 745e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 746e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 747e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 748e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 749e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 750e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 7 751e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 8 752e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 5 753e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 9 754e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 6 755e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 756e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 757e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 758e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 759e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 760e22b7015SWesley W. Terpstra #else 761e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 762e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 763e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 764e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 765e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 766e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 5 7676cafd027SMatthias Braun #if defined(TARGET_SPARC) 7686cafd027SMatthias Braun #define TARGET_RLIMIT_NOFILE 6 7696cafd027SMatthias Braun #define TARGET_RLIMIT_NPROC 7 7706cafd027SMatthias Braun #else 771e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 6 772e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 7 7736cafd027SMatthias Braun #endif 774e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 8 775e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 9 776e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 777e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 778e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 779e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 780e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 781e22b7015SWesley W. Terpstra #endif 782e22b7015SWesley W. Terpstra 7839de5e440Sbellard struct target_pollfd { 7849de5e440Sbellard int fd; /* file descriptor */ 7859de5e440Sbellard short events; /* requested events */ 7869de5e440Sbellard short revents; /* returned events */ 7879de5e440Sbellard }; 7889de5e440Sbellard 7898e5a0667Sbellard /* virtual terminal ioctls */ 7900221cfcdSbellard #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ 7910221cfcdSbellard #define TARGET_KDMKTONE 0x4B30 /* generate tone */ 7928e5a0667Sbellard #define TARGET_KDGKBTYPE 0x4b33 793f7680a55SUlrich Hecht #define TARGET_KDSETMODE 0x4b3a 794f7680a55SUlrich Hecht #define TARGET_KDGKBMODE 0x4b44 795f7680a55SUlrich Hecht #define TARGET_KDSKBMODE 0x4b45 7960221cfcdSbellard #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ 7970221cfcdSbellard #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ 798e6fe18fbSCédric VINCENT #define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ 799e6fe18fbSCédric VINCENT #define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ 800e6fe18fbSCédric VINCENT #define TARGET_KDGETLED 0x4B31 /* return current led state */ 801e6fe18fbSCédric VINCENT #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */ 802ca56f5b5SPaul Burton #define TARGET_KDSIGACCEPT 0x4B4E 8038e5a0667Sbellard 804373b067fSFilip Bozuta struct target_rtc_pll_info { 805373b067fSFilip Bozuta int pll_ctrl; 806373b067fSFilip Bozuta int pll_value; 807373b067fSFilip Bozuta int pll_max; 808373b067fSFilip Bozuta int pll_min; 809373b067fSFilip Bozuta int pll_posmult; 810373b067fSFilip Bozuta int pll_negmult; 811373b067fSFilip Bozuta abi_long pll_clock; 812373b067fSFilip Bozuta }; 813373b067fSFilip Bozuta 81468365f96SFilip Bozuta /* real time clock ioctls */ 81568365f96SFilip Bozuta #define TARGET_RTC_AIE_ON TARGET_IO('p', 0x01) 81668365f96SFilip Bozuta #define TARGET_RTC_AIE_OFF TARGET_IO('p', 0x02) 81768365f96SFilip Bozuta #define TARGET_RTC_UIE_ON TARGET_IO('p', 0x03) 81868365f96SFilip Bozuta #define TARGET_RTC_UIE_OFF TARGET_IO('p', 0x04) 81968365f96SFilip Bozuta #define TARGET_RTC_PIE_ON TARGET_IO('p', 0x05) 82068365f96SFilip Bozuta #define TARGET_RTC_PIE_OFF TARGET_IO('p', 0x06) 82168365f96SFilip Bozuta #define TARGET_RTC_WIE_ON TARGET_IO('p', 0x0f) 82268365f96SFilip Bozuta #define TARGET_RTC_WIE_OFF TARGET_IO('p', 0x10) 823178b14a0SFilip Bozuta #define TARGET_RTC_ALM_READ TARGET_IOR('p', 0x08, struct rtc_time) 824178b14a0SFilip Bozuta #define TARGET_RTC_ALM_SET TARGET_IOW('p', 0x07, struct rtc_time) 825178b14a0SFilip Bozuta #define TARGET_RTC_RD_TIME TARGET_IOR('p', 0x09, struct rtc_time) 826178b14a0SFilip Bozuta #define TARGET_RTC_SET_TIME TARGET_IOW('p', 0x0a, struct rtc_time) 827fa857eb5SFilip Bozuta #define TARGET_RTC_IRQP_READ TARGET_IOR('p', 0x0b, abi_ulong) 828fa857eb5SFilip Bozuta #define TARGET_RTC_IRQP_SET TARGET_IOW('p', 0x0c, abi_ulong) 829fa857eb5SFilip Bozuta #define TARGET_RTC_EPOCH_READ TARGET_IOR('p', 0x0d, abi_ulong) 830fa857eb5SFilip Bozuta #define TARGET_RTC_EPOCH_SET TARGET_IOW('p', 0x0e, abi_ulong) 831abc81bf6SFilip Bozuta #define TARGET_RTC_WKALM_RD TARGET_IOR('p', 0x10, struct rtc_wkalrm) 832abc81bf6SFilip Bozuta #define TARGET_RTC_WKALM_SET TARGET_IOW('p', 0x0f, struct rtc_wkalrm) 833373b067fSFilip Bozuta #define TARGET_RTC_PLL_GET TARGET_IOR('p', 0x11, \ 834373b067fSFilip Bozuta struct target_rtc_pll_info) 835373b067fSFilip Bozuta #define TARGET_RTC_PLL_SET TARGET_IOW('p', 0x12, \ 836373b067fSFilip Bozuta struct target_rtc_pll_info) 837a7b09746SFilip Bozuta #define TARGET_RTC_VL_READ TARGET_IOR('p', 0x13, int) 838a7b09746SFilip Bozuta #define TARGET_RTC_VL_CLR TARGET_IO('p', 0x14) 83968365f96SFilip Bozuta 840d14eabbeSAleksandar Markovic #if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) || \ 841d14eabbeSAleksandar Markovic defined(TARGET_XTENSA) 8424e4b173fSAleksandar Markovic #define TARGET_FIOGETOWN TARGET_IOR('f', 123, int) 8434e4b173fSAleksandar Markovic #define TARGET_FIOSETOWN TARGET_IOW('f', 124, int) 844e1be1606SAleksandar Markovic #define TARGET_SIOCATMARK TARGET_IOR('s', 7, int) 845c495a793SAleksandar Markovic #define TARGET_SIOCSPGRP TARGET_IOW('s', 8, pid_t) 846405b4915SHelge Deller #define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t) 847e1be1606SAleksandar Markovic #else 8484e4b173fSAleksandar Markovic #define TARGET_FIOGETOWN 0x8903 8494e4b173fSAleksandar Markovic #define TARGET_FIOSETOWN 0x8901 8502521d698Sbellard #define TARGET_SIOCATMARK 0x8905 851c495a793SAleksandar Markovic #define TARGET_SIOCSPGRP 0x8902 852405b4915SHelge Deller #define TARGET_SIOCGPGRP 0x8904 853e1be1606SAleksandar Markovic #endif 854c495a793SAleksandar Markovic 8556d5d5ddeSDaniel P. Berrangé #if defined(TARGET_SH4) 8566d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMP_OLD TARGET_IOR('s', 100, struct target_timeval) 8576d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMPNS_OLD TARGET_IOR('s', 101, struct target_timespec) 8586d5d5ddeSDaniel P. Berrangé #else 8596d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMP_OLD 0x8906 8606d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMPNS_OLD 0x8907 8616d5d5ddeSDaniel P. Berrangé #endif 8626d5d5ddeSDaniel P. Berrangé 8636d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMP_NEW TARGET_IOR(0x89, 0x06, abi_llong[2]) 8646d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMPNS_NEW TARGET_IOR(0x89, 0x07, abi_llong[2]) 8652521d698Sbellard 86631e31b8aSbellard /* Networking ioctls */ 86731e31b8aSbellard #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ 86831e31b8aSbellard #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ 86931e31b8aSbellard #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ 87031e31b8aSbellard #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ 87131e31b8aSbellard #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ 87231e31b8aSbellard #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ 87331e31b8aSbellard #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ 87431e31b8aSbellard #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ 87531e31b8aSbellard #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ 87631e31b8aSbellard #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ 87731e31b8aSbellard #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ 87831e31b8aSbellard #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ 87931e31b8aSbellard #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ 88031e31b8aSbellard #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ 88131e31b8aSbellard #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ 88231e31b8aSbellard #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ 88331e31b8aSbellard #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ 88431e31b8aSbellard #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ 88531e31b8aSbellard #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ 88631e31b8aSbellard #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ 88731e31b8aSbellard #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ 88831e31b8aSbellard #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ 88931e31b8aSbellard #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ 89031e31b8aSbellard #define TARGET_SIOCSIFENCAP 0x8926 89131e31b8aSbellard #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ 89231e31b8aSbellard #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ 89331e31b8aSbellard #define TARGET_SIOCSIFSLAVE 0x8930 89431e31b8aSbellard #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ 89531e31b8aSbellard #define TARGET_SIOCDELMULTI 0x8932 896f63eb01aSPaul Burton #define TARGET_SIOCGIFINDEX 0x8933 8974bdcd79eSNeng Chen #define TARGET_SIOCSIFPFLAGS 0x8934 /* set extended flags */ 8984bdcd79eSNeng Chen #define TARGET_SIOCGIFPFLAGS 0x8935 /* get extended flags */ 89931e31b8aSbellard 90031e31b8aSbellard /* Bridging control calls */ 90131e31b8aSbellard #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ 90231e31b8aSbellard #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ 90331e31b8aSbellard 90431e31b8aSbellard #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ 90531e31b8aSbellard #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ 90631e31b8aSbellard 90731e31b8aSbellard /* ARP cache control calls. */ 90831e31b8aSbellard #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ 90931e31b8aSbellard #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ 91031e31b8aSbellard #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ 91131e31b8aSbellard #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ 91231e31b8aSbellard #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ 91331e31b8aSbellard #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ 91431e31b8aSbellard 91531e31b8aSbellard /* RARP cache control calls. */ 91631e31b8aSbellard #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ 91731e31b8aSbellard #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ 91831e31b8aSbellard #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ 91931e31b8aSbellard 92031e31b8aSbellard /* Driver configuration calls */ 92131e31b8aSbellard #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ 92231e31b8aSbellard #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ 92331e31b8aSbellard 92431e31b8aSbellard /* DLCI configuration calls */ 92531e31b8aSbellard #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ 92631e31b8aSbellard #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ 92731e31b8aSbellard 92886fcd946SLaurent Vivier /* From <linux/wireless.h> */ 92986fcd946SLaurent Vivier 93086fcd946SLaurent Vivier #define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ 93131e31b8aSbellard 932d6d6d6feSMarco A L Barbosa /* From <linux/random.h> */ 933d6d6d6feSMarco A L Barbosa 934d6d6d6feSMarco A L Barbosa #define TARGET_RNDGETENTCNT TARGET_IOR('R', 0x00, int) 935d6d6d6feSMarco A L Barbosa #define TARGET_RNDADDTOENTCNT TARGET_IOW('R', 0x01, int) 936d6d6d6feSMarco A L Barbosa #define TARGET_RNDZAPENTCNT TARGET_IO('R', 0x04) 937d6d6d6feSMarco A L Barbosa #define TARGET_RNDCLEARPOOL TARGET_IO('R', 0x06) 93892c096f0SAleksandar Markovic #define TARGET_RNDRESEEDCRNG TARGET_IO('R', 0x07) 939d6d6d6feSMarco A L Barbosa 94031e31b8aSbellard /* From <linux/fs.h> */ 94131e31b8aSbellard 94231e31b8aSbellard #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ 94331e31b8aSbellard #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ 94431e31b8aSbellard #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ 94531e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ 94631e31b8aSbellard #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ 94731e31b8aSbellard #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ 94831e31b8aSbellard #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ 94931e31b8aSbellard #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ 95031e31b8aSbellard #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ 95131e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ 95231e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ 95331e31b8aSbellard #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ 954fff8c539SAndreas Färber #define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */ 95531e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */ 956c8b0bf54SPeter Maydell #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong) 957c8b0bf54SPeter Maydell #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong) 958edafea13SAlexander Graf #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) 959edafea13SAlexander Graf /* return device size in bytes 960edafea13SAlexander Graf (u64 *arg) */ 9614715856aSPeter Maydell 9624715856aSPeter Maydell #define TARGET_BLKDISCARD TARGET_IO(0x12, 119) 9634715856aSPeter Maydell #define TARGET_BLKIOMIN TARGET_IO(0x12, 120) 9644715856aSPeter Maydell #define TARGET_BLKIOOPT TARGET_IO(0x12, 121) 9654715856aSPeter Maydell #define TARGET_BLKALIGNOFF TARGET_IO(0x12, 122) 9664715856aSPeter Maydell #define TARGET_BLKPBSZGET TARGET_IO(0x12, 123) 9674715856aSPeter Maydell #define TARGET_BLKDISCARDZEROES TARGET_IO(0x12, 124) 9684715856aSPeter Maydell #define TARGET_BLKSECDISCARD TARGET_IO(0x12, 125) 9694715856aSPeter Maydell #define TARGET_BLKROTATIONAL TARGET_IO(0x12, 126) 9704715856aSPeter Maydell #define TARGET_BLKZEROOUT TARGET_IO(0x12, 127) 9714715856aSPeter Maydell 972ab22b4ddSYunqiang Su /* From <linux/fd.h> */ 973ab22b4ddSYunqiang Su 9747e35fc8bSAleksandar Markovic #define TARGET_FDMSGON TARGET_IO(2, 0x45) 9757e35fc8bSAleksandar Markovic #define TARGET_FDMSGOFF TARGET_IO(2, 0x46) 97608e3ce59SAleksandar Markovic #define TARGET_FDFMTBEG TARGET_IO(2, 0x47) 97708e3ce59SAleksandar Markovic #define TARGET_FDFMTTRK TARGET_IOW(2, 0x48, struct format_descr) 97808e3ce59SAleksandar Markovic #define TARGET_FDFMTEND TARGET_IO(2, 0x49) 97981eb1a36SAleksandar Markovic #define TARGET_FDSETEMSGTRESH TARGET_IO(2, 0x4a) 980ab22b4ddSYunqiang Su #define TARGET_FDFLUSH TARGET_IO(2, 0x4b) 98181eb1a36SAleksandar Markovic #define TARGET_FDSETMAXERRS TARGET_IOW(2, 0x4c, struct floppy_max_errors) 98281eb1a36SAleksandar Markovic #define TARGET_FDGETMAXERRS TARGET_IOR(2, 0x0e, struct floppy_max_errors) 9835eea9429SAleksandar Markovic #define TARGET_FDRESET TARGET_IO(2, 0x54) 9845eea9429SAleksandar Markovic #define TARGET_FDRAWCMD TARGET_IO(2, 0x58) 9855eea9429SAleksandar Markovic #define TARGET_FDTWADDLE TARGET_IO(2, 0x59) 9865eea9429SAleksandar Markovic #define TARGET_FDEJECT TARGET_IO(2, 0x5a) 987ab22b4ddSYunqiang Su 98831e31b8aSbellard #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ 98931e31b8aSbellard #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ 99021992cb6SHelge Deller 99121992cb6SHelge Deller #define TARGET_FICLONE TARGET_IOW(0x94, 9, int) 99221992cb6SHelge Deller #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range) 99321992cb6SHelge Deller 9945ae774a9SAleksandar Markovic /* 9955ae774a9SAleksandar Markovic * Note that the ioctl numbers for FS_IOC_<GET|SET><FLAGS|VERSION> 9965ae774a9SAleksandar Markovic * claim type "long" but the actual type used by the kernel is "int". 99760807231SPeter Maydell */ 9981847b7baSPeter Maydell #define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, abi_long) 9991847b7baSPeter Maydell #define TARGET_FS_IOC_SETFLAGS TARGET_IOW('f', 2, abi_long) 10005ae774a9SAleksandar Markovic #define TARGET_FS_IOC_GETVERSION TARGET_IOR('v', 1, abi_long) 10015ae774a9SAleksandar Markovic #define TARGET_FS_IOC_SETVERSION TARGET_IOW('v', 2, abi_long) 1002285da2b9SPeter Maydell #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) 10030b471ba6SAleksandar Markovic #define TARGET_FS_IOC32_GETFLAGS TARGET_IOR('f', 1, int) 10040b471ba6SAleksandar Markovic #define TARGET_FS_IOC32_SETFLAGS TARGET_IOW('f', 2, int) 10050d899cd6SAleksandar Markovic #define TARGET_FS_IOC32_GETVERSION TARGET_IOR('v', 1, int) 10060d899cd6SAleksandar Markovic #define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, int) 100731e31b8aSbellard 1008d6092e08SFilip Bozuta /* btrfs ioctls */ 1009*48f670ecSThomas Huth #ifdef HAVE_BTRFS_H 1010527e8d8fSFilip Bozuta #define TARGET_BTRFS_IOC_SNAP_CREATE TARGET_IOWU(BTRFS_IOCTL_MAGIC, 1) 10119bbd60e7SFilip Bozuta #define TARGET_BTRFS_IOC_SCAN_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 4) 10129bbd60e7SFilip Bozuta #define TARGET_BTRFS_IOC_FORGET_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 5) 10139bbd60e7SFilip Bozuta #define TARGET_BTRFS_IOC_ADD_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 10) 10149bbd60e7SFilip Bozuta #define TARGET_BTRFS_IOC_RM_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 11) 1015d6092e08SFilip Bozuta #define TARGET_BTRFS_IOC_SUBVOL_CREATE TARGET_IOWU(BTRFS_IOCTL_MAGIC, 14) 1016527e8d8fSFilip Bozuta #define TARGET_BTRFS_IOC_SNAP_DESTROY TARGET_IOWU(BTRFS_IOCTL_MAGIC, 15) 10170ff496a0SFilip Bozuta #define TARGET_BTRFS_IOC_INO_LOOKUP TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 18) 1018784c08c8SFilip Bozuta #define TARGET_BTRFS_IOC_DEFAULT_SUBVOL TARGET_IOW(BTRFS_IOCTL_MAGIC, 19,\ 1019784c08c8SFilip Bozuta abi_ullong) 1020d6092e08SFilip Bozuta #define TARGET_BTRFS_IOC_SUBVOL_GETFLAGS TARGET_IOR(BTRFS_IOCTL_MAGIC, 25,\ 1021d6092e08SFilip Bozuta abi_ullong) 1022d6092e08SFilip Bozuta #define TARGET_BTRFS_IOC_SUBVOL_SETFLAGS TARGET_IOW(BTRFS_IOCTL_MAGIC, 26,\ 1023d6092e08SFilip Bozuta abi_ullong) 10249a5a5a05SFilip Bozuta #define TARGET_BTRFS_IOC_SCRUB TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 27) 10259a5a5a05SFilip Bozuta #define TARGET_BTRFS_IOC_SCRUB_CANCEL TARGET_IO(BTRFS_IOCTL_MAGIC, 28) 10269a5a5a05SFilip Bozuta #define TARGET_BTRFS_IOC_SCRUB_PROGRESS TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 29) 10279bbd60e7SFilip Bozuta #define TARGET_BTRFS_IOC_DEV_INFO TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 30) 10280ff496a0SFilip Bozuta #define TARGET_BTRFS_IOC_INO_PATHS TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 35) 10290ff496a0SFilip Bozuta #define TARGET_BTRFS_IOC_LOGICAL_INO TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 36) 103053906f68SFilip Bozuta #define TARGET_BTRFS_IOC_QUOTA_CTL TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 40) 103153906f68SFilip Bozuta #define TARGET_BTRFS_IOC_QGROUP_ASSIGN TARGET_IOWU(BTRFS_IOCTL_MAGIC, 41) 103253906f68SFilip Bozuta #define TARGET_BTRFS_IOC_QGROUP_CREATE TARGET_IOWU(BTRFS_IOCTL_MAGIC, 42) 103353906f68SFilip Bozuta #define TARGET_BTRFS_IOC_QGROUP_LIMIT TARGET_IORU(BTRFS_IOCTL_MAGIC, 43) 103453906f68SFilip Bozuta #define TARGET_BTRFS_IOC_QUOTA_RESCAN TARGET_IOWU(BTRFS_IOCTL_MAGIC, 44) 103553906f68SFilip Bozuta #define TARGET_BTRFS_IOC_QUOTA_RESCAN_STATUS TARGET_IORU(BTRFS_IOCTL_MAGIC, 45) 103653906f68SFilip Bozuta #define TARGET_BTRFS_IOC_QUOTA_RESCAN_WAIT TARGET_IO(BTRFS_IOCTL_MAGIC, 46) 10379bbd60e7SFilip Bozuta #define TARGET_BTRFS_IOC_GET_DEV_STATS TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 52) 103849b422a8SFilip Bozuta #define TARGET_BTRFS_IOC_GET_FEATURES TARGET_IORU(BTRFS_IOCTL_MAGIC, 57) 103949b422a8SFilip Bozuta #define TARGET_BTRFS_IOC_SET_FEATURES TARGET_IOWU(BTRFS_IOCTL_MAGIC, 57) 104049b422a8SFilip Bozuta #define TARGET_BTRFS_IOC_GET_SUPPORTED_FEATURES TARGET_IORU(BTRFS_IOCTL_MAGIC, 57) 10410ff496a0SFilip Bozuta #define TARGET_BTRFS_IOC_LOGICAL_INO_V2 TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 59) 1042d6092e08SFilip Bozuta #define TARGET_BTRFS_IOC_GET_SUBVOL_INFO TARGET_IORU(BTRFS_IOCTL_MAGIC, 60) 1043784c08c8SFilip Bozuta #define TARGET_BTRFS_IOC_GET_SUBVOL_ROOTREF TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 61) 10440ff496a0SFilip Bozuta #define TARGET_BTRFS_IOC_INO_LOOKUP_USER TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 62) 10455d5d1752SFilip Bozuta #endif 1046d6092e08SFilip Bozuta 10476c753a63SCortland Tölva /* usb ioctls */ 10486c753a63SCortland Tölva #define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0) 10496c753a63SCortland Tölva #define TARGET_USBDEVFS_BULK TARGET_IOWRU('U', 2) 10506c753a63SCortland Tölva #define TARGET_USBDEVFS_RESETEP TARGET_IORU('U', 3) 10516c753a63SCortland Tölva #define TARGET_USBDEVFS_SETINTERFACE TARGET_IORU('U', 4) 10526c753a63SCortland Tölva #define TARGET_USBDEVFS_SETCONFIGURATION TARGET_IORU('U', 5) 10536c753a63SCortland Tölva #define TARGET_USBDEVFS_GETDRIVER TARGET_IOWU('U', 8) 1054a133367eSCortland Tölva #define TARGET_USBDEVFS_SUBMITURB TARGET_IORU('U', 10) 1055a133367eSCortland Tölva #define TARGET_USBDEVFS_DISCARDURB TARGET_IO('U', 11) 1056a133367eSCortland Tölva #define TARGET_USBDEVFS_REAPURB TARGET_IOWU('U', 12) 1057a133367eSCortland Tölva #define TARGET_USBDEVFS_REAPURBNDELAY TARGET_IOWU('U', 13) 10586c753a63SCortland Tölva #define TARGET_USBDEVFS_DISCSIGNAL TARGET_IORU('U', 14) 10596c753a63SCortland Tölva #define TARGET_USBDEVFS_CLAIMINTERFACE TARGET_IORU('U', 15) 10606c753a63SCortland Tölva #define TARGET_USBDEVFS_RELEASEINTERFACE TARGET_IORU('U', 16) 10616c753a63SCortland Tölva #define TARGET_USBDEVFS_CONNECTINFO TARGET_IOWU('U', 17) 10626c753a63SCortland Tölva #define TARGET_USBDEVFS_IOCTL TARGET_IOWRU('U', 18) 10636c753a63SCortland Tölva #define TARGET_USBDEVFS_HUB_PORTINFO TARGET_IORU('U', 19) 10646c753a63SCortland Tölva #define TARGET_USBDEVFS_RESET TARGET_IO('U', 20) 10656c753a63SCortland Tölva #define TARGET_USBDEVFS_CLEAR_HALT TARGET_IORU('U', 21) 10666c753a63SCortland Tölva #define TARGET_USBDEVFS_DISCONNECT TARGET_IO('U', 22) 10676c753a63SCortland Tölva #define TARGET_USBDEVFS_CONNECT TARGET_IO('U', 23) 10686c753a63SCortland Tölva #define TARGET_USBDEVFS_CLAIM_PORT TARGET_IORU('U', 24) 10696c753a63SCortland Tölva #define TARGET_USBDEVFS_RELEASE_PORT TARGET_IORU('U', 25) 10706c753a63SCortland Tölva #define TARGET_USBDEVFS_GET_CAPABILITIES TARGET_IORU('U', 26) 10716c753a63SCortland Tölva #define TARGET_USBDEVFS_DISCONNECT_CLAIM TARGET_IORU('U', 27) 10726c753a63SCortland Tölva #define TARGET_USBDEVFS_DROP_PRIVILEGES TARGET_IOWU('U', 30) 10736c753a63SCortland Tölva #define TARGET_USBDEVFS_GET_SPEED TARGET_IO('U', 31) 10746c753a63SCortland Tölva 107531e31b8aSbellard /* cdrom commands */ 107631e31b8aSbellard #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ 107731e31b8aSbellard #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ 107831e31b8aSbellard #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ 107931e31b8aSbellard #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index 108031e31b8aSbellard (struct cdrom_ti) */ 108131e31b8aSbellard #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header 108231e31b8aSbellard (struct cdrom_tochdr) */ 108331e31b8aSbellard #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry 108431e31b8aSbellard (struct cdrom_tocentry) */ 108531e31b8aSbellard #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ 108631e31b8aSbellard #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ 108731e31b8aSbellard #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ 108831e31b8aSbellard #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume 108931e31b8aSbellard (struct cdrom_volctrl) */ 109031e31b8aSbellard #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data 109131e31b8aSbellard (struct cdrom_subchnl) */ 109231e31b8aSbellard #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) 109331e31b8aSbellard (struct cdrom_read) */ 109431e31b8aSbellard #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) 109531e31b8aSbellard (struct cdrom_read) */ 109631e31b8aSbellard #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ 109731e31b8aSbellard #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ 109831e31b8aSbellard #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session 109931e31b8aSbellard address of multi session disks 110031e31b8aSbellard (struct cdrom_multisession) */ 110131e31b8aSbellard #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" 110231e31b8aSbellard if available (struct cdrom_mcn) */ 110367cc32ebSVeres Lajos #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is deprecated, 1104b4916d7bSDong Xu Wang but here anyway for compatibility */ 110531e31b8aSbellard #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ 110631e31b8aSbellard #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting 110731e31b8aSbellard (struct cdrom_volctrl) */ 110831e31b8aSbellard #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) 110931e31b8aSbellard (struct cdrom_read) */ 111031e31b8aSbellard /* 111131e31b8aSbellard * These ioctls are used only used in aztcd.c and optcd.c 111231e31b8aSbellard */ 111331e31b8aSbellard #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ 111431e31b8aSbellard #define TARGET_CDROMSEEK 0x5316 /* seek msf address */ 111531e31b8aSbellard 111631e31b8aSbellard /* 111731e31b8aSbellard * This ioctl is only used by the scsi-cd driver. 111831e31b8aSbellard It is for playing audio in logical block addressing mode. 111931e31b8aSbellard */ 112031e31b8aSbellard #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ 112131e31b8aSbellard 112231e31b8aSbellard /* 112331e31b8aSbellard * These ioctls are only used in optcd.c 112431e31b8aSbellard */ 112531e31b8aSbellard #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ 112631e31b8aSbellard 112731e31b8aSbellard /* 112831e31b8aSbellard * These ioctls are (now) only in ide-cd.c for controlling 112931e31b8aSbellard * drive spindown time. They should be implemented in the 113031e31b8aSbellard * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, 113131e31b8aSbellard * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... 113231e31b8aSbellard * -Erik 113331e31b8aSbellard */ 113431e31b8aSbellard #define TARGET_CDROMGETSPINDOWN 0x531d 113531e31b8aSbellard #define TARGET_CDROMSETSPINDOWN 0x531e 113631e31b8aSbellard 113731e31b8aSbellard /* 113831e31b8aSbellard * These ioctls are implemented through the uniform CD-ROM driver 113931e31b8aSbellard * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM 114031e31b8aSbellard * drivers are eventually ported to the uniform CD-ROM driver interface. 114131e31b8aSbellard */ 114231e31b8aSbellard #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ 114331e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ 114431e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ 114531e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ 114631e31b8aSbellard #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ 114731e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ 114831e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ 114931e31b8aSbellard #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ 115031e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ 115131e31b8aSbellard #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ 115231e31b8aSbellard #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ 115331e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ 115431e31b8aSbellard 115531e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. 115631e31b8aSbellard * Future CDROM ioctls should be kept below 0x537F 115731e31b8aSbellard */ 115831e31b8aSbellard 115931e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */ 116031e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ 116131e31b8aSbellard /* conflict with SCSI_IOCTL_GET_IDLUN */ 116231e31b8aSbellard 116331e31b8aSbellard /* DVD-ROM Specific ioctls */ 116431e31b8aSbellard #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ 116531e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ 116631e31b8aSbellard #define TARGET_DVD_AUTH 0x5392 /* Authentication */ 116731e31b8aSbellard 116831e31b8aSbellard #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ 116931e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ 117031e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ 117131e31b8aSbellard 117231e31b8aSbellard /* HD commands */ 117331e31b8aSbellard 117431e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ 117531e31b8aSbellard #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ 117631e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ 117731e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ 117831e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ 117931e31b8aSbellard #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ 118031e31b8aSbellard #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ 118131e31b8aSbellard #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ 11822521d698Sbellard #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ 118331e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ 118431e31b8aSbellard 118531e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ 118631e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ 118731e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ 118831e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ 118931e31b8aSbellard #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ 119031e31b8aSbellard #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ 119131e31b8aSbellard #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ 119231e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ 11932521d698Sbellard 1194b8005914Sbalrog /* loop ioctls */ 1195b8005914Sbalrog #define TARGET_LOOP_SET_FD 0x4C00 1196b8005914Sbalrog #define TARGET_LOOP_CLR_FD 0x4C01 1197b8005914Sbalrog #define TARGET_LOOP_SET_STATUS 0x4C02 1198b8005914Sbalrog #define TARGET_LOOP_GET_STATUS 0x4C03 1199b8005914Sbalrog #define TARGET_LOOP_SET_STATUS64 0x4C04 1200b8005914Sbalrog #define TARGET_LOOP_GET_STATUS64 0x4C05 1201b8005914Sbalrog #define TARGET_LOOP_CHANGE_FD 0x4C06 12022521d698Sbellard 1203884cdc48SPeter Maydell #define TARGET_LOOP_CTL_ADD 0x4C80 1204884cdc48SPeter Maydell #define TARGET_LOOP_CTL_REMOVE 0x4C81 1205884cdc48SPeter Maydell #define TARGET_LOOP_CTL_GET_FREE 0x4C82 1206884cdc48SPeter Maydell 1207f7680a55SUlrich Hecht /* fb ioctls */ 1208f7680a55SUlrich Hecht #define TARGET_FBIOGET_VSCREENINFO 0x4600 1209f7680a55SUlrich Hecht #define TARGET_FBIOPUT_VSCREENINFO 0x4601 1210f7680a55SUlrich Hecht #define TARGET_FBIOGET_FSCREENINFO 0x4602 121112b81b71SCédric VINCENT #define TARGET_FBIOGETCMAP 0x4604 121212b81b71SCédric VINCENT #define TARGET_FBIOPUTCMAP 0x4605 121312b81b71SCédric VINCENT #define TARGET_FBIOPAN_DISPLAY 0x4606 121412b81b71SCédric VINCENT #define TARGET_FBIOGET_CON2FBMAP 0x460F 121512b81b71SCédric VINCENT #define TARGET_FBIOPUT_CON2FBMAP 0x4610 1216f7680a55SUlrich Hecht 1217f7680a55SUlrich Hecht /* vt ioctls */ 1218f7680a55SUlrich Hecht #define TARGET_VT_OPENQRY 0x5600 1219f7680a55SUlrich Hecht #define TARGET_VT_GETSTATE 0x5603 1220f7680a55SUlrich Hecht #define TARGET_VT_ACTIVATE 0x5606 1221f7680a55SUlrich Hecht #define TARGET_VT_WAITACTIVE 0x5607 1222f7680a55SUlrich Hecht #define TARGET_VT_LOCKSWITCH 0x560b 1223f7680a55SUlrich Hecht #define TARGET_VT_UNLOCKSWITCH 0x560c 1224774750c0SCédric VINCENT #define TARGET_VT_GETMODE 0x5601 1225774750c0SCédric VINCENT #define TARGET_VT_SETMODE 0x5602 1226774750c0SCédric VINCENT #define TARGET_VT_RELDISP 0x5605 1227774750c0SCédric VINCENT #define TARGET_VT_DISALLOCATE 0x5608 1228f7680a55SUlrich Hecht 122956e904ecSAlexander Graf /* device mapper */ 123056e904ecSAlexander Graf #define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00) 123156e904ecSAlexander Graf #define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01) 123256e904ecSAlexander Graf #define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02) 123356e904ecSAlexander Graf #define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03) 123456e904ecSAlexander Graf #define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04) 123556e904ecSAlexander Graf #define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05) 123656e904ecSAlexander Graf #define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06) 123756e904ecSAlexander Graf #define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07) 123856e904ecSAlexander Graf #define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08) 123956e904ecSAlexander Graf #define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09) 124056e904ecSAlexander Graf #define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a) 124156e904ecSAlexander Graf #define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b) 124256e904ecSAlexander Graf #define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c) 124356e904ecSAlexander Graf #define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d) 124456e904ecSAlexander Graf #define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e) 124556e904ecSAlexander Graf #define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f) 124656e904ecSAlexander Graf 1247e865b97fSChen Gang /* drm ioctls */ 1248e865b97fSChen Gang #define TARGET_DRM_IOCTL_VERSION TARGET_IOWRU('d', 0x00) 1249e865b97fSChen Gang 1250913b03c2SChen Gang /* drm i915 ioctls */ 1251913b03c2SChen Gang #define TARGET_DRM_IOCTL_I915_GETPARAM TARGET_IOWRU('d', 0x46) 1252913b03c2SChen Gang 12532521d698Sbellard /* from asm/termbits.h */ 12542521d698Sbellard 12553bfd9da1Sbellard #define TARGET_NCC 8 12563bfd9da1Sbellard struct target_termio { 12573bfd9da1Sbellard unsigned short c_iflag; /* input mode flags */ 12583bfd9da1Sbellard unsigned short c_oflag; /* output mode flags */ 12593bfd9da1Sbellard unsigned short c_cflag; /* control mode flags */ 12603bfd9da1Sbellard unsigned short c_lflag; /* local mode flags */ 12612521d698Sbellard unsigned char c_line; /* line discipline */ 12623bfd9da1Sbellard unsigned char c_cc[TARGET_NCC]; /* control characters */ 12632521d698Sbellard }; 12642521d698Sbellard 12653bfd9da1Sbellard struct target_winsize { 12663bfd9da1Sbellard unsigned short ws_row; 12673bfd9da1Sbellard unsigned short ws_col; 12683bfd9da1Sbellard unsigned short ws_xpixel; 12693bfd9da1Sbellard unsigned short ws_ypixel; 12703bfd9da1Sbellard }; 12712521d698Sbellard 12723bfd9da1Sbellard #include "termbits.h" 12732521d698Sbellard 12749e0b74a4SPaul Brook #if defined(TARGET_MIPS) 12759e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x10 12769e0b74a4SPaul Brook #else 12779e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x08 12789e0b74a4SPaul Brook #endif 12799e0b74a4SPaul Brook 1280be5d6f48SRichard Henderson #ifdef TARGET_AARCH64 1281be5d6f48SRichard Henderson #define TARGET_PROT_BTI 0x10 1282be5d6f48SRichard Henderson #endif 1283be5d6f48SRichard Henderson 1284e44a3e79Saurel32 /* Common */ 12852521d698Sbellard #define TARGET_MAP_SHARED 0x01 /* Share changes */ 12862521d698Sbellard #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ 1287e65be6a7SHelge Deller #if defined(TARGET_HPPA) 1288e65be6a7SHelge Deller #define TARGET_MAP_TYPE 0x03 /* Mask for type of mapping */ 1289e65be6a7SHelge Deller #else 12902521d698Sbellard #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ 1291e65be6a7SHelge Deller #endif 1292e44a3e79Saurel32 1293e44a3e79Saurel32 /* Target specific */ 1294048f6b4dSbellard #if defined(TARGET_MIPS) 1295e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1296048f6b4dSbellard #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 1297048f6b4dSbellard #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 1298048f6b4dSbellard #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 1299048f6b4dSbellard #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 1300048f6b4dSbellard #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 1301048f6b4dSbellard #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 1302540635baSths #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 1303540635baSths #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1304541e1690SHelge Deller #define TARGET_MAP_STACK 0x40000 /* ignored */ 1305541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ 1306e44a3e79Saurel32 #elif defined(TARGET_PPC) 1307e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 13082521d698Sbellard #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 13092521d698Sbellard #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 13102521d698Sbellard #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 13112521d698Sbellard #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 13127ec93196Sj_mayer #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ 13137ec93196Sj_mayer #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ 1314e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1315e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1316541e1690SHelge Deller #define TARGET_MAP_STACK 0x20000 /* ignored */ 1317541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ 1318e44a3e79Saurel32 #elif defined(TARGET_ALPHA) 1319e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1320e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ 1321e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ 1322e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ 1323e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ 1324e44a3e79Saurel32 #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ 1325e44a3e79Saurel32 #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ 1326e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ 1327e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ 1328541e1690SHelge Deller #define TARGET_MAP_STACK 0x80000 /* ignored */ 1329541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x100000 /* create a huge page mapping */ 1330a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 1331a10d1e50SRichard Henderson #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1332a10d1e50SRichard Henderson #define TARGET_MAP_FIXED 0x04 /* Interpret addr exactly */ 1333a10d1e50SRichard Henderson #define TARGET_MAP_GROWSDOWN 0x08000 /* stack-like segment */ 1334a10d1e50SRichard Henderson #define TARGET_MAP_DENYWRITE 0x00800 /* ETXTBSY */ 1335a10d1e50SRichard Henderson #define TARGET_MAP_EXECUTABLE 0x01000 /* mark it as an executable */ 1336a10d1e50SRichard Henderson #define TARGET_MAP_LOCKED 0x02000 /* lock the mapping */ 1337a10d1e50SRichard Henderson #define TARGET_MAP_NORESERVE 0x04000 /* no check for reservations */ 1338a10d1e50SRichard Henderson #define TARGET_MAP_POPULATE 0x10000 /* pop (prefault) pagetables */ 1339a10d1e50SRichard Henderson #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1340541e1690SHelge Deller #define TARGET_MAP_STACK 0x40000 /* ignored */ 1341541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ 1342ba7651fbSMax Filippov #elif defined(TARGET_XTENSA) 1343ba7651fbSMax Filippov #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1344ba7651fbSMax Filippov #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 1345ba7651fbSMax Filippov #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 1346ba7651fbSMax Filippov #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 1347ba7651fbSMax Filippov #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 1348ba7651fbSMax Filippov #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 1349ba7651fbSMax Filippov #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 1350ba7651fbSMax Filippov #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 1351ba7651fbSMax Filippov #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1352ba7651fbSMax Filippov #define TARGET_MAP_STACK 0x40000 1353ba7651fbSMax Filippov #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ 13547ec93196Sj_mayer #else 1355e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1356e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 1357e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 1358e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 1359e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 13602521d698Sbellard #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ 13612521d698Sbellard #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ 1362540635baSths #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1363540635baSths #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1364541e1690SHelge Deller #define TARGET_MAP_STACK 0x20000 /* ignored */ 1365541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ 1366906c1b8eSMike Frysinger #define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ 13677ec93196Sj_mayer #endif 13682521d698Sbellard 136909701199SAlexander Graf #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 137009701199SAlexander Graf || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 1371daa4374aSPeter Maydell || defined(TARGET_CRIS) 13725f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 13732521d698Sbellard struct target_stat { 13742521d698Sbellard unsigned short st_dev; 13752521d698Sbellard unsigned short __pad1; 1376992f48a0Sblueswir1 abi_ulong st_ino; 13772521d698Sbellard unsigned short st_mode; 13782521d698Sbellard unsigned short st_nlink; 13792521d698Sbellard unsigned short st_uid; 13802521d698Sbellard unsigned short st_gid; 13812521d698Sbellard unsigned short st_rdev; 13822521d698Sbellard unsigned short __pad2; 1383992f48a0Sblueswir1 abi_ulong st_size; 1384992f48a0Sblueswir1 abi_ulong st_blksize; 1385992f48a0Sblueswir1 abi_ulong st_blocks; 1386992f48a0Sblueswir1 abi_ulong target_st_atime; 13875f992db6SChen-Yu Tsai abi_ulong target_st_atime_nsec; 1388992f48a0Sblueswir1 abi_ulong target_st_mtime; 13895f992db6SChen-Yu Tsai abi_ulong target_st_mtime_nsec; 1390992f48a0Sblueswir1 abi_ulong target_st_ctime; 13915f992db6SChen-Yu Tsai abi_ulong target_st_ctime_nsec; 1392992f48a0Sblueswir1 abi_ulong __unused4; 1393992f48a0Sblueswir1 abi_ulong __unused5; 13942521d698Sbellard }; 13952521d698Sbellard 13962521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely 13972521d698Sbellard * insane amounts of padding around dev_t's. 13982521d698Sbellard */ 139920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 14002521d698Sbellard struct target_stat64 { 14012521d698Sbellard unsigned short st_dev; 14022521d698Sbellard unsigned char __pad0[10]; 14032521d698Sbellard 14042521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1405992f48a0Sblueswir1 abi_ulong __st_ino; 14062521d698Sbellard 14072521d698Sbellard unsigned int st_mode; 14082521d698Sbellard unsigned int st_nlink; 14092521d698Sbellard 1410992f48a0Sblueswir1 abi_ulong st_uid; 1411992f48a0Sblueswir1 abi_ulong st_gid; 14122521d698Sbellard 14132521d698Sbellard unsigned short st_rdev; 14142521d698Sbellard unsigned char __pad3[10]; 14152521d698Sbellard 14162521d698Sbellard long long st_size; 1417992f48a0Sblueswir1 abi_ulong st_blksize; 14182521d698Sbellard 1419992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1420992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 14212521d698Sbellard 1422992f48a0Sblueswir1 abi_ulong target_st_atime; 14235f992db6SChen-Yu Tsai abi_ulong target_st_atime_nsec; 14242521d698Sbellard 1425992f48a0Sblueswir1 abi_ulong target_st_mtime; 14265f992db6SChen-Yu Tsai abi_ulong target_st_mtime_nsec; 14272521d698Sbellard 1428992f48a0Sblueswir1 abi_ulong target_st_ctime; 14295f992db6SChen-Yu Tsai abi_ulong target_st_ctime_nsec; 14302521d698Sbellard 14312521d698Sbellard unsigned long long st_ino; 1432541dc0d4SStefan Weil } QEMU_PACKED; 14332521d698Sbellard 1434ce4defa0Spbrook #ifdef TARGET_ARM 143520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1436ce4defa0Spbrook struct target_eabi_stat64 { 1437ce4defa0Spbrook unsigned long long st_dev; 1438ce4defa0Spbrook unsigned int __pad1; 1439992f48a0Sblueswir1 abi_ulong __st_ino; 1440ce4defa0Spbrook unsigned int st_mode; 1441ce4defa0Spbrook unsigned int st_nlink; 1442ce4defa0Spbrook 1443992f48a0Sblueswir1 abi_ulong st_uid; 1444992f48a0Sblueswir1 abi_ulong st_gid; 1445ce4defa0Spbrook 1446ce4defa0Spbrook unsigned long long st_rdev; 1447ce4defa0Spbrook unsigned int __pad2[2]; 1448ce4defa0Spbrook 1449ce4defa0Spbrook long long st_size; 1450992f48a0Sblueswir1 abi_ulong st_blksize; 1451ce4defa0Spbrook unsigned int __pad3; 1452ce4defa0Spbrook unsigned long long st_blocks; 1453ce4defa0Spbrook 1454992f48a0Sblueswir1 abi_ulong target_st_atime; 1455992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1456ce4defa0Spbrook 1457992f48a0Sblueswir1 abi_ulong target_st_mtime; 1458992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1459ce4defa0Spbrook 1460992f48a0Sblueswir1 abi_ulong target_st_ctime; 1461992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1462ce4defa0Spbrook 1463ce4defa0Spbrook unsigned long long st_ino; 1464541dc0d4SStefan Weil } QEMU_PACKED; 1465ce4defa0Spbrook #endif 1466ce4defa0Spbrook 1467992f48a0Sblueswir1 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 14681b8dd648Sblueswir1 struct target_stat { 14691b8dd648Sblueswir1 unsigned int st_dev; 1470992f48a0Sblueswir1 abi_ulong st_ino; 14711b8dd648Sblueswir1 unsigned int st_mode; 14721b8dd648Sblueswir1 unsigned int st_nlink; 14731b8dd648Sblueswir1 unsigned int st_uid; 14741b8dd648Sblueswir1 unsigned int st_gid; 14751b8dd648Sblueswir1 unsigned int st_rdev; 1476992f48a0Sblueswir1 abi_long st_size; 1477992f48a0Sblueswir1 abi_long target_st_atime; 1478992f48a0Sblueswir1 abi_long target_st_mtime; 1479992f48a0Sblueswir1 abi_long target_st_ctime; 1480992f48a0Sblueswir1 abi_long st_blksize; 1481992f48a0Sblueswir1 abi_long st_blocks; 1482992f48a0Sblueswir1 abi_ulong __unused4[2]; 14831b8dd648Sblueswir1 }; 14841b8dd648Sblueswir1 148520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 14861b8dd648Sblueswir1 struct target_stat64 { 14871b8dd648Sblueswir1 unsigned char __pad0[6]; 14881b8dd648Sblueswir1 unsigned short st_dev; 14891b8dd648Sblueswir1 14901b8dd648Sblueswir1 uint64_t st_ino; 14911b8dd648Sblueswir1 uint64_t st_nlink; 14921b8dd648Sblueswir1 14931b8dd648Sblueswir1 unsigned int st_mode; 14941b8dd648Sblueswir1 14951b8dd648Sblueswir1 unsigned int st_uid; 14961b8dd648Sblueswir1 unsigned int st_gid; 14971b8dd648Sblueswir1 14981b8dd648Sblueswir1 unsigned char __pad2[6]; 14991b8dd648Sblueswir1 unsigned short st_rdev; 15001b8dd648Sblueswir1 15011b8dd648Sblueswir1 int64_t st_size; 15021b8dd648Sblueswir1 int64_t st_blksize; 15031b8dd648Sblueswir1 15041b8dd648Sblueswir1 unsigned char __pad4[4]; 15051b8dd648Sblueswir1 unsigned int st_blocks; 15061b8dd648Sblueswir1 1507992f48a0Sblueswir1 abi_ulong target_st_atime; 15085f992db6SChen-Yu Tsai abi_ulong target_st_atime_nsec; 15091b8dd648Sblueswir1 1510992f48a0Sblueswir1 abi_ulong target_st_mtime; 15115f992db6SChen-Yu Tsai abi_ulong target_st_mtime_nsec; 15121b8dd648Sblueswir1 1513992f48a0Sblueswir1 abi_ulong target_st_ctime; 15145f992db6SChen-Yu Tsai abi_ulong target_st_ctime_nsec; 15151b8dd648Sblueswir1 1516992f48a0Sblueswir1 abi_ulong __unused4[3]; 15171b8dd648Sblueswir1 }; 15181b8dd648Sblueswir1 15193bfd9da1Sbellard #elif defined(TARGET_SPARC) 15203bfd9da1Sbellard 15215f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 15223bfd9da1Sbellard struct target_stat { 15233bfd9da1Sbellard unsigned short st_dev; 1524992f48a0Sblueswir1 abi_ulong st_ino; 15253bfd9da1Sbellard unsigned short st_mode; 15263bfd9da1Sbellard short st_nlink; 15273bfd9da1Sbellard unsigned short st_uid; 15283bfd9da1Sbellard unsigned short st_gid; 15293bfd9da1Sbellard unsigned short st_rdev; 1530992f48a0Sblueswir1 abi_long st_size; 1531992f48a0Sblueswir1 abi_long target_st_atime; 15325f992db6SChen-Yu Tsai abi_ulong target_st_atime_nsec; 1533992f48a0Sblueswir1 abi_long target_st_mtime; 15345f992db6SChen-Yu Tsai abi_ulong target_st_mtime_nsec; 1535992f48a0Sblueswir1 abi_long target_st_ctime; 15365f992db6SChen-Yu Tsai abi_ulong target_st_ctime_nsec; 1537992f48a0Sblueswir1 abi_long st_blksize; 1538992f48a0Sblueswir1 abi_long st_blocks; 15395f992db6SChen-Yu Tsai abi_ulong __unused1[2]; 15403bfd9da1Sbellard }; 15413bfd9da1Sbellard 154220d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 15433bfd9da1Sbellard struct target_stat64 { 15443bfd9da1Sbellard unsigned char __pad0[6]; 15453bfd9da1Sbellard unsigned short st_dev; 15463bfd9da1Sbellard 15473bfd9da1Sbellard uint64_t st_ino; 15483bfd9da1Sbellard 15493bfd9da1Sbellard unsigned int st_mode; 15503bfd9da1Sbellard unsigned int st_nlink; 15513bfd9da1Sbellard 15523bfd9da1Sbellard unsigned int st_uid; 15533bfd9da1Sbellard unsigned int st_gid; 15543bfd9da1Sbellard 15553bfd9da1Sbellard unsigned char __pad2[6]; 15563bfd9da1Sbellard unsigned short st_rdev; 15573bfd9da1Sbellard 15583bfd9da1Sbellard unsigned char __pad3[8]; 15593bfd9da1Sbellard 15603bfd9da1Sbellard int64_t st_size; 15613bfd9da1Sbellard unsigned int st_blksize; 15623bfd9da1Sbellard 15633bfd9da1Sbellard unsigned char __pad4[8]; 15643bfd9da1Sbellard unsigned int st_blocks; 15653bfd9da1Sbellard 15663bfd9da1Sbellard unsigned int target_st_atime; 15675f992db6SChen-Yu Tsai unsigned int target_st_atime_nsec; 15683bfd9da1Sbellard 15693bfd9da1Sbellard unsigned int target_st_mtime; 15705f992db6SChen-Yu Tsai unsigned int target_st_mtime_nsec; 15713bfd9da1Sbellard 15723bfd9da1Sbellard unsigned int target_st_ctime; 15735f992db6SChen-Yu Tsai unsigned int target_st_ctime_nsec; 15743bfd9da1Sbellard 15755f992db6SChen-Yu Tsai unsigned int __unused1; 15765f992db6SChen-Yu Tsai unsigned int __unused2; 15773bfd9da1Sbellard }; 15783bfd9da1Sbellard 157967867308Sbellard #elif defined(TARGET_PPC) 158067867308Sbellard 15815f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 158267867308Sbellard struct target_stat { 1583e32448e0Sj_mayer abi_ulong st_dev; 1584992f48a0Sblueswir1 abi_ulong st_ino; 1585325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1586e32448e0Sj_mayer abi_ulong st_nlink; 1587325e651fSj_mayer unsigned int st_mode; 1588325e651fSj_mayer #else 158967867308Sbellard unsigned int st_mode; 159067867308Sbellard unsigned short st_nlink; 1591325e651fSj_mayer #endif 159267867308Sbellard unsigned int st_uid; 159367867308Sbellard unsigned int st_gid; 1594e32448e0Sj_mayer abi_ulong st_rdev; 1595992f48a0Sblueswir1 abi_ulong st_size; 1596992f48a0Sblueswir1 abi_ulong st_blksize; 1597992f48a0Sblueswir1 abi_ulong st_blocks; 1598992f48a0Sblueswir1 abi_ulong target_st_atime; 1599e32448e0Sj_mayer abi_ulong target_st_atime_nsec; 1600992f48a0Sblueswir1 abi_ulong target_st_mtime; 1601e32448e0Sj_mayer abi_ulong target_st_mtime_nsec; 1602992f48a0Sblueswir1 abi_ulong target_st_ctime; 1603e32448e0Sj_mayer abi_ulong target_st_ctime_nsec; 1604992f48a0Sblueswir1 abi_ulong __unused4; 1605992f48a0Sblueswir1 abi_ulong __unused5; 1606325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1607325e651fSj_mayer abi_ulong __unused6; 1608325e651fSj_mayer #endif 160967867308Sbellard }; 161067867308Sbellard 161120d155bcSStefan Weil #if !defined(TARGET_PPC64) || defined(TARGET_ABI32) 161220d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1613541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 161467867308Sbellard unsigned long long st_dev; 161567867308Sbellard unsigned long long st_ino; 161667867308Sbellard unsigned int st_mode; 161767867308Sbellard unsigned int st_nlink; 161867867308Sbellard unsigned int st_uid; 161967867308Sbellard unsigned int st_gid; 162067867308Sbellard unsigned long long st_rdev; 1621e1ce5e40Saurel32 unsigned long long __pad0; 162267867308Sbellard long long st_size; 1623e32448e0Sj_mayer int st_blksize; 1624e1ce5e40Saurel32 unsigned int __pad1; 162561322e91SMax Filippov long long st_blocks; /* Number 512-byte blocks allocated. */ 1626e32448e0Sj_mayer int target_st_atime; 1627e32448e0Sj_mayer unsigned int target_st_atime_nsec; 1628e32448e0Sj_mayer int target_st_mtime; 1629e32448e0Sj_mayer unsigned int target_st_mtime_nsec; 1630e32448e0Sj_mayer int target_st_ctime; 1631e32448e0Sj_mayer unsigned int target_st_ctime_nsec; 1632e32448e0Sj_mayer unsigned int __unused4; 1633e32448e0Sj_mayer unsigned int __unused5; 163467867308Sbellard }; 163520d155bcSStefan Weil #endif 163667867308Sbellard 1637b779e29eSEdgar E. Iglesias #elif defined(TARGET_MICROBLAZE) 1638b779e29eSEdgar E. Iglesias 16395f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1640b779e29eSEdgar E. Iglesias struct target_stat { 1641b779e29eSEdgar E. Iglesias abi_ulong st_dev; 1642b779e29eSEdgar E. Iglesias abi_ulong st_ino; 1643b779e29eSEdgar E. Iglesias unsigned int st_mode; 1644b779e29eSEdgar E. Iglesias unsigned short st_nlink; 1645b779e29eSEdgar E. Iglesias unsigned int st_uid; 1646b779e29eSEdgar E. Iglesias unsigned int st_gid; 1647b779e29eSEdgar E. Iglesias abi_ulong st_rdev; 1648b779e29eSEdgar E. Iglesias abi_ulong st_size; 1649b779e29eSEdgar E. Iglesias abi_ulong st_blksize; 1650b779e29eSEdgar E. Iglesias abi_ulong st_blocks; 1651b779e29eSEdgar E. Iglesias abi_ulong target_st_atime; 1652b779e29eSEdgar E. Iglesias abi_ulong target_st_atime_nsec; 1653b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime; 1654b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime_nsec; 1655b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime; 1656b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime_nsec; 1657b779e29eSEdgar E. Iglesias abi_ulong __unused4; 1658b779e29eSEdgar E. Iglesias abi_ulong __unused5; 1659b779e29eSEdgar E. Iglesias }; 1660b779e29eSEdgar E. Iglesias 1661b779e29eSEdgar E. Iglesias /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ 166220d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1663541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 1664b779e29eSEdgar E. Iglesias uint64_t st_dev; 1665a523eb06SEdgar E. Iglesias #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1666a523eb06SEdgar E. Iglesias uint32_t pad0; 1667a523eb06SEdgar E. Iglesias uint32_t __st_ino; 1668a523eb06SEdgar E. Iglesias 1669b779e29eSEdgar E. Iglesias uint32_t st_mode; 1670b779e29eSEdgar E. Iglesias uint32_t st_nlink; 1671b779e29eSEdgar E. Iglesias uint32_t st_uid; 1672b779e29eSEdgar E. Iglesias uint32_t st_gid; 1673b779e29eSEdgar E. Iglesias uint64_t st_rdev; 167421ebeb23SEdgar E. Iglesias uint64_t __pad1; 1675b779e29eSEdgar E. Iglesias 1676b779e29eSEdgar E. Iglesias int64_t st_size; 1677b779e29eSEdgar E. Iglesias int32_t st_blksize; 167821ebeb23SEdgar E. Iglesias uint32_t __pad2; 1679b779e29eSEdgar E. Iglesias int64_t st_blocks; /* Number 512-byte blocks allocated. */ 1680b779e29eSEdgar E. Iglesias 1681b779e29eSEdgar E. Iglesias int target_st_atime; 1682b779e29eSEdgar E. Iglesias unsigned int target_st_atime_nsec; 1683b779e29eSEdgar E. Iglesias int target_st_mtime; 1684b779e29eSEdgar E. Iglesias unsigned int target_st_mtime_nsec; 1685b779e29eSEdgar E. Iglesias int target_st_ctime; 1686b779e29eSEdgar E. Iglesias unsigned int target_st_ctime_nsec; 1687a523eb06SEdgar E. Iglesias uint64_t st_ino; 1688b779e29eSEdgar E. Iglesias }; 1689b779e29eSEdgar E. Iglesias 1690e6e5906bSpbrook #elif defined(TARGET_M68K) 1691e6e5906bSpbrook 1692e6e5906bSpbrook struct target_stat { 1693e6e5906bSpbrook unsigned short st_dev; 1694e6e5906bSpbrook unsigned short __pad1; 1695992f48a0Sblueswir1 abi_ulong st_ino; 1696e6e5906bSpbrook unsigned short st_mode; 1697e6e5906bSpbrook unsigned short st_nlink; 1698e6e5906bSpbrook unsigned short st_uid; 1699e6e5906bSpbrook unsigned short st_gid; 1700e6e5906bSpbrook unsigned short st_rdev; 1701e6e5906bSpbrook unsigned short __pad2; 1702992f48a0Sblueswir1 abi_ulong st_size; 1703992f48a0Sblueswir1 abi_ulong st_blksize; 1704992f48a0Sblueswir1 abi_ulong st_blocks; 1705992f48a0Sblueswir1 abi_ulong target_st_atime; 1706992f48a0Sblueswir1 abi_ulong __unused1; 1707992f48a0Sblueswir1 abi_ulong target_st_mtime; 1708992f48a0Sblueswir1 abi_ulong __unused2; 1709992f48a0Sblueswir1 abi_ulong target_st_ctime; 1710992f48a0Sblueswir1 abi_ulong __unused3; 1711992f48a0Sblueswir1 abi_ulong __unused4; 1712992f48a0Sblueswir1 abi_ulong __unused5; 1713e6e5906bSpbrook }; 1714e6e5906bSpbrook 1715e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely 1716e6e5906bSpbrook * insane amounts of padding around dev_t's. 1717e6e5906bSpbrook */ 171820d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1719e6e5906bSpbrook struct target_stat64 { 1720e6e5906bSpbrook unsigned long long st_dev; 1721e6e5906bSpbrook unsigned char __pad1[2]; 1722e6e5906bSpbrook 1723e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1724992f48a0Sblueswir1 abi_ulong __st_ino; 1725e6e5906bSpbrook 1726e6e5906bSpbrook unsigned int st_mode; 1727e6e5906bSpbrook unsigned int st_nlink; 1728e6e5906bSpbrook 1729992f48a0Sblueswir1 abi_ulong st_uid; 1730992f48a0Sblueswir1 abi_ulong st_gid; 1731e6e5906bSpbrook 1732e6e5906bSpbrook unsigned long long st_rdev; 1733e6e5906bSpbrook unsigned char __pad3[2]; 1734e6e5906bSpbrook 1735e6e5906bSpbrook long long st_size; 1736992f48a0Sblueswir1 abi_ulong st_blksize; 1737e6e5906bSpbrook 1738992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 1739992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1740e6e5906bSpbrook 1741992f48a0Sblueswir1 abi_ulong target_st_atime; 1742992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1743e6e5906bSpbrook 1744992f48a0Sblueswir1 abi_ulong target_st_mtime; 1745992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1746e6e5906bSpbrook 1747992f48a0Sblueswir1 abi_ulong target_st_ctime; 1748992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1749e6e5906bSpbrook 1750e6e5906bSpbrook unsigned long long st_ino; 1751541dc0d4SStefan Weil } QEMU_PACKED; 1752e6e5906bSpbrook 1753d26bc211Sths #elif defined(TARGET_ABI_MIPSN64) 1754540635baSths 17555f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1756540635baSths /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ 1757540635baSths struct target_stat { 1758540635baSths unsigned int st_dev; 1759540635baSths unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ 1760540635baSths 1761992f48a0Sblueswir1 abi_ulong st_ino; 1762540635baSths 1763540635baSths unsigned int st_mode; 1764540635baSths unsigned int st_nlink; 1765540635baSths 1766540635baSths int st_uid; 1767540635baSths int st_gid; 1768540635baSths 1769540635baSths unsigned int st_rdev; 1770540635baSths unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ 1771540635baSths 1772992f48a0Sblueswir1 abi_ulong st_size; 1773540635baSths 1774540635baSths /* 1775540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1776540635baSths * but we don't have it under Linux. 1777540635baSths */ 1778540635baSths unsigned int target_st_atime; 1779540635baSths unsigned int target_st_atime_nsec; 1780540635baSths 1781540635baSths unsigned int target_st_mtime; 1782540635baSths unsigned int target_st_mtime_nsec; 1783540635baSths 1784540635baSths unsigned int target_st_ctime; 1785540635baSths unsigned int target_st_ctime_nsec; 1786540635baSths 1787540635baSths unsigned int st_blksize; 1788540635baSths unsigned int st_pad2; 1789540635baSths 1790992f48a0Sblueswir1 abi_ulong st_blocks; 1791540635baSths }; 1792540635baSths 1793d26bc211Sths #elif defined(TARGET_ABI_MIPSN32) 1794540635baSths 17955f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1796540635baSths struct target_stat { 17971ab2aea2SLeon Alrae abi_ulong st_dev; 17981ab2aea2SLeon Alrae abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 17991ab2aea2SLeon Alrae uint64_t st_ino; 1800540635baSths unsigned int st_mode; 1801540635baSths unsigned int st_nlink; 1802540635baSths int st_uid; 1803540635baSths int st_gid; 18041ab2aea2SLeon Alrae abi_ulong st_rdev; 18051ab2aea2SLeon Alrae abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 18061ab2aea2SLeon Alrae int64_t st_size; 18071ab2aea2SLeon Alrae abi_long target_st_atime; 18081ab2aea2SLeon Alrae abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 18091ab2aea2SLeon Alrae abi_long target_st_mtime; 18101ab2aea2SLeon Alrae abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 18111ab2aea2SLeon Alrae abi_long target_st_ctime; 18121ab2aea2SLeon Alrae abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 18131ab2aea2SLeon Alrae abi_ulong st_blksize; 18141ab2aea2SLeon Alrae abi_ulong st_pad2; 18151ab2aea2SLeon Alrae int64_t st_blocks; 1816540635baSths }; 1817540635baSths 1818d26bc211Sths #elif defined(TARGET_ABI_MIPSO32) 1819048f6b4dSbellard 18205f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1821048f6b4dSbellard struct target_stat { 1822048f6b4dSbellard unsigned st_dev; 1823992f48a0Sblueswir1 abi_long st_pad1[3]; /* Reserved for network id */ 1824992f48a0Sblueswir1 abi_ulong st_ino; 1825048f6b4dSbellard unsigned int st_mode; 1826048f6b4dSbellard unsigned int st_nlink; 1827048f6b4dSbellard int st_uid; 1828048f6b4dSbellard int st_gid; 1829048f6b4dSbellard unsigned st_rdev; 1830992f48a0Sblueswir1 abi_long st_pad2[2]; 1831992f48a0Sblueswir1 abi_long st_size; 1832992f48a0Sblueswir1 abi_long st_pad3; 1833048f6b4dSbellard /* 1834048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1835048f6b4dSbellard * but we don't have it under Linux. 1836048f6b4dSbellard */ 1837992f48a0Sblueswir1 abi_long target_st_atime; 1838992f48a0Sblueswir1 abi_long target_st_atime_nsec; 1839992f48a0Sblueswir1 abi_long target_st_mtime; 1840992f48a0Sblueswir1 abi_long target_st_mtime_nsec; 1841992f48a0Sblueswir1 abi_long target_st_ctime; 1842992f48a0Sblueswir1 abi_long target_st_ctime_nsec; 1843992f48a0Sblueswir1 abi_long st_blksize; 1844992f48a0Sblueswir1 abi_long st_blocks; 1845992f48a0Sblueswir1 abi_long st_pad4[14]; 1846048f6b4dSbellard }; 1847048f6b4dSbellard 1848048f6b4dSbellard /* 1849048f6b4dSbellard * This matches struct stat64 in glibc2.1, hence the absolutely insane 1850048f6b4dSbellard * amounts of padding around dev_t's. The memory layout is the same as of 1851048f6b4dSbellard * struct stat of the 64-bit kernel. 1852048f6b4dSbellard */ 1853048f6b4dSbellard 185420d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1855048f6b4dSbellard struct target_stat64 { 1856992f48a0Sblueswir1 abi_ulong st_dev; 1857992f48a0Sblueswir1 abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 1858048f6b4dSbellard 1859048f6b4dSbellard uint64_t st_ino; 1860048f6b4dSbellard 1861048f6b4dSbellard unsigned int st_mode; 1862048f6b4dSbellard unsigned int st_nlink; 1863048f6b4dSbellard 1864048f6b4dSbellard int st_uid; 1865048f6b4dSbellard int st_gid; 1866048f6b4dSbellard 1867992f48a0Sblueswir1 abi_ulong st_rdev; 1868992f48a0Sblueswir1 abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 1869048f6b4dSbellard 1870048f6b4dSbellard int64_t st_size; 1871048f6b4dSbellard 1872048f6b4dSbellard /* 1873048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1874048f6b4dSbellard * but we don't have it under Linux. 1875048f6b4dSbellard */ 1876992f48a0Sblueswir1 abi_long target_st_atime; 1877992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 1878048f6b4dSbellard 1879992f48a0Sblueswir1 abi_long target_st_mtime; 1880992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 1881048f6b4dSbellard 1882992f48a0Sblueswir1 abi_long target_st_ctime; 1883992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 1884048f6b4dSbellard 1885992f48a0Sblueswir1 abi_ulong st_blksize; 1886992f48a0Sblueswir1 abi_ulong st_pad2; 1887048f6b4dSbellard 1888048f6b4dSbellard int64_t st_blocks; 1889048f6b4dSbellard }; 18907a3148a9Sj_mayer 18917a3148a9Sj_mayer #elif defined(TARGET_ALPHA) 18927a3148a9Sj_mayer 18937a3148a9Sj_mayer struct target_stat { 18947a3148a9Sj_mayer unsigned int st_dev; 18957a3148a9Sj_mayer unsigned int st_ino; 18967a3148a9Sj_mayer unsigned int st_mode; 18977a3148a9Sj_mayer unsigned int st_nlink; 18987a3148a9Sj_mayer unsigned int st_uid; 18997a3148a9Sj_mayer unsigned int st_gid; 19007a3148a9Sj_mayer unsigned int st_rdev; 1901992f48a0Sblueswir1 abi_long st_size; 1902992f48a0Sblueswir1 abi_ulong target_st_atime; 1903992f48a0Sblueswir1 abi_ulong target_st_mtime; 1904992f48a0Sblueswir1 abi_ulong target_st_ctime; 19057a3148a9Sj_mayer unsigned int st_blksize; 19067a3148a9Sj_mayer unsigned int st_blocks; 19077a3148a9Sj_mayer unsigned int st_flags; 19087a3148a9Sj_mayer unsigned int st_gen; 19097a3148a9Sj_mayer }; 19107a3148a9Sj_mayer 191120d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 19127a3148a9Sj_mayer struct target_stat64 { 1913992f48a0Sblueswir1 abi_ulong st_dev; 1914992f48a0Sblueswir1 abi_ulong st_ino; 1915992f48a0Sblueswir1 abi_ulong st_rdev; 1916992f48a0Sblueswir1 abi_long st_size; 1917992f48a0Sblueswir1 abi_ulong st_blocks; 19187a3148a9Sj_mayer 19197a3148a9Sj_mayer unsigned int st_mode; 19207a3148a9Sj_mayer unsigned int st_uid; 19217a3148a9Sj_mayer unsigned int st_gid; 19227a3148a9Sj_mayer unsigned int st_blksize; 19237a3148a9Sj_mayer unsigned int st_nlink; 19247a3148a9Sj_mayer unsigned int __pad0; 19257a3148a9Sj_mayer 1926992f48a0Sblueswir1 abi_ulong target_st_atime; 1927992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1928992f48a0Sblueswir1 abi_ulong target_st_mtime; 1929992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1930992f48a0Sblueswir1 abi_ulong target_st_ctime; 1931992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1932992f48a0Sblueswir1 abi_long __unused[3]; 19337a3148a9Sj_mayer }; 19347a3148a9Sj_mayer 19356db45e65Sths #elif defined(TARGET_SH4) 19366db45e65Sths 19375f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 19386db45e65Sths struct target_stat { 1939992f48a0Sblueswir1 abi_ulong st_dev; 1940992f48a0Sblueswir1 abi_ulong st_ino; 19416db45e65Sths unsigned short st_mode; 19426db45e65Sths unsigned short st_nlink; 19436db45e65Sths unsigned short st_uid; 19446db45e65Sths unsigned short st_gid; 1945992f48a0Sblueswir1 abi_ulong st_rdev; 1946992f48a0Sblueswir1 abi_ulong st_size; 1947992f48a0Sblueswir1 abi_ulong st_blksize; 1948992f48a0Sblueswir1 abi_ulong st_blocks; 1949992f48a0Sblueswir1 abi_ulong target_st_atime; 1950992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1951992f48a0Sblueswir1 abi_ulong target_st_mtime; 1952992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1953992f48a0Sblueswir1 abi_ulong target_st_ctime; 1954992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1955992f48a0Sblueswir1 abi_ulong __unused4; 1956992f48a0Sblueswir1 abi_ulong __unused5; 19576db45e65Sths }; 19586db45e65Sths 19596db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely 19606db45e65Sths * insane amounts of padding around dev_t's. 19616db45e65Sths */ 196220d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1963541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 19646db45e65Sths unsigned long long st_dev; 19656db45e65Sths unsigned char __pad0[4]; 19666db45e65Sths 19676db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1968992f48a0Sblueswir1 abi_ulong __st_ino; 19696db45e65Sths 19706db45e65Sths unsigned int st_mode; 19716db45e65Sths unsigned int st_nlink; 19726db45e65Sths 1973992f48a0Sblueswir1 abi_ulong st_uid; 1974992f48a0Sblueswir1 abi_ulong st_gid; 19756db45e65Sths 19766db45e65Sths unsigned long long st_rdev; 19776db45e65Sths unsigned char __pad3[4]; 19786db45e65Sths 19796db45e65Sths long long st_size; 1980992f48a0Sblueswir1 abi_ulong st_blksize; 19816db45e65Sths 19826db45e65Sths unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ 19836db45e65Sths 1984992f48a0Sblueswir1 abi_ulong target_st_atime; 1985992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 19866db45e65Sths 1987992f48a0Sblueswir1 abi_ulong target_st_mtime; 1988992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 19896db45e65Sths 1990992f48a0Sblueswir1 abi_ulong target_st_ctime; 1991992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 19926db45e65Sths 19936db45e65Sths unsigned long long st_ino; 19946db45e65Sths }; 19956db45e65Sths 1996d2fd1af7Sbellard #elif defined(TARGET_I386) && !defined(TARGET_ABI32) 19975f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1998d2fd1af7Sbellard struct target_stat { 1999d2fd1af7Sbellard abi_ulong st_dev; 2000d2fd1af7Sbellard abi_ulong st_ino; 2001d2fd1af7Sbellard abi_ulong st_nlink; 2002d2fd1af7Sbellard 2003d2fd1af7Sbellard unsigned int st_mode; 2004d2fd1af7Sbellard unsigned int st_uid; 2005d2fd1af7Sbellard unsigned int st_gid; 2006d2fd1af7Sbellard unsigned int __pad0; 2007d2fd1af7Sbellard abi_ulong st_rdev; 2008d2fd1af7Sbellard abi_long st_size; 2009d2fd1af7Sbellard abi_long st_blksize; 2010d2fd1af7Sbellard abi_long st_blocks; /* Number 512-byte blocks allocated. */ 2011d2fd1af7Sbellard 2012d2fd1af7Sbellard abi_ulong target_st_atime; 2013d2fd1af7Sbellard abi_ulong target_st_atime_nsec; 2014d2fd1af7Sbellard abi_ulong target_st_mtime; 2015d2fd1af7Sbellard abi_ulong target_st_mtime_nsec; 2016d2fd1af7Sbellard abi_ulong target_st_ctime; 2017d2fd1af7Sbellard abi_ulong target_st_ctime_nsec; 2018d2fd1af7Sbellard 2019d2fd1af7Sbellard abi_long __unused[3]; 2020d2fd1af7Sbellard }; 2021a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 2022a4c075f1SUlrich Hecht struct target_stat { 2023a4c075f1SUlrich Hecht abi_ulong st_dev; 2024a4c075f1SUlrich Hecht abi_ulong st_ino; 2025a4c075f1SUlrich Hecht abi_ulong st_nlink; 2026a4c075f1SUlrich Hecht unsigned int st_mode; 2027a4c075f1SUlrich Hecht unsigned int st_uid; 2028a4c075f1SUlrich Hecht unsigned int st_gid; 2029a4c075f1SUlrich Hecht unsigned int __pad1; 2030a4c075f1SUlrich Hecht abi_ulong st_rdev; 2031a4c075f1SUlrich Hecht abi_ulong st_size; 2032a4c075f1SUlrich Hecht abi_ulong target_st_atime; 2033a4c075f1SUlrich Hecht abi_ulong target_st_atime_nsec; 2034a4c075f1SUlrich Hecht abi_ulong target_st_mtime; 2035a4c075f1SUlrich Hecht abi_ulong target_st_mtime_nsec; 2036a4c075f1SUlrich Hecht abi_ulong target_st_ctime; 2037a4c075f1SUlrich Hecht abi_ulong target_st_ctime_nsec; 2038a4c075f1SUlrich Hecht abi_ulong st_blksize; 2039a4c075f1SUlrich Hecht abi_long st_blocks; 2040a4c075f1SUlrich Hecht abi_ulong __unused[3]; 2041a4c075f1SUlrich Hecht }; 204209701199SAlexander Graf #elif defined(TARGET_AARCH64) 20435f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 204409701199SAlexander Graf struct target_stat { 204509701199SAlexander Graf abi_ulong st_dev; 204609701199SAlexander Graf abi_ulong st_ino; 204709701199SAlexander Graf unsigned int st_mode; 204809701199SAlexander Graf unsigned int st_nlink; 204909701199SAlexander Graf unsigned int st_uid; 205009701199SAlexander Graf unsigned int st_gid; 205109701199SAlexander Graf abi_ulong st_rdev; 205209701199SAlexander Graf abi_ulong _pad1; 205309701199SAlexander Graf abi_long st_size; 205409701199SAlexander Graf int st_blksize; 205509701199SAlexander Graf int __pad2; 205609701199SAlexander Graf abi_long st_blocks; 205709701199SAlexander Graf abi_long target_st_atime; 205809701199SAlexander Graf abi_ulong target_st_atime_nsec; 205909701199SAlexander Graf abi_long target_st_mtime; 206009701199SAlexander Graf abi_ulong target_st_mtime_nsec; 206109701199SAlexander Graf abi_long target_st_ctime; 206209701199SAlexander Graf abi_ulong target_st_ctime_nsec; 206309701199SAlexander Graf unsigned int __unused[2]; 206409701199SAlexander Graf }; 2065ba7651fbSMax Filippov #elif defined(TARGET_XTENSA) 20665f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 2067ba7651fbSMax Filippov struct target_stat { 2068ba7651fbSMax Filippov abi_ulong st_dev; 2069ba7651fbSMax Filippov abi_ulong st_ino; 2070ba7651fbSMax Filippov unsigned int st_mode; 2071ba7651fbSMax Filippov unsigned int st_nlink; 2072ba7651fbSMax Filippov unsigned int st_uid; 2073ba7651fbSMax Filippov unsigned int st_gid; 2074ba7651fbSMax Filippov abi_ulong st_rdev; 2075ba7651fbSMax Filippov abi_long st_size; 2076ba7651fbSMax Filippov abi_ulong st_blksize; 2077ba7651fbSMax Filippov abi_ulong st_blocks; 2078ba7651fbSMax Filippov abi_ulong target_st_atime; 2079ba7651fbSMax Filippov abi_ulong target_st_atime_nsec; 2080ba7651fbSMax Filippov abi_ulong target_st_mtime; 2081ba7651fbSMax Filippov abi_ulong target_st_mtime_nsec; 2082ba7651fbSMax Filippov abi_ulong target_st_ctime; 2083ba7651fbSMax Filippov abi_ulong target_st_ctime_nsec; 2084ba7651fbSMax Filippov abi_ulong __unused4; 2085ba7651fbSMax Filippov abi_ulong __unused5; 2086ba7651fbSMax Filippov }; 2087ba7651fbSMax Filippov 2088ba7651fbSMax Filippov #define TARGET_HAS_STRUCT_STAT64 2089ba7651fbSMax Filippov struct target_stat64 { 2090ba7651fbSMax Filippov uint64_t st_dev; /* Device */ 2091ba7651fbSMax Filippov uint64_t st_ino; /* File serial number */ 2092ba7651fbSMax Filippov unsigned int st_mode; /* File mode. */ 2093ba7651fbSMax Filippov unsigned int st_nlink; /* Link count. */ 2094ba7651fbSMax Filippov unsigned int st_uid; /* User ID of the file's owner. */ 2095ba7651fbSMax Filippov unsigned int st_gid; /* Group ID of the file's group. */ 2096ba7651fbSMax Filippov uint64_t st_rdev; /* Device number, if device. */ 2097ba7651fbSMax Filippov int64_t st_size; /* Size of file, in bytes. */ 2098ba7651fbSMax Filippov abi_ulong st_blksize; /* Optimal block size for I/O. */ 2099ba7651fbSMax Filippov abi_ulong __unused2; 2100ba7651fbSMax Filippov uint64_t st_blocks; /* Number 512-byte blocks allocated. */ 2101ba7651fbSMax Filippov abi_ulong target_st_atime; /* Time of last access. */ 2102ba7651fbSMax Filippov abi_ulong target_st_atime_nsec; 2103ba7651fbSMax Filippov abi_ulong target_st_mtime; /* Time of last modification. */ 2104ba7651fbSMax Filippov abi_ulong target_st_mtime_nsec; 2105ba7651fbSMax Filippov abi_ulong target_st_ctime; /* Time of last status change. */ 2106ba7651fbSMax Filippov abi_ulong target_st_ctime_nsec; 2107ba7651fbSMax Filippov abi_ulong __unused4; 2108ba7651fbSMax Filippov abi_ulong __unused5; 2109ba7651fbSMax Filippov }; 2110ba7651fbSMax Filippov 2111a0a839b6SMarek Vasut #elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) || \ 211247ae93cdSMichael Clark defined(TARGET_NIOS2) || defined(TARGET_RISCV) 2113c7819dfbSPeter Maydell 2114c7819dfbSPeter Maydell /* These are the asm-generic versions of the stat and stat64 structures */ 2115c7819dfbSPeter Maydell 21165f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 2117d962783eSJia Liu struct target_stat { 2118d962783eSJia Liu abi_ulong st_dev; 2119d962783eSJia Liu abi_ulong st_ino; 2120d962783eSJia Liu unsigned int st_mode; 2121c7819dfbSPeter Maydell unsigned int st_nlink; 2122d962783eSJia Liu unsigned int st_uid; 2123d962783eSJia Liu unsigned int st_gid; 2124d962783eSJia Liu abi_ulong st_rdev; 2125c7819dfbSPeter Maydell abi_ulong __pad1; 2126d962783eSJia Liu abi_long st_size; 2127c7819dfbSPeter Maydell int st_blksize; 2128c7819dfbSPeter Maydell int __pad2; 2129c7819dfbSPeter Maydell abi_long st_blocks; 2130c7819dfbSPeter Maydell abi_long target_st_atime; 2131d962783eSJia Liu abi_ulong target_st_atime_nsec; 2132c7819dfbSPeter Maydell abi_long target_st_mtime; 2133d962783eSJia Liu abi_ulong target_st_mtime_nsec; 2134c7819dfbSPeter Maydell abi_long target_st_ctime; 2135d962783eSJia Liu abi_ulong target_st_ctime_nsec; 2136c7819dfbSPeter Maydell unsigned int __unused4; 2137c7819dfbSPeter Maydell unsigned int __unused5; 2138d962783eSJia Liu }; 2139c7819dfbSPeter Maydell 214047ae93cdSMichael Clark #if !defined(TARGET_RISCV64) 214120d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 2142c7819dfbSPeter Maydell struct target_stat64 { 2143c7819dfbSPeter Maydell uint64_t st_dev; 2144c7819dfbSPeter Maydell uint64_t st_ino; 2145c7819dfbSPeter Maydell unsigned int st_mode; 2146c7819dfbSPeter Maydell unsigned int st_nlink; 2147c7819dfbSPeter Maydell unsigned int st_uid; 2148c7819dfbSPeter Maydell unsigned int st_gid; 2149c7819dfbSPeter Maydell uint64_t st_rdev; 2150c7819dfbSPeter Maydell uint64_t __pad1; 2151c7819dfbSPeter Maydell int64_t st_size; 2152c7819dfbSPeter Maydell int st_blksize; 2153c7819dfbSPeter Maydell int __pad2; 2154c7819dfbSPeter Maydell int64_t st_blocks; 2155c7819dfbSPeter Maydell int target_st_atime; 2156c7819dfbSPeter Maydell unsigned int target_st_atime_nsec; 2157c7819dfbSPeter Maydell int target_st_mtime; 2158c7819dfbSPeter Maydell unsigned int target_st_mtime_nsec; 2159c7819dfbSPeter Maydell int target_st_ctime; 2160c7819dfbSPeter Maydell unsigned int target_st_ctime_nsec; 2161c7819dfbSPeter Maydell unsigned int __unused4; 2162c7819dfbSPeter Maydell unsigned int __unused5; 2163c7819dfbSPeter Maydell }; 216447ae93cdSMichael Clark #endif 2165c7819dfbSPeter Maydell 2166a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 2167a10d1e50SRichard Henderson 21685f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 2169a10d1e50SRichard Henderson struct target_stat { 2170a10d1e50SRichard Henderson abi_uint st_dev; 2171a10d1e50SRichard Henderson abi_uint st_ino; 2172a10d1e50SRichard Henderson abi_ushort st_mode; 2173a10d1e50SRichard Henderson abi_ushort st_nlink; 2174a10d1e50SRichard Henderson abi_ushort _res1; 2175a10d1e50SRichard Henderson abi_ushort _res2; 2176a10d1e50SRichard Henderson abi_uint st_rdev; 2177a10d1e50SRichard Henderson abi_int st_size; 2178a10d1e50SRichard Henderson abi_int target_st_atime; 2179a10d1e50SRichard Henderson abi_uint target_st_atime_nsec; 2180a10d1e50SRichard Henderson abi_int target_st_mtime; 2181a10d1e50SRichard Henderson abi_uint target_st_mtime_nsec; 2182a10d1e50SRichard Henderson abi_int target_st_ctime; 2183a10d1e50SRichard Henderson abi_uint target_st_ctime_nsec; 2184a10d1e50SRichard Henderson abi_int st_blksize; 2185a10d1e50SRichard Henderson abi_int st_blocks; 2186a10d1e50SRichard Henderson abi_uint _unused1; 2187a10d1e50SRichard Henderson abi_uint _unused2; 2188a10d1e50SRichard Henderson abi_uint _unused3; 2189a10d1e50SRichard Henderson abi_uint _unused4; 2190a10d1e50SRichard Henderson abi_ushort _unused5; 2191a10d1e50SRichard Henderson abi_short st_fstype; 2192a10d1e50SRichard Henderson abi_uint st_realdev; 2193a10d1e50SRichard Henderson abi_ushort st_basemode; 2194a10d1e50SRichard Henderson abi_ushort _unused6; 2195a10d1e50SRichard Henderson abi_uint st_uid; 2196a10d1e50SRichard Henderson abi_uint st_gid; 2197a10d1e50SRichard Henderson abi_uint _unused7[3]; 2198a10d1e50SRichard Henderson }; 2199a10d1e50SRichard Henderson 2200a10d1e50SRichard Henderson #define TARGET_HAS_STRUCT_STAT64 2201a10d1e50SRichard Henderson struct target_stat64 { 2202a10d1e50SRichard Henderson uint64_t st_dev; 2203a10d1e50SRichard Henderson abi_uint _pad1; 2204a10d1e50SRichard Henderson abi_uint _res1; 2205a10d1e50SRichard Henderson abi_uint st_mode; 2206a10d1e50SRichard Henderson abi_uint st_nlink; 2207a10d1e50SRichard Henderson abi_uint st_uid; 2208a10d1e50SRichard Henderson abi_uint st_gid; 2209a10d1e50SRichard Henderson uint64_t st_rdev; 2210a10d1e50SRichard Henderson abi_uint _pad2; 2211a10d1e50SRichard Henderson int64_t st_size; 2212a10d1e50SRichard Henderson abi_int st_blksize; 2213a10d1e50SRichard Henderson int64_t st_blocks; 2214a10d1e50SRichard Henderson abi_int target_st_atime; 2215a10d1e50SRichard Henderson abi_uint target_st_atime_nsec; 2216a10d1e50SRichard Henderson abi_int target_st_mtime; 2217a10d1e50SRichard Henderson abi_uint target_st_mtime_nsec; 2218a10d1e50SRichard Henderson abi_int target_st_ctime; 2219a10d1e50SRichard Henderson abi_uint target_st_ctime_nsec; 2220a10d1e50SRichard Henderson uint64_t st_ino; 2221a10d1e50SRichard Henderson }; 2222a10d1e50SRichard Henderson 2223048f6b4dSbellard #else 2224048f6b4dSbellard #error unsupported CPU 2225048f6b4dSbellard #endif 22262521d698Sbellard 22274ce6f8deSths typedef struct { 22284ce6f8deSths int val[2]; 2229c227f099SAnthony Liguori } target_fsid_t; 22304ce6f8deSths 223156c8f68fSbellard #ifdef TARGET_MIPS 2232d26bc211Sths #ifdef TARGET_ABI_MIPSN32 2233540635baSths struct target_statfs { 2234540635baSths int32_t f_type; 2235540635baSths int32_t f_bsize; 2236540635baSths int32_t f_frsize; /* Fragment size - unsupported */ 2237540635baSths int32_t f_blocks; 2238540635baSths int32_t f_bfree; 2239540635baSths int32_t f_files; 2240540635baSths int32_t f_ffree; 2241540635baSths int32_t f_bavail; 2242540635baSths 2243540635baSths /* Linux specials */ 2244c227f099SAnthony Liguori target_fsid_t f_fsid; 2245540635baSths int32_t f_namelen; 2246d4247ec2SShea Levy int32_t f_flags; 2247d4247ec2SShea Levy int32_t f_spare[5]; 2248540635baSths }; 2249540635baSths #else 225056c8f68fSbellard struct target_statfs { 2251992f48a0Sblueswir1 abi_long f_type; 2252992f48a0Sblueswir1 abi_long f_bsize; 2253992f48a0Sblueswir1 abi_long f_frsize; /* Fragment size - unsupported */ 2254992f48a0Sblueswir1 abi_long f_blocks; 2255992f48a0Sblueswir1 abi_long f_bfree; 2256992f48a0Sblueswir1 abi_long f_files; 2257992f48a0Sblueswir1 abi_long f_ffree; 2258992f48a0Sblueswir1 abi_long f_bavail; 225956c8f68fSbellard 226056c8f68fSbellard /* Linux specials */ 2261c227f099SAnthony Liguori target_fsid_t f_fsid; 2262992f48a0Sblueswir1 abi_long f_namelen; 2263d4247ec2SShea Levy abi_long f_flags; 2264d4247ec2SShea Levy abi_long f_spare[5]; 226556c8f68fSbellard }; 2266540635baSths #endif 226756c8f68fSbellard 226856c8f68fSbellard struct target_statfs64 { 226956c8f68fSbellard uint32_t f_type; 227056c8f68fSbellard uint32_t f_bsize; 227156c8f68fSbellard uint32_t f_frsize; /* Fragment size - unsupported */ 227256c8f68fSbellard uint32_t __pad; 227356c8f68fSbellard uint64_t f_blocks; 227456c8f68fSbellard uint64_t f_bfree; 227556c8f68fSbellard uint64_t f_files; 227656c8f68fSbellard uint64_t f_ffree; 227756c8f68fSbellard uint64_t f_bavail; 2278c227f099SAnthony Liguori target_fsid_t f_fsid; 227956c8f68fSbellard uint32_t f_namelen; 2280d4247ec2SShea Levy uint32_t f_flags; 2281d4247ec2SShea Levy uint32_t f_spare[5]; 228256c8f68fSbellard }; 2283c4d10628Sbalrog #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ 228447ae93cdSMichael Clark defined(TARGET_SPARC64) || defined(TARGET_AARCH64) || \ 228547ae93cdSMichael Clark defined(TARGET_RISCV)) && !defined(TARGET_ABI32) 2286325e651fSj_mayer struct target_statfs { 2287325e651fSj_mayer abi_long f_type; 2288325e651fSj_mayer abi_long f_bsize; 2289325e651fSj_mayer abi_long f_blocks; 2290325e651fSj_mayer abi_long f_bfree; 2291325e651fSj_mayer abi_long f_bavail; 2292325e651fSj_mayer abi_long f_files; 2293325e651fSj_mayer abi_long f_ffree; 2294c227f099SAnthony Liguori target_fsid_t f_fsid; 2295325e651fSj_mayer abi_long f_namelen; 2296325e651fSj_mayer abi_long f_frsize; 2297d4247ec2SShea Levy abi_long f_flags; 2298d4247ec2SShea Levy abi_long f_spare[4]; 2299325e651fSj_mayer }; 2300325e651fSj_mayer 2301325e651fSj_mayer struct target_statfs64 { 2302325e651fSj_mayer abi_long f_type; 2303325e651fSj_mayer abi_long f_bsize; 2304325e651fSj_mayer abi_long f_blocks; 2305325e651fSj_mayer abi_long f_bfree; 2306325e651fSj_mayer abi_long f_bavail; 2307325e651fSj_mayer abi_long f_files; 2308325e651fSj_mayer abi_long f_ffree; 2309c227f099SAnthony Liguori target_fsid_t f_fsid; 2310325e651fSj_mayer abi_long f_namelen; 2311325e651fSj_mayer abi_long f_frsize; 2312d4247ec2SShea Levy abi_long f_flags; 2313d4247ec2SShea Levy abi_long f_spare[4]; 2314325e651fSj_mayer }; 2315a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 2316a4c075f1SUlrich Hecht struct target_statfs { 2317a4c075f1SUlrich Hecht int32_t f_type; 2318a4c075f1SUlrich Hecht int32_t f_bsize; 2319a4c075f1SUlrich Hecht abi_long f_blocks; 2320a4c075f1SUlrich Hecht abi_long f_bfree; 2321a4c075f1SUlrich Hecht abi_long f_bavail; 2322a4c075f1SUlrich Hecht abi_long f_files; 2323a4c075f1SUlrich Hecht abi_long f_ffree; 2324a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2325a4c075f1SUlrich Hecht int32_t f_namelen; 2326a4c075f1SUlrich Hecht int32_t f_frsize; 2327d4247ec2SShea Levy int32_t f_flags; 2328d4247ec2SShea Levy int32_t f_spare[4]; 2329d4247ec2SShea Levy 2330a4c075f1SUlrich Hecht }; 2331a4c075f1SUlrich Hecht 2332a4c075f1SUlrich Hecht struct target_statfs64 { 2333a4c075f1SUlrich Hecht int32_t f_type; 2334a4c075f1SUlrich Hecht int32_t f_bsize; 2335a4c075f1SUlrich Hecht abi_long f_blocks; 2336a4c075f1SUlrich Hecht abi_long f_bfree; 2337a4c075f1SUlrich Hecht abi_long f_bavail; 2338a4c075f1SUlrich Hecht abi_long f_files; 2339a4c075f1SUlrich Hecht abi_long f_ffree; 2340a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2341a4c075f1SUlrich Hecht int32_t f_namelen; 2342a4c075f1SUlrich Hecht int32_t f_frsize; 2343d4247ec2SShea Levy int32_t f_flags; 2344d4247ec2SShea Levy int32_t f_spare[4]; 2345a4c075f1SUlrich Hecht }; 234656c8f68fSbellard #else 234756c8f68fSbellard struct target_statfs { 234856c8f68fSbellard uint32_t f_type; 234956c8f68fSbellard uint32_t f_bsize; 235056c8f68fSbellard uint32_t f_blocks; 235156c8f68fSbellard uint32_t f_bfree; 235256c8f68fSbellard uint32_t f_bavail; 235356c8f68fSbellard uint32_t f_files; 235456c8f68fSbellard uint32_t f_ffree; 2355c227f099SAnthony Liguori target_fsid_t f_fsid; 235656c8f68fSbellard uint32_t f_namelen; 235756c8f68fSbellard uint32_t f_frsize; 2358d4247ec2SShea Levy uint32_t f_flags; 2359d4247ec2SShea Levy uint32_t f_spare[4]; 236056c8f68fSbellard }; 236156c8f68fSbellard 236256c8f68fSbellard struct target_statfs64 { 236356c8f68fSbellard uint32_t f_type; 236456c8f68fSbellard uint32_t f_bsize; 236556c8f68fSbellard uint64_t f_blocks; 236656c8f68fSbellard uint64_t f_bfree; 236756c8f68fSbellard uint64_t f_bavail; 236856c8f68fSbellard uint64_t f_files; 236956c8f68fSbellard uint64_t f_ffree; 2370c227f099SAnthony Liguori target_fsid_t f_fsid; 237156c8f68fSbellard uint32_t f_namelen; 237256c8f68fSbellard uint32_t f_frsize; 2373d4247ec2SShea Levy uint32_t f_flags; 2374d4247ec2SShea Levy uint32_t f_spare[4]; 237556c8f68fSbellard }; 237656c8f68fSbellard #endif 237756c8f68fSbellard 23787e22e546SUlrich Hecht #define TARGET_F_LINUX_SPECIFIC_BASE 1024 23797e22e546SUlrich Hecht #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0) 23807e22e546SUlrich Hecht #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1) 23817e22e546SUlrich Hecht #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) 23827e3b92ecSPeter Maydell #define TARGET_F_SETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 7) 23837e3b92ecSPeter Maydell #define TARGET_F_GETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 8) 23847e22e546SUlrich Hecht #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2) 23857e22e546SUlrich Hecht 23865de7706eSLaurent Vivier #include "target_fcntl.h" 23878d5d3004SAndreas Schwab 23882521d698Sbellard /* soundcard defines */ 238967cc32ebSVeres Lajos /* XXX: convert them all to arch independent entries */ 23902521d698Sbellard #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); 23912521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 23922521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 23932521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 23942521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA 0xc0144302 23952521d698Sbellard #define TARGET_SNDCTL_COPR_RESET 0x00004300 23962521d698Sbellard #define TARGET_SNDCTL_COPR_RUN 0xc0144306 23972521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 23982521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE 0x40144305 23992521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA 0x40144304 24002521d698Sbellard #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) 24012521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) 24022521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) 24032521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) 24042521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) 24052521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) 24062521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) 24072521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) 24082521d698Sbellard #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) 24092521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) 24102521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) 24112521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) 24122521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) 24132521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) 24142521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) 24152521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) 24162521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) 24172521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) 24185f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19) 24195f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20) 24202521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e 24212521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 24222521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 24232521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 24242521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 24252521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f 24262521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 24272521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO 0xc074510c 24282521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 24292521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 24302521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 24312521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 24322521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 24332521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 24342521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 24352521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 24362521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b 24372521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a 24382521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 24392521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC 0x00005111 24402521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 24412521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET 0x00005100 24422521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 24432521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC 0x00005101 24442521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 24452521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d 24462521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d 24472521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 24482521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e 24492521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 24502521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME 0x40045407 24512521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT 0x40045408 24522521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 24532521d698Sbellard #define TARGET_SNDCTL_TMR_START 0x00005402 24542521d698Sbellard #define TARGET_SNDCTL_TMR_STOP 0x00005403 24552521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 24562521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 24572521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE 0x80045002 24582521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 24592521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS 0x80045005 24602521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 24612521d698Sbellard #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) 24622521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 24632521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) 24642521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) 24652521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) 24662521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) 24672521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) 24682521d698Sbellard 24692521d698Sbellard #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) 24702521d698Sbellard 24712521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) 24722521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) 24732521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) 24742521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) 24752521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) 24762521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) 24772521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) 24782521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) 24792521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) 24802521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) 24812521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) 24822521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) 24832521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) 24842521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) 24852521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) 24862521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) 24872521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) 24882521d698Sbellard 24892521d698Sbellard /* Obsolete macros */ 24902521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) 24912521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) 24922521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) 24932521d698Sbellard 24942521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) 24952521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) 24962521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) 24972521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) 24982521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) 24992521d698Sbellard 25002521d698Sbellard #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) 25012521d698Sbellard 25022521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) 25032521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) 25042521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) 25052521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) 25062521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) 25072521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) 25082521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) 25092521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) 25102521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) 25112521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) 25122521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) 25132521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) 25142521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) 25152521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) 25162521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) 25172521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) 25182521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) 25192521d698Sbellard 25202521d698Sbellard /* Obsolete macros */ 25212521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) 25222521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) 25232521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) 25242521d698Sbellard 25252521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) 25262521d698Sbellard 2527aca7708eSFilip Bozuta struct target_snd_timer_id { 2528aca7708eSFilip Bozuta int dev_class; 2529aca7708eSFilip Bozuta int dev_sclass; 2530aca7708eSFilip Bozuta int card; 2531aca7708eSFilip Bozuta int device; 2532aca7708eSFilip Bozuta int subdevice; 2533aca7708eSFilip Bozuta }; 2534aca7708eSFilip Bozuta 2535aca7708eSFilip Bozuta struct target_snd_timer_ginfo { 2536aca7708eSFilip Bozuta struct target_snd_timer_id tid; 2537aca7708eSFilip Bozuta unsigned int flags; 2538aca7708eSFilip Bozuta int card; 2539aca7708eSFilip Bozuta unsigned char id[64]; 2540aca7708eSFilip Bozuta unsigned char name[80]; 2541aca7708eSFilip Bozuta abi_ulong reserved0; 2542aca7708eSFilip Bozuta abi_ulong resolution; 2543aca7708eSFilip Bozuta abi_ulong resolution_min; 2544aca7708eSFilip Bozuta abi_ulong resolution_max; 2545aca7708eSFilip Bozuta unsigned int clients; 2546aca7708eSFilip Bozuta unsigned char reserved[32]; 2547aca7708eSFilip Bozuta }; 2548aca7708eSFilip Bozuta 2549aca7708eSFilip Bozuta struct target_snd_timer_gparams { 2550aca7708eSFilip Bozuta struct target_snd_timer_id tid; 2551aca7708eSFilip Bozuta abi_ulong period_num; 2552aca7708eSFilip Bozuta abi_ulong period_den; 2553aca7708eSFilip Bozuta unsigned char reserved[32]; 2554aca7708eSFilip Bozuta }; 2555aca7708eSFilip Bozuta 2556aca7708eSFilip Bozuta struct target_snd_timer_gstatus { 2557aca7708eSFilip Bozuta struct target_snd_timer_id tid; 2558aca7708eSFilip Bozuta abi_ulong resolution; 2559aca7708eSFilip Bozuta abi_ulong resolution_num; 2560aca7708eSFilip Bozuta abi_ulong resolution_den; 2561aca7708eSFilip Bozuta unsigned char reserved[32]; 2562aca7708eSFilip Bozuta }; 2563aca7708eSFilip Bozuta 2564d22edf0aSFilip Bozuta struct target_snd_timer_select { 2565d22edf0aSFilip Bozuta struct target_snd_timer_id id; 2566d22edf0aSFilip Bozuta unsigned char reserved[32]; 2567d22edf0aSFilip Bozuta }; 2568d22edf0aSFilip Bozuta 2569fe333025SFilip Bozuta struct target_snd_timer_info { 2570fe333025SFilip Bozuta unsigned int flags; 2571fe333025SFilip Bozuta int card; 2572fe333025SFilip Bozuta unsigned char id[64]; 2573fe333025SFilip Bozuta unsigned char name[80]; 2574fe333025SFilip Bozuta abi_ulong reserved0; 2575fe333025SFilip Bozuta abi_ulong resolution; 2576fe333025SFilip Bozuta unsigned char reserved[64]; 2577fe333025SFilip Bozuta }; 2578fe333025SFilip Bozuta 2579fe333025SFilip Bozuta struct target_snd_timer_status { 2580fe333025SFilip Bozuta struct target_timespec tstamp; 2581fe333025SFilip Bozuta unsigned int resolution; 2582fe333025SFilip Bozuta unsigned int lost; 2583fe333025SFilip Bozuta unsigned int overrun; 2584fe333025SFilip Bozuta unsigned int queue; 2585fe333025SFilip Bozuta unsigned char reserved[64]; 2586fe333025SFilip Bozuta }; 2587fe333025SFilip Bozuta 25881c4c6fcdSFilip Bozuta /* alsa timer ioctls */ 25891c4c6fcdSFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_PVERSION TARGET_IOR('T', 0x00, int) 25901c4c6fcdSFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_NEXT_DEVICE TARGET_IOWR('T', 0x01, \ 25911c4c6fcdSFilip Bozuta struct snd_timer_id) 2592aca7708eSFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_GINFO TARGET_IOWR('T', 0x03, \ 2593aca7708eSFilip Bozuta struct target_snd_timer_ginfo) 2594aca7708eSFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_GPARAMS TARGET_IOW('T', 0x04, \ 2595aca7708eSFilip Bozuta struct target_snd_timer_gparams) 2596aca7708eSFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_GSTATUS TARGET_IOWR('T', 0x05, \ 2597aca7708eSFilip Bozuta struct target_snd_timer_gstatus) 2598d22edf0aSFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_SELECT TARGET_IOW('T', 0x10, \ 2599d22edf0aSFilip Bozuta struct target_snd_timer_select) 2600fe333025SFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_INFO TARGET_IOR('T', 0x11, \ 2601fe333025SFilip Bozuta struct target_snd_timer_info) 2602fe333025SFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_PARAMS TARGET_IOW('T', 0x12, \ 2603fe333025SFilip Bozuta struct snd_timer_params) 2604fe333025SFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_STATUS TARGET_IOR('T', 0x14, \ 2605fe333025SFilip Bozuta struct target_snd_timer_status) 2606045823a9SFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_START TARGET_IO('T', 0xa0) 2607045823a9SFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_STOP TARGET_IO('T', 0xa1) 2608045823a9SFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_CONTINUE TARGET_IO('T', 0xa2) 2609045823a9SFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_PAUSE TARGET_IO('T', 0xa3) 26101c4c6fcdSFilip Bozuta 26112521d698Sbellard /* vfat ioctls */ 26122521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) 26132521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) 2614a5448a7dSbellard 2615f443e396SPeter Maydell struct target_mtop { 2616f443e396SPeter Maydell abi_short mt_op; 2617f443e396SPeter Maydell abi_int mt_count; 2618f443e396SPeter Maydell }; 2619f443e396SPeter Maydell 2620f443e396SPeter Maydell #if defined(TARGET_SPARC) || defined(TARGET_MIPS) 2621f443e396SPeter Maydell typedef abi_long target_kernel_daddr_t; 2622f443e396SPeter Maydell #else 2623f443e396SPeter Maydell typedef abi_int target_kernel_daddr_t; 2624f443e396SPeter Maydell #endif 2625f443e396SPeter Maydell 2626f443e396SPeter Maydell struct target_mtget { 2627f443e396SPeter Maydell abi_long mt_type; 2628f443e396SPeter Maydell abi_long mt_resid; 2629f443e396SPeter Maydell abi_long mt_dsreg; 2630f443e396SPeter Maydell abi_long mt_gstat; 2631f443e396SPeter Maydell abi_long mt_erreg; 2632f443e396SPeter Maydell target_kernel_daddr_t mt_fileno; 2633f443e396SPeter Maydell target_kernel_daddr_t mt_blkno; 2634f443e396SPeter Maydell }; 2635f443e396SPeter Maydell 2636f443e396SPeter Maydell struct target_mtpos { 2637f443e396SPeter Maydell abi_long mt_blkno; 2638f443e396SPeter Maydell }; 2639f443e396SPeter Maydell 2640f443e396SPeter Maydell #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct target_mtop) 2641f443e396SPeter Maydell #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct target_mtget) 2642f443e396SPeter Maydell #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct target_mtpos) 26438fbd6b52Sbalrog 2644bd27e675SAleksandar Markovic /* kcov ioctls */ 2645bd27e675SAleksandar Markovic #define TARGET_KCOV_ENABLE TARGET_IO('c', 100) 2646bd27e675SAleksandar Markovic #define TARGET_KCOV_DISABLE TARGET_IO('c', 101) 2647f7dbd8feSAleksandar Markovic #define TARGET_KCOV_INIT_TRACE TARGET_IOR('c', 1, abi_ulong) 2648bd27e675SAleksandar Markovic 2649a5448a7dSbellard struct target_sysinfo { 2650992f48a0Sblueswir1 abi_long uptime; /* Seconds since boot */ 2651992f48a0Sblueswir1 abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */ 2652992f48a0Sblueswir1 abi_ulong totalram; /* Total usable main memory size */ 2653992f48a0Sblueswir1 abi_ulong freeram; /* Available memory size */ 2654992f48a0Sblueswir1 abi_ulong sharedram; /* Amount of shared memory */ 2655992f48a0Sblueswir1 abi_ulong bufferram; /* Memory used by buffers */ 2656992f48a0Sblueswir1 abi_ulong totalswap; /* Total swap space size */ 2657992f48a0Sblueswir1 abi_ulong freeswap; /* swap space still available */ 2658a5448a7dSbellard unsigned short procs; /* Number of current processes */ 2659a5448a7dSbellard unsigned short pad; /* explicit padding for m68k */ 2660992f48a0Sblueswir1 abi_ulong totalhigh; /* Total high memory size */ 2661992f48a0Sblueswir1 abi_ulong freehigh; /* Available high memory size */ 2662a5448a7dSbellard unsigned int mem_unit; /* Memory unit size in bytes */ 2663992f48a0Sblueswir1 char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 2664a5448a7dSbellard }; 26653532fa74Sbellard 26666556a833Saurel32 struct linux_dirent { 26676556a833Saurel32 long d_ino; 26686556a833Saurel32 unsigned long d_off; 26696556a833Saurel32 unsigned short d_reclen; 26706556a833Saurel32 char d_name[256]; /* We must not include limits.h! */ 26716556a833Saurel32 }; 26726556a833Saurel32 26736556a833Saurel32 struct linux_dirent64 { 26746556a833Saurel32 uint64_t d_ino; 26756556a833Saurel32 int64_t d_off; 26766556a833Saurel32 unsigned short d_reclen; 26776556a833Saurel32 unsigned char d_type; 26786556a833Saurel32 char d_name[256]; 26796556a833Saurel32 }; 26806556a833Saurel32 268124e1003aSaurel32 struct target_mq_attr { 268224e1003aSaurel32 abi_long mq_flags; 268324e1003aSaurel32 abi_long mq_maxmsg; 268424e1003aSaurel32 abi_long mq_msgsize; 268524e1003aSaurel32 abi_long mq_curmsgs; 268624e1003aSaurel32 }; 268724e1003aSaurel32 2688e865b97fSChen Gang struct target_drm_version { 2689e865b97fSChen Gang int version_major; 2690e865b97fSChen Gang int version_minor; 2691e865b97fSChen Gang int version_patchlevel; 2692e865b97fSChen Gang abi_ulong name_len; 2693e865b97fSChen Gang abi_ulong name; 2694e865b97fSChen Gang abi_ulong date_len; 2695e865b97fSChen Gang abi_ulong date; 2696e865b97fSChen Gang abi_ulong desc_len; 2697e865b97fSChen Gang abi_ulong desc; 2698e865b97fSChen Gang }; 2699e865b97fSChen Gang 2700913b03c2SChen Gang struct target_drm_i915_getparam { 2701913b03c2SChen Gang int param; 2702913b03c2SChen Gang abi_ulong value; 2703913b03c2SChen Gang }; 2704913b03c2SChen Gang 27053532fa74Sbellard #include "socket.h" 2706637947f1Sths 2707637947f1Sths #include "errno_defs.h" 270803dfe9f8SRiku Voipio 270903dfe9f8SRiku Voipio #define FUTEX_WAIT 0 271003dfe9f8SRiku Voipio #define FUTEX_WAKE 1 271103dfe9f8SRiku Voipio #define FUTEX_FD 2 271203dfe9f8SRiku Voipio #define FUTEX_REQUEUE 3 271303dfe9f8SRiku Voipio #define FUTEX_CMP_REQUEUE 4 271403dfe9f8SRiku Voipio #define FUTEX_WAKE_OP 5 271503dfe9f8SRiku Voipio #define FUTEX_LOCK_PI 6 271603dfe9f8SRiku Voipio #define FUTEX_UNLOCK_PI 7 271703dfe9f8SRiku Voipio #define FUTEX_TRYLOCK_PI 8 271803dfe9f8SRiku Voipio #define FUTEX_WAIT_BITSET 9 271903dfe9f8SRiku Voipio #define FUTEX_WAKE_BITSET 10 272003dfe9f8SRiku Voipio 272103dfe9f8SRiku Voipio #define FUTEX_PRIVATE_FLAG 128 272203dfe9f8SRiku Voipio #define FUTEX_CLOCK_REALTIME 256 272303dfe9f8SRiku Voipio #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) 272403dfe9f8SRiku Voipio 27253b6edd16SPeter Maydell #ifdef CONFIG_EPOLL 2726928bed6aSLaurent Vivier #if defined(TARGET_X86_64) 2727928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED QEMU_PACKED 2728928bed6aSLaurent Vivier #else 2729928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED 2730928bed6aSLaurent Vivier #endif 2731928bed6aSLaurent Vivier 27323b6edd16SPeter Maydell typedef union target_epoll_data { 27333b6edd16SPeter Maydell abi_ulong ptr; 2734928bed6aSLaurent Vivier abi_int fd; 2735928bed6aSLaurent Vivier abi_uint u32; 2736928bed6aSLaurent Vivier abi_ullong u64; 27373b6edd16SPeter Maydell } target_epoll_data_t; 27383b6edd16SPeter Maydell 27393b6edd16SPeter Maydell struct target_epoll_event { 2740928bed6aSLaurent Vivier abi_uint events; 27413b6edd16SPeter Maydell target_epoll_data_t data; 2742928bed6aSLaurent Vivier } TARGET_EPOLL_PACKED; 27432ba7fae3SPeter Maydell 27442ba7fae3SPeter Maydell #define TARGET_EP_MAX_EVENTS (INT_MAX / sizeof(struct target_epoll_event)) 27452ba7fae3SPeter Maydell 27463b6edd16SPeter Maydell #endif 2747163a05a8SPeter Maydell struct target_rlimit64 { 2748163a05a8SPeter Maydell uint64_t rlim_cur; 2749163a05a8SPeter Maydell uint64_t rlim_max; 2750163a05a8SPeter Maydell }; 2751583359a6SAkos PASZTORY 2752583359a6SAkos PASZTORY struct target_ucred { 2753583359a6SAkos PASZTORY uint32_t pid; 2754583359a6SAkos PASZTORY uint32_t uid; 2755583359a6SAkos PASZTORY uint32_t gid; 2756583359a6SAkos PASZTORY }; 2757cb9c377fSPaolo Bonzini 2758aecc8861SAlexander Graf typedef int32_t target_timer_t; 2759905bba13SErik de Castro Lopo 276034d60862SNatanael Copa #define TARGET_SIGEV_MAX_SIZE 64 276134d60862SNatanael Copa 276234d60862SNatanael Copa /* This is architecture-specific but most architectures use the default */ 276334d60862SNatanael Copa #ifdef TARGET_MIPS 276434d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long)) 276534d60862SNatanael Copa #else 276634d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ 276734d60862SNatanael Copa + sizeof(target_sigval_t)) 276834d60862SNatanael Copa #endif 276934d60862SNatanael Copa 277034d60862SNatanael Copa #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ 277134d60862SNatanael Copa - TARGET_SIGEV_PREAMBLE_SIZE) \ 277234d60862SNatanael Copa / sizeof(int32_t)) 277334d60862SNatanael Copa 2774905bba13SErik de Castro Lopo struct target_sigevent { 2775905bba13SErik de Castro Lopo target_sigval_t sigev_value; 277617351c3fSPeter Maydell abi_int sigev_signo; 277717351c3fSPeter Maydell abi_int sigev_notify; 2778905bba13SErik de Castro Lopo union { 277917351c3fSPeter Maydell abi_int _pad[TARGET_SIGEV_PAD_SIZE]; 278017351c3fSPeter Maydell abi_int _tid; 2781905bba13SErik de Castro Lopo 278217351c3fSPeter Maydell /* The kernel (and thus QEMU) never looks at these; 278317351c3fSPeter Maydell * they're only used as part of the ABI between a 278417351c3fSPeter Maydell * userspace program and libc. 278517351c3fSPeter Maydell */ 2786905bba13SErik de Castro Lopo struct { 278717351c3fSPeter Maydell abi_ulong _function; 278817351c3fSPeter Maydell abi_ulong _attribute; 2789905bba13SErik de Castro Lopo } _sigev_thread; 2790905bba13SErik de Castro Lopo } _sigev_un; 2791905bba13SErik de Castro Lopo }; 2792e0eb210eSPeter Maydell 2793e0eb210eSPeter Maydell struct target_user_cap_header { 2794e0eb210eSPeter Maydell uint32_t version; 2795e0eb210eSPeter Maydell int pid; 2796e0eb210eSPeter Maydell }; 2797e0eb210eSPeter Maydell 2798e0eb210eSPeter Maydell struct target_user_cap_data { 2799e0eb210eSPeter Maydell uint32_t effective; 2800e0eb210eSPeter Maydell uint32_t permitted; 2801e0eb210eSPeter Maydell uint32_t inheritable; 2802e0eb210eSPeter Maydell }; 28031b3c4fdfSMarkus Armbruster 2804da2c8ad7SAleksandar Markovic /* from kernel's include/linux/syslog.h */ 2805da2c8ad7SAleksandar Markovic 2806da2c8ad7SAleksandar Markovic /* Close the log. Currently a NOP. */ 2807da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CLOSE 0 2808da2c8ad7SAleksandar Markovic /* Open the log. Currently a NOP. */ 2809da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_OPEN 1 2810da2c8ad7SAleksandar Markovic /* Read from the log. */ 2811da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ 2 2812da2c8ad7SAleksandar Markovic /* Read all messages remaining in the ring buffer. */ 2813da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ_ALL 3 2814da2c8ad7SAleksandar Markovic /* Read and clear all messages remaining in the ring buffer */ 2815da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ_CLEAR 4 2816da2c8ad7SAleksandar Markovic /* Clear ring buffer. */ 2817da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CLEAR 5 2818da2c8ad7SAleksandar Markovic /* Disable printk's to console */ 2819da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_OFF 6 2820da2c8ad7SAleksandar Markovic /* Enable printk's to console */ 2821da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_ON 7 2822da2c8ad7SAleksandar Markovic /* Set level of messages printed to console */ 2823da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_LEVEL 8 2824da2c8ad7SAleksandar Markovic /* Return number of unread characters in the log buffer */ 2825da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_SIZE_UNREAD 9 2826da2c8ad7SAleksandar Markovic /* Return size of the log buffer */ 2827da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10 2828da2c8ad7SAleksandar Markovic 2829efa92184SAleksandar Rikalo struct target_statx_timestamp { 2830efa92184SAleksandar Rikalo int64_t tv_sec; 2831efa92184SAleksandar Rikalo uint32_t tv_nsec; 2832efa92184SAleksandar Rikalo int32_t __reserved; 2833efa92184SAleksandar Rikalo }; 2834efa92184SAleksandar Rikalo 2835efa92184SAleksandar Rikalo struct target_statx { 2836efa92184SAleksandar Rikalo /* 0x00 */ 2837efa92184SAleksandar Rikalo uint32_t stx_mask; /* What results were written [uncond] */ 2838efa92184SAleksandar Rikalo uint32_t stx_blksize; /* Preferred general I/O size [uncond] */ 2839efa92184SAleksandar Rikalo uint64_t stx_attributes; /* Flags conveying information about the file */ 2840efa92184SAleksandar Rikalo /* 0x10 */ 2841efa92184SAleksandar Rikalo uint32_t stx_nlink; /* Number of hard links */ 2842efa92184SAleksandar Rikalo uint32_t stx_uid; /* User ID of owner */ 2843efa92184SAleksandar Rikalo uint32_t stx_gid; /* Group ID of owner */ 2844efa92184SAleksandar Rikalo uint16_t stx_mode; /* File mode */ 2845efa92184SAleksandar Rikalo uint16_t __spare0[1]; 2846efa92184SAleksandar Rikalo /* 0x20 */ 2847efa92184SAleksandar Rikalo uint64_t stx_ino; /* Inode number */ 2848efa92184SAleksandar Rikalo uint64_t stx_size; /* File size */ 2849efa92184SAleksandar Rikalo uint64_t stx_blocks; /* Number of 512-byte blocks allocated */ 2850efa92184SAleksandar Rikalo uint64_t stx_attributes_mask; /* Mask to show what is supported */ 2851efa92184SAleksandar Rikalo /* 0x40 */ 2852efa92184SAleksandar Rikalo struct target_statx_timestamp stx_atime; /* Last access time */ 2853efa92184SAleksandar Rikalo struct target_statx_timestamp stx_btime; /* File creation time */ 2854efa92184SAleksandar Rikalo struct target_statx_timestamp stx_ctime; /* Last attribute change time */ 2855efa92184SAleksandar Rikalo struct target_statx_timestamp stx_mtime; /* Last data modification time */ 2856efa92184SAleksandar Rikalo /* 0x80 */ 2857efa92184SAleksandar Rikalo uint32_t stx_rdev_major; /* Device ID of special file [if bdev/cdev] */ 2858efa92184SAleksandar Rikalo uint32_t stx_rdev_minor; 2859efa92184SAleksandar Rikalo uint32_t stx_dev_major; /* ID of device containing file [uncond] */ 2860efa92184SAleksandar Rikalo uint32_t stx_dev_minor; 2861efa92184SAleksandar Rikalo /* 0x90 */ 2862efa92184SAleksandar Rikalo uint64_t __spare2[14]; /* Spare space for future expansion */ 2863efa92184SAleksandar Rikalo /* 0x100 */ 2864efa92184SAleksandar Rikalo }; 2865efa92184SAleksandar Rikalo 28661b3c4fdfSMarkus Armbruster #endif 2867