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)) \ 64baead642SPhilippe Mathieu-Daudé || (defined(TARGET_SPARC) && defined(TARGET_ABI32)) \ 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 70f6ee1627SRichard Henderson #define target_id abi_uint 7174d753acSMika Westerberg #endif 7274d753acSMika Westerberg 73e6e5906bSpbrook #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ 74b16189b2SChen Gang || defined(TARGET_M68K) || defined(TARGET_CRIS) \ 752cc1a901SThomas Huth || defined(TARGET_S390X) || defined(TARGET_OPENRISC) \ 76ba7651fbSMax Filippov || defined(TARGET_NIOS2) || defined(TARGET_RISCV) \ 771f630196SSong Gao || defined(TARGET_XTENSA) || defined(TARGET_LOONGARCH64) 782521d698Sbellard 792521d698Sbellard #define TARGET_IOC_SIZEBITS 14 802521d698Sbellard #define TARGET_IOC_DIRBITS 2 812521d698Sbellard 822521d698Sbellard #define TARGET_IOC_NONE 0U 832521d698Sbellard #define TARGET_IOC_WRITE 1U 842521d698Sbellard #define TARGET_IOC_READ 2U 852521d698Sbellard 86048f6b4dSbellard #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ 87b779e29eSEdgar E. Iglesias defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \ 88b779e29eSEdgar E. Iglesias defined(TARGET_MIPS) 892521d698Sbellard 902521d698Sbellard #define TARGET_IOC_SIZEBITS 13 912521d698Sbellard #define TARGET_IOC_DIRBITS 3 922521d698Sbellard 932521d698Sbellard #define TARGET_IOC_NONE 1U 942521d698Sbellard #define TARGET_IOC_READ 2U 952521d698Sbellard #define TARGET_IOC_WRITE 4U 962521d698Sbellard 97a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 98a10d1e50SRichard Henderson 99a10d1e50SRichard Henderson #define TARGET_IOC_SIZEBITS 14 100a10d1e50SRichard Henderson #define TARGET_IOC_DIRBITS 2 101a10d1e50SRichard Henderson 102a10d1e50SRichard Henderson #define TARGET_IOC_NONE 0U 103a10d1e50SRichard Henderson #define TARGET_IOC_WRITE 2U 104a10d1e50SRichard Henderson #define TARGET_IOC_READ 1U 105a10d1e50SRichard Henderson 106d2a56bd2STaylor Simpson #elif defined(TARGET_HEXAGON) 107d2a56bd2STaylor Simpson 108d2a56bd2STaylor Simpson #define TARGET_IOC_SIZEBITS 14 109d2a56bd2STaylor Simpson 110d2a56bd2STaylor Simpson #define TARGET_IOC_NONE 0U 111d2a56bd2STaylor Simpson #define TARGET_IOC_WRITE 1U 112d2a56bd2STaylor Simpson #define TARGET_IOC_READ 2U 113d2a56bd2STaylor Simpson 1142521d698Sbellard #else 1152521d698Sbellard #error unsupported CPU 1162521d698Sbellard #endif 1172521d698Sbellard 1182521d698Sbellard #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) 1192521d698Sbellard #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) 1202521d698Sbellard #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) 1212521d698Sbellard #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) 1222521d698Sbellard 1232521d698Sbellard #define TARGET_IOC_NRSHIFT 0 1242521d698Sbellard #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) 1252521d698Sbellard #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) 1262521d698Sbellard #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) 1272521d698Sbellard 1282521d698Sbellard #define TARGET_IOC(dir,type,nr,size) \ 1292521d698Sbellard (((dir) << TARGET_IOC_DIRSHIFT) | \ 1302521d698Sbellard ((type) << TARGET_IOC_TYPESHIFT) | \ 1312521d698Sbellard ((nr) << TARGET_IOC_NRSHIFT) | \ 1322521d698Sbellard ((size) << TARGET_IOC_SIZESHIFT)) 1332521d698Sbellard 1342521d698Sbellard /* used to create numbers */ 1352521d698Sbellard #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) 1362521d698Sbellard #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) 1372521d698Sbellard #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1382521d698Sbellard #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1392521d698Sbellard 1402521d698Sbellard /* the size is automatically computed for these defines */ 1412521d698Sbellard #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) 1422521d698Sbellard #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1432521d698Sbellard #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1442521d698Sbellard 1457854b056Sbellard struct target_sockaddr { 1469a68960dSPhilippe Mathieu-Daudé abi_ushort sa_family; 1477854b056Sbellard uint8_t sa_data[14]; 1487854b056Sbellard }; 1497854b056Sbellard 15033a29b51SJoakim Tjernlund struct target_sockaddr_ll { 1519a68960dSPhilippe Mathieu-Daudé abi_ushort sll_family; /* Always AF_PACKET */ 1529a68960dSPhilippe Mathieu-Daudé abi_ushort sll_protocol; /* Physical layer protocol */ 1539a68960dSPhilippe Mathieu-Daudé abi_int sll_ifindex; /* Interface number */ 1549a68960dSPhilippe Mathieu-Daudé abi_ushort sll_hatype; /* ARP hardware type */ 15533a29b51SJoakim Tjernlund uint8_t sll_pkttype; /* Packet type */ 15633a29b51SJoakim Tjernlund uint8_t sll_halen; /* Length of address */ 15733a29b51SJoakim Tjernlund uint8_t sll_addr[8]; /* Physical layer address */ 15833a29b51SJoakim Tjernlund }; 15933a29b51SJoakim Tjernlund 160fb3aabf3SLaurent Vivier struct target_sockaddr_un { 1619a68960dSPhilippe Mathieu-Daudé abi_ushort su_family; 162fb3aabf3SLaurent Vivier uint8_t sun_path[108]; 163fb3aabf3SLaurent Vivier }; 164fb3aabf3SLaurent Vivier 165a47401bcSPhilippe Mathieu-Daudé struct target_sockaddr_nl { 166a47401bcSPhilippe Mathieu-Daudé abi_ushort nl_family; /* AF_NETLINK */ 167a47401bcSPhilippe Mathieu-Daudé abi_ushort __pad; 168a47401bcSPhilippe Mathieu-Daudé abi_uint nl_pid; 169a47401bcSPhilippe Mathieu-Daudé abi_uint nl_groups; 170a47401bcSPhilippe Mathieu-Daudé }; 171a47401bcSPhilippe Mathieu-Daudé 172fb3aabf3SLaurent Vivier struct target_in_addr { 1739a68960dSPhilippe Mathieu-Daudé abi_uint s_addr; /* big endian */ 174fb3aabf3SLaurent Vivier }; 175fb3aabf3SLaurent Vivier 176fb3aabf3SLaurent Vivier struct target_sockaddr_in { 1779a68960dSPhilippe Mathieu-Daudé abi_ushort sin_family; 1789a68960dSPhilippe Mathieu-Daudé abi_short sin_port; /* big endian */ 179fb3aabf3SLaurent Vivier struct target_in_addr sin_addr; 180fb3aabf3SLaurent Vivier uint8_t __pad[sizeof(struct target_sockaddr) - 1819a68960dSPhilippe Mathieu-Daudé sizeof(abi_ushort) - sizeof(abi_short) - 182fb3aabf3SLaurent Vivier sizeof(struct target_in_addr)]; 183fb3aabf3SLaurent Vivier }; 184fb3aabf3SLaurent Vivier 185ee1ac3a1SHelge Deller struct target_sockaddr_in6 { 1869a68960dSPhilippe Mathieu-Daudé abi_ushort sin6_family; 1879a68960dSPhilippe Mathieu-Daudé abi_ushort sin6_port; /* big endian */ 1889a68960dSPhilippe Mathieu-Daudé abi_uint sin6_flowinfo; /* big endian */ 189ee1ac3a1SHelge Deller struct in6_addr sin6_addr; /* IPv6 address, big endian */ 1909a68960dSPhilippe Mathieu-Daudé abi_uint sin6_scope_id; 191ee1ac3a1SHelge Deller }; 192ee1ac3a1SHelge Deller 193f57d4192SLaurent Vivier struct target_sock_filter { 194f57d4192SLaurent Vivier abi_ushort code; 195f57d4192SLaurent Vivier uint8_t jt; 196f57d4192SLaurent Vivier uint8_t jf; 197f57d4192SLaurent Vivier abi_uint k; 198f57d4192SLaurent Vivier }; 199f57d4192SLaurent Vivier 200f57d4192SLaurent Vivier struct target_sock_fprog { 201f57d4192SLaurent Vivier abi_ushort len; 202f57d4192SLaurent Vivier abi_ulong filter; 203f57d4192SLaurent Vivier }; 204f57d4192SLaurent Vivier 205b975b83bSLionel Landwerlin struct target_ip_mreq { 206b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 207b975b83bSLionel Landwerlin struct target_in_addr imr_address; 208b975b83bSLionel Landwerlin }; 209b975b83bSLionel Landwerlin 210b975b83bSLionel Landwerlin struct target_ip_mreqn { 211b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 212b975b83bSLionel Landwerlin struct target_in_addr imr_address; 213b975b83bSLionel Landwerlin abi_long imr_ifindex; 214b975b83bSLionel Landwerlin }; 215b975b83bSLionel Landwerlin 2166e3cb58fSLionel Landwerlin struct target_ip_mreq_source { 2176e3cb58fSLionel Landwerlin /* big endian */ 218f6ee1627SRichard Henderson abi_uint imr_multiaddr; 219f6ee1627SRichard Henderson abi_uint imr_interface; 220f6ee1627SRichard Henderson abi_uint imr_sourceaddr; 2216e3cb58fSLionel Landwerlin }; 2226e3cb58fSLionel Landwerlin 22383eb6e50SCarlo Marcelo Arenas Belón struct target_linger { 22483eb6e50SCarlo Marcelo Arenas Belón abi_int l_onoff; /* Linger active */ 22583eb6e50SCarlo Marcelo Arenas Belón abi_int l_linger; /* How long to linger for */ 22683eb6e50SCarlo Marcelo Arenas Belón }; 22783eb6e50SCarlo Marcelo Arenas Belón 2286d5d5ddeSDaniel P. Berrangé #if defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 2296d5d5ddeSDaniel P. Berrangé struct target_timeval { 2306d5d5ddeSDaniel P. Berrangé abi_long tv_sec; 2316d5d5ddeSDaniel P. Berrangé abi_int tv_usec; 2326d5d5ddeSDaniel P. Berrangé }; 2336d5d5ddeSDaniel P. Berrangé #define target__kernel_sock_timeval target_timeval 2346d5d5ddeSDaniel P. Berrangé #else 23531e31b8aSbellard struct target_timeval { 236992f48a0Sblueswir1 abi_long tv_sec; 237992f48a0Sblueswir1 abi_long tv_usec; 23831e31b8aSbellard }; 23931e31b8aSbellard 2406d5d5ddeSDaniel P. Berrangé struct target__kernel_sock_timeval { 2416d5d5ddeSDaniel P. Berrangé abi_llong tv_sec; 2426d5d5ddeSDaniel P. Berrangé abi_llong tv_usec; 2436d5d5ddeSDaniel P. Berrangé }; 2446d5d5ddeSDaniel P. Berrangé #endif 2456d5d5ddeSDaniel P. Berrangé 2461b6b029eSbellard struct target_timespec { 247992f48a0Sblueswir1 abi_long tv_sec; 248992f48a0Sblueswir1 abi_long tv_nsec; 2491b6b029eSbellard }; 2501b6b029eSbellard 2516d5d5ddeSDaniel P. Berrangé struct target__kernel_timespec { 2526d5d5ddeSDaniel P. Berrangé abi_llong tv_sec; 2536d5d5ddeSDaniel P. Berrangé abi_llong tv_nsec; 2546d5d5ddeSDaniel P. Berrangé }; 2556d5d5ddeSDaniel P. Berrangé 256ef4467e9SPaul Burton struct target_timezone { 257ef4467e9SPaul Burton abi_int tz_minuteswest; 258ef4467e9SPaul Burton abi_int tz_dsttime; 259ef4467e9SPaul Burton }; 260ef4467e9SPaul Burton 26166fb9763Sbellard struct target_itimerval { 26266fb9763Sbellard struct target_timeval it_interval; 26366fb9763Sbellard struct target_timeval it_value; 26466fb9763Sbellard }; 26566fb9763Sbellard 266905bba13SErik de Castro Lopo struct target_itimerspec { 267905bba13SErik de Castro Lopo struct target_timespec it_interval; 268905bba13SErik de Castro Lopo struct target_timespec it_value; 269905bba13SErik de Castro Lopo }; 270905bba13SErik de Castro Lopo 271828cb3a1SFilip Bozuta struct target__kernel_itimerspec { 272828cb3a1SFilip Bozuta struct target__kernel_timespec it_interval; 273828cb3a1SFilip Bozuta struct target__kernel_timespec it_value; 274828cb3a1SFilip Bozuta }; 275828cb3a1SFilip Bozuta 27619f59bceSAleksandar Markovic struct target_timex { 27719f59bceSAleksandar Markovic abi_uint modes; /* Mode selector */ 27819f59bceSAleksandar Markovic abi_long offset; /* Time offset */ 27919f59bceSAleksandar Markovic abi_long freq; /* Frequency offset */ 28019f59bceSAleksandar Markovic abi_long maxerror; /* Maximum error (microseconds) */ 28119f59bceSAleksandar Markovic abi_long esterror; /* Estimated error (microseconds) */ 28219f59bceSAleksandar Markovic abi_int status; /* Clock command/status */ 28319f59bceSAleksandar Markovic abi_long constant; /* PLL (phase-locked loop) time constant */ 28419f59bceSAleksandar Markovic abi_long precision; /* Clock precision (microseconds, ro) */ 28519f59bceSAleksandar Markovic abi_long tolerance; /* Clock freq. tolerance (ppm, ro) */ 28619f59bceSAleksandar Markovic struct target_timeval time; /* Current time */ 28719f59bceSAleksandar Markovic abi_long tick; /* Microseconds between clock ticks */ 28819f59bceSAleksandar Markovic abi_long ppsfreq; /* PPS (pulse per second) frequency */ 28919f59bceSAleksandar Markovic abi_long jitter; /* PPS jitter (ro); nanoseconds */ 29019f59bceSAleksandar Markovic abi_int shift; /* PPS interval duration (seconds) */ 29119f59bceSAleksandar Markovic abi_long stabil; /* PPS stability */ 29219f59bceSAleksandar Markovic abi_long jitcnt; /* PPS jitter limit exceeded (ro) */ 29319f59bceSAleksandar Markovic abi_long calcnt; /* PPS calibration intervals */ 29419f59bceSAleksandar Markovic abi_long errcnt; /* PPS calibration errors */ 29519f59bceSAleksandar Markovic abi_long stbcnt; /* PPS stability limit exceeded */ 29619f59bceSAleksandar Markovic abi_int tai; /* TAI offset */ 29719f59bceSAleksandar Markovic 29819f59bceSAleksandar Markovic /* Further padding bytes to allow for future expansion */ 29919f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; abi_int:32; 30019f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; abi_int:32; 30119f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; 30219f59bceSAleksandar Markovic }; 30319f59bceSAleksandar Markovic 3046ac03b2cSFilip Bozuta struct target__kernel_timex { 3056ac03b2cSFilip Bozuta abi_uint modes; /* Mode selector */ 3066ac03b2cSFilip Bozuta abi_int: 32; /* pad */ 3076ac03b2cSFilip Bozuta abi_llong offset; /* Time offset */ 3086ac03b2cSFilip Bozuta abi_llong freq; /* Frequency offset */ 3096ac03b2cSFilip Bozuta abi_llong maxerror; /* Maximum error (microseconds) */ 3106ac03b2cSFilip Bozuta abi_llong esterror; /* Estimated error (microseconds) */ 3116ac03b2cSFilip Bozuta abi_int status; /* Clock command/status */ 3126ac03b2cSFilip Bozuta abi_int: 32; /* pad */ 3136ac03b2cSFilip Bozuta abi_llong constant; /* PLL (phase-locked loop) time constant */ 3146ac03b2cSFilip Bozuta abi_llong precision; /* Clock precision (microseconds, ro) */ 3156ac03b2cSFilip Bozuta abi_llong tolerance; /* Clock freq. tolerance (ppm, ro) */ 3166ac03b2cSFilip Bozuta struct target__kernel_sock_timeval time; /* Current time */ 3176ac03b2cSFilip Bozuta abi_llong tick; /* Microseconds between clock ticks */ 3186ac03b2cSFilip Bozuta abi_llong ppsfreq; /* PPS (pulse per second) frequency */ 3196ac03b2cSFilip Bozuta abi_llong jitter; /* PPS jitter (ro); nanoseconds */ 3206ac03b2cSFilip Bozuta abi_int shift; /* PPS interval duration (seconds) */ 3216ac03b2cSFilip Bozuta abi_int: 32; /* pad */ 3226ac03b2cSFilip Bozuta abi_llong stabil; /* PPS stability */ 3236ac03b2cSFilip Bozuta abi_llong jitcnt; /* PPS jitter limit exceeded (ro) */ 3246ac03b2cSFilip Bozuta abi_llong calcnt; /* PPS calibration intervals */ 3256ac03b2cSFilip Bozuta abi_llong errcnt; /* PPS calibration errors */ 3266ac03b2cSFilip Bozuta abi_llong stbcnt; /* PPS stability limit exceeded */ 3276ac03b2cSFilip Bozuta abi_int tai; /* TAI offset */ 3286ac03b2cSFilip Bozuta 3296ac03b2cSFilip Bozuta /* Further padding bytes to allow for future expansion */ 3306ac03b2cSFilip Bozuta abi_int:32; abi_int:32; abi_int:32; abi_int:32; 3316ac03b2cSFilip Bozuta abi_int:32; abi_int:32; abi_int:32; abi_int:32; 3326ac03b2cSFilip Bozuta abi_int:32; abi_int:32; abi_int:32; 3336ac03b2cSFilip Bozuta }; 3346ac03b2cSFilip Bozuta 335c227f099SAnthony Liguori typedef abi_long target_clock_t; 33632f36bceSbellard 337c596ed17Sbellard #define TARGET_HZ 100 338c596ed17Sbellard 33932f36bceSbellard struct target_tms { 340c227f099SAnthony Liguori target_clock_t tms_utime; 341c227f099SAnthony Liguori target_clock_t tms_stime; 342c227f099SAnthony Liguori target_clock_t tms_cutime; 343c227f099SAnthony Liguori target_clock_t tms_cstime; 34432f36bceSbellard }; 34532f36bceSbellard 3466180a181Sbellard struct target_utimbuf { 347992f48a0Sblueswir1 abi_long actime; 348992f48a0Sblueswir1 abi_long modtime; 3496180a181Sbellard }; 3506180a181Sbellard 351f2674e31Sbellard struct target_sel_arg_struct { 352992f48a0Sblueswir1 abi_long n; 353992f48a0Sblueswir1 abi_long inp, outp, exp; 354992f48a0Sblueswir1 abi_long tvp; 355f2674e31Sbellard }; 356f2674e31Sbellard 35731e31b8aSbellard struct target_iovec { 358992f48a0Sblueswir1 abi_long iov_base; /* Starting address */ 359992f48a0Sblueswir1 abi_long iov_len; /* Number of bytes */ 36031e31b8aSbellard }; 36131e31b8aSbellard 3621a9353d2Sbellard struct target_msghdr { 363992f48a0Sblueswir1 abi_long msg_name; /* Socket name */ 364b3c719b2SRichard Henderson abi_int msg_namelen; /* Length of name */ 365992f48a0Sblueswir1 abi_long msg_iov; /* Data blocks */ 366992f48a0Sblueswir1 abi_long msg_iovlen; /* Number of blocks */ 367992f48a0Sblueswir1 abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ 368992f48a0Sblueswir1 abi_long msg_controllen; /* Length of cmsg list */ 369c7828bd1SRichard Henderson abi_uint msg_flags; 3701a9353d2Sbellard }; 3711a9353d2Sbellard 3727854b056Sbellard struct target_cmsghdr { 373992f48a0Sblueswir1 abi_long cmsg_len; 374b3c719b2SRichard Henderson abi_int cmsg_level; 375b3c719b2SRichard Henderson abi_int cmsg_type; 3767854b056Sbellard }; 3777854b056Sbellard 3787854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) 379ee104587SJonathan Neuschäfer #define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \ 380ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start) 381992f48a0Sblueswir1 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ 382992f48a0Sblueswir1 & (size_t) ~(sizeof (abi_long) - 1)) 383ad762b99SPeter Maydell #define TARGET_CMSG_SPACE(len) (sizeof(struct target_cmsghdr) + \ 384ad762b99SPeter Maydell TARGET_CMSG_ALIGN(len)) 385ad762b99SPeter Maydell #define TARGET_CMSG_LEN(len) (sizeof(struct target_cmsghdr) + (len)) 3867854b056Sbellard 3877854b056Sbellard static __inline__ struct target_cmsghdr * 388ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(struct target_msghdr *__mhdr, 389ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg, 390ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg_start) 3917854b056Sbellard { 3922b8bdefcSths struct target_cmsghdr *__ptr; 3937854b056Sbellard 3942b8bdefcSths __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg 395cbb21eedSMatthias Braun + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len))); 396ee104587SJonathan Neuschäfer if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start) 397ee104587SJonathan Neuschäfer > tswapal(__mhdr->msg_controllen)) { 3987854b056Sbellard /* No more entries. */ 3992b8bdefcSths return (struct target_cmsghdr *)0; 400ee104587SJonathan Neuschäfer } 401ee104587SJonathan Neuschäfer return __ptr; 4027854b056Sbellard } 4037854b056Sbellard 404f19e00d7SAlexander Graf struct target_mmsghdr { 405f19e00d7SAlexander Graf struct target_msghdr msg_hdr; /* Message header */ 406c7828bd1SRichard Henderson abi_uint msg_len; /* Number of bytes transmitted */ 407f19e00d7SAlexander Graf }; 4087854b056Sbellard 40931e31b8aSbellard struct target_rusage { 41031e31b8aSbellard struct target_timeval ru_utime; /* user time used */ 41131e31b8aSbellard struct target_timeval ru_stime; /* system time used */ 412992f48a0Sblueswir1 abi_long ru_maxrss; /* maximum resident set size */ 413992f48a0Sblueswir1 abi_long ru_ixrss; /* integral shared memory size */ 414992f48a0Sblueswir1 abi_long ru_idrss; /* integral unshared data size */ 415992f48a0Sblueswir1 abi_long ru_isrss; /* integral unshared stack size */ 416992f48a0Sblueswir1 abi_long ru_minflt; /* page reclaims */ 417992f48a0Sblueswir1 abi_long ru_majflt; /* page faults */ 418992f48a0Sblueswir1 abi_long ru_nswap; /* swaps */ 419992f48a0Sblueswir1 abi_long ru_inblock; /* block input operations */ 420992f48a0Sblueswir1 abi_long ru_oublock; /* block output operations */ 421992f48a0Sblueswir1 abi_long ru_msgsnd; /* messages sent */ 422992f48a0Sblueswir1 abi_long ru_msgrcv; /* messages received */ 423992f48a0Sblueswir1 abi_long ru_nsignals; /* signals received */ 424992f48a0Sblueswir1 abi_long ru_nvcsw; /* voluntary context switches */ 425992f48a0Sblueswir1 abi_long ru_nivcsw; /* involuntary " */ 42631e31b8aSbellard }; 42731e31b8aSbellard 42831e31b8aSbellard typedef struct { 429b3c719b2SRichard Henderson abi_int val[2]; 430c227f099SAnthony Liguori } kernel_fsid_t; 43131e31b8aSbellard 432dab2ed99Sbellard struct target_dirent { 433992f48a0Sblueswir1 abi_long d_ino; 434992f48a0Sblueswir1 abi_long d_off; 43577e935f4SRichard Henderson abi_ushort d_reclen; 436333858b7SDmitry V. Levin char d_name[]; 437dab2ed99Sbellard }; 438dab2ed99Sbellard 439dab2ed99Sbellard struct target_dirent64 { 4401962cb00SRichard Henderson abi_ullong d_ino; 4411962cb00SRichard Henderson abi_llong d_off; 4421962cb00SRichard Henderson abi_ushort d_reclen; 443dab2ed99Sbellard unsigned char d_type; 444540a736fSRichard Henderson char d_name[]; 445dab2ed99Sbellard }; 446dab2ed99Sbellard 447dab2ed99Sbellard 44831e31b8aSbellard /* mostly generic signal stuff */ 449992f48a0Sblueswir1 #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ 450992f48a0Sblueswir1 #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ 451992f48a0Sblueswir1 #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ 45231e31b8aSbellard 45331e31b8aSbellard #ifdef TARGET_MIPS 45431e31b8aSbellard #define TARGET_NSIG 128 45531e31b8aSbellard #else 45631e31b8aSbellard #define TARGET_NSIG 64 45731e31b8aSbellard #endif 458992f48a0Sblueswir1 #define TARGET_NSIG_BPW TARGET_ABI_BITS 45931e31b8aSbellard #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) 46031e31b8aSbellard 46131e31b8aSbellard typedef struct { 462992f48a0Sblueswir1 abi_ulong sig[TARGET_NSIG_WORDS]; 463c227f099SAnthony Liguori } target_sigset_t; 46431e31b8aSbellard 46566fb9763Sbellard #ifdef BSWAP_NEEDED 466c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 46766fb9763Sbellard { 46866fb9763Sbellard int i; 46966fb9763Sbellard for(i = 0;i < TARGET_NSIG_WORDS; i++) 470cbb21eedSMatthias Braun d->sig[i] = tswapal(s->sig[i]); 47166fb9763Sbellard } 47266fb9763Sbellard #else 473c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 47466fb9763Sbellard { 47566fb9763Sbellard *d = *s; 47666fb9763Sbellard } 47766fb9763Sbellard #endif 47866fb9763Sbellard 479c227f099SAnthony Liguori static inline void target_siginitset(target_sigset_t *d, abi_ulong set) 48066fb9763Sbellard { 48166fb9763Sbellard int i; 48266fb9763Sbellard d->sig[0] = set; 48366fb9763Sbellard for(i = 1;i < TARGET_NSIG_WORDS; i++) 48466fb9763Sbellard d->sig[i] = 0; 48566fb9763Sbellard } 48666fb9763Sbellard 487c227f099SAnthony Liguori void host_to_target_sigset(target_sigset_t *d, const sigset_t *s); 488c227f099SAnthony Liguori void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); 489992f48a0Sblueswir1 void host_to_target_old_sigset(abi_ulong *old_sigset, 49066fb9763Sbellard const sigset_t *sigset); 49166fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset, 492992f48a0Sblueswir1 const abi_ulong *old_sigset); 49366fb9763Sbellard struct target_sigaction; 49466fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act, 49502fb28e8SRichard Henderson struct target_sigaction *oact, abi_ulong ka_restorer); 49666fb9763Sbellard 4979850f9f6SLaurent Vivier #include "target_signal.h" 4989850f9f6SLaurent Vivier 4997f047de1SRichard Henderson #ifdef TARGET_SA_RESTORER 5007f047de1SRichard Henderson #define TARGET_ARCH_HAS_SA_RESTORER 1 5017f047de1SRichard Henderson #endif 5027f047de1SRichard Henderson 5036049f4f8SRichard Henderson #if defined(TARGET_ALPHA) 5045dc0c971SRichard Henderson typedef abi_int target_old_sa_flags; 50502d0de10SRichard Henderson #else 50602d0de10SRichard Henderson typedef abi_ulong target_old_sa_flags; 50702d0de10SRichard Henderson #endif 508106ec879Sbellard 50902d0de10SRichard Henderson #if defined(TARGET_MIPS) 510106ec879Sbellard struct target_sigaction { 511f6ee1627SRichard Henderson abi_uint sa_flags; 512d26bc211Sths #if defined(TARGET_ABI_MIPSN32) 513f6ee1627SRichard Henderson abi_uint _sa_handler; 514540635baSths #else 515992f48a0Sblueswir1 abi_ulong _sa_handler; 516540635baSths #endif 517c227f099SAnthony Liguori target_sigset_t sa_mask; 5187f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 5197f047de1SRichard Henderson /* ??? This is always present, but ignored unless O32. */ 5207f047de1SRichard Henderson abi_ulong sa_restorer; 5217f047de1SRichard Henderson #endif 522106ec879Sbellard }; 523106ec879Sbellard #else 5242521d698Sbellard struct target_old_sigaction { 525992f48a0Sblueswir1 abi_ulong _sa_handler; 526992f48a0Sblueswir1 abi_ulong sa_mask; 52702d0de10SRichard Henderson target_old_sa_flags sa_flags; 5287f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 529992f48a0Sblueswir1 abi_ulong sa_restorer; 5307f047de1SRichard Henderson #endif 5312521d698Sbellard }; 5322521d698Sbellard 5332521d698Sbellard struct target_sigaction { 534992f48a0Sblueswir1 abi_ulong _sa_handler; 535992f48a0Sblueswir1 abi_ulong sa_flags; 5367f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 537992f48a0Sblueswir1 abi_ulong sa_restorer; 5387f047de1SRichard Henderson #endif 539c227f099SAnthony Liguori target_sigset_t sa_mask; 5405de154e8SLaurent Vivier #ifdef TARGET_ARCH_HAS_KA_RESTORER 5415de154e8SLaurent Vivier abi_ulong ka_restorer; 5425de154e8SLaurent Vivier #endif 5432521d698Sbellard }; 544106ec879Sbellard #endif 5452521d698Sbellard 5462521d698Sbellard typedef union target_sigval { 547b3c719b2SRichard Henderson abi_int sival_int; 548992f48a0Sblueswir1 abi_ulong sival_ptr; 549c227f099SAnthony Liguori } target_sigval_t; 5502521d698Sbellard 5512521d698Sbellard #define TARGET_SI_MAX_SIZE 128 552aa5e03d2SMaxim Ostapenko 553aa5e03d2SMaxim Ostapenko #if TARGET_ABI_BITS == 32 554aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int)) 555aa5e03d2SMaxim Ostapenko #else 556aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int)) 557aa5e03d2SMaxim Ostapenko #endif 558aa5e03d2SMaxim Ostapenko 559aa5e03d2SMaxim Ostapenko #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int)) 5602521d698Sbellard 561a70dadc7SPeter Maydell /* Within QEMU the top 16 bits of si_code indicate which of the parts of 562a70dadc7SPeter Maydell * the union in target_siginfo is valid. This only applies between 563a70dadc7SPeter Maydell * host_to_target_siginfo_noswap() and tswap_siginfo(); it does not 564a70dadc7SPeter Maydell * appear either within host siginfo_t or in target_siginfo structures 565a70dadc7SPeter Maydell * which we get from the guest userspace program. (The Linux kernel 566a70dadc7SPeter Maydell * does a similar thing with using the top bits for its own internal 567a70dadc7SPeter Maydell * purposes but not letting them be visible to userspace.) 568a70dadc7SPeter Maydell */ 569a70dadc7SPeter Maydell #define QEMU_SI_KILL 0 570a70dadc7SPeter Maydell #define QEMU_SI_TIMER 1 571a70dadc7SPeter Maydell #define QEMU_SI_POLL 2 572a70dadc7SPeter Maydell #define QEMU_SI_FAULT 3 573a70dadc7SPeter Maydell #define QEMU_SI_CHLD 4 574a70dadc7SPeter Maydell #define QEMU_SI_RT 5 575a70dadc7SPeter Maydell 5762521d698Sbellard typedef struct target_siginfo { 5773f53d546Spbrook #ifdef TARGET_MIPS 578b3c719b2SRichard Henderson abi_int si_signo; 579b3c719b2SRichard Henderson abi_int si_code; 580b3c719b2SRichard Henderson abi_int si_errno; 5813f53d546Spbrook #else 582b3c719b2SRichard Henderson abi_int si_signo; 583b3c719b2SRichard Henderson abi_int si_errno; 584b3c719b2SRichard Henderson abi_int si_code; 5853f53d546Spbrook #endif 5862521d698Sbellard 5872521d698Sbellard union { 588b3c719b2SRichard Henderson abi_int _pad[TARGET_SI_PAD_SIZE]; 5892521d698Sbellard 5902521d698Sbellard /* kill() */ 5912521d698Sbellard struct { 5922521d698Sbellard pid_t _pid; /* sender's pid */ 5932521d698Sbellard uid_t _uid; /* sender's uid */ 5942521d698Sbellard } _kill; 5952521d698Sbellard 5962521d698Sbellard /* POSIX.1b timers */ 5972521d698Sbellard struct { 598c7828bd1SRichard Henderson abi_uint _timer1; 599c7828bd1SRichard Henderson abi_uint _timer2; 6002521d698Sbellard } _timer; 6012521d698Sbellard 6022521d698Sbellard /* POSIX.1b signals */ 6032521d698Sbellard struct { 6042521d698Sbellard pid_t _pid; /* sender's pid */ 6052521d698Sbellard uid_t _uid; /* sender's uid */ 606c227f099SAnthony Liguori target_sigval_t _sigval; 6072521d698Sbellard } _rt; 6082521d698Sbellard 6092521d698Sbellard /* SIGCHLD */ 6102521d698Sbellard struct { 6112521d698Sbellard pid_t _pid; /* which child */ 6122521d698Sbellard uid_t _uid; /* sender's uid */ 613b3c719b2SRichard Henderson abi_int _status; /* exit code */ 614c227f099SAnthony Liguori target_clock_t _utime; 615c227f099SAnthony Liguori target_clock_t _stime; 6162521d698Sbellard } _sigchld; 6172521d698Sbellard 6182521d698Sbellard /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 6192521d698Sbellard struct { 620992f48a0Sblueswir1 abi_ulong _addr; /* faulting insn/memory ref. */ 6212521d698Sbellard } _sigfault; 6222521d698Sbellard 6232521d698Sbellard /* SIGPOLL */ 6242521d698Sbellard struct { 625b3c719b2SRichard Henderson abi_int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 626b3c719b2SRichard Henderson abi_int _fd; 6272521d698Sbellard } _sigpoll; 6282521d698Sbellard } _sifields; 629c227f099SAnthony Liguori } target_siginfo_t; 6302521d698Sbellard 6312521d698Sbellard /* 6322521d698Sbellard * si_code values 6332521d698Sbellard * Digital reserves positive values for kernel-generated signals. 6342521d698Sbellard */ 6352521d698Sbellard #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ 6362521d698Sbellard #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 6372521d698Sbellard #define TARGET_SI_QUEUE -1 /* sent by sigqueue */ 6382521d698Sbellard #define TARGET_SI_TIMER -2 /* sent by timer expiration */ 6392521d698Sbellard #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ 6402521d698Sbellard #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ 6412521d698Sbellard #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ 6422521d698Sbellard 6432521d698Sbellard /* 6442521d698Sbellard * SIGILL si_codes 6452521d698Sbellard */ 646ffa65c3bSbellard #define TARGET_ILL_ILLOPC (1) /* illegal opcode */ 6472521d698Sbellard #define TARGET_ILL_ILLOPN (2) /* illegal operand */ 648ffa65c3bSbellard #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ 649ffa65c3bSbellard #define TARGET_ILL_ILLTRP (4) /* illegal trap */ 650ffa65c3bSbellard #define TARGET_ILL_PRVOPC (5) /* privileged opcode */ 651ffa65c3bSbellard #define TARGET_ILL_PRVREG (6) /* privileged register */ 652ffa65c3bSbellard #define TARGET_ILL_COPROC (7) /* coprocessor error */ 653ffa65c3bSbellard #define TARGET_ILL_BADSTK (8) /* internal stack error */ 6542521d698Sbellard 6552521d698Sbellard /* 6562521d698Sbellard * SIGFPE si_codes 6572521d698Sbellard */ 6582521d698Sbellard #define TARGET_FPE_INTDIV (1) /* integer divide by zero */ 6592521d698Sbellard #define TARGET_FPE_INTOVF (2) /* integer overflow */ 6602521d698Sbellard #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ 6612521d698Sbellard #define TARGET_FPE_FLTOVF (4) /* floating point overflow */ 6622521d698Sbellard #define TARGET_FPE_FLTUND (5) /* floating point underflow */ 6632521d698Sbellard #define TARGET_FPE_FLTRES (6) /* floating point inexact result */ 6642521d698Sbellard #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ 6652521d698Sbellard #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ 66621ba8564SRichard Henderson #define TARGET_FPE_FLTUNK (14) /* undiagnosed fp exception */ 6670edf34c9SRichard Henderson #define TARGET_FPE_CONDTRAP (15) /* trap on condition */ 6682521d698Sbellard 6692521d698Sbellard /* 6702521d698Sbellard * SIGSEGV si_codes 6712521d698Sbellard */ 6722521d698Sbellard #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ 6732521d698Sbellard #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ 674de2fdd56SChen Gang #define TARGET_SEGV_BNDERR (3) /* failed address bound checks */ 6752521d698Sbellard 6762521d698Sbellard /* 677ffa65c3bSbellard * SIGBUS si_codes 678ffa65c3bSbellard */ 679ffa65c3bSbellard #define TARGET_BUS_ADRALN (1) /* invalid address alignment */ 680b4916d7bSDong Xu Wang #define TARGET_BUS_ADRERR (2) /* non-existent physical address */ 681ffa65c3bSbellard #define TARGET_BUS_OBJERR (3) /* object specific hardware error */ 682de2fdd56SChen Gang /* hardware memory error consumed on a machine check: action required */ 683de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AR (4) 684de2fdd56SChen Gang /* hardware memory error detected in process but not consumed: action optional*/ 685de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AO (5) 686ffa65c3bSbellard 687ffa65c3bSbellard /* 6882521d698Sbellard * SIGTRAP si_codes 6892521d698Sbellard */ 6902521d698Sbellard #define TARGET_TRAP_BRKPT (1) /* process breakpoint */ 6912521d698Sbellard #define TARGET_TRAP_TRACE (2) /* process trace trap */ 692de2fdd56SChen Gang #define TARGET_TRAP_BRANCH (3) /* process taken branch trap */ 693de2fdd56SChen Gang #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */ 694d010b8bdSRichard Henderson #define TARGET_TRAP_UNK (5) /* undiagnosed trap */ 6952521d698Sbellard 696e64c6d42SRichard Henderson /* 697e64c6d42SRichard Henderson * SIGEMT si_codes 698e64c6d42SRichard Henderson */ 699e64c6d42SRichard Henderson #define TARGET_EMT_TAGOVF 1 /* tag overflow */ 700e64c6d42SRichard Henderson 701b13e49bcSSerge Belyshev #include "target_resource.h" 702e22b7015SWesley W. Terpstra 7039de5e440Sbellard struct target_pollfd { 704b3c719b2SRichard Henderson abi_int fd; /* file descriptor */ 70520d49567SRichard Henderson abi_short events; /* requested events */ 70620d49567SRichard Henderson abi_short revents; /* returned events */ 7079de5e440Sbellard }; 7089de5e440Sbellard 7098e5a0667Sbellard /* virtual terminal ioctls */ 7100221cfcdSbellard #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ 7110221cfcdSbellard #define TARGET_KDMKTONE 0x4B30 /* generate tone */ 7128e5a0667Sbellard #define TARGET_KDGKBTYPE 0x4b33 713f7680a55SUlrich Hecht #define TARGET_KDSETMODE 0x4b3a 714f7680a55SUlrich Hecht #define TARGET_KDGKBMODE 0x4b44 715f7680a55SUlrich Hecht #define TARGET_KDSKBMODE 0x4b45 7160221cfcdSbellard #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ 7170221cfcdSbellard #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ 718e6fe18fbSCédric VINCENT #define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ 719e6fe18fbSCédric VINCENT #define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ 720e6fe18fbSCédric VINCENT #define TARGET_KDGETLED 0x4B31 /* return current led state */ 721e6fe18fbSCédric VINCENT #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */ 722ca56f5b5SPaul Burton #define TARGET_KDSIGACCEPT 0x4B4E 7238e5a0667Sbellard 724373b067fSFilip Bozuta struct target_rtc_pll_info { 725b3c719b2SRichard Henderson abi_int pll_ctrl; 726b3c719b2SRichard Henderson abi_int pll_value; 727b3c719b2SRichard Henderson abi_int pll_max; 728b3c719b2SRichard Henderson abi_int pll_min; 729b3c719b2SRichard Henderson abi_int pll_posmult; 730b3c719b2SRichard Henderson abi_int pll_negmult; 731373b067fSFilip Bozuta abi_long pll_clock; 732373b067fSFilip Bozuta }; 733373b067fSFilip Bozuta 73468365f96SFilip Bozuta /* real time clock ioctls */ 73568365f96SFilip Bozuta #define TARGET_RTC_AIE_ON TARGET_IO('p', 0x01) 73668365f96SFilip Bozuta #define TARGET_RTC_AIE_OFF TARGET_IO('p', 0x02) 73768365f96SFilip Bozuta #define TARGET_RTC_UIE_ON TARGET_IO('p', 0x03) 73868365f96SFilip Bozuta #define TARGET_RTC_UIE_OFF TARGET_IO('p', 0x04) 73968365f96SFilip Bozuta #define TARGET_RTC_PIE_ON TARGET_IO('p', 0x05) 74068365f96SFilip Bozuta #define TARGET_RTC_PIE_OFF TARGET_IO('p', 0x06) 74168365f96SFilip Bozuta #define TARGET_RTC_WIE_ON TARGET_IO('p', 0x0f) 74268365f96SFilip Bozuta #define TARGET_RTC_WIE_OFF TARGET_IO('p', 0x10) 743178b14a0SFilip Bozuta #define TARGET_RTC_ALM_READ TARGET_IOR('p', 0x08, struct rtc_time) 744178b14a0SFilip Bozuta #define TARGET_RTC_ALM_SET TARGET_IOW('p', 0x07, struct rtc_time) 745178b14a0SFilip Bozuta #define TARGET_RTC_RD_TIME TARGET_IOR('p', 0x09, struct rtc_time) 746178b14a0SFilip Bozuta #define TARGET_RTC_SET_TIME TARGET_IOW('p', 0x0a, struct rtc_time) 747fa857eb5SFilip Bozuta #define TARGET_RTC_IRQP_READ TARGET_IOR('p', 0x0b, abi_ulong) 748fa857eb5SFilip Bozuta #define TARGET_RTC_IRQP_SET TARGET_IOW('p', 0x0c, abi_ulong) 749fa857eb5SFilip Bozuta #define TARGET_RTC_EPOCH_READ TARGET_IOR('p', 0x0d, abi_ulong) 750fa857eb5SFilip Bozuta #define TARGET_RTC_EPOCH_SET TARGET_IOW('p', 0x0e, abi_ulong) 751abc81bf6SFilip Bozuta #define TARGET_RTC_WKALM_RD TARGET_IOR('p', 0x10, struct rtc_wkalrm) 752abc81bf6SFilip Bozuta #define TARGET_RTC_WKALM_SET TARGET_IOW('p', 0x0f, struct rtc_wkalrm) 753373b067fSFilip Bozuta #define TARGET_RTC_PLL_GET TARGET_IOR('p', 0x11, \ 754373b067fSFilip Bozuta struct target_rtc_pll_info) 755373b067fSFilip Bozuta #define TARGET_RTC_PLL_SET TARGET_IOW('p', 0x12, \ 756373b067fSFilip Bozuta struct target_rtc_pll_info) 757b3c719b2SRichard Henderson #define TARGET_RTC_VL_READ TARGET_IOR('p', 0x13, abi_int) 758a7b09746SFilip Bozuta #define TARGET_RTC_VL_CLR TARGET_IO('p', 0x14) 75968365f96SFilip Bozuta 760d14eabbeSAleksandar Markovic #if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) || \ 761d14eabbeSAleksandar Markovic defined(TARGET_XTENSA) 762b3c719b2SRichard Henderson #define TARGET_FIOGETOWN TARGET_IOR('f', 123, abi_int) 763b3c719b2SRichard Henderson #define TARGET_FIOSETOWN TARGET_IOW('f', 124, abi_int) 764b3c719b2SRichard Henderson #define TARGET_SIOCATMARK TARGET_IOR('s', 7, abi_int) 765c495a793SAleksandar Markovic #define TARGET_SIOCSPGRP TARGET_IOW('s', 8, pid_t) 766405b4915SHelge Deller #define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t) 767e1be1606SAleksandar Markovic #else 7684e4b173fSAleksandar Markovic #define TARGET_FIOGETOWN 0x8903 7694e4b173fSAleksandar Markovic #define TARGET_FIOSETOWN 0x8901 7702521d698Sbellard #define TARGET_SIOCATMARK 0x8905 771c495a793SAleksandar Markovic #define TARGET_SIOCSPGRP 0x8902 772405b4915SHelge Deller #define TARGET_SIOCGPGRP 0x8904 773e1be1606SAleksandar Markovic #endif 774c495a793SAleksandar Markovic 7756d5d5ddeSDaniel P. Berrangé #if defined(TARGET_SH4) 7766d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMP_OLD TARGET_IOR('s', 100, struct target_timeval) 7776d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMPNS_OLD TARGET_IOR('s', 101, struct target_timespec) 7786d5d5ddeSDaniel P. Berrangé #else 7796d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMP_OLD 0x8906 7806d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMPNS_OLD 0x8907 7816d5d5ddeSDaniel P. Berrangé #endif 7826d5d5ddeSDaniel P. Berrangé 7836d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMP_NEW TARGET_IOR(0x89, 0x06, abi_llong[2]) 7846d5d5ddeSDaniel P. Berrangé #define TARGET_SIOCGSTAMPNS_NEW TARGET_IOR(0x89, 0x07, abi_llong[2]) 7852521d698Sbellard 78631e31b8aSbellard /* Networking ioctls */ 78731e31b8aSbellard #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ 78831e31b8aSbellard #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ 78931e31b8aSbellard #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ 79031e31b8aSbellard #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ 79131e31b8aSbellard #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ 79231e31b8aSbellard #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ 79331e31b8aSbellard #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ 79431e31b8aSbellard #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ 79531e31b8aSbellard #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ 79631e31b8aSbellard #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ 79731e31b8aSbellard #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ 79831e31b8aSbellard #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ 79931e31b8aSbellard #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ 80031e31b8aSbellard #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ 80131e31b8aSbellard #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ 80231e31b8aSbellard #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ 80331e31b8aSbellard #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ 80431e31b8aSbellard #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ 80531e31b8aSbellard #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ 80631e31b8aSbellard #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ 80731e31b8aSbellard #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ 80831e31b8aSbellard #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ 80931e31b8aSbellard #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ 81031e31b8aSbellard #define TARGET_SIOCSIFENCAP 0x8926 81131e31b8aSbellard #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ 81231e31b8aSbellard #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ 81331e31b8aSbellard #define TARGET_SIOCSIFSLAVE 0x8930 81431e31b8aSbellard #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ 81531e31b8aSbellard #define TARGET_SIOCDELMULTI 0x8932 816f63eb01aSPaul Burton #define TARGET_SIOCGIFINDEX 0x8933 8174bdcd79eSNeng Chen #define TARGET_SIOCSIFPFLAGS 0x8934 /* set extended flags */ 8184bdcd79eSNeng Chen #define TARGET_SIOCGIFPFLAGS 0x8935 /* get extended flags */ 81931e31b8aSbellard 82031e31b8aSbellard /* Bridging control calls */ 82131e31b8aSbellard #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ 82231e31b8aSbellard #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ 82331e31b8aSbellard 82431e31b8aSbellard #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ 82531e31b8aSbellard #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ 82631e31b8aSbellard 82731e31b8aSbellard /* ARP cache control calls. */ 82831e31b8aSbellard #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ 82931e31b8aSbellard #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ 83031e31b8aSbellard #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ 83131e31b8aSbellard #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ 83231e31b8aSbellard #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ 83331e31b8aSbellard #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ 83431e31b8aSbellard 83531e31b8aSbellard /* RARP cache control calls. */ 83631e31b8aSbellard #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ 83731e31b8aSbellard #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ 83831e31b8aSbellard #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ 83931e31b8aSbellard 84031e31b8aSbellard /* Driver configuration calls */ 84131e31b8aSbellard #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ 84231e31b8aSbellard #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ 84331e31b8aSbellard 84431e31b8aSbellard /* DLCI configuration calls */ 84531e31b8aSbellard #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ 84631e31b8aSbellard #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ 84731e31b8aSbellard 84886fcd946SLaurent Vivier /* From <linux/wireless.h> */ 84986fcd946SLaurent Vivier 85086fcd946SLaurent Vivier #define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ 85131e31b8aSbellard 8526addf06aSShu-Chun Weng /* From <linux/if_tun.h> */ 8536addf06aSShu-Chun Weng 854b3c719b2SRichard Henderson #define TARGET_TUNSETDEBUG TARGET_IOW('T', 201, abi_int) 855b3c719b2SRichard Henderson #define TARGET_TUNSETIFF TARGET_IOW('T', 202, abi_int) 856b3c719b2SRichard Henderson #define TARGET_TUNSETPERSIST TARGET_IOW('T', 203, abi_int) 857b3c719b2SRichard Henderson #define TARGET_TUNSETOWNER TARGET_IOW('T', 204, abi_int) 858b3c719b2SRichard Henderson #define TARGET_TUNSETLINK TARGET_IOW('T', 205, abi_int) 859b3c719b2SRichard Henderson #define TARGET_TUNSETGROUP TARGET_IOW('T', 206, abi_int) 860c7828bd1SRichard Henderson #define TARGET_TUNGETFEATURES TARGET_IOR('T', 207, abi_uint) 861c7828bd1SRichard Henderson #define TARGET_TUNSETOFFLOAD TARGET_IOW('T', 208, abi_uint) 862c7828bd1SRichard Henderson #define TARGET_TUNSETTXFILTER TARGET_IOW('T', 209, abi_uint) 863c7828bd1SRichard Henderson #define TARGET_TUNGETIFF TARGET_IOR('T', 210, abi_uint) 864b3c719b2SRichard Henderson #define TARGET_TUNGETSNDBUF TARGET_IOR('T', 211, abi_int) 865b3c719b2SRichard Henderson #define TARGET_TUNSETSNDBUF TARGET_IOW('T', 212, abi_int) 8666addf06aSShu-Chun Weng /* 8676addf06aSShu-Chun Weng * TUNATTACHFILTER and TUNDETACHFILTER are not supported. Linux kernel keeps a 8686addf06aSShu-Chun Weng * user pointer in TUNATTACHFILTER, which we are not able to correctly handle. 8696addf06aSShu-Chun Weng */ 870b3c719b2SRichard Henderson #define TARGET_TUNGETVNETHDRSZ TARGET_IOR('T', 215, abi_int) 871b3c719b2SRichard Henderson #define TARGET_TUNSETVNETHDRSZ TARGET_IOW('T', 216, abi_int) 872b3c719b2SRichard Henderson #define TARGET_TUNSETQUEUE TARGET_IOW('T', 217, abi_int) 873c7828bd1SRichard Henderson #define TARGET_TUNSETIFINDEX TARGET_IOW('T', 218, abi_uint) 8746addf06aSShu-Chun Weng /* TUNGETFILTER is not supported: see TUNATTACHFILTER. */ 875b3c719b2SRichard Henderson #define TARGET_TUNSETVNETLE TARGET_IOW('T', 220, abi_int) 876b3c719b2SRichard Henderson #define TARGET_TUNGETVNETLE TARGET_IOR('T', 221, abi_int) 877b3c719b2SRichard Henderson #define TARGET_TUNSETVNETBE TARGET_IOW('T', 222, abi_int) 878b3c719b2SRichard Henderson #define TARGET_TUNGETVNETBE TARGET_IOR('T', 223, abi_int) 879b3c719b2SRichard Henderson #define TARGET_TUNSETSTEERINGEBPF TARGET_IOR('T', 224, abi_int) 880b3c719b2SRichard Henderson #define TARGET_TUNSETFILTEREBPF TARGET_IOR('T', 225, abi_int) 881b3c719b2SRichard Henderson #define TARGET_TUNSETCARRIER TARGET_IOW('T', 226, abi_int) 8826addf06aSShu-Chun Weng #define TARGET_TUNGETDEVNETNS TARGET_IO('T', 227) 8836addf06aSShu-Chun Weng 884d6d6d6feSMarco A L Barbosa /* From <linux/random.h> */ 885d6d6d6feSMarco A L Barbosa 886b3c719b2SRichard Henderson #define TARGET_RNDGETENTCNT TARGET_IOR('R', 0x00, abi_int) 887b3c719b2SRichard Henderson #define TARGET_RNDADDTOENTCNT TARGET_IOW('R', 0x01, abi_int) 888d6d6d6feSMarco A L Barbosa #define TARGET_RNDZAPENTCNT TARGET_IO('R', 0x04) 889d6d6d6feSMarco A L Barbosa #define TARGET_RNDCLEARPOOL TARGET_IO('R', 0x06) 89092c096f0SAleksandar Markovic #define TARGET_RNDRESEEDCRNG TARGET_IO('R', 0x07) 891d6d6d6feSMarco A L Barbosa 89231e31b8aSbellard /* From <linux/fs.h> */ 89331e31b8aSbellard 89431e31b8aSbellard #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ 89531e31b8aSbellard #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ 89631e31b8aSbellard #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ 89731e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ 89831e31b8aSbellard #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ 89931e31b8aSbellard #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ 90031e31b8aSbellard #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ 90131e31b8aSbellard #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ 90231e31b8aSbellard #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ 90331e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ 90431e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ 90531e31b8aSbellard #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ 906fff8c539SAndreas Färber #define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */ 90731e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */ 908c8b0bf54SPeter Maydell #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong) 909c8b0bf54SPeter Maydell #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong) 910edafea13SAlexander Graf #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) 911edafea13SAlexander Graf /* return device size in bytes 912edafea13SAlexander Graf (u64 *arg) */ 9134715856aSPeter Maydell 9144715856aSPeter Maydell #define TARGET_BLKDISCARD TARGET_IO(0x12, 119) 9154715856aSPeter Maydell #define TARGET_BLKIOMIN TARGET_IO(0x12, 120) 9164715856aSPeter Maydell #define TARGET_BLKIOOPT TARGET_IO(0x12, 121) 9174715856aSPeter Maydell #define TARGET_BLKALIGNOFF TARGET_IO(0x12, 122) 9184715856aSPeter Maydell #define TARGET_BLKPBSZGET TARGET_IO(0x12, 123) 9194715856aSPeter Maydell #define TARGET_BLKDISCARDZEROES TARGET_IO(0x12, 124) 9204715856aSPeter Maydell #define TARGET_BLKSECDISCARD TARGET_IO(0x12, 125) 9214715856aSPeter Maydell #define TARGET_BLKROTATIONAL TARGET_IO(0x12, 126) 9224715856aSPeter Maydell #define TARGET_BLKZEROOUT TARGET_IO(0x12, 127) 9234715856aSPeter Maydell 924ab22b4ddSYunqiang Su /* From <linux/fd.h> */ 925ab22b4ddSYunqiang Su 9267e35fc8bSAleksandar Markovic #define TARGET_FDMSGON TARGET_IO(2, 0x45) 9277e35fc8bSAleksandar Markovic #define TARGET_FDMSGOFF TARGET_IO(2, 0x46) 92808e3ce59SAleksandar Markovic #define TARGET_FDFMTBEG TARGET_IO(2, 0x47) 92908e3ce59SAleksandar Markovic #define TARGET_FDFMTTRK TARGET_IOW(2, 0x48, struct format_descr) 93008e3ce59SAleksandar Markovic #define TARGET_FDFMTEND TARGET_IO(2, 0x49) 93181eb1a36SAleksandar Markovic #define TARGET_FDSETEMSGTRESH TARGET_IO(2, 0x4a) 932ab22b4ddSYunqiang Su #define TARGET_FDFLUSH TARGET_IO(2, 0x4b) 93381eb1a36SAleksandar Markovic #define TARGET_FDSETMAXERRS TARGET_IOW(2, 0x4c, struct floppy_max_errors) 93481eb1a36SAleksandar Markovic #define TARGET_FDGETMAXERRS TARGET_IOR(2, 0x0e, struct floppy_max_errors) 9355eea9429SAleksandar Markovic #define TARGET_FDRESET TARGET_IO(2, 0x54) 9365eea9429SAleksandar Markovic #define TARGET_FDRAWCMD TARGET_IO(2, 0x58) 9375eea9429SAleksandar Markovic #define TARGET_FDTWADDLE TARGET_IO(2, 0x59) 9385eea9429SAleksandar Markovic #define TARGET_FDEJECT TARGET_IO(2, 0x5a) 939ab22b4ddSYunqiang Su 94031e31b8aSbellard #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ 94131e31b8aSbellard #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ 94221992cb6SHelge Deller 943b3c719b2SRichard Henderson #define TARGET_FICLONE TARGET_IOW(0x94, 9, abi_int) 94421992cb6SHelge Deller #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range) 94521992cb6SHelge Deller 9465ae774a9SAleksandar Markovic /* 9475ae774a9SAleksandar Markovic * Note that the ioctl numbers for FS_IOC_<GET|SET><FLAGS|VERSION> 9485ae774a9SAleksandar Markovic * claim type "long" but the actual type used by the kernel is "int". 94960807231SPeter Maydell */ 9501847b7baSPeter Maydell #define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, abi_long) 9511847b7baSPeter Maydell #define TARGET_FS_IOC_SETFLAGS TARGET_IOW('f', 2, abi_long) 9525ae774a9SAleksandar Markovic #define TARGET_FS_IOC_GETVERSION TARGET_IOR('v', 1, abi_long) 9535ae774a9SAleksandar Markovic #define TARGET_FS_IOC_SETVERSION TARGET_IOW('v', 2, abi_long) 954285da2b9SPeter Maydell #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) 955b3c719b2SRichard Henderson #define TARGET_FS_IOC32_GETFLAGS TARGET_IOR('f', 1, abi_int) 956b3c719b2SRichard Henderson #define TARGET_FS_IOC32_SETFLAGS TARGET_IOW('f', 2, abi_int) 957b3c719b2SRichard Henderson #define TARGET_FS_IOC32_GETVERSION TARGET_IOR('v', 1, abi_int) 958b3c719b2SRichard Henderson #define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, abi_int) 95931e31b8aSbellard 960d6092e08SFilip Bozuta /* btrfs ioctls */ 96148f670ecSThomas Huth #ifdef HAVE_BTRFS_H 962527e8d8fSFilip Bozuta #define TARGET_BTRFS_IOC_SNAP_CREATE TARGET_IOWU(BTRFS_IOCTL_MAGIC, 1) 9639bbd60e7SFilip Bozuta #define TARGET_BTRFS_IOC_SCAN_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 4) 9649bbd60e7SFilip Bozuta #define TARGET_BTRFS_IOC_FORGET_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 5) 9659bbd60e7SFilip Bozuta #define TARGET_BTRFS_IOC_ADD_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 10) 9669bbd60e7SFilip Bozuta #define TARGET_BTRFS_IOC_RM_DEV TARGET_IOWU(BTRFS_IOCTL_MAGIC, 11) 967d6092e08SFilip Bozuta #define TARGET_BTRFS_IOC_SUBVOL_CREATE TARGET_IOWU(BTRFS_IOCTL_MAGIC, 14) 968527e8d8fSFilip Bozuta #define TARGET_BTRFS_IOC_SNAP_DESTROY TARGET_IOWU(BTRFS_IOCTL_MAGIC, 15) 9690ff496a0SFilip Bozuta #define TARGET_BTRFS_IOC_INO_LOOKUP TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 18) 970784c08c8SFilip Bozuta #define TARGET_BTRFS_IOC_DEFAULT_SUBVOL TARGET_IOW(BTRFS_IOCTL_MAGIC, 19, \ 971784c08c8SFilip Bozuta abi_ullong) 972d6092e08SFilip Bozuta #define TARGET_BTRFS_IOC_SUBVOL_GETFLAGS TARGET_IOR(BTRFS_IOCTL_MAGIC, 25, \ 973d6092e08SFilip Bozuta abi_ullong) 974d6092e08SFilip Bozuta #define TARGET_BTRFS_IOC_SUBVOL_SETFLAGS TARGET_IOW(BTRFS_IOCTL_MAGIC, 26, \ 975d6092e08SFilip Bozuta abi_ullong) 9769a5a5a05SFilip Bozuta #define TARGET_BTRFS_IOC_SCRUB TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 27) 9779a5a5a05SFilip Bozuta #define TARGET_BTRFS_IOC_SCRUB_CANCEL TARGET_IO(BTRFS_IOCTL_MAGIC, 28) 9789a5a5a05SFilip Bozuta #define TARGET_BTRFS_IOC_SCRUB_PROGRESS TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 29) 9799bbd60e7SFilip Bozuta #define TARGET_BTRFS_IOC_DEV_INFO TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 30) 9800ff496a0SFilip Bozuta #define TARGET_BTRFS_IOC_INO_PATHS TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 35) 9810ff496a0SFilip Bozuta #define TARGET_BTRFS_IOC_LOGICAL_INO TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 36) 98253906f68SFilip Bozuta #define TARGET_BTRFS_IOC_QUOTA_CTL TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 40) 98353906f68SFilip Bozuta #define TARGET_BTRFS_IOC_QGROUP_ASSIGN TARGET_IOWU(BTRFS_IOCTL_MAGIC, 41) 98453906f68SFilip Bozuta #define TARGET_BTRFS_IOC_QGROUP_CREATE TARGET_IOWU(BTRFS_IOCTL_MAGIC, 42) 98553906f68SFilip Bozuta #define TARGET_BTRFS_IOC_QGROUP_LIMIT TARGET_IORU(BTRFS_IOCTL_MAGIC, 43) 98653906f68SFilip Bozuta #define TARGET_BTRFS_IOC_QUOTA_RESCAN TARGET_IOWU(BTRFS_IOCTL_MAGIC, 44) 98753906f68SFilip Bozuta #define TARGET_BTRFS_IOC_QUOTA_RESCAN_STATUS TARGET_IORU(BTRFS_IOCTL_MAGIC, 45) 98853906f68SFilip Bozuta #define TARGET_BTRFS_IOC_QUOTA_RESCAN_WAIT TARGET_IO(BTRFS_IOCTL_MAGIC, 46) 9899bbd60e7SFilip Bozuta #define TARGET_BTRFS_IOC_GET_DEV_STATS TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 52) 99049b422a8SFilip Bozuta #define TARGET_BTRFS_IOC_GET_FEATURES TARGET_IORU(BTRFS_IOCTL_MAGIC, 57) 99149b422a8SFilip Bozuta #define TARGET_BTRFS_IOC_SET_FEATURES TARGET_IOWU(BTRFS_IOCTL_MAGIC, 57) 99249b422a8SFilip Bozuta #define TARGET_BTRFS_IOC_GET_SUPPORTED_FEATURES TARGET_IORU(BTRFS_IOCTL_MAGIC, 57) 9930ff496a0SFilip Bozuta #define TARGET_BTRFS_IOC_LOGICAL_INO_V2 TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 59) 994d6092e08SFilip Bozuta #define TARGET_BTRFS_IOC_GET_SUBVOL_INFO TARGET_IORU(BTRFS_IOCTL_MAGIC, 60) 995784c08c8SFilip Bozuta #define TARGET_BTRFS_IOC_GET_SUBVOL_ROOTREF TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 61) 9960ff496a0SFilip Bozuta #define TARGET_BTRFS_IOC_INO_LOOKUP_USER TARGET_IOWRU(BTRFS_IOCTL_MAGIC, 62) 9975d5d1752SFilip Bozuta #endif 998d6092e08SFilip Bozuta 9996c753a63SCortland Tölva /* usb ioctls */ 10006c753a63SCortland Tölva #define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0) 10016c753a63SCortland Tölva #define TARGET_USBDEVFS_BULK TARGET_IOWRU('U', 2) 10026c753a63SCortland Tölva #define TARGET_USBDEVFS_RESETEP TARGET_IORU('U', 3) 10036c753a63SCortland Tölva #define TARGET_USBDEVFS_SETINTERFACE TARGET_IORU('U', 4) 10046c753a63SCortland Tölva #define TARGET_USBDEVFS_SETCONFIGURATION TARGET_IORU('U', 5) 10056c753a63SCortland Tölva #define TARGET_USBDEVFS_GETDRIVER TARGET_IOWU('U', 8) 1006a133367eSCortland Tölva #define TARGET_USBDEVFS_SUBMITURB TARGET_IORU('U', 10) 1007a133367eSCortland Tölva #define TARGET_USBDEVFS_DISCARDURB TARGET_IO('U', 11) 1008a133367eSCortland Tölva #define TARGET_USBDEVFS_REAPURB TARGET_IOWU('U', 12) 1009a133367eSCortland Tölva #define TARGET_USBDEVFS_REAPURBNDELAY TARGET_IOWU('U', 13) 10106c753a63SCortland Tölva #define TARGET_USBDEVFS_DISCSIGNAL TARGET_IORU('U', 14) 10116c753a63SCortland Tölva #define TARGET_USBDEVFS_CLAIMINTERFACE TARGET_IORU('U', 15) 10126c753a63SCortland Tölva #define TARGET_USBDEVFS_RELEASEINTERFACE TARGET_IORU('U', 16) 10136c753a63SCortland Tölva #define TARGET_USBDEVFS_CONNECTINFO TARGET_IOWU('U', 17) 10146c753a63SCortland Tölva #define TARGET_USBDEVFS_IOCTL TARGET_IOWRU('U', 18) 10156c753a63SCortland Tölva #define TARGET_USBDEVFS_HUB_PORTINFO TARGET_IORU('U', 19) 10166c753a63SCortland Tölva #define TARGET_USBDEVFS_RESET TARGET_IO('U', 20) 10176c753a63SCortland Tölva #define TARGET_USBDEVFS_CLEAR_HALT TARGET_IORU('U', 21) 10186c753a63SCortland Tölva #define TARGET_USBDEVFS_DISCONNECT TARGET_IO('U', 22) 10196c753a63SCortland Tölva #define TARGET_USBDEVFS_CONNECT TARGET_IO('U', 23) 10206c753a63SCortland Tölva #define TARGET_USBDEVFS_CLAIM_PORT TARGET_IORU('U', 24) 10216c753a63SCortland Tölva #define TARGET_USBDEVFS_RELEASE_PORT TARGET_IORU('U', 25) 10226c753a63SCortland Tölva #define TARGET_USBDEVFS_GET_CAPABILITIES TARGET_IORU('U', 26) 10236c753a63SCortland Tölva #define TARGET_USBDEVFS_DISCONNECT_CLAIM TARGET_IORU('U', 27) 10246c753a63SCortland Tölva #define TARGET_USBDEVFS_DROP_PRIVILEGES TARGET_IOWU('U', 30) 10256c753a63SCortland Tölva #define TARGET_USBDEVFS_GET_SPEED TARGET_IO('U', 31) 10266c753a63SCortland Tölva 102731e31b8aSbellard /* cdrom commands */ 102831e31b8aSbellard #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ 102931e31b8aSbellard #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ 103031e31b8aSbellard #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ 103131e31b8aSbellard #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index 103231e31b8aSbellard (struct cdrom_ti) */ 103331e31b8aSbellard #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header 103431e31b8aSbellard (struct cdrom_tochdr) */ 103531e31b8aSbellard #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry 103631e31b8aSbellard (struct cdrom_tocentry) */ 103731e31b8aSbellard #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ 103831e31b8aSbellard #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ 103931e31b8aSbellard #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ 104031e31b8aSbellard #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume 104131e31b8aSbellard (struct cdrom_volctrl) */ 104231e31b8aSbellard #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data 104331e31b8aSbellard (struct cdrom_subchnl) */ 104431e31b8aSbellard #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) 104531e31b8aSbellard (struct cdrom_read) */ 104631e31b8aSbellard #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) 104731e31b8aSbellard (struct cdrom_read) */ 104831e31b8aSbellard #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ 104931e31b8aSbellard #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ 105031e31b8aSbellard #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session 105131e31b8aSbellard address of multi session disks 105231e31b8aSbellard (struct cdrom_multisession) */ 105331e31b8aSbellard #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" 105431e31b8aSbellard if available (struct cdrom_mcn) */ 105567cc32ebSVeres Lajos #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is deprecated, 1056b4916d7bSDong Xu Wang but here anyway for compatibility */ 105731e31b8aSbellard #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ 105831e31b8aSbellard #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting 105931e31b8aSbellard (struct cdrom_volctrl) */ 106031e31b8aSbellard #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) 106131e31b8aSbellard (struct cdrom_read) */ 106231e31b8aSbellard /* 106331e31b8aSbellard * These ioctls are used only used in aztcd.c and optcd.c 106431e31b8aSbellard */ 106531e31b8aSbellard #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ 106631e31b8aSbellard #define TARGET_CDROMSEEK 0x5316 /* seek msf address */ 106731e31b8aSbellard 106831e31b8aSbellard /* 106931e31b8aSbellard * This ioctl is only used by the scsi-cd driver. 107031e31b8aSbellard It is for playing audio in logical block addressing mode. 107131e31b8aSbellard */ 107231e31b8aSbellard #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ 107331e31b8aSbellard 107431e31b8aSbellard /* 107531e31b8aSbellard * These ioctls are only used in optcd.c 107631e31b8aSbellard */ 107731e31b8aSbellard #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ 107831e31b8aSbellard 107931e31b8aSbellard /* 108031e31b8aSbellard * These ioctls are (now) only in ide-cd.c for controlling 108131e31b8aSbellard * drive spindown time. They should be implemented in the 108231e31b8aSbellard * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, 108331e31b8aSbellard * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... 108431e31b8aSbellard * -Erik 108531e31b8aSbellard */ 108631e31b8aSbellard #define TARGET_CDROMGETSPINDOWN 0x531d 108731e31b8aSbellard #define TARGET_CDROMSETSPINDOWN 0x531e 108831e31b8aSbellard 108931e31b8aSbellard /* 109031e31b8aSbellard * These ioctls are implemented through the uniform CD-ROM driver 109131e31b8aSbellard * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM 109231e31b8aSbellard * drivers are eventually ported to the uniform CD-ROM driver interface. 109331e31b8aSbellard */ 109431e31b8aSbellard #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ 109531e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ 109631e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ 109731e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ 109831e31b8aSbellard #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ 109931e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ 110031e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ 110131e31b8aSbellard #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ 110231e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ 110331e31b8aSbellard #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ 110431e31b8aSbellard #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ 110531e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ 110631e31b8aSbellard 110731e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. 110831e31b8aSbellard * Future CDROM ioctls should be kept below 0x537F 110931e31b8aSbellard */ 111031e31b8aSbellard 111131e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */ 111231e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ 111331e31b8aSbellard /* conflict with SCSI_IOCTL_GET_IDLUN */ 111431e31b8aSbellard 111531e31b8aSbellard /* DVD-ROM Specific ioctls */ 111631e31b8aSbellard #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ 111731e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ 111831e31b8aSbellard #define TARGET_DVD_AUTH 0x5392 /* Authentication */ 111931e31b8aSbellard 112031e31b8aSbellard #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ 112131e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ 112231e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ 112331e31b8aSbellard 112431e31b8aSbellard /* HD commands */ 112531e31b8aSbellard 112631e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ 112731e31b8aSbellard #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ 112831e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ 112931e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ 113031e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ 113131e31b8aSbellard #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ 113231e31b8aSbellard #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ 113331e31b8aSbellard #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ 11342521d698Sbellard #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ 113531e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ 113631e31b8aSbellard 113731e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ 113831e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ 113931e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ 114031e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ 114131e31b8aSbellard #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ 114231e31b8aSbellard #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ 114331e31b8aSbellard #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ 114431e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ 11452521d698Sbellard 1146b8005914Sbalrog /* loop ioctls */ 1147b8005914Sbalrog #define TARGET_LOOP_SET_FD 0x4C00 1148b8005914Sbalrog #define TARGET_LOOP_CLR_FD 0x4C01 1149b8005914Sbalrog #define TARGET_LOOP_SET_STATUS 0x4C02 1150b8005914Sbalrog #define TARGET_LOOP_GET_STATUS 0x4C03 1151b8005914Sbalrog #define TARGET_LOOP_SET_STATUS64 0x4C04 1152b8005914Sbalrog #define TARGET_LOOP_GET_STATUS64 0x4C05 1153b8005914Sbalrog #define TARGET_LOOP_CHANGE_FD 0x4C06 11540a761ce3SAndreas Schwab #define TARGET_LOOP_SET_CAPACITY 0x4C07 11550a761ce3SAndreas Schwab #define TARGET_LOOP_SET_DIRECT_IO 0x4C08 11560a761ce3SAndreas Schwab #define TARGET_LOOP_SET_BLOCK_SIZE 0x4C09 11570a761ce3SAndreas Schwab #define TARGET_LOOP_CONFIGURE 0x4C0A 11582521d698Sbellard 1159884cdc48SPeter Maydell #define TARGET_LOOP_CTL_ADD 0x4C80 1160884cdc48SPeter Maydell #define TARGET_LOOP_CTL_REMOVE 0x4C81 1161884cdc48SPeter Maydell #define TARGET_LOOP_CTL_GET_FREE 0x4C82 1162884cdc48SPeter Maydell 1163f7680a55SUlrich Hecht /* fb ioctls */ 1164f7680a55SUlrich Hecht #define TARGET_FBIOGET_VSCREENINFO 0x4600 1165f7680a55SUlrich Hecht #define TARGET_FBIOPUT_VSCREENINFO 0x4601 1166f7680a55SUlrich Hecht #define TARGET_FBIOGET_FSCREENINFO 0x4602 116712b81b71SCédric VINCENT #define TARGET_FBIOGETCMAP 0x4604 116812b81b71SCédric VINCENT #define TARGET_FBIOPUTCMAP 0x4605 116912b81b71SCédric VINCENT #define TARGET_FBIOPAN_DISPLAY 0x4606 117012b81b71SCédric VINCENT #define TARGET_FBIOGET_CON2FBMAP 0x460F 117112b81b71SCédric VINCENT #define TARGET_FBIOPUT_CON2FBMAP 0x4610 1172f7680a55SUlrich Hecht 1173f7680a55SUlrich Hecht /* vt ioctls */ 1174f7680a55SUlrich Hecht #define TARGET_VT_OPENQRY 0x5600 1175f7680a55SUlrich Hecht #define TARGET_VT_GETSTATE 0x5603 1176f7680a55SUlrich Hecht #define TARGET_VT_ACTIVATE 0x5606 1177f7680a55SUlrich Hecht #define TARGET_VT_WAITACTIVE 0x5607 1178f7680a55SUlrich Hecht #define TARGET_VT_LOCKSWITCH 0x560b 1179f7680a55SUlrich Hecht #define TARGET_VT_UNLOCKSWITCH 0x560c 1180774750c0SCédric VINCENT #define TARGET_VT_GETMODE 0x5601 1181774750c0SCédric VINCENT #define TARGET_VT_SETMODE 0x5602 1182774750c0SCédric VINCENT #define TARGET_VT_RELDISP 0x5605 1183774750c0SCédric VINCENT #define TARGET_VT_DISALLOCATE 0x5608 1184f7680a55SUlrich Hecht 118556e904ecSAlexander Graf /* device mapper */ 118656e904ecSAlexander Graf #define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00) 118756e904ecSAlexander Graf #define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01) 118856e904ecSAlexander Graf #define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02) 118956e904ecSAlexander Graf #define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03) 119056e904ecSAlexander Graf #define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04) 119156e904ecSAlexander Graf #define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05) 119256e904ecSAlexander Graf #define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06) 119356e904ecSAlexander Graf #define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07) 119456e904ecSAlexander Graf #define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08) 119556e904ecSAlexander Graf #define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09) 119656e904ecSAlexander Graf #define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a) 119756e904ecSAlexander Graf #define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b) 119856e904ecSAlexander Graf #define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c) 119956e904ecSAlexander Graf #define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d) 120056e904ecSAlexander Graf #define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e) 120156e904ecSAlexander Graf #define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f) 120256e904ecSAlexander Graf 1203e865b97fSChen Gang /* drm ioctls */ 1204e865b97fSChen Gang #define TARGET_DRM_IOCTL_VERSION TARGET_IOWRU('d', 0x00) 1205e865b97fSChen Gang 1206913b03c2SChen Gang /* drm i915 ioctls */ 1207913b03c2SChen Gang #define TARGET_DRM_IOCTL_I915_GETPARAM TARGET_IOWRU('d', 0x46) 1208913b03c2SChen Gang 12092521d698Sbellard /* from asm/termbits.h */ 12102521d698Sbellard 12113bfd9da1Sbellard #define TARGET_NCC 8 12123bfd9da1Sbellard struct target_termio { 121377e935f4SRichard Henderson abi_ushort c_iflag; /* input mode flags */ 121477e935f4SRichard Henderson abi_ushort c_oflag; /* output mode flags */ 121577e935f4SRichard Henderson abi_ushort c_cflag; /* control mode flags */ 121677e935f4SRichard Henderson abi_ushort c_lflag; /* local mode flags */ 12172521d698Sbellard unsigned char c_line; /* line discipline */ 12183bfd9da1Sbellard unsigned char c_cc[TARGET_NCC]; /* control characters */ 12192521d698Sbellard }; 12202521d698Sbellard 12213bfd9da1Sbellard struct target_winsize { 122277e935f4SRichard Henderson abi_ushort ws_row; 122377e935f4SRichard Henderson abi_ushort ws_col; 122477e935f4SRichard Henderson abi_ushort ws_xpixel; 122577e935f4SRichard Henderson abi_ushort ws_ypixel; 12263bfd9da1Sbellard }; 12272521d698Sbellard 12283bfd9da1Sbellard #include "termbits.h" 12292521d698Sbellard 1230d124853bSHelge Deller #if defined(TARGET_MIPS) || defined(TARGET_XTENSA) 12319e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x10 12329e0b74a4SPaul Brook #else 12339e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x08 12349e0b74a4SPaul Brook #endif 12359e0b74a4SPaul Brook 1236be5d6f48SRichard Henderson #ifdef TARGET_AARCH64 1237be5d6f48SRichard Henderson #define TARGET_PROT_BTI 0x10 1238d109b46dSRichard Henderson #define TARGET_PROT_MTE 0x20 1239be5d6f48SRichard Henderson #endif 1240be5d6f48SRichard Henderson 1241*492fe4e7SRichard Henderson #include "target_mman.h" 12422521d698Sbellard 124309701199SAlexander Graf #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 124409701199SAlexander Graf || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 1245daa4374aSPeter Maydell || defined(TARGET_CRIS) 12465f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 12472521d698Sbellard struct target_stat { 124877e935f4SRichard Henderson abi_ushort st_dev; 124977e935f4SRichard Henderson abi_ushort __pad1; 1250992f48a0Sblueswir1 abi_ulong st_ino; 125177e935f4SRichard Henderson abi_ushort st_mode; 125277e935f4SRichard Henderson abi_ushort st_nlink; 125377e935f4SRichard Henderson abi_ushort st_uid; 125477e935f4SRichard Henderson abi_ushort st_gid; 125577e935f4SRichard Henderson abi_ushort st_rdev; 125677e935f4SRichard Henderson abi_ushort __pad2; 1257992f48a0Sblueswir1 abi_ulong st_size; 1258992f48a0Sblueswir1 abi_ulong st_blksize; 1259992f48a0Sblueswir1 abi_ulong st_blocks; 1260992f48a0Sblueswir1 abi_ulong target_st_atime; 12615f992db6SChen-Yu Tsai abi_ulong target_st_atime_nsec; 1262992f48a0Sblueswir1 abi_ulong target_st_mtime; 12635f992db6SChen-Yu Tsai abi_ulong target_st_mtime_nsec; 1264992f48a0Sblueswir1 abi_ulong target_st_ctime; 12655f992db6SChen-Yu Tsai abi_ulong target_st_ctime_nsec; 1266992f48a0Sblueswir1 abi_ulong __unused4; 1267992f48a0Sblueswir1 abi_ulong __unused5; 12682521d698Sbellard }; 12692521d698Sbellard 12702521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely 12712521d698Sbellard * insane amounts of padding around dev_t's. 12722521d698Sbellard */ 127320d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 12742521d698Sbellard struct target_stat64 { 127577e935f4SRichard Henderson abi_ushort st_dev; 12762521d698Sbellard unsigned char __pad0[10]; 12772521d698Sbellard 12782521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1279992f48a0Sblueswir1 abi_ulong __st_ino; 12802521d698Sbellard 1281c7828bd1SRichard Henderson abi_uint st_mode; 1282c7828bd1SRichard Henderson abi_uint st_nlink; 12832521d698Sbellard 1284992f48a0Sblueswir1 abi_ulong st_uid; 1285992f48a0Sblueswir1 abi_ulong st_gid; 12862521d698Sbellard 128777e935f4SRichard Henderson abi_ushort st_rdev; 12882521d698Sbellard unsigned char __pad3[10]; 12892521d698Sbellard 129055a1bcffSRichard Henderson abi_llong st_size; 1291992f48a0Sblueswir1 abi_ulong st_blksize; 12922521d698Sbellard 1293992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1294992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 12952521d698Sbellard 1296992f48a0Sblueswir1 abi_ulong target_st_atime; 12975f992db6SChen-Yu Tsai abi_ulong target_st_atime_nsec; 12982521d698Sbellard 1299992f48a0Sblueswir1 abi_ulong target_st_mtime; 13005f992db6SChen-Yu Tsai abi_ulong target_st_mtime_nsec; 13012521d698Sbellard 1302992f48a0Sblueswir1 abi_ulong target_st_ctime; 13035f992db6SChen-Yu Tsai abi_ulong target_st_ctime_nsec; 13042521d698Sbellard 13056c977729SRichard Henderson abi_ullong st_ino; 1306541dc0d4SStefan Weil } QEMU_PACKED; 13072521d698Sbellard 1308ce4defa0Spbrook #ifdef TARGET_ARM 130920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1310ce4defa0Spbrook struct target_eabi_stat64 { 13116c977729SRichard Henderson abi_ullong st_dev; 1312c7828bd1SRichard Henderson abi_uint __pad1; 1313992f48a0Sblueswir1 abi_ulong __st_ino; 1314c7828bd1SRichard Henderson abi_uint st_mode; 1315c7828bd1SRichard Henderson abi_uint st_nlink; 1316ce4defa0Spbrook 1317992f48a0Sblueswir1 abi_ulong st_uid; 1318992f48a0Sblueswir1 abi_ulong st_gid; 1319ce4defa0Spbrook 13206c977729SRichard Henderson abi_ullong st_rdev; 1321c7828bd1SRichard Henderson abi_uint __pad2[2]; 1322ce4defa0Spbrook 132355a1bcffSRichard Henderson abi_llong st_size; 1324992f48a0Sblueswir1 abi_ulong st_blksize; 1325c7828bd1SRichard Henderson abi_uint __pad3; 13266c977729SRichard Henderson abi_ullong st_blocks; 1327ce4defa0Spbrook 1328992f48a0Sblueswir1 abi_ulong target_st_atime; 1329992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1330ce4defa0Spbrook 1331992f48a0Sblueswir1 abi_ulong target_st_mtime; 1332992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1333ce4defa0Spbrook 1334992f48a0Sblueswir1 abi_ulong target_st_ctime; 1335992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1336ce4defa0Spbrook 13376c977729SRichard Henderson abi_ullong st_ino; 1338541dc0d4SStefan Weil } QEMU_PACKED; 1339ce4defa0Spbrook #endif 1340ce4defa0Spbrook 1341992f48a0Sblueswir1 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 13421b8dd648Sblueswir1 struct target_stat { 1343c7828bd1SRichard Henderson abi_uint st_dev; 1344992f48a0Sblueswir1 abi_ulong st_ino; 1345c7828bd1SRichard Henderson abi_uint st_mode; 1346c7828bd1SRichard Henderson abi_uint st_nlink; 1347c7828bd1SRichard Henderson abi_uint st_uid; 1348c7828bd1SRichard Henderson abi_uint st_gid; 1349c7828bd1SRichard Henderson abi_uint st_rdev; 1350992f48a0Sblueswir1 abi_long st_size; 1351992f48a0Sblueswir1 abi_long target_st_atime; 1352992f48a0Sblueswir1 abi_long target_st_mtime; 1353992f48a0Sblueswir1 abi_long target_st_ctime; 1354992f48a0Sblueswir1 abi_long st_blksize; 1355992f48a0Sblueswir1 abi_long st_blocks; 1356992f48a0Sblueswir1 abi_ulong __unused4[2]; 13571b8dd648Sblueswir1 }; 13581b8dd648Sblueswir1 135920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 13601b8dd648Sblueswir1 struct target_stat64 { 13611b8dd648Sblueswir1 unsigned char __pad0[6]; 136277e935f4SRichard Henderson abi_ushort st_dev; 13631b8dd648Sblueswir1 13647af406a6SRichard Henderson abi_ullong st_ino; 13657af406a6SRichard Henderson abi_ullong st_nlink; 13661b8dd648Sblueswir1 1367c7828bd1SRichard Henderson abi_uint st_mode; 13681b8dd648Sblueswir1 1369c7828bd1SRichard Henderson abi_uint st_uid; 1370c7828bd1SRichard Henderson abi_uint st_gid; 13711b8dd648Sblueswir1 13721b8dd648Sblueswir1 unsigned char __pad2[6]; 137377e935f4SRichard Henderson abi_ushort st_rdev; 13741b8dd648Sblueswir1 137593c5c6cdSRichard Henderson abi_llong st_size; 137693c5c6cdSRichard Henderson abi_llong st_blksize; 13771b8dd648Sblueswir1 13781b8dd648Sblueswir1 unsigned char __pad4[4]; 1379c7828bd1SRichard Henderson abi_uint st_blocks; 13801b8dd648Sblueswir1 1381992f48a0Sblueswir1 abi_ulong target_st_atime; 13825f992db6SChen-Yu Tsai abi_ulong target_st_atime_nsec; 13831b8dd648Sblueswir1 1384992f48a0Sblueswir1 abi_ulong target_st_mtime; 13855f992db6SChen-Yu Tsai abi_ulong target_st_mtime_nsec; 13861b8dd648Sblueswir1 1387992f48a0Sblueswir1 abi_ulong target_st_ctime; 13885f992db6SChen-Yu Tsai abi_ulong target_st_ctime_nsec; 13891b8dd648Sblueswir1 1390992f48a0Sblueswir1 abi_ulong __unused4[3]; 13911b8dd648Sblueswir1 }; 13921b8dd648Sblueswir1 13933bfd9da1Sbellard #elif defined(TARGET_SPARC) 13943bfd9da1Sbellard 13955f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 13963bfd9da1Sbellard struct target_stat { 139777e935f4SRichard Henderson abi_ushort st_dev; 1398992f48a0Sblueswir1 abi_ulong st_ino; 139977e935f4SRichard Henderson abi_ushort st_mode; 140020d49567SRichard Henderson abi_short st_nlink; 140177e935f4SRichard Henderson abi_ushort st_uid; 140277e935f4SRichard Henderson abi_ushort st_gid; 140377e935f4SRichard Henderson abi_ushort st_rdev; 1404992f48a0Sblueswir1 abi_long st_size; 1405992f48a0Sblueswir1 abi_long target_st_atime; 14065f992db6SChen-Yu Tsai abi_ulong target_st_atime_nsec; 1407992f48a0Sblueswir1 abi_long target_st_mtime; 14085f992db6SChen-Yu Tsai abi_ulong target_st_mtime_nsec; 1409992f48a0Sblueswir1 abi_long target_st_ctime; 14105f992db6SChen-Yu Tsai abi_ulong target_st_ctime_nsec; 1411992f48a0Sblueswir1 abi_long st_blksize; 1412992f48a0Sblueswir1 abi_long st_blocks; 14135f992db6SChen-Yu Tsai abi_ulong __unused1[2]; 14143bfd9da1Sbellard }; 14153bfd9da1Sbellard 141620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 14173bfd9da1Sbellard struct target_stat64 { 14183bfd9da1Sbellard unsigned char __pad0[6]; 141977e935f4SRichard Henderson abi_ushort st_dev; 14203bfd9da1Sbellard 14217af406a6SRichard Henderson abi_ullong st_ino; 14223bfd9da1Sbellard 1423c7828bd1SRichard Henderson abi_uint st_mode; 1424c7828bd1SRichard Henderson abi_uint st_nlink; 14253bfd9da1Sbellard 1426c7828bd1SRichard Henderson abi_uint st_uid; 1427c7828bd1SRichard Henderson abi_uint st_gid; 14283bfd9da1Sbellard 14293bfd9da1Sbellard unsigned char __pad2[6]; 143077e935f4SRichard Henderson abi_ushort st_rdev; 14313bfd9da1Sbellard 14323bfd9da1Sbellard unsigned char __pad3[8]; 14333bfd9da1Sbellard 143493c5c6cdSRichard Henderson abi_llong st_size; 1435c7828bd1SRichard Henderson abi_uint st_blksize; 14363bfd9da1Sbellard 14373bfd9da1Sbellard unsigned char __pad4[8]; 1438c7828bd1SRichard Henderson abi_uint st_blocks; 14393bfd9da1Sbellard 1440c7828bd1SRichard Henderson abi_uint target_st_atime; 1441c7828bd1SRichard Henderson abi_uint target_st_atime_nsec; 14423bfd9da1Sbellard 1443c7828bd1SRichard Henderson abi_uint target_st_mtime; 1444c7828bd1SRichard Henderson abi_uint target_st_mtime_nsec; 14453bfd9da1Sbellard 1446c7828bd1SRichard Henderson abi_uint target_st_ctime; 1447c7828bd1SRichard Henderson abi_uint target_st_ctime_nsec; 14483bfd9da1Sbellard 1449c7828bd1SRichard Henderson abi_uint __unused1; 1450c7828bd1SRichard Henderson abi_uint __unused2; 14513bfd9da1Sbellard }; 14523bfd9da1Sbellard 145367867308Sbellard #elif defined(TARGET_PPC) 145467867308Sbellard 14555f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 145667867308Sbellard struct target_stat { 1457e32448e0Sj_mayer abi_ulong st_dev; 1458992f48a0Sblueswir1 abi_ulong st_ino; 145974154d7eSThomas Huth #if defined(TARGET_PPC64) 1460e32448e0Sj_mayer abi_ulong st_nlink; 1461c7828bd1SRichard Henderson abi_uint st_mode; 1462325e651fSj_mayer #else 1463c7828bd1SRichard Henderson abi_uint st_mode; 146477e935f4SRichard Henderson abi_ushort st_nlink; 1465325e651fSj_mayer #endif 1466c7828bd1SRichard Henderson abi_uint st_uid; 1467c7828bd1SRichard Henderson abi_uint st_gid; 1468e32448e0Sj_mayer abi_ulong st_rdev; 1469992f48a0Sblueswir1 abi_ulong st_size; 1470992f48a0Sblueswir1 abi_ulong st_blksize; 1471992f48a0Sblueswir1 abi_ulong st_blocks; 1472992f48a0Sblueswir1 abi_ulong target_st_atime; 1473e32448e0Sj_mayer abi_ulong target_st_atime_nsec; 1474992f48a0Sblueswir1 abi_ulong target_st_mtime; 1475e32448e0Sj_mayer abi_ulong target_st_mtime_nsec; 1476992f48a0Sblueswir1 abi_ulong target_st_ctime; 1477e32448e0Sj_mayer abi_ulong target_st_ctime_nsec; 1478992f48a0Sblueswir1 abi_ulong __unused4; 1479992f48a0Sblueswir1 abi_ulong __unused5; 148074154d7eSThomas Huth #if defined(TARGET_PPC64) 1481325e651fSj_mayer abi_ulong __unused6; 1482325e651fSj_mayer #endif 148367867308Sbellard }; 148467867308Sbellard 148574154d7eSThomas Huth #if !defined(TARGET_PPC64) 148620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1487541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 14886c977729SRichard Henderson abi_ullong st_dev; 14896c977729SRichard Henderson abi_ullong st_ino; 1490c7828bd1SRichard Henderson abi_uint st_mode; 1491c7828bd1SRichard Henderson abi_uint st_nlink; 1492c7828bd1SRichard Henderson abi_uint st_uid; 1493c7828bd1SRichard Henderson abi_uint st_gid; 14946c977729SRichard Henderson abi_ullong st_rdev; 14956c977729SRichard Henderson abi_ullong __pad0; 149655a1bcffSRichard Henderson abi_llong st_size; 1497b3c719b2SRichard Henderson abi_int st_blksize; 1498c7828bd1SRichard Henderson abi_uint __pad1; 149955a1bcffSRichard Henderson abi_llong st_blocks; /* Number 512-byte blocks allocated. */ 1500b3c719b2SRichard Henderson abi_int target_st_atime; 1501c7828bd1SRichard Henderson abi_uint target_st_atime_nsec; 1502b3c719b2SRichard Henderson abi_int target_st_mtime; 1503c7828bd1SRichard Henderson abi_uint target_st_mtime_nsec; 1504b3c719b2SRichard Henderson abi_int target_st_ctime; 1505c7828bd1SRichard Henderson abi_uint target_st_ctime_nsec; 1506c7828bd1SRichard Henderson abi_uint __unused4; 1507c7828bd1SRichard Henderson abi_uint __unused5; 150867867308Sbellard }; 150920d155bcSStefan Weil #endif 151067867308Sbellard 1511b779e29eSEdgar E. Iglesias #elif defined(TARGET_MICROBLAZE) 1512b779e29eSEdgar E. Iglesias 15135f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1514b779e29eSEdgar E. Iglesias struct target_stat { 1515b779e29eSEdgar E. Iglesias abi_ulong st_dev; 1516b779e29eSEdgar E. Iglesias abi_ulong st_ino; 1517c7828bd1SRichard Henderson abi_uint st_mode; 151877e935f4SRichard Henderson abi_ushort st_nlink; 1519c7828bd1SRichard Henderson abi_uint st_uid; 1520c7828bd1SRichard Henderson abi_uint st_gid; 1521b779e29eSEdgar E. Iglesias abi_ulong st_rdev; 1522b779e29eSEdgar E. Iglesias abi_ulong st_size; 1523b779e29eSEdgar E. Iglesias abi_ulong st_blksize; 1524b779e29eSEdgar E. Iglesias abi_ulong st_blocks; 1525b779e29eSEdgar E. Iglesias abi_ulong target_st_atime; 1526b779e29eSEdgar E. Iglesias abi_ulong target_st_atime_nsec; 1527b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime; 1528b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime_nsec; 1529b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime; 1530b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime_nsec; 1531b779e29eSEdgar E. Iglesias abi_ulong __unused4; 1532b779e29eSEdgar E. Iglesias abi_ulong __unused5; 1533b779e29eSEdgar E. Iglesias }; 1534b779e29eSEdgar E. Iglesias 1535b779e29eSEdgar E. Iglesias /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ 153620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1537541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 15387af406a6SRichard Henderson abi_ullong st_dev; 1539a523eb06SEdgar E. Iglesias #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1540f6ee1627SRichard Henderson abi_uint pad0; 1541f6ee1627SRichard Henderson abi_uint __st_ino; 1542a523eb06SEdgar E. Iglesias 1543f6ee1627SRichard Henderson abi_uint st_mode; 1544f6ee1627SRichard Henderson abi_uint st_nlink; 1545f6ee1627SRichard Henderson abi_uint st_uid; 1546f6ee1627SRichard Henderson abi_uint st_gid; 15477af406a6SRichard Henderson abi_ullong st_rdev; 15487af406a6SRichard Henderson abi_ullong __pad1; 1549b779e29eSEdgar E. Iglesias 155093c5c6cdSRichard Henderson abi_llong st_size; 15515dc0c971SRichard Henderson abi_int st_blksize; 1552f6ee1627SRichard Henderson abi_uint __pad2; 155393c5c6cdSRichard Henderson abi_llong st_blocks; 1554b779e29eSEdgar E. Iglesias 1555b3c719b2SRichard Henderson abi_int target_st_atime; 1556c7828bd1SRichard Henderson abi_uint target_st_atime_nsec; 1557b3c719b2SRichard Henderson abi_int target_st_mtime; 1558c7828bd1SRichard Henderson abi_uint target_st_mtime_nsec; 1559b3c719b2SRichard Henderson abi_int target_st_ctime; 1560c7828bd1SRichard Henderson abi_uint target_st_ctime_nsec; 15617af406a6SRichard Henderson abi_ullong st_ino; 1562b779e29eSEdgar E. Iglesias }; 1563b779e29eSEdgar E. Iglesias 1564e6e5906bSpbrook #elif defined(TARGET_M68K) 1565e6e5906bSpbrook 1566e6e5906bSpbrook struct target_stat { 156777e935f4SRichard Henderson abi_ushort st_dev; 156877e935f4SRichard Henderson abi_ushort __pad1; 1569992f48a0Sblueswir1 abi_ulong st_ino; 157077e935f4SRichard Henderson abi_ushort st_mode; 157177e935f4SRichard Henderson abi_ushort st_nlink; 157277e935f4SRichard Henderson abi_ushort st_uid; 157377e935f4SRichard Henderson abi_ushort st_gid; 157477e935f4SRichard Henderson abi_ushort st_rdev; 157577e935f4SRichard Henderson abi_ushort __pad2; 1576992f48a0Sblueswir1 abi_ulong st_size; 1577992f48a0Sblueswir1 abi_ulong st_blksize; 1578992f48a0Sblueswir1 abi_ulong st_blocks; 1579992f48a0Sblueswir1 abi_ulong target_st_atime; 1580992f48a0Sblueswir1 abi_ulong __unused1; 1581992f48a0Sblueswir1 abi_ulong target_st_mtime; 1582992f48a0Sblueswir1 abi_ulong __unused2; 1583992f48a0Sblueswir1 abi_ulong target_st_ctime; 1584992f48a0Sblueswir1 abi_ulong __unused3; 1585992f48a0Sblueswir1 abi_ulong __unused4; 1586992f48a0Sblueswir1 abi_ulong __unused5; 1587e6e5906bSpbrook }; 1588e6e5906bSpbrook 1589e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely 1590e6e5906bSpbrook * insane amounts of padding around dev_t's. 1591e6e5906bSpbrook */ 159220d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1593e6e5906bSpbrook struct target_stat64 { 15946c977729SRichard Henderson abi_ullong st_dev; 1595e6e5906bSpbrook unsigned char __pad1[2]; 1596e6e5906bSpbrook 1597e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1598992f48a0Sblueswir1 abi_ulong __st_ino; 1599e6e5906bSpbrook 1600c7828bd1SRichard Henderson abi_uint st_mode; 1601c7828bd1SRichard Henderson abi_uint st_nlink; 1602e6e5906bSpbrook 1603992f48a0Sblueswir1 abi_ulong st_uid; 1604992f48a0Sblueswir1 abi_ulong st_gid; 1605e6e5906bSpbrook 16066c977729SRichard Henderson abi_ullong st_rdev; 1607e6e5906bSpbrook unsigned char __pad3[2]; 1608e6e5906bSpbrook 160955a1bcffSRichard Henderson abi_llong st_size; 1610992f48a0Sblueswir1 abi_ulong st_blksize; 1611e6e5906bSpbrook 1612992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 1613992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1614e6e5906bSpbrook 1615992f48a0Sblueswir1 abi_ulong target_st_atime; 1616992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1617e6e5906bSpbrook 1618992f48a0Sblueswir1 abi_ulong target_st_mtime; 1619992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1620e6e5906bSpbrook 1621992f48a0Sblueswir1 abi_ulong target_st_ctime; 1622992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1623e6e5906bSpbrook 16246c977729SRichard Henderson abi_ullong st_ino; 1625541dc0d4SStefan Weil } QEMU_PACKED; 1626e6e5906bSpbrook 1627d26bc211Sths #elif defined(TARGET_ABI_MIPSN64) 1628540635baSths 16295f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1630540635baSths /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ 1631540635baSths struct target_stat { 1632c7828bd1SRichard Henderson abi_uint st_dev; 1633c7828bd1SRichard Henderson abi_uint st_pad0[3]; /* Reserved for st_dev expansion */ 1634540635baSths 1635992f48a0Sblueswir1 abi_ulong st_ino; 1636540635baSths 1637c7828bd1SRichard Henderson abi_uint st_mode; 1638c7828bd1SRichard Henderson abi_uint st_nlink; 1639540635baSths 1640b3c719b2SRichard Henderson abi_int st_uid; 1641b3c719b2SRichard Henderson abi_int st_gid; 1642540635baSths 1643c7828bd1SRichard Henderson abi_uint st_rdev; 1644c7828bd1SRichard Henderson abi_uint st_pad1[3]; /* Reserved for st_rdev expansion */ 1645540635baSths 1646992f48a0Sblueswir1 abi_ulong st_size; 1647540635baSths 1648540635baSths /* 1649540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1650540635baSths * but we don't have it under Linux. 1651540635baSths */ 1652c7828bd1SRichard Henderson abi_uint target_st_atime; 1653c7828bd1SRichard Henderson abi_uint target_st_atime_nsec; 1654540635baSths 1655c7828bd1SRichard Henderson abi_uint target_st_mtime; 1656c7828bd1SRichard Henderson abi_uint target_st_mtime_nsec; 1657540635baSths 1658c7828bd1SRichard Henderson abi_uint target_st_ctime; 1659c7828bd1SRichard Henderson abi_uint target_st_ctime_nsec; 1660540635baSths 1661c7828bd1SRichard Henderson abi_uint st_blksize; 1662c7828bd1SRichard Henderson abi_uint st_pad2; 1663540635baSths 1664992f48a0Sblueswir1 abi_ulong st_blocks; 1665540635baSths }; 1666540635baSths 1667d26bc211Sths #elif defined(TARGET_ABI_MIPSN32) 1668540635baSths 16695f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1670540635baSths struct target_stat { 16711ab2aea2SLeon Alrae abi_ulong st_dev; 16721ab2aea2SLeon Alrae abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 16737af406a6SRichard Henderson abi_ullong st_ino; 1674c7828bd1SRichard Henderson abi_uint st_mode; 1675c7828bd1SRichard Henderson abi_uint st_nlink; 1676b3c719b2SRichard Henderson abi_int st_uid; 1677b3c719b2SRichard Henderson abi_int st_gid; 16781ab2aea2SLeon Alrae abi_ulong st_rdev; 16791ab2aea2SLeon Alrae abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 168093c5c6cdSRichard Henderson abi_llong st_size; 16811ab2aea2SLeon Alrae abi_long target_st_atime; 16821ab2aea2SLeon Alrae abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 16831ab2aea2SLeon Alrae abi_long target_st_mtime; 16841ab2aea2SLeon Alrae abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 16851ab2aea2SLeon Alrae abi_long target_st_ctime; 16861ab2aea2SLeon Alrae abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 16871ab2aea2SLeon Alrae abi_ulong st_blksize; 16881ab2aea2SLeon Alrae abi_ulong st_pad2; 168993c5c6cdSRichard Henderson abi_llong st_blocks; 1690540635baSths }; 1691540635baSths 1692d26bc211Sths #elif defined(TARGET_ABI_MIPSO32) 1693048f6b4dSbellard 16945f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1695048f6b4dSbellard struct target_stat { 16960f41be8dSRichard Henderson abi_uint st_dev; 1697992f48a0Sblueswir1 abi_long st_pad1[3]; /* Reserved for network id */ 1698992f48a0Sblueswir1 abi_ulong st_ino; 1699c7828bd1SRichard Henderson abi_uint st_mode; 1700c7828bd1SRichard Henderson abi_uint st_nlink; 1701b3c719b2SRichard Henderson abi_int st_uid; 1702b3c719b2SRichard Henderson abi_int st_gid; 17030f41be8dSRichard Henderson abi_uint st_rdev; 1704992f48a0Sblueswir1 abi_long st_pad2[2]; 1705992f48a0Sblueswir1 abi_long st_size; 1706992f48a0Sblueswir1 abi_long st_pad3; 1707048f6b4dSbellard /* 1708048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1709048f6b4dSbellard * but we don't have it under Linux. 1710048f6b4dSbellard */ 1711992f48a0Sblueswir1 abi_long target_st_atime; 1712992f48a0Sblueswir1 abi_long target_st_atime_nsec; 1713992f48a0Sblueswir1 abi_long target_st_mtime; 1714992f48a0Sblueswir1 abi_long target_st_mtime_nsec; 1715992f48a0Sblueswir1 abi_long target_st_ctime; 1716992f48a0Sblueswir1 abi_long target_st_ctime_nsec; 1717992f48a0Sblueswir1 abi_long st_blksize; 1718992f48a0Sblueswir1 abi_long st_blocks; 1719992f48a0Sblueswir1 abi_long st_pad4[14]; 1720048f6b4dSbellard }; 1721048f6b4dSbellard 1722048f6b4dSbellard /* 1723048f6b4dSbellard * This matches struct stat64 in glibc2.1, hence the absolutely insane 1724048f6b4dSbellard * amounts of padding around dev_t's. The memory layout is the same as of 1725048f6b4dSbellard * struct stat of the 64-bit kernel. 1726048f6b4dSbellard */ 1727048f6b4dSbellard 172820d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1729048f6b4dSbellard struct target_stat64 { 1730992f48a0Sblueswir1 abi_ulong st_dev; 1731992f48a0Sblueswir1 abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 1732048f6b4dSbellard 17337af406a6SRichard Henderson abi_ullong st_ino; 1734048f6b4dSbellard 1735c7828bd1SRichard Henderson abi_uint st_mode; 1736c7828bd1SRichard Henderson abi_uint st_nlink; 1737048f6b4dSbellard 1738b3c719b2SRichard Henderson abi_int st_uid; 1739b3c719b2SRichard Henderson abi_int st_gid; 1740048f6b4dSbellard 1741992f48a0Sblueswir1 abi_ulong st_rdev; 1742992f48a0Sblueswir1 abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 1743048f6b4dSbellard 174493c5c6cdSRichard Henderson abi_llong st_size; 1745048f6b4dSbellard 1746048f6b4dSbellard /* 1747048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1748048f6b4dSbellard * but we don't have it under Linux. 1749048f6b4dSbellard */ 1750992f48a0Sblueswir1 abi_long target_st_atime; 1751992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 1752048f6b4dSbellard 1753992f48a0Sblueswir1 abi_long target_st_mtime; 1754992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 1755048f6b4dSbellard 1756992f48a0Sblueswir1 abi_long target_st_ctime; 1757992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 1758048f6b4dSbellard 1759992f48a0Sblueswir1 abi_ulong st_blksize; 1760992f48a0Sblueswir1 abi_ulong st_pad2; 1761048f6b4dSbellard 176293c5c6cdSRichard Henderson abi_llong st_blocks; 1763048f6b4dSbellard }; 17647a3148a9Sj_mayer 17657a3148a9Sj_mayer #elif defined(TARGET_ALPHA) 17667a3148a9Sj_mayer 17677a3148a9Sj_mayer struct target_stat { 1768c7828bd1SRichard Henderson abi_uint st_dev; 1769c7828bd1SRichard Henderson abi_uint st_ino; 1770c7828bd1SRichard Henderson abi_uint st_mode; 1771c7828bd1SRichard Henderson abi_uint st_nlink; 1772c7828bd1SRichard Henderson abi_uint st_uid; 1773c7828bd1SRichard Henderson abi_uint st_gid; 1774c7828bd1SRichard Henderson abi_uint st_rdev; 1775992f48a0Sblueswir1 abi_long st_size; 1776992f48a0Sblueswir1 abi_ulong target_st_atime; 1777992f48a0Sblueswir1 abi_ulong target_st_mtime; 1778992f48a0Sblueswir1 abi_ulong target_st_ctime; 1779c7828bd1SRichard Henderson abi_uint st_blksize; 1780c7828bd1SRichard Henderson abi_uint st_blocks; 1781c7828bd1SRichard Henderson abi_uint st_flags; 1782c7828bd1SRichard Henderson abi_uint st_gen; 17837a3148a9Sj_mayer }; 17847a3148a9Sj_mayer 178520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 17867a3148a9Sj_mayer struct target_stat64 { 1787992f48a0Sblueswir1 abi_ulong st_dev; 1788992f48a0Sblueswir1 abi_ulong st_ino; 1789992f48a0Sblueswir1 abi_ulong st_rdev; 1790992f48a0Sblueswir1 abi_long st_size; 1791992f48a0Sblueswir1 abi_ulong st_blocks; 17927a3148a9Sj_mayer 1793c7828bd1SRichard Henderson abi_uint st_mode; 1794c7828bd1SRichard Henderson abi_uint st_uid; 1795c7828bd1SRichard Henderson abi_uint st_gid; 1796c7828bd1SRichard Henderson abi_uint st_blksize; 1797c7828bd1SRichard Henderson abi_uint st_nlink; 1798c7828bd1SRichard Henderson abi_uint __pad0; 17997a3148a9Sj_mayer 1800992f48a0Sblueswir1 abi_ulong target_st_atime; 1801992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1802992f48a0Sblueswir1 abi_ulong target_st_mtime; 1803992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1804992f48a0Sblueswir1 abi_ulong target_st_ctime; 1805992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1806992f48a0Sblueswir1 abi_long __unused[3]; 18077a3148a9Sj_mayer }; 18087a3148a9Sj_mayer 18096db45e65Sths #elif defined(TARGET_SH4) 18106db45e65Sths 18115f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 18126db45e65Sths struct target_stat { 1813992f48a0Sblueswir1 abi_ulong st_dev; 1814992f48a0Sblueswir1 abi_ulong st_ino; 181577e935f4SRichard Henderson abi_ushort st_mode; 181677e935f4SRichard Henderson abi_ushort st_nlink; 181777e935f4SRichard Henderson abi_ushort st_uid; 181877e935f4SRichard Henderson abi_ushort st_gid; 1819992f48a0Sblueswir1 abi_ulong st_rdev; 1820992f48a0Sblueswir1 abi_ulong st_size; 1821992f48a0Sblueswir1 abi_ulong st_blksize; 1822992f48a0Sblueswir1 abi_ulong st_blocks; 1823992f48a0Sblueswir1 abi_ulong target_st_atime; 1824992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1825992f48a0Sblueswir1 abi_ulong target_st_mtime; 1826992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1827992f48a0Sblueswir1 abi_ulong target_st_ctime; 1828992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1829992f48a0Sblueswir1 abi_ulong __unused4; 1830992f48a0Sblueswir1 abi_ulong __unused5; 18316db45e65Sths }; 18326db45e65Sths 18336db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely 18346db45e65Sths * insane amounts of padding around dev_t's. 18356db45e65Sths */ 183620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1837541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 18386c977729SRichard Henderson abi_ullong st_dev; 18396db45e65Sths unsigned char __pad0[4]; 18406db45e65Sths 18416db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1842992f48a0Sblueswir1 abi_ulong __st_ino; 18436db45e65Sths 1844c7828bd1SRichard Henderson abi_uint st_mode; 1845c7828bd1SRichard Henderson abi_uint st_nlink; 18466db45e65Sths 1847992f48a0Sblueswir1 abi_ulong st_uid; 1848992f48a0Sblueswir1 abi_ulong st_gid; 18496db45e65Sths 18506c977729SRichard Henderson abi_ullong st_rdev; 18516db45e65Sths unsigned char __pad3[4]; 18526db45e65Sths 185355a1bcffSRichard Henderson abi_llong st_size; 1854992f48a0Sblueswir1 abi_ulong st_blksize; 18556db45e65Sths 18566c977729SRichard Henderson abi_ullong st_blocks; /* Number 512-byte blocks allocated. */ 18576db45e65Sths 1858992f48a0Sblueswir1 abi_ulong target_st_atime; 1859992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 18606db45e65Sths 1861992f48a0Sblueswir1 abi_ulong target_st_mtime; 1862992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 18636db45e65Sths 1864992f48a0Sblueswir1 abi_ulong target_st_ctime; 1865992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 18666db45e65Sths 18676c977729SRichard Henderson abi_ullong st_ino; 18686db45e65Sths }; 18696db45e65Sths 1870d2fd1af7Sbellard #elif defined(TARGET_I386) && !defined(TARGET_ABI32) 18715f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1872d2fd1af7Sbellard struct target_stat { 1873d2fd1af7Sbellard abi_ulong st_dev; 1874d2fd1af7Sbellard abi_ulong st_ino; 1875d2fd1af7Sbellard abi_ulong st_nlink; 1876d2fd1af7Sbellard 1877c7828bd1SRichard Henderson abi_uint st_mode; 1878c7828bd1SRichard Henderson abi_uint st_uid; 1879c7828bd1SRichard Henderson abi_uint st_gid; 1880c7828bd1SRichard Henderson abi_uint __pad0; 1881d2fd1af7Sbellard abi_ulong st_rdev; 1882d2fd1af7Sbellard abi_long st_size; 1883d2fd1af7Sbellard abi_long st_blksize; 1884d2fd1af7Sbellard abi_long st_blocks; /* Number 512-byte blocks allocated. */ 1885d2fd1af7Sbellard 1886d2fd1af7Sbellard abi_ulong target_st_atime; 1887d2fd1af7Sbellard abi_ulong target_st_atime_nsec; 1888d2fd1af7Sbellard abi_ulong target_st_mtime; 1889d2fd1af7Sbellard abi_ulong target_st_mtime_nsec; 1890d2fd1af7Sbellard abi_ulong target_st_ctime; 1891d2fd1af7Sbellard abi_ulong target_st_ctime_nsec; 1892d2fd1af7Sbellard 1893d2fd1af7Sbellard abi_long __unused[3]; 1894d2fd1af7Sbellard }; 1895a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 1896a4c075f1SUlrich Hecht struct target_stat { 1897a4c075f1SUlrich Hecht abi_ulong st_dev; 1898a4c075f1SUlrich Hecht abi_ulong st_ino; 1899a4c075f1SUlrich Hecht abi_ulong st_nlink; 1900c7828bd1SRichard Henderson abi_uint st_mode; 1901c7828bd1SRichard Henderson abi_uint st_uid; 1902c7828bd1SRichard Henderson abi_uint st_gid; 1903c7828bd1SRichard Henderson abi_uint __pad1; 1904a4c075f1SUlrich Hecht abi_ulong st_rdev; 1905a4c075f1SUlrich Hecht abi_ulong st_size; 1906a4c075f1SUlrich Hecht abi_ulong target_st_atime; 1907a4c075f1SUlrich Hecht abi_ulong target_st_atime_nsec; 1908a4c075f1SUlrich Hecht abi_ulong target_st_mtime; 1909a4c075f1SUlrich Hecht abi_ulong target_st_mtime_nsec; 1910a4c075f1SUlrich Hecht abi_ulong target_st_ctime; 1911a4c075f1SUlrich Hecht abi_ulong target_st_ctime_nsec; 1912a4c075f1SUlrich Hecht abi_ulong st_blksize; 1913a4c075f1SUlrich Hecht abi_long st_blocks; 1914a4c075f1SUlrich Hecht abi_ulong __unused[3]; 1915a4c075f1SUlrich Hecht }; 191609701199SAlexander Graf #elif defined(TARGET_AARCH64) 19175f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 191809701199SAlexander Graf struct target_stat { 191909701199SAlexander Graf abi_ulong st_dev; 192009701199SAlexander Graf abi_ulong st_ino; 1921c7828bd1SRichard Henderson abi_uint st_mode; 1922c7828bd1SRichard Henderson abi_uint st_nlink; 1923c7828bd1SRichard Henderson abi_uint st_uid; 1924c7828bd1SRichard Henderson abi_uint st_gid; 192509701199SAlexander Graf abi_ulong st_rdev; 192609701199SAlexander Graf abi_ulong _pad1; 192709701199SAlexander Graf abi_long st_size; 1928b3c719b2SRichard Henderson abi_int st_blksize; 1929b3c719b2SRichard Henderson abi_int __pad2; 193009701199SAlexander Graf abi_long st_blocks; 193109701199SAlexander Graf abi_long target_st_atime; 193209701199SAlexander Graf abi_ulong target_st_atime_nsec; 193309701199SAlexander Graf abi_long target_st_mtime; 193409701199SAlexander Graf abi_ulong target_st_mtime_nsec; 193509701199SAlexander Graf abi_long target_st_ctime; 193609701199SAlexander Graf abi_ulong target_st_ctime_nsec; 1937c7828bd1SRichard Henderson abi_uint __unused[2]; 193809701199SAlexander Graf }; 1939ba7651fbSMax Filippov #elif defined(TARGET_XTENSA) 19405f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1941ba7651fbSMax Filippov struct target_stat { 1942ba7651fbSMax Filippov abi_ulong st_dev; 1943ba7651fbSMax Filippov abi_ulong st_ino; 1944c7828bd1SRichard Henderson abi_uint st_mode; 1945c7828bd1SRichard Henderson abi_uint st_nlink; 1946c7828bd1SRichard Henderson abi_uint st_uid; 1947c7828bd1SRichard Henderson abi_uint st_gid; 1948ba7651fbSMax Filippov abi_ulong st_rdev; 1949ba7651fbSMax Filippov abi_long st_size; 1950ba7651fbSMax Filippov abi_ulong st_blksize; 1951ba7651fbSMax Filippov abi_ulong st_blocks; 1952ba7651fbSMax Filippov abi_ulong target_st_atime; 1953ba7651fbSMax Filippov abi_ulong target_st_atime_nsec; 1954ba7651fbSMax Filippov abi_ulong target_st_mtime; 1955ba7651fbSMax Filippov abi_ulong target_st_mtime_nsec; 1956ba7651fbSMax Filippov abi_ulong target_st_ctime; 1957ba7651fbSMax Filippov abi_ulong target_st_ctime_nsec; 1958ba7651fbSMax Filippov abi_ulong __unused4; 1959ba7651fbSMax Filippov abi_ulong __unused5; 1960ba7651fbSMax Filippov }; 1961ba7651fbSMax Filippov 1962ba7651fbSMax Filippov #define TARGET_HAS_STRUCT_STAT64 1963ba7651fbSMax Filippov struct target_stat64 { 19647af406a6SRichard Henderson abi_ullong st_dev; /* Device */ 19657af406a6SRichard Henderson abi_ullong st_ino; /* File serial number */ 1966c7828bd1SRichard Henderson abi_uint st_mode; /* File mode. */ 1967c7828bd1SRichard Henderson abi_uint st_nlink; /* Link count. */ 1968c7828bd1SRichard Henderson abi_uint st_uid; /* User ID of the file's owner. */ 1969c7828bd1SRichard Henderson abi_uint st_gid; /* Group ID of the file's group. */ 19707af406a6SRichard Henderson abi_ullong st_rdev; /* Device number, if device. */ 197193c5c6cdSRichard Henderson abi_llong st_size; /* Size of file, in bytes. */ 1972ba7651fbSMax Filippov abi_ulong st_blksize; /* Optimal block size for I/O. */ 1973ba7651fbSMax Filippov abi_ulong __unused2; 19747af406a6SRichard Henderson abi_ullong st_blocks; /* Number 512-byte blocks allocated. */ 1975ba7651fbSMax Filippov abi_ulong target_st_atime; /* Time of last access. */ 1976ba7651fbSMax Filippov abi_ulong target_st_atime_nsec; 1977ba7651fbSMax Filippov abi_ulong target_st_mtime; /* Time of last modification. */ 1978ba7651fbSMax Filippov abi_ulong target_st_mtime_nsec; 1979ba7651fbSMax Filippov abi_ulong target_st_ctime; /* Time of last status change. */ 1980ba7651fbSMax Filippov abi_ulong target_st_ctime_nsec; 1981ba7651fbSMax Filippov abi_ulong __unused4; 1982ba7651fbSMax Filippov abi_ulong __unused5; 1983ba7651fbSMax Filippov }; 1984ba7651fbSMax Filippov 1985be23b0ebSPhilippe Mathieu-Daudé #elif defined(TARGET_OPENRISC) || defined(TARGET_NIOS2) \ 1986be23b0ebSPhilippe Mathieu-Daudé || defined(TARGET_RISCV) || defined(TARGET_HEXAGON) 1987c7819dfbSPeter Maydell 1988c7819dfbSPeter Maydell /* These are the asm-generic versions of the stat and stat64 structures */ 1989c7819dfbSPeter Maydell 19905f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1991d962783eSJia Liu struct target_stat { 1992d962783eSJia Liu abi_ulong st_dev; 1993d962783eSJia Liu abi_ulong st_ino; 1994c7828bd1SRichard Henderson abi_uint st_mode; 1995c7828bd1SRichard Henderson abi_uint st_nlink; 1996c7828bd1SRichard Henderson abi_uint st_uid; 1997c7828bd1SRichard Henderson abi_uint st_gid; 1998d962783eSJia Liu abi_ulong st_rdev; 1999c7819dfbSPeter Maydell abi_ulong __pad1; 2000d962783eSJia Liu abi_long st_size; 2001b3c719b2SRichard Henderson abi_int st_blksize; 2002b3c719b2SRichard Henderson abi_int __pad2; 2003c7819dfbSPeter Maydell abi_long st_blocks; 2004c7819dfbSPeter Maydell abi_long target_st_atime; 2005d962783eSJia Liu abi_ulong target_st_atime_nsec; 2006c7819dfbSPeter Maydell abi_long target_st_mtime; 2007d962783eSJia Liu abi_ulong target_st_mtime_nsec; 2008c7819dfbSPeter Maydell abi_long target_st_ctime; 2009d962783eSJia Liu abi_ulong target_st_ctime_nsec; 2010c7828bd1SRichard Henderson abi_uint __unused4; 2011c7828bd1SRichard Henderson abi_uint __unused5; 2012d962783eSJia Liu }; 2013c7819dfbSPeter Maydell 201447ae93cdSMichael Clark #if !defined(TARGET_RISCV64) 201520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 2016c7819dfbSPeter Maydell struct target_stat64 { 20177af406a6SRichard Henderson abi_ullong st_dev; 20187af406a6SRichard Henderson abi_ullong st_ino; 2019c7828bd1SRichard Henderson abi_uint st_mode; 2020c7828bd1SRichard Henderson abi_uint st_nlink; 2021c7828bd1SRichard Henderson abi_uint st_uid; 2022c7828bd1SRichard Henderson abi_uint st_gid; 20237af406a6SRichard Henderson abi_ullong st_rdev; 20247af406a6SRichard Henderson abi_ullong __pad1; 202593c5c6cdSRichard Henderson abi_llong st_size; 2026b3c719b2SRichard Henderson abi_int st_blksize; 2027b3c719b2SRichard Henderson abi_int __pad2; 202893c5c6cdSRichard Henderson abi_llong st_blocks; 2029b3c719b2SRichard Henderson abi_int target_st_atime; 2030c7828bd1SRichard Henderson abi_uint target_st_atime_nsec; 2031b3c719b2SRichard Henderson abi_int target_st_mtime; 2032c7828bd1SRichard Henderson abi_uint target_st_mtime_nsec; 2033b3c719b2SRichard Henderson abi_int target_st_ctime; 2034c7828bd1SRichard Henderson abi_uint target_st_ctime_nsec; 2035c7828bd1SRichard Henderson abi_uint __unused4; 2036c7828bd1SRichard Henderson abi_uint __unused5; 2037c7819dfbSPeter Maydell }; 203847ae93cdSMichael Clark #endif 2039c7819dfbSPeter Maydell 2040a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 2041a10d1e50SRichard Henderson 20425f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 2043a10d1e50SRichard Henderson struct target_stat { 2044a10d1e50SRichard Henderson abi_uint st_dev; 2045a10d1e50SRichard Henderson abi_uint st_ino; 2046a10d1e50SRichard Henderson abi_ushort st_mode; 2047a10d1e50SRichard Henderson abi_ushort st_nlink; 2048a10d1e50SRichard Henderson abi_ushort _res1; 2049a10d1e50SRichard Henderson abi_ushort _res2; 2050a10d1e50SRichard Henderson abi_uint st_rdev; 2051a10d1e50SRichard Henderson abi_int st_size; 2052a10d1e50SRichard Henderson abi_int target_st_atime; 2053a10d1e50SRichard Henderson abi_uint target_st_atime_nsec; 2054a10d1e50SRichard Henderson abi_int target_st_mtime; 2055a10d1e50SRichard Henderson abi_uint target_st_mtime_nsec; 2056a10d1e50SRichard Henderson abi_int target_st_ctime; 2057a10d1e50SRichard Henderson abi_uint target_st_ctime_nsec; 2058a10d1e50SRichard Henderson abi_int st_blksize; 2059a10d1e50SRichard Henderson abi_int st_blocks; 2060a10d1e50SRichard Henderson abi_uint _unused1; 2061a10d1e50SRichard Henderson abi_uint _unused2; 2062a10d1e50SRichard Henderson abi_uint _unused3; 2063a10d1e50SRichard Henderson abi_uint _unused4; 2064a10d1e50SRichard Henderson abi_ushort _unused5; 2065a10d1e50SRichard Henderson abi_short st_fstype; 2066a10d1e50SRichard Henderson abi_uint st_realdev; 2067a10d1e50SRichard Henderson abi_ushort st_basemode; 2068a10d1e50SRichard Henderson abi_ushort _unused6; 2069a10d1e50SRichard Henderson abi_uint st_uid; 2070a10d1e50SRichard Henderson abi_uint st_gid; 2071a10d1e50SRichard Henderson abi_uint _unused7[3]; 2072a10d1e50SRichard Henderson }; 2073a10d1e50SRichard Henderson 2074a10d1e50SRichard Henderson #define TARGET_HAS_STRUCT_STAT64 2075a10d1e50SRichard Henderson struct target_stat64 { 20767af406a6SRichard Henderson abi_ullong st_dev; 2077a10d1e50SRichard Henderson abi_uint _pad1; 2078a10d1e50SRichard Henderson abi_uint _res1; 2079a10d1e50SRichard Henderson abi_uint st_mode; 2080a10d1e50SRichard Henderson abi_uint st_nlink; 2081a10d1e50SRichard Henderson abi_uint st_uid; 2082a10d1e50SRichard Henderson abi_uint st_gid; 20837af406a6SRichard Henderson abi_ullong st_rdev; 2084a10d1e50SRichard Henderson abi_uint _pad2; 208593c5c6cdSRichard Henderson abi_llong st_size; 2086a10d1e50SRichard Henderson abi_int st_blksize; 208793c5c6cdSRichard Henderson abi_llong st_blocks; 2088a10d1e50SRichard Henderson abi_int target_st_atime; 2089a10d1e50SRichard Henderson abi_uint target_st_atime_nsec; 2090a10d1e50SRichard Henderson abi_int target_st_mtime; 2091a10d1e50SRichard Henderson abi_uint target_st_mtime_nsec; 2092a10d1e50SRichard Henderson abi_int target_st_ctime; 2093a10d1e50SRichard Henderson abi_uint target_st_ctime_nsec; 20947af406a6SRichard Henderson abi_ullong st_ino; 2095a10d1e50SRichard Henderson }; 2096a10d1e50SRichard Henderson 20971f630196SSong Gao #elif defined(TARGET_LOONGARCH64) 20981f630196SSong Gao 20991f630196SSong Gao /* LoongArch no newfstatat/fstat syscall. */ 21001f630196SSong Gao 2101048f6b4dSbellard #else 2102048f6b4dSbellard #error unsupported CPU 2103048f6b4dSbellard #endif 21042521d698Sbellard 21054ce6f8deSths typedef struct { 2106b3c719b2SRichard Henderson abi_int val[2]; 2107c227f099SAnthony Liguori } target_fsid_t; 21084ce6f8deSths 210956c8f68fSbellard #ifdef TARGET_MIPS 2110d26bc211Sths #ifdef TARGET_ABI_MIPSN32 2111540635baSths struct target_statfs { 21125dc0c971SRichard Henderson abi_int f_type; 21135dc0c971SRichard Henderson abi_int f_bsize; 21145dc0c971SRichard Henderson abi_int f_frsize; /* Fragment size - unsupported */ 21155dc0c971SRichard Henderson abi_int f_blocks; 21165dc0c971SRichard Henderson abi_int f_bfree; 21175dc0c971SRichard Henderson abi_int f_files; 21185dc0c971SRichard Henderson abi_int f_ffree; 21195dc0c971SRichard Henderson abi_int f_bavail; 2120540635baSths 2121540635baSths /* Linux specials */ 2122c227f099SAnthony Liguori target_fsid_t f_fsid; 21235dc0c971SRichard Henderson abi_int f_namelen; 21245dc0c971SRichard Henderson abi_int f_flags; 21255dc0c971SRichard Henderson abi_int f_spare[5]; 2126540635baSths }; 2127540635baSths #else 212856c8f68fSbellard struct target_statfs { 2129992f48a0Sblueswir1 abi_long f_type; 2130992f48a0Sblueswir1 abi_long f_bsize; 2131992f48a0Sblueswir1 abi_long f_frsize; /* Fragment size - unsupported */ 2132992f48a0Sblueswir1 abi_long f_blocks; 2133992f48a0Sblueswir1 abi_long f_bfree; 2134992f48a0Sblueswir1 abi_long f_files; 2135992f48a0Sblueswir1 abi_long f_ffree; 2136992f48a0Sblueswir1 abi_long f_bavail; 213756c8f68fSbellard 213856c8f68fSbellard /* Linux specials */ 2139c227f099SAnthony Liguori target_fsid_t f_fsid; 2140992f48a0Sblueswir1 abi_long f_namelen; 2141d4247ec2SShea Levy abi_long f_flags; 2142d4247ec2SShea Levy abi_long f_spare[5]; 214356c8f68fSbellard }; 2144540635baSths #endif 214556c8f68fSbellard 214656c8f68fSbellard struct target_statfs64 { 2147f6ee1627SRichard Henderson abi_uint f_type; 2148f6ee1627SRichard Henderson abi_uint f_bsize; 2149f6ee1627SRichard Henderson abi_uint f_frsize; /* Fragment size - unsupported */ 2150f6ee1627SRichard Henderson abi_uint __pad; 21517af406a6SRichard Henderson abi_ullong f_blocks; 21527af406a6SRichard Henderson abi_ullong f_bfree; 21537af406a6SRichard Henderson abi_ullong f_files; 21547af406a6SRichard Henderson abi_ullong f_ffree; 21557af406a6SRichard Henderson abi_ullong f_bavail; 2156c227f099SAnthony Liguori target_fsid_t f_fsid; 2157f6ee1627SRichard Henderson abi_uint f_namelen; 2158f6ee1627SRichard Henderson abi_uint f_flags; 2159f6ee1627SRichard Henderson abi_uint f_spare[5]; 216056c8f68fSbellard }; 2161c4d10628Sbalrog #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ 216247ae93cdSMichael Clark defined(TARGET_SPARC64) || defined(TARGET_AARCH64) || \ 21637bf36a5cSWANG Xuerui defined(TARGET_RISCV) || defined(TARGET_LOONGARCH64)) && \ 21647bf36a5cSWANG Xuerui !defined(TARGET_ABI32) 2165325e651fSj_mayer struct target_statfs { 2166325e651fSj_mayer abi_long f_type; 2167325e651fSj_mayer abi_long f_bsize; 2168325e651fSj_mayer abi_long f_blocks; 2169325e651fSj_mayer abi_long f_bfree; 2170325e651fSj_mayer abi_long f_bavail; 2171325e651fSj_mayer abi_long f_files; 2172325e651fSj_mayer abi_long f_ffree; 2173c227f099SAnthony Liguori target_fsid_t f_fsid; 2174325e651fSj_mayer abi_long f_namelen; 2175325e651fSj_mayer abi_long f_frsize; 2176d4247ec2SShea Levy abi_long f_flags; 2177d4247ec2SShea Levy abi_long f_spare[4]; 2178325e651fSj_mayer }; 2179325e651fSj_mayer 2180325e651fSj_mayer struct target_statfs64 { 2181325e651fSj_mayer abi_long f_type; 2182325e651fSj_mayer abi_long f_bsize; 2183325e651fSj_mayer abi_long f_blocks; 2184325e651fSj_mayer abi_long f_bfree; 2185325e651fSj_mayer abi_long f_bavail; 2186325e651fSj_mayer abi_long f_files; 2187325e651fSj_mayer abi_long f_ffree; 2188c227f099SAnthony Liguori target_fsid_t f_fsid; 2189325e651fSj_mayer abi_long f_namelen; 2190325e651fSj_mayer abi_long f_frsize; 2191d4247ec2SShea Levy abi_long f_flags; 2192d4247ec2SShea Levy abi_long f_spare[4]; 2193325e651fSj_mayer }; 2194a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 2195a4c075f1SUlrich Hecht struct target_statfs { 21965dc0c971SRichard Henderson abi_int f_type; 21975dc0c971SRichard Henderson abi_int f_bsize; 2198a4c075f1SUlrich Hecht abi_long f_blocks; 2199a4c075f1SUlrich Hecht abi_long f_bfree; 2200a4c075f1SUlrich Hecht abi_long f_bavail; 2201a4c075f1SUlrich Hecht abi_long f_files; 2202a4c075f1SUlrich Hecht abi_long f_ffree; 2203a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 22045dc0c971SRichard Henderson abi_int f_namelen; 22055dc0c971SRichard Henderson abi_int f_frsize; 22065dc0c971SRichard Henderson abi_int f_flags; 22075dc0c971SRichard Henderson abi_int f_spare[4]; 2208d4247ec2SShea Levy 2209a4c075f1SUlrich Hecht }; 2210a4c075f1SUlrich Hecht 2211a4c075f1SUlrich Hecht struct target_statfs64 { 22125dc0c971SRichard Henderson abi_int f_type; 22135dc0c971SRichard Henderson abi_int f_bsize; 2214a4c075f1SUlrich Hecht abi_long f_blocks; 2215a4c075f1SUlrich Hecht abi_long f_bfree; 2216a4c075f1SUlrich Hecht abi_long f_bavail; 2217a4c075f1SUlrich Hecht abi_long f_files; 2218a4c075f1SUlrich Hecht abi_long f_ffree; 2219a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 22205dc0c971SRichard Henderson abi_int f_namelen; 22215dc0c971SRichard Henderson abi_int f_frsize; 22225dc0c971SRichard Henderson abi_int f_flags; 22235dc0c971SRichard Henderson abi_int f_spare[4]; 2224a4c075f1SUlrich Hecht }; 222556c8f68fSbellard #else 222656c8f68fSbellard struct target_statfs { 2227f6ee1627SRichard Henderson abi_uint f_type; 2228f6ee1627SRichard Henderson abi_uint f_bsize; 2229f6ee1627SRichard Henderson abi_uint f_blocks; 2230f6ee1627SRichard Henderson abi_uint f_bfree; 2231f6ee1627SRichard Henderson abi_uint f_bavail; 2232f6ee1627SRichard Henderson abi_uint f_files; 2233f6ee1627SRichard Henderson abi_uint f_ffree; 2234c227f099SAnthony Liguori target_fsid_t f_fsid; 2235f6ee1627SRichard Henderson abi_uint f_namelen; 2236f6ee1627SRichard Henderson abi_uint f_frsize; 2237f6ee1627SRichard Henderson abi_uint f_flags; 2238f6ee1627SRichard Henderson abi_uint f_spare[4]; 223956c8f68fSbellard }; 224056c8f68fSbellard 224156c8f68fSbellard struct target_statfs64 { 2242f6ee1627SRichard Henderson abi_uint f_type; 2243f6ee1627SRichard Henderson abi_uint f_bsize; 22447af406a6SRichard Henderson abi_ullong f_blocks; 22457af406a6SRichard Henderson abi_ullong f_bfree; 22467af406a6SRichard Henderson abi_ullong f_bavail; 22477af406a6SRichard Henderson abi_ullong f_files; 22487af406a6SRichard Henderson abi_ullong f_ffree; 2249c227f099SAnthony Liguori target_fsid_t f_fsid; 2250f6ee1627SRichard Henderson abi_uint f_namelen; 2251f6ee1627SRichard Henderson abi_uint f_frsize; 2252f6ee1627SRichard Henderson abi_uint f_flags; 2253f6ee1627SRichard Henderson abi_uint f_spare[4]; 225456c8f68fSbellard }; 225556c8f68fSbellard #endif 225656c8f68fSbellard 22577e22e546SUlrich Hecht #define TARGET_F_LINUX_SPECIFIC_BASE 1024 22587e22e546SUlrich Hecht #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0) 22597e22e546SUlrich Hecht #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1) 22607e22e546SUlrich Hecht #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) 22612bb963ffSShu-Chun Weng #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE + 2) 22627e3b92ecSPeter Maydell #define TARGET_F_SETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 7) 22637e3b92ecSPeter Maydell #define TARGET_F_GETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 8) 22642bb963ffSShu-Chun Weng #define TARGET_F_ADD_SEALS (TARGET_F_LINUX_SPECIFIC_BASE + 9) 22652bb963ffSShu-Chun Weng #define TARGET_F_GET_SEALS (TARGET_F_LINUX_SPECIFIC_BASE + 10) 22667e22e546SUlrich Hecht 22675de7706eSLaurent Vivier #include "target_fcntl.h" 22688d5d3004SAndreas Schwab 22692521d698Sbellard /* soundcard defines */ 227067cc32ebSVeres Lajos /* XXX: convert them all to arch independent entries */ 2271b3c719b2SRichard Henderson #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, abi_int); 22722521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 22732521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 22742521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 22752521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA 0xc0144302 22762521d698Sbellard #define TARGET_SNDCTL_COPR_RESET 0x00004300 22772521d698Sbellard #define TARGET_SNDCTL_COPR_RUN 0xc0144306 22782521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 22792521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE 0x40144305 22802521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA 0x40144304 22812521d698Sbellard #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) 22822521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) 2283b3c719b2SRichard Henderson #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, abi_int) 2284b3c719b2SRichard Henderson #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, abi_int) 2285b3c719b2SRichard Henderson #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, abi_int) 2286b3c719b2SRichard Henderson #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, abi_int) 2287b3c719b2SRichard Henderson #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, abi_int) 2288b3c719b2SRichard Henderson #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, abi_int) 22892521d698Sbellard #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) 2290b3c719b2SRichard Henderson #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, abi_int) 2291b3c719b2SRichard Henderson #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, abi_int) 2292b3c719b2SRichard Henderson #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, abi_int) 22932521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) 22942521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) 2295b3c719b2SRichard Henderson #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, abi_int) 2296b3c719b2SRichard Henderson #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, abi_int) 22972521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) 22982521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) 22995f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19) 23005f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20) 23012521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e 23022521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 23032521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 23042521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 23052521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 23062521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f 23072521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 23082521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO 0xc074510c 23092521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 23102521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 23112521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 23122521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 23132521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 23142521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 23152521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 23162521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 23172521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b 23182521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a 23192521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 23202521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC 0x00005111 23212521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 23222521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET 0x00005100 23232521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 23242521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC 0x00005101 23252521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 23262521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d 23272521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d 23282521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 23292521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e 23302521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 23312521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME 0x40045407 23322521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT 0x40045408 23332521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 23342521d698Sbellard #define TARGET_SNDCTL_TMR_START 0x00005402 23352521d698Sbellard #define TARGET_SNDCTL_TMR_STOP 0x00005403 23362521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 23372521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 23382521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE 0x80045002 23392521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 23402521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS 0x80045005 23412521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 23422521d698Sbellard #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) 23432521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 2344b3c719b2SRichard Henderson #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, abi_int) 2345b3c719b2SRichard Henderson #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, abi_int) 2346b3c719b2SRichard Henderson #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, abi_int) 2347b3c719b2SRichard Henderson #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, abi_int) 2348b3c719b2SRichard Henderson #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, abi_int) 23492521d698Sbellard 2350b3c719b2SRichard Henderson #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, abi_int) 23512521d698Sbellard 23522521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) 23532521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) 23542521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) 23552521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) 23562521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) 23572521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) 23582521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) 23592521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) 23602521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) 23612521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) 23622521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) 23632521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) 23642521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) 23652521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) 23662521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) 23672521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) 23682521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) 23692521d698Sbellard 23702521d698Sbellard /* Obsolete macros */ 23712521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) 23722521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) 23732521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) 23742521d698Sbellard 23752521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) 23762521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) 23772521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) 23782521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) 23792521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) 23802521d698Sbellard 2381b3c719b2SRichard Henderson #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, abi_int) 23822521d698Sbellard 23832521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) 23842521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) 23852521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) 23862521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) 23872521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) 23882521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) 23892521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) 23902521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) 23912521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) 23922521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) 23932521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) 23942521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) 23952521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) 23962521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) 23972521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) 23982521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) 23992521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) 24002521d698Sbellard 24012521d698Sbellard /* Obsolete macros */ 24022521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) 24032521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) 24042521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) 24052521d698Sbellard 24062521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) 24072521d698Sbellard 2408aca7708eSFilip Bozuta struct target_snd_timer_id { 2409b3c719b2SRichard Henderson abi_int dev_class; 2410b3c719b2SRichard Henderson abi_int dev_sclass; 2411b3c719b2SRichard Henderson abi_int card; 2412b3c719b2SRichard Henderson abi_int device; 2413b3c719b2SRichard Henderson abi_int subdevice; 2414aca7708eSFilip Bozuta }; 2415aca7708eSFilip Bozuta 2416aca7708eSFilip Bozuta struct target_snd_timer_ginfo { 2417aca7708eSFilip Bozuta struct target_snd_timer_id tid; 2418c7828bd1SRichard Henderson abi_uint flags; 2419b3c719b2SRichard Henderson abi_int card; 2420aca7708eSFilip Bozuta unsigned char id[64]; 2421aca7708eSFilip Bozuta unsigned char name[80]; 2422aca7708eSFilip Bozuta abi_ulong reserved0; 2423aca7708eSFilip Bozuta abi_ulong resolution; 2424aca7708eSFilip Bozuta abi_ulong resolution_min; 2425aca7708eSFilip Bozuta abi_ulong resolution_max; 2426c7828bd1SRichard Henderson abi_uint clients; 2427aca7708eSFilip Bozuta unsigned char reserved[32]; 2428aca7708eSFilip Bozuta }; 2429aca7708eSFilip Bozuta 2430aca7708eSFilip Bozuta struct target_snd_timer_gparams { 2431aca7708eSFilip Bozuta struct target_snd_timer_id tid; 2432aca7708eSFilip Bozuta abi_ulong period_num; 2433aca7708eSFilip Bozuta abi_ulong period_den; 2434aca7708eSFilip Bozuta unsigned char reserved[32]; 2435aca7708eSFilip Bozuta }; 2436aca7708eSFilip Bozuta 2437aca7708eSFilip Bozuta struct target_snd_timer_gstatus { 2438aca7708eSFilip Bozuta struct target_snd_timer_id tid; 2439aca7708eSFilip Bozuta abi_ulong resolution; 2440aca7708eSFilip Bozuta abi_ulong resolution_num; 2441aca7708eSFilip Bozuta abi_ulong resolution_den; 2442aca7708eSFilip Bozuta unsigned char reserved[32]; 2443aca7708eSFilip Bozuta }; 2444aca7708eSFilip Bozuta 2445d22edf0aSFilip Bozuta struct target_snd_timer_select { 2446d22edf0aSFilip Bozuta struct target_snd_timer_id id; 2447d22edf0aSFilip Bozuta unsigned char reserved[32]; 2448d22edf0aSFilip Bozuta }; 2449d22edf0aSFilip Bozuta 2450fe333025SFilip Bozuta struct target_snd_timer_info { 2451c7828bd1SRichard Henderson abi_uint flags; 2452b3c719b2SRichard Henderson abi_int card; 2453fe333025SFilip Bozuta unsigned char id[64]; 2454fe333025SFilip Bozuta unsigned char name[80]; 2455fe333025SFilip Bozuta abi_ulong reserved0; 2456fe333025SFilip Bozuta abi_ulong resolution; 2457fe333025SFilip Bozuta unsigned char reserved[64]; 2458fe333025SFilip Bozuta }; 2459fe333025SFilip Bozuta 2460fe333025SFilip Bozuta struct target_snd_timer_status { 2461fe333025SFilip Bozuta struct target_timespec tstamp; 2462c7828bd1SRichard Henderson abi_uint resolution; 2463c7828bd1SRichard Henderson abi_uint lost; 2464c7828bd1SRichard Henderson abi_uint overrun; 2465c7828bd1SRichard Henderson abi_uint queue; 2466fe333025SFilip Bozuta unsigned char reserved[64]; 2467fe333025SFilip Bozuta }; 2468fe333025SFilip Bozuta 24691c4c6fcdSFilip Bozuta /* alsa timer ioctls */ 2470b3c719b2SRichard Henderson #define TARGET_SNDRV_TIMER_IOCTL_PVERSION TARGET_IOR('T', 0x00, abi_int) 24711c4c6fcdSFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_NEXT_DEVICE TARGET_IOWR('T', 0x01, \ 24721c4c6fcdSFilip Bozuta struct snd_timer_id) 2473aca7708eSFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_GINFO TARGET_IOWR('T', 0x03, \ 2474aca7708eSFilip Bozuta struct target_snd_timer_ginfo) 2475aca7708eSFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_GPARAMS TARGET_IOW('T', 0x04, \ 2476aca7708eSFilip Bozuta struct target_snd_timer_gparams) 2477aca7708eSFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_GSTATUS TARGET_IOWR('T', 0x05, \ 2478aca7708eSFilip Bozuta struct target_snd_timer_gstatus) 2479d22edf0aSFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_SELECT TARGET_IOW('T', 0x10, \ 2480d22edf0aSFilip Bozuta struct target_snd_timer_select) 2481fe333025SFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_INFO TARGET_IOR('T', 0x11, \ 2482fe333025SFilip Bozuta struct target_snd_timer_info) 2483fe333025SFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_PARAMS TARGET_IOW('T', 0x12, \ 2484fe333025SFilip Bozuta struct snd_timer_params) 2485fe333025SFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_STATUS TARGET_IOR('T', 0x14, \ 2486fe333025SFilip Bozuta struct target_snd_timer_status) 2487045823a9SFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_START TARGET_IO('T', 0xa0) 2488045823a9SFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_STOP TARGET_IO('T', 0xa1) 2489045823a9SFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_CONTINUE TARGET_IO('T', 0xa2) 2490045823a9SFilip Bozuta #define TARGET_SNDRV_TIMER_IOCTL_PAUSE TARGET_IO('T', 0xa3) 24911c4c6fcdSFilip Bozuta 24922521d698Sbellard /* vfat ioctls */ 24932521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) 24942521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) 2495a5448a7dSbellard 2496f443e396SPeter Maydell struct target_mtop { 2497f443e396SPeter Maydell abi_short mt_op; 2498f443e396SPeter Maydell abi_int mt_count; 2499f443e396SPeter Maydell }; 2500f443e396SPeter Maydell 2501f443e396SPeter Maydell #if defined(TARGET_SPARC) || defined(TARGET_MIPS) 2502f443e396SPeter Maydell typedef abi_long target_kernel_daddr_t; 2503f443e396SPeter Maydell #else 2504f443e396SPeter Maydell typedef abi_int target_kernel_daddr_t; 2505f443e396SPeter Maydell #endif 2506f443e396SPeter Maydell 2507f443e396SPeter Maydell struct target_mtget { 2508f443e396SPeter Maydell abi_long mt_type; 2509f443e396SPeter Maydell abi_long mt_resid; 2510f443e396SPeter Maydell abi_long mt_dsreg; 2511f443e396SPeter Maydell abi_long mt_gstat; 2512f443e396SPeter Maydell abi_long mt_erreg; 2513f443e396SPeter Maydell target_kernel_daddr_t mt_fileno; 2514f443e396SPeter Maydell target_kernel_daddr_t mt_blkno; 2515f443e396SPeter Maydell }; 2516f443e396SPeter Maydell 2517f443e396SPeter Maydell struct target_mtpos { 2518f443e396SPeter Maydell abi_long mt_blkno; 2519f443e396SPeter Maydell }; 2520f443e396SPeter Maydell 2521f443e396SPeter Maydell #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct target_mtop) 2522f443e396SPeter Maydell #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct target_mtget) 2523f443e396SPeter Maydell #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct target_mtpos) 25248fbd6b52Sbalrog 2525bd27e675SAleksandar Markovic /* kcov ioctls */ 2526bd27e675SAleksandar Markovic #define TARGET_KCOV_ENABLE TARGET_IO('c', 100) 2527bd27e675SAleksandar Markovic #define TARGET_KCOV_DISABLE TARGET_IO('c', 101) 2528f7dbd8feSAleksandar Markovic #define TARGET_KCOV_INIT_TRACE TARGET_IOR('c', 1, abi_ulong) 2529bd27e675SAleksandar Markovic 2530a5448a7dSbellard struct target_sysinfo { 2531992f48a0Sblueswir1 abi_long uptime; /* Seconds since boot */ 2532992f48a0Sblueswir1 abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */ 2533992f48a0Sblueswir1 abi_ulong totalram; /* Total usable main memory size */ 2534992f48a0Sblueswir1 abi_ulong freeram; /* Available memory size */ 2535992f48a0Sblueswir1 abi_ulong sharedram; /* Amount of shared memory */ 2536992f48a0Sblueswir1 abi_ulong bufferram; /* Memory used by buffers */ 2537992f48a0Sblueswir1 abi_ulong totalswap; /* Total swap space size */ 2538992f48a0Sblueswir1 abi_ulong freeswap; /* swap space still available */ 253977e935f4SRichard Henderson abi_ushort procs; /* Number of current processes */ 254077e935f4SRichard Henderson abi_ushort pad; /* explicit padding for m68k */ 2541992f48a0Sblueswir1 abi_ulong totalhigh; /* Total high memory size */ 2542992f48a0Sblueswir1 abi_ulong freehigh; /* Available high memory size */ 2543c7828bd1SRichard Henderson abi_uint mem_unit; /* Memory unit size in bytes */ 2544992f48a0Sblueswir1 char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 2545a5448a7dSbellard }; 25463532fa74Sbellard 25476556a833Saurel32 struct linux_dirent { 25486556a833Saurel32 long d_ino; 25496556a833Saurel32 unsigned long d_off; 25506556a833Saurel32 unsigned short d_reclen; 2551540a736fSRichard Henderson char d_name[]; 25526556a833Saurel32 }; 25536556a833Saurel32 25546556a833Saurel32 struct linux_dirent64 { 25556556a833Saurel32 uint64_t d_ino; 25566556a833Saurel32 int64_t d_off; 25576556a833Saurel32 unsigned short d_reclen; 25586556a833Saurel32 unsigned char d_type; 2559540a736fSRichard Henderson char d_name[]; 25606556a833Saurel32 }; 25616556a833Saurel32 256224e1003aSaurel32 struct target_mq_attr { 256324e1003aSaurel32 abi_long mq_flags; 256424e1003aSaurel32 abi_long mq_maxmsg; 256524e1003aSaurel32 abi_long mq_msgsize; 256624e1003aSaurel32 abi_long mq_curmsgs; 256724e1003aSaurel32 }; 256824e1003aSaurel32 2569e865b97fSChen Gang struct target_drm_version { 2570b3c719b2SRichard Henderson abi_int version_major; 2571b3c719b2SRichard Henderson abi_int version_minor; 2572b3c719b2SRichard Henderson abi_int version_patchlevel; 2573e865b97fSChen Gang abi_ulong name_len; 2574e865b97fSChen Gang abi_ulong name; 2575e865b97fSChen Gang abi_ulong date_len; 2576e865b97fSChen Gang abi_ulong date; 2577e865b97fSChen Gang abi_ulong desc_len; 2578e865b97fSChen Gang abi_ulong desc; 2579e865b97fSChen Gang }; 2580e865b97fSChen Gang 2581913b03c2SChen Gang struct target_drm_i915_getparam { 2582b3c719b2SRichard Henderson abi_int param; 2583913b03c2SChen Gang abi_ulong value; 2584913b03c2SChen Gang }; 2585913b03c2SChen Gang 25863532fa74Sbellard #include "socket.h" 2587637947f1Sths 25888f968b6aSPhilippe Mathieu-Daudé #include "target_errno_defs.h" 258903dfe9f8SRiku Voipio 259003dfe9f8SRiku Voipio #define FUTEX_WAIT 0 259103dfe9f8SRiku Voipio #define FUTEX_WAKE 1 259203dfe9f8SRiku Voipio #define FUTEX_FD 2 259303dfe9f8SRiku Voipio #define FUTEX_REQUEUE 3 259403dfe9f8SRiku Voipio #define FUTEX_CMP_REQUEUE 4 259503dfe9f8SRiku Voipio #define FUTEX_WAKE_OP 5 259603dfe9f8SRiku Voipio #define FUTEX_LOCK_PI 6 259703dfe9f8SRiku Voipio #define FUTEX_UNLOCK_PI 7 259803dfe9f8SRiku Voipio #define FUTEX_TRYLOCK_PI 8 259903dfe9f8SRiku Voipio #define FUTEX_WAIT_BITSET 9 260003dfe9f8SRiku Voipio #define FUTEX_WAKE_BITSET 10 2601c72a90dfSRichard Henderson #define FUTEX_WAIT_REQUEUE_PI 11 2602c72a90dfSRichard Henderson #define FUTEX_CMP_REQUEUE_PI 12 2603c72a90dfSRichard Henderson #define FUTEX_LOCK_PI2 13 260403dfe9f8SRiku Voipio 260503dfe9f8SRiku Voipio #define FUTEX_PRIVATE_FLAG 128 260603dfe9f8SRiku Voipio #define FUTEX_CLOCK_REALTIME 256 260703dfe9f8SRiku Voipio #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) 260803dfe9f8SRiku Voipio 26093b6edd16SPeter Maydell #ifdef CONFIG_EPOLL 2610928bed6aSLaurent Vivier #if defined(TARGET_X86_64) 2611928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED QEMU_PACKED 2612928bed6aSLaurent Vivier #else 2613928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED 2614928bed6aSLaurent Vivier #endif 2615928bed6aSLaurent Vivier 26163b6edd16SPeter Maydell typedef union target_epoll_data { 26173b6edd16SPeter Maydell abi_ulong ptr; 2618928bed6aSLaurent Vivier abi_int fd; 2619928bed6aSLaurent Vivier abi_uint u32; 2620928bed6aSLaurent Vivier abi_ullong u64; 26213b6edd16SPeter Maydell } target_epoll_data_t; 26223b6edd16SPeter Maydell 26233b6edd16SPeter Maydell struct target_epoll_event { 2624928bed6aSLaurent Vivier abi_uint events; 26253b6edd16SPeter Maydell target_epoll_data_t data; 2626928bed6aSLaurent Vivier } TARGET_EPOLL_PACKED; 26272ba7fae3SPeter Maydell 26282ba7fae3SPeter Maydell #define TARGET_EP_MAX_EVENTS (INT_MAX / sizeof(struct target_epoll_event)) 26292ba7fae3SPeter Maydell 26303b6edd16SPeter Maydell #endif 2631583359a6SAkos PASZTORY 2632583359a6SAkos PASZTORY struct target_ucred { 2633f6ee1627SRichard Henderson abi_uint pid; 2634f6ee1627SRichard Henderson abi_uint uid; 2635f6ee1627SRichard Henderson abi_uint gid; 2636583359a6SAkos PASZTORY }; 2637cb9c377fSPaolo Bonzini 26385dc0c971SRichard Henderson typedef abi_int target_timer_t; 2639905bba13SErik de Castro Lopo 264034d60862SNatanael Copa #define TARGET_SIGEV_MAX_SIZE 64 264134d60862SNatanael Copa 264234d60862SNatanael Copa /* This is architecture-specific but most architectures use the default */ 264334d60862SNatanael Copa #ifdef TARGET_MIPS 26445dc0c971SRichard Henderson #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(abi_int) * 2 + sizeof(abi_long)) 264534d60862SNatanael Copa #else 26465dc0c971SRichard Henderson #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(abi_int) * 2 \ 264734d60862SNatanael Copa + sizeof(target_sigval_t)) 264834d60862SNatanael Copa #endif 264934d60862SNatanael Copa 265034d60862SNatanael Copa #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ 265134d60862SNatanael Copa - TARGET_SIGEV_PREAMBLE_SIZE) \ 26525dc0c971SRichard Henderson / sizeof(abi_int)) 265334d60862SNatanael Copa 2654905bba13SErik de Castro Lopo struct target_sigevent { 2655905bba13SErik de Castro Lopo target_sigval_t sigev_value; 265617351c3fSPeter Maydell abi_int sigev_signo; 265717351c3fSPeter Maydell abi_int sigev_notify; 2658905bba13SErik de Castro Lopo union { 265917351c3fSPeter Maydell abi_int _pad[TARGET_SIGEV_PAD_SIZE]; 266017351c3fSPeter Maydell abi_int _tid; 2661905bba13SErik de Castro Lopo 266217351c3fSPeter Maydell /* The kernel (and thus QEMU) never looks at these; 266317351c3fSPeter Maydell * they're only used as part of the ABI between a 266417351c3fSPeter Maydell * userspace program and libc. 266517351c3fSPeter Maydell */ 2666905bba13SErik de Castro Lopo struct { 266717351c3fSPeter Maydell abi_ulong _function; 266817351c3fSPeter Maydell abi_ulong _attribute; 2669905bba13SErik de Castro Lopo } _sigev_thread; 2670905bba13SErik de Castro Lopo } _sigev_un; 2671905bba13SErik de Castro Lopo }; 2672e0eb210eSPeter Maydell 2673e0eb210eSPeter Maydell struct target_user_cap_header { 2674f6ee1627SRichard Henderson abi_uint version; 2675b3c719b2SRichard Henderson abi_int pid; 2676e0eb210eSPeter Maydell }; 2677e0eb210eSPeter Maydell 2678e0eb210eSPeter Maydell struct target_user_cap_data { 2679f6ee1627SRichard Henderson abi_uint effective; 2680f6ee1627SRichard Henderson abi_uint permitted; 2681f6ee1627SRichard Henderson abi_uint inheritable; 2682e0eb210eSPeter Maydell }; 26831b3c4fdfSMarkus Armbruster 2684da2c8ad7SAleksandar Markovic /* from kernel's include/linux/syslog.h */ 2685da2c8ad7SAleksandar Markovic 2686da2c8ad7SAleksandar Markovic /* Close the log. Currently a NOP. */ 2687da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CLOSE 0 2688da2c8ad7SAleksandar Markovic /* Open the log. Currently a NOP. */ 2689da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_OPEN 1 2690da2c8ad7SAleksandar Markovic /* Read from the log. */ 2691da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ 2 2692da2c8ad7SAleksandar Markovic /* Read all messages remaining in the ring buffer. */ 2693da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ_ALL 3 2694da2c8ad7SAleksandar Markovic /* Read and clear all messages remaining in the ring buffer */ 2695da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ_CLEAR 4 2696da2c8ad7SAleksandar Markovic /* Clear ring buffer. */ 2697da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CLEAR 5 2698da2c8ad7SAleksandar Markovic /* Disable printk's to console */ 2699da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_OFF 6 2700da2c8ad7SAleksandar Markovic /* Enable printk's to console */ 2701da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_ON 7 2702da2c8ad7SAleksandar Markovic /* Set level of messages printed to console */ 2703da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_LEVEL 8 2704da2c8ad7SAleksandar Markovic /* Return number of unread characters in the log buffer */ 2705da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_SIZE_UNREAD 9 2706da2c8ad7SAleksandar Markovic /* Return size of the log buffer */ 2707da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10 2708da2c8ad7SAleksandar Markovic 2709efa92184SAleksandar Rikalo struct target_statx_timestamp { 271093c5c6cdSRichard Henderson abi_llong tv_sec; 2711f6ee1627SRichard Henderson abi_uint tv_nsec; 27125dc0c971SRichard Henderson abi_int __reserved; 2713efa92184SAleksandar Rikalo }; 2714efa92184SAleksandar Rikalo 2715efa92184SAleksandar Rikalo struct target_statx { 2716efa92184SAleksandar Rikalo /* 0x00 */ 2717f6ee1627SRichard Henderson abi_uint stx_mask; /* What results were written [uncond] */ 2718f6ee1627SRichard Henderson abi_uint stx_blksize; /* Preferred general I/O size [uncond] */ 27197af406a6SRichard Henderson abi_ullong stx_attributes; /* Flags conveying information about the file */ 2720efa92184SAleksandar Rikalo /* 0x10 */ 2721f6ee1627SRichard Henderson abi_uint stx_nlink; /* Number of hard links */ 2722f6ee1627SRichard Henderson abi_uint stx_uid; /* User ID of owner */ 2723f6ee1627SRichard Henderson abi_uint stx_gid; /* Group ID of owner */ 2724efa92184SAleksandar Rikalo uint16_t stx_mode; /* File mode */ 2725efa92184SAleksandar Rikalo uint16_t __spare0[1]; 2726efa92184SAleksandar Rikalo /* 0x20 */ 27277af406a6SRichard Henderson abi_ullong stx_ino; /* Inode number */ 27287af406a6SRichard Henderson abi_ullong stx_size; /* File size */ 27297af406a6SRichard Henderson abi_ullong stx_blocks; /* Number of 512-byte blocks allocated */ 27307af406a6SRichard Henderson abi_ullong stx_attributes_mask; /* Mask to show what is supported */ 2731efa92184SAleksandar Rikalo /* 0x40 */ 2732efa92184SAleksandar Rikalo struct target_statx_timestamp stx_atime; /* Last access time */ 2733efa92184SAleksandar Rikalo struct target_statx_timestamp stx_btime; /* File creation time */ 2734efa92184SAleksandar Rikalo struct target_statx_timestamp stx_ctime; /* Last attribute change time */ 2735efa92184SAleksandar Rikalo struct target_statx_timestamp stx_mtime; /* Last data modification time */ 2736efa92184SAleksandar Rikalo /* 0x80 */ 2737f6ee1627SRichard Henderson abi_uint stx_rdev_major; /* Device ID of special file [if bdev/cdev] */ 2738f6ee1627SRichard Henderson abi_uint stx_rdev_minor; 2739f6ee1627SRichard Henderson abi_uint stx_dev_major; /* ID of device containing file [uncond] */ 2740f6ee1627SRichard Henderson abi_uint stx_dev_minor; 2741efa92184SAleksandar Rikalo /* 0x90 */ 27427af406a6SRichard Henderson abi_ullong __spare2[14]; /* Spare space for future expansion */ 2743efa92184SAleksandar Rikalo /* 0x100 */ 2744efa92184SAleksandar Rikalo }; 2745efa92184SAleksandar Rikalo 274645ad761cSTonis Tiigi /* from kernel's include/linux/sched/types.h */ 274745ad761cSTonis Tiigi struct target_sched_attr { 274845ad761cSTonis Tiigi abi_uint size; 274945ad761cSTonis Tiigi abi_uint sched_policy; 275045ad761cSTonis Tiigi abi_ullong sched_flags; 275145ad761cSTonis Tiigi abi_int sched_nice; 275245ad761cSTonis Tiigi abi_uint sched_priority; 275345ad761cSTonis Tiigi abi_ullong sched_runtime; 275445ad761cSTonis Tiigi abi_ullong sched_deadline; 275545ad761cSTonis Tiigi abi_ullong sched_period; 275645ad761cSTonis Tiigi abi_uint sched_util_min; 275745ad761cSTonis Tiigi abi_uint sched_util_max; 275845ad761cSTonis Tiigi }; 275945ad761cSTonis Tiigi 2760407a119bSTonis Tiigi struct target_sched_param { 2761407a119bSTonis Tiigi abi_int sched_priority; 2762407a119bSTonis Tiigi }; 2763407a119bSTonis Tiigi 27641b3c4fdfSMarkus Armbruster #endif 2765