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 358853f86eSbellard #define IPCOP_semop 1 368853f86eSbellard #define IPCOP_semget 2 378853f86eSbellard #define IPCOP_semctl 3 388853f86eSbellard #define IPCOP_semtimedop 4 398853f86eSbellard #define IPCOP_msgsnd 11 408853f86eSbellard #define IPCOP_msgrcv 12 418853f86eSbellard #define IPCOP_msgget 13 428853f86eSbellard #define IPCOP_msgctl 14 438853f86eSbellard #define IPCOP_shmat 21 448853f86eSbellard #define IPCOP_shmdt 22 458853f86eSbellard #define IPCOP_shmget 23 468853f86eSbellard #define IPCOP_shmctl 24 478853f86eSbellard 482521d698Sbellard /* 492521d698Sbellard * The following is for compatibility across the various Linux 502521d698Sbellard * platforms. The i386 ioctl numbering scheme doesn't really enforce 512521d698Sbellard * a type field. De facto, however, the top 8 bits of the lower 16 522521d698Sbellard * bits are indeed used as a type field, so we might just as well make 532521d698Sbellard * this explicit here. Please be sure to use the decoding macros 542521d698Sbellard * below from now on. 552521d698Sbellard */ 562521d698Sbellard #define TARGET_IOC_NRBITS 8 572521d698Sbellard #define TARGET_IOC_TYPEBITS 8 582521d698Sbellard 59716f3fbeSPeter Maydell #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 60716f3fbeSPeter Maydell || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 61cd98d390SAndreas Schwab || defined(TARGET_SPARC) \ 620c866a7eSRiku Voipio || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) 6374d753acSMika Westerberg /* 16 bit uid wrappers emulation */ 6474d753acSMika Westerberg #define USE_UID16 650c866a7eSRiku Voipio #define target_id uint16_t 660c866a7eSRiku Voipio #else 670c866a7eSRiku Voipio #define target_id uint32_t 6874d753acSMika Westerberg #endif 6974d753acSMika Westerberg 70e6e5906bSpbrook #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ 71b16189b2SChen Gang || defined(TARGET_M68K) || defined(TARGET_CRIS) \ 72daa4374aSPeter Maydell || defined(TARGET_S390X) \ 73a0a839b6SMarek Vasut || defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) \ 74ba7651fbSMax Filippov || defined(TARGET_NIOS2) || defined(TARGET_RISCV) \ 75ba7651fbSMax Filippov || defined(TARGET_XTENSA) 762521d698Sbellard 772521d698Sbellard #define TARGET_IOC_SIZEBITS 14 782521d698Sbellard #define TARGET_IOC_DIRBITS 2 792521d698Sbellard 802521d698Sbellard #define TARGET_IOC_NONE 0U 812521d698Sbellard #define TARGET_IOC_WRITE 1U 822521d698Sbellard #define TARGET_IOC_READ 2U 832521d698Sbellard 84048f6b4dSbellard #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ 85b779e29eSEdgar E. Iglesias defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \ 86b779e29eSEdgar E. Iglesias defined(TARGET_MIPS) 872521d698Sbellard 882521d698Sbellard #define TARGET_IOC_SIZEBITS 13 892521d698Sbellard #define TARGET_IOC_DIRBITS 3 902521d698Sbellard 912521d698Sbellard #define TARGET_IOC_NONE 1U 922521d698Sbellard #define TARGET_IOC_READ 2U 932521d698Sbellard #define TARGET_IOC_WRITE 4U 942521d698Sbellard 95a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 96a10d1e50SRichard Henderson 97a10d1e50SRichard Henderson #define TARGET_IOC_SIZEBITS 14 98a10d1e50SRichard Henderson #define TARGET_IOC_DIRBITS 2 99a10d1e50SRichard Henderson 100a10d1e50SRichard Henderson #define TARGET_IOC_NONE 0U 101a10d1e50SRichard Henderson #define TARGET_IOC_WRITE 2U 102a10d1e50SRichard Henderson #define TARGET_IOC_READ 1U 103a10d1e50SRichard Henderson 1042521d698Sbellard #else 1052521d698Sbellard #error unsupported CPU 1062521d698Sbellard #endif 1072521d698Sbellard 1082521d698Sbellard #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) 1092521d698Sbellard #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) 1102521d698Sbellard #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) 1112521d698Sbellard #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) 1122521d698Sbellard 1132521d698Sbellard #define TARGET_IOC_NRSHIFT 0 1142521d698Sbellard #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) 1152521d698Sbellard #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) 1162521d698Sbellard #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) 1172521d698Sbellard 1182521d698Sbellard #define TARGET_IOC(dir,type,nr,size) \ 1192521d698Sbellard (((dir) << TARGET_IOC_DIRSHIFT) | \ 1202521d698Sbellard ((type) << TARGET_IOC_TYPESHIFT) | \ 1212521d698Sbellard ((nr) << TARGET_IOC_NRSHIFT) | \ 1222521d698Sbellard ((size) << TARGET_IOC_SIZESHIFT)) 1232521d698Sbellard 1242521d698Sbellard /* used to create numbers */ 1252521d698Sbellard #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) 1262521d698Sbellard #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) 1272521d698Sbellard #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1282521d698Sbellard #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1292521d698Sbellard 1302521d698Sbellard /* the size is automatically computed for these defines */ 1312521d698Sbellard #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) 1322521d698Sbellard #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1332521d698Sbellard #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1342521d698Sbellard 1357854b056Sbellard struct target_sockaddr { 1367854b056Sbellard uint16_t sa_family; 1377854b056Sbellard uint8_t sa_data[14]; 1387854b056Sbellard }; 1397854b056Sbellard 14033a29b51SJoakim Tjernlund struct target_sockaddr_ll { 14133a29b51SJoakim Tjernlund uint16_t sll_family; /* Always AF_PACKET */ 14233a29b51SJoakim Tjernlund uint16_t sll_protocol; /* Physical layer protocol */ 14333a29b51SJoakim Tjernlund int sll_ifindex; /* Interface number */ 14433a29b51SJoakim Tjernlund uint16_t sll_hatype; /* ARP hardware type */ 14533a29b51SJoakim Tjernlund uint8_t sll_pkttype; /* Packet type */ 14633a29b51SJoakim Tjernlund uint8_t sll_halen; /* Length of address */ 14733a29b51SJoakim Tjernlund uint8_t sll_addr[8]; /* Physical layer address */ 14833a29b51SJoakim Tjernlund }; 14933a29b51SJoakim Tjernlund 150fb3aabf3SLaurent Vivier struct target_sockaddr_un { 151fb3aabf3SLaurent Vivier uint16_t su_family; 152fb3aabf3SLaurent Vivier uint8_t sun_path[108]; 153fb3aabf3SLaurent Vivier }; 154fb3aabf3SLaurent Vivier 155fb3aabf3SLaurent Vivier struct target_in_addr { 156fb3aabf3SLaurent Vivier uint32_t s_addr; /* big endian */ 157fb3aabf3SLaurent Vivier }; 158fb3aabf3SLaurent Vivier 159fb3aabf3SLaurent Vivier struct target_sockaddr_in { 160fb3aabf3SLaurent Vivier uint16_t sin_family; 161fb3aabf3SLaurent Vivier int16_t sin_port; /* big endian */ 162fb3aabf3SLaurent Vivier struct target_in_addr sin_addr; 163fb3aabf3SLaurent Vivier uint8_t __pad[sizeof(struct target_sockaddr) - 164fb3aabf3SLaurent Vivier sizeof(uint16_t) - sizeof(int16_t) - 165fb3aabf3SLaurent Vivier sizeof(struct target_in_addr)]; 166fb3aabf3SLaurent Vivier }; 167fb3aabf3SLaurent Vivier 168ee1ac3a1SHelge Deller struct target_sockaddr_in6 { 169ee1ac3a1SHelge Deller uint16_t sin6_family; 170ee1ac3a1SHelge Deller uint16_t sin6_port; /* big endian */ 171ee1ac3a1SHelge Deller uint32_t sin6_flowinfo; /* big endian */ 172ee1ac3a1SHelge Deller struct in6_addr sin6_addr; /* IPv6 address, big endian */ 173ee1ac3a1SHelge Deller uint32_t sin6_scope_id; 174ee1ac3a1SHelge Deller }; 175ee1ac3a1SHelge Deller 176f57d4192SLaurent Vivier struct target_sock_filter { 177f57d4192SLaurent Vivier abi_ushort code; 178f57d4192SLaurent Vivier uint8_t jt; 179f57d4192SLaurent Vivier uint8_t jf; 180f57d4192SLaurent Vivier abi_uint k; 181f57d4192SLaurent Vivier }; 182f57d4192SLaurent Vivier 183f57d4192SLaurent Vivier struct target_sock_fprog { 184f57d4192SLaurent Vivier abi_ushort len; 185f57d4192SLaurent Vivier abi_ulong filter; 186f57d4192SLaurent Vivier }; 187f57d4192SLaurent Vivier 188b975b83bSLionel Landwerlin struct target_ip_mreq { 189b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 190b975b83bSLionel Landwerlin struct target_in_addr imr_address; 191b975b83bSLionel Landwerlin }; 192b975b83bSLionel Landwerlin 193b975b83bSLionel Landwerlin struct target_ip_mreqn { 194b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 195b975b83bSLionel Landwerlin struct target_in_addr imr_address; 196b975b83bSLionel Landwerlin abi_long imr_ifindex; 197b975b83bSLionel Landwerlin }; 198b975b83bSLionel Landwerlin 1996e3cb58fSLionel Landwerlin struct target_ip_mreq_source { 2006e3cb58fSLionel Landwerlin /* big endian */ 2016e3cb58fSLionel Landwerlin uint32_t imr_multiaddr; 2026e3cb58fSLionel Landwerlin uint32_t imr_interface; 2036e3cb58fSLionel Landwerlin uint32_t imr_sourceaddr; 2046e3cb58fSLionel Landwerlin }; 2056e3cb58fSLionel Landwerlin 20683eb6e50SCarlo Marcelo Arenas Belón struct target_linger { 20783eb6e50SCarlo Marcelo Arenas Belón abi_int l_onoff; /* Linger active */ 20883eb6e50SCarlo Marcelo Arenas Belón abi_int l_linger; /* How long to linger for */ 20983eb6e50SCarlo Marcelo Arenas Belón }; 21083eb6e50SCarlo Marcelo Arenas Belón 21131e31b8aSbellard struct target_timeval { 212992f48a0Sblueswir1 abi_long tv_sec; 213992f48a0Sblueswir1 abi_long tv_usec; 21431e31b8aSbellard }; 21531e31b8aSbellard 2161b6b029eSbellard struct target_timespec { 217992f48a0Sblueswir1 abi_long tv_sec; 218992f48a0Sblueswir1 abi_long tv_nsec; 2191b6b029eSbellard }; 2201b6b029eSbellard 221ef4467e9SPaul Burton struct target_timezone { 222ef4467e9SPaul Burton abi_int tz_minuteswest; 223ef4467e9SPaul Burton abi_int tz_dsttime; 224ef4467e9SPaul Burton }; 225ef4467e9SPaul Burton 22666fb9763Sbellard struct target_itimerval { 22766fb9763Sbellard struct target_timeval it_interval; 22866fb9763Sbellard struct target_timeval it_value; 22966fb9763Sbellard }; 23066fb9763Sbellard 231905bba13SErik de Castro Lopo struct target_itimerspec { 232905bba13SErik de Castro Lopo struct target_timespec it_interval; 233905bba13SErik de Castro Lopo struct target_timespec it_value; 234905bba13SErik de Castro Lopo }; 235905bba13SErik de Castro Lopo 23619f59bceSAleksandar Markovic struct target_timex { 23719f59bceSAleksandar Markovic abi_uint modes; /* Mode selector */ 23819f59bceSAleksandar Markovic abi_long offset; /* Time offset */ 23919f59bceSAleksandar Markovic abi_long freq; /* Frequency offset */ 24019f59bceSAleksandar Markovic abi_long maxerror; /* Maximum error (microseconds) */ 24119f59bceSAleksandar Markovic abi_long esterror; /* Estimated error (microseconds) */ 24219f59bceSAleksandar Markovic abi_int status; /* Clock command/status */ 24319f59bceSAleksandar Markovic abi_long constant; /* PLL (phase-locked loop) time constant */ 24419f59bceSAleksandar Markovic abi_long precision; /* Clock precision (microseconds, ro) */ 24519f59bceSAleksandar Markovic abi_long tolerance; /* Clock freq. tolerance (ppm, ro) */ 24619f59bceSAleksandar Markovic struct target_timeval time; /* Current time */ 24719f59bceSAleksandar Markovic abi_long tick; /* Microseconds between clock ticks */ 24819f59bceSAleksandar Markovic abi_long ppsfreq; /* PPS (pulse per second) frequency */ 24919f59bceSAleksandar Markovic abi_long jitter; /* PPS jitter (ro); nanoseconds */ 25019f59bceSAleksandar Markovic abi_int shift; /* PPS interval duration (seconds) */ 25119f59bceSAleksandar Markovic abi_long stabil; /* PPS stability */ 25219f59bceSAleksandar Markovic abi_long jitcnt; /* PPS jitter limit exceeded (ro) */ 25319f59bceSAleksandar Markovic abi_long calcnt; /* PPS calibration intervals */ 25419f59bceSAleksandar Markovic abi_long errcnt; /* PPS calibration errors */ 25519f59bceSAleksandar Markovic abi_long stbcnt; /* PPS stability limit exceeded */ 25619f59bceSAleksandar Markovic abi_int tai; /* TAI offset */ 25719f59bceSAleksandar Markovic 25819f59bceSAleksandar Markovic /* Further padding bytes to allow for future expansion */ 25919f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; abi_int:32; 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; 26219f59bceSAleksandar Markovic }; 26319f59bceSAleksandar Markovic 264c227f099SAnthony Liguori typedef abi_long target_clock_t; 26532f36bceSbellard 266c596ed17Sbellard #define TARGET_HZ 100 267c596ed17Sbellard 26832f36bceSbellard struct target_tms { 269c227f099SAnthony Liguori target_clock_t tms_utime; 270c227f099SAnthony Liguori target_clock_t tms_stime; 271c227f099SAnthony Liguori target_clock_t tms_cutime; 272c227f099SAnthony Liguori target_clock_t tms_cstime; 27332f36bceSbellard }; 27432f36bceSbellard 2756180a181Sbellard struct target_utimbuf { 276992f48a0Sblueswir1 abi_long actime; 277992f48a0Sblueswir1 abi_long modtime; 2786180a181Sbellard }; 2796180a181Sbellard 280f2674e31Sbellard struct target_sel_arg_struct { 281992f48a0Sblueswir1 abi_long n; 282992f48a0Sblueswir1 abi_long inp, outp, exp; 283992f48a0Sblueswir1 abi_long tvp; 284f2674e31Sbellard }; 285f2674e31Sbellard 28631e31b8aSbellard struct target_iovec { 287992f48a0Sblueswir1 abi_long iov_base; /* Starting address */ 288992f48a0Sblueswir1 abi_long iov_len; /* Number of bytes */ 28931e31b8aSbellard }; 29031e31b8aSbellard 2911a9353d2Sbellard struct target_msghdr { 292992f48a0Sblueswir1 abi_long msg_name; /* Socket name */ 2931a9353d2Sbellard int msg_namelen; /* Length of name */ 294992f48a0Sblueswir1 abi_long msg_iov; /* Data blocks */ 295992f48a0Sblueswir1 abi_long msg_iovlen; /* Number of blocks */ 296992f48a0Sblueswir1 abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ 297992f48a0Sblueswir1 abi_long msg_controllen; /* Length of cmsg list */ 2981a9353d2Sbellard unsigned int msg_flags; 2991a9353d2Sbellard }; 3001a9353d2Sbellard 3017854b056Sbellard struct target_cmsghdr { 302992f48a0Sblueswir1 abi_long cmsg_len; 3037854b056Sbellard int cmsg_level; 3047854b056Sbellard int cmsg_type; 3057854b056Sbellard }; 3067854b056Sbellard 3077854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) 308ee104587SJonathan Neuschäfer #define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \ 309ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start) 310992f48a0Sblueswir1 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ 311992f48a0Sblueswir1 & (size_t) ~(sizeof (abi_long) - 1)) 312ad762b99SPeter Maydell #define TARGET_CMSG_SPACE(len) (sizeof(struct target_cmsghdr) + \ 313ad762b99SPeter Maydell TARGET_CMSG_ALIGN(len)) 314ad762b99SPeter Maydell #define TARGET_CMSG_LEN(len) (sizeof(struct target_cmsghdr) + (len)) 3157854b056Sbellard 3167854b056Sbellard static __inline__ struct target_cmsghdr * 317ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(struct target_msghdr *__mhdr, 318ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg, 319ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg_start) 3207854b056Sbellard { 3212b8bdefcSths struct target_cmsghdr *__ptr; 3227854b056Sbellard 3232b8bdefcSths __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg 324cbb21eedSMatthias Braun + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len))); 325ee104587SJonathan Neuschäfer if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start) 326ee104587SJonathan Neuschäfer > tswapal(__mhdr->msg_controllen)) { 3277854b056Sbellard /* No more entries. */ 3282b8bdefcSths return (struct target_cmsghdr *)0; 329ee104587SJonathan Neuschäfer } 330ee104587SJonathan Neuschäfer return __ptr; 3317854b056Sbellard } 3327854b056Sbellard 333f19e00d7SAlexander Graf struct target_mmsghdr { 334f19e00d7SAlexander Graf struct target_msghdr msg_hdr; /* Message header */ 335f19e00d7SAlexander Graf unsigned int msg_len; /* Number of bytes transmitted */ 336f19e00d7SAlexander Graf }; 3377854b056Sbellard 33831e31b8aSbellard struct target_rusage { 33931e31b8aSbellard struct target_timeval ru_utime; /* user time used */ 34031e31b8aSbellard struct target_timeval ru_stime; /* system time used */ 341992f48a0Sblueswir1 abi_long ru_maxrss; /* maximum resident set size */ 342992f48a0Sblueswir1 abi_long ru_ixrss; /* integral shared memory size */ 343992f48a0Sblueswir1 abi_long ru_idrss; /* integral unshared data size */ 344992f48a0Sblueswir1 abi_long ru_isrss; /* integral unshared stack size */ 345992f48a0Sblueswir1 abi_long ru_minflt; /* page reclaims */ 346992f48a0Sblueswir1 abi_long ru_majflt; /* page faults */ 347992f48a0Sblueswir1 abi_long ru_nswap; /* swaps */ 348992f48a0Sblueswir1 abi_long ru_inblock; /* block input operations */ 349992f48a0Sblueswir1 abi_long ru_oublock; /* block output operations */ 350992f48a0Sblueswir1 abi_long ru_msgsnd; /* messages sent */ 351992f48a0Sblueswir1 abi_long ru_msgrcv; /* messages received */ 352992f48a0Sblueswir1 abi_long ru_nsignals; /* signals received */ 353992f48a0Sblueswir1 abi_long ru_nvcsw; /* voluntary context switches */ 354992f48a0Sblueswir1 abi_long ru_nivcsw; /* involuntary " */ 35531e31b8aSbellard }; 35631e31b8aSbellard 35731e31b8aSbellard typedef struct { 35831e31b8aSbellard int val[2]; 359c227f099SAnthony Liguori } kernel_fsid_t; 36031e31b8aSbellard 361dab2ed99Sbellard struct target_dirent { 362992f48a0Sblueswir1 abi_long d_ino; 363992f48a0Sblueswir1 abi_long d_off; 364dab2ed99Sbellard unsigned short d_reclen; 365333858b7SDmitry V. Levin char d_name[]; 366dab2ed99Sbellard }; 367dab2ed99Sbellard 368dab2ed99Sbellard struct target_dirent64 { 369dab2ed99Sbellard uint64_t d_ino; 370dab2ed99Sbellard int64_t d_off; 371dab2ed99Sbellard unsigned short d_reclen; 372dab2ed99Sbellard unsigned char d_type; 373dab2ed99Sbellard char d_name[256]; 374dab2ed99Sbellard }; 375dab2ed99Sbellard 376dab2ed99Sbellard 37731e31b8aSbellard /* mostly generic signal stuff */ 378992f48a0Sblueswir1 #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ 379992f48a0Sblueswir1 #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ 380992f48a0Sblueswir1 #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ 38131e31b8aSbellard 38231e31b8aSbellard #ifdef TARGET_MIPS 38331e31b8aSbellard #define TARGET_NSIG 128 38431e31b8aSbellard #else 38531e31b8aSbellard #define TARGET_NSIG 64 38631e31b8aSbellard #endif 387992f48a0Sblueswir1 #define TARGET_NSIG_BPW TARGET_ABI_BITS 38831e31b8aSbellard #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) 38931e31b8aSbellard 39031e31b8aSbellard typedef struct { 391992f48a0Sblueswir1 abi_ulong sig[TARGET_NSIG_WORDS]; 392c227f099SAnthony Liguori } target_sigset_t; 39331e31b8aSbellard 39466fb9763Sbellard #ifdef BSWAP_NEEDED 395c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 39666fb9763Sbellard { 39766fb9763Sbellard int i; 39866fb9763Sbellard for(i = 0;i < TARGET_NSIG_WORDS; i++) 399cbb21eedSMatthias Braun d->sig[i] = tswapal(s->sig[i]); 40066fb9763Sbellard } 40166fb9763Sbellard #else 402c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 40366fb9763Sbellard { 40466fb9763Sbellard *d = *s; 40566fb9763Sbellard } 40666fb9763Sbellard #endif 40766fb9763Sbellard 408c227f099SAnthony Liguori static inline void target_siginitset(target_sigset_t *d, abi_ulong set) 40966fb9763Sbellard { 41066fb9763Sbellard int i; 41166fb9763Sbellard d->sig[0] = set; 41266fb9763Sbellard for(i = 1;i < TARGET_NSIG_WORDS; i++) 41366fb9763Sbellard d->sig[i] = 0; 41466fb9763Sbellard } 41566fb9763Sbellard 416c227f099SAnthony Liguori void host_to_target_sigset(target_sigset_t *d, const sigset_t *s); 417c227f099SAnthony Liguori void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); 418992f48a0Sblueswir1 void host_to_target_old_sigset(abi_ulong *old_sigset, 41966fb9763Sbellard const sigset_t *sigset); 42066fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset, 421992f48a0Sblueswir1 const abi_ulong *old_sigset); 42266fb9763Sbellard struct target_sigaction; 42366fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act, 42466fb9763Sbellard struct target_sigaction *oact); 42566fb9763Sbellard 4269850f9f6SLaurent Vivier #include "target_signal.h" 4279850f9f6SLaurent Vivier 4287f047de1SRichard Henderson #ifdef TARGET_SA_RESTORER 4297f047de1SRichard Henderson #define TARGET_ARCH_HAS_SA_RESTORER 1 4307f047de1SRichard Henderson #endif 4317f047de1SRichard Henderson 4326049f4f8SRichard Henderson #if defined(TARGET_ALPHA) 4336049f4f8SRichard Henderson struct target_old_sigaction { 4346049f4f8SRichard Henderson abi_ulong _sa_handler; 4356049f4f8SRichard Henderson abi_ulong sa_mask; 436d2565875SRichard Henderson int32_t sa_flags; 4376049f4f8SRichard Henderson }; 438106ec879Sbellard 4396049f4f8SRichard Henderson struct target_rt_sigaction { 4406049f4f8SRichard Henderson abi_ulong _sa_handler; 4416049f4f8SRichard Henderson abi_ulong sa_flags; 4426049f4f8SRichard Henderson target_sigset_t sa_mask; 4436049f4f8SRichard Henderson }; 4446049f4f8SRichard Henderson 4456049f4f8SRichard Henderson /* This is the struct used inside the kernel. The ka_restorer 4466049f4f8SRichard Henderson field comes from the 5th argument to sys_rt_sigaction. */ 4476049f4f8SRichard Henderson struct target_sigaction { 4486049f4f8SRichard Henderson abi_ulong _sa_handler; 4496049f4f8SRichard Henderson abi_ulong sa_flags; 4506049f4f8SRichard Henderson target_sigset_t sa_mask; 4516049f4f8SRichard Henderson abi_ulong sa_restorer; 4526049f4f8SRichard Henderson }; 4536049f4f8SRichard Henderson #elif defined(TARGET_MIPS) 454106ec879Sbellard struct target_sigaction { 455540635baSths uint32_t sa_flags; 456d26bc211Sths #if defined(TARGET_ABI_MIPSN32) 457540635baSths uint32_t _sa_handler; 458540635baSths #else 459992f48a0Sblueswir1 abi_ulong _sa_handler; 460540635baSths #endif 461c227f099SAnthony Liguori target_sigset_t sa_mask; 4627f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 4637f047de1SRichard Henderson /* ??? This is always present, but ignored unless O32. */ 4647f047de1SRichard Henderson abi_ulong sa_restorer; 4657f047de1SRichard Henderson #endif 466106ec879Sbellard }; 467106ec879Sbellard #else 4682521d698Sbellard struct target_old_sigaction { 469992f48a0Sblueswir1 abi_ulong _sa_handler; 470992f48a0Sblueswir1 abi_ulong sa_mask; 471992f48a0Sblueswir1 abi_ulong sa_flags; 4727f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 473992f48a0Sblueswir1 abi_ulong sa_restorer; 4747f047de1SRichard Henderson #endif 4752521d698Sbellard }; 4762521d698Sbellard 4772521d698Sbellard struct target_sigaction { 478992f48a0Sblueswir1 abi_ulong _sa_handler; 479992f48a0Sblueswir1 abi_ulong sa_flags; 4807f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 481992f48a0Sblueswir1 abi_ulong sa_restorer; 4827f047de1SRichard Henderson #endif 483c227f099SAnthony Liguori target_sigset_t sa_mask; 4845de154e8SLaurent Vivier #ifdef TARGET_ARCH_HAS_KA_RESTORER 4855de154e8SLaurent Vivier abi_ulong ka_restorer; 4865de154e8SLaurent Vivier #endif 4872521d698Sbellard }; 488106ec879Sbellard #endif 4892521d698Sbellard 4902521d698Sbellard typedef union target_sigval { 4912521d698Sbellard int sival_int; 492992f48a0Sblueswir1 abi_ulong sival_ptr; 493c227f099SAnthony Liguori } target_sigval_t; 4946d5e216dSbellard #if 0 4956d5e216dSbellard #if defined (TARGET_SPARC) 4966d5e216dSbellard typedef struct { 4976d5e216dSbellard struct { 498992f48a0Sblueswir1 abi_ulong psr; 499992f48a0Sblueswir1 abi_ulong pc; 500992f48a0Sblueswir1 abi_ulong npc; 501992f48a0Sblueswir1 abi_ulong y; 502992f48a0Sblueswir1 abi_ulong u_regs[16]; /* globals and ins */ 5036d5e216dSbellard } si_regs; 5046d5e216dSbellard int si_mask; 5056d5e216dSbellard } __siginfo_t; 5066d5e216dSbellard 5076d5e216dSbellard typedef struct { 5086d5e216dSbellard unsigned long si_float_regs [32]; 5096d5e216dSbellard unsigned long si_fsr; 5106d5e216dSbellard unsigned long si_fpqdepth; 5116d5e216dSbellard struct { 5126d5e216dSbellard unsigned long *insn_addr; 5136d5e216dSbellard unsigned long insn; 5146d5e216dSbellard } si_fpqueue [16]; 5156d5e216dSbellard } __siginfo_fpu_t; 5166d5e216dSbellard #endif 5176d5e216dSbellard #endif 5182521d698Sbellard 5192521d698Sbellard #define TARGET_SI_MAX_SIZE 128 520aa5e03d2SMaxim Ostapenko 521aa5e03d2SMaxim Ostapenko #if TARGET_ABI_BITS == 32 522aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int)) 523aa5e03d2SMaxim Ostapenko #else 524aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int)) 525aa5e03d2SMaxim Ostapenko #endif 526aa5e03d2SMaxim Ostapenko 527aa5e03d2SMaxim Ostapenko #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int)) 5282521d698Sbellard 529a70dadc7SPeter Maydell /* Within QEMU the top 16 bits of si_code indicate which of the parts of 530a70dadc7SPeter Maydell * the union in target_siginfo is valid. This only applies between 531a70dadc7SPeter Maydell * host_to_target_siginfo_noswap() and tswap_siginfo(); it does not 532a70dadc7SPeter Maydell * appear either within host siginfo_t or in target_siginfo structures 533a70dadc7SPeter Maydell * which we get from the guest userspace program. (The Linux kernel 534a70dadc7SPeter Maydell * does a similar thing with using the top bits for its own internal 535a70dadc7SPeter Maydell * purposes but not letting them be visible to userspace.) 536a70dadc7SPeter Maydell */ 537a70dadc7SPeter Maydell #define QEMU_SI_KILL 0 538a70dadc7SPeter Maydell #define QEMU_SI_TIMER 1 539a70dadc7SPeter Maydell #define QEMU_SI_POLL 2 540a70dadc7SPeter Maydell #define QEMU_SI_FAULT 3 541a70dadc7SPeter Maydell #define QEMU_SI_CHLD 4 542a70dadc7SPeter Maydell #define QEMU_SI_RT 5 543a70dadc7SPeter Maydell 5442521d698Sbellard typedef struct target_siginfo { 5453f53d546Spbrook #ifdef TARGET_MIPS 5463f53d546Spbrook int si_signo; 5473f53d546Spbrook int si_code; 5483f53d546Spbrook int si_errno; 5493f53d546Spbrook #else 5502521d698Sbellard int si_signo; 5512521d698Sbellard int si_errno; 5522521d698Sbellard int si_code; 5533f53d546Spbrook #endif 5542521d698Sbellard 5552521d698Sbellard union { 5562521d698Sbellard int _pad[TARGET_SI_PAD_SIZE]; 5572521d698Sbellard 5582521d698Sbellard /* kill() */ 5592521d698Sbellard struct { 5602521d698Sbellard pid_t _pid; /* sender's pid */ 5612521d698Sbellard uid_t _uid; /* sender's uid */ 5622521d698Sbellard } _kill; 5632521d698Sbellard 5642521d698Sbellard /* POSIX.1b timers */ 5652521d698Sbellard struct { 5662521d698Sbellard unsigned int _timer1; 5672521d698Sbellard unsigned int _timer2; 5682521d698Sbellard } _timer; 5692521d698Sbellard 5702521d698Sbellard /* POSIX.1b signals */ 5712521d698Sbellard struct { 5722521d698Sbellard pid_t _pid; /* sender's pid */ 5732521d698Sbellard uid_t _uid; /* sender's uid */ 574c227f099SAnthony Liguori target_sigval_t _sigval; 5752521d698Sbellard } _rt; 5762521d698Sbellard 5772521d698Sbellard /* SIGCHLD */ 5782521d698Sbellard struct { 5792521d698Sbellard pid_t _pid; /* which child */ 5802521d698Sbellard uid_t _uid; /* sender's uid */ 5812521d698Sbellard int _status; /* exit code */ 582c227f099SAnthony Liguori target_clock_t _utime; 583c227f099SAnthony Liguori target_clock_t _stime; 5842521d698Sbellard } _sigchld; 5852521d698Sbellard 5862521d698Sbellard /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 5872521d698Sbellard struct { 588992f48a0Sblueswir1 abi_ulong _addr; /* faulting insn/memory ref. */ 5892521d698Sbellard } _sigfault; 5902521d698Sbellard 5912521d698Sbellard /* SIGPOLL */ 5922521d698Sbellard struct { 5932521d698Sbellard int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 5942521d698Sbellard int _fd; 5952521d698Sbellard } _sigpoll; 5962521d698Sbellard } _sifields; 597c227f099SAnthony Liguori } target_siginfo_t; 5982521d698Sbellard 5992521d698Sbellard /* 6002521d698Sbellard * si_code values 6012521d698Sbellard * Digital reserves positive values for kernel-generated signals. 6022521d698Sbellard */ 6032521d698Sbellard #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ 6042521d698Sbellard #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 6052521d698Sbellard #define TARGET_SI_QUEUE -1 /* sent by sigqueue */ 6062521d698Sbellard #define TARGET_SI_TIMER -2 /* sent by timer expiration */ 6072521d698Sbellard #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ 6082521d698Sbellard #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ 6092521d698Sbellard #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ 6102521d698Sbellard 6112521d698Sbellard /* 6122521d698Sbellard * SIGILL si_codes 6132521d698Sbellard */ 614ffa65c3bSbellard #define TARGET_ILL_ILLOPC (1) /* illegal opcode */ 6152521d698Sbellard #define TARGET_ILL_ILLOPN (2) /* illegal operand */ 616ffa65c3bSbellard #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ 617ffa65c3bSbellard #define TARGET_ILL_ILLTRP (4) /* illegal trap */ 618ffa65c3bSbellard #define TARGET_ILL_PRVOPC (5) /* privileged opcode */ 619ffa65c3bSbellard #define TARGET_ILL_PRVREG (6) /* privileged register */ 620ffa65c3bSbellard #define TARGET_ILL_COPROC (7) /* coprocessor error */ 621ffa65c3bSbellard #define TARGET_ILL_BADSTK (8) /* internal stack error */ 622de2fdd56SChen Gang #ifdef TARGET_TILEGX 623de2fdd56SChen Gang #define TARGET_ILL_DBLFLT (9) /* double fault */ 624de2fdd56SChen Gang #define TARGET_ILL_HARDWALL (10) /* user networks hardwall violation */ 625de2fdd56SChen Gang #endif 6262521d698Sbellard 6272521d698Sbellard /* 6282521d698Sbellard * SIGFPE si_codes 6292521d698Sbellard */ 6302521d698Sbellard #define TARGET_FPE_INTDIV (1) /* integer divide by zero */ 6312521d698Sbellard #define TARGET_FPE_INTOVF (2) /* integer overflow */ 6322521d698Sbellard #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ 6332521d698Sbellard #define TARGET_FPE_FLTOVF (4) /* floating point overflow */ 6342521d698Sbellard #define TARGET_FPE_FLTUND (5) /* floating point underflow */ 6352521d698Sbellard #define TARGET_FPE_FLTRES (6) /* floating point inexact result */ 6362521d698Sbellard #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ 6372521d698Sbellard #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ 638*21ba8564SRichard Henderson #define TARGET_FPE_FLTUNK (14) /* undiagnosed fp exception */ 639*21ba8564SRichard Henderson #define TARGET_NSIGFPE 15 6402521d698Sbellard 6412521d698Sbellard /* 6422521d698Sbellard * SIGSEGV si_codes 6432521d698Sbellard */ 6442521d698Sbellard #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ 6452521d698Sbellard #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ 646de2fdd56SChen Gang #define TARGET_SEGV_BNDERR (3) /* failed address bound checks */ 6472521d698Sbellard 6482521d698Sbellard /* 649ffa65c3bSbellard * SIGBUS si_codes 650ffa65c3bSbellard */ 651ffa65c3bSbellard #define TARGET_BUS_ADRALN (1) /* invalid address alignment */ 652b4916d7bSDong Xu Wang #define TARGET_BUS_ADRERR (2) /* non-existent physical address */ 653ffa65c3bSbellard #define TARGET_BUS_OBJERR (3) /* object specific hardware error */ 654de2fdd56SChen Gang /* hardware memory error consumed on a machine check: action required */ 655de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AR (4) 656de2fdd56SChen Gang /* hardware memory error detected in process but not consumed: action optional*/ 657de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AO (5) 658ffa65c3bSbellard 659ffa65c3bSbellard /* 6602521d698Sbellard * SIGTRAP si_codes 6612521d698Sbellard */ 6622521d698Sbellard #define TARGET_TRAP_BRKPT (1) /* process breakpoint */ 6632521d698Sbellard #define TARGET_TRAP_TRACE (2) /* process trace trap */ 664de2fdd56SChen Gang #define TARGET_TRAP_BRANCH (3) /* process taken branch trap */ 665de2fdd56SChen Gang #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */ 6662521d698Sbellard 6679de5e440Sbellard struct target_rlimit { 668992f48a0Sblueswir1 abi_ulong rlim_cur; 669992f48a0Sblueswir1 abi_ulong rlim_max; 6709de5e440Sbellard }; 6719de5e440Sbellard 67281bbe906Stakasi-y@ops.dti.ne.jp #if defined(TARGET_ALPHA) 673e476492eSAurelien Jarno #define TARGET_RLIM_INFINITY 0x7fffffffffffffffull 6746cafd027SMatthias Braun #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32) 67581bbe906Stakasi-y@ops.dti.ne.jp #define TARGET_RLIM_INFINITY 0x7fffffffUL 67681bbe906Stakasi-y@ops.dti.ne.jp #else 67726b746dbSMatthias Braun #define TARGET_RLIM_INFINITY ((abi_ulong)-1) 67881bbe906Stakasi-y@ops.dti.ne.jp #endif 67981bbe906Stakasi-y@ops.dti.ne.jp 680e22b7015SWesley W. Terpstra #if defined(TARGET_MIPS) 681e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 682e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 683e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 684e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 685e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 686e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 7 687e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 8 688e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 5 689e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 9 690e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 6 691e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 692e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 693e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 694e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 695e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 696e22b7015SWesley W. Terpstra #else 697e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 698e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 699e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 700e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 701e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 702e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 5 7036cafd027SMatthias Braun #if defined(TARGET_SPARC) 7046cafd027SMatthias Braun #define TARGET_RLIMIT_NOFILE 6 7056cafd027SMatthias Braun #define TARGET_RLIMIT_NPROC 7 7066cafd027SMatthias Braun #else 707e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 6 708e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 7 7096cafd027SMatthias Braun #endif 710e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 8 711e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 9 712e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 713e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 714e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 715e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 716e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 717e22b7015SWesley W. Terpstra #endif 718e22b7015SWesley W. Terpstra 7199de5e440Sbellard struct target_pollfd { 7209de5e440Sbellard int fd; /* file descriptor */ 7219de5e440Sbellard short events; /* requested events */ 7229de5e440Sbellard short revents; /* returned events */ 7239de5e440Sbellard }; 7249de5e440Sbellard 7258e5a0667Sbellard /* virtual terminal ioctls */ 7260221cfcdSbellard #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ 7270221cfcdSbellard #define TARGET_KDMKTONE 0x4B30 /* generate tone */ 7288e5a0667Sbellard #define TARGET_KDGKBTYPE 0x4b33 729f7680a55SUlrich Hecht #define TARGET_KDSETMODE 0x4b3a 730f7680a55SUlrich Hecht #define TARGET_KDGKBMODE 0x4b44 731f7680a55SUlrich Hecht #define TARGET_KDSKBMODE 0x4b45 7320221cfcdSbellard #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ 7330221cfcdSbellard #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ 734e6fe18fbSCédric VINCENT #define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ 735e6fe18fbSCédric VINCENT #define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ 736e6fe18fbSCédric VINCENT #define TARGET_KDGETLED 0x4B31 /* return current led state */ 737e6fe18fbSCédric VINCENT #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */ 738ca56f5b5SPaul Burton #define TARGET_KDSIGACCEPT 0x4B4E 7398e5a0667Sbellard 740e1be1606SAleksandar Markovic #if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) 741e1be1606SAleksandar Markovic #define TARGET_SIOCATMARK TARGET_IOR('s', 7, int) 742405b4915SHelge Deller #define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t) 743e1be1606SAleksandar Markovic #else 7442521d698Sbellard #define TARGET_SIOCATMARK 0x8905 745405b4915SHelge Deller #define TARGET_SIOCGPGRP 0x8904 746e1be1606SAleksandar Markovic #endif 747405b4915SHelge Deller #define TARGET_SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ 748405b4915SHelge Deller #define TARGET_SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ 7492521d698Sbellard 75031e31b8aSbellard /* Networking ioctls */ 75131e31b8aSbellard #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ 75231e31b8aSbellard #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ 75331e31b8aSbellard #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ 75431e31b8aSbellard #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ 75531e31b8aSbellard #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ 75631e31b8aSbellard #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ 75731e31b8aSbellard #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ 75831e31b8aSbellard #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ 75931e31b8aSbellard #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ 76031e31b8aSbellard #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ 76131e31b8aSbellard #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ 76231e31b8aSbellard #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ 76331e31b8aSbellard #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ 76431e31b8aSbellard #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ 76531e31b8aSbellard #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ 76631e31b8aSbellard #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ 76731e31b8aSbellard #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ 76831e31b8aSbellard #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ 76931e31b8aSbellard #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ 77031e31b8aSbellard #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ 77131e31b8aSbellard #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ 77231e31b8aSbellard #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ 77331e31b8aSbellard #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ 77431e31b8aSbellard #define TARGET_SIOCSIFENCAP 0x8926 77531e31b8aSbellard #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ 77631e31b8aSbellard #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ 77731e31b8aSbellard #define TARGET_SIOCSIFSLAVE 0x8930 77831e31b8aSbellard #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ 77931e31b8aSbellard #define TARGET_SIOCDELMULTI 0x8932 780f63eb01aSPaul Burton #define TARGET_SIOCGIFINDEX 0x8933 78131e31b8aSbellard 78231e31b8aSbellard /* Bridging control calls */ 78331e31b8aSbellard #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ 78431e31b8aSbellard #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ 78531e31b8aSbellard 78631e31b8aSbellard #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ 78731e31b8aSbellard #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ 78831e31b8aSbellard 78931e31b8aSbellard /* ARP cache control calls. */ 79031e31b8aSbellard #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ 79131e31b8aSbellard #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ 79231e31b8aSbellard #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ 79331e31b8aSbellard #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ 79431e31b8aSbellard #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ 79531e31b8aSbellard #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ 79631e31b8aSbellard 79731e31b8aSbellard /* RARP cache control calls. */ 79831e31b8aSbellard #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ 79931e31b8aSbellard #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ 80031e31b8aSbellard #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ 80131e31b8aSbellard 80231e31b8aSbellard /* Driver configuration calls */ 80331e31b8aSbellard #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ 80431e31b8aSbellard #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ 80531e31b8aSbellard 80631e31b8aSbellard /* DLCI configuration calls */ 80731e31b8aSbellard #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ 80831e31b8aSbellard #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ 80931e31b8aSbellard 81086fcd946SLaurent Vivier /* From <linux/wireless.h> */ 81186fcd946SLaurent Vivier 81286fcd946SLaurent Vivier #define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ 81331e31b8aSbellard 814d6d6d6feSMarco A L Barbosa /* From <linux/random.h> */ 815d6d6d6feSMarco A L Barbosa 816d6d6d6feSMarco A L Barbosa #define TARGET_RNDGETENTCNT TARGET_IOR('R', 0x00, int) 817d6d6d6feSMarco A L Barbosa #define TARGET_RNDADDTOENTCNT TARGET_IOW('R', 0x01, int) 818d6d6d6feSMarco A L Barbosa #define TARGET_RNDZAPENTCNT TARGET_IO('R', 0x04) 819d6d6d6feSMarco A L Barbosa #define TARGET_RNDCLEARPOOL TARGET_IO('R', 0x06) 820d6d6d6feSMarco A L Barbosa 82131e31b8aSbellard /* From <linux/fs.h> */ 82231e31b8aSbellard 82331e31b8aSbellard #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ 82431e31b8aSbellard #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ 82531e31b8aSbellard #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ 82631e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ 82731e31b8aSbellard #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ 82831e31b8aSbellard #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ 82931e31b8aSbellard #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ 83031e31b8aSbellard #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ 83131e31b8aSbellard #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ 83231e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ 83331e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ 83431e31b8aSbellard #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ 835fff8c539SAndreas Färber #define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */ 83631e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */ 837c8b0bf54SPeter Maydell #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong) 838c8b0bf54SPeter Maydell #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong) 839edafea13SAlexander Graf #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) 840edafea13SAlexander Graf /* return device size in bytes 841edafea13SAlexander Graf (u64 *arg) */ 8424715856aSPeter Maydell 8434715856aSPeter Maydell #define TARGET_BLKDISCARD TARGET_IO(0x12, 119) 8444715856aSPeter Maydell #define TARGET_BLKIOMIN TARGET_IO(0x12, 120) 8454715856aSPeter Maydell #define TARGET_BLKIOOPT TARGET_IO(0x12, 121) 8464715856aSPeter Maydell #define TARGET_BLKALIGNOFF TARGET_IO(0x12, 122) 8474715856aSPeter Maydell #define TARGET_BLKPBSZGET TARGET_IO(0x12, 123) 8484715856aSPeter Maydell #define TARGET_BLKDISCARDZEROES TARGET_IO(0x12, 124) 8494715856aSPeter Maydell #define TARGET_BLKSECDISCARD TARGET_IO(0x12, 125) 8504715856aSPeter Maydell #define TARGET_BLKROTATIONAL TARGET_IO(0x12, 126) 8514715856aSPeter Maydell #define TARGET_BLKZEROOUT TARGET_IO(0x12, 127) 8524715856aSPeter Maydell 85331e31b8aSbellard #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ 85431e31b8aSbellard #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ 85521992cb6SHelge Deller 85621992cb6SHelge Deller #define TARGET_FICLONE TARGET_IOW(0x94, 9, int) 85721992cb6SHelge Deller #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range) 85821992cb6SHelge Deller 85960807231SPeter Maydell /* Note that the ioctl numbers claim type "long" but the actual type 86060807231SPeter Maydell * used by the kernel is "int". 86160807231SPeter Maydell */ 8621847b7baSPeter Maydell #define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, abi_long) 8631847b7baSPeter Maydell #define TARGET_FS_IOC_SETFLAGS TARGET_IOW('f', 2, abi_long) 86460807231SPeter Maydell 865285da2b9SPeter Maydell #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) 86631e31b8aSbellard 8676c753a63SCortland Tölva /* usb ioctls */ 8686c753a63SCortland Tölva #define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0) 8696c753a63SCortland Tölva #define TARGET_USBDEVFS_BULK TARGET_IOWRU('U', 2) 8706c753a63SCortland Tölva #define TARGET_USBDEVFS_RESETEP TARGET_IORU('U', 3) 8716c753a63SCortland Tölva #define TARGET_USBDEVFS_SETINTERFACE TARGET_IORU('U', 4) 8726c753a63SCortland Tölva #define TARGET_USBDEVFS_SETCONFIGURATION TARGET_IORU('U', 5) 8736c753a63SCortland Tölva #define TARGET_USBDEVFS_GETDRIVER TARGET_IOWU('U', 8) 874a133367eSCortland Tölva #define TARGET_USBDEVFS_SUBMITURB TARGET_IORU('U', 10) 875a133367eSCortland Tölva #define TARGET_USBDEVFS_DISCARDURB TARGET_IO('U', 11) 876a133367eSCortland Tölva #define TARGET_USBDEVFS_REAPURB TARGET_IOWU('U', 12) 877a133367eSCortland Tölva #define TARGET_USBDEVFS_REAPURBNDELAY TARGET_IOWU('U', 13) 8786c753a63SCortland Tölva #define TARGET_USBDEVFS_DISCSIGNAL TARGET_IORU('U', 14) 8796c753a63SCortland Tölva #define TARGET_USBDEVFS_CLAIMINTERFACE TARGET_IORU('U', 15) 8806c753a63SCortland Tölva #define TARGET_USBDEVFS_RELEASEINTERFACE TARGET_IORU('U', 16) 8816c753a63SCortland Tölva #define TARGET_USBDEVFS_CONNECTINFO TARGET_IOWU('U', 17) 8826c753a63SCortland Tölva #define TARGET_USBDEVFS_IOCTL TARGET_IOWRU('U', 18) 8836c753a63SCortland Tölva #define TARGET_USBDEVFS_HUB_PORTINFO TARGET_IORU('U', 19) 8846c753a63SCortland Tölva #define TARGET_USBDEVFS_RESET TARGET_IO('U', 20) 8856c753a63SCortland Tölva #define TARGET_USBDEVFS_CLEAR_HALT TARGET_IORU('U', 21) 8866c753a63SCortland Tölva #define TARGET_USBDEVFS_DISCONNECT TARGET_IO('U', 22) 8876c753a63SCortland Tölva #define TARGET_USBDEVFS_CONNECT TARGET_IO('U', 23) 8886c753a63SCortland Tölva #define TARGET_USBDEVFS_CLAIM_PORT TARGET_IORU('U', 24) 8896c753a63SCortland Tölva #define TARGET_USBDEVFS_RELEASE_PORT TARGET_IORU('U', 25) 8906c753a63SCortland Tölva #define TARGET_USBDEVFS_GET_CAPABILITIES TARGET_IORU('U', 26) 8916c753a63SCortland Tölva #define TARGET_USBDEVFS_DISCONNECT_CLAIM TARGET_IORU('U', 27) 8926c753a63SCortland Tölva #define TARGET_USBDEVFS_DROP_PRIVILEGES TARGET_IOWU('U', 30) 8936c753a63SCortland Tölva #define TARGET_USBDEVFS_GET_SPEED TARGET_IO('U', 31) 8946c753a63SCortland Tölva 89531e31b8aSbellard /* cdrom commands */ 89631e31b8aSbellard #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ 89731e31b8aSbellard #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ 89831e31b8aSbellard #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ 89931e31b8aSbellard #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index 90031e31b8aSbellard (struct cdrom_ti) */ 90131e31b8aSbellard #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header 90231e31b8aSbellard (struct cdrom_tochdr) */ 90331e31b8aSbellard #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry 90431e31b8aSbellard (struct cdrom_tocentry) */ 90531e31b8aSbellard #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ 90631e31b8aSbellard #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ 90731e31b8aSbellard #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ 90831e31b8aSbellard #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume 90931e31b8aSbellard (struct cdrom_volctrl) */ 91031e31b8aSbellard #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data 91131e31b8aSbellard (struct cdrom_subchnl) */ 91231e31b8aSbellard #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) 91331e31b8aSbellard (struct cdrom_read) */ 91431e31b8aSbellard #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) 91531e31b8aSbellard (struct cdrom_read) */ 91631e31b8aSbellard #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ 91731e31b8aSbellard #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ 91831e31b8aSbellard #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session 91931e31b8aSbellard address of multi session disks 92031e31b8aSbellard (struct cdrom_multisession) */ 92131e31b8aSbellard #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" 92231e31b8aSbellard if available (struct cdrom_mcn) */ 92367cc32ebSVeres Lajos #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is deprecated, 924b4916d7bSDong Xu Wang but here anyway for compatibility */ 92531e31b8aSbellard #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ 92631e31b8aSbellard #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting 92731e31b8aSbellard (struct cdrom_volctrl) */ 92831e31b8aSbellard #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) 92931e31b8aSbellard (struct cdrom_read) */ 93031e31b8aSbellard /* 93131e31b8aSbellard * These ioctls are used only used in aztcd.c and optcd.c 93231e31b8aSbellard */ 93331e31b8aSbellard #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ 93431e31b8aSbellard #define TARGET_CDROMSEEK 0x5316 /* seek msf address */ 93531e31b8aSbellard 93631e31b8aSbellard /* 93731e31b8aSbellard * This ioctl is only used by the scsi-cd driver. 93831e31b8aSbellard It is for playing audio in logical block addressing mode. 93931e31b8aSbellard */ 94031e31b8aSbellard #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ 94131e31b8aSbellard 94231e31b8aSbellard /* 94331e31b8aSbellard * These ioctls are only used in optcd.c 94431e31b8aSbellard */ 94531e31b8aSbellard #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ 94631e31b8aSbellard 94731e31b8aSbellard /* 94831e31b8aSbellard * These ioctls are (now) only in ide-cd.c for controlling 94931e31b8aSbellard * drive spindown time. They should be implemented in the 95031e31b8aSbellard * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, 95131e31b8aSbellard * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... 95231e31b8aSbellard * -Erik 95331e31b8aSbellard */ 95431e31b8aSbellard #define TARGET_CDROMGETSPINDOWN 0x531d 95531e31b8aSbellard #define TARGET_CDROMSETSPINDOWN 0x531e 95631e31b8aSbellard 95731e31b8aSbellard /* 95831e31b8aSbellard * These ioctls are implemented through the uniform CD-ROM driver 95931e31b8aSbellard * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM 96031e31b8aSbellard * drivers are eventually ported to the uniform CD-ROM driver interface. 96131e31b8aSbellard */ 96231e31b8aSbellard #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ 96331e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ 96431e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ 96531e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ 96631e31b8aSbellard #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ 96731e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ 96831e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ 96931e31b8aSbellard #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ 97031e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ 97131e31b8aSbellard #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ 97231e31b8aSbellard #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ 97331e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ 97431e31b8aSbellard 97531e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. 97631e31b8aSbellard * Future CDROM ioctls should be kept below 0x537F 97731e31b8aSbellard */ 97831e31b8aSbellard 97931e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */ 98031e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ 98131e31b8aSbellard /* conflict with SCSI_IOCTL_GET_IDLUN */ 98231e31b8aSbellard 98331e31b8aSbellard /* DVD-ROM Specific ioctls */ 98431e31b8aSbellard #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ 98531e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ 98631e31b8aSbellard #define TARGET_DVD_AUTH 0x5392 /* Authentication */ 98731e31b8aSbellard 98831e31b8aSbellard #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ 98931e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ 99031e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ 99131e31b8aSbellard 99231e31b8aSbellard /* HD commands */ 99331e31b8aSbellard 99431e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ 99531e31b8aSbellard #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ 99631e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ 99731e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ 99831e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ 99931e31b8aSbellard #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ 100031e31b8aSbellard #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ 100131e31b8aSbellard #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ 10022521d698Sbellard #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ 100331e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ 100431e31b8aSbellard 100531e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ 100631e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ 100731e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ 100831e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ 100931e31b8aSbellard #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ 101031e31b8aSbellard #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ 101131e31b8aSbellard #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ 101231e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ 10132521d698Sbellard 1014b8005914Sbalrog /* loop ioctls */ 1015b8005914Sbalrog #define TARGET_LOOP_SET_FD 0x4C00 1016b8005914Sbalrog #define TARGET_LOOP_CLR_FD 0x4C01 1017b8005914Sbalrog #define TARGET_LOOP_SET_STATUS 0x4C02 1018b8005914Sbalrog #define TARGET_LOOP_GET_STATUS 0x4C03 1019b8005914Sbalrog #define TARGET_LOOP_SET_STATUS64 0x4C04 1020b8005914Sbalrog #define TARGET_LOOP_GET_STATUS64 0x4C05 1021b8005914Sbalrog #define TARGET_LOOP_CHANGE_FD 0x4C06 10222521d698Sbellard 1023884cdc48SPeter Maydell #define TARGET_LOOP_CTL_ADD 0x4C80 1024884cdc48SPeter Maydell #define TARGET_LOOP_CTL_REMOVE 0x4C81 1025884cdc48SPeter Maydell #define TARGET_LOOP_CTL_GET_FREE 0x4C82 1026884cdc48SPeter Maydell 1027f7680a55SUlrich Hecht /* fb ioctls */ 1028f7680a55SUlrich Hecht #define TARGET_FBIOGET_VSCREENINFO 0x4600 1029f7680a55SUlrich Hecht #define TARGET_FBIOPUT_VSCREENINFO 0x4601 1030f7680a55SUlrich Hecht #define TARGET_FBIOGET_FSCREENINFO 0x4602 103112b81b71SCédric VINCENT #define TARGET_FBIOGETCMAP 0x4604 103212b81b71SCédric VINCENT #define TARGET_FBIOPUTCMAP 0x4605 103312b81b71SCédric VINCENT #define TARGET_FBIOPAN_DISPLAY 0x4606 103412b81b71SCédric VINCENT #define TARGET_FBIOGET_CON2FBMAP 0x460F 103512b81b71SCédric VINCENT #define TARGET_FBIOPUT_CON2FBMAP 0x4610 1036f7680a55SUlrich Hecht 1037f7680a55SUlrich Hecht /* vt ioctls */ 1038f7680a55SUlrich Hecht #define TARGET_VT_OPENQRY 0x5600 1039f7680a55SUlrich Hecht #define TARGET_VT_GETSTATE 0x5603 1040f7680a55SUlrich Hecht #define TARGET_VT_ACTIVATE 0x5606 1041f7680a55SUlrich Hecht #define TARGET_VT_WAITACTIVE 0x5607 1042f7680a55SUlrich Hecht #define TARGET_VT_LOCKSWITCH 0x560b 1043f7680a55SUlrich Hecht #define TARGET_VT_UNLOCKSWITCH 0x560c 1044774750c0SCédric VINCENT #define TARGET_VT_GETMODE 0x5601 1045774750c0SCédric VINCENT #define TARGET_VT_SETMODE 0x5602 1046774750c0SCédric VINCENT #define TARGET_VT_RELDISP 0x5605 1047774750c0SCédric VINCENT #define TARGET_VT_DISALLOCATE 0x5608 1048f7680a55SUlrich Hecht 104956e904ecSAlexander Graf /* device mapper */ 105056e904ecSAlexander Graf #define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00) 105156e904ecSAlexander Graf #define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01) 105256e904ecSAlexander Graf #define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02) 105356e904ecSAlexander Graf #define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03) 105456e904ecSAlexander Graf #define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04) 105556e904ecSAlexander Graf #define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05) 105656e904ecSAlexander Graf #define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06) 105756e904ecSAlexander Graf #define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07) 105856e904ecSAlexander Graf #define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08) 105956e904ecSAlexander Graf #define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09) 106056e904ecSAlexander Graf #define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a) 106156e904ecSAlexander Graf #define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b) 106256e904ecSAlexander Graf #define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c) 106356e904ecSAlexander Graf #define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d) 106456e904ecSAlexander Graf #define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e) 106556e904ecSAlexander Graf #define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f) 106656e904ecSAlexander Graf 10672521d698Sbellard /* from asm/termbits.h */ 10682521d698Sbellard 10693bfd9da1Sbellard #define TARGET_NCC 8 10703bfd9da1Sbellard struct target_termio { 10713bfd9da1Sbellard unsigned short c_iflag; /* input mode flags */ 10723bfd9da1Sbellard unsigned short c_oflag; /* output mode flags */ 10733bfd9da1Sbellard unsigned short c_cflag; /* control mode flags */ 10743bfd9da1Sbellard unsigned short c_lflag; /* local mode flags */ 10752521d698Sbellard unsigned char c_line; /* line discipline */ 10763bfd9da1Sbellard unsigned char c_cc[TARGET_NCC]; /* control characters */ 10772521d698Sbellard }; 10782521d698Sbellard 10793bfd9da1Sbellard struct target_winsize { 10803bfd9da1Sbellard unsigned short ws_row; 10813bfd9da1Sbellard unsigned short ws_col; 10823bfd9da1Sbellard unsigned short ws_xpixel; 10833bfd9da1Sbellard unsigned short ws_ypixel; 10843bfd9da1Sbellard }; 10852521d698Sbellard 10863bfd9da1Sbellard #include "termbits.h" 10872521d698Sbellard 10889e0b74a4SPaul Brook #if defined(TARGET_MIPS) 10899e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x10 10909e0b74a4SPaul Brook #else 10919e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x08 10929e0b74a4SPaul Brook #endif 10939e0b74a4SPaul Brook 1094e44a3e79Saurel32 /* Common */ 10952521d698Sbellard #define TARGET_MAP_SHARED 0x01 /* Share changes */ 10962521d698Sbellard #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ 1097e65be6a7SHelge Deller #if defined(TARGET_HPPA) 1098e65be6a7SHelge Deller #define TARGET_MAP_TYPE 0x03 /* Mask for type of mapping */ 1099e65be6a7SHelge Deller #else 11002521d698Sbellard #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ 1101e65be6a7SHelge Deller #endif 1102e44a3e79Saurel32 1103e44a3e79Saurel32 /* Target specific */ 1104048f6b4dSbellard #if defined(TARGET_MIPS) 1105e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1106048f6b4dSbellard #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 1107048f6b4dSbellard #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 1108048f6b4dSbellard #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 1109048f6b4dSbellard #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 1110048f6b4dSbellard #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 1111048f6b4dSbellard #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 1112540635baSths #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 1113540635baSths #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1114541e1690SHelge Deller #define TARGET_MAP_STACK 0x40000 /* ignored */ 1115541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ 1116e44a3e79Saurel32 #elif defined(TARGET_PPC) 1117e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 11182521d698Sbellard #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 11192521d698Sbellard #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 11202521d698Sbellard #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 11212521d698Sbellard #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 11227ec93196Sj_mayer #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ 11237ec93196Sj_mayer #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ 1124e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1125e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1126541e1690SHelge Deller #define TARGET_MAP_STACK 0x20000 /* ignored */ 1127541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ 1128e44a3e79Saurel32 #elif defined(TARGET_ALPHA) 1129e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1130e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ 1131e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ 1132e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ 1133e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ 1134e44a3e79Saurel32 #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ 1135e44a3e79Saurel32 #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ 1136e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ 1137e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ 1138541e1690SHelge Deller #define TARGET_MAP_STACK 0x80000 /* ignored */ 1139541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x100000 /* create a huge page mapping */ 1140a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 1141a10d1e50SRichard Henderson #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1142a10d1e50SRichard Henderson #define TARGET_MAP_FIXED 0x04 /* Interpret addr exactly */ 1143a10d1e50SRichard Henderson #define TARGET_MAP_GROWSDOWN 0x08000 /* stack-like segment */ 1144a10d1e50SRichard Henderson #define TARGET_MAP_DENYWRITE 0x00800 /* ETXTBSY */ 1145a10d1e50SRichard Henderson #define TARGET_MAP_EXECUTABLE 0x01000 /* mark it as an executable */ 1146a10d1e50SRichard Henderson #define TARGET_MAP_LOCKED 0x02000 /* lock the mapping */ 1147a10d1e50SRichard Henderson #define TARGET_MAP_NORESERVE 0x04000 /* no check for reservations */ 1148a10d1e50SRichard Henderson #define TARGET_MAP_POPULATE 0x10000 /* pop (prefault) pagetables */ 1149a10d1e50SRichard Henderson #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1150541e1690SHelge Deller #define TARGET_MAP_STACK 0x40000 /* ignored */ 1151541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ 1152ba7651fbSMax Filippov #elif defined(TARGET_XTENSA) 1153ba7651fbSMax Filippov #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1154ba7651fbSMax Filippov #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 1155ba7651fbSMax Filippov #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 1156ba7651fbSMax Filippov #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 1157ba7651fbSMax Filippov #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 1158ba7651fbSMax Filippov #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 1159ba7651fbSMax Filippov #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 1160ba7651fbSMax Filippov #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 1161ba7651fbSMax Filippov #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1162ba7651fbSMax Filippov #define TARGET_MAP_STACK 0x40000 1163ba7651fbSMax Filippov #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ 11647ec93196Sj_mayer #else 1165e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1166e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 1167e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 1168e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 1169e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 11702521d698Sbellard #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ 11712521d698Sbellard #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ 1172540635baSths #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1173540635baSths #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1174541e1690SHelge Deller #define TARGET_MAP_STACK 0x20000 /* ignored */ 1175541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ 1176906c1b8eSMike Frysinger #define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ 11777ec93196Sj_mayer #endif 11782521d698Sbellard 117909701199SAlexander Graf #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 118009701199SAlexander Graf || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 1181daa4374aSPeter Maydell || defined(TARGET_CRIS) 11822521d698Sbellard struct target_stat { 11832521d698Sbellard unsigned short st_dev; 11842521d698Sbellard unsigned short __pad1; 1185992f48a0Sblueswir1 abi_ulong st_ino; 11862521d698Sbellard unsigned short st_mode; 11872521d698Sbellard unsigned short st_nlink; 11882521d698Sbellard unsigned short st_uid; 11892521d698Sbellard unsigned short st_gid; 11902521d698Sbellard unsigned short st_rdev; 11912521d698Sbellard unsigned short __pad2; 1192992f48a0Sblueswir1 abi_ulong st_size; 1193992f48a0Sblueswir1 abi_ulong st_blksize; 1194992f48a0Sblueswir1 abi_ulong st_blocks; 1195992f48a0Sblueswir1 abi_ulong target_st_atime; 1196992f48a0Sblueswir1 abi_ulong __unused1; 1197992f48a0Sblueswir1 abi_ulong target_st_mtime; 1198992f48a0Sblueswir1 abi_ulong __unused2; 1199992f48a0Sblueswir1 abi_ulong target_st_ctime; 1200992f48a0Sblueswir1 abi_ulong __unused3; 1201992f48a0Sblueswir1 abi_ulong __unused4; 1202992f48a0Sblueswir1 abi_ulong __unused5; 12032521d698Sbellard }; 12042521d698Sbellard 12052521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely 12062521d698Sbellard * insane amounts of padding around dev_t's. 12072521d698Sbellard */ 120820d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 12092521d698Sbellard struct target_stat64 { 12102521d698Sbellard unsigned short st_dev; 12112521d698Sbellard unsigned char __pad0[10]; 12122521d698Sbellard 12132521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1214992f48a0Sblueswir1 abi_ulong __st_ino; 12152521d698Sbellard 12162521d698Sbellard unsigned int st_mode; 12172521d698Sbellard unsigned int st_nlink; 12182521d698Sbellard 1219992f48a0Sblueswir1 abi_ulong st_uid; 1220992f48a0Sblueswir1 abi_ulong st_gid; 12212521d698Sbellard 12222521d698Sbellard unsigned short st_rdev; 12232521d698Sbellard unsigned char __pad3[10]; 12242521d698Sbellard 12252521d698Sbellard long long st_size; 1226992f48a0Sblueswir1 abi_ulong st_blksize; 12272521d698Sbellard 1228992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1229992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 12302521d698Sbellard 1231992f48a0Sblueswir1 abi_ulong target_st_atime; 1232992f48a0Sblueswir1 abi_ulong __pad5; 12332521d698Sbellard 1234992f48a0Sblueswir1 abi_ulong target_st_mtime; 1235992f48a0Sblueswir1 abi_ulong __pad6; 12362521d698Sbellard 1237992f48a0Sblueswir1 abi_ulong target_st_ctime; 1238992f48a0Sblueswir1 abi_ulong __pad7; /* will be high 32 bits of ctime someday */ 12392521d698Sbellard 12402521d698Sbellard unsigned long long st_ino; 1241541dc0d4SStefan Weil } QEMU_PACKED; 12422521d698Sbellard 1243ce4defa0Spbrook #ifdef TARGET_ARM 124420d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1245ce4defa0Spbrook struct target_eabi_stat64 { 1246ce4defa0Spbrook unsigned long long st_dev; 1247ce4defa0Spbrook unsigned int __pad1; 1248992f48a0Sblueswir1 abi_ulong __st_ino; 1249ce4defa0Spbrook unsigned int st_mode; 1250ce4defa0Spbrook unsigned int st_nlink; 1251ce4defa0Spbrook 1252992f48a0Sblueswir1 abi_ulong st_uid; 1253992f48a0Sblueswir1 abi_ulong st_gid; 1254ce4defa0Spbrook 1255ce4defa0Spbrook unsigned long long st_rdev; 1256ce4defa0Spbrook unsigned int __pad2[2]; 1257ce4defa0Spbrook 1258ce4defa0Spbrook long long st_size; 1259992f48a0Sblueswir1 abi_ulong st_blksize; 1260ce4defa0Spbrook unsigned int __pad3; 1261ce4defa0Spbrook unsigned long long st_blocks; 1262ce4defa0Spbrook 1263992f48a0Sblueswir1 abi_ulong target_st_atime; 1264992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1265ce4defa0Spbrook 1266992f48a0Sblueswir1 abi_ulong target_st_mtime; 1267992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1268ce4defa0Spbrook 1269992f48a0Sblueswir1 abi_ulong target_st_ctime; 1270992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1271ce4defa0Spbrook 1272ce4defa0Spbrook unsigned long long st_ino; 1273541dc0d4SStefan Weil } QEMU_PACKED; 1274ce4defa0Spbrook #endif 1275ce4defa0Spbrook 1276992f48a0Sblueswir1 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 12771b8dd648Sblueswir1 struct target_stat { 12781b8dd648Sblueswir1 unsigned int st_dev; 1279992f48a0Sblueswir1 abi_ulong st_ino; 12801b8dd648Sblueswir1 unsigned int st_mode; 12811b8dd648Sblueswir1 unsigned int st_nlink; 12821b8dd648Sblueswir1 unsigned int st_uid; 12831b8dd648Sblueswir1 unsigned int st_gid; 12841b8dd648Sblueswir1 unsigned int st_rdev; 1285992f48a0Sblueswir1 abi_long st_size; 1286992f48a0Sblueswir1 abi_long target_st_atime; 1287992f48a0Sblueswir1 abi_long target_st_mtime; 1288992f48a0Sblueswir1 abi_long target_st_ctime; 1289992f48a0Sblueswir1 abi_long st_blksize; 1290992f48a0Sblueswir1 abi_long st_blocks; 1291992f48a0Sblueswir1 abi_ulong __unused4[2]; 12921b8dd648Sblueswir1 }; 12931b8dd648Sblueswir1 129420d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 12951b8dd648Sblueswir1 struct target_stat64 { 12961b8dd648Sblueswir1 unsigned char __pad0[6]; 12971b8dd648Sblueswir1 unsigned short st_dev; 12981b8dd648Sblueswir1 12991b8dd648Sblueswir1 uint64_t st_ino; 13001b8dd648Sblueswir1 uint64_t st_nlink; 13011b8dd648Sblueswir1 13021b8dd648Sblueswir1 unsigned int st_mode; 13031b8dd648Sblueswir1 13041b8dd648Sblueswir1 unsigned int st_uid; 13051b8dd648Sblueswir1 unsigned int st_gid; 13061b8dd648Sblueswir1 13071b8dd648Sblueswir1 unsigned char __pad2[6]; 13081b8dd648Sblueswir1 unsigned short st_rdev; 13091b8dd648Sblueswir1 13101b8dd648Sblueswir1 int64_t st_size; 13111b8dd648Sblueswir1 int64_t st_blksize; 13121b8dd648Sblueswir1 13131b8dd648Sblueswir1 unsigned char __pad4[4]; 13141b8dd648Sblueswir1 unsigned int st_blocks; 13151b8dd648Sblueswir1 1316992f48a0Sblueswir1 abi_ulong target_st_atime; 1317992f48a0Sblueswir1 abi_ulong __unused1; 13181b8dd648Sblueswir1 1319992f48a0Sblueswir1 abi_ulong target_st_mtime; 1320992f48a0Sblueswir1 abi_ulong __unused2; 13211b8dd648Sblueswir1 1322992f48a0Sblueswir1 abi_ulong target_st_ctime; 1323992f48a0Sblueswir1 abi_ulong __unused3; 13241b8dd648Sblueswir1 1325992f48a0Sblueswir1 abi_ulong __unused4[3]; 13261b8dd648Sblueswir1 }; 13271b8dd648Sblueswir1 13283bfd9da1Sbellard #elif defined(TARGET_SPARC) 13293bfd9da1Sbellard 13303bfd9da1Sbellard struct target_stat { 13313bfd9da1Sbellard unsigned short st_dev; 1332992f48a0Sblueswir1 abi_ulong st_ino; 13333bfd9da1Sbellard unsigned short st_mode; 13343bfd9da1Sbellard short st_nlink; 13353bfd9da1Sbellard unsigned short st_uid; 13363bfd9da1Sbellard unsigned short st_gid; 13373bfd9da1Sbellard unsigned short st_rdev; 1338992f48a0Sblueswir1 abi_long st_size; 1339992f48a0Sblueswir1 abi_long target_st_atime; 1340992f48a0Sblueswir1 abi_ulong __unused1; 1341992f48a0Sblueswir1 abi_long target_st_mtime; 1342992f48a0Sblueswir1 abi_ulong __unused2; 1343992f48a0Sblueswir1 abi_long target_st_ctime; 1344992f48a0Sblueswir1 abi_ulong __unused3; 1345992f48a0Sblueswir1 abi_long st_blksize; 1346992f48a0Sblueswir1 abi_long st_blocks; 1347992f48a0Sblueswir1 abi_ulong __unused4[2]; 13483bfd9da1Sbellard }; 13493bfd9da1Sbellard 135020d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 13513bfd9da1Sbellard struct target_stat64 { 13523bfd9da1Sbellard unsigned char __pad0[6]; 13533bfd9da1Sbellard unsigned short st_dev; 13543bfd9da1Sbellard 13553bfd9da1Sbellard uint64_t st_ino; 13563bfd9da1Sbellard 13573bfd9da1Sbellard unsigned int st_mode; 13583bfd9da1Sbellard unsigned int st_nlink; 13593bfd9da1Sbellard 13603bfd9da1Sbellard unsigned int st_uid; 13613bfd9da1Sbellard unsigned int st_gid; 13623bfd9da1Sbellard 13633bfd9da1Sbellard unsigned char __pad2[6]; 13643bfd9da1Sbellard unsigned short st_rdev; 13653bfd9da1Sbellard 13663bfd9da1Sbellard unsigned char __pad3[8]; 13673bfd9da1Sbellard 13683bfd9da1Sbellard int64_t st_size; 13693bfd9da1Sbellard unsigned int st_blksize; 13703bfd9da1Sbellard 13713bfd9da1Sbellard unsigned char __pad4[8]; 13723bfd9da1Sbellard unsigned int st_blocks; 13733bfd9da1Sbellard 13743bfd9da1Sbellard unsigned int target_st_atime; 13753bfd9da1Sbellard unsigned int __unused1; 13763bfd9da1Sbellard 13773bfd9da1Sbellard unsigned int target_st_mtime; 13783bfd9da1Sbellard unsigned int __unused2; 13793bfd9da1Sbellard 13803bfd9da1Sbellard unsigned int target_st_ctime; 13813bfd9da1Sbellard unsigned int __unused3; 13823bfd9da1Sbellard 13833bfd9da1Sbellard unsigned int __unused4; 13843bfd9da1Sbellard unsigned int __unused5; 13853bfd9da1Sbellard }; 13863bfd9da1Sbellard 138767867308Sbellard #elif defined(TARGET_PPC) 138867867308Sbellard 138967867308Sbellard struct target_stat { 1390e32448e0Sj_mayer abi_ulong st_dev; 1391992f48a0Sblueswir1 abi_ulong st_ino; 1392325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1393e32448e0Sj_mayer abi_ulong st_nlink; 1394325e651fSj_mayer unsigned int st_mode; 1395325e651fSj_mayer #else 139667867308Sbellard unsigned int st_mode; 139767867308Sbellard unsigned short st_nlink; 1398325e651fSj_mayer #endif 139967867308Sbellard unsigned int st_uid; 140067867308Sbellard unsigned int st_gid; 1401e32448e0Sj_mayer abi_ulong st_rdev; 1402992f48a0Sblueswir1 abi_ulong st_size; 1403992f48a0Sblueswir1 abi_ulong st_blksize; 1404992f48a0Sblueswir1 abi_ulong st_blocks; 1405992f48a0Sblueswir1 abi_ulong target_st_atime; 1406e32448e0Sj_mayer abi_ulong target_st_atime_nsec; 1407992f48a0Sblueswir1 abi_ulong target_st_mtime; 1408e32448e0Sj_mayer abi_ulong target_st_mtime_nsec; 1409992f48a0Sblueswir1 abi_ulong target_st_ctime; 1410e32448e0Sj_mayer abi_ulong target_st_ctime_nsec; 1411992f48a0Sblueswir1 abi_ulong __unused4; 1412992f48a0Sblueswir1 abi_ulong __unused5; 1413325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1414325e651fSj_mayer abi_ulong __unused6; 1415325e651fSj_mayer #endif 141667867308Sbellard }; 141767867308Sbellard 141820d155bcSStefan Weil #if !defined(TARGET_PPC64) || defined(TARGET_ABI32) 141920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1420541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 142167867308Sbellard unsigned long long st_dev; 142267867308Sbellard unsigned long long st_ino; 142367867308Sbellard unsigned int st_mode; 142467867308Sbellard unsigned int st_nlink; 142567867308Sbellard unsigned int st_uid; 142667867308Sbellard unsigned int st_gid; 142767867308Sbellard unsigned long long st_rdev; 1428e1ce5e40Saurel32 unsigned long long __pad0; 142967867308Sbellard long long st_size; 1430e32448e0Sj_mayer int st_blksize; 1431e1ce5e40Saurel32 unsigned int __pad1; 143261322e91SMax Filippov long long st_blocks; /* Number 512-byte blocks allocated. */ 1433e32448e0Sj_mayer int target_st_atime; 1434e32448e0Sj_mayer unsigned int target_st_atime_nsec; 1435e32448e0Sj_mayer int target_st_mtime; 1436e32448e0Sj_mayer unsigned int target_st_mtime_nsec; 1437e32448e0Sj_mayer int target_st_ctime; 1438e32448e0Sj_mayer unsigned int target_st_ctime_nsec; 1439e32448e0Sj_mayer unsigned int __unused4; 1440e32448e0Sj_mayer unsigned int __unused5; 144167867308Sbellard }; 144220d155bcSStefan Weil #endif 144367867308Sbellard 1444b779e29eSEdgar E. Iglesias #elif defined(TARGET_MICROBLAZE) 1445b779e29eSEdgar E. Iglesias 1446b779e29eSEdgar E. Iglesias struct target_stat { 1447b779e29eSEdgar E. Iglesias abi_ulong st_dev; 1448b779e29eSEdgar E. Iglesias abi_ulong st_ino; 1449b779e29eSEdgar E. Iglesias unsigned int st_mode; 1450b779e29eSEdgar E. Iglesias unsigned short st_nlink; 1451b779e29eSEdgar E. Iglesias unsigned int st_uid; 1452b779e29eSEdgar E. Iglesias unsigned int st_gid; 1453b779e29eSEdgar E. Iglesias abi_ulong st_rdev; 1454b779e29eSEdgar E. Iglesias abi_ulong st_size; 1455b779e29eSEdgar E. Iglesias abi_ulong st_blksize; 1456b779e29eSEdgar E. Iglesias abi_ulong st_blocks; 1457b779e29eSEdgar E. Iglesias abi_ulong target_st_atime; 1458b779e29eSEdgar E. Iglesias abi_ulong target_st_atime_nsec; 1459b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime; 1460b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime_nsec; 1461b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime; 1462b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime_nsec; 1463b779e29eSEdgar E. Iglesias abi_ulong __unused4; 1464b779e29eSEdgar E. Iglesias abi_ulong __unused5; 1465b779e29eSEdgar E. Iglesias }; 1466b779e29eSEdgar E. Iglesias 1467b779e29eSEdgar E. Iglesias /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ 146820d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1469541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 1470b779e29eSEdgar E. Iglesias uint64_t st_dev; 1471a523eb06SEdgar E. Iglesias #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1472a523eb06SEdgar E. Iglesias uint32_t pad0; 1473a523eb06SEdgar E. Iglesias uint32_t __st_ino; 1474a523eb06SEdgar E. Iglesias 1475b779e29eSEdgar E. Iglesias uint32_t st_mode; 1476b779e29eSEdgar E. Iglesias uint32_t st_nlink; 1477b779e29eSEdgar E. Iglesias uint32_t st_uid; 1478b779e29eSEdgar E. Iglesias uint32_t st_gid; 1479b779e29eSEdgar E. Iglesias uint64_t st_rdev; 148021ebeb23SEdgar E. Iglesias uint64_t __pad1; 1481b779e29eSEdgar E. Iglesias 1482b779e29eSEdgar E. Iglesias int64_t st_size; 1483b779e29eSEdgar E. Iglesias int32_t st_blksize; 148421ebeb23SEdgar E. Iglesias uint32_t __pad2; 1485b779e29eSEdgar E. Iglesias int64_t st_blocks; /* Number 512-byte blocks allocated. */ 1486b779e29eSEdgar E. Iglesias 1487b779e29eSEdgar E. Iglesias int target_st_atime; 1488b779e29eSEdgar E. Iglesias unsigned int target_st_atime_nsec; 1489b779e29eSEdgar E. Iglesias int target_st_mtime; 1490b779e29eSEdgar E. Iglesias unsigned int target_st_mtime_nsec; 1491b779e29eSEdgar E. Iglesias int target_st_ctime; 1492b779e29eSEdgar E. Iglesias unsigned int target_st_ctime_nsec; 1493a523eb06SEdgar E. Iglesias uint64_t st_ino; 1494b779e29eSEdgar E. Iglesias }; 1495b779e29eSEdgar E. Iglesias 1496e6e5906bSpbrook #elif defined(TARGET_M68K) 1497e6e5906bSpbrook 1498e6e5906bSpbrook struct target_stat { 1499e6e5906bSpbrook unsigned short st_dev; 1500e6e5906bSpbrook unsigned short __pad1; 1501992f48a0Sblueswir1 abi_ulong st_ino; 1502e6e5906bSpbrook unsigned short st_mode; 1503e6e5906bSpbrook unsigned short st_nlink; 1504e6e5906bSpbrook unsigned short st_uid; 1505e6e5906bSpbrook unsigned short st_gid; 1506e6e5906bSpbrook unsigned short st_rdev; 1507e6e5906bSpbrook unsigned short __pad2; 1508992f48a0Sblueswir1 abi_ulong st_size; 1509992f48a0Sblueswir1 abi_ulong st_blksize; 1510992f48a0Sblueswir1 abi_ulong st_blocks; 1511992f48a0Sblueswir1 abi_ulong target_st_atime; 1512992f48a0Sblueswir1 abi_ulong __unused1; 1513992f48a0Sblueswir1 abi_ulong target_st_mtime; 1514992f48a0Sblueswir1 abi_ulong __unused2; 1515992f48a0Sblueswir1 abi_ulong target_st_ctime; 1516992f48a0Sblueswir1 abi_ulong __unused3; 1517992f48a0Sblueswir1 abi_ulong __unused4; 1518992f48a0Sblueswir1 abi_ulong __unused5; 1519e6e5906bSpbrook }; 1520e6e5906bSpbrook 1521e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely 1522e6e5906bSpbrook * insane amounts of padding around dev_t's. 1523e6e5906bSpbrook */ 152420d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1525e6e5906bSpbrook struct target_stat64 { 1526e6e5906bSpbrook unsigned long long st_dev; 1527e6e5906bSpbrook unsigned char __pad1[2]; 1528e6e5906bSpbrook 1529e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1530992f48a0Sblueswir1 abi_ulong __st_ino; 1531e6e5906bSpbrook 1532e6e5906bSpbrook unsigned int st_mode; 1533e6e5906bSpbrook unsigned int st_nlink; 1534e6e5906bSpbrook 1535992f48a0Sblueswir1 abi_ulong st_uid; 1536992f48a0Sblueswir1 abi_ulong st_gid; 1537e6e5906bSpbrook 1538e6e5906bSpbrook unsigned long long st_rdev; 1539e6e5906bSpbrook unsigned char __pad3[2]; 1540e6e5906bSpbrook 1541e6e5906bSpbrook long long st_size; 1542992f48a0Sblueswir1 abi_ulong st_blksize; 1543e6e5906bSpbrook 1544992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 1545992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1546e6e5906bSpbrook 1547992f48a0Sblueswir1 abi_ulong target_st_atime; 1548992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1549e6e5906bSpbrook 1550992f48a0Sblueswir1 abi_ulong target_st_mtime; 1551992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1552e6e5906bSpbrook 1553992f48a0Sblueswir1 abi_ulong target_st_ctime; 1554992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1555e6e5906bSpbrook 1556e6e5906bSpbrook unsigned long long st_ino; 1557541dc0d4SStefan Weil } QEMU_PACKED; 1558e6e5906bSpbrook 1559d26bc211Sths #elif defined(TARGET_ABI_MIPSN64) 1560540635baSths 1561540635baSths /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ 1562540635baSths struct target_stat { 1563540635baSths unsigned int st_dev; 1564540635baSths unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ 1565540635baSths 1566992f48a0Sblueswir1 abi_ulong st_ino; 1567540635baSths 1568540635baSths unsigned int st_mode; 1569540635baSths unsigned int st_nlink; 1570540635baSths 1571540635baSths int st_uid; 1572540635baSths int st_gid; 1573540635baSths 1574540635baSths unsigned int st_rdev; 1575540635baSths unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ 1576540635baSths 1577992f48a0Sblueswir1 abi_ulong st_size; 1578540635baSths 1579540635baSths /* 1580540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1581540635baSths * but we don't have it under Linux. 1582540635baSths */ 1583540635baSths unsigned int target_st_atime; 1584540635baSths unsigned int target_st_atime_nsec; 1585540635baSths 1586540635baSths unsigned int target_st_mtime; 1587540635baSths unsigned int target_st_mtime_nsec; 1588540635baSths 1589540635baSths unsigned int target_st_ctime; 1590540635baSths unsigned int target_st_ctime_nsec; 1591540635baSths 1592540635baSths unsigned int st_blksize; 1593540635baSths unsigned int st_pad2; 1594540635baSths 1595992f48a0Sblueswir1 abi_ulong st_blocks; 1596540635baSths }; 1597540635baSths 1598d26bc211Sths #elif defined(TARGET_ABI_MIPSN32) 1599540635baSths 1600540635baSths struct target_stat { 16011ab2aea2SLeon Alrae abi_ulong st_dev; 16021ab2aea2SLeon Alrae abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 16031ab2aea2SLeon Alrae uint64_t st_ino; 1604540635baSths unsigned int st_mode; 1605540635baSths unsigned int st_nlink; 1606540635baSths int st_uid; 1607540635baSths int st_gid; 16081ab2aea2SLeon Alrae abi_ulong st_rdev; 16091ab2aea2SLeon Alrae abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 16101ab2aea2SLeon Alrae int64_t st_size; 16111ab2aea2SLeon Alrae abi_long target_st_atime; 16121ab2aea2SLeon Alrae abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 16131ab2aea2SLeon Alrae abi_long target_st_mtime; 16141ab2aea2SLeon Alrae abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 16151ab2aea2SLeon Alrae abi_long target_st_ctime; 16161ab2aea2SLeon Alrae abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 16171ab2aea2SLeon Alrae abi_ulong st_blksize; 16181ab2aea2SLeon Alrae abi_ulong st_pad2; 16191ab2aea2SLeon Alrae int64_t st_blocks; 1620540635baSths }; 1621540635baSths 1622d26bc211Sths #elif defined(TARGET_ABI_MIPSO32) 1623048f6b4dSbellard 1624048f6b4dSbellard struct target_stat { 1625048f6b4dSbellard unsigned st_dev; 1626992f48a0Sblueswir1 abi_long st_pad1[3]; /* Reserved for network id */ 1627992f48a0Sblueswir1 abi_ulong st_ino; 1628048f6b4dSbellard unsigned int st_mode; 1629048f6b4dSbellard unsigned int st_nlink; 1630048f6b4dSbellard int st_uid; 1631048f6b4dSbellard int st_gid; 1632048f6b4dSbellard unsigned st_rdev; 1633992f48a0Sblueswir1 abi_long st_pad2[2]; 1634992f48a0Sblueswir1 abi_long st_size; 1635992f48a0Sblueswir1 abi_long st_pad3; 1636048f6b4dSbellard /* 1637048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1638048f6b4dSbellard * but we don't have it under Linux. 1639048f6b4dSbellard */ 1640992f48a0Sblueswir1 abi_long target_st_atime; 1641992f48a0Sblueswir1 abi_long target_st_atime_nsec; 1642992f48a0Sblueswir1 abi_long target_st_mtime; 1643992f48a0Sblueswir1 abi_long target_st_mtime_nsec; 1644992f48a0Sblueswir1 abi_long target_st_ctime; 1645992f48a0Sblueswir1 abi_long target_st_ctime_nsec; 1646992f48a0Sblueswir1 abi_long st_blksize; 1647992f48a0Sblueswir1 abi_long st_blocks; 1648992f48a0Sblueswir1 abi_long st_pad4[14]; 1649048f6b4dSbellard }; 1650048f6b4dSbellard 1651048f6b4dSbellard /* 1652048f6b4dSbellard * This matches struct stat64 in glibc2.1, hence the absolutely insane 1653048f6b4dSbellard * amounts of padding around dev_t's. The memory layout is the same as of 1654048f6b4dSbellard * struct stat of the 64-bit kernel. 1655048f6b4dSbellard */ 1656048f6b4dSbellard 165720d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1658048f6b4dSbellard struct target_stat64 { 1659992f48a0Sblueswir1 abi_ulong st_dev; 1660992f48a0Sblueswir1 abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 1661048f6b4dSbellard 1662048f6b4dSbellard uint64_t st_ino; 1663048f6b4dSbellard 1664048f6b4dSbellard unsigned int st_mode; 1665048f6b4dSbellard unsigned int st_nlink; 1666048f6b4dSbellard 1667048f6b4dSbellard int st_uid; 1668048f6b4dSbellard int st_gid; 1669048f6b4dSbellard 1670992f48a0Sblueswir1 abi_ulong st_rdev; 1671992f48a0Sblueswir1 abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 1672048f6b4dSbellard 1673048f6b4dSbellard int64_t st_size; 1674048f6b4dSbellard 1675048f6b4dSbellard /* 1676048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1677048f6b4dSbellard * but we don't have it under Linux. 1678048f6b4dSbellard */ 1679992f48a0Sblueswir1 abi_long target_st_atime; 1680992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 1681048f6b4dSbellard 1682992f48a0Sblueswir1 abi_long target_st_mtime; 1683992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 1684048f6b4dSbellard 1685992f48a0Sblueswir1 abi_long target_st_ctime; 1686992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 1687048f6b4dSbellard 1688992f48a0Sblueswir1 abi_ulong st_blksize; 1689992f48a0Sblueswir1 abi_ulong st_pad2; 1690048f6b4dSbellard 1691048f6b4dSbellard int64_t st_blocks; 1692048f6b4dSbellard }; 16937a3148a9Sj_mayer 16947a3148a9Sj_mayer #elif defined(TARGET_ALPHA) 16957a3148a9Sj_mayer 16967a3148a9Sj_mayer struct target_stat { 16977a3148a9Sj_mayer unsigned int st_dev; 16987a3148a9Sj_mayer unsigned int st_ino; 16997a3148a9Sj_mayer unsigned int st_mode; 17007a3148a9Sj_mayer unsigned int st_nlink; 17017a3148a9Sj_mayer unsigned int st_uid; 17027a3148a9Sj_mayer unsigned int st_gid; 17037a3148a9Sj_mayer unsigned int st_rdev; 1704992f48a0Sblueswir1 abi_long st_size; 1705992f48a0Sblueswir1 abi_ulong target_st_atime; 1706992f48a0Sblueswir1 abi_ulong target_st_mtime; 1707992f48a0Sblueswir1 abi_ulong target_st_ctime; 17087a3148a9Sj_mayer unsigned int st_blksize; 17097a3148a9Sj_mayer unsigned int st_blocks; 17107a3148a9Sj_mayer unsigned int st_flags; 17117a3148a9Sj_mayer unsigned int st_gen; 17127a3148a9Sj_mayer }; 17137a3148a9Sj_mayer 171420d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 17157a3148a9Sj_mayer struct target_stat64 { 1716992f48a0Sblueswir1 abi_ulong st_dev; 1717992f48a0Sblueswir1 abi_ulong st_ino; 1718992f48a0Sblueswir1 abi_ulong st_rdev; 1719992f48a0Sblueswir1 abi_long st_size; 1720992f48a0Sblueswir1 abi_ulong st_blocks; 17217a3148a9Sj_mayer 17227a3148a9Sj_mayer unsigned int st_mode; 17237a3148a9Sj_mayer unsigned int st_uid; 17247a3148a9Sj_mayer unsigned int st_gid; 17257a3148a9Sj_mayer unsigned int st_blksize; 17267a3148a9Sj_mayer unsigned int st_nlink; 17277a3148a9Sj_mayer unsigned int __pad0; 17287a3148a9Sj_mayer 1729992f48a0Sblueswir1 abi_ulong target_st_atime; 1730992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1731992f48a0Sblueswir1 abi_ulong target_st_mtime; 1732992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1733992f48a0Sblueswir1 abi_ulong target_st_ctime; 1734992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1735992f48a0Sblueswir1 abi_long __unused[3]; 17367a3148a9Sj_mayer }; 17377a3148a9Sj_mayer 17386db45e65Sths #elif defined(TARGET_SH4) 17396db45e65Sths 17406db45e65Sths struct target_stat { 1741992f48a0Sblueswir1 abi_ulong st_dev; 1742992f48a0Sblueswir1 abi_ulong st_ino; 17436db45e65Sths unsigned short st_mode; 17446db45e65Sths unsigned short st_nlink; 17456db45e65Sths unsigned short st_uid; 17466db45e65Sths unsigned short st_gid; 1747992f48a0Sblueswir1 abi_ulong st_rdev; 1748992f48a0Sblueswir1 abi_ulong st_size; 1749992f48a0Sblueswir1 abi_ulong st_blksize; 1750992f48a0Sblueswir1 abi_ulong st_blocks; 1751992f48a0Sblueswir1 abi_ulong target_st_atime; 1752992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1753992f48a0Sblueswir1 abi_ulong target_st_mtime; 1754992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1755992f48a0Sblueswir1 abi_ulong target_st_ctime; 1756992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1757992f48a0Sblueswir1 abi_ulong __unused4; 1758992f48a0Sblueswir1 abi_ulong __unused5; 17596db45e65Sths }; 17606db45e65Sths 17616db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely 17626db45e65Sths * insane amounts of padding around dev_t's. 17636db45e65Sths */ 176420d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1765541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 17666db45e65Sths unsigned long long st_dev; 17676db45e65Sths unsigned char __pad0[4]; 17686db45e65Sths 17696db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1770992f48a0Sblueswir1 abi_ulong __st_ino; 17716db45e65Sths 17726db45e65Sths unsigned int st_mode; 17736db45e65Sths unsigned int st_nlink; 17746db45e65Sths 1775992f48a0Sblueswir1 abi_ulong st_uid; 1776992f48a0Sblueswir1 abi_ulong st_gid; 17776db45e65Sths 17786db45e65Sths unsigned long long st_rdev; 17796db45e65Sths unsigned char __pad3[4]; 17806db45e65Sths 17816db45e65Sths long long st_size; 1782992f48a0Sblueswir1 abi_ulong st_blksize; 17836db45e65Sths 17846db45e65Sths unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ 17856db45e65Sths 1786992f48a0Sblueswir1 abi_ulong target_st_atime; 1787992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 17886db45e65Sths 1789992f48a0Sblueswir1 abi_ulong target_st_mtime; 1790992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 17916db45e65Sths 1792992f48a0Sblueswir1 abi_ulong target_st_ctime; 1793992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 17946db45e65Sths 17956db45e65Sths unsigned long long st_ino; 17966db45e65Sths }; 17976db45e65Sths 1798d2fd1af7Sbellard #elif defined(TARGET_I386) && !defined(TARGET_ABI32) 1799d2fd1af7Sbellard struct target_stat { 1800d2fd1af7Sbellard abi_ulong st_dev; 1801d2fd1af7Sbellard abi_ulong st_ino; 1802d2fd1af7Sbellard abi_ulong st_nlink; 1803d2fd1af7Sbellard 1804d2fd1af7Sbellard unsigned int st_mode; 1805d2fd1af7Sbellard unsigned int st_uid; 1806d2fd1af7Sbellard unsigned int st_gid; 1807d2fd1af7Sbellard unsigned int __pad0; 1808d2fd1af7Sbellard abi_ulong st_rdev; 1809d2fd1af7Sbellard abi_long st_size; 1810d2fd1af7Sbellard abi_long st_blksize; 1811d2fd1af7Sbellard abi_long st_blocks; /* Number 512-byte blocks allocated. */ 1812d2fd1af7Sbellard 1813d2fd1af7Sbellard abi_ulong target_st_atime; 1814d2fd1af7Sbellard abi_ulong target_st_atime_nsec; 1815d2fd1af7Sbellard abi_ulong target_st_mtime; 1816d2fd1af7Sbellard abi_ulong target_st_mtime_nsec; 1817d2fd1af7Sbellard abi_ulong target_st_ctime; 1818d2fd1af7Sbellard abi_ulong target_st_ctime_nsec; 1819d2fd1af7Sbellard 1820d2fd1af7Sbellard abi_long __unused[3]; 1821d2fd1af7Sbellard }; 1822a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 1823a4c075f1SUlrich Hecht struct target_stat { 1824a4c075f1SUlrich Hecht abi_ulong st_dev; 1825a4c075f1SUlrich Hecht abi_ulong st_ino; 1826a4c075f1SUlrich Hecht abi_ulong st_nlink; 1827a4c075f1SUlrich Hecht unsigned int st_mode; 1828a4c075f1SUlrich Hecht unsigned int st_uid; 1829a4c075f1SUlrich Hecht unsigned int st_gid; 1830a4c075f1SUlrich Hecht unsigned int __pad1; 1831a4c075f1SUlrich Hecht abi_ulong st_rdev; 1832a4c075f1SUlrich Hecht abi_ulong st_size; 1833a4c075f1SUlrich Hecht abi_ulong target_st_atime; 1834a4c075f1SUlrich Hecht abi_ulong target_st_atime_nsec; 1835a4c075f1SUlrich Hecht abi_ulong target_st_mtime; 1836a4c075f1SUlrich Hecht abi_ulong target_st_mtime_nsec; 1837a4c075f1SUlrich Hecht abi_ulong target_st_ctime; 1838a4c075f1SUlrich Hecht abi_ulong target_st_ctime_nsec; 1839a4c075f1SUlrich Hecht abi_ulong st_blksize; 1840a4c075f1SUlrich Hecht abi_long st_blocks; 1841a4c075f1SUlrich Hecht abi_ulong __unused[3]; 1842a4c075f1SUlrich Hecht }; 184309701199SAlexander Graf #elif defined(TARGET_AARCH64) 184409701199SAlexander Graf struct target_stat { 184509701199SAlexander Graf abi_ulong st_dev; 184609701199SAlexander Graf abi_ulong st_ino; 184709701199SAlexander Graf unsigned int st_mode; 184809701199SAlexander Graf unsigned int st_nlink; 184909701199SAlexander Graf unsigned int st_uid; 185009701199SAlexander Graf unsigned int st_gid; 185109701199SAlexander Graf abi_ulong st_rdev; 185209701199SAlexander Graf abi_ulong _pad1; 185309701199SAlexander Graf abi_long st_size; 185409701199SAlexander Graf int st_blksize; 185509701199SAlexander Graf int __pad2; 185609701199SAlexander Graf abi_long st_blocks; 185709701199SAlexander Graf abi_long target_st_atime; 185809701199SAlexander Graf abi_ulong target_st_atime_nsec; 185909701199SAlexander Graf abi_long target_st_mtime; 186009701199SAlexander Graf abi_ulong target_st_mtime_nsec; 186109701199SAlexander Graf abi_long target_st_ctime; 186209701199SAlexander Graf abi_ulong target_st_ctime_nsec; 186309701199SAlexander Graf unsigned int __unused[2]; 186409701199SAlexander Graf }; 1865ba7651fbSMax Filippov #elif defined(TARGET_XTENSA) 1866ba7651fbSMax Filippov struct target_stat { 1867ba7651fbSMax Filippov abi_ulong st_dev; 1868ba7651fbSMax Filippov abi_ulong st_ino; 1869ba7651fbSMax Filippov unsigned int st_mode; 1870ba7651fbSMax Filippov unsigned int st_nlink; 1871ba7651fbSMax Filippov unsigned int st_uid; 1872ba7651fbSMax Filippov unsigned int st_gid; 1873ba7651fbSMax Filippov abi_ulong st_rdev; 1874ba7651fbSMax Filippov abi_long st_size; 1875ba7651fbSMax Filippov abi_ulong st_blksize; 1876ba7651fbSMax Filippov abi_ulong st_blocks; 1877ba7651fbSMax Filippov abi_ulong target_st_atime; 1878ba7651fbSMax Filippov abi_ulong target_st_atime_nsec; 1879ba7651fbSMax Filippov abi_ulong target_st_mtime; 1880ba7651fbSMax Filippov abi_ulong target_st_mtime_nsec; 1881ba7651fbSMax Filippov abi_ulong target_st_ctime; 1882ba7651fbSMax Filippov abi_ulong target_st_ctime_nsec; 1883ba7651fbSMax Filippov abi_ulong __unused4; 1884ba7651fbSMax Filippov abi_ulong __unused5; 1885ba7651fbSMax Filippov }; 1886ba7651fbSMax Filippov 1887ba7651fbSMax Filippov #define TARGET_HAS_STRUCT_STAT64 1888ba7651fbSMax Filippov struct target_stat64 { 1889ba7651fbSMax Filippov uint64_t st_dev; /* Device */ 1890ba7651fbSMax Filippov uint64_t st_ino; /* File serial number */ 1891ba7651fbSMax Filippov unsigned int st_mode; /* File mode. */ 1892ba7651fbSMax Filippov unsigned int st_nlink; /* Link count. */ 1893ba7651fbSMax Filippov unsigned int st_uid; /* User ID of the file's owner. */ 1894ba7651fbSMax Filippov unsigned int st_gid; /* Group ID of the file's group. */ 1895ba7651fbSMax Filippov uint64_t st_rdev; /* Device number, if device. */ 1896ba7651fbSMax Filippov int64_t st_size; /* Size of file, in bytes. */ 1897ba7651fbSMax Filippov abi_ulong st_blksize; /* Optimal block size for I/O. */ 1898ba7651fbSMax Filippov abi_ulong __unused2; 1899ba7651fbSMax Filippov uint64_t st_blocks; /* Number 512-byte blocks allocated. */ 1900ba7651fbSMax Filippov abi_ulong target_st_atime; /* Time of last access. */ 1901ba7651fbSMax Filippov abi_ulong target_st_atime_nsec; 1902ba7651fbSMax Filippov abi_ulong target_st_mtime; /* Time of last modification. */ 1903ba7651fbSMax Filippov abi_ulong target_st_mtime_nsec; 1904ba7651fbSMax Filippov abi_ulong target_st_ctime; /* Time of last status change. */ 1905ba7651fbSMax Filippov abi_ulong target_st_ctime_nsec; 1906ba7651fbSMax Filippov abi_ulong __unused4; 1907ba7651fbSMax Filippov abi_ulong __unused5; 1908ba7651fbSMax Filippov }; 1909ba7651fbSMax Filippov 1910a0a839b6SMarek Vasut #elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) || \ 191147ae93cdSMichael Clark defined(TARGET_NIOS2) || defined(TARGET_RISCV) 1912c7819dfbSPeter Maydell 1913c7819dfbSPeter Maydell /* These are the asm-generic versions of the stat and stat64 structures */ 1914c7819dfbSPeter Maydell 1915d962783eSJia Liu struct target_stat { 1916d962783eSJia Liu abi_ulong st_dev; 1917d962783eSJia Liu abi_ulong st_ino; 1918d962783eSJia Liu unsigned int st_mode; 1919c7819dfbSPeter Maydell unsigned int st_nlink; 1920d962783eSJia Liu unsigned int st_uid; 1921d962783eSJia Liu unsigned int st_gid; 1922d962783eSJia Liu abi_ulong st_rdev; 1923c7819dfbSPeter Maydell abi_ulong __pad1; 1924d962783eSJia Liu abi_long st_size; 1925c7819dfbSPeter Maydell int st_blksize; 1926c7819dfbSPeter Maydell int __pad2; 1927c7819dfbSPeter Maydell abi_long st_blocks; 1928c7819dfbSPeter Maydell abi_long target_st_atime; 1929d962783eSJia Liu abi_ulong target_st_atime_nsec; 1930c7819dfbSPeter Maydell abi_long target_st_mtime; 1931d962783eSJia Liu abi_ulong target_st_mtime_nsec; 1932c7819dfbSPeter Maydell abi_long target_st_ctime; 1933d962783eSJia Liu abi_ulong target_st_ctime_nsec; 1934c7819dfbSPeter Maydell unsigned int __unused4; 1935c7819dfbSPeter Maydell unsigned int __unused5; 1936d962783eSJia Liu }; 1937c7819dfbSPeter Maydell 193847ae93cdSMichael Clark #if !defined(TARGET_RISCV64) 193920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1940c7819dfbSPeter Maydell struct target_stat64 { 1941c7819dfbSPeter Maydell uint64_t st_dev; 1942c7819dfbSPeter Maydell uint64_t st_ino; 1943c7819dfbSPeter Maydell unsigned int st_mode; 1944c7819dfbSPeter Maydell unsigned int st_nlink; 1945c7819dfbSPeter Maydell unsigned int st_uid; 1946c7819dfbSPeter Maydell unsigned int st_gid; 1947c7819dfbSPeter Maydell uint64_t st_rdev; 1948c7819dfbSPeter Maydell uint64_t __pad1; 1949c7819dfbSPeter Maydell int64_t st_size; 1950c7819dfbSPeter Maydell int st_blksize; 1951c7819dfbSPeter Maydell int __pad2; 1952c7819dfbSPeter Maydell int64_t st_blocks; 1953c7819dfbSPeter Maydell int target_st_atime; 1954c7819dfbSPeter Maydell unsigned int target_st_atime_nsec; 1955c7819dfbSPeter Maydell int target_st_mtime; 1956c7819dfbSPeter Maydell unsigned int target_st_mtime_nsec; 1957c7819dfbSPeter Maydell int target_st_ctime; 1958c7819dfbSPeter Maydell unsigned int target_st_ctime_nsec; 1959c7819dfbSPeter Maydell unsigned int __unused4; 1960c7819dfbSPeter Maydell unsigned int __unused5; 1961c7819dfbSPeter Maydell }; 196247ae93cdSMichael Clark #endif 1963c7819dfbSPeter Maydell 1964a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 1965a10d1e50SRichard Henderson 1966a10d1e50SRichard Henderson struct target_stat { 1967a10d1e50SRichard Henderson abi_uint st_dev; 1968a10d1e50SRichard Henderson abi_uint st_ino; 1969a10d1e50SRichard Henderson abi_ushort st_mode; 1970a10d1e50SRichard Henderson abi_ushort st_nlink; 1971a10d1e50SRichard Henderson abi_ushort _res1; 1972a10d1e50SRichard Henderson abi_ushort _res2; 1973a10d1e50SRichard Henderson abi_uint st_rdev; 1974a10d1e50SRichard Henderson abi_int st_size; 1975a10d1e50SRichard Henderson abi_int target_st_atime; 1976a10d1e50SRichard Henderson abi_uint target_st_atime_nsec; 1977a10d1e50SRichard Henderson abi_int target_st_mtime; 1978a10d1e50SRichard Henderson abi_uint target_st_mtime_nsec; 1979a10d1e50SRichard Henderson abi_int target_st_ctime; 1980a10d1e50SRichard Henderson abi_uint target_st_ctime_nsec; 1981a10d1e50SRichard Henderson abi_int st_blksize; 1982a10d1e50SRichard Henderson abi_int st_blocks; 1983a10d1e50SRichard Henderson abi_uint _unused1; 1984a10d1e50SRichard Henderson abi_uint _unused2; 1985a10d1e50SRichard Henderson abi_uint _unused3; 1986a10d1e50SRichard Henderson abi_uint _unused4; 1987a10d1e50SRichard Henderson abi_ushort _unused5; 1988a10d1e50SRichard Henderson abi_short st_fstype; 1989a10d1e50SRichard Henderson abi_uint st_realdev; 1990a10d1e50SRichard Henderson abi_ushort st_basemode; 1991a10d1e50SRichard Henderson abi_ushort _unused6; 1992a10d1e50SRichard Henderson abi_uint st_uid; 1993a10d1e50SRichard Henderson abi_uint st_gid; 1994a10d1e50SRichard Henderson abi_uint _unused7[3]; 1995a10d1e50SRichard Henderson }; 1996a10d1e50SRichard Henderson 1997a10d1e50SRichard Henderson #define TARGET_HAS_STRUCT_STAT64 1998a10d1e50SRichard Henderson struct target_stat64 { 1999a10d1e50SRichard Henderson uint64_t st_dev; 2000a10d1e50SRichard Henderson abi_uint _pad1; 2001a10d1e50SRichard Henderson abi_uint _res1; 2002a10d1e50SRichard Henderson abi_uint st_mode; 2003a10d1e50SRichard Henderson abi_uint st_nlink; 2004a10d1e50SRichard Henderson abi_uint st_uid; 2005a10d1e50SRichard Henderson abi_uint st_gid; 2006a10d1e50SRichard Henderson uint64_t st_rdev; 2007a10d1e50SRichard Henderson abi_uint _pad2; 2008a10d1e50SRichard Henderson int64_t st_size; 2009a10d1e50SRichard Henderson abi_int st_blksize; 2010a10d1e50SRichard Henderson int64_t st_blocks; 2011a10d1e50SRichard Henderson abi_int target_st_atime; 2012a10d1e50SRichard Henderson abi_uint target_st_atime_nsec; 2013a10d1e50SRichard Henderson abi_int target_st_mtime; 2014a10d1e50SRichard Henderson abi_uint target_st_mtime_nsec; 2015a10d1e50SRichard Henderson abi_int target_st_ctime; 2016a10d1e50SRichard Henderson abi_uint target_st_ctime_nsec; 2017a10d1e50SRichard Henderson uint64_t st_ino; 2018a10d1e50SRichard Henderson }; 2019a10d1e50SRichard Henderson 2020048f6b4dSbellard #else 2021048f6b4dSbellard #error unsupported CPU 2022048f6b4dSbellard #endif 20232521d698Sbellard 20244ce6f8deSths typedef struct { 20254ce6f8deSths int val[2]; 2026c227f099SAnthony Liguori } target_fsid_t; 20274ce6f8deSths 202856c8f68fSbellard #ifdef TARGET_MIPS 2029d26bc211Sths #ifdef TARGET_ABI_MIPSN32 2030540635baSths struct target_statfs { 2031540635baSths int32_t f_type; 2032540635baSths int32_t f_bsize; 2033540635baSths int32_t f_frsize; /* Fragment size - unsupported */ 2034540635baSths int32_t f_blocks; 2035540635baSths int32_t f_bfree; 2036540635baSths int32_t f_files; 2037540635baSths int32_t f_ffree; 2038540635baSths int32_t f_bavail; 2039540635baSths 2040540635baSths /* Linux specials */ 2041c227f099SAnthony Liguori target_fsid_t f_fsid; 2042540635baSths int32_t f_namelen; 2043d4247ec2SShea Levy int32_t f_flags; 2044d4247ec2SShea Levy int32_t f_spare[5]; 2045540635baSths }; 2046540635baSths #else 204756c8f68fSbellard struct target_statfs { 2048992f48a0Sblueswir1 abi_long f_type; 2049992f48a0Sblueswir1 abi_long f_bsize; 2050992f48a0Sblueswir1 abi_long f_frsize; /* Fragment size - unsupported */ 2051992f48a0Sblueswir1 abi_long f_blocks; 2052992f48a0Sblueswir1 abi_long f_bfree; 2053992f48a0Sblueswir1 abi_long f_files; 2054992f48a0Sblueswir1 abi_long f_ffree; 2055992f48a0Sblueswir1 abi_long f_bavail; 205656c8f68fSbellard 205756c8f68fSbellard /* Linux specials */ 2058c227f099SAnthony Liguori target_fsid_t f_fsid; 2059992f48a0Sblueswir1 abi_long f_namelen; 2060d4247ec2SShea Levy abi_long f_flags; 2061d4247ec2SShea Levy abi_long f_spare[5]; 206256c8f68fSbellard }; 2063540635baSths #endif 206456c8f68fSbellard 206556c8f68fSbellard struct target_statfs64 { 206656c8f68fSbellard uint32_t f_type; 206756c8f68fSbellard uint32_t f_bsize; 206856c8f68fSbellard uint32_t f_frsize; /* Fragment size - unsupported */ 206956c8f68fSbellard uint32_t __pad; 207056c8f68fSbellard uint64_t f_blocks; 207156c8f68fSbellard uint64_t f_bfree; 207256c8f68fSbellard uint64_t f_files; 207356c8f68fSbellard uint64_t f_ffree; 207456c8f68fSbellard uint64_t f_bavail; 2075c227f099SAnthony Liguori target_fsid_t f_fsid; 207656c8f68fSbellard uint32_t f_namelen; 2077d4247ec2SShea Levy uint32_t f_flags; 2078d4247ec2SShea Levy uint32_t f_spare[5]; 207956c8f68fSbellard }; 2080c4d10628Sbalrog #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ 208147ae93cdSMichael Clark defined(TARGET_SPARC64) || defined(TARGET_AARCH64) || \ 208247ae93cdSMichael Clark defined(TARGET_RISCV)) && !defined(TARGET_ABI32) 2083325e651fSj_mayer struct target_statfs { 2084325e651fSj_mayer abi_long f_type; 2085325e651fSj_mayer abi_long f_bsize; 2086325e651fSj_mayer abi_long f_blocks; 2087325e651fSj_mayer abi_long f_bfree; 2088325e651fSj_mayer abi_long f_bavail; 2089325e651fSj_mayer abi_long f_files; 2090325e651fSj_mayer abi_long f_ffree; 2091c227f099SAnthony Liguori target_fsid_t f_fsid; 2092325e651fSj_mayer abi_long f_namelen; 2093325e651fSj_mayer abi_long f_frsize; 2094d4247ec2SShea Levy abi_long f_flags; 2095d4247ec2SShea Levy abi_long f_spare[4]; 2096325e651fSj_mayer }; 2097325e651fSj_mayer 2098325e651fSj_mayer struct target_statfs64 { 2099325e651fSj_mayer abi_long f_type; 2100325e651fSj_mayer abi_long f_bsize; 2101325e651fSj_mayer abi_long f_blocks; 2102325e651fSj_mayer abi_long f_bfree; 2103325e651fSj_mayer abi_long f_bavail; 2104325e651fSj_mayer abi_long f_files; 2105325e651fSj_mayer abi_long f_ffree; 2106c227f099SAnthony Liguori target_fsid_t f_fsid; 2107325e651fSj_mayer abi_long f_namelen; 2108325e651fSj_mayer abi_long f_frsize; 2109d4247ec2SShea Levy abi_long f_flags; 2110d4247ec2SShea Levy abi_long f_spare[4]; 2111325e651fSj_mayer }; 2112a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 2113a4c075f1SUlrich Hecht struct target_statfs { 2114a4c075f1SUlrich Hecht int32_t f_type; 2115a4c075f1SUlrich Hecht int32_t f_bsize; 2116a4c075f1SUlrich Hecht abi_long f_blocks; 2117a4c075f1SUlrich Hecht abi_long f_bfree; 2118a4c075f1SUlrich Hecht abi_long f_bavail; 2119a4c075f1SUlrich Hecht abi_long f_files; 2120a4c075f1SUlrich Hecht abi_long f_ffree; 2121a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2122a4c075f1SUlrich Hecht int32_t f_namelen; 2123a4c075f1SUlrich Hecht int32_t f_frsize; 2124d4247ec2SShea Levy int32_t f_flags; 2125d4247ec2SShea Levy int32_t f_spare[4]; 2126d4247ec2SShea Levy 2127a4c075f1SUlrich Hecht }; 2128a4c075f1SUlrich Hecht 2129a4c075f1SUlrich Hecht struct target_statfs64 { 2130a4c075f1SUlrich Hecht int32_t f_type; 2131a4c075f1SUlrich Hecht int32_t f_bsize; 2132a4c075f1SUlrich Hecht abi_long f_blocks; 2133a4c075f1SUlrich Hecht abi_long f_bfree; 2134a4c075f1SUlrich Hecht abi_long f_bavail; 2135a4c075f1SUlrich Hecht abi_long f_files; 2136a4c075f1SUlrich Hecht abi_long f_ffree; 2137a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2138a4c075f1SUlrich Hecht int32_t f_namelen; 2139a4c075f1SUlrich Hecht int32_t f_frsize; 2140d4247ec2SShea Levy int32_t f_flags; 2141d4247ec2SShea Levy int32_t f_spare[4]; 2142a4c075f1SUlrich Hecht }; 214356c8f68fSbellard #else 214456c8f68fSbellard struct target_statfs { 214556c8f68fSbellard uint32_t f_type; 214656c8f68fSbellard uint32_t f_bsize; 214756c8f68fSbellard uint32_t f_blocks; 214856c8f68fSbellard uint32_t f_bfree; 214956c8f68fSbellard uint32_t f_bavail; 215056c8f68fSbellard uint32_t f_files; 215156c8f68fSbellard uint32_t f_ffree; 2152c227f099SAnthony Liguori target_fsid_t f_fsid; 215356c8f68fSbellard uint32_t f_namelen; 215456c8f68fSbellard uint32_t f_frsize; 2155d4247ec2SShea Levy uint32_t f_flags; 2156d4247ec2SShea Levy uint32_t f_spare[4]; 215756c8f68fSbellard }; 215856c8f68fSbellard 215956c8f68fSbellard struct target_statfs64 { 216056c8f68fSbellard uint32_t f_type; 216156c8f68fSbellard uint32_t f_bsize; 216256c8f68fSbellard uint64_t f_blocks; 216356c8f68fSbellard uint64_t f_bfree; 216456c8f68fSbellard uint64_t f_bavail; 216556c8f68fSbellard uint64_t f_files; 216656c8f68fSbellard uint64_t f_ffree; 2167c227f099SAnthony Liguori target_fsid_t f_fsid; 216856c8f68fSbellard uint32_t f_namelen; 216956c8f68fSbellard uint32_t f_frsize; 2170d4247ec2SShea Levy uint32_t f_flags; 2171d4247ec2SShea Levy uint32_t f_spare[4]; 217256c8f68fSbellard }; 217356c8f68fSbellard #endif 217456c8f68fSbellard 21757e22e546SUlrich Hecht #define TARGET_F_LINUX_SPECIFIC_BASE 1024 21767e22e546SUlrich Hecht #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0) 21777e22e546SUlrich Hecht #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1) 21787e22e546SUlrich Hecht #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) 21797e3b92ecSPeter Maydell #define TARGET_F_SETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 7) 21807e3b92ecSPeter Maydell #define TARGET_F_GETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 8) 21817e22e546SUlrich Hecht #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2) 21827e22e546SUlrich Hecht 21835de7706eSLaurent Vivier #include "target_fcntl.h" 21848d5d3004SAndreas Schwab 21852521d698Sbellard /* soundcard defines */ 218667cc32ebSVeres Lajos /* XXX: convert them all to arch independent entries */ 21872521d698Sbellard #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); 21882521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 21892521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 21902521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 21912521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA 0xc0144302 21922521d698Sbellard #define TARGET_SNDCTL_COPR_RESET 0x00004300 21932521d698Sbellard #define TARGET_SNDCTL_COPR_RUN 0xc0144306 21942521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 21952521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE 0x40144305 21962521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA 0x40144304 21972521d698Sbellard #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) 21982521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) 21992521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) 22002521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) 22012521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) 22022521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) 22032521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) 22042521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) 22052521d698Sbellard #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) 22062521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) 22072521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) 22082521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) 22092521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) 22102521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) 22112521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) 22122521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) 22132521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) 22142521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) 22155f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19) 22165f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20) 22172521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e 22182521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 22192521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 22202521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 22212521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 22222521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f 22232521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 22242521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO 0xc074510c 22252521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 22262521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 22272521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 22282521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 22292521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 22302521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 22312521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 22322521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 22332521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b 22342521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a 22352521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 22362521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC 0x00005111 22372521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 22382521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET 0x00005100 22392521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 22402521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC 0x00005101 22412521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 22422521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d 22432521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d 22442521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 22452521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e 22462521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 22472521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME 0x40045407 22482521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT 0x40045408 22492521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 22502521d698Sbellard #define TARGET_SNDCTL_TMR_START 0x00005402 22512521d698Sbellard #define TARGET_SNDCTL_TMR_STOP 0x00005403 22522521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 22532521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 22542521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE 0x80045002 22552521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 22562521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS 0x80045005 22572521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 22582521d698Sbellard #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) 22592521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 22602521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) 22612521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) 22622521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) 22632521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) 22642521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) 22652521d698Sbellard 22662521d698Sbellard #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) 22672521d698Sbellard 22682521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) 22692521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) 22702521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) 22712521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) 22722521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) 22732521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) 22742521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) 22752521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) 22762521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) 22772521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) 22782521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) 22792521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) 22802521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) 22812521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) 22822521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) 22832521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) 22842521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) 22852521d698Sbellard 22862521d698Sbellard /* Obsolete macros */ 22872521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) 22882521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) 22892521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) 22902521d698Sbellard 22912521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) 22922521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) 22932521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) 22942521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) 22952521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) 22962521d698Sbellard 22972521d698Sbellard #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) 22982521d698Sbellard 22992521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) 23002521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) 23012521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) 23022521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) 23032521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) 23042521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) 23052521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) 23062521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) 23072521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) 23082521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) 23092521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) 23102521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) 23112521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) 23122521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) 23132521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) 23142521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) 23152521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) 23162521d698Sbellard 23172521d698Sbellard /* Obsolete macros */ 23182521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) 23192521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) 23202521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) 23212521d698Sbellard 23222521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) 23232521d698Sbellard 23242521d698Sbellard /* vfat ioctls */ 23252521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) 23262521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) 2327a5448a7dSbellard 2328f443e396SPeter Maydell struct target_mtop { 2329f443e396SPeter Maydell abi_short mt_op; 2330f443e396SPeter Maydell abi_int mt_count; 2331f443e396SPeter Maydell }; 2332f443e396SPeter Maydell 2333f443e396SPeter Maydell #if defined(TARGET_SPARC) || defined(TARGET_MIPS) 2334f443e396SPeter Maydell typedef abi_long target_kernel_daddr_t; 2335f443e396SPeter Maydell #else 2336f443e396SPeter Maydell typedef abi_int target_kernel_daddr_t; 2337f443e396SPeter Maydell #endif 2338f443e396SPeter Maydell 2339f443e396SPeter Maydell struct target_mtget { 2340f443e396SPeter Maydell abi_long mt_type; 2341f443e396SPeter Maydell abi_long mt_resid; 2342f443e396SPeter Maydell abi_long mt_dsreg; 2343f443e396SPeter Maydell abi_long mt_gstat; 2344f443e396SPeter Maydell abi_long mt_erreg; 2345f443e396SPeter Maydell target_kernel_daddr_t mt_fileno; 2346f443e396SPeter Maydell target_kernel_daddr_t mt_blkno; 2347f443e396SPeter Maydell }; 2348f443e396SPeter Maydell 2349f443e396SPeter Maydell struct target_mtpos { 2350f443e396SPeter Maydell abi_long mt_blkno; 2351f443e396SPeter Maydell }; 2352f443e396SPeter Maydell 2353f443e396SPeter Maydell #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct target_mtop) 2354f443e396SPeter Maydell #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct target_mtget) 2355f443e396SPeter Maydell #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct target_mtpos) 23568fbd6b52Sbalrog 2357a5448a7dSbellard struct target_sysinfo { 2358992f48a0Sblueswir1 abi_long uptime; /* Seconds since boot */ 2359992f48a0Sblueswir1 abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */ 2360992f48a0Sblueswir1 abi_ulong totalram; /* Total usable main memory size */ 2361992f48a0Sblueswir1 abi_ulong freeram; /* Available memory size */ 2362992f48a0Sblueswir1 abi_ulong sharedram; /* Amount of shared memory */ 2363992f48a0Sblueswir1 abi_ulong bufferram; /* Memory used by buffers */ 2364992f48a0Sblueswir1 abi_ulong totalswap; /* Total swap space size */ 2365992f48a0Sblueswir1 abi_ulong freeswap; /* swap space still available */ 2366a5448a7dSbellard unsigned short procs; /* Number of current processes */ 2367a5448a7dSbellard unsigned short pad; /* explicit padding for m68k */ 2368992f48a0Sblueswir1 abi_ulong totalhigh; /* Total high memory size */ 2369992f48a0Sblueswir1 abi_ulong freehigh; /* Available high memory size */ 2370a5448a7dSbellard unsigned int mem_unit; /* Memory unit size in bytes */ 2371992f48a0Sblueswir1 char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 2372a5448a7dSbellard }; 23733532fa74Sbellard 23746556a833Saurel32 struct linux_dirent { 23756556a833Saurel32 long d_ino; 23766556a833Saurel32 unsigned long d_off; 23776556a833Saurel32 unsigned short d_reclen; 23786556a833Saurel32 char d_name[256]; /* We must not include limits.h! */ 23796556a833Saurel32 }; 23806556a833Saurel32 23816556a833Saurel32 struct linux_dirent64 { 23826556a833Saurel32 uint64_t d_ino; 23836556a833Saurel32 int64_t d_off; 23846556a833Saurel32 unsigned short d_reclen; 23856556a833Saurel32 unsigned char d_type; 23866556a833Saurel32 char d_name[256]; 23876556a833Saurel32 }; 23886556a833Saurel32 238924e1003aSaurel32 struct target_mq_attr { 239024e1003aSaurel32 abi_long mq_flags; 239124e1003aSaurel32 abi_long mq_maxmsg; 239224e1003aSaurel32 abi_long mq_msgsize; 239324e1003aSaurel32 abi_long mq_curmsgs; 239424e1003aSaurel32 }; 239524e1003aSaurel32 23963532fa74Sbellard #include "socket.h" 2397637947f1Sths 2398637947f1Sths #include "errno_defs.h" 239903dfe9f8SRiku Voipio 240003dfe9f8SRiku Voipio #define FUTEX_WAIT 0 240103dfe9f8SRiku Voipio #define FUTEX_WAKE 1 240203dfe9f8SRiku Voipio #define FUTEX_FD 2 240303dfe9f8SRiku Voipio #define FUTEX_REQUEUE 3 240403dfe9f8SRiku Voipio #define FUTEX_CMP_REQUEUE 4 240503dfe9f8SRiku Voipio #define FUTEX_WAKE_OP 5 240603dfe9f8SRiku Voipio #define FUTEX_LOCK_PI 6 240703dfe9f8SRiku Voipio #define FUTEX_UNLOCK_PI 7 240803dfe9f8SRiku Voipio #define FUTEX_TRYLOCK_PI 8 240903dfe9f8SRiku Voipio #define FUTEX_WAIT_BITSET 9 241003dfe9f8SRiku Voipio #define FUTEX_WAKE_BITSET 10 241103dfe9f8SRiku Voipio 241203dfe9f8SRiku Voipio #define FUTEX_PRIVATE_FLAG 128 241303dfe9f8SRiku Voipio #define FUTEX_CLOCK_REALTIME 256 241403dfe9f8SRiku Voipio #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) 241503dfe9f8SRiku Voipio 24163b6edd16SPeter Maydell #ifdef CONFIG_EPOLL 2417928bed6aSLaurent Vivier #if defined(TARGET_X86_64) 2418928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED QEMU_PACKED 2419928bed6aSLaurent Vivier #else 2420928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED 2421928bed6aSLaurent Vivier #endif 2422928bed6aSLaurent Vivier 24233b6edd16SPeter Maydell typedef union target_epoll_data { 24243b6edd16SPeter Maydell abi_ulong ptr; 2425928bed6aSLaurent Vivier abi_int fd; 2426928bed6aSLaurent Vivier abi_uint u32; 2427928bed6aSLaurent Vivier abi_ullong u64; 24283b6edd16SPeter Maydell } target_epoll_data_t; 24293b6edd16SPeter Maydell 24303b6edd16SPeter Maydell struct target_epoll_event { 2431928bed6aSLaurent Vivier abi_uint events; 24323b6edd16SPeter Maydell target_epoll_data_t data; 2433928bed6aSLaurent Vivier } TARGET_EPOLL_PACKED; 24342ba7fae3SPeter Maydell 24352ba7fae3SPeter Maydell #define TARGET_EP_MAX_EVENTS (INT_MAX / sizeof(struct target_epoll_event)) 24362ba7fae3SPeter Maydell 24373b6edd16SPeter Maydell #endif 2438163a05a8SPeter Maydell struct target_rlimit64 { 2439163a05a8SPeter Maydell uint64_t rlim_cur; 2440163a05a8SPeter Maydell uint64_t rlim_max; 2441163a05a8SPeter Maydell }; 2442583359a6SAkos PASZTORY 2443583359a6SAkos PASZTORY struct target_ucred { 2444583359a6SAkos PASZTORY uint32_t pid; 2445583359a6SAkos PASZTORY uint32_t uid; 2446583359a6SAkos PASZTORY uint32_t gid; 2447583359a6SAkos PASZTORY }; 2448cb9c377fSPaolo Bonzini 2449aecc8861SAlexander Graf typedef int32_t target_timer_t; 2450905bba13SErik de Castro Lopo 245134d60862SNatanael Copa #define TARGET_SIGEV_MAX_SIZE 64 245234d60862SNatanael Copa 245334d60862SNatanael Copa /* This is architecture-specific but most architectures use the default */ 245434d60862SNatanael Copa #ifdef TARGET_MIPS 245534d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long)) 245634d60862SNatanael Copa #else 245734d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ 245834d60862SNatanael Copa + sizeof(target_sigval_t)) 245934d60862SNatanael Copa #endif 246034d60862SNatanael Copa 246134d60862SNatanael Copa #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ 246234d60862SNatanael Copa - TARGET_SIGEV_PREAMBLE_SIZE) \ 246334d60862SNatanael Copa / sizeof(int32_t)) 246434d60862SNatanael Copa 2465905bba13SErik de Castro Lopo struct target_sigevent { 2466905bba13SErik de Castro Lopo target_sigval_t sigev_value; 246717351c3fSPeter Maydell abi_int sigev_signo; 246817351c3fSPeter Maydell abi_int sigev_notify; 2469905bba13SErik de Castro Lopo union { 247017351c3fSPeter Maydell abi_int _pad[TARGET_SIGEV_PAD_SIZE]; 247117351c3fSPeter Maydell abi_int _tid; 2472905bba13SErik de Castro Lopo 247317351c3fSPeter Maydell /* The kernel (and thus QEMU) never looks at these; 247417351c3fSPeter Maydell * they're only used as part of the ABI between a 247517351c3fSPeter Maydell * userspace program and libc. 247617351c3fSPeter Maydell */ 2477905bba13SErik de Castro Lopo struct { 247817351c3fSPeter Maydell abi_ulong _function; 247917351c3fSPeter Maydell abi_ulong _attribute; 2480905bba13SErik de Castro Lopo } _sigev_thread; 2481905bba13SErik de Castro Lopo } _sigev_un; 2482905bba13SErik de Castro Lopo }; 2483e0eb210eSPeter Maydell 2484e0eb210eSPeter Maydell struct target_user_cap_header { 2485e0eb210eSPeter Maydell uint32_t version; 2486e0eb210eSPeter Maydell int pid; 2487e0eb210eSPeter Maydell }; 2488e0eb210eSPeter Maydell 2489e0eb210eSPeter Maydell struct target_user_cap_data { 2490e0eb210eSPeter Maydell uint32_t effective; 2491e0eb210eSPeter Maydell uint32_t permitted; 2492e0eb210eSPeter Maydell uint32_t inheritable; 2493e0eb210eSPeter Maydell }; 24941b3c4fdfSMarkus Armbruster 2495da2c8ad7SAleksandar Markovic /* from kernel's include/linux/syslog.h */ 2496da2c8ad7SAleksandar Markovic 2497da2c8ad7SAleksandar Markovic /* Close the log. Currently a NOP. */ 2498da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CLOSE 0 2499da2c8ad7SAleksandar Markovic /* Open the log. Currently a NOP. */ 2500da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_OPEN 1 2501da2c8ad7SAleksandar Markovic /* Read from the log. */ 2502da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ 2 2503da2c8ad7SAleksandar Markovic /* Read all messages remaining in the ring buffer. */ 2504da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ_ALL 3 2505da2c8ad7SAleksandar Markovic /* Read and clear all messages remaining in the ring buffer */ 2506da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ_CLEAR 4 2507da2c8ad7SAleksandar Markovic /* Clear ring buffer. */ 2508da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CLEAR 5 2509da2c8ad7SAleksandar Markovic /* Disable printk's to console */ 2510da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_OFF 6 2511da2c8ad7SAleksandar Markovic /* Enable printk's to console */ 2512da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_ON 7 2513da2c8ad7SAleksandar Markovic /* Set level of messages printed to console */ 2514da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_LEVEL 8 2515da2c8ad7SAleksandar Markovic /* Return number of unread characters in the log buffer */ 2516da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_SIZE_UNREAD 9 2517da2c8ad7SAleksandar Markovic /* Return size of the log buffer */ 2518da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10 2519da2c8ad7SAleksandar Markovic 25201b3c4fdfSMarkus Armbruster #endif 2521