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) \ 72b16189b2SChen Gang || defined(TARGET_UNICORE32) || defined(TARGET_S390X) \ 73a0a839b6SMarek Vasut || defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) \ 74*47ae93cdSMichael Clark || defined(TARGET_NIOS2) || defined(TARGET_RISCV) 752521d698Sbellard 762521d698Sbellard #define TARGET_IOC_SIZEBITS 14 772521d698Sbellard #define TARGET_IOC_DIRBITS 2 782521d698Sbellard 792521d698Sbellard #define TARGET_IOC_NONE 0U 802521d698Sbellard #define TARGET_IOC_WRITE 1U 812521d698Sbellard #define TARGET_IOC_READ 2U 822521d698Sbellard 83048f6b4dSbellard #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ 84b779e29eSEdgar E. Iglesias defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \ 85b779e29eSEdgar E. Iglesias defined(TARGET_MIPS) 862521d698Sbellard 872521d698Sbellard #define TARGET_IOC_SIZEBITS 13 882521d698Sbellard #define TARGET_IOC_DIRBITS 3 892521d698Sbellard 902521d698Sbellard #define TARGET_IOC_NONE 1U 912521d698Sbellard #define TARGET_IOC_READ 2U 922521d698Sbellard #define TARGET_IOC_WRITE 4U 932521d698Sbellard 94a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 95a10d1e50SRichard Henderson 96a10d1e50SRichard Henderson #define TARGET_IOC_SIZEBITS 14 97a10d1e50SRichard Henderson #define TARGET_IOC_DIRBITS 2 98a10d1e50SRichard Henderson 99a10d1e50SRichard Henderson #define TARGET_IOC_NONE 0U 100a10d1e50SRichard Henderson #define TARGET_IOC_WRITE 2U 101a10d1e50SRichard Henderson #define TARGET_IOC_READ 1U 102a10d1e50SRichard Henderson 1032521d698Sbellard #else 1042521d698Sbellard #error unsupported CPU 1052521d698Sbellard #endif 1062521d698Sbellard 1072521d698Sbellard #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) 1082521d698Sbellard #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) 1092521d698Sbellard #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) 1102521d698Sbellard #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) 1112521d698Sbellard 1122521d698Sbellard #define TARGET_IOC_NRSHIFT 0 1132521d698Sbellard #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) 1142521d698Sbellard #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) 1152521d698Sbellard #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) 1162521d698Sbellard 1172521d698Sbellard #define TARGET_IOC(dir,type,nr,size) \ 1182521d698Sbellard (((dir) << TARGET_IOC_DIRSHIFT) | \ 1192521d698Sbellard ((type) << TARGET_IOC_TYPESHIFT) | \ 1202521d698Sbellard ((nr) << TARGET_IOC_NRSHIFT) | \ 1212521d698Sbellard ((size) << TARGET_IOC_SIZESHIFT)) 1222521d698Sbellard 1232521d698Sbellard /* used to create numbers */ 1242521d698Sbellard #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) 1252521d698Sbellard #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) 1262521d698Sbellard #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1272521d698Sbellard #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1282521d698Sbellard 1292521d698Sbellard /* the size is automatically computed for these defines */ 1302521d698Sbellard #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) 1312521d698Sbellard #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1322521d698Sbellard #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1332521d698Sbellard 1347854b056Sbellard struct target_sockaddr { 1357854b056Sbellard uint16_t sa_family; 1367854b056Sbellard uint8_t sa_data[14]; 1377854b056Sbellard }; 1387854b056Sbellard 13933a29b51SJoakim Tjernlund struct target_sockaddr_ll { 14033a29b51SJoakim Tjernlund uint16_t sll_family; /* Always AF_PACKET */ 14133a29b51SJoakim Tjernlund uint16_t sll_protocol; /* Physical layer protocol */ 14233a29b51SJoakim Tjernlund int sll_ifindex; /* Interface number */ 14333a29b51SJoakim Tjernlund uint16_t sll_hatype; /* ARP hardware type */ 14433a29b51SJoakim Tjernlund uint8_t sll_pkttype; /* Packet type */ 14533a29b51SJoakim Tjernlund uint8_t sll_halen; /* Length of address */ 14633a29b51SJoakim Tjernlund uint8_t sll_addr[8]; /* Physical layer address */ 14733a29b51SJoakim Tjernlund }; 14833a29b51SJoakim Tjernlund 149fb3aabf3SLaurent Vivier struct target_sockaddr_un { 150fb3aabf3SLaurent Vivier uint16_t su_family; 151fb3aabf3SLaurent Vivier uint8_t sun_path[108]; 152fb3aabf3SLaurent Vivier }; 153fb3aabf3SLaurent Vivier 154fb3aabf3SLaurent Vivier struct target_in_addr { 155fb3aabf3SLaurent Vivier uint32_t s_addr; /* big endian */ 156fb3aabf3SLaurent Vivier }; 157fb3aabf3SLaurent Vivier 158fb3aabf3SLaurent Vivier struct target_sockaddr_in { 159fb3aabf3SLaurent Vivier uint16_t sin_family; 160fb3aabf3SLaurent Vivier int16_t sin_port; /* big endian */ 161fb3aabf3SLaurent Vivier struct target_in_addr sin_addr; 162fb3aabf3SLaurent Vivier uint8_t __pad[sizeof(struct target_sockaddr) - 163fb3aabf3SLaurent Vivier sizeof(uint16_t) - sizeof(int16_t) - 164fb3aabf3SLaurent Vivier sizeof(struct target_in_addr)]; 165fb3aabf3SLaurent Vivier }; 166fb3aabf3SLaurent Vivier 167ee1ac3a1SHelge Deller struct target_sockaddr_in6 { 168ee1ac3a1SHelge Deller uint16_t sin6_family; 169ee1ac3a1SHelge Deller uint16_t sin6_port; /* big endian */ 170ee1ac3a1SHelge Deller uint32_t sin6_flowinfo; /* big endian */ 171ee1ac3a1SHelge Deller struct in6_addr sin6_addr; /* IPv6 address, big endian */ 172ee1ac3a1SHelge Deller uint32_t sin6_scope_id; 173ee1ac3a1SHelge Deller }; 174ee1ac3a1SHelge Deller 175f57d4192SLaurent Vivier struct target_sock_filter { 176f57d4192SLaurent Vivier abi_ushort code; 177f57d4192SLaurent Vivier uint8_t jt; 178f57d4192SLaurent Vivier uint8_t jf; 179f57d4192SLaurent Vivier abi_uint k; 180f57d4192SLaurent Vivier }; 181f57d4192SLaurent Vivier 182f57d4192SLaurent Vivier struct target_sock_fprog { 183f57d4192SLaurent Vivier abi_ushort len; 184f57d4192SLaurent Vivier abi_ulong filter; 185f57d4192SLaurent Vivier }; 186f57d4192SLaurent Vivier 187b975b83bSLionel Landwerlin struct target_ip_mreq { 188b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 189b975b83bSLionel Landwerlin struct target_in_addr imr_address; 190b975b83bSLionel Landwerlin }; 191b975b83bSLionel Landwerlin 192b975b83bSLionel Landwerlin struct target_ip_mreqn { 193b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 194b975b83bSLionel Landwerlin struct target_in_addr imr_address; 195b975b83bSLionel Landwerlin abi_long imr_ifindex; 196b975b83bSLionel Landwerlin }; 197b975b83bSLionel Landwerlin 1986e3cb58fSLionel Landwerlin struct target_ip_mreq_source { 1996e3cb58fSLionel Landwerlin /* big endian */ 2006e3cb58fSLionel Landwerlin uint32_t imr_multiaddr; 2016e3cb58fSLionel Landwerlin uint32_t imr_interface; 2026e3cb58fSLionel Landwerlin uint32_t imr_sourceaddr; 2036e3cb58fSLionel Landwerlin }; 2046e3cb58fSLionel Landwerlin 20531e31b8aSbellard struct target_timeval { 206992f48a0Sblueswir1 abi_long tv_sec; 207992f48a0Sblueswir1 abi_long tv_usec; 20831e31b8aSbellard }; 20931e31b8aSbellard 2101b6b029eSbellard struct target_timespec { 211992f48a0Sblueswir1 abi_long tv_sec; 212992f48a0Sblueswir1 abi_long tv_nsec; 2131b6b029eSbellard }; 2141b6b029eSbellard 215ef4467e9SPaul Burton struct target_timezone { 216ef4467e9SPaul Burton abi_int tz_minuteswest; 217ef4467e9SPaul Burton abi_int tz_dsttime; 218ef4467e9SPaul Burton }; 219ef4467e9SPaul Burton 22066fb9763Sbellard struct target_itimerval { 22166fb9763Sbellard struct target_timeval it_interval; 22266fb9763Sbellard struct target_timeval it_value; 22366fb9763Sbellard }; 22466fb9763Sbellard 225905bba13SErik de Castro Lopo struct target_itimerspec { 226905bba13SErik de Castro Lopo struct target_timespec it_interval; 227905bba13SErik de Castro Lopo struct target_timespec it_value; 228905bba13SErik de Castro Lopo }; 229905bba13SErik de Castro Lopo 23019f59bceSAleksandar Markovic struct target_timex { 23119f59bceSAleksandar Markovic abi_uint modes; /* Mode selector */ 23219f59bceSAleksandar Markovic abi_long offset; /* Time offset */ 23319f59bceSAleksandar Markovic abi_long freq; /* Frequency offset */ 23419f59bceSAleksandar Markovic abi_long maxerror; /* Maximum error (microseconds) */ 23519f59bceSAleksandar Markovic abi_long esterror; /* Estimated error (microseconds) */ 23619f59bceSAleksandar Markovic abi_int status; /* Clock command/status */ 23719f59bceSAleksandar Markovic abi_long constant; /* PLL (phase-locked loop) time constant */ 23819f59bceSAleksandar Markovic abi_long precision; /* Clock precision (microseconds, ro) */ 23919f59bceSAleksandar Markovic abi_long tolerance; /* Clock freq. tolerance (ppm, ro) */ 24019f59bceSAleksandar Markovic struct target_timeval time; /* Current time */ 24119f59bceSAleksandar Markovic abi_long tick; /* Microseconds between clock ticks */ 24219f59bceSAleksandar Markovic abi_long ppsfreq; /* PPS (pulse per second) frequency */ 24319f59bceSAleksandar Markovic abi_long jitter; /* PPS jitter (ro); nanoseconds */ 24419f59bceSAleksandar Markovic abi_int shift; /* PPS interval duration (seconds) */ 24519f59bceSAleksandar Markovic abi_long stabil; /* PPS stability */ 24619f59bceSAleksandar Markovic abi_long jitcnt; /* PPS jitter limit exceeded (ro) */ 24719f59bceSAleksandar Markovic abi_long calcnt; /* PPS calibration intervals */ 24819f59bceSAleksandar Markovic abi_long errcnt; /* PPS calibration errors */ 24919f59bceSAleksandar Markovic abi_long stbcnt; /* PPS stability limit exceeded */ 25019f59bceSAleksandar Markovic abi_int tai; /* TAI offset */ 25119f59bceSAleksandar Markovic 25219f59bceSAleksandar Markovic /* Further padding bytes to allow for future expansion */ 25319f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; abi_int:32; 25419f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; abi_int:32; 25519f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; 25619f59bceSAleksandar Markovic }; 25719f59bceSAleksandar Markovic 258c227f099SAnthony Liguori typedef abi_long target_clock_t; 25932f36bceSbellard 260c596ed17Sbellard #define TARGET_HZ 100 261c596ed17Sbellard 26232f36bceSbellard struct target_tms { 263c227f099SAnthony Liguori target_clock_t tms_utime; 264c227f099SAnthony Liguori target_clock_t tms_stime; 265c227f099SAnthony Liguori target_clock_t tms_cutime; 266c227f099SAnthony Liguori target_clock_t tms_cstime; 26732f36bceSbellard }; 26832f36bceSbellard 2696180a181Sbellard struct target_utimbuf { 270992f48a0Sblueswir1 abi_long actime; 271992f48a0Sblueswir1 abi_long modtime; 2726180a181Sbellard }; 2736180a181Sbellard 274f2674e31Sbellard struct target_sel_arg_struct { 275992f48a0Sblueswir1 abi_long n; 276992f48a0Sblueswir1 abi_long inp, outp, exp; 277992f48a0Sblueswir1 abi_long tvp; 278f2674e31Sbellard }; 279f2674e31Sbellard 28031e31b8aSbellard struct target_iovec { 281992f48a0Sblueswir1 abi_long iov_base; /* Starting address */ 282992f48a0Sblueswir1 abi_long iov_len; /* Number of bytes */ 28331e31b8aSbellard }; 28431e31b8aSbellard 2851a9353d2Sbellard struct target_msghdr { 286992f48a0Sblueswir1 abi_long msg_name; /* Socket name */ 2871a9353d2Sbellard int msg_namelen; /* Length of name */ 288992f48a0Sblueswir1 abi_long msg_iov; /* Data blocks */ 289992f48a0Sblueswir1 abi_long msg_iovlen; /* Number of blocks */ 290992f48a0Sblueswir1 abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ 291992f48a0Sblueswir1 abi_long msg_controllen; /* Length of cmsg list */ 2921a9353d2Sbellard unsigned int msg_flags; 2931a9353d2Sbellard }; 2941a9353d2Sbellard 2957854b056Sbellard struct target_cmsghdr { 296992f48a0Sblueswir1 abi_long cmsg_len; 2977854b056Sbellard int cmsg_level; 2987854b056Sbellard int cmsg_type; 2997854b056Sbellard }; 3007854b056Sbellard 3017854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) 302ee104587SJonathan Neuschäfer #define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \ 303ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start) 304992f48a0Sblueswir1 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ 305992f48a0Sblueswir1 & (size_t) ~(sizeof (abi_long) - 1)) 306ad762b99SPeter Maydell #define TARGET_CMSG_SPACE(len) (sizeof(struct target_cmsghdr) + \ 307ad762b99SPeter Maydell TARGET_CMSG_ALIGN(len)) 308ad762b99SPeter Maydell #define TARGET_CMSG_LEN(len) (sizeof(struct target_cmsghdr) + (len)) 3097854b056Sbellard 3107854b056Sbellard static __inline__ struct target_cmsghdr * 311ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(struct target_msghdr *__mhdr, 312ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg, 313ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg_start) 3147854b056Sbellard { 3152b8bdefcSths struct target_cmsghdr *__ptr; 3167854b056Sbellard 3172b8bdefcSths __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg 318cbb21eedSMatthias Braun + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len))); 319ee104587SJonathan Neuschäfer if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start) 320ee104587SJonathan Neuschäfer > tswapal(__mhdr->msg_controllen)) { 3217854b056Sbellard /* No more entries. */ 3222b8bdefcSths return (struct target_cmsghdr *)0; 323ee104587SJonathan Neuschäfer } 324ee104587SJonathan Neuschäfer return __ptr; 3257854b056Sbellard } 3267854b056Sbellard 327f19e00d7SAlexander Graf struct target_mmsghdr { 328f19e00d7SAlexander Graf struct target_msghdr msg_hdr; /* Message header */ 329f19e00d7SAlexander Graf unsigned int msg_len; /* Number of bytes transmitted */ 330f19e00d7SAlexander Graf }; 3317854b056Sbellard 33231e31b8aSbellard struct target_rusage { 33331e31b8aSbellard struct target_timeval ru_utime; /* user time used */ 33431e31b8aSbellard struct target_timeval ru_stime; /* system time used */ 335992f48a0Sblueswir1 abi_long ru_maxrss; /* maximum resident set size */ 336992f48a0Sblueswir1 abi_long ru_ixrss; /* integral shared memory size */ 337992f48a0Sblueswir1 abi_long ru_idrss; /* integral unshared data size */ 338992f48a0Sblueswir1 abi_long ru_isrss; /* integral unshared stack size */ 339992f48a0Sblueswir1 abi_long ru_minflt; /* page reclaims */ 340992f48a0Sblueswir1 abi_long ru_majflt; /* page faults */ 341992f48a0Sblueswir1 abi_long ru_nswap; /* swaps */ 342992f48a0Sblueswir1 abi_long ru_inblock; /* block input operations */ 343992f48a0Sblueswir1 abi_long ru_oublock; /* block output operations */ 344992f48a0Sblueswir1 abi_long ru_msgsnd; /* messages sent */ 345992f48a0Sblueswir1 abi_long ru_msgrcv; /* messages received */ 346992f48a0Sblueswir1 abi_long ru_nsignals; /* signals received */ 347992f48a0Sblueswir1 abi_long ru_nvcsw; /* voluntary context switches */ 348992f48a0Sblueswir1 abi_long ru_nivcsw; /* involuntary " */ 34931e31b8aSbellard }; 35031e31b8aSbellard 35131e31b8aSbellard typedef struct { 35231e31b8aSbellard int val[2]; 353c227f099SAnthony Liguori } kernel_fsid_t; 35431e31b8aSbellard 35572f03900Sbellard struct kernel_statfs { 35631e31b8aSbellard int f_type; 35731e31b8aSbellard int f_bsize; 35831e31b8aSbellard int f_blocks; 35931e31b8aSbellard int f_bfree; 36031e31b8aSbellard int f_bavail; 36131e31b8aSbellard int f_files; 36231e31b8aSbellard int f_ffree; 363c227f099SAnthony Liguori kernel_fsid_t f_fsid; 36431e31b8aSbellard int f_namelen; 36531e31b8aSbellard int f_spare[6]; 36631e31b8aSbellard }; 36731e31b8aSbellard 368dab2ed99Sbellard struct target_dirent { 369992f48a0Sblueswir1 abi_long d_ino; 370992f48a0Sblueswir1 abi_long d_off; 371dab2ed99Sbellard unsigned short d_reclen; 372333858b7SDmitry V. Levin char d_name[]; 373dab2ed99Sbellard }; 374dab2ed99Sbellard 375dab2ed99Sbellard struct target_dirent64 { 376dab2ed99Sbellard uint64_t d_ino; 377dab2ed99Sbellard int64_t d_off; 378dab2ed99Sbellard unsigned short d_reclen; 379dab2ed99Sbellard unsigned char d_type; 380dab2ed99Sbellard char d_name[256]; 381dab2ed99Sbellard }; 382dab2ed99Sbellard 383dab2ed99Sbellard 38431e31b8aSbellard /* mostly generic signal stuff */ 385992f48a0Sblueswir1 #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ 386992f48a0Sblueswir1 #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ 387992f48a0Sblueswir1 #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ 38831e31b8aSbellard 38931e31b8aSbellard #ifdef TARGET_MIPS 39031e31b8aSbellard #define TARGET_NSIG 128 39131e31b8aSbellard #else 39231e31b8aSbellard #define TARGET_NSIG 64 39331e31b8aSbellard #endif 394992f48a0Sblueswir1 #define TARGET_NSIG_BPW TARGET_ABI_BITS 39531e31b8aSbellard #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) 39631e31b8aSbellard 39731e31b8aSbellard typedef struct { 398992f48a0Sblueswir1 abi_ulong sig[TARGET_NSIG_WORDS]; 399c227f099SAnthony Liguori } target_sigset_t; 40031e31b8aSbellard 40166fb9763Sbellard #ifdef BSWAP_NEEDED 402c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 40366fb9763Sbellard { 40466fb9763Sbellard int i; 40566fb9763Sbellard for(i = 0;i < TARGET_NSIG_WORDS; i++) 406cbb21eedSMatthias Braun d->sig[i] = tswapal(s->sig[i]); 40766fb9763Sbellard } 40866fb9763Sbellard #else 409c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 41066fb9763Sbellard { 41166fb9763Sbellard *d = *s; 41266fb9763Sbellard } 41366fb9763Sbellard #endif 41466fb9763Sbellard 415c227f099SAnthony Liguori static inline void target_siginitset(target_sigset_t *d, abi_ulong set) 41666fb9763Sbellard { 41766fb9763Sbellard int i; 41866fb9763Sbellard d->sig[0] = set; 41966fb9763Sbellard for(i = 1;i < TARGET_NSIG_WORDS; i++) 42066fb9763Sbellard d->sig[i] = 0; 42166fb9763Sbellard } 42266fb9763Sbellard 423c227f099SAnthony Liguori void host_to_target_sigset(target_sigset_t *d, const sigset_t *s); 424c227f099SAnthony Liguori void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); 425992f48a0Sblueswir1 void host_to_target_old_sigset(abi_ulong *old_sigset, 42666fb9763Sbellard const sigset_t *sigset); 42766fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset, 428992f48a0Sblueswir1 const abi_ulong *old_sigset); 42966fb9763Sbellard struct target_sigaction; 43066fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act, 43166fb9763Sbellard struct target_sigaction *oact); 43266fb9763Sbellard 433d2fbca94SGuan Xuetao #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \ 434d2fbca94SGuan Xuetao || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined(TARGET_SH4) \ 435d2fbca94SGuan Xuetao || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) \ 436a4c075f1SUlrich Hecht || defined(TARGET_MICROBLAZE) || defined(TARGET_UNICORE32) \ 437b16189b2SChen Gang || defined(TARGET_S390X) || defined(TARGET_OPENRISC) \ 438*47ae93cdSMichael Clark || defined(TARGET_TILEGX) || defined(TARGET_HPPA) || defined(TARGET_NIOS2) \ 439*47ae93cdSMichael Clark || defined(TARGET_RISCV) 4402521d698Sbellard 441048f6b4dSbellard #if defined(TARGET_SPARC) 442048f6b4dSbellard #define TARGET_SA_NOCLDSTOP 8u 443048f6b4dSbellard #define TARGET_SA_NOCLDWAIT 0x100u 444048f6b4dSbellard #define TARGET_SA_SIGINFO 0x200u 445048f6b4dSbellard #define TARGET_SA_ONSTACK 1u 446048f6b4dSbellard #define TARGET_SA_RESTART 2u 447048f6b4dSbellard #define TARGET_SA_NODEFER 0x20u 448048f6b4dSbellard #define TARGET_SA_RESETHAND 4u 4497f047de1SRichard Henderson #define TARGET_ARCH_HAS_SA_RESTORER 1 450048f6b4dSbellard #elif defined(TARGET_MIPS) 451048f6b4dSbellard #define TARGET_SA_NOCLDSTOP 0x00000001 452048f6b4dSbellard #define TARGET_SA_NOCLDWAIT 0x00010000 453048f6b4dSbellard #define TARGET_SA_SIGINFO 0x00000008 454048f6b4dSbellard #define TARGET_SA_ONSTACK 0x08000000 455048f6b4dSbellard #define TARGET_SA_NODEFER 0x40000000 456048f6b4dSbellard #define TARGET_SA_RESTART 0x10000000 457048f6b4dSbellard #define TARGET_SA_RESETHAND 0x80000000 458d26bc211Sths #if !defined(TARGET_ABI_MIPSN32) && !defined(TARGET_ABI_MIPSN64) 459d26bc211Sths #define TARGET_SA_RESTORER 0x04000000 /* Only for O32 */ 460540635baSths #endif 461d962783eSJia Liu #elif defined(TARGET_OPENRISC) 462d962783eSJia Liu #define TARGET_SA_NOCLDSTOP 0x00000001 463d962783eSJia Liu #define TARGET_SA_NOCLDWAIT 0x00000002 464d962783eSJia Liu #define TARGET_SA_SIGINFO 0x00000004 465d962783eSJia Liu #define TARGET_SA_ONSTACK 0x08000000 466d962783eSJia Liu #define TARGET_SA_RESTART 0x10000000 467d962783eSJia Liu #define TARGET_SA_NODEFER 0x40000000 468d962783eSJia Liu #define TARGET_SA_RESETHAND 0x80000000 46957f18a95SRichard Henderson #elif defined(TARGET_ALPHA) 47057f18a95SRichard Henderson #define TARGET_SA_ONSTACK 0x00000001 47157f18a95SRichard Henderson #define TARGET_SA_RESTART 0x00000002 47257f18a95SRichard Henderson #define TARGET_SA_NOCLDSTOP 0x00000004 47357f18a95SRichard Henderson #define TARGET_SA_NODEFER 0x00000008 47457f18a95SRichard Henderson #define TARGET_SA_RESETHAND 0x00000010 47557f18a95SRichard Henderson #define TARGET_SA_NOCLDWAIT 0x00000020 /* not supported yet */ 47657f18a95SRichard Henderson #define TARGET_SA_SIGINFO 0x00000040 4772da6e76cSHelge Deller #elif defined(TARGET_HPPA) 4782da6e76cSHelge Deller #define TARGET_SA_ONSTACK 0x00000001 4792da6e76cSHelge Deller #define TARGET_SA_RESETHAND 0x00000004 4802da6e76cSHelge Deller #define TARGET_SA_NOCLDSTOP 0x00000008 4812da6e76cSHelge Deller #define TARGET_SA_SIGINFO 0x00000010 4822da6e76cSHelge Deller #define TARGET_SA_NODEFER 0x00000020 4832da6e76cSHelge Deller #define TARGET_SA_RESTART 0x00000040 4842da6e76cSHelge Deller #define TARGET_SA_NOCLDWAIT 0x00000080 485048f6b4dSbellard #else 4862521d698Sbellard #define TARGET_SA_NOCLDSTOP 0x00000001 4872521d698Sbellard #define TARGET_SA_NOCLDWAIT 0x00000002 /* not supported yet */ 4882521d698Sbellard #define TARGET_SA_SIGINFO 0x00000004 4892521d698Sbellard #define TARGET_SA_ONSTACK 0x08000000 4902521d698Sbellard #define TARGET_SA_RESTART 0x10000000 4912521d698Sbellard #define TARGET_SA_NODEFER 0x40000000 4922521d698Sbellard #define TARGET_SA_RESETHAND 0x80000000 4932521d698Sbellard #define TARGET_SA_RESTORER 0x04000000 4946d5e216dSbellard #endif 4956d5e216dSbellard 4967f047de1SRichard Henderson #ifdef TARGET_SA_RESTORER 4977f047de1SRichard Henderson #define TARGET_ARCH_HAS_SA_RESTORER 1 4987f047de1SRichard Henderson #endif 4997f047de1SRichard Henderson 500d0f20495SRichard Henderson #if defined(TARGET_ALPHA) 501d0f20495SRichard Henderson 502d0f20495SRichard Henderson #define TARGET_SIGHUP 1 503d0f20495SRichard Henderson #define TARGET_SIGINT 2 504d0f20495SRichard Henderson #define TARGET_SIGQUIT 3 505d0f20495SRichard Henderson #define TARGET_SIGILL 4 506d0f20495SRichard Henderson #define TARGET_SIGTRAP 5 507d0f20495SRichard Henderson #define TARGET_SIGABRT 6 508d0f20495SRichard Henderson #define TARGET_SIGSTKFLT 7 /* actually SIGEMT */ 509d0f20495SRichard Henderson #define TARGET_SIGFPE 8 510d0f20495SRichard Henderson #define TARGET_SIGKILL 9 511d0f20495SRichard Henderson #define TARGET_SIGBUS 10 512d0f20495SRichard Henderson #define TARGET_SIGSEGV 11 513d0f20495SRichard Henderson #define TARGET_SIGSYS 12 514d0f20495SRichard Henderson #define TARGET_SIGPIPE 13 515d0f20495SRichard Henderson #define TARGET_SIGALRM 14 516d0f20495SRichard Henderson #define TARGET_SIGTERM 15 517d0f20495SRichard Henderson #define TARGET_SIGURG 16 518d0f20495SRichard Henderson #define TARGET_SIGSTOP 17 519d0f20495SRichard Henderson #define TARGET_SIGTSTP 18 520d0f20495SRichard Henderson #define TARGET_SIGCONT 19 521d0f20495SRichard Henderson #define TARGET_SIGCHLD 20 522d0f20495SRichard Henderson #define TARGET_SIGTTIN 21 523d0f20495SRichard Henderson #define TARGET_SIGTTOU 22 524d0f20495SRichard Henderson #define TARGET_SIGIO 23 525d0f20495SRichard Henderson #define TARGET_SIGXCPU 24 526d0f20495SRichard Henderson #define TARGET_SIGXFSZ 25 527d0f20495SRichard Henderson #define TARGET_SIGVTALRM 26 528d0f20495SRichard Henderson #define TARGET_SIGPROF 27 529d0f20495SRichard Henderson #define TARGET_SIGWINCH 28 530d0f20495SRichard Henderson #define TARGET_SIGPWR 29 /* actually SIGINFO */ 531d0f20495SRichard Henderson #define TARGET_SIGUSR1 30 532d0f20495SRichard Henderson #define TARGET_SIGUSR2 31 533d0f20495SRichard Henderson #define TARGET_SIGRTMIN 32 534d0f20495SRichard Henderson 535d0f20495SRichard Henderson #define TARGET_SIG_BLOCK 1 536d0f20495SRichard Henderson #define TARGET_SIG_UNBLOCK 2 537d0f20495SRichard Henderson #define TARGET_SIG_SETMASK 3 538d0f20495SRichard Henderson 539d0f20495SRichard Henderson #elif defined(TARGET_SPARC) 5406d5e216dSbellard 5416d5e216dSbellard #define TARGET_SIGHUP 1 5426d5e216dSbellard #define TARGET_SIGINT 2 5436d5e216dSbellard #define TARGET_SIGQUIT 3 5446d5e216dSbellard #define TARGET_SIGILL 4 5456d5e216dSbellard #define TARGET_SIGTRAP 5 5466d5e216dSbellard #define TARGET_SIGABRT 6 5476d5e216dSbellard #define TARGET_SIGIOT 6 5486d5e216dSbellard #define TARGET_SIGSTKFLT 7 /* actually EMT */ 5496d5e216dSbellard #define TARGET_SIGFPE 8 5506d5e216dSbellard #define TARGET_SIGKILL 9 5516d5e216dSbellard #define TARGET_SIGBUS 10 5526d5e216dSbellard #define TARGET_SIGSEGV 11 5536d5e216dSbellard #define TARGET_SIGSYS 12 5546d5e216dSbellard #define TARGET_SIGPIPE 13 5556d5e216dSbellard #define TARGET_SIGALRM 14 5566d5e216dSbellard #define TARGET_SIGTERM 15 5576d5e216dSbellard #define TARGET_SIGURG 16 5586d5e216dSbellard #define TARGET_SIGSTOP 17 5596d5e216dSbellard #define TARGET_SIGTSTP 18 5606d5e216dSbellard #define TARGET_SIGCONT 19 5616d5e216dSbellard #define TARGET_SIGCHLD 20 5626d5e216dSbellard #define TARGET_SIGTTIN 21 5636d5e216dSbellard #define TARGET_SIGTTOU 22 5646d5e216dSbellard #define TARGET_SIGIO 23 5656d5e216dSbellard #define TARGET_SIGXCPU 24 5666d5e216dSbellard #define TARGET_SIGXFSZ 25 5676d5e216dSbellard #define TARGET_SIGVTALRM 26 5686d5e216dSbellard #define TARGET_SIGPROF 27 5696d5e216dSbellard #define TARGET_SIGWINCH 28 5706d5e216dSbellard #define TARGET_SIGPWR 29 5716d5e216dSbellard #define TARGET_SIGUSR1 30 5726d5e216dSbellard #define TARGET_SIGUSR2 31 5736d5e216dSbellard #define TARGET_SIGRTMIN 32 5746d5e216dSbellard 5756d5e216dSbellard #define TARGET_SIG_BLOCK 0x01 /* for blocking signals */ 5766d5e216dSbellard #define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */ 5776d5e216dSbellard #define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */ 5786d5e216dSbellard 579048f6b4dSbellard #elif defined(TARGET_MIPS) 580048f6b4dSbellard 581048f6b4dSbellard #define TARGET_SIGHUP 1 /* Hangup (POSIX). */ 582048f6b4dSbellard #define TARGET_SIGINT 2 /* Interrupt (ANSI). */ 583048f6b4dSbellard #define TARGET_SIGQUIT 3 /* Quit (POSIX). */ 584048f6b4dSbellard #define TARGET_SIGILL 4 /* Illegal instruction (ANSI). */ 585048f6b4dSbellard #define TARGET_SIGTRAP 5 /* Trace trap (POSIX). */ 586048f6b4dSbellard #define TARGET_SIGIOT 6 /* IOT trap (4.2 BSD). */ 587048f6b4dSbellard #define TARGET_SIGABRT TARGET_SIGIOT /* Abort (ANSI). */ 588048f6b4dSbellard #define TARGET_SIGEMT 7 589048f6b4dSbellard #define TARGET_SIGSTKFLT 7 /* XXX: incorrect */ 590048f6b4dSbellard #define TARGET_SIGFPE 8 /* Floating-point exception (ANSI). */ 591048f6b4dSbellard #define TARGET_SIGKILL 9 /* Kill, unblockable (POSIX). */ 592048f6b4dSbellard #define TARGET_SIGBUS 10 /* BUS error (4.2 BSD). */ 593048f6b4dSbellard #define TARGET_SIGSEGV 11 /* Segmentation violation (ANSI). */ 594048f6b4dSbellard #define TARGET_SIGSYS 12 595048f6b4dSbellard #define TARGET_SIGPIPE 13 /* Broken pipe (POSIX). */ 596048f6b4dSbellard #define TARGET_SIGALRM 14 /* Alarm clock (POSIX). */ 597048f6b4dSbellard #define TARGET_SIGTERM 15 /* Termination (ANSI). */ 598048f6b4dSbellard #define TARGET_SIGUSR1 16 /* User-defined signal 1 (POSIX). */ 599048f6b4dSbellard #define TARGET_SIGUSR2 17 /* User-defined signal 2 (POSIX). */ 600048f6b4dSbellard #define TARGET_SIGCHLD 18 /* Child status has changed (POSIX). */ 601048f6b4dSbellard #define TARGET_SIGCLD TARGET_SIGCHLD /* Same as TARGET_SIGCHLD (System V). */ 602048f6b4dSbellard #define TARGET_SIGPWR 19 /* Power failure restart (System V). */ 603048f6b4dSbellard #define TARGET_SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */ 604048f6b4dSbellard #define TARGET_SIGURG 21 /* Urgent condition on socket (4.2 BSD). */ 605048f6b4dSbellard #define TARGET_SIGIO 22 /* I/O now possible (4.2 BSD). */ 606048f6b4dSbellard #define TARGET_SIGPOLL TARGET_SIGIO /* Pollable event occurred (System V). */ 607048f6b4dSbellard #define TARGET_SIGSTOP 23 /* Stop, unblockable (POSIX). */ 608048f6b4dSbellard #define TARGET_SIGTSTP 24 /* Keyboard stop (POSIX). */ 609048f6b4dSbellard #define TARGET_SIGCONT 25 /* Continue (POSIX). */ 610048f6b4dSbellard #define TARGET_SIGTTIN 26 /* Background read from tty (POSIX). */ 611048f6b4dSbellard #define TARGET_SIGTTOU 27 /* Background write to tty (POSIX). */ 612048f6b4dSbellard #define TARGET_SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */ 613048f6b4dSbellard #define TARGET_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */ 614048f6b4dSbellard #define TARGET_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ 615048f6b4dSbellard #define TARGET_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ 616048f6b4dSbellard #define TARGET_SIGRTMIN 32 617048f6b4dSbellard 618048f6b4dSbellard #define TARGET_SIG_BLOCK 1 /* for blocking signals */ 619048f6b4dSbellard #define TARGET_SIG_UNBLOCK 2 /* for unblocking signals */ 620048f6b4dSbellard #define TARGET_SIG_SETMASK 3 /* for setting the signal mask */ 621048f6b4dSbellard 622a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 623a10d1e50SRichard Henderson 624a10d1e50SRichard Henderson #define TARGET_SIGHUP 1 625a10d1e50SRichard Henderson #define TARGET_SIGINT 2 626a10d1e50SRichard Henderson #define TARGET_SIGQUIT 3 627a10d1e50SRichard Henderson #define TARGET_SIGILL 4 628a10d1e50SRichard Henderson #define TARGET_SIGTRAP 5 629a10d1e50SRichard Henderson #define TARGET_SIGABRT 6 630a10d1e50SRichard Henderson #define TARGET_SIGIOT 6 631a10d1e50SRichard Henderson #define TARGET_SIGSTKFLT 7 632a10d1e50SRichard Henderson #define TARGET_SIGFPE 8 633a10d1e50SRichard Henderson #define TARGET_SIGKILL 9 634a10d1e50SRichard Henderson #define TARGET_SIGBUS 10 635a10d1e50SRichard Henderson #define TARGET_SIGSEGV 11 636a10d1e50SRichard Henderson #define TARGET_SIGXCPU 12 637a10d1e50SRichard Henderson #define TARGET_SIGPIPE 13 638a10d1e50SRichard Henderson #define TARGET_SIGALRM 14 639a10d1e50SRichard Henderson #define TARGET_SIGTERM 15 640a10d1e50SRichard Henderson #define TARGET_SIGUSR1 16 641a10d1e50SRichard Henderson #define TARGET_SIGUSR2 17 642a10d1e50SRichard Henderson #define TARGET_SIGCHLD 18 643a10d1e50SRichard Henderson #define TARGET_SIGPWR 19 644a10d1e50SRichard Henderson #define TARGET_SIGVTALRM 20 645a10d1e50SRichard Henderson #define TARGET_SIGPROF 21 646a10d1e50SRichard Henderson #define TARGET_SIGIO 22 647a10d1e50SRichard Henderson #define TARGET_SIGPOLL TARGET_SIGIO 648a10d1e50SRichard Henderson #define TARGET_SIGWINCH 23 649a10d1e50SRichard Henderson #define TARGET_SIGSTOP 24 650a10d1e50SRichard Henderson #define TARGET_SIGTSTP 25 651a10d1e50SRichard Henderson #define TARGET_SIGCONT 26 652a10d1e50SRichard Henderson #define TARGET_SIGTTIN 27 653a10d1e50SRichard Henderson #define TARGET_SIGTTOU 28 654a10d1e50SRichard Henderson #define TARGET_SIGURG 29 655a10d1e50SRichard Henderson #define TARGET_SIGXFSZ 30 656a10d1e50SRichard Henderson #define TARGET_SIGSYS 31 657a10d1e50SRichard Henderson 658a10d1e50SRichard Henderson #define TARGET_SIG_BLOCK 0 659a10d1e50SRichard Henderson #define TARGET_SIG_UNBLOCK 1 660a10d1e50SRichard Henderson #define TARGET_SIG_SETMASK 2 661a10d1e50SRichard Henderson 6626d5e216dSbellard #else 6632521d698Sbellard 664d962783eSJia Liu /* OpenRISC Using the general signals */ 6652521d698Sbellard #define TARGET_SIGHUP 1 6662521d698Sbellard #define TARGET_SIGINT 2 6672521d698Sbellard #define TARGET_SIGQUIT 3 6682521d698Sbellard #define TARGET_SIGILL 4 6692521d698Sbellard #define TARGET_SIGTRAP 5 6702521d698Sbellard #define TARGET_SIGABRT 6 6712521d698Sbellard #define TARGET_SIGIOT 6 6722521d698Sbellard #define TARGET_SIGBUS 7 6732521d698Sbellard #define TARGET_SIGFPE 8 6742521d698Sbellard #define TARGET_SIGKILL 9 6752521d698Sbellard #define TARGET_SIGUSR1 10 6762521d698Sbellard #define TARGET_SIGSEGV 11 6772521d698Sbellard #define TARGET_SIGUSR2 12 6782521d698Sbellard #define TARGET_SIGPIPE 13 6792521d698Sbellard #define TARGET_SIGALRM 14 6802521d698Sbellard #define TARGET_SIGTERM 15 6812521d698Sbellard #define TARGET_SIGSTKFLT 16 6822521d698Sbellard #define TARGET_SIGCHLD 17 6832521d698Sbellard #define TARGET_SIGCONT 18 6842521d698Sbellard #define TARGET_SIGSTOP 19 6852521d698Sbellard #define TARGET_SIGTSTP 20 6862521d698Sbellard #define TARGET_SIGTTIN 21 6872521d698Sbellard #define TARGET_SIGTTOU 22 6882521d698Sbellard #define TARGET_SIGURG 23 6892521d698Sbellard #define TARGET_SIGXCPU 24 6902521d698Sbellard #define TARGET_SIGXFSZ 25 6912521d698Sbellard #define TARGET_SIGVTALRM 26 6922521d698Sbellard #define TARGET_SIGPROF 27 6932521d698Sbellard #define TARGET_SIGWINCH 28 6942521d698Sbellard #define TARGET_SIGIO 29 695c596ed17Sbellard #define TARGET_SIGPWR 30 696c596ed17Sbellard #define TARGET_SIGSYS 31 6972521d698Sbellard #define TARGET_SIGRTMIN 32 6982521d698Sbellard 6992521d698Sbellard #define TARGET_SIG_BLOCK 0 /* for blocking signals */ 7002521d698Sbellard #define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */ 7012521d698Sbellard #define TARGET_SIG_SETMASK 2 /* for setting the signal mask */ 7022521d698Sbellard 7036d5e216dSbellard #endif 7046d5e216dSbellard 7056049f4f8SRichard Henderson #if defined(TARGET_ALPHA) 7066049f4f8SRichard Henderson struct target_old_sigaction { 7076049f4f8SRichard Henderson abi_ulong _sa_handler; 7086049f4f8SRichard Henderson abi_ulong sa_mask; 709d2565875SRichard Henderson int32_t sa_flags; 7106049f4f8SRichard Henderson }; 711106ec879Sbellard 7126049f4f8SRichard Henderson struct target_rt_sigaction { 7136049f4f8SRichard Henderson abi_ulong _sa_handler; 7146049f4f8SRichard Henderson abi_ulong sa_flags; 7156049f4f8SRichard Henderson target_sigset_t sa_mask; 7166049f4f8SRichard Henderson }; 7176049f4f8SRichard Henderson 7186049f4f8SRichard Henderson /* This is the struct used inside the kernel. The ka_restorer 7196049f4f8SRichard Henderson field comes from the 5th argument to sys_rt_sigaction. */ 7206049f4f8SRichard Henderson struct target_sigaction { 7216049f4f8SRichard Henderson abi_ulong _sa_handler; 7226049f4f8SRichard Henderson abi_ulong sa_flags; 7236049f4f8SRichard Henderson target_sigset_t sa_mask; 7246049f4f8SRichard Henderson abi_ulong sa_restorer; 7256049f4f8SRichard Henderson }; 7266049f4f8SRichard Henderson #elif defined(TARGET_MIPS) 727106ec879Sbellard struct target_sigaction { 728540635baSths uint32_t sa_flags; 729d26bc211Sths #if defined(TARGET_ABI_MIPSN32) 730540635baSths uint32_t _sa_handler; 731540635baSths #else 732992f48a0Sblueswir1 abi_ulong _sa_handler; 733540635baSths #endif 734c227f099SAnthony Liguori target_sigset_t sa_mask; 7357f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 7367f047de1SRichard Henderson /* ??? This is always present, but ignored unless O32. */ 7377f047de1SRichard Henderson abi_ulong sa_restorer; 7387f047de1SRichard Henderson #endif 739106ec879Sbellard }; 740106ec879Sbellard #else 7412521d698Sbellard struct target_old_sigaction { 742992f48a0Sblueswir1 abi_ulong _sa_handler; 743992f48a0Sblueswir1 abi_ulong sa_mask; 744992f48a0Sblueswir1 abi_ulong sa_flags; 7457f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 746992f48a0Sblueswir1 abi_ulong sa_restorer; 7477f047de1SRichard Henderson #endif 7482521d698Sbellard }; 7492521d698Sbellard 7502521d698Sbellard struct target_sigaction { 751992f48a0Sblueswir1 abi_ulong _sa_handler; 752992f48a0Sblueswir1 abi_ulong sa_flags; 7537f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 754992f48a0Sblueswir1 abi_ulong sa_restorer; 7557f047de1SRichard Henderson #endif 756c227f099SAnthony Liguori target_sigset_t sa_mask; 7572521d698Sbellard }; 758106ec879Sbellard #endif 7592521d698Sbellard 7602521d698Sbellard typedef union target_sigval { 7612521d698Sbellard int sival_int; 762992f48a0Sblueswir1 abi_ulong sival_ptr; 763c227f099SAnthony Liguori } target_sigval_t; 7646d5e216dSbellard #if 0 7656d5e216dSbellard #if defined (TARGET_SPARC) 7666d5e216dSbellard typedef struct { 7676d5e216dSbellard struct { 768992f48a0Sblueswir1 abi_ulong psr; 769992f48a0Sblueswir1 abi_ulong pc; 770992f48a0Sblueswir1 abi_ulong npc; 771992f48a0Sblueswir1 abi_ulong y; 772992f48a0Sblueswir1 abi_ulong u_regs[16]; /* globals and ins */ 7736d5e216dSbellard } si_regs; 7746d5e216dSbellard int si_mask; 7756d5e216dSbellard } __siginfo_t; 7766d5e216dSbellard 7776d5e216dSbellard typedef struct { 7786d5e216dSbellard unsigned long si_float_regs [32]; 7796d5e216dSbellard unsigned long si_fsr; 7806d5e216dSbellard unsigned long si_fpqdepth; 7816d5e216dSbellard struct { 7826d5e216dSbellard unsigned long *insn_addr; 7836d5e216dSbellard unsigned long insn; 7846d5e216dSbellard } si_fpqueue [16]; 7856d5e216dSbellard } __siginfo_fpu_t; 7866d5e216dSbellard #endif 7876d5e216dSbellard #endif 7882521d698Sbellard 7892521d698Sbellard #define TARGET_SI_MAX_SIZE 128 790aa5e03d2SMaxim Ostapenko 791aa5e03d2SMaxim Ostapenko #if TARGET_ABI_BITS == 32 792aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int)) 793aa5e03d2SMaxim Ostapenko #else 794aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int)) 795aa5e03d2SMaxim Ostapenko #endif 796aa5e03d2SMaxim Ostapenko 797aa5e03d2SMaxim Ostapenko #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int)) 7982521d698Sbellard 799a70dadc7SPeter Maydell /* Within QEMU the top 16 bits of si_code indicate which of the parts of 800a70dadc7SPeter Maydell * the union in target_siginfo is valid. This only applies between 801a70dadc7SPeter Maydell * host_to_target_siginfo_noswap() and tswap_siginfo(); it does not 802a70dadc7SPeter Maydell * appear either within host siginfo_t or in target_siginfo structures 803a70dadc7SPeter Maydell * which we get from the guest userspace program. (The Linux kernel 804a70dadc7SPeter Maydell * does a similar thing with using the top bits for its own internal 805a70dadc7SPeter Maydell * purposes but not letting them be visible to userspace.) 806a70dadc7SPeter Maydell */ 807a70dadc7SPeter Maydell #define QEMU_SI_KILL 0 808a70dadc7SPeter Maydell #define QEMU_SI_TIMER 1 809a70dadc7SPeter Maydell #define QEMU_SI_POLL 2 810a70dadc7SPeter Maydell #define QEMU_SI_FAULT 3 811a70dadc7SPeter Maydell #define QEMU_SI_CHLD 4 812a70dadc7SPeter Maydell #define QEMU_SI_RT 5 813a70dadc7SPeter Maydell 8142521d698Sbellard typedef struct target_siginfo { 8153f53d546Spbrook #ifdef TARGET_MIPS 8163f53d546Spbrook int si_signo; 8173f53d546Spbrook int si_code; 8183f53d546Spbrook int si_errno; 8193f53d546Spbrook #else 8202521d698Sbellard int si_signo; 8212521d698Sbellard int si_errno; 8222521d698Sbellard int si_code; 8233f53d546Spbrook #endif 8242521d698Sbellard 8252521d698Sbellard union { 8262521d698Sbellard int _pad[TARGET_SI_PAD_SIZE]; 8272521d698Sbellard 8282521d698Sbellard /* kill() */ 8292521d698Sbellard struct { 8302521d698Sbellard pid_t _pid; /* sender's pid */ 8312521d698Sbellard uid_t _uid; /* sender's uid */ 8322521d698Sbellard } _kill; 8332521d698Sbellard 8342521d698Sbellard /* POSIX.1b timers */ 8352521d698Sbellard struct { 8362521d698Sbellard unsigned int _timer1; 8372521d698Sbellard unsigned int _timer2; 8382521d698Sbellard } _timer; 8392521d698Sbellard 8402521d698Sbellard /* POSIX.1b signals */ 8412521d698Sbellard struct { 8422521d698Sbellard pid_t _pid; /* sender's pid */ 8432521d698Sbellard uid_t _uid; /* sender's uid */ 844c227f099SAnthony Liguori target_sigval_t _sigval; 8452521d698Sbellard } _rt; 8462521d698Sbellard 8472521d698Sbellard /* SIGCHLD */ 8482521d698Sbellard struct { 8492521d698Sbellard pid_t _pid; /* which child */ 8502521d698Sbellard uid_t _uid; /* sender's uid */ 8512521d698Sbellard int _status; /* exit code */ 852c227f099SAnthony Liguori target_clock_t _utime; 853c227f099SAnthony Liguori target_clock_t _stime; 8542521d698Sbellard } _sigchld; 8552521d698Sbellard 8562521d698Sbellard /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 8572521d698Sbellard struct { 858992f48a0Sblueswir1 abi_ulong _addr; /* faulting insn/memory ref. */ 8592521d698Sbellard } _sigfault; 8602521d698Sbellard 8612521d698Sbellard /* SIGPOLL */ 8622521d698Sbellard struct { 8632521d698Sbellard int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 8642521d698Sbellard int _fd; 8652521d698Sbellard } _sigpoll; 8662521d698Sbellard } _sifields; 867c227f099SAnthony Liguori } target_siginfo_t; 8682521d698Sbellard 8692521d698Sbellard /* 8702521d698Sbellard * si_code values 8712521d698Sbellard * Digital reserves positive values for kernel-generated signals. 8722521d698Sbellard */ 8732521d698Sbellard #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ 8742521d698Sbellard #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 8752521d698Sbellard #define TARGET_SI_QUEUE -1 /* sent by sigqueue */ 8762521d698Sbellard #define TARGET_SI_TIMER -2 /* sent by timer expiration */ 8772521d698Sbellard #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ 8782521d698Sbellard #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ 8792521d698Sbellard #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ 8802521d698Sbellard 8812521d698Sbellard /* 8822521d698Sbellard * SIGILL si_codes 8832521d698Sbellard */ 884ffa65c3bSbellard #define TARGET_ILL_ILLOPC (1) /* illegal opcode */ 8852521d698Sbellard #define TARGET_ILL_ILLOPN (2) /* illegal operand */ 886ffa65c3bSbellard #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ 887ffa65c3bSbellard #define TARGET_ILL_ILLTRP (4) /* illegal trap */ 888ffa65c3bSbellard #define TARGET_ILL_PRVOPC (5) /* privileged opcode */ 889ffa65c3bSbellard #define TARGET_ILL_PRVREG (6) /* privileged register */ 890ffa65c3bSbellard #define TARGET_ILL_COPROC (7) /* coprocessor error */ 891ffa65c3bSbellard #define TARGET_ILL_BADSTK (8) /* internal stack error */ 892de2fdd56SChen Gang #ifdef TARGET_TILEGX 893de2fdd56SChen Gang #define TARGET_ILL_DBLFLT (9) /* double fault */ 894de2fdd56SChen Gang #define TARGET_ILL_HARDWALL (10) /* user networks hardwall violation */ 895de2fdd56SChen Gang #endif 8962521d698Sbellard 8972521d698Sbellard /* 8982521d698Sbellard * SIGFPE si_codes 8992521d698Sbellard */ 9002521d698Sbellard #define TARGET_FPE_INTDIV (1) /* integer divide by zero */ 9012521d698Sbellard #define TARGET_FPE_INTOVF (2) /* integer overflow */ 9022521d698Sbellard #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ 9032521d698Sbellard #define TARGET_FPE_FLTOVF (4) /* floating point overflow */ 9042521d698Sbellard #define TARGET_FPE_FLTUND (5) /* floating point underflow */ 9052521d698Sbellard #define TARGET_FPE_FLTRES (6) /* floating point inexact result */ 9062521d698Sbellard #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ 9072521d698Sbellard #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ 9082521d698Sbellard #define TARGET_NSIGFPE 8 9092521d698Sbellard 9102521d698Sbellard /* 9112521d698Sbellard * SIGSEGV si_codes 9122521d698Sbellard */ 9132521d698Sbellard #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ 9142521d698Sbellard #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ 915de2fdd56SChen Gang #define TARGET_SEGV_BNDERR (3) /* failed address bound checks */ 9162521d698Sbellard 9172521d698Sbellard /* 918ffa65c3bSbellard * SIGBUS si_codes 919ffa65c3bSbellard */ 920ffa65c3bSbellard #define TARGET_BUS_ADRALN (1) /* invalid address alignment */ 921b4916d7bSDong Xu Wang #define TARGET_BUS_ADRERR (2) /* non-existent physical address */ 922ffa65c3bSbellard #define TARGET_BUS_OBJERR (3) /* object specific hardware error */ 923de2fdd56SChen Gang /* hardware memory error consumed on a machine check: action required */ 924de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AR (4) 925de2fdd56SChen Gang /* hardware memory error detected in process but not consumed: action optional*/ 926de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AO (5) 927ffa65c3bSbellard 928ffa65c3bSbellard /* 9292521d698Sbellard * SIGTRAP si_codes 9302521d698Sbellard */ 9312521d698Sbellard #define TARGET_TRAP_BRKPT (1) /* process breakpoint */ 9322521d698Sbellard #define TARGET_TRAP_TRACE (2) /* process trace trap */ 933de2fdd56SChen Gang #define TARGET_TRAP_BRANCH (3) /* process taken branch trap */ 934de2fdd56SChen Gang #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */ 9352521d698Sbellard 9362521d698Sbellard #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */ 9372521d698Sbellard 9389de5e440Sbellard struct target_rlimit { 939992f48a0Sblueswir1 abi_ulong rlim_cur; 940992f48a0Sblueswir1 abi_ulong rlim_max; 9419de5e440Sbellard }; 9429de5e440Sbellard 94381bbe906Stakasi-y@ops.dti.ne.jp #if defined(TARGET_ALPHA) 944e476492eSAurelien Jarno #define TARGET_RLIM_INFINITY 0x7fffffffffffffffull 9456cafd027SMatthias Braun #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32) 94681bbe906Stakasi-y@ops.dti.ne.jp #define TARGET_RLIM_INFINITY 0x7fffffffUL 94781bbe906Stakasi-y@ops.dti.ne.jp #else 94826b746dbSMatthias Braun #define TARGET_RLIM_INFINITY ((abi_ulong)-1) 94981bbe906Stakasi-y@ops.dti.ne.jp #endif 95081bbe906Stakasi-y@ops.dti.ne.jp 951e22b7015SWesley W. Terpstra #if defined(TARGET_MIPS) 952e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 953e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 954e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 955e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 956e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 957e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 7 958e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 8 959e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 5 960e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 9 961e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 6 962e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 963e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 964e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 965e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 966e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 967e22b7015SWesley W. Terpstra #else 968e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 969e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 970e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 971e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 972e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 973e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 5 9746cafd027SMatthias Braun #if defined(TARGET_SPARC) 9756cafd027SMatthias Braun #define TARGET_RLIMIT_NOFILE 6 9766cafd027SMatthias Braun #define TARGET_RLIMIT_NPROC 7 9776cafd027SMatthias Braun #else 978e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 6 979e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 7 9806cafd027SMatthias Braun #endif 981e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 8 982e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 9 983e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 984e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 985e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 986e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 987e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 988e22b7015SWesley W. Terpstra #endif 989e22b7015SWesley W. Terpstra 9909de5e440Sbellard struct target_pollfd { 9919de5e440Sbellard int fd; /* file descriptor */ 9929de5e440Sbellard short events; /* requested events */ 9939de5e440Sbellard short revents; /* returned events */ 9949de5e440Sbellard }; 9959de5e440Sbellard 9968e5a0667Sbellard /* virtual terminal ioctls */ 9970221cfcdSbellard #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ 9980221cfcdSbellard #define TARGET_KDMKTONE 0x4B30 /* generate tone */ 9998e5a0667Sbellard #define TARGET_KDGKBTYPE 0x4b33 1000f7680a55SUlrich Hecht #define TARGET_KDSETMODE 0x4b3a 1001f7680a55SUlrich Hecht #define TARGET_KDGKBMODE 0x4b44 1002f7680a55SUlrich Hecht #define TARGET_KDSKBMODE 0x4b45 10030221cfcdSbellard #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ 10040221cfcdSbellard #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ 1005e6fe18fbSCédric VINCENT #define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ 1006e6fe18fbSCédric VINCENT #define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ 1007e6fe18fbSCédric VINCENT #define TARGET_KDGETLED 0x4B31 /* return current led state */ 1008e6fe18fbSCédric VINCENT #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */ 1009ca56f5b5SPaul Burton #define TARGET_KDSIGACCEPT 0x4B4E 10108e5a0667Sbellard 1011e1be1606SAleksandar Markovic #if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) 1012e1be1606SAleksandar Markovic #define TARGET_SIOCATMARK TARGET_IOR('s', 7, int) 1013405b4915SHelge Deller #define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t) 1014e1be1606SAleksandar Markovic #else 10152521d698Sbellard #define TARGET_SIOCATMARK 0x8905 1016405b4915SHelge Deller #define TARGET_SIOCGPGRP 0x8904 1017e1be1606SAleksandar Markovic #endif 1018405b4915SHelge Deller #define TARGET_SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ 1019405b4915SHelge Deller #define TARGET_SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ 10202521d698Sbellard 102131e31b8aSbellard /* Networking ioctls */ 102231e31b8aSbellard #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ 102331e31b8aSbellard #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ 102431e31b8aSbellard #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ 102531e31b8aSbellard #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ 102631e31b8aSbellard #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ 102731e31b8aSbellard #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ 102831e31b8aSbellard #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ 102931e31b8aSbellard #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ 103031e31b8aSbellard #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ 103131e31b8aSbellard #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ 103231e31b8aSbellard #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ 103331e31b8aSbellard #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ 103431e31b8aSbellard #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ 103531e31b8aSbellard #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ 103631e31b8aSbellard #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ 103731e31b8aSbellard #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ 103831e31b8aSbellard #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ 103931e31b8aSbellard #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ 104031e31b8aSbellard #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ 104131e31b8aSbellard #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ 104231e31b8aSbellard #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ 104331e31b8aSbellard #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ 104431e31b8aSbellard #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ 104531e31b8aSbellard #define TARGET_SIOCSIFENCAP 0x8926 104631e31b8aSbellard #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ 104731e31b8aSbellard #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ 104831e31b8aSbellard #define TARGET_SIOCSIFSLAVE 0x8930 104931e31b8aSbellard #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ 105031e31b8aSbellard #define TARGET_SIOCDELMULTI 0x8932 1051f63eb01aSPaul Burton #define TARGET_SIOCGIFINDEX 0x8933 105231e31b8aSbellard 105331e31b8aSbellard /* Bridging control calls */ 105431e31b8aSbellard #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ 105531e31b8aSbellard #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ 105631e31b8aSbellard 105731e31b8aSbellard #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ 105831e31b8aSbellard #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ 105931e31b8aSbellard 106031e31b8aSbellard /* ARP cache control calls. */ 106131e31b8aSbellard #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ 106231e31b8aSbellard #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ 106331e31b8aSbellard #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ 106431e31b8aSbellard #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ 106531e31b8aSbellard #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ 106631e31b8aSbellard #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ 106731e31b8aSbellard 106831e31b8aSbellard /* RARP cache control calls. */ 106931e31b8aSbellard #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ 107031e31b8aSbellard #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ 107131e31b8aSbellard #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ 107231e31b8aSbellard 107331e31b8aSbellard /* Driver configuration calls */ 107431e31b8aSbellard #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ 107531e31b8aSbellard #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ 107631e31b8aSbellard 107731e31b8aSbellard /* DLCI configuration calls */ 107831e31b8aSbellard #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ 107931e31b8aSbellard #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ 108031e31b8aSbellard 108186fcd946SLaurent Vivier /* From <linux/wireless.h> */ 108286fcd946SLaurent Vivier 108386fcd946SLaurent Vivier #define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ 108431e31b8aSbellard 1085d6d6d6feSMarco A L Barbosa /* From <linux/random.h> */ 1086d6d6d6feSMarco A L Barbosa 1087d6d6d6feSMarco A L Barbosa #define TARGET_RNDGETENTCNT TARGET_IOR('R', 0x00, int) 1088d6d6d6feSMarco A L Barbosa #define TARGET_RNDADDTOENTCNT TARGET_IOW('R', 0x01, int) 1089d6d6d6feSMarco A L Barbosa #define TARGET_RNDZAPENTCNT TARGET_IO('R', 0x04) 1090d6d6d6feSMarco A L Barbosa #define TARGET_RNDCLEARPOOL TARGET_IO('R', 0x06) 1091d6d6d6feSMarco A L Barbosa 109231e31b8aSbellard /* From <linux/fs.h> */ 109331e31b8aSbellard 109431e31b8aSbellard #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ 109531e31b8aSbellard #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ 109631e31b8aSbellard #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ 109731e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ 109831e31b8aSbellard #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ 109931e31b8aSbellard #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ 110031e31b8aSbellard #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ 110131e31b8aSbellard #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ 110231e31b8aSbellard #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ 110331e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ 110431e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ 110531e31b8aSbellard #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ 1106fff8c539SAndreas Färber #define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */ 110731e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */ 1108c8b0bf54SPeter Maydell #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong) 1109c8b0bf54SPeter Maydell #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong) 1110edafea13SAlexander Graf #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) 1111edafea13SAlexander Graf /* return device size in bytes 1112edafea13SAlexander Graf (u64 *arg) */ 11134715856aSPeter Maydell 11144715856aSPeter Maydell #define TARGET_BLKDISCARD TARGET_IO(0x12, 119) 11154715856aSPeter Maydell #define TARGET_BLKIOMIN TARGET_IO(0x12, 120) 11164715856aSPeter Maydell #define TARGET_BLKIOOPT TARGET_IO(0x12, 121) 11174715856aSPeter Maydell #define TARGET_BLKALIGNOFF TARGET_IO(0x12, 122) 11184715856aSPeter Maydell #define TARGET_BLKPBSZGET TARGET_IO(0x12, 123) 11194715856aSPeter Maydell #define TARGET_BLKDISCARDZEROES TARGET_IO(0x12, 124) 11204715856aSPeter Maydell #define TARGET_BLKSECDISCARD TARGET_IO(0x12, 125) 11214715856aSPeter Maydell #define TARGET_BLKROTATIONAL TARGET_IO(0x12, 126) 11224715856aSPeter Maydell #define TARGET_BLKZEROOUT TARGET_IO(0x12, 127) 11234715856aSPeter Maydell 112431e31b8aSbellard #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ 112531e31b8aSbellard #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ 112621992cb6SHelge Deller 112721992cb6SHelge Deller #define TARGET_FICLONE TARGET_IOW(0x94, 9, int) 112821992cb6SHelge Deller #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range) 112921992cb6SHelge Deller 113060807231SPeter Maydell /* Note that the ioctl numbers claim type "long" but the actual type 113160807231SPeter Maydell * used by the kernel is "int". 113260807231SPeter Maydell */ 11331847b7baSPeter Maydell #define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, abi_long) 11341847b7baSPeter Maydell #define TARGET_FS_IOC_SETFLAGS TARGET_IOW('f', 2, abi_long) 113560807231SPeter Maydell 1136285da2b9SPeter Maydell #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) 113731e31b8aSbellard 113831e31b8aSbellard /* cdrom commands */ 113931e31b8aSbellard #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ 114031e31b8aSbellard #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ 114131e31b8aSbellard #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ 114231e31b8aSbellard #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index 114331e31b8aSbellard (struct cdrom_ti) */ 114431e31b8aSbellard #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header 114531e31b8aSbellard (struct cdrom_tochdr) */ 114631e31b8aSbellard #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry 114731e31b8aSbellard (struct cdrom_tocentry) */ 114831e31b8aSbellard #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ 114931e31b8aSbellard #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ 115031e31b8aSbellard #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ 115131e31b8aSbellard #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume 115231e31b8aSbellard (struct cdrom_volctrl) */ 115331e31b8aSbellard #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data 115431e31b8aSbellard (struct cdrom_subchnl) */ 115531e31b8aSbellard #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) 115631e31b8aSbellard (struct cdrom_read) */ 115731e31b8aSbellard #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) 115831e31b8aSbellard (struct cdrom_read) */ 115931e31b8aSbellard #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ 116031e31b8aSbellard #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ 116131e31b8aSbellard #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session 116231e31b8aSbellard address of multi session disks 116331e31b8aSbellard (struct cdrom_multisession) */ 116431e31b8aSbellard #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" 116531e31b8aSbellard if available (struct cdrom_mcn) */ 116667cc32ebSVeres Lajos #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is deprecated, 1167b4916d7bSDong Xu Wang but here anyway for compatibility */ 116831e31b8aSbellard #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ 116931e31b8aSbellard #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting 117031e31b8aSbellard (struct cdrom_volctrl) */ 117131e31b8aSbellard #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) 117231e31b8aSbellard (struct cdrom_read) */ 117331e31b8aSbellard /* 117431e31b8aSbellard * These ioctls are used only used in aztcd.c and optcd.c 117531e31b8aSbellard */ 117631e31b8aSbellard #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ 117731e31b8aSbellard #define TARGET_CDROMSEEK 0x5316 /* seek msf address */ 117831e31b8aSbellard 117931e31b8aSbellard /* 118031e31b8aSbellard * This ioctl is only used by the scsi-cd driver. 118131e31b8aSbellard It is for playing audio in logical block addressing mode. 118231e31b8aSbellard */ 118331e31b8aSbellard #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ 118431e31b8aSbellard 118531e31b8aSbellard /* 118631e31b8aSbellard * These ioctls are only used in optcd.c 118731e31b8aSbellard */ 118831e31b8aSbellard #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ 118931e31b8aSbellard 119031e31b8aSbellard /* 119131e31b8aSbellard * These ioctls are (now) only in ide-cd.c for controlling 119231e31b8aSbellard * drive spindown time. They should be implemented in the 119331e31b8aSbellard * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, 119431e31b8aSbellard * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... 119531e31b8aSbellard * -Erik 119631e31b8aSbellard */ 119731e31b8aSbellard #define TARGET_CDROMGETSPINDOWN 0x531d 119831e31b8aSbellard #define TARGET_CDROMSETSPINDOWN 0x531e 119931e31b8aSbellard 120031e31b8aSbellard /* 120131e31b8aSbellard * These ioctls are implemented through the uniform CD-ROM driver 120231e31b8aSbellard * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM 120331e31b8aSbellard * drivers are eventually ported to the uniform CD-ROM driver interface. 120431e31b8aSbellard */ 120531e31b8aSbellard #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ 120631e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ 120731e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ 120831e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ 120931e31b8aSbellard #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ 121031e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ 121131e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ 121231e31b8aSbellard #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ 121331e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ 121431e31b8aSbellard #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ 121531e31b8aSbellard #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ 121631e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ 121731e31b8aSbellard 121831e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. 121931e31b8aSbellard * Future CDROM ioctls should be kept below 0x537F 122031e31b8aSbellard */ 122131e31b8aSbellard 122231e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */ 122331e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ 122431e31b8aSbellard /* conflict with SCSI_IOCTL_GET_IDLUN */ 122531e31b8aSbellard 122631e31b8aSbellard /* DVD-ROM Specific ioctls */ 122731e31b8aSbellard #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ 122831e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ 122931e31b8aSbellard #define TARGET_DVD_AUTH 0x5392 /* Authentication */ 123031e31b8aSbellard 123131e31b8aSbellard #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ 123231e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ 123331e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ 123431e31b8aSbellard 123531e31b8aSbellard /* HD commands */ 123631e31b8aSbellard 123731e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ 123831e31b8aSbellard #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ 123931e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ 124031e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ 124131e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ 124231e31b8aSbellard #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ 124331e31b8aSbellard #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ 124431e31b8aSbellard #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ 12452521d698Sbellard #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ 124631e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ 124731e31b8aSbellard 124831e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ 124931e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ 125031e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ 125131e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ 125231e31b8aSbellard #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ 125331e31b8aSbellard #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ 125431e31b8aSbellard #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ 125531e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ 12562521d698Sbellard 1257b8005914Sbalrog /* loop ioctls */ 1258b8005914Sbalrog #define TARGET_LOOP_SET_FD 0x4C00 1259b8005914Sbalrog #define TARGET_LOOP_CLR_FD 0x4C01 1260b8005914Sbalrog #define TARGET_LOOP_SET_STATUS 0x4C02 1261b8005914Sbalrog #define TARGET_LOOP_GET_STATUS 0x4C03 1262b8005914Sbalrog #define TARGET_LOOP_SET_STATUS64 0x4C04 1263b8005914Sbalrog #define TARGET_LOOP_GET_STATUS64 0x4C05 1264b8005914Sbalrog #define TARGET_LOOP_CHANGE_FD 0x4C06 12652521d698Sbellard 1266884cdc48SPeter Maydell #define TARGET_LOOP_CTL_ADD 0x4C80 1267884cdc48SPeter Maydell #define TARGET_LOOP_CTL_REMOVE 0x4C81 1268884cdc48SPeter Maydell #define TARGET_LOOP_CTL_GET_FREE 0x4C82 1269884cdc48SPeter Maydell 1270f7680a55SUlrich Hecht /* fb ioctls */ 1271f7680a55SUlrich Hecht #define TARGET_FBIOGET_VSCREENINFO 0x4600 1272f7680a55SUlrich Hecht #define TARGET_FBIOPUT_VSCREENINFO 0x4601 1273f7680a55SUlrich Hecht #define TARGET_FBIOGET_FSCREENINFO 0x4602 127412b81b71SCédric VINCENT #define TARGET_FBIOGETCMAP 0x4604 127512b81b71SCédric VINCENT #define TARGET_FBIOPUTCMAP 0x4605 127612b81b71SCédric VINCENT #define TARGET_FBIOPAN_DISPLAY 0x4606 127712b81b71SCédric VINCENT #define TARGET_FBIOGET_CON2FBMAP 0x460F 127812b81b71SCédric VINCENT #define TARGET_FBIOPUT_CON2FBMAP 0x4610 1279f7680a55SUlrich Hecht 1280f7680a55SUlrich Hecht /* vt ioctls */ 1281f7680a55SUlrich Hecht #define TARGET_VT_OPENQRY 0x5600 1282f7680a55SUlrich Hecht #define TARGET_VT_GETSTATE 0x5603 1283f7680a55SUlrich Hecht #define TARGET_VT_ACTIVATE 0x5606 1284f7680a55SUlrich Hecht #define TARGET_VT_WAITACTIVE 0x5607 1285f7680a55SUlrich Hecht #define TARGET_VT_LOCKSWITCH 0x560b 1286f7680a55SUlrich Hecht #define TARGET_VT_UNLOCKSWITCH 0x560c 1287774750c0SCédric VINCENT #define TARGET_VT_GETMODE 0x5601 1288774750c0SCédric VINCENT #define TARGET_VT_SETMODE 0x5602 1289774750c0SCédric VINCENT #define TARGET_VT_RELDISP 0x5605 1290774750c0SCédric VINCENT #define TARGET_VT_DISALLOCATE 0x5608 1291f7680a55SUlrich Hecht 129256e904ecSAlexander Graf /* device mapper */ 129356e904ecSAlexander Graf #define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00) 129456e904ecSAlexander Graf #define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01) 129556e904ecSAlexander Graf #define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02) 129656e904ecSAlexander Graf #define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03) 129756e904ecSAlexander Graf #define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04) 129856e904ecSAlexander Graf #define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05) 129956e904ecSAlexander Graf #define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06) 130056e904ecSAlexander Graf #define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07) 130156e904ecSAlexander Graf #define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08) 130256e904ecSAlexander Graf #define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09) 130356e904ecSAlexander Graf #define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a) 130456e904ecSAlexander Graf #define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b) 130556e904ecSAlexander Graf #define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c) 130656e904ecSAlexander Graf #define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d) 130756e904ecSAlexander Graf #define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e) 130856e904ecSAlexander Graf #define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f) 130956e904ecSAlexander Graf 13102521d698Sbellard /* from asm/termbits.h */ 13112521d698Sbellard 13123bfd9da1Sbellard #define TARGET_NCC 8 13133bfd9da1Sbellard struct target_termio { 13143bfd9da1Sbellard unsigned short c_iflag; /* input mode flags */ 13153bfd9da1Sbellard unsigned short c_oflag; /* output mode flags */ 13163bfd9da1Sbellard unsigned short c_cflag; /* control mode flags */ 13173bfd9da1Sbellard unsigned short c_lflag; /* local mode flags */ 13182521d698Sbellard unsigned char c_line; /* line discipline */ 13193bfd9da1Sbellard unsigned char c_cc[TARGET_NCC]; /* control characters */ 13202521d698Sbellard }; 13212521d698Sbellard 13223bfd9da1Sbellard struct target_winsize { 13233bfd9da1Sbellard unsigned short ws_row; 13243bfd9da1Sbellard unsigned short ws_col; 13253bfd9da1Sbellard unsigned short ws_xpixel; 13263bfd9da1Sbellard unsigned short ws_ypixel; 13273bfd9da1Sbellard }; 13282521d698Sbellard 13293bfd9da1Sbellard #include "termbits.h" 13302521d698Sbellard 13319e0b74a4SPaul Brook #if defined(TARGET_MIPS) 13329e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x10 13339e0b74a4SPaul Brook #else 13349e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x08 13359e0b74a4SPaul Brook #endif 13369e0b74a4SPaul Brook 1337e44a3e79Saurel32 /* Common */ 13382521d698Sbellard #define TARGET_MAP_SHARED 0x01 /* Share changes */ 13392521d698Sbellard #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ 1340e65be6a7SHelge Deller #if defined(TARGET_HPPA) 1341e65be6a7SHelge Deller #define TARGET_MAP_TYPE 0x03 /* Mask for type of mapping */ 1342e65be6a7SHelge Deller #else 13432521d698Sbellard #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ 1344e65be6a7SHelge Deller #endif 1345e44a3e79Saurel32 1346e44a3e79Saurel32 /* Target specific */ 1347048f6b4dSbellard #if defined(TARGET_MIPS) 1348e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1349048f6b4dSbellard #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 1350048f6b4dSbellard #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 1351048f6b4dSbellard #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 1352048f6b4dSbellard #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 1353048f6b4dSbellard #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 1354048f6b4dSbellard #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 1355540635baSths #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 1356540635baSths #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1357541e1690SHelge Deller #define TARGET_MAP_STACK 0x40000 /* ignored */ 1358541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ 1359e44a3e79Saurel32 #elif defined(TARGET_PPC) 1360e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 13612521d698Sbellard #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 13622521d698Sbellard #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 13632521d698Sbellard #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 13642521d698Sbellard #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 13657ec93196Sj_mayer #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ 13667ec93196Sj_mayer #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ 1367e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1368e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1369541e1690SHelge Deller #define TARGET_MAP_STACK 0x20000 /* ignored */ 1370541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ 1371e44a3e79Saurel32 #elif defined(TARGET_ALPHA) 1372e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1373e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ 1374e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ 1375e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ 1376e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ 1377e44a3e79Saurel32 #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ 1378e44a3e79Saurel32 #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ 1379e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ 1380e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ 1381541e1690SHelge Deller #define TARGET_MAP_STACK 0x80000 /* ignored */ 1382541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x100000 /* create a huge page mapping */ 1383a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 1384a10d1e50SRichard Henderson #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1385a10d1e50SRichard Henderson #define TARGET_MAP_FIXED 0x04 /* Interpret addr exactly */ 1386a10d1e50SRichard Henderson #define TARGET_MAP_GROWSDOWN 0x08000 /* stack-like segment */ 1387a10d1e50SRichard Henderson #define TARGET_MAP_DENYWRITE 0x00800 /* ETXTBSY */ 1388a10d1e50SRichard Henderson #define TARGET_MAP_EXECUTABLE 0x01000 /* mark it as an executable */ 1389a10d1e50SRichard Henderson #define TARGET_MAP_LOCKED 0x02000 /* lock the mapping */ 1390a10d1e50SRichard Henderson #define TARGET_MAP_NORESERVE 0x04000 /* no check for reservations */ 1391a10d1e50SRichard Henderson #define TARGET_MAP_POPULATE 0x10000 /* pop (prefault) pagetables */ 1392a10d1e50SRichard Henderson #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1393541e1690SHelge Deller #define TARGET_MAP_STACK 0x40000 /* ignored */ 1394541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ 13957ec93196Sj_mayer #else 1396e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1397e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 1398e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 1399e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 1400e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 14012521d698Sbellard #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ 14022521d698Sbellard #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ 1403540635baSths #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1404540635baSths #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1405541e1690SHelge Deller #define TARGET_MAP_STACK 0x20000 /* ignored */ 1406541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ 1407906c1b8eSMike Frysinger #define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ 14087ec93196Sj_mayer #endif 14092521d698Sbellard 141009701199SAlexander Graf #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 141109701199SAlexander Graf || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 1412c7819dfbSPeter Maydell || defined(TARGET_CRIS) || defined(TARGET_UNICORE32) 14132521d698Sbellard struct target_stat { 14142521d698Sbellard unsigned short st_dev; 14152521d698Sbellard unsigned short __pad1; 1416992f48a0Sblueswir1 abi_ulong st_ino; 14172521d698Sbellard unsigned short st_mode; 14182521d698Sbellard unsigned short st_nlink; 14192521d698Sbellard unsigned short st_uid; 14202521d698Sbellard unsigned short st_gid; 14212521d698Sbellard unsigned short st_rdev; 14222521d698Sbellard unsigned short __pad2; 1423992f48a0Sblueswir1 abi_ulong st_size; 1424992f48a0Sblueswir1 abi_ulong st_blksize; 1425992f48a0Sblueswir1 abi_ulong st_blocks; 1426992f48a0Sblueswir1 abi_ulong target_st_atime; 1427992f48a0Sblueswir1 abi_ulong __unused1; 1428992f48a0Sblueswir1 abi_ulong target_st_mtime; 1429992f48a0Sblueswir1 abi_ulong __unused2; 1430992f48a0Sblueswir1 abi_ulong target_st_ctime; 1431992f48a0Sblueswir1 abi_ulong __unused3; 1432992f48a0Sblueswir1 abi_ulong __unused4; 1433992f48a0Sblueswir1 abi_ulong __unused5; 14342521d698Sbellard }; 14352521d698Sbellard 14362521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely 14372521d698Sbellard * insane amounts of padding around dev_t's. 14382521d698Sbellard */ 143920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 14402521d698Sbellard struct target_stat64 { 14412521d698Sbellard unsigned short st_dev; 14422521d698Sbellard unsigned char __pad0[10]; 14432521d698Sbellard 14442521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1445992f48a0Sblueswir1 abi_ulong __st_ino; 14462521d698Sbellard 14472521d698Sbellard unsigned int st_mode; 14482521d698Sbellard unsigned int st_nlink; 14492521d698Sbellard 1450992f48a0Sblueswir1 abi_ulong st_uid; 1451992f48a0Sblueswir1 abi_ulong st_gid; 14522521d698Sbellard 14532521d698Sbellard unsigned short st_rdev; 14542521d698Sbellard unsigned char __pad3[10]; 14552521d698Sbellard 14562521d698Sbellard long long st_size; 1457992f48a0Sblueswir1 abi_ulong st_blksize; 14582521d698Sbellard 1459992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1460992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 14612521d698Sbellard 1462992f48a0Sblueswir1 abi_ulong target_st_atime; 1463992f48a0Sblueswir1 abi_ulong __pad5; 14642521d698Sbellard 1465992f48a0Sblueswir1 abi_ulong target_st_mtime; 1466992f48a0Sblueswir1 abi_ulong __pad6; 14672521d698Sbellard 1468992f48a0Sblueswir1 abi_ulong target_st_ctime; 1469992f48a0Sblueswir1 abi_ulong __pad7; /* will be high 32 bits of ctime someday */ 14702521d698Sbellard 14712521d698Sbellard unsigned long long st_ino; 1472541dc0d4SStefan Weil } QEMU_PACKED; 14732521d698Sbellard 1474ce4defa0Spbrook #ifdef TARGET_ARM 147520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1476ce4defa0Spbrook struct target_eabi_stat64 { 1477ce4defa0Spbrook unsigned long long st_dev; 1478ce4defa0Spbrook unsigned int __pad1; 1479992f48a0Sblueswir1 abi_ulong __st_ino; 1480ce4defa0Spbrook unsigned int st_mode; 1481ce4defa0Spbrook unsigned int st_nlink; 1482ce4defa0Spbrook 1483992f48a0Sblueswir1 abi_ulong st_uid; 1484992f48a0Sblueswir1 abi_ulong st_gid; 1485ce4defa0Spbrook 1486ce4defa0Spbrook unsigned long long st_rdev; 1487ce4defa0Spbrook unsigned int __pad2[2]; 1488ce4defa0Spbrook 1489ce4defa0Spbrook long long st_size; 1490992f48a0Sblueswir1 abi_ulong st_blksize; 1491ce4defa0Spbrook unsigned int __pad3; 1492ce4defa0Spbrook unsigned long long st_blocks; 1493ce4defa0Spbrook 1494992f48a0Sblueswir1 abi_ulong target_st_atime; 1495992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1496ce4defa0Spbrook 1497992f48a0Sblueswir1 abi_ulong target_st_mtime; 1498992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1499ce4defa0Spbrook 1500992f48a0Sblueswir1 abi_ulong target_st_ctime; 1501992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1502ce4defa0Spbrook 1503ce4defa0Spbrook unsigned long long st_ino; 1504541dc0d4SStefan Weil } QEMU_PACKED; 1505ce4defa0Spbrook #endif 1506ce4defa0Spbrook 1507992f48a0Sblueswir1 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 15081b8dd648Sblueswir1 struct target_stat { 15091b8dd648Sblueswir1 unsigned int st_dev; 1510992f48a0Sblueswir1 abi_ulong st_ino; 15111b8dd648Sblueswir1 unsigned int st_mode; 15121b8dd648Sblueswir1 unsigned int st_nlink; 15131b8dd648Sblueswir1 unsigned int st_uid; 15141b8dd648Sblueswir1 unsigned int st_gid; 15151b8dd648Sblueswir1 unsigned int st_rdev; 1516992f48a0Sblueswir1 abi_long st_size; 1517992f48a0Sblueswir1 abi_long target_st_atime; 1518992f48a0Sblueswir1 abi_long target_st_mtime; 1519992f48a0Sblueswir1 abi_long target_st_ctime; 1520992f48a0Sblueswir1 abi_long st_blksize; 1521992f48a0Sblueswir1 abi_long st_blocks; 1522992f48a0Sblueswir1 abi_ulong __unused4[2]; 15231b8dd648Sblueswir1 }; 15241b8dd648Sblueswir1 152520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 15261b8dd648Sblueswir1 struct target_stat64 { 15271b8dd648Sblueswir1 unsigned char __pad0[6]; 15281b8dd648Sblueswir1 unsigned short st_dev; 15291b8dd648Sblueswir1 15301b8dd648Sblueswir1 uint64_t st_ino; 15311b8dd648Sblueswir1 uint64_t st_nlink; 15321b8dd648Sblueswir1 15331b8dd648Sblueswir1 unsigned int st_mode; 15341b8dd648Sblueswir1 15351b8dd648Sblueswir1 unsigned int st_uid; 15361b8dd648Sblueswir1 unsigned int st_gid; 15371b8dd648Sblueswir1 15381b8dd648Sblueswir1 unsigned char __pad2[6]; 15391b8dd648Sblueswir1 unsigned short st_rdev; 15401b8dd648Sblueswir1 15411b8dd648Sblueswir1 int64_t st_size; 15421b8dd648Sblueswir1 int64_t st_blksize; 15431b8dd648Sblueswir1 15441b8dd648Sblueswir1 unsigned char __pad4[4]; 15451b8dd648Sblueswir1 unsigned int st_blocks; 15461b8dd648Sblueswir1 1547992f48a0Sblueswir1 abi_ulong target_st_atime; 1548992f48a0Sblueswir1 abi_ulong __unused1; 15491b8dd648Sblueswir1 1550992f48a0Sblueswir1 abi_ulong target_st_mtime; 1551992f48a0Sblueswir1 abi_ulong __unused2; 15521b8dd648Sblueswir1 1553992f48a0Sblueswir1 abi_ulong target_st_ctime; 1554992f48a0Sblueswir1 abi_ulong __unused3; 15551b8dd648Sblueswir1 1556992f48a0Sblueswir1 abi_ulong __unused4[3]; 15571b8dd648Sblueswir1 }; 15581b8dd648Sblueswir1 15593bfd9da1Sbellard #elif defined(TARGET_SPARC) 15603bfd9da1Sbellard 15613bfd9da1Sbellard struct target_stat { 15623bfd9da1Sbellard unsigned short st_dev; 1563992f48a0Sblueswir1 abi_ulong st_ino; 15643bfd9da1Sbellard unsigned short st_mode; 15653bfd9da1Sbellard short st_nlink; 15663bfd9da1Sbellard unsigned short st_uid; 15673bfd9da1Sbellard unsigned short st_gid; 15683bfd9da1Sbellard unsigned short st_rdev; 1569992f48a0Sblueswir1 abi_long st_size; 1570992f48a0Sblueswir1 abi_long target_st_atime; 1571992f48a0Sblueswir1 abi_ulong __unused1; 1572992f48a0Sblueswir1 abi_long target_st_mtime; 1573992f48a0Sblueswir1 abi_ulong __unused2; 1574992f48a0Sblueswir1 abi_long target_st_ctime; 1575992f48a0Sblueswir1 abi_ulong __unused3; 1576992f48a0Sblueswir1 abi_long st_blksize; 1577992f48a0Sblueswir1 abi_long st_blocks; 1578992f48a0Sblueswir1 abi_ulong __unused4[2]; 15793bfd9da1Sbellard }; 15803bfd9da1Sbellard 158120d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 15823bfd9da1Sbellard struct target_stat64 { 15833bfd9da1Sbellard unsigned char __pad0[6]; 15843bfd9da1Sbellard unsigned short st_dev; 15853bfd9da1Sbellard 15863bfd9da1Sbellard uint64_t st_ino; 15873bfd9da1Sbellard 15883bfd9da1Sbellard unsigned int st_mode; 15893bfd9da1Sbellard unsigned int st_nlink; 15903bfd9da1Sbellard 15913bfd9da1Sbellard unsigned int st_uid; 15923bfd9da1Sbellard unsigned int st_gid; 15933bfd9da1Sbellard 15943bfd9da1Sbellard unsigned char __pad2[6]; 15953bfd9da1Sbellard unsigned short st_rdev; 15963bfd9da1Sbellard 15973bfd9da1Sbellard unsigned char __pad3[8]; 15983bfd9da1Sbellard 15993bfd9da1Sbellard int64_t st_size; 16003bfd9da1Sbellard unsigned int st_blksize; 16013bfd9da1Sbellard 16023bfd9da1Sbellard unsigned char __pad4[8]; 16033bfd9da1Sbellard unsigned int st_blocks; 16043bfd9da1Sbellard 16053bfd9da1Sbellard unsigned int target_st_atime; 16063bfd9da1Sbellard unsigned int __unused1; 16073bfd9da1Sbellard 16083bfd9da1Sbellard unsigned int target_st_mtime; 16093bfd9da1Sbellard unsigned int __unused2; 16103bfd9da1Sbellard 16113bfd9da1Sbellard unsigned int target_st_ctime; 16123bfd9da1Sbellard unsigned int __unused3; 16133bfd9da1Sbellard 16143bfd9da1Sbellard unsigned int __unused4; 16153bfd9da1Sbellard unsigned int __unused5; 16163bfd9da1Sbellard }; 16173bfd9da1Sbellard 161867867308Sbellard #elif defined(TARGET_PPC) 161967867308Sbellard 162067867308Sbellard struct target_stat { 1621e32448e0Sj_mayer abi_ulong st_dev; 1622992f48a0Sblueswir1 abi_ulong st_ino; 1623325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1624e32448e0Sj_mayer abi_ulong st_nlink; 1625325e651fSj_mayer unsigned int st_mode; 1626325e651fSj_mayer #else 162767867308Sbellard unsigned int st_mode; 162867867308Sbellard unsigned short st_nlink; 1629325e651fSj_mayer #endif 163067867308Sbellard unsigned int st_uid; 163167867308Sbellard unsigned int st_gid; 1632e32448e0Sj_mayer abi_ulong st_rdev; 1633992f48a0Sblueswir1 abi_ulong st_size; 1634992f48a0Sblueswir1 abi_ulong st_blksize; 1635992f48a0Sblueswir1 abi_ulong st_blocks; 1636992f48a0Sblueswir1 abi_ulong target_st_atime; 1637e32448e0Sj_mayer abi_ulong target_st_atime_nsec; 1638992f48a0Sblueswir1 abi_ulong target_st_mtime; 1639e32448e0Sj_mayer abi_ulong target_st_mtime_nsec; 1640992f48a0Sblueswir1 abi_ulong target_st_ctime; 1641e32448e0Sj_mayer abi_ulong target_st_ctime_nsec; 1642992f48a0Sblueswir1 abi_ulong __unused4; 1643992f48a0Sblueswir1 abi_ulong __unused5; 1644325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1645325e651fSj_mayer abi_ulong __unused6; 1646325e651fSj_mayer #endif 164767867308Sbellard }; 164867867308Sbellard 164920d155bcSStefan Weil #if !defined(TARGET_PPC64) || defined(TARGET_ABI32) 165020d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1651541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 165267867308Sbellard unsigned long long st_dev; 165367867308Sbellard unsigned long long st_ino; 165467867308Sbellard unsigned int st_mode; 165567867308Sbellard unsigned int st_nlink; 165667867308Sbellard unsigned int st_uid; 165767867308Sbellard unsigned int st_gid; 165867867308Sbellard unsigned long long st_rdev; 1659e1ce5e40Saurel32 unsigned long long __pad0; 166067867308Sbellard long long st_size; 1661e32448e0Sj_mayer int st_blksize; 1662e1ce5e40Saurel32 unsigned int __pad1; 166361322e91SMax Filippov long long st_blocks; /* Number 512-byte blocks allocated. */ 1664e32448e0Sj_mayer int target_st_atime; 1665e32448e0Sj_mayer unsigned int target_st_atime_nsec; 1666e32448e0Sj_mayer int target_st_mtime; 1667e32448e0Sj_mayer unsigned int target_st_mtime_nsec; 1668e32448e0Sj_mayer int target_st_ctime; 1669e32448e0Sj_mayer unsigned int target_st_ctime_nsec; 1670e32448e0Sj_mayer unsigned int __unused4; 1671e32448e0Sj_mayer unsigned int __unused5; 167267867308Sbellard }; 167320d155bcSStefan Weil #endif 167467867308Sbellard 1675b779e29eSEdgar E. Iglesias #elif defined(TARGET_MICROBLAZE) 1676b779e29eSEdgar E. Iglesias 1677b779e29eSEdgar E. Iglesias struct target_stat { 1678b779e29eSEdgar E. Iglesias abi_ulong st_dev; 1679b779e29eSEdgar E. Iglesias abi_ulong st_ino; 1680b779e29eSEdgar E. Iglesias unsigned int st_mode; 1681b779e29eSEdgar E. Iglesias unsigned short st_nlink; 1682b779e29eSEdgar E. Iglesias unsigned int st_uid; 1683b779e29eSEdgar E. Iglesias unsigned int st_gid; 1684b779e29eSEdgar E. Iglesias abi_ulong st_rdev; 1685b779e29eSEdgar E. Iglesias abi_ulong st_size; 1686b779e29eSEdgar E. Iglesias abi_ulong st_blksize; 1687b779e29eSEdgar E. Iglesias abi_ulong st_blocks; 1688b779e29eSEdgar E. Iglesias abi_ulong target_st_atime; 1689b779e29eSEdgar E. Iglesias abi_ulong target_st_atime_nsec; 1690b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime; 1691b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime_nsec; 1692b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime; 1693b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime_nsec; 1694b779e29eSEdgar E. Iglesias abi_ulong __unused4; 1695b779e29eSEdgar E. Iglesias abi_ulong __unused5; 1696b779e29eSEdgar E. Iglesias }; 1697b779e29eSEdgar E. Iglesias 1698b779e29eSEdgar E. Iglesias /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ 169920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1700541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 1701b779e29eSEdgar E. Iglesias uint64_t st_dev; 1702a523eb06SEdgar E. Iglesias #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1703a523eb06SEdgar E. Iglesias uint32_t pad0; 1704a523eb06SEdgar E. Iglesias uint32_t __st_ino; 1705a523eb06SEdgar E. Iglesias 1706b779e29eSEdgar E. Iglesias uint32_t st_mode; 1707b779e29eSEdgar E. Iglesias uint32_t st_nlink; 1708b779e29eSEdgar E. Iglesias uint32_t st_uid; 1709b779e29eSEdgar E. Iglesias uint32_t st_gid; 1710b779e29eSEdgar E. Iglesias uint64_t st_rdev; 171121ebeb23SEdgar E. Iglesias uint64_t __pad1; 1712b779e29eSEdgar E. Iglesias 1713b779e29eSEdgar E. Iglesias int64_t st_size; 1714b779e29eSEdgar E. Iglesias int32_t st_blksize; 171521ebeb23SEdgar E. Iglesias uint32_t __pad2; 1716b779e29eSEdgar E. Iglesias int64_t st_blocks; /* Number 512-byte blocks allocated. */ 1717b779e29eSEdgar E. Iglesias 1718b779e29eSEdgar E. Iglesias int target_st_atime; 1719b779e29eSEdgar E. Iglesias unsigned int target_st_atime_nsec; 1720b779e29eSEdgar E. Iglesias int target_st_mtime; 1721b779e29eSEdgar E. Iglesias unsigned int target_st_mtime_nsec; 1722b779e29eSEdgar E. Iglesias int target_st_ctime; 1723b779e29eSEdgar E. Iglesias unsigned int target_st_ctime_nsec; 1724a523eb06SEdgar E. Iglesias uint64_t st_ino; 1725b779e29eSEdgar E. Iglesias }; 1726b779e29eSEdgar E. Iglesias 1727e6e5906bSpbrook #elif defined(TARGET_M68K) 1728e6e5906bSpbrook 1729e6e5906bSpbrook struct target_stat { 1730e6e5906bSpbrook unsigned short st_dev; 1731e6e5906bSpbrook unsigned short __pad1; 1732992f48a0Sblueswir1 abi_ulong st_ino; 1733e6e5906bSpbrook unsigned short st_mode; 1734e6e5906bSpbrook unsigned short st_nlink; 1735e6e5906bSpbrook unsigned short st_uid; 1736e6e5906bSpbrook unsigned short st_gid; 1737e6e5906bSpbrook unsigned short st_rdev; 1738e6e5906bSpbrook unsigned short __pad2; 1739992f48a0Sblueswir1 abi_ulong st_size; 1740992f48a0Sblueswir1 abi_ulong st_blksize; 1741992f48a0Sblueswir1 abi_ulong st_blocks; 1742992f48a0Sblueswir1 abi_ulong target_st_atime; 1743992f48a0Sblueswir1 abi_ulong __unused1; 1744992f48a0Sblueswir1 abi_ulong target_st_mtime; 1745992f48a0Sblueswir1 abi_ulong __unused2; 1746992f48a0Sblueswir1 abi_ulong target_st_ctime; 1747992f48a0Sblueswir1 abi_ulong __unused3; 1748992f48a0Sblueswir1 abi_ulong __unused4; 1749992f48a0Sblueswir1 abi_ulong __unused5; 1750e6e5906bSpbrook }; 1751e6e5906bSpbrook 1752e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely 1753e6e5906bSpbrook * insane amounts of padding around dev_t's. 1754e6e5906bSpbrook */ 175520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1756e6e5906bSpbrook struct target_stat64 { 1757e6e5906bSpbrook unsigned long long st_dev; 1758e6e5906bSpbrook unsigned char __pad1[2]; 1759e6e5906bSpbrook 1760e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1761992f48a0Sblueswir1 abi_ulong __st_ino; 1762e6e5906bSpbrook 1763e6e5906bSpbrook unsigned int st_mode; 1764e6e5906bSpbrook unsigned int st_nlink; 1765e6e5906bSpbrook 1766992f48a0Sblueswir1 abi_ulong st_uid; 1767992f48a0Sblueswir1 abi_ulong st_gid; 1768e6e5906bSpbrook 1769e6e5906bSpbrook unsigned long long st_rdev; 1770e6e5906bSpbrook unsigned char __pad3[2]; 1771e6e5906bSpbrook 1772e6e5906bSpbrook long long st_size; 1773992f48a0Sblueswir1 abi_ulong st_blksize; 1774e6e5906bSpbrook 1775992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 1776992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1777e6e5906bSpbrook 1778992f48a0Sblueswir1 abi_ulong target_st_atime; 1779992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1780e6e5906bSpbrook 1781992f48a0Sblueswir1 abi_ulong target_st_mtime; 1782992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1783e6e5906bSpbrook 1784992f48a0Sblueswir1 abi_ulong target_st_ctime; 1785992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1786e6e5906bSpbrook 1787e6e5906bSpbrook unsigned long long st_ino; 1788541dc0d4SStefan Weil } QEMU_PACKED; 1789e6e5906bSpbrook 1790d26bc211Sths #elif defined(TARGET_ABI_MIPSN64) 1791540635baSths 1792540635baSths /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ 1793540635baSths struct target_stat { 1794540635baSths unsigned int st_dev; 1795540635baSths unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ 1796540635baSths 1797992f48a0Sblueswir1 abi_ulong st_ino; 1798540635baSths 1799540635baSths unsigned int st_mode; 1800540635baSths unsigned int st_nlink; 1801540635baSths 1802540635baSths int st_uid; 1803540635baSths int st_gid; 1804540635baSths 1805540635baSths unsigned int st_rdev; 1806540635baSths unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ 1807540635baSths 1808992f48a0Sblueswir1 abi_ulong st_size; 1809540635baSths 1810540635baSths /* 1811540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1812540635baSths * but we don't have it under Linux. 1813540635baSths */ 1814540635baSths unsigned int target_st_atime; 1815540635baSths unsigned int target_st_atime_nsec; 1816540635baSths 1817540635baSths unsigned int target_st_mtime; 1818540635baSths unsigned int target_st_mtime_nsec; 1819540635baSths 1820540635baSths unsigned int target_st_ctime; 1821540635baSths unsigned int target_st_ctime_nsec; 1822540635baSths 1823540635baSths unsigned int st_blksize; 1824540635baSths unsigned int st_pad2; 1825540635baSths 1826992f48a0Sblueswir1 abi_ulong st_blocks; 1827540635baSths }; 1828540635baSths 1829d26bc211Sths #elif defined(TARGET_ABI_MIPSN32) 1830540635baSths 1831540635baSths struct target_stat { 18321ab2aea2SLeon Alrae abi_ulong st_dev; 18331ab2aea2SLeon Alrae abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 18341ab2aea2SLeon Alrae uint64_t st_ino; 1835540635baSths unsigned int st_mode; 1836540635baSths unsigned int st_nlink; 1837540635baSths int st_uid; 1838540635baSths int st_gid; 18391ab2aea2SLeon Alrae abi_ulong st_rdev; 18401ab2aea2SLeon Alrae abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 18411ab2aea2SLeon Alrae int64_t st_size; 18421ab2aea2SLeon Alrae abi_long target_st_atime; 18431ab2aea2SLeon Alrae abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 18441ab2aea2SLeon Alrae abi_long target_st_mtime; 18451ab2aea2SLeon Alrae abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 18461ab2aea2SLeon Alrae abi_long target_st_ctime; 18471ab2aea2SLeon Alrae abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 18481ab2aea2SLeon Alrae abi_ulong st_blksize; 18491ab2aea2SLeon Alrae abi_ulong st_pad2; 18501ab2aea2SLeon Alrae int64_t st_blocks; 1851540635baSths }; 1852540635baSths 1853d26bc211Sths #elif defined(TARGET_ABI_MIPSO32) 1854048f6b4dSbellard 1855048f6b4dSbellard struct target_stat { 1856048f6b4dSbellard unsigned st_dev; 1857992f48a0Sblueswir1 abi_long st_pad1[3]; /* Reserved for network id */ 1858992f48a0Sblueswir1 abi_ulong st_ino; 1859048f6b4dSbellard unsigned int st_mode; 1860048f6b4dSbellard unsigned int st_nlink; 1861048f6b4dSbellard int st_uid; 1862048f6b4dSbellard int st_gid; 1863048f6b4dSbellard unsigned st_rdev; 1864992f48a0Sblueswir1 abi_long st_pad2[2]; 1865992f48a0Sblueswir1 abi_long st_size; 1866992f48a0Sblueswir1 abi_long st_pad3; 1867048f6b4dSbellard /* 1868048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1869048f6b4dSbellard * but we don't have it under Linux. 1870048f6b4dSbellard */ 1871992f48a0Sblueswir1 abi_long target_st_atime; 1872992f48a0Sblueswir1 abi_long target_st_atime_nsec; 1873992f48a0Sblueswir1 abi_long target_st_mtime; 1874992f48a0Sblueswir1 abi_long target_st_mtime_nsec; 1875992f48a0Sblueswir1 abi_long target_st_ctime; 1876992f48a0Sblueswir1 abi_long target_st_ctime_nsec; 1877992f48a0Sblueswir1 abi_long st_blksize; 1878992f48a0Sblueswir1 abi_long st_blocks; 1879992f48a0Sblueswir1 abi_long st_pad4[14]; 1880048f6b4dSbellard }; 1881048f6b4dSbellard 1882048f6b4dSbellard /* 1883048f6b4dSbellard * This matches struct stat64 in glibc2.1, hence the absolutely insane 1884048f6b4dSbellard * amounts of padding around dev_t's. The memory layout is the same as of 1885048f6b4dSbellard * struct stat of the 64-bit kernel. 1886048f6b4dSbellard */ 1887048f6b4dSbellard 188820d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1889048f6b4dSbellard struct target_stat64 { 1890992f48a0Sblueswir1 abi_ulong st_dev; 1891992f48a0Sblueswir1 abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 1892048f6b4dSbellard 1893048f6b4dSbellard uint64_t st_ino; 1894048f6b4dSbellard 1895048f6b4dSbellard unsigned int st_mode; 1896048f6b4dSbellard unsigned int st_nlink; 1897048f6b4dSbellard 1898048f6b4dSbellard int st_uid; 1899048f6b4dSbellard int st_gid; 1900048f6b4dSbellard 1901992f48a0Sblueswir1 abi_ulong st_rdev; 1902992f48a0Sblueswir1 abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 1903048f6b4dSbellard 1904048f6b4dSbellard int64_t st_size; 1905048f6b4dSbellard 1906048f6b4dSbellard /* 1907048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1908048f6b4dSbellard * but we don't have it under Linux. 1909048f6b4dSbellard */ 1910992f48a0Sblueswir1 abi_long target_st_atime; 1911992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 1912048f6b4dSbellard 1913992f48a0Sblueswir1 abi_long target_st_mtime; 1914992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 1915048f6b4dSbellard 1916992f48a0Sblueswir1 abi_long target_st_ctime; 1917992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 1918048f6b4dSbellard 1919992f48a0Sblueswir1 abi_ulong st_blksize; 1920992f48a0Sblueswir1 abi_ulong st_pad2; 1921048f6b4dSbellard 1922048f6b4dSbellard int64_t st_blocks; 1923048f6b4dSbellard }; 19247a3148a9Sj_mayer 19257a3148a9Sj_mayer #elif defined(TARGET_ALPHA) 19267a3148a9Sj_mayer 19277a3148a9Sj_mayer struct target_stat { 19287a3148a9Sj_mayer unsigned int st_dev; 19297a3148a9Sj_mayer unsigned int st_ino; 19307a3148a9Sj_mayer unsigned int st_mode; 19317a3148a9Sj_mayer unsigned int st_nlink; 19327a3148a9Sj_mayer unsigned int st_uid; 19337a3148a9Sj_mayer unsigned int st_gid; 19347a3148a9Sj_mayer unsigned int st_rdev; 1935992f48a0Sblueswir1 abi_long st_size; 1936992f48a0Sblueswir1 abi_ulong target_st_atime; 1937992f48a0Sblueswir1 abi_ulong target_st_mtime; 1938992f48a0Sblueswir1 abi_ulong target_st_ctime; 19397a3148a9Sj_mayer unsigned int st_blksize; 19407a3148a9Sj_mayer unsigned int st_blocks; 19417a3148a9Sj_mayer unsigned int st_flags; 19427a3148a9Sj_mayer unsigned int st_gen; 19437a3148a9Sj_mayer }; 19447a3148a9Sj_mayer 194520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 19467a3148a9Sj_mayer struct target_stat64 { 1947992f48a0Sblueswir1 abi_ulong st_dev; 1948992f48a0Sblueswir1 abi_ulong st_ino; 1949992f48a0Sblueswir1 abi_ulong st_rdev; 1950992f48a0Sblueswir1 abi_long st_size; 1951992f48a0Sblueswir1 abi_ulong st_blocks; 19527a3148a9Sj_mayer 19537a3148a9Sj_mayer unsigned int st_mode; 19547a3148a9Sj_mayer unsigned int st_uid; 19557a3148a9Sj_mayer unsigned int st_gid; 19567a3148a9Sj_mayer unsigned int st_blksize; 19577a3148a9Sj_mayer unsigned int st_nlink; 19587a3148a9Sj_mayer unsigned int __pad0; 19597a3148a9Sj_mayer 1960992f48a0Sblueswir1 abi_ulong target_st_atime; 1961992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1962992f48a0Sblueswir1 abi_ulong target_st_mtime; 1963992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1964992f48a0Sblueswir1 abi_ulong target_st_ctime; 1965992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1966992f48a0Sblueswir1 abi_long __unused[3]; 19677a3148a9Sj_mayer }; 19687a3148a9Sj_mayer 19696db45e65Sths #elif defined(TARGET_SH4) 19706db45e65Sths 19716db45e65Sths struct target_stat { 1972992f48a0Sblueswir1 abi_ulong st_dev; 1973992f48a0Sblueswir1 abi_ulong st_ino; 19746db45e65Sths unsigned short st_mode; 19756db45e65Sths unsigned short st_nlink; 19766db45e65Sths unsigned short st_uid; 19776db45e65Sths unsigned short st_gid; 1978992f48a0Sblueswir1 abi_ulong st_rdev; 1979992f48a0Sblueswir1 abi_ulong st_size; 1980992f48a0Sblueswir1 abi_ulong st_blksize; 1981992f48a0Sblueswir1 abi_ulong st_blocks; 1982992f48a0Sblueswir1 abi_ulong target_st_atime; 1983992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1984992f48a0Sblueswir1 abi_ulong target_st_mtime; 1985992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1986992f48a0Sblueswir1 abi_ulong target_st_ctime; 1987992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1988992f48a0Sblueswir1 abi_ulong __unused4; 1989992f48a0Sblueswir1 abi_ulong __unused5; 19906db45e65Sths }; 19916db45e65Sths 19926db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely 19936db45e65Sths * insane amounts of padding around dev_t's. 19946db45e65Sths */ 199520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1996541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 19976db45e65Sths unsigned long long st_dev; 19986db45e65Sths unsigned char __pad0[4]; 19996db45e65Sths 20006db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 2001992f48a0Sblueswir1 abi_ulong __st_ino; 20026db45e65Sths 20036db45e65Sths unsigned int st_mode; 20046db45e65Sths unsigned int st_nlink; 20056db45e65Sths 2006992f48a0Sblueswir1 abi_ulong st_uid; 2007992f48a0Sblueswir1 abi_ulong st_gid; 20086db45e65Sths 20096db45e65Sths unsigned long long st_rdev; 20106db45e65Sths unsigned char __pad3[4]; 20116db45e65Sths 20126db45e65Sths long long st_size; 2013992f48a0Sblueswir1 abi_ulong st_blksize; 20146db45e65Sths 20156db45e65Sths unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ 20166db45e65Sths 2017992f48a0Sblueswir1 abi_ulong target_st_atime; 2018992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 20196db45e65Sths 2020992f48a0Sblueswir1 abi_ulong target_st_mtime; 2021992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 20226db45e65Sths 2023992f48a0Sblueswir1 abi_ulong target_st_ctime; 2024992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 20256db45e65Sths 20266db45e65Sths unsigned long long st_ino; 20276db45e65Sths }; 20286db45e65Sths 2029d2fd1af7Sbellard #elif defined(TARGET_I386) && !defined(TARGET_ABI32) 2030d2fd1af7Sbellard struct target_stat { 2031d2fd1af7Sbellard abi_ulong st_dev; 2032d2fd1af7Sbellard abi_ulong st_ino; 2033d2fd1af7Sbellard abi_ulong st_nlink; 2034d2fd1af7Sbellard 2035d2fd1af7Sbellard unsigned int st_mode; 2036d2fd1af7Sbellard unsigned int st_uid; 2037d2fd1af7Sbellard unsigned int st_gid; 2038d2fd1af7Sbellard unsigned int __pad0; 2039d2fd1af7Sbellard abi_ulong st_rdev; 2040d2fd1af7Sbellard abi_long st_size; 2041d2fd1af7Sbellard abi_long st_blksize; 2042d2fd1af7Sbellard abi_long st_blocks; /* Number 512-byte blocks allocated. */ 2043d2fd1af7Sbellard 2044d2fd1af7Sbellard abi_ulong target_st_atime; 2045d2fd1af7Sbellard abi_ulong target_st_atime_nsec; 2046d2fd1af7Sbellard abi_ulong target_st_mtime; 2047d2fd1af7Sbellard abi_ulong target_st_mtime_nsec; 2048d2fd1af7Sbellard abi_ulong target_st_ctime; 2049d2fd1af7Sbellard abi_ulong target_st_ctime_nsec; 2050d2fd1af7Sbellard 2051d2fd1af7Sbellard abi_long __unused[3]; 2052d2fd1af7Sbellard }; 2053a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 2054a4c075f1SUlrich Hecht struct target_stat { 2055a4c075f1SUlrich Hecht abi_ulong st_dev; 2056a4c075f1SUlrich Hecht abi_ulong st_ino; 2057a4c075f1SUlrich Hecht abi_ulong st_nlink; 2058a4c075f1SUlrich Hecht unsigned int st_mode; 2059a4c075f1SUlrich Hecht unsigned int st_uid; 2060a4c075f1SUlrich Hecht unsigned int st_gid; 2061a4c075f1SUlrich Hecht unsigned int __pad1; 2062a4c075f1SUlrich Hecht abi_ulong st_rdev; 2063a4c075f1SUlrich Hecht abi_ulong st_size; 2064a4c075f1SUlrich Hecht abi_ulong target_st_atime; 2065a4c075f1SUlrich Hecht abi_ulong target_st_atime_nsec; 2066a4c075f1SUlrich Hecht abi_ulong target_st_mtime; 2067a4c075f1SUlrich Hecht abi_ulong target_st_mtime_nsec; 2068a4c075f1SUlrich Hecht abi_ulong target_st_ctime; 2069a4c075f1SUlrich Hecht abi_ulong target_st_ctime_nsec; 2070a4c075f1SUlrich Hecht abi_ulong st_blksize; 2071a4c075f1SUlrich Hecht abi_long st_blocks; 2072a4c075f1SUlrich Hecht abi_ulong __unused[3]; 2073a4c075f1SUlrich Hecht }; 207409701199SAlexander Graf #elif defined(TARGET_AARCH64) 207509701199SAlexander Graf struct target_stat { 207609701199SAlexander Graf abi_ulong st_dev; 207709701199SAlexander Graf abi_ulong st_ino; 207809701199SAlexander Graf unsigned int st_mode; 207909701199SAlexander Graf unsigned int st_nlink; 208009701199SAlexander Graf unsigned int st_uid; 208109701199SAlexander Graf unsigned int st_gid; 208209701199SAlexander Graf abi_ulong st_rdev; 208309701199SAlexander Graf abi_ulong _pad1; 208409701199SAlexander Graf abi_long st_size; 208509701199SAlexander Graf int st_blksize; 208609701199SAlexander Graf int __pad2; 208709701199SAlexander Graf abi_long st_blocks; 208809701199SAlexander Graf abi_long target_st_atime; 208909701199SAlexander Graf abi_ulong target_st_atime_nsec; 209009701199SAlexander Graf abi_long target_st_mtime; 209109701199SAlexander Graf abi_ulong target_st_mtime_nsec; 209209701199SAlexander Graf abi_long target_st_ctime; 209309701199SAlexander Graf abi_ulong target_st_ctime_nsec; 209409701199SAlexander Graf unsigned int __unused[2]; 209509701199SAlexander Graf }; 2096a0a839b6SMarek Vasut #elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) || \ 2097*47ae93cdSMichael Clark defined(TARGET_NIOS2) || defined(TARGET_RISCV) 2098c7819dfbSPeter Maydell 2099c7819dfbSPeter Maydell /* These are the asm-generic versions of the stat and stat64 structures */ 2100c7819dfbSPeter Maydell 2101d962783eSJia Liu struct target_stat { 2102d962783eSJia Liu abi_ulong st_dev; 2103d962783eSJia Liu abi_ulong st_ino; 2104d962783eSJia Liu unsigned int st_mode; 2105c7819dfbSPeter Maydell unsigned int st_nlink; 2106d962783eSJia Liu unsigned int st_uid; 2107d962783eSJia Liu unsigned int st_gid; 2108d962783eSJia Liu abi_ulong st_rdev; 2109c7819dfbSPeter Maydell abi_ulong __pad1; 2110d962783eSJia Liu abi_long st_size; 2111c7819dfbSPeter Maydell int st_blksize; 2112c7819dfbSPeter Maydell int __pad2; 2113c7819dfbSPeter Maydell abi_long st_blocks; 2114c7819dfbSPeter Maydell abi_long target_st_atime; 2115d962783eSJia Liu abi_ulong target_st_atime_nsec; 2116c7819dfbSPeter Maydell abi_long target_st_mtime; 2117d962783eSJia Liu abi_ulong target_st_mtime_nsec; 2118c7819dfbSPeter Maydell abi_long target_st_ctime; 2119d962783eSJia Liu abi_ulong target_st_ctime_nsec; 2120c7819dfbSPeter Maydell unsigned int __unused4; 2121c7819dfbSPeter Maydell unsigned int __unused5; 2122d962783eSJia Liu }; 2123c7819dfbSPeter Maydell 2124*47ae93cdSMichael Clark #if !defined(TARGET_RISCV64) 212520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 2126c7819dfbSPeter Maydell struct target_stat64 { 2127c7819dfbSPeter Maydell uint64_t st_dev; 2128c7819dfbSPeter Maydell uint64_t st_ino; 2129c7819dfbSPeter Maydell unsigned int st_mode; 2130c7819dfbSPeter Maydell unsigned int st_nlink; 2131c7819dfbSPeter Maydell unsigned int st_uid; 2132c7819dfbSPeter Maydell unsigned int st_gid; 2133c7819dfbSPeter Maydell uint64_t st_rdev; 2134c7819dfbSPeter Maydell uint64_t __pad1; 2135c7819dfbSPeter Maydell int64_t st_size; 2136c7819dfbSPeter Maydell int st_blksize; 2137c7819dfbSPeter Maydell int __pad2; 2138c7819dfbSPeter Maydell int64_t st_blocks; 2139c7819dfbSPeter Maydell int target_st_atime; 2140c7819dfbSPeter Maydell unsigned int target_st_atime_nsec; 2141c7819dfbSPeter Maydell int target_st_mtime; 2142c7819dfbSPeter Maydell unsigned int target_st_mtime_nsec; 2143c7819dfbSPeter Maydell int target_st_ctime; 2144c7819dfbSPeter Maydell unsigned int target_st_ctime_nsec; 2145c7819dfbSPeter Maydell unsigned int __unused4; 2146c7819dfbSPeter Maydell unsigned int __unused5; 2147c7819dfbSPeter Maydell }; 2148*47ae93cdSMichael Clark #endif 2149c7819dfbSPeter Maydell 2150a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 2151a10d1e50SRichard Henderson 2152a10d1e50SRichard Henderson struct target_stat { 2153a10d1e50SRichard Henderson abi_uint st_dev; 2154a10d1e50SRichard Henderson abi_uint st_ino; 2155a10d1e50SRichard Henderson abi_ushort st_mode; 2156a10d1e50SRichard Henderson abi_ushort st_nlink; 2157a10d1e50SRichard Henderson abi_ushort _res1; 2158a10d1e50SRichard Henderson abi_ushort _res2; 2159a10d1e50SRichard Henderson abi_uint st_rdev; 2160a10d1e50SRichard Henderson abi_int st_size; 2161a10d1e50SRichard Henderson abi_int target_st_atime; 2162a10d1e50SRichard Henderson abi_uint target_st_atime_nsec; 2163a10d1e50SRichard Henderson abi_int target_st_mtime; 2164a10d1e50SRichard Henderson abi_uint target_st_mtime_nsec; 2165a10d1e50SRichard Henderson abi_int target_st_ctime; 2166a10d1e50SRichard Henderson abi_uint target_st_ctime_nsec; 2167a10d1e50SRichard Henderson abi_int st_blksize; 2168a10d1e50SRichard Henderson abi_int st_blocks; 2169a10d1e50SRichard Henderson abi_uint _unused1; 2170a10d1e50SRichard Henderson abi_uint _unused2; 2171a10d1e50SRichard Henderson abi_uint _unused3; 2172a10d1e50SRichard Henderson abi_uint _unused4; 2173a10d1e50SRichard Henderson abi_ushort _unused5; 2174a10d1e50SRichard Henderson abi_short st_fstype; 2175a10d1e50SRichard Henderson abi_uint st_realdev; 2176a10d1e50SRichard Henderson abi_ushort st_basemode; 2177a10d1e50SRichard Henderson abi_ushort _unused6; 2178a10d1e50SRichard Henderson abi_uint st_uid; 2179a10d1e50SRichard Henderson abi_uint st_gid; 2180a10d1e50SRichard Henderson abi_uint _unused7[3]; 2181a10d1e50SRichard Henderson }; 2182a10d1e50SRichard Henderson 2183a10d1e50SRichard Henderson #define TARGET_HAS_STRUCT_STAT64 2184a10d1e50SRichard Henderson struct target_stat64 { 2185a10d1e50SRichard Henderson uint64_t st_dev; 2186a10d1e50SRichard Henderson abi_uint _pad1; 2187a10d1e50SRichard Henderson abi_uint _res1; 2188a10d1e50SRichard Henderson abi_uint st_mode; 2189a10d1e50SRichard Henderson abi_uint st_nlink; 2190a10d1e50SRichard Henderson abi_uint st_uid; 2191a10d1e50SRichard Henderson abi_uint st_gid; 2192a10d1e50SRichard Henderson uint64_t st_rdev; 2193a10d1e50SRichard Henderson abi_uint _pad2; 2194a10d1e50SRichard Henderson int64_t st_size; 2195a10d1e50SRichard Henderson abi_int st_blksize; 2196a10d1e50SRichard Henderson int64_t st_blocks; 2197a10d1e50SRichard Henderson abi_int target_st_atime; 2198a10d1e50SRichard Henderson abi_uint target_st_atime_nsec; 2199a10d1e50SRichard Henderson abi_int target_st_mtime; 2200a10d1e50SRichard Henderson abi_uint target_st_mtime_nsec; 2201a10d1e50SRichard Henderson abi_int target_st_ctime; 2202a10d1e50SRichard Henderson abi_uint target_st_ctime_nsec; 2203a10d1e50SRichard Henderson uint64_t st_ino; 2204a10d1e50SRichard Henderson }; 2205a10d1e50SRichard Henderson 2206048f6b4dSbellard #else 2207048f6b4dSbellard #error unsupported CPU 2208048f6b4dSbellard #endif 22092521d698Sbellard 22104ce6f8deSths typedef struct { 22114ce6f8deSths int val[2]; 2212c227f099SAnthony Liguori } target_fsid_t; 22134ce6f8deSths 221456c8f68fSbellard #ifdef TARGET_MIPS 2215d26bc211Sths #ifdef TARGET_ABI_MIPSN32 2216540635baSths struct target_statfs { 2217540635baSths int32_t f_type; 2218540635baSths int32_t f_bsize; 2219540635baSths int32_t f_frsize; /* Fragment size - unsupported */ 2220540635baSths int32_t f_blocks; 2221540635baSths int32_t f_bfree; 2222540635baSths int32_t f_files; 2223540635baSths int32_t f_ffree; 2224540635baSths int32_t f_bavail; 2225540635baSths 2226540635baSths /* Linux specials */ 2227c227f099SAnthony Liguori target_fsid_t f_fsid; 2228540635baSths int32_t f_namelen; 2229540635baSths int32_t f_spare[6]; 2230540635baSths }; 2231540635baSths #else 223256c8f68fSbellard struct target_statfs { 2233992f48a0Sblueswir1 abi_long f_type; 2234992f48a0Sblueswir1 abi_long f_bsize; 2235992f48a0Sblueswir1 abi_long f_frsize; /* Fragment size - unsupported */ 2236992f48a0Sblueswir1 abi_long f_blocks; 2237992f48a0Sblueswir1 abi_long f_bfree; 2238992f48a0Sblueswir1 abi_long f_files; 2239992f48a0Sblueswir1 abi_long f_ffree; 2240992f48a0Sblueswir1 abi_long f_bavail; 224156c8f68fSbellard 224256c8f68fSbellard /* Linux specials */ 2243c227f099SAnthony Liguori target_fsid_t f_fsid; 2244992f48a0Sblueswir1 abi_long f_namelen; 2245992f48a0Sblueswir1 abi_long f_spare[6]; 224656c8f68fSbellard }; 2247540635baSths #endif 224856c8f68fSbellard 224956c8f68fSbellard struct target_statfs64 { 225056c8f68fSbellard uint32_t f_type; 225156c8f68fSbellard uint32_t f_bsize; 225256c8f68fSbellard uint32_t f_frsize; /* Fragment size - unsupported */ 225356c8f68fSbellard uint32_t __pad; 225456c8f68fSbellard uint64_t f_blocks; 225556c8f68fSbellard uint64_t f_bfree; 225656c8f68fSbellard uint64_t f_files; 225756c8f68fSbellard uint64_t f_ffree; 225856c8f68fSbellard uint64_t f_bavail; 2259c227f099SAnthony Liguori target_fsid_t f_fsid; 226056c8f68fSbellard uint32_t f_namelen; 226156c8f68fSbellard uint32_t f_spare[6]; 226256c8f68fSbellard }; 2263c4d10628Sbalrog #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ 2264*47ae93cdSMichael Clark defined(TARGET_SPARC64) || defined(TARGET_AARCH64) || \ 2265*47ae93cdSMichael Clark defined(TARGET_RISCV)) && !defined(TARGET_ABI32) 2266325e651fSj_mayer struct target_statfs { 2267325e651fSj_mayer abi_long f_type; 2268325e651fSj_mayer abi_long f_bsize; 2269325e651fSj_mayer abi_long f_blocks; 2270325e651fSj_mayer abi_long f_bfree; 2271325e651fSj_mayer abi_long f_bavail; 2272325e651fSj_mayer abi_long f_files; 2273325e651fSj_mayer abi_long f_ffree; 2274c227f099SAnthony Liguori target_fsid_t f_fsid; 2275325e651fSj_mayer abi_long f_namelen; 2276325e651fSj_mayer abi_long f_frsize; 2277325e651fSj_mayer abi_long f_spare[5]; 2278325e651fSj_mayer }; 2279325e651fSj_mayer 2280325e651fSj_mayer struct target_statfs64 { 2281325e651fSj_mayer abi_long f_type; 2282325e651fSj_mayer abi_long f_bsize; 2283325e651fSj_mayer abi_long f_blocks; 2284325e651fSj_mayer abi_long f_bfree; 2285325e651fSj_mayer abi_long f_bavail; 2286325e651fSj_mayer abi_long f_files; 2287325e651fSj_mayer abi_long f_ffree; 2288c227f099SAnthony Liguori target_fsid_t f_fsid; 2289325e651fSj_mayer abi_long f_namelen; 2290325e651fSj_mayer abi_long f_frsize; 2291325e651fSj_mayer abi_long f_spare[5]; 2292325e651fSj_mayer }; 2293a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 2294a4c075f1SUlrich Hecht struct target_statfs { 2295a4c075f1SUlrich Hecht int32_t f_type; 2296a4c075f1SUlrich Hecht int32_t f_bsize; 2297a4c075f1SUlrich Hecht abi_long f_blocks; 2298a4c075f1SUlrich Hecht abi_long f_bfree; 2299a4c075f1SUlrich Hecht abi_long f_bavail; 2300a4c075f1SUlrich Hecht abi_long f_files; 2301a4c075f1SUlrich Hecht abi_long f_ffree; 2302a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2303a4c075f1SUlrich Hecht int32_t f_namelen; 2304a4c075f1SUlrich Hecht int32_t f_frsize; 2305a4c075f1SUlrich Hecht int32_t f_spare[5]; 2306a4c075f1SUlrich Hecht }; 2307a4c075f1SUlrich Hecht 2308a4c075f1SUlrich Hecht struct target_statfs64 { 2309a4c075f1SUlrich Hecht int32_t f_type; 2310a4c075f1SUlrich Hecht int32_t f_bsize; 2311a4c075f1SUlrich Hecht abi_long f_blocks; 2312a4c075f1SUlrich Hecht abi_long f_bfree; 2313a4c075f1SUlrich Hecht abi_long f_bavail; 2314a4c075f1SUlrich Hecht abi_long f_files; 2315a4c075f1SUlrich Hecht abi_long f_ffree; 2316a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2317a4c075f1SUlrich Hecht int32_t f_namelen; 2318a4c075f1SUlrich Hecht int32_t f_frsize; 2319a4c075f1SUlrich Hecht int32_t f_spare[5]; 2320a4c075f1SUlrich Hecht }; 232156c8f68fSbellard #else 232256c8f68fSbellard struct target_statfs { 232356c8f68fSbellard uint32_t f_type; 232456c8f68fSbellard uint32_t f_bsize; 232556c8f68fSbellard uint32_t f_blocks; 232656c8f68fSbellard uint32_t f_bfree; 232756c8f68fSbellard uint32_t f_bavail; 232856c8f68fSbellard uint32_t f_files; 232956c8f68fSbellard uint32_t f_ffree; 2330c227f099SAnthony Liguori target_fsid_t f_fsid; 233156c8f68fSbellard uint32_t f_namelen; 233256c8f68fSbellard uint32_t f_frsize; 233356c8f68fSbellard uint32_t f_spare[5]; 233456c8f68fSbellard }; 233556c8f68fSbellard 233656c8f68fSbellard struct target_statfs64 { 233756c8f68fSbellard uint32_t f_type; 233856c8f68fSbellard uint32_t f_bsize; 233956c8f68fSbellard uint64_t f_blocks; 234056c8f68fSbellard uint64_t f_bfree; 234156c8f68fSbellard uint64_t f_bavail; 234256c8f68fSbellard uint64_t f_files; 234356c8f68fSbellard uint64_t f_ffree; 2344c227f099SAnthony Liguori target_fsid_t f_fsid; 234556c8f68fSbellard uint32_t f_namelen; 234656c8f68fSbellard uint32_t f_frsize; 234756c8f68fSbellard uint32_t f_spare[5]; 234856c8f68fSbellard }; 234956c8f68fSbellard #endif 235056c8f68fSbellard 235156c8f68fSbellard 23522521d698Sbellard #define TARGET_F_DUPFD 0 /* dup */ 23532521d698Sbellard #define TARGET_F_GETFD 1 /* get close_on_exec */ 23542521d698Sbellard #define TARGET_F_SETFD 2 /* set/clear close_on_exec */ 23552521d698Sbellard #define TARGET_F_GETFL 3 /* get file->f_flags */ 23562521d698Sbellard #define TARGET_F_SETFL 4 /* set file->f_flags */ 23572521d698Sbellard 23582521d698Sbellard #if defined(TARGET_ALPHA) 23592521d698Sbellard #define TARGET_F_GETLK 7 23602521d698Sbellard #define TARGET_F_SETLK 8 23612521d698Sbellard #define TARGET_F_SETLKW 9 23622521d698Sbellard #define TARGET_F_SETOWN 5 /* for sockets. */ 23632521d698Sbellard #define TARGET_F_GETOWN 6 /* for sockets. */ 23642ba7f730SLaurent Vivier 23652ba7f730SLaurent Vivier #define TARGET_F_RDLCK 1 23662ba7f730SLaurent Vivier #define TARGET_F_WRLCK 2 23672ba7f730SLaurent Vivier #define TARGET_F_UNLCK 8 23682ba7f730SLaurent Vivier #define TARGET_F_EXLCK 16 23692ba7f730SLaurent Vivier #define TARGET_F_SHLCK 32 23705f106811SArnaud Patard (Rtp) #elif defined(TARGET_MIPS) 23715f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK 14 23725f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK 6 23735f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW 7 23745f106811SArnaud Patard (Rtp) #define TARGET_F_SETOWN 24 /* for sockets. */ 23753a87a954SAleksandar Markovic #define TARGET_F_GETOWN 23 /* for sockets. */ 2376b5c375e2SHelge Deller #elif defined(TARGET_HPPA) 23773d60c84dSHelge Deller #define TARGET_F_RDLCK 1 23783d60c84dSHelge Deller #define TARGET_F_WRLCK 2 23793d60c84dSHelge Deller #define TARGET_F_UNLCK 3 2380b5c375e2SHelge Deller #define TARGET_F_GETLK 5 2381b5c375e2SHelge Deller #define TARGET_F_SETLK 6 2382b5c375e2SHelge Deller #define TARGET_F_SETLKW 7 2383b5c375e2SHelge Deller #define TARGET_F_GETOWN 11 /* for sockets. */ 2384b5c375e2SHelge Deller #define TARGET_F_SETOWN 12 /* for sockets. */ 23852521d698Sbellard #else 23862521d698Sbellard #define TARGET_F_GETLK 5 23872521d698Sbellard #define TARGET_F_SETLK 6 23882521d698Sbellard #define TARGET_F_SETLKW 7 23892521d698Sbellard #define TARGET_F_SETOWN 8 /* for sockets. */ 23902521d698Sbellard #define TARGET_F_GETOWN 9 /* for sockets. */ 23912521d698Sbellard #endif 23928d5d3004SAndreas Schwab #define TARGET_F_SETOWN_EX 15 23938d5d3004SAndreas Schwab #define TARGET_F_GETOWN_EX 16 23942521d698Sbellard 23952ba7f730SLaurent Vivier #ifndef TARGET_F_RDLCK 23962ba7f730SLaurent Vivier #define TARGET_F_RDLCK 0 23972ba7f730SLaurent Vivier #define TARGET_F_WRLCK 1 23982ba7f730SLaurent Vivier #define TARGET_F_UNLCK 2 23992ba7f730SLaurent Vivier #endif 24002ba7f730SLaurent Vivier 24012ba7f730SLaurent Vivier #ifndef TARGET_F_EXLCK 24022ba7f730SLaurent Vivier #define TARGET_F_EXLCK 4 24032ba7f730SLaurent Vivier #define TARGET_F_SHLCK 8 24042ba7f730SLaurent Vivier #endif 24052ba7f730SLaurent Vivier 24062ba7f730SLaurent Vivier 2407b5c375e2SHelge Deller #if defined(TARGET_HPPA) 2408b5c375e2SHelge Deller #define TARGET_F_SETSIG 13 /* for sockets. */ 2409b5c375e2SHelge Deller #define TARGET_F_GETSIG 14 /* for sockets. */ 2410b5c375e2SHelge Deller #else 24112521d698Sbellard #define TARGET_F_SETSIG 10 /* for sockets. */ 24122521d698Sbellard #define TARGET_F_GETSIG 11 /* for sockets. */ 2413b5c375e2SHelge Deller #endif 24142521d698Sbellard 24155f106811SArnaud Patard (Rtp) #if defined(TARGET_MIPS) 24165f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK64 33 /* using 'struct flock64' */ 24175f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK64 34 24185f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW64 35 2419b5c375e2SHelge Deller #elif defined(TARGET_HPPA) 2420b5c375e2SHelge Deller #define TARGET_F_GETLK64 8 /* using 'struct flock64' */ 2421b5c375e2SHelge Deller #define TARGET_F_SETLK64 9 2422b5c375e2SHelge Deller #define TARGET_F_SETLKW64 10 24235f106811SArnaud Patard (Rtp) #else 24242521d698Sbellard #define TARGET_F_GETLK64 12 /* using 'struct flock64' */ 24252521d698Sbellard #define TARGET_F_SETLK64 13 24262521d698Sbellard #define TARGET_F_SETLKW64 14 24275f106811SArnaud Patard (Rtp) #endif 24287e22e546SUlrich Hecht 24297e22e546SUlrich Hecht #define TARGET_F_LINUX_SPECIFIC_BASE 1024 24307e22e546SUlrich Hecht #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0) 24317e22e546SUlrich Hecht #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1) 24327e22e546SUlrich Hecht #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) 24337e3b92ecSPeter Maydell #define TARGET_F_SETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 7) 24347e3b92ecSPeter Maydell #define TARGET_F_GETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 8) 24357e22e546SUlrich Hecht #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2) 24367e22e546SUlrich Hecht 24374eeea4f3SRichard Henderson #if defined(TARGET_ALPHA) 24384eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK 04 24394eeea4f3SRichard Henderson #define TARGET_O_APPEND 010 24404eeea4f3SRichard Henderson #define TARGET_O_CREAT 01000 /* not fcntl */ 24414eeea4f3SRichard Henderson #define TARGET_O_TRUNC 02000 /* not fcntl */ 24424eeea4f3SRichard Henderson #define TARGET_O_EXCL 04000 /* not fcntl */ 24434eeea4f3SRichard Henderson #define TARGET_O_NOCTTY 010000 /* not fcntl */ 24444eeea4f3SRichard Henderson #define TARGET_O_DSYNC 040000 24454eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0 /* not necessary, always 64-bit */ 24464eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY 0100000 /* must be a directory */ 24474eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW 0200000 /* don't follow links */ 24484eeea4f3SRichard Henderson #define TARGET_O_DIRECT 02000000 /* direct disk access hint */ 24494eeea4f3SRichard Henderson #define TARGET_O_NOATIME 04000000 24504eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 010000000 24514eeea4f3SRichard Henderson #define TARGET___O_SYNC 020000000 24524eeea4f3SRichard Henderson #define TARGET_O_PATH 040000000 2453a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 2454a10d1e50SRichard Henderson #define TARGET_O_NONBLOCK 000200004 /* HPUX has separate NDELAY & NONBLOCK */ 2455a10d1e50SRichard Henderson #define TARGET_O_APPEND 000000010 2456a10d1e50SRichard Henderson #define TARGET_O_CREAT 000000400 /* not fcntl */ 2457a10d1e50SRichard Henderson #define TARGET_O_EXCL 000002000 /* not fcntl */ 2458a10d1e50SRichard Henderson #define TARGET_O_NOCTTY 000400000 /* not fcntl */ 2459a10d1e50SRichard Henderson #define TARGET_O_DSYNC 001000000 2460a10d1e50SRichard Henderson #define TARGET_O_LARGEFILE 000004000 2461a10d1e50SRichard Henderson #define TARGET_O_DIRECTORY 000010000 /* must be a directory */ 2462a10d1e50SRichard Henderson #define TARGET_O_NOFOLLOW 000000200 /* don't follow links */ 2463a10d1e50SRichard Henderson #define TARGET_O_NOATIME 004000000 2464a10d1e50SRichard Henderson #define TARGET_O_CLOEXEC 010000000 2465a10d1e50SRichard Henderson #define TARGET___O_SYNC 000100000 2466a10d1e50SRichard Henderson #define TARGET_O_PATH 020000000 24675f9cee46SRiku Voipio #elif defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_AARCH64) 2468f09936acSbellard #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 2469f09936acSbellard #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 2470f09936acSbellard #define TARGET_O_DIRECT 0200000 /* direct disk access hint */ 2471f09936acSbellard #define TARGET_O_LARGEFILE 0400000 2472048f6b4dSbellard #elif defined(TARGET_MIPS) 2473048f6b4dSbellard #define TARGET_O_APPEND 0x0008 24744eeea4f3SRichard Henderson #define TARGET_O_DSYNC 0x0010 2475048f6b4dSbellard #define TARGET_O_NONBLOCK 0x0080 2476048f6b4dSbellard #define TARGET_O_CREAT 0x0100 /* not fcntl */ 2477048f6b4dSbellard #define TARGET_O_TRUNC 0x0200 /* not fcntl */ 2478048f6b4dSbellard #define TARGET_O_EXCL 0x0400 /* not fcntl */ 2479048f6b4dSbellard #define TARGET_O_NOCTTY 0x0800 /* not fcntl */ 2480048f6b4dSbellard #define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */ 2481048f6b4dSbellard #define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */ 24824eeea4f3SRichard Henderson #define TARGET___O_SYNC 0x4000 2483048f6b4dSbellard #define TARGET_O_DIRECT 0x8000 /* direct disk access hint */ 24844eeea4f3SRichard Henderson #elif defined (TARGET_PPC) 24854eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 24864eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 24874eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0200000 24884eeea4f3SRichard Henderson #define TARGET_O_DIRECT 0400000 /* direct disk access hint */ 24894eeea4f3SRichard Henderson #elif defined (TARGET_SPARC) 24901f961124Saurel32 #define TARGET_O_APPEND 0x0008 24914eeea4f3SRichard Henderson #define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */ 24921f961124Saurel32 #define TARGET_O_CREAT 0x0200 /* not fcntl */ 24931f961124Saurel32 #define TARGET_O_TRUNC 0x0400 /* not fcntl */ 24941f961124Saurel32 #define TARGET_O_EXCL 0x0800 /* not fcntl */ 24954eeea4f3SRichard Henderson #define TARGET_O_DSYNC 0x2000 24964eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK 0x4000 24974eeea4f3SRichard Henderson # ifdef TARGET_SPARC64 24984eeea4f3SRichard Henderson # define TARGET_O_NDELAY 0x0004 2499ffa65c3bSbellard # else 25004eeea4f3SRichard Henderson # define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK) 25014eeea4f3SRichard Henderson # endif 25024eeea4f3SRichard Henderson #define TARGET_O_NOCTTY 0x8000 /* not fcntl */ 25034eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0x40000 25044eeea4f3SRichard Henderson #define TARGET_O_DIRECT 0x100000 /* direct disk access hint */ 25054eeea4f3SRichard Henderson #define TARGET_O_NOATIME 0x200000 25064eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 0x400000 25074eeea4f3SRichard Henderson #define TARGET___O_SYNC 0x800000 25084eeea4f3SRichard Henderson #define TARGET_O_PATH 0x1000000 25094eeea4f3SRichard Henderson #endif 25104eeea4f3SRichard Henderson 25114eeea4f3SRichard Henderson /* <asm-generic/fcntl.h> values follow. */ 2512ffa65c3bSbellard #define TARGET_O_ACCMODE 0003 2513ffa65c3bSbellard #define TARGET_O_RDONLY 00 2514ffa65c3bSbellard #define TARGET_O_WRONLY 01 2515ffa65c3bSbellard #define TARGET_O_RDWR 02 25164eeea4f3SRichard Henderson #ifndef TARGET_O_CREAT 2517ffa65c3bSbellard #define TARGET_O_CREAT 0100 /* not fcntl */ 25184eeea4f3SRichard Henderson #endif 25194eeea4f3SRichard Henderson #ifndef TARGET_O_EXCL 2520ffa65c3bSbellard #define TARGET_O_EXCL 0200 /* not fcntl */ 25214eeea4f3SRichard Henderson #endif 25224eeea4f3SRichard Henderson #ifndef TARGET_O_NOCTTY 2523ffa65c3bSbellard #define TARGET_O_NOCTTY 0400 /* not fcntl */ 25244eeea4f3SRichard Henderson #endif 25254eeea4f3SRichard Henderson #ifndef TARGET_O_TRUNC 2526ffa65c3bSbellard #define TARGET_O_TRUNC 01000 /* not fcntl */ 25274eeea4f3SRichard Henderson #endif 25284eeea4f3SRichard Henderson #ifndef TARGET_O_APPEND 2529ffa65c3bSbellard #define TARGET_O_APPEND 02000 25304eeea4f3SRichard Henderson #endif 25314eeea4f3SRichard Henderson #ifndef TARGET_O_NONBLOCK 2532ffa65c3bSbellard #define TARGET_O_NONBLOCK 04000 25334eeea4f3SRichard Henderson #endif 25344eeea4f3SRichard Henderson #ifndef TARGET_O_DSYNC 25354eeea4f3SRichard Henderson #define TARGET_O_DSYNC 010000 25364eeea4f3SRichard Henderson #endif 25374eeea4f3SRichard Henderson #ifndef TARGET_FASYNC 2538ffa65c3bSbellard #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ 25394eeea4f3SRichard Henderson #endif 25404eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECT 2541ffa65c3bSbellard #define TARGET_O_DIRECT 040000 /* direct disk access hint */ 25424eeea4f3SRichard Henderson #endif 25434eeea4f3SRichard Henderson #ifndef TARGET_O_LARGEFILE 2544ffa65c3bSbellard #define TARGET_O_LARGEFILE 0100000 25454eeea4f3SRichard Henderson #endif 25464eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECTORY 2547ffa65c3bSbellard #define TARGET_O_DIRECTORY 0200000 /* must be a directory */ 25484eeea4f3SRichard Henderson #endif 25494eeea4f3SRichard Henderson #ifndef TARGET_O_NOFOLLOW 2550ffa65c3bSbellard #define TARGET_O_NOFOLLOW 0400000 /* don't follow links */ 2551ffa65c3bSbellard #endif 25524eeea4f3SRichard Henderson #ifndef TARGET_O_NOATIME 25534eeea4f3SRichard Henderson #define TARGET_O_NOATIME 01000000 25544eeea4f3SRichard Henderson #endif 25554eeea4f3SRichard Henderson #ifndef TARGET_O_CLOEXEC 25564eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 02000000 25574eeea4f3SRichard Henderson #endif 25584eeea4f3SRichard Henderson #ifndef TARGET___O_SYNC 25594eeea4f3SRichard Henderson #define TARGET___O_SYNC 04000000 25604eeea4f3SRichard Henderson #endif 25614eeea4f3SRichard Henderson #ifndef TARGET_O_PATH 25624eeea4f3SRichard Henderson #define TARGET_O_PATH 010000000 25634eeea4f3SRichard Henderson #endif 25645f9cee46SRiku Voipio #ifndef TARGET___O_TMPFILE 25655f9cee46SRiku Voipio #define TARGET___O_TMPFILE 020000000 25665f9cee46SRiku Voipio #endif 25675f9cee46SRiku Voipio #ifndef TARGET_O_TMPFILE 25685f9cee46SRiku Voipio #define TARGET_O_TMPFILE (TARGET___O_TMPFILE | TARGET_O_DIRECTORY) 25695f9cee46SRiku Voipio #endif 25704eeea4f3SRichard Henderson #ifndef TARGET_O_NDELAY 25714eeea4f3SRichard Henderson #define TARGET_O_NDELAY TARGET_O_NONBLOCK 25724eeea4f3SRichard Henderson #endif 25734eeea4f3SRichard Henderson #ifndef TARGET_O_SYNC 25744eeea4f3SRichard Henderson #define TARGET_O_SYNC (TARGET___O_SYNC | TARGET_O_DSYNC) 25754eeea4f3SRichard Henderson #endif 2576ffa65c3bSbellard 25772521d698Sbellard struct target_flock { 25782521d698Sbellard short l_type; 25792521d698Sbellard short l_whence; 25808efb2ed5SPeter Maydell abi_long l_start; 25818efb2ed5SPeter Maydell abi_long l_len; 25828a8001b1SAleksandar Markovic #if defined(TARGET_MIPS) 25838a8001b1SAleksandar Markovic abi_long l_sysid; 25848a8001b1SAleksandar Markovic #endif 25852521d698Sbellard int l_pid; 25868a8001b1SAleksandar Markovic #if defined(TARGET_MIPS) 25878a8001b1SAleksandar Markovic abi_long pad[4]; 25888a8001b1SAleksandar Markovic #endif 25892521d698Sbellard }; 25902521d698Sbellard 25912521d698Sbellard struct target_flock64 { 25922521d698Sbellard short l_type; 25932521d698Sbellard short l_whence; 2594429b31a2SRichard Henderson #if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) \ 2595429b31a2SRichard Henderson || defined(TARGET_SPARC) || defined(TARGET_HPPA) \ 2596b16189b2SChen Gang || defined(TARGET_MICROBLAZE) || defined(TARGET_TILEGX) 2597ce3f0e2fSaurel32 int __pad; 2598ce3f0e2fSaurel32 #endif 25998efb2ed5SPeter Maydell abi_llong l_start; 26008efb2ed5SPeter Maydell abi_llong l_len; 26012521d698Sbellard int l_pid; 2602541dc0d4SStefan Weil } QEMU_PACKED; 26032521d698Sbellard 2604ce4defa0Spbrook #ifdef TARGET_ARM 2605ce4defa0Spbrook struct target_eabi_flock64 { 2606ce4defa0Spbrook short l_type; 2607ce4defa0Spbrook short l_whence; 2608ce4defa0Spbrook int __pad; 26098efb2ed5SPeter Maydell abi_llong l_start; 26108efb2ed5SPeter Maydell abi_llong l_len; 2611ce4defa0Spbrook int l_pid; 2612541dc0d4SStefan Weil } QEMU_PACKED; 2613ce4defa0Spbrook #endif 26142521d698Sbellard 26158d5d3004SAndreas Schwab struct target_f_owner_ex { 26168d5d3004SAndreas Schwab int type; /* Owner type of ID. */ 26178d5d3004SAndreas Schwab int pid; /* ID of owner. */ 26188d5d3004SAndreas Schwab }; 26198d5d3004SAndreas Schwab 26202521d698Sbellard /* soundcard defines */ 262167cc32ebSVeres Lajos /* XXX: convert them all to arch independent entries */ 26222521d698Sbellard #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); 26232521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 26242521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 26252521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 26262521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA 0xc0144302 26272521d698Sbellard #define TARGET_SNDCTL_COPR_RESET 0x00004300 26282521d698Sbellard #define TARGET_SNDCTL_COPR_RUN 0xc0144306 26292521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 26302521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE 0x40144305 26312521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA 0x40144304 26322521d698Sbellard #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) 26332521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) 26342521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) 26352521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) 26362521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) 26372521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) 26382521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) 26392521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) 26402521d698Sbellard #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) 26412521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) 26422521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) 26432521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) 26442521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) 26452521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) 26462521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) 26472521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) 26482521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) 26492521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) 26505f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19) 26515f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20) 26522521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e 26532521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 26542521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 26552521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 26562521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 26572521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f 26582521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 26592521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO 0xc074510c 26602521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 26612521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 26622521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 26632521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 26642521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 26652521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 26662521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 26672521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 26682521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b 26692521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a 26702521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 26712521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC 0x00005111 26722521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 26732521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET 0x00005100 26742521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 26752521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC 0x00005101 26762521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 26772521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d 26782521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d 26792521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 26802521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e 26812521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 26822521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME 0x40045407 26832521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT 0x40045408 26842521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 26852521d698Sbellard #define TARGET_SNDCTL_TMR_START 0x00005402 26862521d698Sbellard #define TARGET_SNDCTL_TMR_STOP 0x00005403 26872521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 26882521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 26892521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE 0x80045002 26902521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 26912521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS 0x80045005 26922521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 26932521d698Sbellard #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) 26942521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 26952521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) 26962521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) 26972521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) 26982521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) 26992521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) 27002521d698Sbellard 27012521d698Sbellard #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) 27022521d698Sbellard 27032521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) 27042521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) 27052521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) 27062521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) 27072521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) 27082521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) 27092521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) 27102521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) 27112521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) 27122521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) 27132521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) 27142521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) 27152521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) 27162521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) 27172521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) 27182521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) 27192521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) 27202521d698Sbellard 27212521d698Sbellard /* Obsolete macros */ 27222521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) 27232521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) 27242521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) 27252521d698Sbellard 27262521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) 27272521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) 27282521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) 27292521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) 27302521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) 27312521d698Sbellard 27322521d698Sbellard #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) 27332521d698Sbellard 27342521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) 27352521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) 27362521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) 27372521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) 27382521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) 27392521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) 27402521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) 27412521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) 27422521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) 27432521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) 27442521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) 27452521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) 27462521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) 27472521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) 27482521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) 27492521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) 27502521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) 27512521d698Sbellard 27522521d698Sbellard /* Obsolete macros */ 27532521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) 27542521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) 27552521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) 27562521d698Sbellard 27572521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) 27582521d698Sbellard 27592521d698Sbellard /* vfat ioctls */ 27602521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) 27612521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) 2762a5448a7dSbellard 2763f443e396SPeter Maydell struct target_mtop { 2764f443e396SPeter Maydell abi_short mt_op; 2765f443e396SPeter Maydell abi_int mt_count; 2766f443e396SPeter Maydell }; 2767f443e396SPeter Maydell 2768f443e396SPeter Maydell #if defined(TARGET_SPARC) || defined(TARGET_MIPS) 2769f443e396SPeter Maydell typedef abi_long target_kernel_daddr_t; 2770f443e396SPeter Maydell #else 2771f443e396SPeter Maydell typedef abi_int target_kernel_daddr_t; 2772f443e396SPeter Maydell #endif 2773f443e396SPeter Maydell 2774f443e396SPeter Maydell struct target_mtget { 2775f443e396SPeter Maydell abi_long mt_type; 2776f443e396SPeter Maydell abi_long mt_resid; 2777f443e396SPeter Maydell abi_long mt_dsreg; 2778f443e396SPeter Maydell abi_long mt_gstat; 2779f443e396SPeter Maydell abi_long mt_erreg; 2780f443e396SPeter Maydell target_kernel_daddr_t mt_fileno; 2781f443e396SPeter Maydell target_kernel_daddr_t mt_blkno; 2782f443e396SPeter Maydell }; 2783f443e396SPeter Maydell 2784f443e396SPeter Maydell struct target_mtpos { 2785f443e396SPeter Maydell abi_long mt_blkno; 2786f443e396SPeter Maydell }; 2787f443e396SPeter Maydell 2788f443e396SPeter Maydell #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct target_mtop) 2789f443e396SPeter Maydell #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct target_mtget) 2790f443e396SPeter Maydell #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct target_mtpos) 27918fbd6b52Sbalrog 2792a5448a7dSbellard struct target_sysinfo { 2793992f48a0Sblueswir1 abi_long uptime; /* Seconds since boot */ 2794992f48a0Sblueswir1 abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */ 2795992f48a0Sblueswir1 abi_ulong totalram; /* Total usable main memory size */ 2796992f48a0Sblueswir1 abi_ulong freeram; /* Available memory size */ 2797992f48a0Sblueswir1 abi_ulong sharedram; /* Amount of shared memory */ 2798992f48a0Sblueswir1 abi_ulong bufferram; /* Memory used by buffers */ 2799992f48a0Sblueswir1 abi_ulong totalswap; /* Total swap space size */ 2800992f48a0Sblueswir1 abi_ulong freeswap; /* swap space still available */ 2801a5448a7dSbellard unsigned short procs; /* Number of current processes */ 2802a5448a7dSbellard unsigned short pad; /* explicit padding for m68k */ 2803992f48a0Sblueswir1 abi_ulong totalhigh; /* Total high memory size */ 2804992f48a0Sblueswir1 abi_ulong freehigh; /* Available high memory size */ 2805a5448a7dSbellard unsigned int mem_unit; /* Memory unit size in bytes */ 2806992f48a0Sblueswir1 char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 2807a5448a7dSbellard }; 28083532fa74Sbellard 28096556a833Saurel32 struct linux_dirent { 28106556a833Saurel32 long d_ino; 28116556a833Saurel32 unsigned long d_off; 28126556a833Saurel32 unsigned short d_reclen; 28136556a833Saurel32 char d_name[256]; /* We must not include limits.h! */ 28146556a833Saurel32 }; 28156556a833Saurel32 28166556a833Saurel32 struct linux_dirent64 { 28176556a833Saurel32 uint64_t d_ino; 28186556a833Saurel32 int64_t d_off; 28196556a833Saurel32 unsigned short d_reclen; 28206556a833Saurel32 unsigned char d_type; 28216556a833Saurel32 char d_name[256]; 28226556a833Saurel32 }; 28236556a833Saurel32 282424e1003aSaurel32 struct target_mq_attr { 282524e1003aSaurel32 abi_long mq_flags; 282624e1003aSaurel32 abi_long mq_maxmsg; 282724e1003aSaurel32 abi_long mq_msgsize; 282824e1003aSaurel32 abi_long mq_curmsgs; 282924e1003aSaurel32 }; 283024e1003aSaurel32 28313532fa74Sbellard #include "socket.h" 2832637947f1Sths 2833637947f1Sths #include "errno_defs.h" 283403dfe9f8SRiku Voipio 283503dfe9f8SRiku Voipio #define FUTEX_WAIT 0 283603dfe9f8SRiku Voipio #define FUTEX_WAKE 1 283703dfe9f8SRiku Voipio #define FUTEX_FD 2 283803dfe9f8SRiku Voipio #define FUTEX_REQUEUE 3 283903dfe9f8SRiku Voipio #define FUTEX_CMP_REQUEUE 4 284003dfe9f8SRiku Voipio #define FUTEX_WAKE_OP 5 284103dfe9f8SRiku Voipio #define FUTEX_LOCK_PI 6 284203dfe9f8SRiku Voipio #define FUTEX_UNLOCK_PI 7 284303dfe9f8SRiku Voipio #define FUTEX_TRYLOCK_PI 8 284403dfe9f8SRiku Voipio #define FUTEX_WAIT_BITSET 9 284503dfe9f8SRiku Voipio #define FUTEX_WAKE_BITSET 10 284603dfe9f8SRiku Voipio 284703dfe9f8SRiku Voipio #define FUTEX_PRIVATE_FLAG 128 284803dfe9f8SRiku Voipio #define FUTEX_CLOCK_REALTIME 256 284903dfe9f8SRiku Voipio #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) 285003dfe9f8SRiku Voipio 28513b6edd16SPeter Maydell #ifdef CONFIG_EPOLL 2852928bed6aSLaurent Vivier #if defined(TARGET_X86_64) 2853928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED QEMU_PACKED 2854928bed6aSLaurent Vivier #else 2855928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED 2856928bed6aSLaurent Vivier #endif 2857928bed6aSLaurent Vivier 28583b6edd16SPeter Maydell typedef union target_epoll_data { 28593b6edd16SPeter Maydell abi_ulong ptr; 2860928bed6aSLaurent Vivier abi_int fd; 2861928bed6aSLaurent Vivier abi_uint u32; 2862928bed6aSLaurent Vivier abi_ullong u64; 28633b6edd16SPeter Maydell } target_epoll_data_t; 28643b6edd16SPeter Maydell 28653b6edd16SPeter Maydell struct target_epoll_event { 2866928bed6aSLaurent Vivier abi_uint events; 28673b6edd16SPeter Maydell target_epoll_data_t data; 2868928bed6aSLaurent Vivier } TARGET_EPOLL_PACKED; 28692ba7fae3SPeter Maydell 28702ba7fae3SPeter Maydell #define TARGET_EP_MAX_EVENTS (INT_MAX / sizeof(struct target_epoll_event)) 28712ba7fae3SPeter Maydell 28723b6edd16SPeter Maydell #endif 2873163a05a8SPeter Maydell struct target_rlimit64 { 2874163a05a8SPeter Maydell uint64_t rlim_cur; 2875163a05a8SPeter Maydell uint64_t rlim_max; 2876163a05a8SPeter Maydell }; 2877583359a6SAkos PASZTORY 2878583359a6SAkos PASZTORY struct target_ucred { 2879583359a6SAkos PASZTORY uint32_t pid; 2880583359a6SAkos PASZTORY uint32_t uid; 2881583359a6SAkos PASZTORY uint32_t gid; 2882583359a6SAkos PASZTORY }; 2883cb9c377fSPaolo Bonzini 2884aecc8861SAlexander Graf typedef int32_t target_timer_t; 2885905bba13SErik de Castro Lopo 288634d60862SNatanael Copa #define TARGET_SIGEV_MAX_SIZE 64 288734d60862SNatanael Copa 288834d60862SNatanael Copa /* This is architecture-specific but most architectures use the default */ 288934d60862SNatanael Copa #ifdef TARGET_MIPS 289034d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long)) 289134d60862SNatanael Copa #else 289234d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ 289334d60862SNatanael Copa + sizeof(target_sigval_t)) 289434d60862SNatanael Copa #endif 289534d60862SNatanael Copa 289634d60862SNatanael Copa #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ 289734d60862SNatanael Copa - TARGET_SIGEV_PREAMBLE_SIZE) \ 289834d60862SNatanael Copa / sizeof(int32_t)) 289934d60862SNatanael Copa 2900905bba13SErik de Castro Lopo struct target_sigevent { 2901905bba13SErik de Castro Lopo target_sigval_t sigev_value; 290217351c3fSPeter Maydell abi_int sigev_signo; 290317351c3fSPeter Maydell abi_int sigev_notify; 2904905bba13SErik de Castro Lopo union { 290517351c3fSPeter Maydell abi_int _pad[TARGET_SIGEV_PAD_SIZE]; 290617351c3fSPeter Maydell abi_int _tid; 2907905bba13SErik de Castro Lopo 290817351c3fSPeter Maydell /* The kernel (and thus QEMU) never looks at these; 290917351c3fSPeter Maydell * they're only used as part of the ABI between a 291017351c3fSPeter Maydell * userspace program and libc. 291117351c3fSPeter Maydell */ 2912905bba13SErik de Castro Lopo struct { 291317351c3fSPeter Maydell abi_ulong _function; 291417351c3fSPeter Maydell abi_ulong _attribute; 2915905bba13SErik de Castro Lopo } _sigev_thread; 2916905bba13SErik de Castro Lopo } _sigev_un; 2917905bba13SErik de Castro Lopo }; 2918e0eb210eSPeter Maydell 2919e0eb210eSPeter Maydell struct target_user_cap_header { 2920e0eb210eSPeter Maydell uint32_t version; 2921e0eb210eSPeter Maydell int pid; 2922e0eb210eSPeter Maydell }; 2923e0eb210eSPeter Maydell 2924e0eb210eSPeter Maydell struct target_user_cap_data { 2925e0eb210eSPeter Maydell uint32_t effective; 2926e0eb210eSPeter Maydell uint32_t permitted; 2927e0eb210eSPeter Maydell uint32_t inheritable; 2928e0eb210eSPeter Maydell }; 29291b3c4fdfSMarkus Armbruster 2930da2c8ad7SAleksandar Markovic /* from kernel's include/linux/syslog.h */ 2931da2c8ad7SAleksandar Markovic 2932da2c8ad7SAleksandar Markovic /* Close the log. Currently a NOP. */ 2933da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CLOSE 0 2934da2c8ad7SAleksandar Markovic /* Open the log. Currently a NOP. */ 2935da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_OPEN 1 2936da2c8ad7SAleksandar Markovic /* Read from the log. */ 2937da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ 2 2938da2c8ad7SAleksandar Markovic /* Read all messages remaining in the ring buffer. */ 2939da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ_ALL 3 2940da2c8ad7SAleksandar Markovic /* Read and clear all messages remaining in the ring buffer */ 2941da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ_CLEAR 4 2942da2c8ad7SAleksandar Markovic /* Clear ring buffer. */ 2943da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CLEAR 5 2944da2c8ad7SAleksandar Markovic /* Disable printk's to console */ 2945da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_OFF 6 2946da2c8ad7SAleksandar Markovic /* Enable printk's to console */ 2947da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_ON 7 2948da2c8ad7SAleksandar Markovic /* Set level of messages printed to console */ 2949da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_LEVEL 8 2950da2c8ad7SAleksandar Markovic /* Return number of unread characters in the log buffer */ 2951da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_SIZE_UNREAD 9 2952da2c8ad7SAleksandar Markovic /* Return size of the log buffer */ 2953da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10 2954da2c8ad7SAleksandar Markovic 29551b3c4fdfSMarkus Armbruster #endif 2956