131e31b8aSbellard /* common syscall defines for all architectures */ 231e31b8aSbellard 32521d698Sbellard /* Note: although the syscall numbers change between architectures, 4b4916d7bSDong Xu Wang most of them stay the same, so we handle it by putting ifdefs if 52521d698Sbellard necessary */ 62521d698Sbellard 7cb9c377fSPaolo Bonzini #ifndef SYSCALL_DEFS_H 81b3c4fdfSMarkus Armbruster #define SYSCALL_DEFS_H 9cb9c377fSPaolo Bonzini 106180a181Sbellard #include "syscall_nr.h" 112521d698Sbellard 12ff71a454SAleksandar Markovic 13ff71a454SAleksandar Markovic /* socket operations for socketcall() */ 14ff71a454SAleksandar Markovic #define TARGET_SYS_SOCKET 1 /* socket() */ 15ff71a454SAleksandar Markovic #define TARGET_SYS_BIND 2 /* bind() */ 16ff71a454SAleksandar Markovic #define TARGET_SYS_CONNECT 3 /* connect() */ 17ff71a454SAleksandar Markovic #define TARGET_SYS_LISTEN 4 /* listen() */ 18ff71a454SAleksandar Markovic #define TARGET_SYS_ACCEPT 5 /* accept() */ 19ff71a454SAleksandar Markovic #define TARGET_SYS_GETSOCKNAME 6 /* getsockname() */ 20ff71a454SAleksandar Markovic #define TARGET_SYS_GETPEERNAME 7 /* getpeername() */ 21ff71a454SAleksandar Markovic #define TARGET_SYS_SOCKETPAIR 8 /* socketpair() */ 22ff71a454SAleksandar Markovic #define TARGET_SYS_SEND 9 /* send() */ 23ff71a454SAleksandar Markovic #define TARGET_SYS_RECV 10 /* recv() */ 24ff71a454SAleksandar Markovic #define TARGET_SYS_SENDTO 11 /* sendto() */ 25ff71a454SAleksandar Markovic #define TARGET_SYS_RECVFROM 12 /* recvfrom() */ 26ff71a454SAleksandar Markovic #define TARGET_SYS_SHUTDOWN 13 /* shutdown() */ 27ff71a454SAleksandar Markovic #define TARGET_SYS_SETSOCKOPT 14 /* setsockopt() */ 28ff71a454SAleksandar Markovic #define TARGET_SYS_GETSOCKOPT 15 /* getsockopt() */ 29ff71a454SAleksandar Markovic #define TARGET_SYS_SENDMSG 16 /* sendmsg() */ 30ff71a454SAleksandar Markovic #define TARGET_SYS_RECVMSG 17 /* recvmsg() */ 31ff71a454SAleksandar Markovic #define TARGET_SYS_ACCEPT4 18 /* accept4() */ 32ff71a454SAleksandar Markovic #define TARGET_SYS_RECVMMSG 19 /* recvmmsg() */ 33ff71a454SAleksandar Markovic #define TARGET_SYS_SENDMMSG 20 /* sendmmsg() */ 3431e31b8aSbellard 35524fa340SLaurent Vivier #define IPCOP_CALL(VERSION, OP) ((VERSION) << 16 | (OP)) 368853f86eSbellard #define IPCOP_semop 1 378853f86eSbellard #define IPCOP_semget 2 388853f86eSbellard #define IPCOP_semctl 3 398853f86eSbellard #define IPCOP_semtimedop 4 408853f86eSbellard #define IPCOP_msgsnd 11 418853f86eSbellard #define IPCOP_msgrcv 12 428853f86eSbellard #define IPCOP_msgget 13 438853f86eSbellard #define IPCOP_msgctl 14 448853f86eSbellard #define IPCOP_shmat 21 458853f86eSbellard #define IPCOP_shmdt 22 468853f86eSbellard #define IPCOP_shmget 23 478853f86eSbellard #define IPCOP_shmctl 24 488853f86eSbellard 492521d698Sbellard /* 502521d698Sbellard * The following is for compatibility across the various Linux 512521d698Sbellard * platforms. The i386 ioctl numbering scheme doesn't really enforce 522521d698Sbellard * a type field. De facto, however, the top 8 bits of the lower 16 532521d698Sbellard * bits are indeed used as a type field, so we might just as well make 542521d698Sbellard * this explicit here. Please be sure to use the decoding macros 552521d698Sbellard * below from now on. 562521d698Sbellard */ 572521d698Sbellard #define TARGET_IOC_NRBITS 8 582521d698Sbellard #define TARGET_IOC_TYPEBITS 8 592521d698Sbellard 60716f3fbeSPeter Maydell #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 61716f3fbeSPeter Maydell || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 62cd98d390SAndreas Schwab || defined(TARGET_SPARC) \ 630c866a7eSRiku Voipio || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) 6474d753acSMika Westerberg /* 16 bit uid wrappers emulation */ 6574d753acSMika Westerberg #define USE_UID16 660c866a7eSRiku Voipio #define target_id uint16_t 670c866a7eSRiku Voipio #else 680c866a7eSRiku Voipio #define target_id uint32_t 6974d753acSMika Westerberg #endif 7074d753acSMika Westerberg 71e6e5906bSpbrook #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ 72b16189b2SChen Gang || defined(TARGET_M68K) || defined(TARGET_CRIS) \ 73daa4374aSPeter Maydell || defined(TARGET_S390X) \ 74a0a839b6SMarek Vasut || defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) \ 75ba7651fbSMax Filippov || defined(TARGET_NIOS2) || defined(TARGET_RISCV) \ 76ba7651fbSMax Filippov || defined(TARGET_XTENSA) 772521d698Sbellard 782521d698Sbellard #define TARGET_IOC_SIZEBITS 14 792521d698Sbellard #define TARGET_IOC_DIRBITS 2 802521d698Sbellard 812521d698Sbellard #define TARGET_IOC_NONE 0U 822521d698Sbellard #define TARGET_IOC_WRITE 1U 832521d698Sbellard #define TARGET_IOC_READ 2U 842521d698Sbellard 85048f6b4dSbellard #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ 86b779e29eSEdgar E. Iglesias defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \ 87b779e29eSEdgar E. Iglesias defined(TARGET_MIPS) 882521d698Sbellard 892521d698Sbellard #define TARGET_IOC_SIZEBITS 13 902521d698Sbellard #define TARGET_IOC_DIRBITS 3 912521d698Sbellard 922521d698Sbellard #define TARGET_IOC_NONE 1U 932521d698Sbellard #define TARGET_IOC_READ 2U 942521d698Sbellard #define TARGET_IOC_WRITE 4U 952521d698Sbellard 96a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 97a10d1e50SRichard Henderson 98a10d1e50SRichard Henderson #define TARGET_IOC_SIZEBITS 14 99a10d1e50SRichard Henderson #define TARGET_IOC_DIRBITS 2 100a10d1e50SRichard Henderson 101a10d1e50SRichard Henderson #define TARGET_IOC_NONE 0U 102a10d1e50SRichard Henderson #define TARGET_IOC_WRITE 2U 103a10d1e50SRichard Henderson #define TARGET_IOC_READ 1U 104a10d1e50SRichard Henderson 1052521d698Sbellard #else 1062521d698Sbellard #error unsupported CPU 1072521d698Sbellard #endif 1082521d698Sbellard 1092521d698Sbellard #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) 1102521d698Sbellard #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) 1112521d698Sbellard #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) 1122521d698Sbellard #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) 1132521d698Sbellard 1142521d698Sbellard #define TARGET_IOC_NRSHIFT 0 1152521d698Sbellard #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) 1162521d698Sbellard #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) 1172521d698Sbellard #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) 1182521d698Sbellard 1192521d698Sbellard #define TARGET_IOC(dir,type,nr,size) \ 1202521d698Sbellard (((dir) << TARGET_IOC_DIRSHIFT) | \ 1212521d698Sbellard ((type) << TARGET_IOC_TYPESHIFT) | \ 1222521d698Sbellard ((nr) << TARGET_IOC_NRSHIFT) | \ 1232521d698Sbellard ((size) << TARGET_IOC_SIZESHIFT)) 1242521d698Sbellard 1252521d698Sbellard /* used to create numbers */ 1262521d698Sbellard #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) 1272521d698Sbellard #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) 1282521d698Sbellard #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1292521d698Sbellard #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1302521d698Sbellard 1312521d698Sbellard /* the size is automatically computed for these defines */ 1322521d698Sbellard #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) 1332521d698Sbellard #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1342521d698Sbellard #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1352521d698Sbellard 1367854b056Sbellard struct target_sockaddr { 1377854b056Sbellard uint16_t sa_family; 1387854b056Sbellard uint8_t sa_data[14]; 1397854b056Sbellard }; 1407854b056Sbellard 14133a29b51SJoakim Tjernlund struct target_sockaddr_ll { 14233a29b51SJoakim Tjernlund uint16_t sll_family; /* Always AF_PACKET */ 14333a29b51SJoakim Tjernlund uint16_t sll_protocol; /* Physical layer protocol */ 14433a29b51SJoakim Tjernlund int sll_ifindex; /* Interface number */ 14533a29b51SJoakim Tjernlund uint16_t sll_hatype; /* ARP hardware type */ 14633a29b51SJoakim Tjernlund uint8_t sll_pkttype; /* Packet type */ 14733a29b51SJoakim Tjernlund uint8_t sll_halen; /* Length of address */ 14833a29b51SJoakim Tjernlund uint8_t sll_addr[8]; /* Physical layer address */ 14933a29b51SJoakim Tjernlund }; 15033a29b51SJoakim Tjernlund 151fb3aabf3SLaurent Vivier struct target_sockaddr_un { 152fb3aabf3SLaurent Vivier uint16_t su_family; 153fb3aabf3SLaurent Vivier uint8_t sun_path[108]; 154fb3aabf3SLaurent Vivier }; 155fb3aabf3SLaurent Vivier 156fb3aabf3SLaurent Vivier struct target_in_addr { 157fb3aabf3SLaurent Vivier uint32_t s_addr; /* big endian */ 158fb3aabf3SLaurent Vivier }; 159fb3aabf3SLaurent Vivier 160fb3aabf3SLaurent Vivier struct target_sockaddr_in { 161fb3aabf3SLaurent Vivier uint16_t sin_family; 162fb3aabf3SLaurent Vivier int16_t sin_port; /* big endian */ 163fb3aabf3SLaurent Vivier struct target_in_addr sin_addr; 164fb3aabf3SLaurent Vivier uint8_t __pad[sizeof(struct target_sockaddr) - 165fb3aabf3SLaurent Vivier sizeof(uint16_t) - sizeof(int16_t) - 166fb3aabf3SLaurent Vivier sizeof(struct target_in_addr)]; 167fb3aabf3SLaurent Vivier }; 168fb3aabf3SLaurent Vivier 169ee1ac3a1SHelge Deller struct target_sockaddr_in6 { 170ee1ac3a1SHelge Deller uint16_t sin6_family; 171ee1ac3a1SHelge Deller uint16_t sin6_port; /* big endian */ 172ee1ac3a1SHelge Deller uint32_t sin6_flowinfo; /* big endian */ 173ee1ac3a1SHelge Deller struct in6_addr sin6_addr; /* IPv6 address, big endian */ 174ee1ac3a1SHelge Deller uint32_t sin6_scope_id; 175ee1ac3a1SHelge Deller }; 176ee1ac3a1SHelge Deller 177f57d4192SLaurent Vivier struct target_sock_filter { 178f57d4192SLaurent Vivier abi_ushort code; 179f57d4192SLaurent Vivier uint8_t jt; 180f57d4192SLaurent Vivier uint8_t jf; 181f57d4192SLaurent Vivier abi_uint k; 182f57d4192SLaurent Vivier }; 183f57d4192SLaurent Vivier 184f57d4192SLaurent Vivier struct target_sock_fprog { 185f57d4192SLaurent Vivier abi_ushort len; 186f57d4192SLaurent Vivier abi_ulong filter; 187f57d4192SLaurent Vivier }; 188f57d4192SLaurent Vivier 189b975b83bSLionel Landwerlin struct target_ip_mreq { 190b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 191b975b83bSLionel Landwerlin struct target_in_addr imr_address; 192b975b83bSLionel Landwerlin }; 193b975b83bSLionel Landwerlin 194b975b83bSLionel Landwerlin struct target_ip_mreqn { 195b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 196b975b83bSLionel Landwerlin struct target_in_addr imr_address; 197b975b83bSLionel Landwerlin abi_long imr_ifindex; 198b975b83bSLionel Landwerlin }; 199b975b83bSLionel Landwerlin 2006e3cb58fSLionel Landwerlin struct target_ip_mreq_source { 2016e3cb58fSLionel Landwerlin /* big endian */ 2026e3cb58fSLionel Landwerlin uint32_t imr_multiaddr; 2036e3cb58fSLionel Landwerlin uint32_t imr_interface; 2046e3cb58fSLionel Landwerlin uint32_t imr_sourceaddr; 2056e3cb58fSLionel Landwerlin }; 2066e3cb58fSLionel Landwerlin 20783eb6e50SCarlo Marcelo Arenas Belón struct target_linger { 20883eb6e50SCarlo Marcelo Arenas Belón abi_int l_onoff; /* Linger active */ 20983eb6e50SCarlo Marcelo Arenas Belón abi_int l_linger; /* How long to linger for */ 21083eb6e50SCarlo Marcelo Arenas Belón }; 21183eb6e50SCarlo Marcelo Arenas Belón 21231e31b8aSbellard struct target_timeval { 213992f48a0Sblueswir1 abi_long tv_sec; 214992f48a0Sblueswir1 abi_long tv_usec; 21531e31b8aSbellard }; 21631e31b8aSbellard 2171b6b029eSbellard struct target_timespec { 218992f48a0Sblueswir1 abi_long tv_sec; 219992f48a0Sblueswir1 abi_long tv_nsec; 2201b6b029eSbellard }; 2211b6b029eSbellard 222ef4467e9SPaul Burton struct target_timezone { 223ef4467e9SPaul Burton abi_int tz_minuteswest; 224ef4467e9SPaul Burton abi_int tz_dsttime; 225ef4467e9SPaul Burton }; 226ef4467e9SPaul Burton 22766fb9763Sbellard struct target_itimerval { 22866fb9763Sbellard struct target_timeval it_interval; 22966fb9763Sbellard struct target_timeval it_value; 23066fb9763Sbellard }; 23166fb9763Sbellard 232905bba13SErik de Castro Lopo struct target_itimerspec { 233905bba13SErik de Castro Lopo struct target_timespec it_interval; 234905bba13SErik de Castro Lopo struct target_timespec it_value; 235905bba13SErik de Castro Lopo }; 236905bba13SErik de Castro Lopo 23719f59bceSAleksandar Markovic struct target_timex { 23819f59bceSAleksandar Markovic abi_uint modes; /* Mode selector */ 23919f59bceSAleksandar Markovic abi_long offset; /* Time offset */ 24019f59bceSAleksandar Markovic abi_long freq; /* Frequency offset */ 24119f59bceSAleksandar Markovic abi_long maxerror; /* Maximum error (microseconds) */ 24219f59bceSAleksandar Markovic abi_long esterror; /* Estimated error (microseconds) */ 24319f59bceSAleksandar Markovic abi_int status; /* Clock command/status */ 24419f59bceSAleksandar Markovic abi_long constant; /* PLL (phase-locked loop) time constant */ 24519f59bceSAleksandar Markovic abi_long precision; /* Clock precision (microseconds, ro) */ 24619f59bceSAleksandar Markovic abi_long tolerance; /* Clock freq. tolerance (ppm, ro) */ 24719f59bceSAleksandar Markovic struct target_timeval time; /* Current time */ 24819f59bceSAleksandar Markovic abi_long tick; /* Microseconds between clock ticks */ 24919f59bceSAleksandar Markovic abi_long ppsfreq; /* PPS (pulse per second) frequency */ 25019f59bceSAleksandar Markovic abi_long jitter; /* PPS jitter (ro); nanoseconds */ 25119f59bceSAleksandar Markovic abi_int shift; /* PPS interval duration (seconds) */ 25219f59bceSAleksandar Markovic abi_long stabil; /* PPS stability */ 25319f59bceSAleksandar Markovic abi_long jitcnt; /* PPS jitter limit exceeded (ro) */ 25419f59bceSAleksandar Markovic abi_long calcnt; /* PPS calibration intervals */ 25519f59bceSAleksandar Markovic abi_long errcnt; /* PPS calibration errors */ 25619f59bceSAleksandar Markovic abi_long stbcnt; /* PPS stability limit exceeded */ 25719f59bceSAleksandar Markovic abi_int tai; /* TAI offset */ 25819f59bceSAleksandar Markovic 25919f59bceSAleksandar Markovic /* Further padding bytes to allow for future expansion */ 26019f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; abi_int:32; 26119f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; abi_int:32; 26219f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; 26319f59bceSAleksandar Markovic }; 26419f59bceSAleksandar Markovic 265c227f099SAnthony Liguori typedef abi_long target_clock_t; 26632f36bceSbellard 267c596ed17Sbellard #define TARGET_HZ 100 268c596ed17Sbellard 26932f36bceSbellard struct target_tms { 270c227f099SAnthony Liguori target_clock_t tms_utime; 271c227f099SAnthony Liguori target_clock_t tms_stime; 272c227f099SAnthony Liguori target_clock_t tms_cutime; 273c227f099SAnthony Liguori target_clock_t tms_cstime; 27432f36bceSbellard }; 27532f36bceSbellard 2766180a181Sbellard struct target_utimbuf { 277992f48a0Sblueswir1 abi_long actime; 278992f48a0Sblueswir1 abi_long modtime; 2796180a181Sbellard }; 2806180a181Sbellard 281f2674e31Sbellard struct target_sel_arg_struct { 282992f48a0Sblueswir1 abi_long n; 283992f48a0Sblueswir1 abi_long inp, outp, exp; 284992f48a0Sblueswir1 abi_long tvp; 285f2674e31Sbellard }; 286f2674e31Sbellard 28731e31b8aSbellard struct target_iovec { 288992f48a0Sblueswir1 abi_long iov_base; /* Starting address */ 289992f48a0Sblueswir1 abi_long iov_len; /* Number of bytes */ 29031e31b8aSbellard }; 29131e31b8aSbellard 2921a9353d2Sbellard struct target_msghdr { 293992f48a0Sblueswir1 abi_long msg_name; /* Socket name */ 2941a9353d2Sbellard int msg_namelen; /* Length of name */ 295992f48a0Sblueswir1 abi_long msg_iov; /* Data blocks */ 296992f48a0Sblueswir1 abi_long msg_iovlen; /* Number of blocks */ 297992f48a0Sblueswir1 abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ 298992f48a0Sblueswir1 abi_long msg_controllen; /* Length of cmsg list */ 2991a9353d2Sbellard unsigned int msg_flags; 3001a9353d2Sbellard }; 3011a9353d2Sbellard 3027854b056Sbellard struct target_cmsghdr { 303992f48a0Sblueswir1 abi_long cmsg_len; 3047854b056Sbellard int cmsg_level; 3057854b056Sbellard int cmsg_type; 3067854b056Sbellard }; 3077854b056Sbellard 3087854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) 309ee104587SJonathan Neuschäfer #define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \ 310ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start) 311992f48a0Sblueswir1 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ 312992f48a0Sblueswir1 & (size_t) ~(sizeof (abi_long) - 1)) 313ad762b99SPeter Maydell #define TARGET_CMSG_SPACE(len) (sizeof(struct target_cmsghdr) + \ 314ad762b99SPeter Maydell TARGET_CMSG_ALIGN(len)) 315ad762b99SPeter Maydell #define TARGET_CMSG_LEN(len) (sizeof(struct target_cmsghdr) + (len)) 3167854b056Sbellard 3177854b056Sbellard static __inline__ struct target_cmsghdr * 318ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(struct target_msghdr *__mhdr, 319ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg, 320ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg_start) 3217854b056Sbellard { 3222b8bdefcSths struct target_cmsghdr *__ptr; 3237854b056Sbellard 3242b8bdefcSths __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg 325cbb21eedSMatthias Braun + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len))); 326ee104587SJonathan Neuschäfer if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start) 327ee104587SJonathan Neuschäfer > tswapal(__mhdr->msg_controllen)) { 3287854b056Sbellard /* No more entries. */ 3292b8bdefcSths return (struct target_cmsghdr *)0; 330ee104587SJonathan Neuschäfer } 331ee104587SJonathan Neuschäfer return __ptr; 3327854b056Sbellard } 3337854b056Sbellard 334f19e00d7SAlexander Graf struct target_mmsghdr { 335f19e00d7SAlexander Graf struct target_msghdr msg_hdr; /* Message header */ 336f19e00d7SAlexander Graf unsigned int msg_len; /* Number of bytes transmitted */ 337f19e00d7SAlexander Graf }; 3387854b056Sbellard 33931e31b8aSbellard struct target_rusage { 34031e31b8aSbellard struct target_timeval ru_utime; /* user time used */ 34131e31b8aSbellard struct target_timeval ru_stime; /* system time used */ 342992f48a0Sblueswir1 abi_long ru_maxrss; /* maximum resident set size */ 343992f48a0Sblueswir1 abi_long ru_ixrss; /* integral shared memory size */ 344992f48a0Sblueswir1 abi_long ru_idrss; /* integral unshared data size */ 345992f48a0Sblueswir1 abi_long ru_isrss; /* integral unshared stack size */ 346992f48a0Sblueswir1 abi_long ru_minflt; /* page reclaims */ 347992f48a0Sblueswir1 abi_long ru_majflt; /* page faults */ 348992f48a0Sblueswir1 abi_long ru_nswap; /* swaps */ 349992f48a0Sblueswir1 abi_long ru_inblock; /* block input operations */ 350992f48a0Sblueswir1 abi_long ru_oublock; /* block output operations */ 351992f48a0Sblueswir1 abi_long ru_msgsnd; /* messages sent */ 352992f48a0Sblueswir1 abi_long ru_msgrcv; /* messages received */ 353992f48a0Sblueswir1 abi_long ru_nsignals; /* signals received */ 354992f48a0Sblueswir1 abi_long ru_nvcsw; /* voluntary context switches */ 355992f48a0Sblueswir1 abi_long ru_nivcsw; /* involuntary " */ 35631e31b8aSbellard }; 35731e31b8aSbellard 35831e31b8aSbellard typedef struct { 35931e31b8aSbellard int val[2]; 360c227f099SAnthony Liguori } kernel_fsid_t; 36131e31b8aSbellard 362dab2ed99Sbellard struct target_dirent { 363992f48a0Sblueswir1 abi_long d_ino; 364992f48a0Sblueswir1 abi_long d_off; 365dab2ed99Sbellard unsigned short d_reclen; 366333858b7SDmitry V. Levin char d_name[]; 367dab2ed99Sbellard }; 368dab2ed99Sbellard 369dab2ed99Sbellard struct target_dirent64 { 370dab2ed99Sbellard uint64_t d_ino; 371dab2ed99Sbellard int64_t d_off; 372dab2ed99Sbellard unsigned short d_reclen; 373dab2ed99Sbellard unsigned char d_type; 374dab2ed99Sbellard char d_name[256]; 375dab2ed99Sbellard }; 376dab2ed99Sbellard 377dab2ed99Sbellard 37831e31b8aSbellard /* mostly generic signal stuff */ 379992f48a0Sblueswir1 #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ 380992f48a0Sblueswir1 #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ 381992f48a0Sblueswir1 #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ 38231e31b8aSbellard 38331e31b8aSbellard #ifdef TARGET_MIPS 38431e31b8aSbellard #define TARGET_NSIG 128 38531e31b8aSbellard #else 38631e31b8aSbellard #define TARGET_NSIG 64 38731e31b8aSbellard #endif 388992f48a0Sblueswir1 #define TARGET_NSIG_BPW TARGET_ABI_BITS 38931e31b8aSbellard #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) 39031e31b8aSbellard 39131e31b8aSbellard typedef struct { 392992f48a0Sblueswir1 abi_ulong sig[TARGET_NSIG_WORDS]; 393c227f099SAnthony Liguori } target_sigset_t; 39431e31b8aSbellard 39566fb9763Sbellard #ifdef BSWAP_NEEDED 396c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 39766fb9763Sbellard { 39866fb9763Sbellard int i; 39966fb9763Sbellard for(i = 0;i < TARGET_NSIG_WORDS; i++) 400cbb21eedSMatthias Braun d->sig[i] = tswapal(s->sig[i]); 40166fb9763Sbellard } 40266fb9763Sbellard #else 403c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 40466fb9763Sbellard { 40566fb9763Sbellard *d = *s; 40666fb9763Sbellard } 40766fb9763Sbellard #endif 40866fb9763Sbellard 409c227f099SAnthony Liguori static inline void target_siginitset(target_sigset_t *d, abi_ulong set) 41066fb9763Sbellard { 41166fb9763Sbellard int i; 41266fb9763Sbellard d->sig[0] = set; 41366fb9763Sbellard for(i = 1;i < TARGET_NSIG_WORDS; i++) 41466fb9763Sbellard d->sig[i] = 0; 41566fb9763Sbellard } 41666fb9763Sbellard 417c227f099SAnthony Liguori void host_to_target_sigset(target_sigset_t *d, const sigset_t *s); 418c227f099SAnthony Liguori void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); 419992f48a0Sblueswir1 void host_to_target_old_sigset(abi_ulong *old_sigset, 42066fb9763Sbellard const sigset_t *sigset); 42166fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset, 422992f48a0Sblueswir1 const abi_ulong *old_sigset); 42366fb9763Sbellard struct target_sigaction; 42466fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act, 42566fb9763Sbellard struct target_sigaction *oact); 42666fb9763Sbellard 4279850f9f6SLaurent Vivier #include "target_signal.h" 4289850f9f6SLaurent Vivier 4297f047de1SRichard Henderson #ifdef TARGET_SA_RESTORER 4307f047de1SRichard Henderson #define TARGET_ARCH_HAS_SA_RESTORER 1 4317f047de1SRichard Henderson #endif 4327f047de1SRichard Henderson 4336049f4f8SRichard Henderson #if defined(TARGET_ALPHA) 4346049f4f8SRichard Henderson struct target_old_sigaction { 4356049f4f8SRichard Henderson abi_ulong _sa_handler; 4366049f4f8SRichard Henderson abi_ulong sa_mask; 437d2565875SRichard Henderson int32_t sa_flags; 4386049f4f8SRichard Henderson }; 439106ec879Sbellard 4406049f4f8SRichard Henderson struct target_rt_sigaction { 4416049f4f8SRichard Henderson abi_ulong _sa_handler; 4426049f4f8SRichard Henderson abi_ulong sa_flags; 4436049f4f8SRichard Henderson target_sigset_t sa_mask; 4446049f4f8SRichard Henderson }; 4456049f4f8SRichard Henderson 4466049f4f8SRichard Henderson /* This is the struct used inside the kernel. The ka_restorer 4476049f4f8SRichard Henderson field comes from the 5th argument to sys_rt_sigaction. */ 4486049f4f8SRichard Henderson struct target_sigaction { 4496049f4f8SRichard Henderson abi_ulong _sa_handler; 4506049f4f8SRichard Henderson abi_ulong sa_flags; 4516049f4f8SRichard Henderson target_sigset_t sa_mask; 4526049f4f8SRichard Henderson abi_ulong sa_restorer; 4536049f4f8SRichard Henderson }; 4546049f4f8SRichard Henderson #elif defined(TARGET_MIPS) 455106ec879Sbellard struct target_sigaction { 456540635baSths uint32_t sa_flags; 457d26bc211Sths #if defined(TARGET_ABI_MIPSN32) 458540635baSths uint32_t _sa_handler; 459540635baSths #else 460992f48a0Sblueswir1 abi_ulong _sa_handler; 461540635baSths #endif 462c227f099SAnthony Liguori target_sigset_t sa_mask; 4637f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 4647f047de1SRichard Henderson /* ??? This is always present, but ignored unless O32. */ 4657f047de1SRichard Henderson abi_ulong sa_restorer; 4667f047de1SRichard Henderson #endif 467106ec879Sbellard }; 468106ec879Sbellard #else 4692521d698Sbellard struct target_old_sigaction { 470992f48a0Sblueswir1 abi_ulong _sa_handler; 471992f48a0Sblueswir1 abi_ulong sa_mask; 472992f48a0Sblueswir1 abi_ulong sa_flags; 4737f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 474992f48a0Sblueswir1 abi_ulong sa_restorer; 4757f047de1SRichard Henderson #endif 4762521d698Sbellard }; 4772521d698Sbellard 4782521d698Sbellard struct target_sigaction { 479992f48a0Sblueswir1 abi_ulong _sa_handler; 480992f48a0Sblueswir1 abi_ulong sa_flags; 4817f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 482992f48a0Sblueswir1 abi_ulong sa_restorer; 4837f047de1SRichard Henderson #endif 484c227f099SAnthony Liguori target_sigset_t sa_mask; 4855de154e8SLaurent Vivier #ifdef TARGET_ARCH_HAS_KA_RESTORER 4865de154e8SLaurent Vivier abi_ulong ka_restorer; 4875de154e8SLaurent Vivier #endif 4882521d698Sbellard }; 489106ec879Sbellard #endif 4902521d698Sbellard 4912521d698Sbellard typedef union target_sigval { 4922521d698Sbellard int sival_int; 493992f48a0Sblueswir1 abi_ulong sival_ptr; 494c227f099SAnthony Liguori } target_sigval_t; 4956d5e216dSbellard #if 0 4966d5e216dSbellard #if defined (TARGET_SPARC) 4976d5e216dSbellard typedef struct { 4986d5e216dSbellard struct { 499992f48a0Sblueswir1 abi_ulong psr; 500992f48a0Sblueswir1 abi_ulong pc; 501992f48a0Sblueswir1 abi_ulong npc; 502992f48a0Sblueswir1 abi_ulong y; 503992f48a0Sblueswir1 abi_ulong u_regs[16]; /* globals and ins */ 5046d5e216dSbellard } si_regs; 5056d5e216dSbellard int si_mask; 5066d5e216dSbellard } __siginfo_t; 5076d5e216dSbellard 5086d5e216dSbellard typedef struct { 5096d5e216dSbellard unsigned long si_float_regs [32]; 5106d5e216dSbellard unsigned long si_fsr; 5116d5e216dSbellard unsigned long si_fpqdepth; 5126d5e216dSbellard struct { 5136d5e216dSbellard unsigned long *insn_addr; 5146d5e216dSbellard unsigned long insn; 5156d5e216dSbellard } si_fpqueue [16]; 5166d5e216dSbellard } __siginfo_fpu_t; 5176d5e216dSbellard #endif 5186d5e216dSbellard #endif 5192521d698Sbellard 5202521d698Sbellard #define TARGET_SI_MAX_SIZE 128 521aa5e03d2SMaxim Ostapenko 522aa5e03d2SMaxim Ostapenko #if TARGET_ABI_BITS == 32 523aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int)) 524aa5e03d2SMaxim Ostapenko #else 525aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int)) 526aa5e03d2SMaxim Ostapenko #endif 527aa5e03d2SMaxim Ostapenko 528aa5e03d2SMaxim Ostapenko #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int)) 5292521d698Sbellard 530a70dadc7SPeter Maydell /* Within QEMU the top 16 bits of si_code indicate which of the parts of 531a70dadc7SPeter Maydell * the union in target_siginfo is valid. This only applies between 532a70dadc7SPeter Maydell * host_to_target_siginfo_noswap() and tswap_siginfo(); it does not 533a70dadc7SPeter Maydell * appear either within host siginfo_t or in target_siginfo structures 534a70dadc7SPeter Maydell * which we get from the guest userspace program. (The Linux kernel 535a70dadc7SPeter Maydell * does a similar thing with using the top bits for its own internal 536a70dadc7SPeter Maydell * purposes but not letting them be visible to userspace.) 537a70dadc7SPeter Maydell */ 538a70dadc7SPeter Maydell #define QEMU_SI_KILL 0 539a70dadc7SPeter Maydell #define QEMU_SI_TIMER 1 540a70dadc7SPeter Maydell #define QEMU_SI_POLL 2 541a70dadc7SPeter Maydell #define QEMU_SI_FAULT 3 542a70dadc7SPeter Maydell #define QEMU_SI_CHLD 4 543a70dadc7SPeter Maydell #define QEMU_SI_RT 5 544a70dadc7SPeter Maydell 5452521d698Sbellard typedef struct target_siginfo { 5463f53d546Spbrook #ifdef TARGET_MIPS 5473f53d546Spbrook int si_signo; 5483f53d546Spbrook int si_code; 5493f53d546Spbrook int si_errno; 5503f53d546Spbrook #else 5512521d698Sbellard int si_signo; 5522521d698Sbellard int si_errno; 5532521d698Sbellard int si_code; 5543f53d546Spbrook #endif 5552521d698Sbellard 5562521d698Sbellard union { 5572521d698Sbellard int _pad[TARGET_SI_PAD_SIZE]; 5582521d698Sbellard 5592521d698Sbellard /* kill() */ 5602521d698Sbellard struct { 5612521d698Sbellard pid_t _pid; /* sender's pid */ 5622521d698Sbellard uid_t _uid; /* sender's uid */ 5632521d698Sbellard } _kill; 5642521d698Sbellard 5652521d698Sbellard /* POSIX.1b timers */ 5662521d698Sbellard struct { 5672521d698Sbellard unsigned int _timer1; 5682521d698Sbellard unsigned int _timer2; 5692521d698Sbellard } _timer; 5702521d698Sbellard 5712521d698Sbellard /* POSIX.1b signals */ 5722521d698Sbellard struct { 5732521d698Sbellard pid_t _pid; /* sender's pid */ 5742521d698Sbellard uid_t _uid; /* sender's uid */ 575c227f099SAnthony Liguori target_sigval_t _sigval; 5762521d698Sbellard } _rt; 5772521d698Sbellard 5782521d698Sbellard /* SIGCHLD */ 5792521d698Sbellard struct { 5802521d698Sbellard pid_t _pid; /* which child */ 5812521d698Sbellard uid_t _uid; /* sender's uid */ 5822521d698Sbellard int _status; /* exit code */ 583c227f099SAnthony Liguori target_clock_t _utime; 584c227f099SAnthony Liguori target_clock_t _stime; 5852521d698Sbellard } _sigchld; 5862521d698Sbellard 5872521d698Sbellard /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 5882521d698Sbellard struct { 589992f48a0Sblueswir1 abi_ulong _addr; /* faulting insn/memory ref. */ 5902521d698Sbellard } _sigfault; 5912521d698Sbellard 5922521d698Sbellard /* SIGPOLL */ 5932521d698Sbellard struct { 5942521d698Sbellard int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 5952521d698Sbellard int _fd; 5962521d698Sbellard } _sigpoll; 5972521d698Sbellard } _sifields; 598c227f099SAnthony Liguori } target_siginfo_t; 5992521d698Sbellard 6002521d698Sbellard /* 6012521d698Sbellard * si_code values 6022521d698Sbellard * Digital reserves positive values for kernel-generated signals. 6032521d698Sbellard */ 6042521d698Sbellard #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ 6052521d698Sbellard #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 6062521d698Sbellard #define TARGET_SI_QUEUE -1 /* sent by sigqueue */ 6072521d698Sbellard #define TARGET_SI_TIMER -2 /* sent by timer expiration */ 6082521d698Sbellard #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ 6092521d698Sbellard #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ 6102521d698Sbellard #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ 6112521d698Sbellard 6122521d698Sbellard /* 6132521d698Sbellard * SIGILL si_codes 6142521d698Sbellard */ 615ffa65c3bSbellard #define TARGET_ILL_ILLOPC (1) /* illegal opcode */ 6162521d698Sbellard #define TARGET_ILL_ILLOPN (2) /* illegal operand */ 617ffa65c3bSbellard #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ 618ffa65c3bSbellard #define TARGET_ILL_ILLTRP (4) /* illegal trap */ 619ffa65c3bSbellard #define TARGET_ILL_PRVOPC (5) /* privileged opcode */ 620ffa65c3bSbellard #define TARGET_ILL_PRVREG (6) /* privileged register */ 621ffa65c3bSbellard #define TARGET_ILL_COPROC (7) /* coprocessor error */ 622ffa65c3bSbellard #define TARGET_ILL_BADSTK (8) /* internal stack error */ 623de2fdd56SChen Gang #ifdef TARGET_TILEGX 624de2fdd56SChen Gang #define TARGET_ILL_DBLFLT (9) /* double fault */ 625de2fdd56SChen Gang #define TARGET_ILL_HARDWALL (10) /* user networks hardwall violation */ 626de2fdd56SChen Gang #endif 6272521d698Sbellard 6282521d698Sbellard /* 6292521d698Sbellard * SIGFPE si_codes 6302521d698Sbellard */ 6312521d698Sbellard #define TARGET_FPE_INTDIV (1) /* integer divide by zero */ 6322521d698Sbellard #define TARGET_FPE_INTOVF (2) /* integer overflow */ 6332521d698Sbellard #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ 6342521d698Sbellard #define TARGET_FPE_FLTOVF (4) /* floating point overflow */ 6352521d698Sbellard #define TARGET_FPE_FLTUND (5) /* floating point underflow */ 6362521d698Sbellard #define TARGET_FPE_FLTRES (6) /* floating point inexact result */ 6372521d698Sbellard #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ 6382521d698Sbellard #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ 63921ba8564SRichard Henderson #define TARGET_FPE_FLTUNK (14) /* undiagnosed fp exception */ 64021ba8564SRichard Henderson #define TARGET_NSIGFPE 15 6412521d698Sbellard 6422521d698Sbellard /* 6432521d698Sbellard * SIGSEGV si_codes 6442521d698Sbellard */ 6452521d698Sbellard #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ 6462521d698Sbellard #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ 647de2fdd56SChen Gang #define TARGET_SEGV_BNDERR (3) /* failed address bound checks */ 6482521d698Sbellard 6492521d698Sbellard /* 650ffa65c3bSbellard * SIGBUS si_codes 651ffa65c3bSbellard */ 652ffa65c3bSbellard #define TARGET_BUS_ADRALN (1) /* invalid address alignment */ 653b4916d7bSDong Xu Wang #define TARGET_BUS_ADRERR (2) /* non-existent physical address */ 654ffa65c3bSbellard #define TARGET_BUS_OBJERR (3) /* object specific hardware error */ 655de2fdd56SChen Gang /* hardware memory error consumed on a machine check: action required */ 656de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AR (4) 657de2fdd56SChen Gang /* hardware memory error detected in process but not consumed: action optional*/ 658de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AO (5) 659ffa65c3bSbellard 660ffa65c3bSbellard /* 6612521d698Sbellard * SIGTRAP si_codes 6622521d698Sbellard */ 6632521d698Sbellard #define TARGET_TRAP_BRKPT (1) /* process breakpoint */ 6642521d698Sbellard #define TARGET_TRAP_TRACE (2) /* process trace trap */ 665de2fdd56SChen Gang #define TARGET_TRAP_BRANCH (3) /* process taken branch trap */ 666de2fdd56SChen Gang #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */ 6672521d698Sbellard 6689de5e440Sbellard struct target_rlimit { 669992f48a0Sblueswir1 abi_ulong rlim_cur; 670992f48a0Sblueswir1 abi_ulong rlim_max; 6719de5e440Sbellard }; 6729de5e440Sbellard 67381bbe906Stakasi-y@ops.dti.ne.jp #if defined(TARGET_ALPHA) 674e476492eSAurelien Jarno #define TARGET_RLIM_INFINITY 0x7fffffffffffffffull 6756cafd027SMatthias Braun #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32) 67681bbe906Stakasi-y@ops.dti.ne.jp #define TARGET_RLIM_INFINITY 0x7fffffffUL 67781bbe906Stakasi-y@ops.dti.ne.jp #else 67826b746dbSMatthias Braun #define TARGET_RLIM_INFINITY ((abi_ulong)-1) 67981bbe906Stakasi-y@ops.dti.ne.jp #endif 68081bbe906Stakasi-y@ops.dti.ne.jp 681e22b7015SWesley W. Terpstra #if defined(TARGET_MIPS) 682e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 683e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 684e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 685e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 686e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 687e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 7 688e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 8 689e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 5 690e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 9 691e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 6 692e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 693e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 694e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 695e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 696e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 697e22b7015SWesley W. Terpstra #else 698e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 699e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 700e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 701e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 702e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 703e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 5 7046cafd027SMatthias Braun #if defined(TARGET_SPARC) 7056cafd027SMatthias Braun #define TARGET_RLIMIT_NOFILE 6 7066cafd027SMatthias Braun #define TARGET_RLIMIT_NPROC 7 7076cafd027SMatthias Braun #else 708e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 6 709e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 7 7106cafd027SMatthias Braun #endif 711e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 8 712e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 9 713e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 714e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 715e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 716e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 717e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 718e22b7015SWesley W. Terpstra #endif 719e22b7015SWesley W. Terpstra 7209de5e440Sbellard struct target_pollfd { 7219de5e440Sbellard int fd; /* file descriptor */ 7229de5e440Sbellard short events; /* requested events */ 7239de5e440Sbellard short revents; /* returned events */ 7249de5e440Sbellard }; 7259de5e440Sbellard 7268e5a0667Sbellard /* virtual terminal ioctls */ 7270221cfcdSbellard #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ 7280221cfcdSbellard #define TARGET_KDMKTONE 0x4B30 /* generate tone */ 7298e5a0667Sbellard #define TARGET_KDGKBTYPE 0x4b33 730f7680a55SUlrich Hecht #define TARGET_KDSETMODE 0x4b3a 731f7680a55SUlrich Hecht #define TARGET_KDGKBMODE 0x4b44 732f7680a55SUlrich Hecht #define TARGET_KDSKBMODE 0x4b45 7330221cfcdSbellard #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ 7340221cfcdSbellard #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ 735e6fe18fbSCédric VINCENT #define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ 736e6fe18fbSCédric VINCENT #define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ 737e6fe18fbSCédric VINCENT #define TARGET_KDGETLED 0x4B31 /* return current led state */ 738e6fe18fbSCédric VINCENT #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */ 739ca56f5b5SPaul Burton #define TARGET_KDSIGACCEPT 0x4B4E 7408e5a0667Sbellard 741d14eabbeSAleksandar Markovic #if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) || \ 742d14eabbeSAleksandar Markovic defined(TARGET_XTENSA) 743e1be1606SAleksandar Markovic #define TARGET_SIOCATMARK TARGET_IOR('s', 7, int) 744c495a793SAleksandar Markovic #define TARGET_SIOCSPGRP TARGET_IOW('s', 8, pid_t) 745405b4915SHelge Deller #define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t) 746e1be1606SAleksandar Markovic #else 7472521d698Sbellard #define TARGET_SIOCATMARK 0x8905 748c495a793SAleksandar Markovic #define TARGET_SIOCSPGRP 0x8902 749405b4915SHelge Deller #define TARGET_SIOCGPGRP 0x8904 750e1be1606SAleksandar Markovic #endif 751c495a793SAleksandar Markovic 752405b4915SHelge Deller #define TARGET_SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ 753405b4915SHelge Deller #define TARGET_SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ 7542521d698Sbellard 75531e31b8aSbellard /* Networking ioctls */ 75631e31b8aSbellard #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ 75731e31b8aSbellard #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ 75831e31b8aSbellard #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ 75931e31b8aSbellard #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ 76031e31b8aSbellard #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ 76131e31b8aSbellard #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ 76231e31b8aSbellard #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ 76331e31b8aSbellard #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ 76431e31b8aSbellard #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ 76531e31b8aSbellard #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ 76631e31b8aSbellard #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ 76731e31b8aSbellard #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ 76831e31b8aSbellard #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ 76931e31b8aSbellard #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ 77031e31b8aSbellard #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ 77131e31b8aSbellard #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ 77231e31b8aSbellard #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ 77331e31b8aSbellard #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ 77431e31b8aSbellard #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ 77531e31b8aSbellard #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ 77631e31b8aSbellard #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ 77731e31b8aSbellard #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ 77831e31b8aSbellard #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ 77931e31b8aSbellard #define TARGET_SIOCSIFENCAP 0x8926 78031e31b8aSbellard #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ 78131e31b8aSbellard #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ 78231e31b8aSbellard #define TARGET_SIOCSIFSLAVE 0x8930 78331e31b8aSbellard #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ 78431e31b8aSbellard #define TARGET_SIOCDELMULTI 0x8932 785f63eb01aSPaul Burton #define TARGET_SIOCGIFINDEX 0x8933 7864bdcd79eSNeng Chen #define TARGET_SIOCSIFPFLAGS 0x8934 /* set extended flags */ 7874bdcd79eSNeng Chen #define TARGET_SIOCGIFPFLAGS 0x8935 /* get extended flags */ 78831e31b8aSbellard 78931e31b8aSbellard /* Bridging control calls */ 79031e31b8aSbellard #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ 79131e31b8aSbellard #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ 79231e31b8aSbellard 79331e31b8aSbellard #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ 79431e31b8aSbellard #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ 79531e31b8aSbellard 79631e31b8aSbellard /* ARP cache control calls. */ 79731e31b8aSbellard #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ 79831e31b8aSbellard #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ 79931e31b8aSbellard #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ 80031e31b8aSbellard #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ 80131e31b8aSbellard #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ 80231e31b8aSbellard #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ 80331e31b8aSbellard 80431e31b8aSbellard /* RARP cache control calls. */ 80531e31b8aSbellard #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ 80631e31b8aSbellard #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ 80731e31b8aSbellard #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ 80831e31b8aSbellard 80931e31b8aSbellard /* Driver configuration calls */ 81031e31b8aSbellard #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ 81131e31b8aSbellard #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ 81231e31b8aSbellard 81331e31b8aSbellard /* DLCI configuration calls */ 81431e31b8aSbellard #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ 81531e31b8aSbellard #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ 81631e31b8aSbellard 81786fcd946SLaurent Vivier /* From <linux/wireless.h> */ 81886fcd946SLaurent Vivier 81986fcd946SLaurent Vivier #define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ 82031e31b8aSbellard 821d6d6d6feSMarco A L Barbosa /* From <linux/random.h> */ 822d6d6d6feSMarco A L Barbosa 823d6d6d6feSMarco A L Barbosa #define TARGET_RNDGETENTCNT TARGET_IOR('R', 0x00, int) 824d6d6d6feSMarco A L Barbosa #define TARGET_RNDADDTOENTCNT TARGET_IOW('R', 0x01, int) 825d6d6d6feSMarco A L Barbosa #define TARGET_RNDZAPENTCNT TARGET_IO('R', 0x04) 826d6d6d6feSMarco A L Barbosa #define TARGET_RNDCLEARPOOL TARGET_IO('R', 0x06) 827d6d6d6feSMarco A L Barbosa 82831e31b8aSbellard /* From <linux/fs.h> */ 82931e31b8aSbellard 83031e31b8aSbellard #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ 83131e31b8aSbellard #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ 83231e31b8aSbellard #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ 83331e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ 83431e31b8aSbellard #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ 83531e31b8aSbellard #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ 83631e31b8aSbellard #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ 83731e31b8aSbellard #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ 83831e31b8aSbellard #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ 83931e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ 84031e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ 84131e31b8aSbellard #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ 842fff8c539SAndreas Färber #define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */ 84331e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */ 844c8b0bf54SPeter Maydell #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong) 845c8b0bf54SPeter Maydell #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong) 846edafea13SAlexander Graf #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) 847edafea13SAlexander Graf /* return device size in bytes 848edafea13SAlexander Graf (u64 *arg) */ 8494715856aSPeter Maydell 8504715856aSPeter Maydell #define TARGET_BLKDISCARD TARGET_IO(0x12, 119) 8514715856aSPeter Maydell #define TARGET_BLKIOMIN TARGET_IO(0x12, 120) 8524715856aSPeter Maydell #define TARGET_BLKIOOPT TARGET_IO(0x12, 121) 8534715856aSPeter Maydell #define TARGET_BLKALIGNOFF TARGET_IO(0x12, 122) 8544715856aSPeter Maydell #define TARGET_BLKPBSZGET TARGET_IO(0x12, 123) 8554715856aSPeter Maydell #define TARGET_BLKDISCARDZEROES TARGET_IO(0x12, 124) 8564715856aSPeter Maydell #define TARGET_BLKSECDISCARD TARGET_IO(0x12, 125) 8574715856aSPeter Maydell #define TARGET_BLKROTATIONAL TARGET_IO(0x12, 126) 8584715856aSPeter Maydell #define TARGET_BLKZEROOUT TARGET_IO(0x12, 127) 8594715856aSPeter Maydell 86031e31b8aSbellard #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ 86131e31b8aSbellard #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ 86221992cb6SHelge Deller 86321992cb6SHelge Deller #define TARGET_FICLONE TARGET_IOW(0x94, 9, int) 86421992cb6SHelge Deller #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range) 86521992cb6SHelge Deller 86660807231SPeter Maydell /* Note that the ioctl numbers claim type "long" but the actual type 86760807231SPeter Maydell * used by the kernel is "int". 86860807231SPeter Maydell */ 8691847b7baSPeter Maydell #define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, abi_long) 8701847b7baSPeter Maydell #define TARGET_FS_IOC_SETFLAGS TARGET_IOW('f', 2, abi_long) 87160807231SPeter Maydell 872285da2b9SPeter Maydell #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) 87331e31b8aSbellard 8746c753a63SCortland Tölva /* usb ioctls */ 8756c753a63SCortland Tölva #define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0) 8766c753a63SCortland Tölva #define TARGET_USBDEVFS_BULK TARGET_IOWRU('U', 2) 8776c753a63SCortland Tölva #define TARGET_USBDEVFS_RESETEP TARGET_IORU('U', 3) 8786c753a63SCortland Tölva #define TARGET_USBDEVFS_SETINTERFACE TARGET_IORU('U', 4) 8796c753a63SCortland Tölva #define TARGET_USBDEVFS_SETCONFIGURATION TARGET_IORU('U', 5) 8806c753a63SCortland Tölva #define TARGET_USBDEVFS_GETDRIVER TARGET_IOWU('U', 8) 881a133367eSCortland Tölva #define TARGET_USBDEVFS_SUBMITURB TARGET_IORU('U', 10) 882a133367eSCortland Tölva #define TARGET_USBDEVFS_DISCARDURB TARGET_IO('U', 11) 883a133367eSCortland Tölva #define TARGET_USBDEVFS_REAPURB TARGET_IOWU('U', 12) 884a133367eSCortland Tölva #define TARGET_USBDEVFS_REAPURBNDELAY TARGET_IOWU('U', 13) 8856c753a63SCortland Tölva #define TARGET_USBDEVFS_DISCSIGNAL TARGET_IORU('U', 14) 8866c753a63SCortland Tölva #define TARGET_USBDEVFS_CLAIMINTERFACE TARGET_IORU('U', 15) 8876c753a63SCortland Tölva #define TARGET_USBDEVFS_RELEASEINTERFACE TARGET_IORU('U', 16) 8886c753a63SCortland Tölva #define TARGET_USBDEVFS_CONNECTINFO TARGET_IOWU('U', 17) 8896c753a63SCortland Tölva #define TARGET_USBDEVFS_IOCTL TARGET_IOWRU('U', 18) 8906c753a63SCortland Tölva #define TARGET_USBDEVFS_HUB_PORTINFO TARGET_IORU('U', 19) 8916c753a63SCortland Tölva #define TARGET_USBDEVFS_RESET TARGET_IO('U', 20) 8926c753a63SCortland Tölva #define TARGET_USBDEVFS_CLEAR_HALT TARGET_IORU('U', 21) 8936c753a63SCortland Tölva #define TARGET_USBDEVFS_DISCONNECT TARGET_IO('U', 22) 8946c753a63SCortland Tölva #define TARGET_USBDEVFS_CONNECT TARGET_IO('U', 23) 8956c753a63SCortland Tölva #define TARGET_USBDEVFS_CLAIM_PORT TARGET_IORU('U', 24) 8966c753a63SCortland Tölva #define TARGET_USBDEVFS_RELEASE_PORT TARGET_IORU('U', 25) 8976c753a63SCortland Tölva #define TARGET_USBDEVFS_GET_CAPABILITIES TARGET_IORU('U', 26) 8986c753a63SCortland Tölva #define TARGET_USBDEVFS_DISCONNECT_CLAIM TARGET_IORU('U', 27) 8996c753a63SCortland Tölva #define TARGET_USBDEVFS_DROP_PRIVILEGES TARGET_IOWU('U', 30) 9006c753a63SCortland Tölva #define TARGET_USBDEVFS_GET_SPEED TARGET_IO('U', 31) 9016c753a63SCortland Tölva 90231e31b8aSbellard /* cdrom commands */ 90331e31b8aSbellard #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ 90431e31b8aSbellard #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ 90531e31b8aSbellard #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ 90631e31b8aSbellard #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index 90731e31b8aSbellard (struct cdrom_ti) */ 90831e31b8aSbellard #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header 90931e31b8aSbellard (struct cdrom_tochdr) */ 91031e31b8aSbellard #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry 91131e31b8aSbellard (struct cdrom_tocentry) */ 91231e31b8aSbellard #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ 91331e31b8aSbellard #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ 91431e31b8aSbellard #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ 91531e31b8aSbellard #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume 91631e31b8aSbellard (struct cdrom_volctrl) */ 91731e31b8aSbellard #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data 91831e31b8aSbellard (struct cdrom_subchnl) */ 91931e31b8aSbellard #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) 92031e31b8aSbellard (struct cdrom_read) */ 92131e31b8aSbellard #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) 92231e31b8aSbellard (struct cdrom_read) */ 92331e31b8aSbellard #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ 92431e31b8aSbellard #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ 92531e31b8aSbellard #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session 92631e31b8aSbellard address of multi session disks 92731e31b8aSbellard (struct cdrom_multisession) */ 92831e31b8aSbellard #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" 92931e31b8aSbellard if available (struct cdrom_mcn) */ 93067cc32ebSVeres Lajos #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is deprecated, 931b4916d7bSDong Xu Wang but here anyway for compatibility */ 93231e31b8aSbellard #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ 93331e31b8aSbellard #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting 93431e31b8aSbellard (struct cdrom_volctrl) */ 93531e31b8aSbellard #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) 93631e31b8aSbellard (struct cdrom_read) */ 93731e31b8aSbellard /* 93831e31b8aSbellard * These ioctls are used only used in aztcd.c and optcd.c 93931e31b8aSbellard */ 94031e31b8aSbellard #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ 94131e31b8aSbellard #define TARGET_CDROMSEEK 0x5316 /* seek msf address */ 94231e31b8aSbellard 94331e31b8aSbellard /* 94431e31b8aSbellard * This ioctl is only used by the scsi-cd driver. 94531e31b8aSbellard It is for playing audio in logical block addressing mode. 94631e31b8aSbellard */ 94731e31b8aSbellard #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ 94831e31b8aSbellard 94931e31b8aSbellard /* 95031e31b8aSbellard * These ioctls are only used in optcd.c 95131e31b8aSbellard */ 95231e31b8aSbellard #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ 95331e31b8aSbellard 95431e31b8aSbellard /* 95531e31b8aSbellard * These ioctls are (now) only in ide-cd.c for controlling 95631e31b8aSbellard * drive spindown time. They should be implemented in the 95731e31b8aSbellard * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, 95831e31b8aSbellard * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... 95931e31b8aSbellard * -Erik 96031e31b8aSbellard */ 96131e31b8aSbellard #define TARGET_CDROMGETSPINDOWN 0x531d 96231e31b8aSbellard #define TARGET_CDROMSETSPINDOWN 0x531e 96331e31b8aSbellard 96431e31b8aSbellard /* 96531e31b8aSbellard * These ioctls are implemented through the uniform CD-ROM driver 96631e31b8aSbellard * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM 96731e31b8aSbellard * drivers are eventually ported to the uniform CD-ROM driver interface. 96831e31b8aSbellard */ 96931e31b8aSbellard #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ 97031e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ 97131e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ 97231e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ 97331e31b8aSbellard #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ 97431e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ 97531e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ 97631e31b8aSbellard #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ 97731e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ 97831e31b8aSbellard #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ 97931e31b8aSbellard #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ 98031e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ 98131e31b8aSbellard 98231e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. 98331e31b8aSbellard * Future CDROM ioctls should be kept below 0x537F 98431e31b8aSbellard */ 98531e31b8aSbellard 98631e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */ 98731e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ 98831e31b8aSbellard /* conflict with SCSI_IOCTL_GET_IDLUN */ 98931e31b8aSbellard 99031e31b8aSbellard /* DVD-ROM Specific ioctls */ 99131e31b8aSbellard #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ 99231e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ 99331e31b8aSbellard #define TARGET_DVD_AUTH 0x5392 /* Authentication */ 99431e31b8aSbellard 99531e31b8aSbellard #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ 99631e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ 99731e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ 99831e31b8aSbellard 99931e31b8aSbellard /* HD commands */ 100031e31b8aSbellard 100131e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ 100231e31b8aSbellard #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ 100331e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ 100431e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ 100531e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ 100631e31b8aSbellard #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ 100731e31b8aSbellard #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ 100831e31b8aSbellard #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ 10092521d698Sbellard #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ 101031e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ 101131e31b8aSbellard 101231e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ 101331e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ 101431e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ 101531e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ 101631e31b8aSbellard #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ 101731e31b8aSbellard #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ 101831e31b8aSbellard #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ 101931e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ 10202521d698Sbellard 1021b8005914Sbalrog /* loop ioctls */ 1022b8005914Sbalrog #define TARGET_LOOP_SET_FD 0x4C00 1023b8005914Sbalrog #define TARGET_LOOP_CLR_FD 0x4C01 1024b8005914Sbalrog #define TARGET_LOOP_SET_STATUS 0x4C02 1025b8005914Sbalrog #define TARGET_LOOP_GET_STATUS 0x4C03 1026b8005914Sbalrog #define TARGET_LOOP_SET_STATUS64 0x4C04 1027b8005914Sbalrog #define TARGET_LOOP_GET_STATUS64 0x4C05 1028b8005914Sbalrog #define TARGET_LOOP_CHANGE_FD 0x4C06 10292521d698Sbellard 1030884cdc48SPeter Maydell #define TARGET_LOOP_CTL_ADD 0x4C80 1031884cdc48SPeter Maydell #define TARGET_LOOP_CTL_REMOVE 0x4C81 1032884cdc48SPeter Maydell #define TARGET_LOOP_CTL_GET_FREE 0x4C82 1033884cdc48SPeter Maydell 1034f7680a55SUlrich Hecht /* fb ioctls */ 1035f7680a55SUlrich Hecht #define TARGET_FBIOGET_VSCREENINFO 0x4600 1036f7680a55SUlrich Hecht #define TARGET_FBIOPUT_VSCREENINFO 0x4601 1037f7680a55SUlrich Hecht #define TARGET_FBIOGET_FSCREENINFO 0x4602 103812b81b71SCédric VINCENT #define TARGET_FBIOGETCMAP 0x4604 103912b81b71SCédric VINCENT #define TARGET_FBIOPUTCMAP 0x4605 104012b81b71SCédric VINCENT #define TARGET_FBIOPAN_DISPLAY 0x4606 104112b81b71SCédric VINCENT #define TARGET_FBIOGET_CON2FBMAP 0x460F 104212b81b71SCédric VINCENT #define TARGET_FBIOPUT_CON2FBMAP 0x4610 1043f7680a55SUlrich Hecht 1044f7680a55SUlrich Hecht /* vt ioctls */ 1045f7680a55SUlrich Hecht #define TARGET_VT_OPENQRY 0x5600 1046f7680a55SUlrich Hecht #define TARGET_VT_GETSTATE 0x5603 1047f7680a55SUlrich Hecht #define TARGET_VT_ACTIVATE 0x5606 1048f7680a55SUlrich Hecht #define TARGET_VT_WAITACTIVE 0x5607 1049f7680a55SUlrich Hecht #define TARGET_VT_LOCKSWITCH 0x560b 1050f7680a55SUlrich Hecht #define TARGET_VT_UNLOCKSWITCH 0x560c 1051774750c0SCédric VINCENT #define TARGET_VT_GETMODE 0x5601 1052774750c0SCédric VINCENT #define TARGET_VT_SETMODE 0x5602 1053774750c0SCédric VINCENT #define TARGET_VT_RELDISP 0x5605 1054774750c0SCédric VINCENT #define TARGET_VT_DISALLOCATE 0x5608 1055f7680a55SUlrich Hecht 105656e904ecSAlexander Graf /* device mapper */ 105756e904ecSAlexander Graf #define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00) 105856e904ecSAlexander Graf #define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01) 105956e904ecSAlexander Graf #define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02) 106056e904ecSAlexander Graf #define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03) 106156e904ecSAlexander Graf #define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04) 106256e904ecSAlexander Graf #define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05) 106356e904ecSAlexander Graf #define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06) 106456e904ecSAlexander Graf #define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07) 106556e904ecSAlexander Graf #define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08) 106656e904ecSAlexander Graf #define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09) 106756e904ecSAlexander Graf #define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a) 106856e904ecSAlexander Graf #define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b) 106956e904ecSAlexander Graf #define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c) 107056e904ecSAlexander Graf #define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d) 107156e904ecSAlexander Graf #define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e) 107256e904ecSAlexander Graf #define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f) 107356e904ecSAlexander Graf 10742521d698Sbellard /* from asm/termbits.h */ 10752521d698Sbellard 10763bfd9da1Sbellard #define TARGET_NCC 8 10773bfd9da1Sbellard struct target_termio { 10783bfd9da1Sbellard unsigned short c_iflag; /* input mode flags */ 10793bfd9da1Sbellard unsigned short c_oflag; /* output mode flags */ 10803bfd9da1Sbellard unsigned short c_cflag; /* control mode flags */ 10813bfd9da1Sbellard unsigned short c_lflag; /* local mode flags */ 10822521d698Sbellard unsigned char c_line; /* line discipline */ 10833bfd9da1Sbellard unsigned char c_cc[TARGET_NCC]; /* control characters */ 10842521d698Sbellard }; 10852521d698Sbellard 10863bfd9da1Sbellard struct target_winsize { 10873bfd9da1Sbellard unsigned short ws_row; 10883bfd9da1Sbellard unsigned short ws_col; 10893bfd9da1Sbellard unsigned short ws_xpixel; 10903bfd9da1Sbellard unsigned short ws_ypixel; 10913bfd9da1Sbellard }; 10922521d698Sbellard 10933bfd9da1Sbellard #include "termbits.h" 10942521d698Sbellard 10959e0b74a4SPaul Brook #if defined(TARGET_MIPS) 10969e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x10 10979e0b74a4SPaul Brook #else 10989e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x08 10999e0b74a4SPaul Brook #endif 11009e0b74a4SPaul Brook 1101e44a3e79Saurel32 /* Common */ 11022521d698Sbellard #define TARGET_MAP_SHARED 0x01 /* Share changes */ 11032521d698Sbellard #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ 1104e65be6a7SHelge Deller #if defined(TARGET_HPPA) 1105e65be6a7SHelge Deller #define TARGET_MAP_TYPE 0x03 /* Mask for type of mapping */ 1106e65be6a7SHelge Deller #else 11072521d698Sbellard #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ 1108e65be6a7SHelge Deller #endif 1109e44a3e79Saurel32 1110e44a3e79Saurel32 /* Target specific */ 1111048f6b4dSbellard #if defined(TARGET_MIPS) 1112e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1113048f6b4dSbellard #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 1114048f6b4dSbellard #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 1115048f6b4dSbellard #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 1116048f6b4dSbellard #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 1117048f6b4dSbellard #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 1118048f6b4dSbellard #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 1119540635baSths #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 1120540635baSths #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1121541e1690SHelge Deller #define TARGET_MAP_STACK 0x40000 /* ignored */ 1122541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ 1123e44a3e79Saurel32 #elif defined(TARGET_PPC) 1124e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 11252521d698Sbellard #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 11262521d698Sbellard #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 11272521d698Sbellard #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 11282521d698Sbellard #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 11297ec93196Sj_mayer #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ 11307ec93196Sj_mayer #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ 1131e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1132e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1133541e1690SHelge Deller #define TARGET_MAP_STACK 0x20000 /* ignored */ 1134541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ 1135e44a3e79Saurel32 #elif defined(TARGET_ALPHA) 1136e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1137e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ 1138e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ 1139e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ 1140e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ 1141e44a3e79Saurel32 #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ 1142e44a3e79Saurel32 #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ 1143e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ 1144e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ 1145541e1690SHelge Deller #define TARGET_MAP_STACK 0x80000 /* ignored */ 1146541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x100000 /* create a huge page mapping */ 1147a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 1148a10d1e50SRichard Henderson #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1149a10d1e50SRichard Henderson #define TARGET_MAP_FIXED 0x04 /* Interpret addr exactly */ 1150a10d1e50SRichard Henderson #define TARGET_MAP_GROWSDOWN 0x08000 /* stack-like segment */ 1151a10d1e50SRichard Henderson #define TARGET_MAP_DENYWRITE 0x00800 /* ETXTBSY */ 1152a10d1e50SRichard Henderson #define TARGET_MAP_EXECUTABLE 0x01000 /* mark it as an executable */ 1153a10d1e50SRichard Henderson #define TARGET_MAP_LOCKED 0x02000 /* lock the mapping */ 1154a10d1e50SRichard Henderson #define TARGET_MAP_NORESERVE 0x04000 /* no check for reservations */ 1155a10d1e50SRichard Henderson #define TARGET_MAP_POPULATE 0x10000 /* pop (prefault) pagetables */ 1156a10d1e50SRichard Henderson #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1157541e1690SHelge Deller #define TARGET_MAP_STACK 0x40000 /* ignored */ 1158541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ 1159ba7651fbSMax Filippov #elif defined(TARGET_XTENSA) 1160ba7651fbSMax Filippov #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1161ba7651fbSMax Filippov #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 1162ba7651fbSMax Filippov #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 1163ba7651fbSMax Filippov #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 1164ba7651fbSMax Filippov #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 1165ba7651fbSMax Filippov #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 1166ba7651fbSMax Filippov #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 1167ba7651fbSMax Filippov #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 1168ba7651fbSMax Filippov #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1169ba7651fbSMax Filippov #define TARGET_MAP_STACK 0x40000 1170ba7651fbSMax Filippov #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ 11717ec93196Sj_mayer #else 1172e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1173e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 1174e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 1175e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 1176e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 11772521d698Sbellard #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ 11782521d698Sbellard #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ 1179540635baSths #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1180540635baSths #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1181541e1690SHelge Deller #define TARGET_MAP_STACK 0x20000 /* ignored */ 1182541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ 1183906c1b8eSMike Frysinger #define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ 11847ec93196Sj_mayer #endif 11852521d698Sbellard 118609701199SAlexander Graf #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 118709701199SAlexander Graf || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 1188daa4374aSPeter Maydell || defined(TARGET_CRIS) 11895f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 11902521d698Sbellard struct target_stat { 11912521d698Sbellard unsigned short st_dev; 11922521d698Sbellard unsigned short __pad1; 1193992f48a0Sblueswir1 abi_ulong st_ino; 11942521d698Sbellard unsigned short st_mode; 11952521d698Sbellard unsigned short st_nlink; 11962521d698Sbellard unsigned short st_uid; 11972521d698Sbellard unsigned short st_gid; 11982521d698Sbellard unsigned short st_rdev; 11992521d698Sbellard unsigned short __pad2; 1200992f48a0Sblueswir1 abi_ulong st_size; 1201992f48a0Sblueswir1 abi_ulong st_blksize; 1202992f48a0Sblueswir1 abi_ulong st_blocks; 1203992f48a0Sblueswir1 abi_ulong target_st_atime; 12045f992db6SChen-Yu Tsai abi_ulong target_st_atime_nsec; 1205992f48a0Sblueswir1 abi_ulong target_st_mtime; 12065f992db6SChen-Yu Tsai abi_ulong target_st_mtime_nsec; 1207992f48a0Sblueswir1 abi_ulong target_st_ctime; 12085f992db6SChen-Yu Tsai abi_ulong target_st_ctime_nsec; 1209992f48a0Sblueswir1 abi_ulong __unused4; 1210992f48a0Sblueswir1 abi_ulong __unused5; 12112521d698Sbellard }; 12122521d698Sbellard 12132521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely 12142521d698Sbellard * insane amounts of padding around dev_t's. 12152521d698Sbellard */ 121620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 12172521d698Sbellard struct target_stat64 { 12182521d698Sbellard unsigned short st_dev; 12192521d698Sbellard unsigned char __pad0[10]; 12202521d698Sbellard 12212521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1222992f48a0Sblueswir1 abi_ulong __st_ino; 12232521d698Sbellard 12242521d698Sbellard unsigned int st_mode; 12252521d698Sbellard unsigned int st_nlink; 12262521d698Sbellard 1227992f48a0Sblueswir1 abi_ulong st_uid; 1228992f48a0Sblueswir1 abi_ulong st_gid; 12292521d698Sbellard 12302521d698Sbellard unsigned short st_rdev; 12312521d698Sbellard unsigned char __pad3[10]; 12322521d698Sbellard 12332521d698Sbellard long long st_size; 1234992f48a0Sblueswir1 abi_ulong st_blksize; 12352521d698Sbellard 1236992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1237992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 12382521d698Sbellard 1239992f48a0Sblueswir1 abi_ulong target_st_atime; 12405f992db6SChen-Yu Tsai abi_ulong target_st_atime_nsec; 12412521d698Sbellard 1242992f48a0Sblueswir1 abi_ulong target_st_mtime; 12435f992db6SChen-Yu Tsai abi_ulong target_st_mtime_nsec; 12442521d698Sbellard 1245992f48a0Sblueswir1 abi_ulong target_st_ctime; 12465f992db6SChen-Yu Tsai abi_ulong target_st_ctime_nsec; 12472521d698Sbellard 12482521d698Sbellard unsigned long long st_ino; 1249541dc0d4SStefan Weil } QEMU_PACKED; 12502521d698Sbellard 1251ce4defa0Spbrook #ifdef TARGET_ARM 125220d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1253ce4defa0Spbrook struct target_eabi_stat64 { 1254ce4defa0Spbrook unsigned long long st_dev; 1255ce4defa0Spbrook unsigned int __pad1; 1256992f48a0Sblueswir1 abi_ulong __st_ino; 1257ce4defa0Spbrook unsigned int st_mode; 1258ce4defa0Spbrook unsigned int st_nlink; 1259ce4defa0Spbrook 1260992f48a0Sblueswir1 abi_ulong st_uid; 1261992f48a0Sblueswir1 abi_ulong st_gid; 1262ce4defa0Spbrook 1263ce4defa0Spbrook unsigned long long st_rdev; 1264ce4defa0Spbrook unsigned int __pad2[2]; 1265ce4defa0Spbrook 1266ce4defa0Spbrook long long st_size; 1267992f48a0Sblueswir1 abi_ulong st_blksize; 1268ce4defa0Spbrook unsigned int __pad3; 1269ce4defa0Spbrook unsigned long long st_blocks; 1270ce4defa0Spbrook 1271992f48a0Sblueswir1 abi_ulong target_st_atime; 1272992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1273ce4defa0Spbrook 1274992f48a0Sblueswir1 abi_ulong target_st_mtime; 1275992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1276ce4defa0Spbrook 1277992f48a0Sblueswir1 abi_ulong target_st_ctime; 1278992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1279ce4defa0Spbrook 1280ce4defa0Spbrook unsigned long long st_ino; 1281541dc0d4SStefan Weil } QEMU_PACKED; 1282ce4defa0Spbrook #endif 1283ce4defa0Spbrook 1284992f48a0Sblueswir1 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 12851b8dd648Sblueswir1 struct target_stat { 12861b8dd648Sblueswir1 unsigned int st_dev; 1287992f48a0Sblueswir1 abi_ulong st_ino; 12881b8dd648Sblueswir1 unsigned int st_mode; 12891b8dd648Sblueswir1 unsigned int st_nlink; 12901b8dd648Sblueswir1 unsigned int st_uid; 12911b8dd648Sblueswir1 unsigned int st_gid; 12921b8dd648Sblueswir1 unsigned int st_rdev; 1293992f48a0Sblueswir1 abi_long st_size; 1294992f48a0Sblueswir1 abi_long target_st_atime; 1295992f48a0Sblueswir1 abi_long target_st_mtime; 1296992f48a0Sblueswir1 abi_long target_st_ctime; 1297992f48a0Sblueswir1 abi_long st_blksize; 1298992f48a0Sblueswir1 abi_long st_blocks; 1299992f48a0Sblueswir1 abi_ulong __unused4[2]; 13001b8dd648Sblueswir1 }; 13011b8dd648Sblueswir1 130220d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 13031b8dd648Sblueswir1 struct target_stat64 { 13041b8dd648Sblueswir1 unsigned char __pad0[6]; 13051b8dd648Sblueswir1 unsigned short st_dev; 13061b8dd648Sblueswir1 13071b8dd648Sblueswir1 uint64_t st_ino; 13081b8dd648Sblueswir1 uint64_t st_nlink; 13091b8dd648Sblueswir1 13101b8dd648Sblueswir1 unsigned int st_mode; 13111b8dd648Sblueswir1 13121b8dd648Sblueswir1 unsigned int st_uid; 13131b8dd648Sblueswir1 unsigned int st_gid; 13141b8dd648Sblueswir1 13151b8dd648Sblueswir1 unsigned char __pad2[6]; 13161b8dd648Sblueswir1 unsigned short st_rdev; 13171b8dd648Sblueswir1 13181b8dd648Sblueswir1 int64_t st_size; 13191b8dd648Sblueswir1 int64_t st_blksize; 13201b8dd648Sblueswir1 13211b8dd648Sblueswir1 unsigned char __pad4[4]; 13221b8dd648Sblueswir1 unsigned int st_blocks; 13231b8dd648Sblueswir1 1324992f48a0Sblueswir1 abi_ulong target_st_atime; 13255f992db6SChen-Yu Tsai abi_ulong target_st_atime_nsec; 13261b8dd648Sblueswir1 1327992f48a0Sblueswir1 abi_ulong target_st_mtime; 13285f992db6SChen-Yu Tsai abi_ulong target_st_mtime_nsec; 13291b8dd648Sblueswir1 1330992f48a0Sblueswir1 abi_ulong target_st_ctime; 13315f992db6SChen-Yu Tsai abi_ulong target_st_ctime_nsec; 13321b8dd648Sblueswir1 1333992f48a0Sblueswir1 abi_ulong __unused4[3]; 13341b8dd648Sblueswir1 }; 13351b8dd648Sblueswir1 13363bfd9da1Sbellard #elif defined(TARGET_SPARC) 13373bfd9da1Sbellard 13385f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 13393bfd9da1Sbellard struct target_stat { 13403bfd9da1Sbellard unsigned short st_dev; 1341992f48a0Sblueswir1 abi_ulong st_ino; 13423bfd9da1Sbellard unsigned short st_mode; 13433bfd9da1Sbellard short st_nlink; 13443bfd9da1Sbellard unsigned short st_uid; 13453bfd9da1Sbellard unsigned short st_gid; 13463bfd9da1Sbellard unsigned short st_rdev; 1347992f48a0Sblueswir1 abi_long st_size; 1348992f48a0Sblueswir1 abi_long target_st_atime; 13495f992db6SChen-Yu Tsai abi_ulong target_st_atime_nsec; 1350992f48a0Sblueswir1 abi_long target_st_mtime; 13515f992db6SChen-Yu Tsai abi_ulong target_st_mtime_nsec; 1352992f48a0Sblueswir1 abi_long target_st_ctime; 13535f992db6SChen-Yu Tsai abi_ulong target_st_ctime_nsec; 1354992f48a0Sblueswir1 abi_long st_blksize; 1355992f48a0Sblueswir1 abi_long st_blocks; 13565f992db6SChen-Yu Tsai abi_ulong __unused1[2]; 13573bfd9da1Sbellard }; 13583bfd9da1Sbellard 135920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 13603bfd9da1Sbellard struct target_stat64 { 13613bfd9da1Sbellard unsigned char __pad0[6]; 13623bfd9da1Sbellard unsigned short st_dev; 13633bfd9da1Sbellard 13643bfd9da1Sbellard uint64_t st_ino; 13653bfd9da1Sbellard 13663bfd9da1Sbellard unsigned int st_mode; 13673bfd9da1Sbellard unsigned int st_nlink; 13683bfd9da1Sbellard 13693bfd9da1Sbellard unsigned int st_uid; 13703bfd9da1Sbellard unsigned int st_gid; 13713bfd9da1Sbellard 13723bfd9da1Sbellard unsigned char __pad2[6]; 13733bfd9da1Sbellard unsigned short st_rdev; 13743bfd9da1Sbellard 13753bfd9da1Sbellard unsigned char __pad3[8]; 13763bfd9da1Sbellard 13773bfd9da1Sbellard int64_t st_size; 13783bfd9da1Sbellard unsigned int st_blksize; 13793bfd9da1Sbellard 13803bfd9da1Sbellard unsigned char __pad4[8]; 13813bfd9da1Sbellard unsigned int st_blocks; 13823bfd9da1Sbellard 13833bfd9da1Sbellard unsigned int target_st_atime; 13845f992db6SChen-Yu Tsai unsigned int target_st_atime_nsec; 13853bfd9da1Sbellard 13863bfd9da1Sbellard unsigned int target_st_mtime; 13875f992db6SChen-Yu Tsai unsigned int target_st_mtime_nsec; 13883bfd9da1Sbellard 13893bfd9da1Sbellard unsigned int target_st_ctime; 13905f992db6SChen-Yu Tsai unsigned int target_st_ctime_nsec; 13913bfd9da1Sbellard 13925f992db6SChen-Yu Tsai unsigned int __unused1; 13935f992db6SChen-Yu Tsai unsigned int __unused2; 13943bfd9da1Sbellard }; 13953bfd9da1Sbellard 139667867308Sbellard #elif defined(TARGET_PPC) 139767867308Sbellard 13985f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 139967867308Sbellard struct target_stat { 1400e32448e0Sj_mayer abi_ulong st_dev; 1401992f48a0Sblueswir1 abi_ulong st_ino; 1402325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1403e32448e0Sj_mayer abi_ulong st_nlink; 1404325e651fSj_mayer unsigned int st_mode; 1405325e651fSj_mayer #else 140667867308Sbellard unsigned int st_mode; 140767867308Sbellard unsigned short st_nlink; 1408325e651fSj_mayer #endif 140967867308Sbellard unsigned int st_uid; 141067867308Sbellard unsigned int st_gid; 1411e32448e0Sj_mayer abi_ulong st_rdev; 1412992f48a0Sblueswir1 abi_ulong st_size; 1413992f48a0Sblueswir1 abi_ulong st_blksize; 1414992f48a0Sblueswir1 abi_ulong st_blocks; 1415992f48a0Sblueswir1 abi_ulong target_st_atime; 1416e32448e0Sj_mayer abi_ulong target_st_atime_nsec; 1417992f48a0Sblueswir1 abi_ulong target_st_mtime; 1418e32448e0Sj_mayer abi_ulong target_st_mtime_nsec; 1419992f48a0Sblueswir1 abi_ulong target_st_ctime; 1420e32448e0Sj_mayer abi_ulong target_st_ctime_nsec; 1421992f48a0Sblueswir1 abi_ulong __unused4; 1422992f48a0Sblueswir1 abi_ulong __unused5; 1423325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1424325e651fSj_mayer abi_ulong __unused6; 1425325e651fSj_mayer #endif 142667867308Sbellard }; 142767867308Sbellard 142820d155bcSStefan Weil #if !defined(TARGET_PPC64) || defined(TARGET_ABI32) 142920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1430541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 143167867308Sbellard unsigned long long st_dev; 143267867308Sbellard unsigned long long st_ino; 143367867308Sbellard unsigned int st_mode; 143467867308Sbellard unsigned int st_nlink; 143567867308Sbellard unsigned int st_uid; 143667867308Sbellard unsigned int st_gid; 143767867308Sbellard unsigned long long st_rdev; 1438e1ce5e40Saurel32 unsigned long long __pad0; 143967867308Sbellard long long st_size; 1440e32448e0Sj_mayer int st_blksize; 1441e1ce5e40Saurel32 unsigned int __pad1; 144261322e91SMax Filippov long long st_blocks; /* Number 512-byte blocks allocated. */ 1443e32448e0Sj_mayer int target_st_atime; 1444e32448e0Sj_mayer unsigned int target_st_atime_nsec; 1445e32448e0Sj_mayer int target_st_mtime; 1446e32448e0Sj_mayer unsigned int target_st_mtime_nsec; 1447e32448e0Sj_mayer int target_st_ctime; 1448e32448e0Sj_mayer unsigned int target_st_ctime_nsec; 1449e32448e0Sj_mayer unsigned int __unused4; 1450e32448e0Sj_mayer unsigned int __unused5; 145167867308Sbellard }; 145220d155bcSStefan Weil #endif 145367867308Sbellard 1454b779e29eSEdgar E. Iglesias #elif defined(TARGET_MICROBLAZE) 1455b779e29eSEdgar E. Iglesias 14565f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1457b779e29eSEdgar E. Iglesias struct target_stat { 1458b779e29eSEdgar E. Iglesias abi_ulong st_dev; 1459b779e29eSEdgar E. Iglesias abi_ulong st_ino; 1460b779e29eSEdgar E. Iglesias unsigned int st_mode; 1461b779e29eSEdgar E. Iglesias unsigned short st_nlink; 1462b779e29eSEdgar E. Iglesias unsigned int st_uid; 1463b779e29eSEdgar E. Iglesias unsigned int st_gid; 1464b779e29eSEdgar E. Iglesias abi_ulong st_rdev; 1465b779e29eSEdgar E. Iglesias abi_ulong st_size; 1466b779e29eSEdgar E. Iglesias abi_ulong st_blksize; 1467b779e29eSEdgar E. Iglesias abi_ulong st_blocks; 1468b779e29eSEdgar E. Iglesias abi_ulong target_st_atime; 1469b779e29eSEdgar E. Iglesias abi_ulong target_st_atime_nsec; 1470b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime; 1471b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime_nsec; 1472b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime; 1473b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime_nsec; 1474b779e29eSEdgar E. Iglesias abi_ulong __unused4; 1475b779e29eSEdgar E. Iglesias abi_ulong __unused5; 1476b779e29eSEdgar E. Iglesias }; 1477b779e29eSEdgar E. Iglesias 1478b779e29eSEdgar E. Iglesias /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ 147920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1480541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 1481b779e29eSEdgar E. Iglesias uint64_t st_dev; 1482a523eb06SEdgar E. Iglesias #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1483a523eb06SEdgar E. Iglesias uint32_t pad0; 1484a523eb06SEdgar E. Iglesias uint32_t __st_ino; 1485a523eb06SEdgar E. Iglesias 1486b779e29eSEdgar E. Iglesias uint32_t st_mode; 1487b779e29eSEdgar E. Iglesias uint32_t st_nlink; 1488b779e29eSEdgar E. Iglesias uint32_t st_uid; 1489b779e29eSEdgar E. Iglesias uint32_t st_gid; 1490b779e29eSEdgar E. Iglesias uint64_t st_rdev; 149121ebeb23SEdgar E. Iglesias uint64_t __pad1; 1492b779e29eSEdgar E. Iglesias 1493b779e29eSEdgar E. Iglesias int64_t st_size; 1494b779e29eSEdgar E. Iglesias int32_t st_blksize; 149521ebeb23SEdgar E. Iglesias uint32_t __pad2; 1496b779e29eSEdgar E. Iglesias int64_t st_blocks; /* Number 512-byte blocks allocated. */ 1497b779e29eSEdgar E. Iglesias 1498b779e29eSEdgar E. Iglesias int target_st_atime; 1499b779e29eSEdgar E. Iglesias unsigned int target_st_atime_nsec; 1500b779e29eSEdgar E. Iglesias int target_st_mtime; 1501b779e29eSEdgar E. Iglesias unsigned int target_st_mtime_nsec; 1502b779e29eSEdgar E. Iglesias int target_st_ctime; 1503b779e29eSEdgar E. Iglesias unsigned int target_st_ctime_nsec; 1504a523eb06SEdgar E. Iglesias uint64_t st_ino; 1505b779e29eSEdgar E. Iglesias }; 1506b779e29eSEdgar E. Iglesias 1507e6e5906bSpbrook #elif defined(TARGET_M68K) 1508e6e5906bSpbrook 1509e6e5906bSpbrook struct target_stat { 1510e6e5906bSpbrook unsigned short st_dev; 1511e6e5906bSpbrook unsigned short __pad1; 1512992f48a0Sblueswir1 abi_ulong st_ino; 1513e6e5906bSpbrook unsigned short st_mode; 1514e6e5906bSpbrook unsigned short st_nlink; 1515e6e5906bSpbrook unsigned short st_uid; 1516e6e5906bSpbrook unsigned short st_gid; 1517e6e5906bSpbrook unsigned short st_rdev; 1518e6e5906bSpbrook unsigned short __pad2; 1519992f48a0Sblueswir1 abi_ulong st_size; 1520992f48a0Sblueswir1 abi_ulong st_blksize; 1521992f48a0Sblueswir1 abi_ulong st_blocks; 1522992f48a0Sblueswir1 abi_ulong target_st_atime; 1523992f48a0Sblueswir1 abi_ulong __unused1; 1524992f48a0Sblueswir1 abi_ulong target_st_mtime; 1525992f48a0Sblueswir1 abi_ulong __unused2; 1526992f48a0Sblueswir1 abi_ulong target_st_ctime; 1527992f48a0Sblueswir1 abi_ulong __unused3; 1528992f48a0Sblueswir1 abi_ulong __unused4; 1529992f48a0Sblueswir1 abi_ulong __unused5; 1530e6e5906bSpbrook }; 1531e6e5906bSpbrook 1532e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely 1533e6e5906bSpbrook * insane amounts of padding around dev_t's. 1534e6e5906bSpbrook */ 153520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1536e6e5906bSpbrook struct target_stat64 { 1537e6e5906bSpbrook unsigned long long st_dev; 1538e6e5906bSpbrook unsigned char __pad1[2]; 1539e6e5906bSpbrook 1540e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1541992f48a0Sblueswir1 abi_ulong __st_ino; 1542e6e5906bSpbrook 1543e6e5906bSpbrook unsigned int st_mode; 1544e6e5906bSpbrook unsigned int st_nlink; 1545e6e5906bSpbrook 1546992f48a0Sblueswir1 abi_ulong st_uid; 1547992f48a0Sblueswir1 abi_ulong st_gid; 1548e6e5906bSpbrook 1549e6e5906bSpbrook unsigned long long st_rdev; 1550e6e5906bSpbrook unsigned char __pad3[2]; 1551e6e5906bSpbrook 1552e6e5906bSpbrook long long st_size; 1553992f48a0Sblueswir1 abi_ulong st_blksize; 1554e6e5906bSpbrook 1555992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 1556992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1557e6e5906bSpbrook 1558992f48a0Sblueswir1 abi_ulong target_st_atime; 1559992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1560e6e5906bSpbrook 1561992f48a0Sblueswir1 abi_ulong target_st_mtime; 1562992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1563e6e5906bSpbrook 1564992f48a0Sblueswir1 abi_ulong target_st_ctime; 1565992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1566e6e5906bSpbrook 1567e6e5906bSpbrook unsigned long long st_ino; 1568541dc0d4SStefan Weil } QEMU_PACKED; 1569e6e5906bSpbrook 1570d26bc211Sths #elif defined(TARGET_ABI_MIPSN64) 1571540635baSths 15725f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1573540635baSths /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ 1574540635baSths struct target_stat { 1575540635baSths unsigned int st_dev; 1576540635baSths unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ 1577540635baSths 1578992f48a0Sblueswir1 abi_ulong st_ino; 1579540635baSths 1580540635baSths unsigned int st_mode; 1581540635baSths unsigned int st_nlink; 1582540635baSths 1583540635baSths int st_uid; 1584540635baSths int st_gid; 1585540635baSths 1586540635baSths unsigned int st_rdev; 1587540635baSths unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ 1588540635baSths 1589992f48a0Sblueswir1 abi_ulong st_size; 1590540635baSths 1591540635baSths /* 1592540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1593540635baSths * but we don't have it under Linux. 1594540635baSths */ 1595540635baSths unsigned int target_st_atime; 1596540635baSths unsigned int target_st_atime_nsec; 1597540635baSths 1598540635baSths unsigned int target_st_mtime; 1599540635baSths unsigned int target_st_mtime_nsec; 1600540635baSths 1601540635baSths unsigned int target_st_ctime; 1602540635baSths unsigned int target_st_ctime_nsec; 1603540635baSths 1604540635baSths unsigned int st_blksize; 1605540635baSths unsigned int st_pad2; 1606540635baSths 1607992f48a0Sblueswir1 abi_ulong st_blocks; 1608540635baSths }; 1609540635baSths 1610d26bc211Sths #elif defined(TARGET_ABI_MIPSN32) 1611540635baSths 16125f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1613540635baSths struct target_stat { 16141ab2aea2SLeon Alrae abi_ulong st_dev; 16151ab2aea2SLeon Alrae abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 16161ab2aea2SLeon Alrae uint64_t st_ino; 1617540635baSths unsigned int st_mode; 1618540635baSths unsigned int st_nlink; 1619540635baSths int st_uid; 1620540635baSths int st_gid; 16211ab2aea2SLeon Alrae abi_ulong st_rdev; 16221ab2aea2SLeon Alrae abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 16231ab2aea2SLeon Alrae int64_t st_size; 16241ab2aea2SLeon Alrae abi_long target_st_atime; 16251ab2aea2SLeon Alrae abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 16261ab2aea2SLeon Alrae abi_long target_st_mtime; 16271ab2aea2SLeon Alrae abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 16281ab2aea2SLeon Alrae abi_long target_st_ctime; 16291ab2aea2SLeon Alrae abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 16301ab2aea2SLeon Alrae abi_ulong st_blksize; 16311ab2aea2SLeon Alrae abi_ulong st_pad2; 16321ab2aea2SLeon Alrae int64_t st_blocks; 1633540635baSths }; 1634540635baSths 1635d26bc211Sths #elif defined(TARGET_ABI_MIPSO32) 1636048f6b4dSbellard 16375f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1638048f6b4dSbellard struct target_stat { 1639048f6b4dSbellard unsigned st_dev; 1640992f48a0Sblueswir1 abi_long st_pad1[3]; /* Reserved for network id */ 1641992f48a0Sblueswir1 abi_ulong st_ino; 1642048f6b4dSbellard unsigned int st_mode; 1643048f6b4dSbellard unsigned int st_nlink; 1644048f6b4dSbellard int st_uid; 1645048f6b4dSbellard int st_gid; 1646048f6b4dSbellard unsigned st_rdev; 1647992f48a0Sblueswir1 abi_long st_pad2[2]; 1648992f48a0Sblueswir1 abi_long st_size; 1649992f48a0Sblueswir1 abi_long st_pad3; 1650048f6b4dSbellard /* 1651048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1652048f6b4dSbellard * but we don't have it under Linux. 1653048f6b4dSbellard */ 1654992f48a0Sblueswir1 abi_long target_st_atime; 1655992f48a0Sblueswir1 abi_long target_st_atime_nsec; 1656992f48a0Sblueswir1 abi_long target_st_mtime; 1657992f48a0Sblueswir1 abi_long target_st_mtime_nsec; 1658992f48a0Sblueswir1 abi_long target_st_ctime; 1659992f48a0Sblueswir1 abi_long target_st_ctime_nsec; 1660992f48a0Sblueswir1 abi_long st_blksize; 1661992f48a0Sblueswir1 abi_long st_blocks; 1662992f48a0Sblueswir1 abi_long st_pad4[14]; 1663048f6b4dSbellard }; 1664048f6b4dSbellard 1665048f6b4dSbellard /* 1666048f6b4dSbellard * This matches struct stat64 in glibc2.1, hence the absolutely insane 1667048f6b4dSbellard * amounts of padding around dev_t's. The memory layout is the same as of 1668048f6b4dSbellard * struct stat of the 64-bit kernel. 1669048f6b4dSbellard */ 1670048f6b4dSbellard 167120d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1672048f6b4dSbellard struct target_stat64 { 1673992f48a0Sblueswir1 abi_ulong st_dev; 1674992f48a0Sblueswir1 abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 1675048f6b4dSbellard 1676048f6b4dSbellard uint64_t st_ino; 1677048f6b4dSbellard 1678048f6b4dSbellard unsigned int st_mode; 1679048f6b4dSbellard unsigned int st_nlink; 1680048f6b4dSbellard 1681048f6b4dSbellard int st_uid; 1682048f6b4dSbellard int st_gid; 1683048f6b4dSbellard 1684992f48a0Sblueswir1 abi_ulong st_rdev; 1685992f48a0Sblueswir1 abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 1686048f6b4dSbellard 1687048f6b4dSbellard int64_t st_size; 1688048f6b4dSbellard 1689048f6b4dSbellard /* 1690048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1691048f6b4dSbellard * but we don't have it under Linux. 1692048f6b4dSbellard */ 1693992f48a0Sblueswir1 abi_long target_st_atime; 1694992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 1695048f6b4dSbellard 1696992f48a0Sblueswir1 abi_long target_st_mtime; 1697992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 1698048f6b4dSbellard 1699992f48a0Sblueswir1 abi_long target_st_ctime; 1700992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 1701048f6b4dSbellard 1702992f48a0Sblueswir1 abi_ulong st_blksize; 1703992f48a0Sblueswir1 abi_ulong st_pad2; 1704048f6b4dSbellard 1705048f6b4dSbellard int64_t st_blocks; 1706048f6b4dSbellard }; 17077a3148a9Sj_mayer 17087a3148a9Sj_mayer #elif defined(TARGET_ALPHA) 17097a3148a9Sj_mayer 17107a3148a9Sj_mayer struct target_stat { 17117a3148a9Sj_mayer unsigned int st_dev; 17127a3148a9Sj_mayer unsigned int st_ino; 17137a3148a9Sj_mayer unsigned int st_mode; 17147a3148a9Sj_mayer unsigned int st_nlink; 17157a3148a9Sj_mayer unsigned int st_uid; 17167a3148a9Sj_mayer unsigned int st_gid; 17177a3148a9Sj_mayer unsigned int st_rdev; 1718992f48a0Sblueswir1 abi_long st_size; 1719992f48a0Sblueswir1 abi_ulong target_st_atime; 1720992f48a0Sblueswir1 abi_ulong target_st_mtime; 1721992f48a0Sblueswir1 abi_ulong target_st_ctime; 17227a3148a9Sj_mayer unsigned int st_blksize; 17237a3148a9Sj_mayer unsigned int st_blocks; 17247a3148a9Sj_mayer unsigned int st_flags; 17257a3148a9Sj_mayer unsigned int st_gen; 17267a3148a9Sj_mayer }; 17277a3148a9Sj_mayer 172820d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 17297a3148a9Sj_mayer struct target_stat64 { 1730992f48a0Sblueswir1 abi_ulong st_dev; 1731992f48a0Sblueswir1 abi_ulong st_ino; 1732992f48a0Sblueswir1 abi_ulong st_rdev; 1733992f48a0Sblueswir1 abi_long st_size; 1734992f48a0Sblueswir1 abi_ulong st_blocks; 17357a3148a9Sj_mayer 17367a3148a9Sj_mayer unsigned int st_mode; 17377a3148a9Sj_mayer unsigned int st_uid; 17387a3148a9Sj_mayer unsigned int st_gid; 17397a3148a9Sj_mayer unsigned int st_blksize; 17407a3148a9Sj_mayer unsigned int st_nlink; 17417a3148a9Sj_mayer unsigned int __pad0; 17427a3148a9Sj_mayer 1743992f48a0Sblueswir1 abi_ulong target_st_atime; 1744992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1745992f48a0Sblueswir1 abi_ulong target_st_mtime; 1746992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1747992f48a0Sblueswir1 abi_ulong target_st_ctime; 1748992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1749992f48a0Sblueswir1 abi_long __unused[3]; 17507a3148a9Sj_mayer }; 17517a3148a9Sj_mayer 17526db45e65Sths #elif defined(TARGET_SH4) 17536db45e65Sths 17545f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 17556db45e65Sths struct target_stat { 1756992f48a0Sblueswir1 abi_ulong st_dev; 1757992f48a0Sblueswir1 abi_ulong st_ino; 17586db45e65Sths unsigned short st_mode; 17596db45e65Sths unsigned short st_nlink; 17606db45e65Sths unsigned short st_uid; 17616db45e65Sths unsigned short st_gid; 1762992f48a0Sblueswir1 abi_ulong st_rdev; 1763992f48a0Sblueswir1 abi_ulong st_size; 1764992f48a0Sblueswir1 abi_ulong st_blksize; 1765992f48a0Sblueswir1 abi_ulong st_blocks; 1766992f48a0Sblueswir1 abi_ulong target_st_atime; 1767992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1768992f48a0Sblueswir1 abi_ulong target_st_mtime; 1769992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1770992f48a0Sblueswir1 abi_ulong target_st_ctime; 1771992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1772992f48a0Sblueswir1 abi_ulong __unused4; 1773992f48a0Sblueswir1 abi_ulong __unused5; 17746db45e65Sths }; 17756db45e65Sths 17766db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely 17776db45e65Sths * insane amounts of padding around dev_t's. 17786db45e65Sths */ 177920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1780541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 17816db45e65Sths unsigned long long st_dev; 17826db45e65Sths unsigned char __pad0[4]; 17836db45e65Sths 17846db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1785992f48a0Sblueswir1 abi_ulong __st_ino; 17866db45e65Sths 17876db45e65Sths unsigned int st_mode; 17886db45e65Sths unsigned int st_nlink; 17896db45e65Sths 1790992f48a0Sblueswir1 abi_ulong st_uid; 1791992f48a0Sblueswir1 abi_ulong st_gid; 17926db45e65Sths 17936db45e65Sths unsigned long long st_rdev; 17946db45e65Sths unsigned char __pad3[4]; 17956db45e65Sths 17966db45e65Sths long long st_size; 1797992f48a0Sblueswir1 abi_ulong st_blksize; 17986db45e65Sths 17996db45e65Sths unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ 18006db45e65Sths 1801992f48a0Sblueswir1 abi_ulong target_st_atime; 1802992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 18036db45e65Sths 1804992f48a0Sblueswir1 abi_ulong target_st_mtime; 1805992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 18066db45e65Sths 1807992f48a0Sblueswir1 abi_ulong target_st_ctime; 1808992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 18096db45e65Sths 18106db45e65Sths unsigned long long st_ino; 18116db45e65Sths }; 18126db45e65Sths 1813d2fd1af7Sbellard #elif defined(TARGET_I386) && !defined(TARGET_ABI32) 18145f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1815d2fd1af7Sbellard struct target_stat { 1816d2fd1af7Sbellard abi_ulong st_dev; 1817d2fd1af7Sbellard abi_ulong st_ino; 1818d2fd1af7Sbellard abi_ulong st_nlink; 1819d2fd1af7Sbellard 1820d2fd1af7Sbellard unsigned int st_mode; 1821d2fd1af7Sbellard unsigned int st_uid; 1822d2fd1af7Sbellard unsigned int st_gid; 1823d2fd1af7Sbellard unsigned int __pad0; 1824d2fd1af7Sbellard abi_ulong st_rdev; 1825d2fd1af7Sbellard abi_long st_size; 1826d2fd1af7Sbellard abi_long st_blksize; 1827d2fd1af7Sbellard abi_long st_blocks; /* Number 512-byte blocks allocated. */ 1828d2fd1af7Sbellard 1829d2fd1af7Sbellard abi_ulong target_st_atime; 1830d2fd1af7Sbellard abi_ulong target_st_atime_nsec; 1831d2fd1af7Sbellard abi_ulong target_st_mtime; 1832d2fd1af7Sbellard abi_ulong target_st_mtime_nsec; 1833d2fd1af7Sbellard abi_ulong target_st_ctime; 1834d2fd1af7Sbellard abi_ulong target_st_ctime_nsec; 1835d2fd1af7Sbellard 1836d2fd1af7Sbellard abi_long __unused[3]; 1837d2fd1af7Sbellard }; 1838a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 1839a4c075f1SUlrich Hecht struct target_stat { 1840a4c075f1SUlrich Hecht abi_ulong st_dev; 1841a4c075f1SUlrich Hecht abi_ulong st_ino; 1842a4c075f1SUlrich Hecht abi_ulong st_nlink; 1843a4c075f1SUlrich Hecht unsigned int st_mode; 1844a4c075f1SUlrich Hecht unsigned int st_uid; 1845a4c075f1SUlrich Hecht unsigned int st_gid; 1846a4c075f1SUlrich Hecht unsigned int __pad1; 1847a4c075f1SUlrich Hecht abi_ulong st_rdev; 1848a4c075f1SUlrich Hecht abi_ulong st_size; 1849a4c075f1SUlrich Hecht abi_ulong target_st_atime; 1850a4c075f1SUlrich Hecht abi_ulong target_st_atime_nsec; 1851a4c075f1SUlrich Hecht abi_ulong target_st_mtime; 1852a4c075f1SUlrich Hecht abi_ulong target_st_mtime_nsec; 1853a4c075f1SUlrich Hecht abi_ulong target_st_ctime; 1854a4c075f1SUlrich Hecht abi_ulong target_st_ctime_nsec; 1855a4c075f1SUlrich Hecht abi_ulong st_blksize; 1856a4c075f1SUlrich Hecht abi_long st_blocks; 1857a4c075f1SUlrich Hecht abi_ulong __unused[3]; 1858a4c075f1SUlrich Hecht }; 185909701199SAlexander Graf #elif defined(TARGET_AARCH64) 18605f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 186109701199SAlexander Graf struct target_stat { 186209701199SAlexander Graf abi_ulong st_dev; 186309701199SAlexander Graf abi_ulong st_ino; 186409701199SAlexander Graf unsigned int st_mode; 186509701199SAlexander Graf unsigned int st_nlink; 186609701199SAlexander Graf unsigned int st_uid; 186709701199SAlexander Graf unsigned int st_gid; 186809701199SAlexander Graf abi_ulong st_rdev; 186909701199SAlexander Graf abi_ulong _pad1; 187009701199SAlexander Graf abi_long st_size; 187109701199SAlexander Graf int st_blksize; 187209701199SAlexander Graf int __pad2; 187309701199SAlexander Graf abi_long st_blocks; 187409701199SAlexander Graf abi_long target_st_atime; 187509701199SAlexander Graf abi_ulong target_st_atime_nsec; 187609701199SAlexander Graf abi_long target_st_mtime; 187709701199SAlexander Graf abi_ulong target_st_mtime_nsec; 187809701199SAlexander Graf abi_long target_st_ctime; 187909701199SAlexander Graf abi_ulong target_st_ctime_nsec; 188009701199SAlexander Graf unsigned int __unused[2]; 188109701199SAlexander Graf }; 1882ba7651fbSMax Filippov #elif defined(TARGET_XTENSA) 18835f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1884ba7651fbSMax Filippov struct target_stat { 1885ba7651fbSMax Filippov abi_ulong st_dev; 1886ba7651fbSMax Filippov abi_ulong st_ino; 1887ba7651fbSMax Filippov unsigned int st_mode; 1888ba7651fbSMax Filippov unsigned int st_nlink; 1889ba7651fbSMax Filippov unsigned int st_uid; 1890ba7651fbSMax Filippov unsigned int st_gid; 1891ba7651fbSMax Filippov abi_ulong st_rdev; 1892ba7651fbSMax Filippov abi_long st_size; 1893ba7651fbSMax Filippov abi_ulong st_blksize; 1894ba7651fbSMax Filippov abi_ulong st_blocks; 1895ba7651fbSMax Filippov abi_ulong target_st_atime; 1896ba7651fbSMax Filippov abi_ulong target_st_atime_nsec; 1897ba7651fbSMax Filippov abi_ulong target_st_mtime; 1898ba7651fbSMax Filippov abi_ulong target_st_mtime_nsec; 1899ba7651fbSMax Filippov abi_ulong target_st_ctime; 1900ba7651fbSMax Filippov abi_ulong target_st_ctime_nsec; 1901ba7651fbSMax Filippov abi_ulong __unused4; 1902ba7651fbSMax Filippov abi_ulong __unused5; 1903ba7651fbSMax Filippov }; 1904ba7651fbSMax Filippov 1905ba7651fbSMax Filippov #define TARGET_HAS_STRUCT_STAT64 1906ba7651fbSMax Filippov struct target_stat64 { 1907ba7651fbSMax Filippov uint64_t st_dev; /* Device */ 1908ba7651fbSMax Filippov uint64_t st_ino; /* File serial number */ 1909ba7651fbSMax Filippov unsigned int st_mode; /* File mode. */ 1910ba7651fbSMax Filippov unsigned int st_nlink; /* Link count. */ 1911ba7651fbSMax Filippov unsigned int st_uid; /* User ID of the file's owner. */ 1912ba7651fbSMax Filippov unsigned int st_gid; /* Group ID of the file's group. */ 1913ba7651fbSMax Filippov uint64_t st_rdev; /* Device number, if device. */ 1914ba7651fbSMax Filippov int64_t st_size; /* Size of file, in bytes. */ 1915ba7651fbSMax Filippov abi_ulong st_blksize; /* Optimal block size for I/O. */ 1916ba7651fbSMax Filippov abi_ulong __unused2; 1917ba7651fbSMax Filippov uint64_t st_blocks; /* Number 512-byte blocks allocated. */ 1918ba7651fbSMax Filippov abi_ulong target_st_atime; /* Time of last access. */ 1919ba7651fbSMax Filippov abi_ulong target_st_atime_nsec; 1920ba7651fbSMax Filippov abi_ulong target_st_mtime; /* Time of last modification. */ 1921ba7651fbSMax Filippov abi_ulong target_st_mtime_nsec; 1922ba7651fbSMax Filippov abi_ulong target_st_ctime; /* Time of last status change. */ 1923ba7651fbSMax Filippov abi_ulong target_st_ctime_nsec; 1924ba7651fbSMax Filippov abi_ulong __unused4; 1925ba7651fbSMax Filippov abi_ulong __unused5; 1926ba7651fbSMax Filippov }; 1927ba7651fbSMax Filippov 1928a0a839b6SMarek Vasut #elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) || \ 192947ae93cdSMichael Clark defined(TARGET_NIOS2) || defined(TARGET_RISCV) 1930c7819dfbSPeter Maydell 1931c7819dfbSPeter Maydell /* These are the asm-generic versions of the stat and stat64 structures */ 1932c7819dfbSPeter Maydell 19335f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1934d962783eSJia Liu struct target_stat { 1935d962783eSJia Liu abi_ulong st_dev; 1936d962783eSJia Liu abi_ulong st_ino; 1937d962783eSJia Liu unsigned int st_mode; 1938c7819dfbSPeter Maydell unsigned int st_nlink; 1939d962783eSJia Liu unsigned int st_uid; 1940d962783eSJia Liu unsigned int st_gid; 1941d962783eSJia Liu abi_ulong st_rdev; 1942c7819dfbSPeter Maydell abi_ulong __pad1; 1943d962783eSJia Liu abi_long st_size; 1944c7819dfbSPeter Maydell int st_blksize; 1945c7819dfbSPeter Maydell int __pad2; 1946c7819dfbSPeter Maydell abi_long st_blocks; 1947c7819dfbSPeter Maydell abi_long target_st_atime; 1948d962783eSJia Liu abi_ulong target_st_atime_nsec; 1949c7819dfbSPeter Maydell abi_long target_st_mtime; 1950d962783eSJia Liu abi_ulong target_st_mtime_nsec; 1951c7819dfbSPeter Maydell abi_long target_st_ctime; 1952d962783eSJia Liu abi_ulong target_st_ctime_nsec; 1953c7819dfbSPeter Maydell unsigned int __unused4; 1954c7819dfbSPeter Maydell unsigned int __unused5; 1955d962783eSJia Liu }; 1956c7819dfbSPeter Maydell 195747ae93cdSMichael Clark #if !defined(TARGET_RISCV64) 195820d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1959c7819dfbSPeter Maydell struct target_stat64 { 1960c7819dfbSPeter Maydell uint64_t st_dev; 1961c7819dfbSPeter Maydell uint64_t st_ino; 1962c7819dfbSPeter Maydell unsigned int st_mode; 1963c7819dfbSPeter Maydell unsigned int st_nlink; 1964c7819dfbSPeter Maydell unsigned int st_uid; 1965c7819dfbSPeter Maydell unsigned int st_gid; 1966c7819dfbSPeter Maydell uint64_t st_rdev; 1967c7819dfbSPeter Maydell uint64_t __pad1; 1968c7819dfbSPeter Maydell int64_t st_size; 1969c7819dfbSPeter Maydell int st_blksize; 1970c7819dfbSPeter Maydell int __pad2; 1971c7819dfbSPeter Maydell int64_t st_blocks; 1972c7819dfbSPeter Maydell int target_st_atime; 1973c7819dfbSPeter Maydell unsigned int target_st_atime_nsec; 1974c7819dfbSPeter Maydell int target_st_mtime; 1975c7819dfbSPeter Maydell unsigned int target_st_mtime_nsec; 1976c7819dfbSPeter Maydell int target_st_ctime; 1977c7819dfbSPeter Maydell unsigned int target_st_ctime_nsec; 1978c7819dfbSPeter Maydell unsigned int __unused4; 1979c7819dfbSPeter Maydell unsigned int __unused5; 1980c7819dfbSPeter Maydell }; 198147ae93cdSMichael Clark #endif 1982c7819dfbSPeter Maydell 1983a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 1984a10d1e50SRichard Henderson 19855f992db6SChen-Yu Tsai #define TARGET_STAT_HAVE_NSEC 1986a10d1e50SRichard Henderson struct target_stat { 1987a10d1e50SRichard Henderson abi_uint st_dev; 1988a10d1e50SRichard Henderson abi_uint st_ino; 1989a10d1e50SRichard Henderson abi_ushort st_mode; 1990a10d1e50SRichard Henderson abi_ushort st_nlink; 1991a10d1e50SRichard Henderson abi_ushort _res1; 1992a10d1e50SRichard Henderson abi_ushort _res2; 1993a10d1e50SRichard Henderson abi_uint st_rdev; 1994a10d1e50SRichard Henderson abi_int st_size; 1995a10d1e50SRichard Henderson abi_int target_st_atime; 1996a10d1e50SRichard Henderson abi_uint target_st_atime_nsec; 1997a10d1e50SRichard Henderson abi_int target_st_mtime; 1998a10d1e50SRichard Henderson abi_uint target_st_mtime_nsec; 1999a10d1e50SRichard Henderson abi_int target_st_ctime; 2000a10d1e50SRichard Henderson abi_uint target_st_ctime_nsec; 2001a10d1e50SRichard Henderson abi_int st_blksize; 2002a10d1e50SRichard Henderson abi_int st_blocks; 2003a10d1e50SRichard Henderson abi_uint _unused1; 2004a10d1e50SRichard Henderson abi_uint _unused2; 2005a10d1e50SRichard Henderson abi_uint _unused3; 2006a10d1e50SRichard Henderson abi_uint _unused4; 2007a10d1e50SRichard Henderson abi_ushort _unused5; 2008a10d1e50SRichard Henderson abi_short st_fstype; 2009a10d1e50SRichard Henderson abi_uint st_realdev; 2010a10d1e50SRichard Henderson abi_ushort st_basemode; 2011a10d1e50SRichard Henderson abi_ushort _unused6; 2012a10d1e50SRichard Henderson abi_uint st_uid; 2013a10d1e50SRichard Henderson abi_uint st_gid; 2014a10d1e50SRichard Henderson abi_uint _unused7[3]; 2015a10d1e50SRichard Henderson }; 2016a10d1e50SRichard Henderson 2017a10d1e50SRichard Henderson #define TARGET_HAS_STRUCT_STAT64 2018a10d1e50SRichard Henderson struct target_stat64 { 2019a10d1e50SRichard Henderson uint64_t st_dev; 2020a10d1e50SRichard Henderson abi_uint _pad1; 2021a10d1e50SRichard Henderson abi_uint _res1; 2022a10d1e50SRichard Henderson abi_uint st_mode; 2023a10d1e50SRichard Henderson abi_uint st_nlink; 2024a10d1e50SRichard Henderson abi_uint st_uid; 2025a10d1e50SRichard Henderson abi_uint st_gid; 2026a10d1e50SRichard Henderson uint64_t st_rdev; 2027a10d1e50SRichard Henderson abi_uint _pad2; 2028a10d1e50SRichard Henderson int64_t st_size; 2029a10d1e50SRichard Henderson abi_int st_blksize; 2030a10d1e50SRichard Henderson int64_t st_blocks; 2031a10d1e50SRichard Henderson abi_int target_st_atime; 2032a10d1e50SRichard Henderson abi_uint target_st_atime_nsec; 2033a10d1e50SRichard Henderson abi_int target_st_mtime; 2034a10d1e50SRichard Henderson abi_uint target_st_mtime_nsec; 2035a10d1e50SRichard Henderson abi_int target_st_ctime; 2036a10d1e50SRichard Henderson abi_uint target_st_ctime_nsec; 2037a10d1e50SRichard Henderson uint64_t st_ino; 2038a10d1e50SRichard Henderson }; 2039a10d1e50SRichard Henderson 2040048f6b4dSbellard #else 2041048f6b4dSbellard #error unsupported CPU 2042048f6b4dSbellard #endif 20432521d698Sbellard 20444ce6f8deSths typedef struct { 20454ce6f8deSths int val[2]; 2046c227f099SAnthony Liguori } target_fsid_t; 20474ce6f8deSths 204856c8f68fSbellard #ifdef TARGET_MIPS 2049d26bc211Sths #ifdef TARGET_ABI_MIPSN32 2050540635baSths struct target_statfs { 2051540635baSths int32_t f_type; 2052540635baSths int32_t f_bsize; 2053540635baSths int32_t f_frsize; /* Fragment size - unsupported */ 2054540635baSths int32_t f_blocks; 2055540635baSths int32_t f_bfree; 2056540635baSths int32_t f_files; 2057540635baSths int32_t f_ffree; 2058540635baSths int32_t f_bavail; 2059540635baSths 2060540635baSths /* Linux specials */ 2061c227f099SAnthony Liguori target_fsid_t f_fsid; 2062540635baSths int32_t f_namelen; 2063d4247ec2SShea Levy int32_t f_flags; 2064d4247ec2SShea Levy int32_t f_spare[5]; 2065540635baSths }; 2066540635baSths #else 206756c8f68fSbellard struct target_statfs { 2068992f48a0Sblueswir1 abi_long f_type; 2069992f48a0Sblueswir1 abi_long f_bsize; 2070992f48a0Sblueswir1 abi_long f_frsize; /* Fragment size - unsupported */ 2071992f48a0Sblueswir1 abi_long f_blocks; 2072992f48a0Sblueswir1 abi_long f_bfree; 2073992f48a0Sblueswir1 abi_long f_files; 2074992f48a0Sblueswir1 abi_long f_ffree; 2075992f48a0Sblueswir1 abi_long f_bavail; 207656c8f68fSbellard 207756c8f68fSbellard /* Linux specials */ 2078c227f099SAnthony Liguori target_fsid_t f_fsid; 2079992f48a0Sblueswir1 abi_long f_namelen; 2080d4247ec2SShea Levy abi_long f_flags; 2081d4247ec2SShea Levy abi_long f_spare[5]; 208256c8f68fSbellard }; 2083540635baSths #endif 208456c8f68fSbellard 208556c8f68fSbellard struct target_statfs64 { 208656c8f68fSbellard uint32_t f_type; 208756c8f68fSbellard uint32_t f_bsize; 208856c8f68fSbellard uint32_t f_frsize; /* Fragment size - unsupported */ 208956c8f68fSbellard uint32_t __pad; 209056c8f68fSbellard uint64_t f_blocks; 209156c8f68fSbellard uint64_t f_bfree; 209256c8f68fSbellard uint64_t f_files; 209356c8f68fSbellard uint64_t f_ffree; 209456c8f68fSbellard uint64_t f_bavail; 2095c227f099SAnthony Liguori target_fsid_t f_fsid; 209656c8f68fSbellard uint32_t f_namelen; 2097d4247ec2SShea Levy uint32_t f_flags; 2098d4247ec2SShea Levy uint32_t f_spare[5]; 209956c8f68fSbellard }; 2100c4d10628Sbalrog #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ 210147ae93cdSMichael Clark defined(TARGET_SPARC64) || defined(TARGET_AARCH64) || \ 210247ae93cdSMichael Clark defined(TARGET_RISCV)) && !defined(TARGET_ABI32) 2103325e651fSj_mayer struct target_statfs { 2104325e651fSj_mayer abi_long f_type; 2105325e651fSj_mayer abi_long f_bsize; 2106325e651fSj_mayer abi_long f_blocks; 2107325e651fSj_mayer abi_long f_bfree; 2108325e651fSj_mayer abi_long f_bavail; 2109325e651fSj_mayer abi_long f_files; 2110325e651fSj_mayer abi_long f_ffree; 2111c227f099SAnthony Liguori target_fsid_t f_fsid; 2112325e651fSj_mayer abi_long f_namelen; 2113325e651fSj_mayer abi_long f_frsize; 2114d4247ec2SShea Levy abi_long f_flags; 2115d4247ec2SShea Levy abi_long f_spare[4]; 2116325e651fSj_mayer }; 2117325e651fSj_mayer 2118325e651fSj_mayer struct target_statfs64 { 2119325e651fSj_mayer abi_long f_type; 2120325e651fSj_mayer abi_long f_bsize; 2121325e651fSj_mayer abi_long f_blocks; 2122325e651fSj_mayer abi_long f_bfree; 2123325e651fSj_mayer abi_long f_bavail; 2124325e651fSj_mayer abi_long f_files; 2125325e651fSj_mayer abi_long f_ffree; 2126c227f099SAnthony Liguori target_fsid_t f_fsid; 2127325e651fSj_mayer abi_long f_namelen; 2128325e651fSj_mayer abi_long f_frsize; 2129d4247ec2SShea Levy abi_long f_flags; 2130d4247ec2SShea Levy abi_long f_spare[4]; 2131325e651fSj_mayer }; 2132a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 2133a4c075f1SUlrich Hecht struct target_statfs { 2134a4c075f1SUlrich Hecht int32_t f_type; 2135a4c075f1SUlrich Hecht int32_t f_bsize; 2136a4c075f1SUlrich Hecht abi_long f_blocks; 2137a4c075f1SUlrich Hecht abi_long f_bfree; 2138a4c075f1SUlrich Hecht abi_long f_bavail; 2139a4c075f1SUlrich Hecht abi_long f_files; 2140a4c075f1SUlrich Hecht abi_long f_ffree; 2141a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2142a4c075f1SUlrich Hecht int32_t f_namelen; 2143a4c075f1SUlrich Hecht int32_t f_frsize; 2144d4247ec2SShea Levy int32_t f_flags; 2145d4247ec2SShea Levy int32_t f_spare[4]; 2146d4247ec2SShea Levy 2147a4c075f1SUlrich Hecht }; 2148a4c075f1SUlrich Hecht 2149a4c075f1SUlrich Hecht struct target_statfs64 { 2150a4c075f1SUlrich Hecht int32_t f_type; 2151a4c075f1SUlrich Hecht int32_t f_bsize; 2152a4c075f1SUlrich Hecht abi_long f_blocks; 2153a4c075f1SUlrich Hecht abi_long f_bfree; 2154a4c075f1SUlrich Hecht abi_long f_bavail; 2155a4c075f1SUlrich Hecht abi_long f_files; 2156a4c075f1SUlrich Hecht abi_long f_ffree; 2157a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2158a4c075f1SUlrich Hecht int32_t f_namelen; 2159a4c075f1SUlrich Hecht int32_t f_frsize; 2160d4247ec2SShea Levy int32_t f_flags; 2161d4247ec2SShea Levy int32_t f_spare[4]; 2162a4c075f1SUlrich Hecht }; 216356c8f68fSbellard #else 216456c8f68fSbellard struct target_statfs { 216556c8f68fSbellard uint32_t f_type; 216656c8f68fSbellard uint32_t f_bsize; 216756c8f68fSbellard uint32_t f_blocks; 216856c8f68fSbellard uint32_t f_bfree; 216956c8f68fSbellard uint32_t f_bavail; 217056c8f68fSbellard uint32_t f_files; 217156c8f68fSbellard uint32_t f_ffree; 2172c227f099SAnthony Liguori target_fsid_t f_fsid; 217356c8f68fSbellard uint32_t f_namelen; 217456c8f68fSbellard uint32_t f_frsize; 2175d4247ec2SShea Levy uint32_t f_flags; 2176d4247ec2SShea Levy uint32_t f_spare[4]; 217756c8f68fSbellard }; 217856c8f68fSbellard 217956c8f68fSbellard struct target_statfs64 { 218056c8f68fSbellard uint32_t f_type; 218156c8f68fSbellard uint32_t f_bsize; 218256c8f68fSbellard uint64_t f_blocks; 218356c8f68fSbellard uint64_t f_bfree; 218456c8f68fSbellard uint64_t f_bavail; 218556c8f68fSbellard uint64_t f_files; 218656c8f68fSbellard uint64_t f_ffree; 2187c227f099SAnthony Liguori target_fsid_t f_fsid; 218856c8f68fSbellard uint32_t f_namelen; 218956c8f68fSbellard uint32_t f_frsize; 2190d4247ec2SShea Levy uint32_t f_flags; 2191d4247ec2SShea Levy uint32_t f_spare[4]; 219256c8f68fSbellard }; 219356c8f68fSbellard #endif 219456c8f68fSbellard 21957e22e546SUlrich Hecht #define TARGET_F_LINUX_SPECIFIC_BASE 1024 21967e22e546SUlrich Hecht #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0) 21977e22e546SUlrich Hecht #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1) 21987e22e546SUlrich Hecht #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) 21997e3b92ecSPeter Maydell #define TARGET_F_SETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 7) 22007e3b92ecSPeter Maydell #define TARGET_F_GETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 8) 22017e22e546SUlrich Hecht #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2) 22027e22e546SUlrich Hecht 22035de7706eSLaurent Vivier #include "target_fcntl.h" 22048d5d3004SAndreas Schwab 22052521d698Sbellard /* soundcard defines */ 220667cc32ebSVeres Lajos /* XXX: convert them all to arch independent entries */ 22072521d698Sbellard #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); 22082521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 22092521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 22102521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 22112521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA 0xc0144302 22122521d698Sbellard #define TARGET_SNDCTL_COPR_RESET 0x00004300 22132521d698Sbellard #define TARGET_SNDCTL_COPR_RUN 0xc0144306 22142521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 22152521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE 0x40144305 22162521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA 0x40144304 22172521d698Sbellard #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) 22182521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) 22192521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) 22202521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) 22212521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) 22222521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) 22232521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) 22242521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) 22252521d698Sbellard #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) 22262521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) 22272521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) 22282521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) 22292521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) 22302521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) 22312521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) 22322521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) 22332521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) 22342521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) 22355f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19) 22365f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20) 22372521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e 22382521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 22392521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 22402521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 22412521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 22422521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f 22432521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 22442521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO 0xc074510c 22452521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 22462521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 22472521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 22482521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 22492521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 22502521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 22512521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 22522521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 22532521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b 22542521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a 22552521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 22562521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC 0x00005111 22572521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 22582521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET 0x00005100 22592521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 22602521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC 0x00005101 22612521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 22622521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d 22632521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d 22642521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 22652521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e 22662521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 22672521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME 0x40045407 22682521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT 0x40045408 22692521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 22702521d698Sbellard #define TARGET_SNDCTL_TMR_START 0x00005402 22712521d698Sbellard #define TARGET_SNDCTL_TMR_STOP 0x00005403 22722521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 22732521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 22742521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE 0x80045002 22752521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 22762521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS 0x80045005 22772521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 22782521d698Sbellard #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) 22792521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 22802521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) 22812521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) 22822521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) 22832521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) 22842521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) 22852521d698Sbellard 22862521d698Sbellard #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) 22872521d698Sbellard 22882521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) 22892521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) 22902521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) 22912521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) 22922521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) 22932521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) 22942521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) 22952521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) 22962521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) 22972521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) 22982521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) 22992521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) 23002521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) 23012521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) 23022521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) 23032521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) 23042521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) 23052521d698Sbellard 23062521d698Sbellard /* Obsolete macros */ 23072521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) 23082521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) 23092521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) 23102521d698Sbellard 23112521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) 23122521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) 23132521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) 23142521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) 23152521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) 23162521d698Sbellard 23172521d698Sbellard #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) 23182521d698Sbellard 23192521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) 23202521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) 23212521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) 23222521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) 23232521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) 23242521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) 23252521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) 23262521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) 23272521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) 23282521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) 23292521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) 23302521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) 23312521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) 23322521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) 23332521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) 23342521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) 23352521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) 23362521d698Sbellard 23372521d698Sbellard /* Obsolete macros */ 23382521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) 23392521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) 23402521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) 23412521d698Sbellard 23422521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) 23432521d698Sbellard 23442521d698Sbellard /* vfat ioctls */ 23452521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) 23462521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) 2347a5448a7dSbellard 2348f443e396SPeter Maydell struct target_mtop { 2349f443e396SPeter Maydell abi_short mt_op; 2350f443e396SPeter Maydell abi_int mt_count; 2351f443e396SPeter Maydell }; 2352f443e396SPeter Maydell 2353f443e396SPeter Maydell #if defined(TARGET_SPARC) || defined(TARGET_MIPS) 2354f443e396SPeter Maydell typedef abi_long target_kernel_daddr_t; 2355f443e396SPeter Maydell #else 2356f443e396SPeter Maydell typedef abi_int target_kernel_daddr_t; 2357f443e396SPeter Maydell #endif 2358f443e396SPeter Maydell 2359f443e396SPeter Maydell struct target_mtget { 2360f443e396SPeter Maydell abi_long mt_type; 2361f443e396SPeter Maydell abi_long mt_resid; 2362f443e396SPeter Maydell abi_long mt_dsreg; 2363f443e396SPeter Maydell abi_long mt_gstat; 2364f443e396SPeter Maydell abi_long mt_erreg; 2365f443e396SPeter Maydell target_kernel_daddr_t mt_fileno; 2366f443e396SPeter Maydell target_kernel_daddr_t mt_blkno; 2367f443e396SPeter Maydell }; 2368f443e396SPeter Maydell 2369f443e396SPeter Maydell struct target_mtpos { 2370f443e396SPeter Maydell abi_long mt_blkno; 2371f443e396SPeter Maydell }; 2372f443e396SPeter Maydell 2373f443e396SPeter Maydell #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct target_mtop) 2374f443e396SPeter Maydell #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct target_mtget) 2375f443e396SPeter Maydell #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct target_mtpos) 23768fbd6b52Sbalrog 2377a5448a7dSbellard struct target_sysinfo { 2378992f48a0Sblueswir1 abi_long uptime; /* Seconds since boot */ 2379992f48a0Sblueswir1 abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */ 2380992f48a0Sblueswir1 abi_ulong totalram; /* Total usable main memory size */ 2381992f48a0Sblueswir1 abi_ulong freeram; /* Available memory size */ 2382992f48a0Sblueswir1 abi_ulong sharedram; /* Amount of shared memory */ 2383992f48a0Sblueswir1 abi_ulong bufferram; /* Memory used by buffers */ 2384992f48a0Sblueswir1 abi_ulong totalswap; /* Total swap space size */ 2385992f48a0Sblueswir1 abi_ulong freeswap; /* swap space still available */ 2386a5448a7dSbellard unsigned short procs; /* Number of current processes */ 2387a5448a7dSbellard unsigned short pad; /* explicit padding for m68k */ 2388992f48a0Sblueswir1 abi_ulong totalhigh; /* Total high memory size */ 2389992f48a0Sblueswir1 abi_ulong freehigh; /* Available high memory size */ 2390a5448a7dSbellard unsigned int mem_unit; /* Memory unit size in bytes */ 2391992f48a0Sblueswir1 char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 2392a5448a7dSbellard }; 23933532fa74Sbellard 23946556a833Saurel32 struct linux_dirent { 23956556a833Saurel32 long d_ino; 23966556a833Saurel32 unsigned long d_off; 23976556a833Saurel32 unsigned short d_reclen; 23986556a833Saurel32 char d_name[256]; /* We must not include limits.h! */ 23996556a833Saurel32 }; 24006556a833Saurel32 24016556a833Saurel32 struct linux_dirent64 { 24026556a833Saurel32 uint64_t d_ino; 24036556a833Saurel32 int64_t d_off; 24046556a833Saurel32 unsigned short d_reclen; 24056556a833Saurel32 unsigned char d_type; 24066556a833Saurel32 char d_name[256]; 24076556a833Saurel32 }; 24086556a833Saurel32 240924e1003aSaurel32 struct target_mq_attr { 241024e1003aSaurel32 abi_long mq_flags; 241124e1003aSaurel32 abi_long mq_maxmsg; 241224e1003aSaurel32 abi_long mq_msgsize; 241324e1003aSaurel32 abi_long mq_curmsgs; 241424e1003aSaurel32 }; 241524e1003aSaurel32 24163532fa74Sbellard #include "socket.h" 2417637947f1Sths 2418637947f1Sths #include "errno_defs.h" 241903dfe9f8SRiku Voipio 242003dfe9f8SRiku Voipio #define FUTEX_WAIT 0 242103dfe9f8SRiku Voipio #define FUTEX_WAKE 1 242203dfe9f8SRiku Voipio #define FUTEX_FD 2 242303dfe9f8SRiku Voipio #define FUTEX_REQUEUE 3 242403dfe9f8SRiku Voipio #define FUTEX_CMP_REQUEUE 4 242503dfe9f8SRiku Voipio #define FUTEX_WAKE_OP 5 242603dfe9f8SRiku Voipio #define FUTEX_LOCK_PI 6 242703dfe9f8SRiku Voipio #define FUTEX_UNLOCK_PI 7 242803dfe9f8SRiku Voipio #define FUTEX_TRYLOCK_PI 8 242903dfe9f8SRiku Voipio #define FUTEX_WAIT_BITSET 9 243003dfe9f8SRiku Voipio #define FUTEX_WAKE_BITSET 10 243103dfe9f8SRiku Voipio 243203dfe9f8SRiku Voipio #define FUTEX_PRIVATE_FLAG 128 243303dfe9f8SRiku Voipio #define FUTEX_CLOCK_REALTIME 256 243403dfe9f8SRiku Voipio #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) 243503dfe9f8SRiku Voipio 24363b6edd16SPeter Maydell #ifdef CONFIG_EPOLL 2437928bed6aSLaurent Vivier #if defined(TARGET_X86_64) 2438928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED QEMU_PACKED 2439928bed6aSLaurent Vivier #else 2440928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED 2441928bed6aSLaurent Vivier #endif 2442928bed6aSLaurent Vivier 24433b6edd16SPeter Maydell typedef union target_epoll_data { 24443b6edd16SPeter Maydell abi_ulong ptr; 2445928bed6aSLaurent Vivier abi_int fd; 2446928bed6aSLaurent Vivier abi_uint u32; 2447928bed6aSLaurent Vivier abi_ullong u64; 24483b6edd16SPeter Maydell } target_epoll_data_t; 24493b6edd16SPeter Maydell 24503b6edd16SPeter Maydell struct target_epoll_event { 2451928bed6aSLaurent Vivier abi_uint events; 24523b6edd16SPeter Maydell target_epoll_data_t data; 2453928bed6aSLaurent Vivier } TARGET_EPOLL_PACKED; 24542ba7fae3SPeter Maydell 24552ba7fae3SPeter Maydell #define TARGET_EP_MAX_EVENTS (INT_MAX / sizeof(struct target_epoll_event)) 24562ba7fae3SPeter Maydell 24573b6edd16SPeter Maydell #endif 2458163a05a8SPeter Maydell struct target_rlimit64 { 2459163a05a8SPeter Maydell uint64_t rlim_cur; 2460163a05a8SPeter Maydell uint64_t rlim_max; 2461163a05a8SPeter Maydell }; 2462583359a6SAkos PASZTORY 2463583359a6SAkos PASZTORY struct target_ucred { 2464583359a6SAkos PASZTORY uint32_t pid; 2465583359a6SAkos PASZTORY uint32_t uid; 2466583359a6SAkos PASZTORY uint32_t gid; 2467583359a6SAkos PASZTORY }; 2468cb9c377fSPaolo Bonzini 2469aecc8861SAlexander Graf typedef int32_t target_timer_t; 2470905bba13SErik de Castro Lopo 247134d60862SNatanael Copa #define TARGET_SIGEV_MAX_SIZE 64 247234d60862SNatanael Copa 247334d60862SNatanael Copa /* This is architecture-specific but most architectures use the default */ 247434d60862SNatanael Copa #ifdef TARGET_MIPS 247534d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long)) 247634d60862SNatanael Copa #else 247734d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ 247834d60862SNatanael Copa + sizeof(target_sigval_t)) 247934d60862SNatanael Copa #endif 248034d60862SNatanael Copa 248134d60862SNatanael Copa #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ 248234d60862SNatanael Copa - TARGET_SIGEV_PREAMBLE_SIZE) \ 248334d60862SNatanael Copa / sizeof(int32_t)) 248434d60862SNatanael Copa 2485905bba13SErik de Castro Lopo struct target_sigevent { 2486905bba13SErik de Castro Lopo target_sigval_t sigev_value; 248717351c3fSPeter Maydell abi_int sigev_signo; 248817351c3fSPeter Maydell abi_int sigev_notify; 2489905bba13SErik de Castro Lopo union { 249017351c3fSPeter Maydell abi_int _pad[TARGET_SIGEV_PAD_SIZE]; 249117351c3fSPeter Maydell abi_int _tid; 2492905bba13SErik de Castro Lopo 249317351c3fSPeter Maydell /* The kernel (and thus QEMU) never looks at these; 249417351c3fSPeter Maydell * they're only used as part of the ABI between a 249517351c3fSPeter Maydell * userspace program and libc. 249617351c3fSPeter Maydell */ 2497905bba13SErik de Castro Lopo struct { 249817351c3fSPeter Maydell abi_ulong _function; 249917351c3fSPeter Maydell abi_ulong _attribute; 2500905bba13SErik de Castro Lopo } _sigev_thread; 2501905bba13SErik de Castro Lopo } _sigev_un; 2502905bba13SErik de Castro Lopo }; 2503e0eb210eSPeter Maydell 2504e0eb210eSPeter Maydell struct target_user_cap_header { 2505e0eb210eSPeter Maydell uint32_t version; 2506e0eb210eSPeter Maydell int pid; 2507e0eb210eSPeter Maydell }; 2508e0eb210eSPeter Maydell 2509e0eb210eSPeter Maydell struct target_user_cap_data { 2510e0eb210eSPeter Maydell uint32_t effective; 2511e0eb210eSPeter Maydell uint32_t permitted; 2512e0eb210eSPeter Maydell uint32_t inheritable; 2513e0eb210eSPeter Maydell }; 25141b3c4fdfSMarkus Armbruster 2515da2c8ad7SAleksandar Markovic /* from kernel's include/linux/syslog.h */ 2516da2c8ad7SAleksandar Markovic 2517da2c8ad7SAleksandar Markovic /* Close the log. Currently a NOP. */ 2518da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CLOSE 0 2519da2c8ad7SAleksandar Markovic /* Open the log. Currently a NOP. */ 2520da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_OPEN 1 2521da2c8ad7SAleksandar Markovic /* Read from the log. */ 2522da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ 2 2523da2c8ad7SAleksandar Markovic /* Read all messages remaining in the ring buffer. */ 2524da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ_ALL 3 2525da2c8ad7SAleksandar Markovic /* Read and clear all messages remaining in the ring buffer */ 2526da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ_CLEAR 4 2527da2c8ad7SAleksandar Markovic /* Clear ring buffer. */ 2528da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CLEAR 5 2529da2c8ad7SAleksandar Markovic /* Disable printk's to console */ 2530da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_OFF 6 2531da2c8ad7SAleksandar Markovic /* Enable printk's to console */ 2532da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_ON 7 2533da2c8ad7SAleksandar Markovic /* Set level of messages printed to console */ 2534da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_LEVEL 8 2535da2c8ad7SAleksandar Markovic /* Return number of unread characters in the log buffer */ 2536da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_SIZE_UNREAD 9 2537da2c8ad7SAleksandar Markovic /* Return size of the log buffer */ 2538da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10 2539da2c8ad7SAleksandar Markovic 2540*efa92184SAleksandar Rikalo struct target_statx_timestamp { 2541*efa92184SAleksandar Rikalo int64_t tv_sec; 2542*efa92184SAleksandar Rikalo uint32_t tv_nsec; 2543*efa92184SAleksandar Rikalo int32_t __reserved; 2544*efa92184SAleksandar Rikalo }; 2545*efa92184SAleksandar Rikalo 2546*efa92184SAleksandar Rikalo struct target_statx { 2547*efa92184SAleksandar Rikalo /* 0x00 */ 2548*efa92184SAleksandar Rikalo uint32_t stx_mask; /* What results were written [uncond] */ 2549*efa92184SAleksandar Rikalo uint32_t stx_blksize; /* Preferred general I/O size [uncond] */ 2550*efa92184SAleksandar Rikalo uint64_t stx_attributes; /* Flags conveying information about the file */ 2551*efa92184SAleksandar Rikalo /* 0x10 */ 2552*efa92184SAleksandar Rikalo uint32_t stx_nlink; /* Number of hard links */ 2553*efa92184SAleksandar Rikalo uint32_t stx_uid; /* User ID of owner */ 2554*efa92184SAleksandar Rikalo uint32_t stx_gid; /* Group ID of owner */ 2555*efa92184SAleksandar Rikalo uint16_t stx_mode; /* File mode */ 2556*efa92184SAleksandar Rikalo uint16_t __spare0[1]; 2557*efa92184SAleksandar Rikalo /* 0x20 */ 2558*efa92184SAleksandar Rikalo uint64_t stx_ino; /* Inode number */ 2559*efa92184SAleksandar Rikalo uint64_t stx_size; /* File size */ 2560*efa92184SAleksandar Rikalo uint64_t stx_blocks; /* Number of 512-byte blocks allocated */ 2561*efa92184SAleksandar Rikalo uint64_t stx_attributes_mask; /* Mask to show what is supported */ 2562*efa92184SAleksandar Rikalo /* 0x40 */ 2563*efa92184SAleksandar Rikalo struct target_statx_timestamp stx_atime; /* Last access time */ 2564*efa92184SAleksandar Rikalo struct target_statx_timestamp stx_btime; /* File creation time */ 2565*efa92184SAleksandar Rikalo struct target_statx_timestamp stx_ctime; /* Last attribute change time */ 2566*efa92184SAleksandar Rikalo struct target_statx_timestamp stx_mtime; /* Last data modification time */ 2567*efa92184SAleksandar Rikalo /* 0x80 */ 2568*efa92184SAleksandar Rikalo uint32_t stx_rdev_major; /* Device ID of special file [if bdev/cdev] */ 2569*efa92184SAleksandar Rikalo uint32_t stx_rdev_minor; 2570*efa92184SAleksandar Rikalo uint32_t stx_dev_major; /* ID of device containing file [uncond] */ 2571*efa92184SAleksandar Rikalo uint32_t stx_dev_minor; 2572*efa92184SAleksandar Rikalo /* 0x90 */ 2573*efa92184SAleksandar Rikalo uint64_t __spare2[14]; /* Spare space for future expansion */ 2574*efa92184SAleksandar Rikalo /* 0x100 */ 2575*efa92184SAleksandar Rikalo }; 2576*efa92184SAleksandar Rikalo 25771b3c4fdfSMarkus Armbruster #endif 2578