131e31b8aSbellard /* common syscall defines for all architectures */ 231e31b8aSbellard 32521d698Sbellard /* Note: although the syscall numbers change between architectures, 4b4916d7bSDong Xu Wang most of them stay the same, so we handle it by putting ifdefs if 52521d698Sbellard necessary */ 62521d698Sbellard 7cb9c377fSPaolo Bonzini #ifndef SYSCALL_DEFS_H 81b3c4fdfSMarkus Armbruster #define SYSCALL_DEFS_H 9cb9c377fSPaolo Bonzini 106180a181Sbellard #include "syscall_nr.h" 112521d698Sbellard 12ff71a454SAleksandar Markovic 13ff71a454SAleksandar Markovic /* socket operations for socketcall() */ 14ff71a454SAleksandar Markovic #define TARGET_SYS_SOCKET 1 /* socket() */ 15ff71a454SAleksandar Markovic #define TARGET_SYS_BIND 2 /* bind() */ 16ff71a454SAleksandar Markovic #define TARGET_SYS_CONNECT 3 /* connect() */ 17ff71a454SAleksandar Markovic #define TARGET_SYS_LISTEN 4 /* listen() */ 18ff71a454SAleksandar Markovic #define TARGET_SYS_ACCEPT 5 /* accept() */ 19ff71a454SAleksandar Markovic #define TARGET_SYS_GETSOCKNAME 6 /* getsockname() */ 20ff71a454SAleksandar Markovic #define TARGET_SYS_GETPEERNAME 7 /* getpeername() */ 21ff71a454SAleksandar Markovic #define TARGET_SYS_SOCKETPAIR 8 /* socketpair() */ 22ff71a454SAleksandar Markovic #define TARGET_SYS_SEND 9 /* send() */ 23ff71a454SAleksandar Markovic #define TARGET_SYS_RECV 10 /* recv() */ 24ff71a454SAleksandar Markovic #define TARGET_SYS_SENDTO 11 /* sendto() */ 25ff71a454SAleksandar Markovic #define TARGET_SYS_RECVFROM 12 /* recvfrom() */ 26ff71a454SAleksandar Markovic #define TARGET_SYS_SHUTDOWN 13 /* shutdown() */ 27ff71a454SAleksandar Markovic #define TARGET_SYS_SETSOCKOPT 14 /* setsockopt() */ 28ff71a454SAleksandar Markovic #define TARGET_SYS_GETSOCKOPT 15 /* getsockopt() */ 29ff71a454SAleksandar Markovic #define TARGET_SYS_SENDMSG 16 /* sendmsg() */ 30ff71a454SAleksandar Markovic #define TARGET_SYS_RECVMSG 17 /* recvmsg() */ 31ff71a454SAleksandar Markovic #define TARGET_SYS_ACCEPT4 18 /* accept4() */ 32ff71a454SAleksandar Markovic #define TARGET_SYS_RECVMMSG 19 /* recvmmsg() */ 33ff71a454SAleksandar Markovic #define TARGET_SYS_SENDMMSG 20 /* sendmmsg() */ 3431e31b8aSbellard 358853f86eSbellard #define IPCOP_semop 1 368853f86eSbellard #define IPCOP_semget 2 378853f86eSbellard #define IPCOP_semctl 3 388853f86eSbellard #define IPCOP_semtimedop 4 398853f86eSbellard #define IPCOP_msgsnd 11 408853f86eSbellard #define IPCOP_msgrcv 12 418853f86eSbellard #define IPCOP_msgget 13 428853f86eSbellard #define IPCOP_msgctl 14 438853f86eSbellard #define IPCOP_shmat 21 448853f86eSbellard #define IPCOP_shmdt 22 458853f86eSbellard #define IPCOP_shmget 23 468853f86eSbellard #define IPCOP_shmctl 24 478853f86eSbellard 482521d698Sbellard /* 492521d698Sbellard * The following is for compatibility across the various Linux 502521d698Sbellard * platforms. The i386 ioctl numbering scheme doesn't really enforce 512521d698Sbellard * a type field. De facto, however, the top 8 bits of the lower 16 522521d698Sbellard * bits are indeed used as a type field, so we might just as well make 532521d698Sbellard * this explicit here. Please be sure to use the decoding macros 542521d698Sbellard * below from now on. 552521d698Sbellard */ 562521d698Sbellard #define TARGET_IOC_NRBITS 8 572521d698Sbellard #define TARGET_IOC_TYPEBITS 8 582521d698Sbellard 59716f3fbeSPeter Maydell #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 60716f3fbeSPeter Maydell || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 61cd98d390SAndreas Schwab || defined(TARGET_SPARC) \ 620c866a7eSRiku Voipio || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) 6374d753acSMika Westerberg /* 16 bit uid wrappers emulation */ 6474d753acSMika Westerberg #define USE_UID16 650c866a7eSRiku Voipio #define target_id uint16_t 660c866a7eSRiku Voipio #else 670c866a7eSRiku Voipio #define target_id uint32_t 6874d753acSMika Westerberg #endif 6974d753acSMika Westerberg 70e6e5906bSpbrook #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ 71b16189b2SChen Gang || defined(TARGET_M68K) || defined(TARGET_CRIS) \ 72daa4374aSPeter Maydell || defined(TARGET_S390X) \ 73a0a839b6SMarek Vasut || defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) \ 74ba7651fbSMax Filippov || defined(TARGET_NIOS2) || defined(TARGET_RISCV) \ 75ba7651fbSMax Filippov || defined(TARGET_XTENSA) 762521d698Sbellard 772521d698Sbellard #define TARGET_IOC_SIZEBITS 14 782521d698Sbellard #define TARGET_IOC_DIRBITS 2 792521d698Sbellard 802521d698Sbellard #define TARGET_IOC_NONE 0U 812521d698Sbellard #define TARGET_IOC_WRITE 1U 822521d698Sbellard #define TARGET_IOC_READ 2U 832521d698Sbellard 84048f6b4dSbellard #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ 85b779e29eSEdgar E. Iglesias defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \ 86b779e29eSEdgar E. Iglesias defined(TARGET_MIPS) 872521d698Sbellard 882521d698Sbellard #define TARGET_IOC_SIZEBITS 13 892521d698Sbellard #define TARGET_IOC_DIRBITS 3 902521d698Sbellard 912521d698Sbellard #define TARGET_IOC_NONE 1U 922521d698Sbellard #define TARGET_IOC_READ 2U 932521d698Sbellard #define TARGET_IOC_WRITE 4U 942521d698Sbellard 95a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 96a10d1e50SRichard Henderson 97a10d1e50SRichard Henderson #define TARGET_IOC_SIZEBITS 14 98a10d1e50SRichard Henderson #define TARGET_IOC_DIRBITS 2 99a10d1e50SRichard Henderson 100a10d1e50SRichard Henderson #define TARGET_IOC_NONE 0U 101a10d1e50SRichard Henderson #define TARGET_IOC_WRITE 2U 102a10d1e50SRichard Henderson #define TARGET_IOC_READ 1U 103a10d1e50SRichard Henderson 1042521d698Sbellard #else 1052521d698Sbellard #error unsupported CPU 1062521d698Sbellard #endif 1072521d698Sbellard 1082521d698Sbellard #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) 1092521d698Sbellard #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) 1102521d698Sbellard #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) 1112521d698Sbellard #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) 1122521d698Sbellard 1132521d698Sbellard #define TARGET_IOC_NRSHIFT 0 1142521d698Sbellard #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) 1152521d698Sbellard #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) 1162521d698Sbellard #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) 1172521d698Sbellard 1182521d698Sbellard #define TARGET_IOC(dir,type,nr,size) \ 1192521d698Sbellard (((dir) << TARGET_IOC_DIRSHIFT) | \ 1202521d698Sbellard ((type) << TARGET_IOC_TYPESHIFT) | \ 1212521d698Sbellard ((nr) << TARGET_IOC_NRSHIFT) | \ 1222521d698Sbellard ((size) << TARGET_IOC_SIZESHIFT)) 1232521d698Sbellard 1242521d698Sbellard /* used to create numbers */ 1252521d698Sbellard #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) 1262521d698Sbellard #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) 1272521d698Sbellard #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1282521d698Sbellard #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1292521d698Sbellard 1302521d698Sbellard /* the size is automatically computed for these defines */ 1312521d698Sbellard #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) 1322521d698Sbellard #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1332521d698Sbellard #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1342521d698Sbellard 1357854b056Sbellard struct target_sockaddr { 1367854b056Sbellard uint16_t sa_family; 1377854b056Sbellard uint8_t sa_data[14]; 1387854b056Sbellard }; 1397854b056Sbellard 14033a29b51SJoakim Tjernlund struct target_sockaddr_ll { 14133a29b51SJoakim Tjernlund uint16_t sll_family; /* Always AF_PACKET */ 14233a29b51SJoakim Tjernlund uint16_t sll_protocol; /* Physical layer protocol */ 14333a29b51SJoakim Tjernlund int sll_ifindex; /* Interface number */ 14433a29b51SJoakim Tjernlund uint16_t sll_hatype; /* ARP hardware type */ 14533a29b51SJoakim Tjernlund uint8_t sll_pkttype; /* Packet type */ 14633a29b51SJoakim Tjernlund uint8_t sll_halen; /* Length of address */ 14733a29b51SJoakim Tjernlund uint8_t sll_addr[8]; /* Physical layer address */ 14833a29b51SJoakim Tjernlund }; 14933a29b51SJoakim Tjernlund 150fb3aabf3SLaurent Vivier struct target_sockaddr_un { 151fb3aabf3SLaurent Vivier uint16_t su_family; 152fb3aabf3SLaurent Vivier uint8_t sun_path[108]; 153fb3aabf3SLaurent Vivier }; 154fb3aabf3SLaurent Vivier 155fb3aabf3SLaurent Vivier struct target_in_addr { 156fb3aabf3SLaurent Vivier uint32_t s_addr; /* big endian */ 157fb3aabf3SLaurent Vivier }; 158fb3aabf3SLaurent Vivier 159fb3aabf3SLaurent Vivier struct target_sockaddr_in { 160fb3aabf3SLaurent Vivier uint16_t sin_family; 161fb3aabf3SLaurent Vivier int16_t sin_port; /* big endian */ 162fb3aabf3SLaurent Vivier struct target_in_addr sin_addr; 163fb3aabf3SLaurent Vivier uint8_t __pad[sizeof(struct target_sockaddr) - 164fb3aabf3SLaurent Vivier sizeof(uint16_t) - sizeof(int16_t) - 165fb3aabf3SLaurent Vivier sizeof(struct target_in_addr)]; 166fb3aabf3SLaurent Vivier }; 167fb3aabf3SLaurent Vivier 168ee1ac3a1SHelge Deller struct target_sockaddr_in6 { 169ee1ac3a1SHelge Deller uint16_t sin6_family; 170ee1ac3a1SHelge Deller uint16_t sin6_port; /* big endian */ 171ee1ac3a1SHelge Deller uint32_t sin6_flowinfo; /* big endian */ 172ee1ac3a1SHelge Deller struct in6_addr sin6_addr; /* IPv6 address, big endian */ 173ee1ac3a1SHelge Deller uint32_t sin6_scope_id; 174ee1ac3a1SHelge Deller }; 175ee1ac3a1SHelge Deller 176f57d4192SLaurent Vivier struct target_sock_filter { 177f57d4192SLaurent Vivier abi_ushort code; 178f57d4192SLaurent Vivier uint8_t jt; 179f57d4192SLaurent Vivier uint8_t jf; 180f57d4192SLaurent Vivier abi_uint k; 181f57d4192SLaurent Vivier }; 182f57d4192SLaurent Vivier 183f57d4192SLaurent Vivier struct target_sock_fprog { 184f57d4192SLaurent Vivier abi_ushort len; 185f57d4192SLaurent Vivier abi_ulong filter; 186f57d4192SLaurent Vivier }; 187f57d4192SLaurent Vivier 188b975b83bSLionel Landwerlin struct target_ip_mreq { 189b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 190b975b83bSLionel Landwerlin struct target_in_addr imr_address; 191b975b83bSLionel Landwerlin }; 192b975b83bSLionel Landwerlin 193b975b83bSLionel Landwerlin struct target_ip_mreqn { 194b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 195b975b83bSLionel Landwerlin struct target_in_addr imr_address; 196b975b83bSLionel Landwerlin abi_long imr_ifindex; 197b975b83bSLionel Landwerlin }; 198b975b83bSLionel Landwerlin 1996e3cb58fSLionel Landwerlin struct target_ip_mreq_source { 2006e3cb58fSLionel Landwerlin /* big endian */ 2016e3cb58fSLionel Landwerlin uint32_t imr_multiaddr; 2026e3cb58fSLionel Landwerlin uint32_t imr_interface; 2036e3cb58fSLionel Landwerlin uint32_t imr_sourceaddr; 2046e3cb58fSLionel Landwerlin }; 2056e3cb58fSLionel Landwerlin 20631e31b8aSbellard struct target_timeval { 207992f48a0Sblueswir1 abi_long tv_sec; 208992f48a0Sblueswir1 abi_long tv_usec; 20931e31b8aSbellard }; 21031e31b8aSbellard 2111b6b029eSbellard struct target_timespec { 212992f48a0Sblueswir1 abi_long tv_sec; 213992f48a0Sblueswir1 abi_long tv_nsec; 2141b6b029eSbellard }; 2151b6b029eSbellard 216ef4467e9SPaul Burton struct target_timezone { 217ef4467e9SPaul Burton abi_int tz_minuteswest; 218ef4467e9SPaul Burton abi_int tz_dsttime; 219ef4467e9SPaul Burton }; 220ef4467e9SPaul Burton 22166fb9763Sbellard struct target_itimerval { 22266fb9763Sbellard struct target_timeval it_interval; 22366fb9763Sbellard struct target_timeval it_value; 22466fb9763Sbellard }; 22566fb9763Sbellard 226905bba13SErik de Castro Lopo struct target_itimerspec { 227905bba13SErik de Castro Lopo struct target_timespec it_interval; 228905bba13SErik de Castro Lopo struct target_timespec it_value; 229905bba13SErik de Castro Lopo }; 230905bba13SErik de Castro Lopo 23119f59bceSAleksandar Markovic struct target_timex { 23219f59bceSAleksandar Markovic abi_uint modes; /* Mode selector */ 23319f59bceSAleksandar Markovic abi_long offset; /* Time offset */ 23419f59bceSAleksandar Markovic abi_long freq; /* Frequency offset */ 23519f59bceSAleksandar Markovic abi_long maxerror; /* Maximum error (microseconds) */ 23619f59bceSAleksandar Markovic abi_long esterror; /* Estimated error (microseconds) */ 23719f59bceSAleksandar Markovic abi_int status; /* Clock command/status */ 23819f59bceSAleksandar Markovic abi_long constant; /* PLL (phase-locked loop) time constant */ 23919f59bceSAleksandar Markovic abi_long precision; /* Clock precision (microseconds, ro) */ 24019f59bceSAleksandar Markovic abi_long tolerance; /* Clock freq. tolerance (ppm, ro) */ 24119f59bceSAleksandar Markovic struct target_timeval time; /* Current time */ 24219f59bceSAleksandar Markovic abi_long tick; /* Microseconds between clock ticks */ 24319f59bceSAleksandar Markovic abi_long ppsfreq; /* PPS (pulse per second) frequency */ 24419f59bceSAleksandar Markovic abi_long jitter; /* PPS jitter (ro); nanoseconds */ 24519f59bceSAleksandar Markovic abi_int shift; /* PPS interval duration (seconds) */ 24619f59bceSAleksandar Markovic abi_long stabil; /* PPS stability */ 24719f59bceSAleksandar Markovic abi_long jitcnt; /* PPS jitter limit exceeded (ro) */ 24819f59bceSAleksandar Markovic abi_long calcnt; /* PPS calibration intervals */ 24919f59bceSAleksandar Markovic abi_long errcnt; /* PPS calibration errors */ 25019f59bceSAleksandar Markovic abi_long stbcnt; /* PPS stability limit exceeded */ 25119f59bceSAleksandar Markovic abi_int tai; /* TAI offset */ 25219f59bceSAleksandar Markovic 25319f59bceSAleksandar Markovic /* Further padding bytes to allow for future expansion */ 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; abi_int:32; 25619f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; 25719f59bceSAleksandar Markovic }; 25819f59bceSAleksandar Markovic 259c227f099SAnthony Liguori typedef abi_long target_clock_t; 26032f36bceSbellard 261c596ed17Sbellard #define TARGET_HZ 100 262c596ed17Sbellard 26332f36bceSbellard struct target_tms { 264c227f099SAnthony Liguori target_clock_t tms_utime; 265c227f099SAnthony Liguori target_clock_t tms_stime; 266c227f099SAnthony Liguori target_clock_t tms_cutime; 267c227f099SAnthony Liguori target_clock_t tms_cstime; 26832f36bceSbellard }; 26932f36bceSbellard 2706180a181Sbellard struct target_utimbuf { 271992f48a0Sblueswir1 abi_long actime; 272992f48a0Sblueswir1 abi_long modtime; 2736180a181Sbellard }; 2746180a181Sbellard 275f2674e31Sbellard struct target_sel_arg_struct { 276992f48a0Sblueswir1 abi_long n; 277992f48a0Sblueswir1 abi_long inp, outp, exp; 278992f48a0Sblueswir1 abi_long tvp; 279f2674e31Sbellard }; 280f2674e31Sbellard 28131e31b8aSbellard struct target_iovec { 282992f48a0Sblueswir1 abi_long iov_base; /* Starting address */ 283992f48a0Sblueswir1 abi_long iov_len; /* Number of bytes */ 28431e31b8aSbellard }; 28531e31b8aSbellard 2861a9353d2Sbellard struct target_msghdr { 287992f48a0Sblueswir1 abi_long msg_name; /* Socket name */ 2881a9353d2Sbellard int msg_namelen; /* Length of name */ 289992f48a0Sblueswir1 abi_long msg_iov; /* Data blocks */ 290992f48a0Sblueswir1 abi_long msg_iovlen; /* Number of blocks */ 291992f48a0Sblueswir1 abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ 292992f48a0Sblueswir1 abi_long msg_controllen; /* Length of cmsg list */ 2931a9353d2Sbellard unsigned int msg_flags; 2941a9353d2Sbellard }; 2951a9353d2Sbellard 2967854b056Sbellard struct target_cmsghdr { 297992f48a0Sblueswir1 abi_long cmsg_len; 2987854b056Sbellard int cmsg_level; 2997854b056Sbellard int cmsg_type; 3007854b056Sbellard }; 3017854b056Sbellard 3027854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) 303ee104587SJonathan Neuschäfer #define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \ 304ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start) 305992f48a0Sblueswir1 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ 306992f48a0Sblueswir1 & (size_t) ~(sizeof (abi_long) - 1)) 307ad762b99SPeter Maydell #define TARGET_CMSG_SPACE(len) (sizeof(struct target_cmsghdr) + \ 308ad762b99SPeter Maydell TARGET_CMSG_ALIGN(len)) 309ad762b99SPeter Maydell #define TARGET_CMSG_LEN(len) (sizeof(struct target_cmsghdr) + (len)) 3107854b056Sbellard 3117854b056Sbellard static __inline__ struct target_cmsghdr * 312ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(struct target_msghdr *__mhdr, 313ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg, 314ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg_start) 3157854b056Sbellard { 3162b8bdefcSths struct target_cmsghdr *__ptr; 3177854b056Sbellard 3182b8bdefcSths __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg 319cbb21eedSMatthias Braun + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len))); 320ee104587SJonathan Neuschäfer if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start) 321ee104587SJonathan Neuschäfer > tswapal(__mhdr->msg_controllen)) { 3227854b056Sbellard /* No more entries. */ 3232b8bdefcSths return (struct target_cmsghdr *)0; 324ee104587SJonathan Neuschäfer } 325ee104587SJonathan Neuschäfer return __ptr; 3267854b056Sbellard } 3277854b056Sbellard 328f19e00d7SAlexander Graf struct target_mmsghdr { 329f19e00d7SAlexander Graf struct target_msghdr msg_hdr; /* Message header */ 330f19e00d7SAlexander Graf unsigned int msg_len; /* Number of bytes transmitted */ 331f19e00d7SAlexander Graf }; 3327854b056Sbellard 33331e31b8aSbellard struct target_rusage { 33431e31b8aSbellard struct target_timeval ru_utime; /* user time used */ 33531e31b8aSbellard struct target_timeval ru_stime; /* system time used */ 336992f48a0Sblueswir1 abi_long ru_maxrss; /* maximum resident set size */ 337992f48a0Sblueswir1 abi_long ru_ixrss; /* integral shared memory size */ 338992f48a0Sblueswir1 abi_long ru_idrss; /* integral unshared data size */ 339992f48a0Sblueswir1 abi_long ru_isrss; /* integral unshared stack size */ 340992f48a0Sblueswir1 abi_long ru_minflt; /* page reclaims */ 341992f48a0Sblueswir1 abi_long ru_majflt; /* page faults */ 342992f48a0Sblueswir1 abi_long ru_nswap; /* swaps */ 343992f48a0Sblueswir1 abi_long ru_inblock; /* block input operations */ 344992f48a0Sblueswir1 abi_long ru_oublock; /* block output operations */ 345992f48a0Sblueswir1 abi_long ru_msgsnd; /* messages sent */ 346992f48a0Sblueswir1 abi_long ru_msgrcv; /* messages received */ 347992f48a0Sblueswir1 abi_long ru_nsignals; /* signals received */ 348992f48a0Sblueswir1 abi_long ru_nvcsw; /* voluntary context switches */ 349992f48a0Sblueswir1 abi_long ru_nivcsw; /* involuntary " */ 35031e31b8aSbellard }; 35131e31b8aSbellard 35231e31b8aSbellard typedef struct { 35331e31b8aSbellard int val[2]; 354c227f099SAnthony Liguori } kernel_fsid_t; 35531e31b8aSbellard 356dab2ed99Sbellard struct target_dirent { 357992f48a0Sblueswir1 abi_long d_ino; 358992f48a0Sblueswir1 abi_long d_off; 359dab2ed99Sbellard unsigned short d_reclen; 360333858b7SDmitry V. Levin char d_name[]; 361dab2ed99Sbellard }; 362dab2ed99Sbellard 363dab2ed99Sbellard struct target_dirent64 { 364dab2ed99Sbellard uint64_t d_ino; 365dab2ed99Sbellard int64_t d_off; 366dab2ed99Sbellard unsigned short d_reclen; 367dab2ed99Sbellard unsigned char d_type; 368dab2ed99Sbellard char d_name[256]; 369dab2ed99Sbellard }; 370dab2ed99Sbellard 371dab2ed99Sbellard 37231e31b8aSbellard /* mostly generic signal stuff */ 373992f48a0Sblueswir1 #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ 374992f48a0Sblueswir1 #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ 375992f48a0Sblueswir1 #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ 37631e31b8aSbellard 37731e31b8aSbellard #ifdef TARGET_MIPS 37831e31b8aSbellard #define TARGET_NSIG 128 37931e31b8aSbellard #else 38031e31b8aSbellard #define TARGET_NSIG 64 38131e31b8aSbellard #endif 382992f48a0Sblueswir1 #define TARGET_NSIG_BPW TARGET_ABI_BITS 38331e31b8aSbellard #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) 38431e31b8aSbellard 38531e31b8aSbellard typedef struct { 386992f48a0Sblueswir1 abi_ulong sig[TARGET_NSIG_WORDS]; 387c227f099SAnthony Liguori } target_sigset_t; 38831e31b8aSbellard 38966fb9763Sbellard #ifdef BSWAP_NEEDED 390c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 39166fb9763Sbellard { 39266fb9763Sbellard int i; 39366fb9763Sbellard for(i = 0;i < TARGET_NSIG_WORDS; i++) 394cbb21eedSMatthias Braun d->sig[i] = tswapal(s->sig[i]); 39566fb9763Sbellard } 39666fb9763Sbellard #else 397c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 39866fb9763Sbellard { 39966fb9763Sbellard *d = *s; 40066fb9763Sbellard } 40166fb9763Sbellard #endif 40266fb9763Sbellard 403c227f099SAnthony Liguori static inline void target_siginitset(target_sigset_t *d, abi_ulong set) 40466fb9763Sbellard { 40566fb9763Sbellard int i; 40666fb9763Sbellard d->sig[0] = set; 40766fb9763Sbellard for(i = 1;i < TARGET_NSIG_WORDS; i++) 40866fb9763Sbellard d->sig[i] = 0; 40966fb9763Sbellard } 41066fb9763Sbellard 411c227f099SAnthony Liguori void host_to_target_sigset(target_sigset_t *d, const sigset_t *s); 412c227f099SAnthony Liguori void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); 413992f48a0Sblueswir1 void host_to_target_old_sigset(abi_ulong *old_sigset, 41466fb9763Sbellard const sigset_t *sigset); 41566fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset, 416992f48a0Sblueswir1 const abi_ulong *old_sigset); 41766fb9763Sbellard struct target_sigaction; 41866fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act, 41966fb9763Sbellard struct target_sigaction *oact); 42066fb9763Sbellard 421d2fbca94SGuan Xuetao #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \ 422d2fbca94SGuan Xuetao || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined(TARGET_SH4) \ 423d2fbca94SGuan Xuetao || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) \ 424daa4374aSPeter Maydell || defined(TARGET_MICROBLAZE) \ 425b16189b2SChen Gang || defined(TARGET_S390X) || defined(TARGET_OPENRISC) \ 42647ae93cdSMichael Clark || defined(TARGET_TILEGX) || defined(TARGET_HPPA) || defined(TARGET_NIOS2) \ 427ba7651fbSMax Filippov || defined(TARGET_RISCV) || defined(TARGET_XTENSA) 4282521d698Sbellard 429048f6b4dSbellard #if defined(TARGET_SPARC) 430048f6b4dSbellard #define TARGET_SA_NOCLDSTOP 8u 431048f6b4dSbellard #define TARGET_SA_NOCLDWAIT 0x100u 432048f6b4dSbellard #define TARGET_SA_SIGINFO 0x200u 433048f6b4dSbellard #define TARGET_SA_ONSTACK 1u 434048f6b4dSbellard #define TARGET_SA_RESTART 2u 435048f6b4dSbellard #define TARGET_SA_NODEFER 0x20u 436048f6b4dSbellard #define TARGET_SA_RESETHAND 4u 4377f047de1SRichard Henderson #define TARGET_ARCH_HAS_SA_RESTORER 1 438*5de154e8SLaurent Vivier #define TARGET_ARCH_HAS_KA_RESTORER 1 439048f6b4dSbellard #elif defined(TARGET_MIPS) 440048f6b4dSbellard #define TARGET_SA_NOCLDSTOP 0x00000001 441048f6b4dSbellard #define TARGET_SA_NOCLDWAIT 0x00010000 442048f6b4dSbellard #define TARGET_SA_SIGINFO 0x00000008 443048f6b4dSbellard #define TARGET_SA_ONSTACK 0x08000000 444048f6b4dSbellard #define TARGET_SA_NODEFER 0x40000000 445048f6b4dSbellard #define TARGET_SA_RESTART 0x10000000 446048f6b4dSbellard #define TARGET_SA_RESETHAND 0x80000000 447d26bc211Sths #if !defined(TARGET_ABI_MIPSN32) && !defined(TARGET_ABI_MIPSN64) 448d26bc211Sths #define TARGET_SA_RESTORER 0x04000000 /* Only for O32 */ 449540635baSths #endif 450d962783eSJia Liu #elif defined(TARGET_OPENRISC) 451d962783eSJia Liu #define TARGET_SA_NOCLDSTOP 0x00000001 452d962783eSJia Liu #define TARGET_SA_NOCLDWAIT 0x00000002 453d962783eSJia Liu #define TARGET_SA_SIGINFO 0x00000004 454d962783eSJia Liu #define TARGET_SA_ONSTACK 0x08000000 455d962783eSJia Liu #define TARGET_SA_RESTART 0x10000000 456d962783eSJia Liu #define TARGET_SA_NODEFER 0x40000000 457d962783eSJia Liu #define TARGET_SA_RESETHAND 0x80000000 45857f18a95SRichard Henderson #elif defined(TARGET_ALPHA) 45957f18a95SRichard Henderson #define TARGET_SA_ONSTACK 0x00000001 46057f18a95SRichard Henderson #define TARGET_SA_RESTART 0x00000002 46157f18a95SRichard Henderson #define TARGET_SA_NOCLDSTOP 0x00000004 46257f18a95SRichard Henderson #define TARGET_SA_NODEFER 0x00000008 46357f18a95SRichard Henderson #define TARGET_SA_RESETHAND 0x00000010 46457f18a95SRichard Henderson #define TARGET_SA_NOCLDWAIT 0x00000020 /* not supported yet */ 46557f18a95SRichard Henderson #define TARGET_SA_SIGINFO 0x00000040 4662da6e76cSHelge Deller #elif defined(TARGET_HPPA) 4672da6e76cSHelge Deller #define TARGET_SA_ONSTACK 0x00000001 4682da6e76cSHelge Deller #define TARGET_SA_RESETHAND 0x00000004 4692da6e76cSHelge Deller #define TARGET_SA_NOCLDSTOP 0x00000008 4702da6e76cSHelge Deller #define TARGET_SA_SIGINFO 0x00000010 4712da6e76cSHelge Deller #define TARGET_SA_NODEFER 0x00000020 4722da6e76cSHelge Deller #define TARGET_SA_RESTART 0x00000040 4732da6e76cSHelge Deller #define TARGET_SA_NOCLDWAIT 0x00000080 474048f6b4dSbellard #else 4752521d698Sbellard #define TARGET_SA_NOCLDSTOP 0x00000001 4762521d698Sbellard #define TARGET_SA_NOCLDWAIT 0x00000002 /* not supported yet */ 4772521d698Sbellard #define TARGET_SA_SIGINFO 0x00000004 4782521d698Sbellard #define TARGET_SA_ONSTACK 0x08000000 4792521d698Sbellard #define TARGET_SA_RESTART 0x10000000 4802521d698Sbellard #define TARGET_SA_NODEFER 0x40000000 4812521d698Sbellard #define TARGET_SA_RESETHAND 0x80000000 4822521d698Sbellard #define TARGET_SA_RESTORER 0x04000000 4836d5e216dSbellard #endif 4846d5e216dSbellard 4857f047de1SRichard Henderson #ifdef TARGET_SA_RESTORER 4867f047de1SRichard Henderson #define TARGET_ARCH_HAS_SA_RESTORER 1 4877f047de1SRichard Henderson #endif 4887f047de1SRichard Henderson 489d0f20495SRichard Henderson #if defined(TARGET_ALPHA) 490d0f20495SRichard Henderson 491d0f20495SRichard Henderson #define TARGET_SIGHUP 1 492d0f20495SRichard Henderson #define TARGET_SIGINT 2 493d0f20495SRichard Henderson #define TARGET_SIGQUIT 3 494d0f20495SRichard Henderson #define TARGET_SIGILL 4 495d0f20495SRichard Henderson #define TARGET_SIGTRAP 5 496d0f20495SRichard Henderson #define TARGET_SIGABRT 6 497d0f20495SRichard Henderson #define TARGET_SIGSTKFLT 7 /* actually SIGEMT */ 498d0f20495SRichard Henderson #define TARGET_SIGFPE 8 499d0f20495SRichard Henderson #define TARGET_SIGKILL 9 500d0f20495SRichard Henderson #define TARGET_SIGBUS 10 501d0f20495SRichard Henderson #define TARGET_SIGSEGV 11 502d0f20495SRichard Henderson #define TARGET_SIGSYS 12 503d0f20495SRichard Henderson #define TARGET_SIGPIPE 13 504d0f20495SRichard Henderson #define TARGET_SIGALRM 14 505d0f20495SRichard Henderson #define TARGET_SIGTERM 15 506d0f20495SRichard Henderson #define TARGET_SIGURG 16 507d0f20495SRichard Henderson #define TARGET_SIGSTOP 17 508d0f20495SRichard Henderson #define TARGET_SIGTSTP 18 509d0f20495SRichard Henderson #define TARGET_SIGCONT 19 510d0f20495SRichard Henderson #define TARGET_SIGCHLD 20 511d0f20495SRichard Henderson #define TARGET_SIGTTIN 21 512d0f20495SRichard Henderson #define TARGET_SIGTTOU 22 513d0f20495SRichard Henderson #define TARGET_SIGIO 23 514d0f20495SRichard Henderson #define TARGET_SIGXCPU 24 515d0f20495SRichard Henderson #define TARGET_SIGXFSZ 25 516d0f20495SRichard Henderson #define TARGET_SIGVTALRM 26 517d0f20495SRichard Henderson #define TARGET_SIGPROF 27 518d0f20495SRichard Henderson #define TARGET_SIGWINCH 28 519d0f20495SRichard Henderson #define TARGET_SIGPWR 29 /* actually SIGINFO */ 520d0f20495SRichard Henderson #define TARGET_SIGUSR1 30 521d0f20495SRichard Henderson #define TARGET_SIGUSR2 31 522d0f20495SRichard Henderson #define TARGET_SIGRTMIN 32 523d0f20495SRichard Henderson 524d0f20495SRichard Henderson #define TARGET_SIG_BLOCK 1 525d0f20495SRichard Henderson #define TARGET_SIG_UNBLOCK 2 526d0f20495SRichard Henderson #define TARGET_SIG_SETMASK 3 527d0f20495SRichard Henderson 528d0f20495SRichard Henderson #elif defined(TARGET_SPARC) 5296d5e216dSbellard 5306d5e216dSbellard #define TARGET_SIGHUP 1 5316d5e216dSbellard #define TARGET_SIGINT 2 5326d5e216dSbellard #define TARGET_SIGQUIT 3 5336d5e216dSbellard #define TARGET_SIGILL 4 5346d5e216dSbellard #define TARGET_SIGTRAP 5 5356d5e216dSbellard #define TARGET_SIGABRT 6 5366d5e216dSbellard #define TARGET_SIGIOT 6 5376d5e216dSbellard #define TARGET_SIGSTKFLT 7 /* actually EMT */ 5386d5e216dSbellard #define TARGET_SIGFPE 8 5396d5e216dSbellard #define TARGET_SIGKILL 9 5406d5e216dSbellard #define TARGET_SIGBUS 10 5416d5e216dSbellard #define TARGET_SIGSEGV 11 5426d5e216dSbellard #define TARGET_SIGSYS 12 5436d5e216dSbellard #define TARGET_SIGPIPE 13 5446d5e216dSbellard #define TARGET_SIGALRM 14 5456d5e216dSbellard #define TARGET_SIGTERM 15 5466d5e216dSbellard #define TARGET_SIGURG 16 5476d5e216dSbellard #define TARGET_SIGSTOP 17 5486d5e216dSbellard #define TARGET_SIGTSTP 18 5496d5e216dSbellard #define TARGET_SIGCONT 19 5506d5e216dSbellard #define TARGET_SIGCHLD 20 5516d5e216dSbellard #define TARGET_SIGTTIN 21 5526d5e216dSbellard #define TARGET_SIGTTOU 22 5536d5e216dSbellard #define TARGET_SIGIO 23 5546d5e216dSbellard #define TARGET_SIGXCPU 24 5556d5e216dSbellard #define TARGET_SIGXFSZ 25 5566d5e216dSbellard #define TARGET_SIGVTALRM 26 5576d5e216dSbellard #define TARGET_SIGPROF 27 5586d5e216dSbellard #define TARGET_SIGWINCH 28 5596d5e216dSbellard #define TARGET_SIGPWR 29 5606d5e216dSbellard #define TARGET_SIGUSR1 30 5616d5e216dSbellard #define TARGET_SIGUSR2 31 5626d5e216dSbellard #define TARGET_SIGRTMIN 32 5636d5e216dSbellard 5646d5e216dSbellard #define TARGET_SIG_BLOCK 0x01 /* for blocking signals */ 5656d5e216dSbellard #define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */ 5666d5e216dSbellard #define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */ 5676d5e216dSbellard 568048f6b4dSbellard #elif defined(TARGET_MIPS) 569048f6b4dSbellard 570048f6b4dSbellard #define TARGET_SIGHUP 1 /* Hangup (POSIX). */ 571048f6b4dSbellard #define TARGET_SIGINT 2 /* Interrupt (ANSI). */ 572048f6b4dSbellard #define TARGET_SIGQUIT 3 /* Quit (POSIX). */ 573048f6b4dSbellard #define TARGET_SIGILL 4 /* Illegal instruction (ANSI). */ 574048f6b4dSbellard #define TARGET_SIGTRAP 5 /* Trace trap (POSIX). */ 575048f6b4dSbellard #define TARGET_SIGIOT 6 /* IOT trap (4.2 BSD). */ 576048f6b4dSbellard #define TARGET_SIGABRT TARGET_SIGIOT /* Abort (ANSI). */ 577048f6b4dSbellard #define TARGET_SIGEMT 7 578048f6b4dSbellard #define TARGET_SIGSTKFLT 7 /* XXX: incorrect */ 579048f6b4dSbellard #define TARGET_SIGFPE 8 /* Floating-point exception (ANSI). */ 580048f6b4dSbellard #define TARGET_SIGKILL 9 /* Kill, unblockable (POSIX). */ 581048f6b4dSbellard #define TARGET_SIGBUS 10 /* BUS error (4.2 BSD). */ 582048f6b4dSbellard #define TARGET_SIGSEGV 11 /* Segmentation violation (ANSI). */ 583048f6b4dSbellard #define TARGET_SIGSYS 12 584048f6b4dSbellard #define TARGET_SIGPIPE 13 /* Broken pipe (POSIX). */ 585048f6b4dSbellard #define TARGET_SIGALRM 14 /* Alarm clock (POSIX). */ 586048f6b4dSbellard #define TARGET_SIGTERM 15 /* Termination (ANSI). */ 587048f6b4dSbellard #define TARGET_SIGUSR1 16 /* User-defined signal 1 (POSIX). */ 588048f6b4dSbellard #define TARGET_SIGUSR2 17 /* User-defined signal 2 (POSIX). */ 589048f6b4dSbellard #define TARGET_SIGCHLD 18 /* Child status has changed (POSIX). */ 590048f6b4dSbellard #define TARGET_SIGCLD TARGET_SIGCHLD /* Same as TARGET_SIGCHLD (System V). */ 591048f6b4dSbellard #define TARGET_SIGPWR 19 /* Power failure restart (System V). */ 592048f6b4dSbellard #define TARGET_SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */ 593048f6b4dSbellard #define TARGET_SIGURG 21 /* Urgent condition on socket (4.2 BSD). */ 594048f6b4dSbellard #define TARGET_SIGIO 22 /* I/O now possible (4.2 BSD). */ 595048f6b4dSbellard #define TARGET_SIGPOLL TARGET_SIGIO /* Pollable event occurred (System V). */ 596048f6b4dSbellard #define TARGET_SIGSTOP 23 /* Stop, unblockable (POSIX). */ 597048f6b4dSbellard #define TARGET_SIGTSTP 24 /* Keyboard stop (POSIX). */ 598048f6b4dSbellard #define TARGET_SIGCONT 25 /* Continue (POSIX). */ 599048f6b4dSbellard #define TARGET_SIGTTIN 26 /* Background read from tty (POSIX). */ 600048f6b4dSbellard #define TARGET_SIGTTOU 27 /* Background write to tty (POSIX). */ 601048f6b4dSbellard #define TARGET_SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */ 602048f6b4dSbellard #define TARGET_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */ 603048f6b4dSbellard #define TARGET_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ 604048f6b4dSbellard #define TARGET_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ 605048f6b4dSbellard #define TARGET_SIGRTMIN 32 606048f6b4dSbellard 607048f6b4dSbellard #define TARGET_SIG_BLOCK 1 /* for blocking signals */ 608048f6b4dSbellard #define TARGET_SIG_UNBLOCK 2 /* for unblocking signals */ 609048f6b4dSbellard #define TARGET_SIG_SETMASK 3 /* for setting the signal mask */ 610048f6b4dSbellard 611a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 612a10d1e50SRichard Henderson 613a10d1e50SRichard Henderson #define TARGET_SIGHUP 1 614a10d1e50SRichard Henderson #define TARGET_SIGINT 2 615a10d1e50SRichard Henderson #define TARGET_SIGQUIT 3 616a10d1e50SRichard Henderson #define TARGET_SIGILL 4 617a10d1e50SRichard Henderson #define TARGET_SIGTRAP 5 618a10d1e50SRichard Henderson #define TARGET_SIGABRT 6 619a10d1e50SRichard Henderson #define TARGET_SIGIOT 6 620a10d1e50SRichard Henderson #define TARGET_SIGSTKFLT 7 621a10d1e50SRichard Henderson #define TARGET_SIGFPE 8 622a10d1e50SRichard Henderson #define TARGET_SIGKILL 9 623a10d1e50SRichard Henderson #define TARGET_SIGBUS 10 624a10d1e50SRichard Henderson #define TARGET_SIGSEGV 11 625a10d1e50SRichard Henderson #define TARGET_SIGXCPU 12 626a10d1e50SRichard Henderson #define TARGET_SIGPIPE 13 627a10d1e50SRichard Henderson #define TARGET_SIGALRM 14 628a10d1e50SRichard Henderson #define TARGET_SIGTERM 15 629a10d1e50SRichard Henderson #define TARGET_SIGUSR1 16 630a10d1e50SRichard Henderson #define TARGET_SIGUSR2 17 631a10d1e50SRichard Henderson #define TARGET_SIGCHLD 18 632a10d1e50SRichard Henderson #define TARGET_SIGPWR 19 633a10d1e50SRichard Henderson #define TARGET_SIGVTALRM 20 634a10d1e50SRichard Henderson #define TARGET_SIGPROF 21 635a10d1e50SRichard Henderson #define TARGET_SIGIO 22 636a10d1e50SRichard Henderson #define TARGET_SIGPOLL TARGET_SIGIO 637a10d1e50SRichard Henderson #define TARGET_SIGWINCH 23 638a10d1e50SRichard Henderson #define TARGET_SIGSTOP 24 639a10d1e50SRichard Henderson #define TARGET_SIGTSTP 25 640a10d1e50SRichard Henderson #define TARGET_SIGCONT 26 641a10d1e50SRichard Henderson #define TARGET_SIGTTIN 27 642a10d1e50SRichard Henderson #define TARGET_SIGTTOU 28 643a10d1e50SRichard Henderson #define TARGET_SIGURG 29 644a10d1e50SRichard Henderson #define TARGET_SIGXFSZ 30 645a10d1e50SRichard Henderson #define TARGET_SIGSYS 31 646a10d1e50SRichard Henderson 647a10d1e50SRichard Henderson #define TARGET_SIG_BLOCK 0 648a10d1e50SRichard Henderson #define TARGET_SIG_UNBLOCK 1 649a10d1e50SRichard Henderson #define TARGET_SIG_SETMASK 2 650a10d1e50SRichard Henderson 6516d5e216dSbellard #else 6522521d698Sbellard 653d962783eSJia Liu /* OpenRISC Using the general signals */ 6542521d698Sbellard #define TARGET_SIGHUP 1 6552521d698Sbellard #define TARGET_SIGINT 2 6562521d698Sbellard #define TARGET_SIGQUIT 3 6572521d698Sbellard #define TARGET_SIGILL 4 6582521d698Sbellard #define TARGET_SIGTRAP 5 6592521d698Sbellard #define TARGET_SIGABRT 6 6602521d698Sbellard #define TARGET_SIGIOT 6 6612521d698Sbellard #define TARGET_SIGBUS 7 6622521d698Sbellard #define TARGET_SIGFPE 8 6632521d698Sbellard #define TARGET_SIGKILL 9 6642521d698Sbellard #define TARGET_SIGUSR1 10 6652521d698Sbellard #define TARGET_SIGSEGV 11 6662521d698Sbellard #define TARGET_SIGUSR2 12 6672521d698Sbellard #define TARGET_SIGPIPE 13 6682521d698Sbellard #define TARGET_SIGALRM 14 6692521d698Sbellard #define TARGET_SIGTERM 15 6702521d698Sbellard #define TARGET_SIGSTKFLT 16 6712521d698Sbellard #define TARGET_SIGCHLD 17 6722521d698Sbellard #define TARGET_SIGCONT 18 6732521d698Sbellard #define TARGET_SIGSTOP 19 6742521d698Sbellard #define TARGET_SIGTSTP 20 6752521d698Sbellard #define TARGET_SIGTTIN 21 6762521d698Sbellard #define TARGET_SIGTTOU 22 6772521d698Sbellard #define TARGET_SIGURG 23 6782521d698Sbellard #define TARGET_SIGXCPU 24 6792521d698Sbellard #define TARGET_SIGXFSZ 25 6802521d698Sbellard #define TARGET_SIGVTALRM 26 6812521d698Sbellard #define TARGET_SIGPROF 27 6822521d698Sbellard #define TARGET_SIGWINCH 28 6832521d698Sbellard #define TARGET_SIGIO 29 684c596ed17Sbellard #define TARGET_SIGPWR 30 685c596ed17Sbellard #define TARGET_SIGSYS 31 6862521d698Sbellard #define TARGET_SIGRTMIN 32 6872521d698Sbellard 6882521d698Sbellard #define TARGET_SIG_BLOCK 0 /* for blocking signals */ 6892521d698Sbellard #define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */ 6902521d698Sbellard #define TARGET_SIG_SETMASK 2 /* for setting the signal mask */ 6912521d698Sbellard 6926d5e216dSbellard #endif 6936d5e216dSbellard 6946049f4f8SRichard Henderson #if defined(TARGET_ALPHA) 6956049f4f8SRichard Henderson struct target_old_sigaction { 6966049f4f8SRichard Henderson abi_ulong _sa_handler; 6976049f4f8SRichard Henderson abi_ulong sa_mask; 698d2565875SRichard Henderson int32_t sa_flags; 6996049f4f8SRichard Henderson }; 700106ec879Sbellard 7016049f4f8SRichard Henderson struct target_rt_sigaction { 7026049f4f8SRichard Henderson abi_ulong _sa_handler; 7036049f4f8SRichard Henderson abi_ulong sa_flags; 7046049f4f8SRichard Henderson target_sigset_t sa_mask; 7056049f4f8SRichard Henderson }; 7066049f4f8SRichard Henderson 7076049f4f8SRichard Henderson /* This is the struct used inside the kernel. The ka_restorer 7086049f4f8SRichard Henderson field comes from the 5th argument to sys_rt_sigaction. */ 7096049f4f8SRichard Henderson struct target_sigaction { 7106049f4f8SRichard Henderson abi_ulong _sa_handler; 7116049f4f8SRichard Henderson abi_ulong sa_flags; 7126049f4f8SRichard Henderson target_sigset_t sa_mask; 7136049f4f8SRichard Henderson abi_ulong sa_restorer; 7146049f4f8SRichard Henderson }; 7156049f4f8SRichard Henderson #elif defined(TARGET_MIPS) 716106ec879Sbellard struct target_sigaction { 717540635baSths uint32_t sa_flags; 718d26bc211Sths #if defined(TARGET_ABI_MIPSN32) 719540635baSths uint32_t _sa_handler; 720540635baSths #else 721992f48a0Sblueswir1 abi_ulong _sa_handler; 722540635baSths #endif 723c227f099SAnthony Liguori target_sigset_t sa_mask; 7247f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 7257f047de1SRichard Henderson /* ??? This is always present, but ignored unless O32. */ 7267f047de1SRichard Henderson abi_ulong sa_restorer; 7277f047de1SRichard Henderson #endif 728106ec879Sbellard }; 729106ec879Sbellard #else 7302521d698Sbellard struct target_old_sigaction { 731992f48a0Sblueswir1 abi_ulong _sa_handler; 732992f48a0Sblueswir1 abi_ulong sa_mask; 733992f48a0Sblueswir1 abi_ulong sa_flags; 7347f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 735992f48a0Sblueswir1 abi_ulong sa_restorer; 7367f047de1SRichard Henderson #endif 7372521d698Sbellard }; 7382521d698Sbellard 7392521d698Sbellard struct target_sigaction { 740992f48a0Sblueswir1 abi_ulong _sa_handler; 741992f48a0Sblueswir1 abi_ulong sa_flags; 7427f047de1SRichard Henderson #ifdef TARGET_ARCH_HAS_SA_RESTORER 743992f48a0Sblueswir1 abi_ulong sa_restorer; 7447f047de1SRichard Henderson #endif 745c227f099SAnthony Liguori target_sigset_t sa_mask; 746*5de154e8SLaurent Vivier #ifdef TARGET_ARCH_HAS_KA_RESTORER 747*5de154e8SLaurent Vivier abi_ulong ka_restorer; 748*5de154e8SLaurent Vivier #endif 7492521d698Sbellard }; 750106ec879Sbellard #endif 7512521d698Sbellard 7522521d698Sbellard typedef union target_sigval { 7532521d698Sbellard int sival_int; 754992f48a0Sblueswir1 abi_ulong sival_ptr; 755c227f099SAnthony Liguori } target_sigval_t; 7566d5e216dSbellard #if 0 7576d5e216dSbellard #if defined (TARGET_SPARC) 7586d5e216dSbellard typedef struct { 7596d5e216dSbellard struct { 760992f48a0Sblueswir1 abi_ulong psr; 761992f48a0Sblueswir1 abi_ulong pc; 762992f48a0Sblueswir1 abi_ulong npc; 763992f48a0Sblueswir1 abi_ulong y; 764992f48a0Sblueswir1 abi_ulong u_regs[16]; /* globals and ins */ 7656d5e216dSbellard } si_regs; 7666d5e216dSbellard int si_mask; 7676d5e216dSbellard } __siginfo_t; 7686d5e216dSbellard 7696d5e216dSbellard typedef struct { 7706d5e216dSbellard unsigned long si_float_regs [32]; 7716d5e216dSbellard unsigned long si_fsr; 7726d5e216dSbellard unsigned long si_fpqdepth; 7736d5e216dSbellard struct { 7746d5e216dSbellard unsigned long *insn_addr; 7756d5e216dSbellard unsigned long insn; 7766d5e216dSbellard } si_fpqueue [16]; 7776d5e216dSbellard } __siginfo_fpu_t; 7786d5e216dSbellard #endif 7796d5e216dSbellard #endif 7802521d698Sbellard 7812521d698Sbellard #define TARGET_SI_MAX_SIZE 128 782aa5e03d2SMaxim Ostapenko 783aa5e03d2SMaxim Ostapenko #if TARGET_ABI_BITS == 32 784aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int)) 785aa5e03d2SMaxim Ostapenko #else 786aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int)) 787aa5e03d2SMaxim Ostapenko #endif 788aa5e03d2SMaxim Ostapenko 789aa5e03d2SMaxim Ostapenko #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int)) 7902521d698Sbellard 791a70dadc7SPeter Maydell /* Within QEMU the top 16 bits of si_code indicate which of the parts of 792a70dadc7SPeter Maydell * the union in target_siginfo is valid. This only applies between 793a70dadc7SPeter Maydell * host_to_target_siginfo_noswap() and tswap_siginfo(); it does not 794a70dadc7SPeter Maydell * appear either within host siginfo_t or in target_siginfo structures 795a70dadc7SPeter Maydell * which we get from the guest userspace program. (The Linux kernel 796a70dadc7SPeter Maydell * does a similar thing with using the top bits for its own internal 797a70dadc7SPeter Maydell * purposes but not letting them be visible to userspace.) 798a70dadc7SPeter Maydell */ 799a70dadc7SPeter Maydell #define QEMU_SI_KILL 0 800a70dadc7SPeter Maydell #define QEMU_SI_TIMER 1 801a70dadc7SPeter Maydell #define QEMU_SI_POLL 2 802a70dadc7SPeter Maydell #define QEMU_SI_FAULT 3 803a70dadc7SPeter Maydell #define QEMU_SI_CHLD 4 804a70dadc7SPeter Maydell #define QEMU_SI_RT 5 805a70dadc7SPeter Maydell 8062521d698Sbellard typedef struct target_siginfo { 8073f53d546Spbrook #ifdef TARGET_MIPS 8083f53d546Spbrook int si_signo; 8093f53d546Spbrook int si_code; 8103f53d546Spbrook int si_errno; 8113f53d546Spbrook #else 8122521d698Sbellard int si_signo; 8132521d698Sbellard int si_errno; 8142521d698Sbellard int si_code; 8153f53d546Spbrook #endif 8162521d698Sbellard 8172521d698Sbellard union { 8182521d698Sbellard int _pad[TARGET_SI_PAD_SIZE]; 8192521d698Sbellard 8202521d698Sbellard /* kill() */ 8212521d698Sbellard struct { 8222521d698Sbellard pid_t _pid; /* sender's pid */ 8232521d698Sbellard uid_t _uid; /* sender's uid */ 8242521d698Sbellard } _kill; 8252521d698Sbellard 8262521d698Sbellard /* POSIX.1b timers */ 8272521d698Sbellard struct { 8282521d698Sbellard unsigned int _timer1; 8292521d698Sbellard unsigned int _timer2; 8302521d698Sbellard } _timer; 8312521d698Sbellard 8322521d698Sbellard /* POSIX.1b signals */ 8332521d698Sbellard struct { 8342521d698Sbellard pid_t _pid; /* sender's pid */ 8352521d698Sbellard uid_t _uid; /* sender's uid */ 836c227f099SAnthony Liguori target_sigval_t _sigval; 8372521d698Sbellard } _rt; 8382521d698Sbellard 8392521d698Sbellard /* SIGCHLD */ 8402521d698Sbellard struct { 8412521d698Sbellard pid_t _pid; /* which child */ 8422521d698Sbellard uid_t _uid; /* sender's uid */ 8432521d698Sbellard int _status; /* exit code */ 844c227f099SAnthony Liguori target_clock_t _utime; 845c227f099SAnthony Liguori target_clock_t _stime; 8462521d698Sbellard } _sigchld; 8472521d698Sbellard 8482521d698Sbellard /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 8492521d698Sbellard struct { 850992f48a0Sblueswir1 abi_ulong _addr; /* faulting insn/memory ref. */ 8512521d698Sbellard } _sigfault; 8522521d698Sbellard 8532521d698Sbellard /* SIGPOLL */ 8542521d698Sbellard struct { 8552521d698Sbellard int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 8562521d698Sbellard int _fd; 8572521d698Sbellard } _sigpoll; 8582521d698Sbellard } _sifields; 859c227f099SAnthony Liguori } target_siginfo_t; 8602521d698Sbellard 8612521d698Sbellard /* 8622521d698Sbellard * si_code values 8632521d698Sbellard * Digital reserves positive values for kernel-generated signals. 8642521d698Sbellard */ 8652521d698Sbellard #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ 8662521d698Sbellard #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 8672521d698Sbellard #define TARGET_SI_QUEUE -1 /* sent by sigqueue */ 8682521d698Sbellard #define TARGET_SI_TIMER -2 /* sent by timer expiration */ 8692521d698Sbellard #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ 8702521d698Sbellard #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ 8712521d698Sbellard #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ 8722521d698Sbellard 8732521d698Sbellard /* 8742521d698Sbellard * SIGILL si_codes 8752521d698Sbellard */ 876ffa65c3bSbellard #define TARGET_ILL_ILLOPC (1) /* illegal opcode */ 8772521d698Sbellard #define TARGET_ILL_ILLOPN (2) /* illegal operand */ 878ffa65c3bSbellard #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ 879ffa65c3bSbellard #define TARGET_ILL_ILLTRP (4) /* illegal trap */ 880ffa65c3bSbellard #define TARGET_ILL_PRVOPC (5) /* privileged opcode */ 881ffa65c3bSbellard #define TARGET_ILL_PRVREG (6) /* privileged register */ 882ffa65c3bSbellard #define TARGET_ILL_COPROC (7) /* coprocessor error */ 883ffa65c3bSbellard #define TARGET_ILL_BADSTK (8) /* internal stack error */ 884de2fdd56SChen Gang #ifdef TARGET_TILEGX 885de2fdd56SChen Gang #define TARGET_ILL_DBLFLT (9) /* double fault */ 886de2fdd56SChen Gang #define TARGET_ILL_HARDWALL (10) /* user networks hardwall violation */ 887de2fdd56SChen Gang #endif 8882521d698Sbellard 8892521d698Sbellard /* 8902521d698Sbellard * SIGFPE si_codes 8912521d698Sbellard */ 8922521d698Sbellard #define TARGET_FPE_INTDIV (1) /* integer divide by zero */ 8932521d698Sbellard #define TARGET_FPE_INTOVF (2) /* integer overflow */ 8942521d698Sbellard #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ 8952521d698Sbellard #define TARGET_FPE_FLTOVF (4) /* floating point overflow */ 8962521d698Sbellard #define TARGET_FPE_FLTUND (5) /* floating point underflow */ 8972521d698Sbellard #define TARGET_FPE_FLTRES (6) /* floating point inexact result */ 8982521d698Sbellard #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ 8992521d698Sbellard #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ 9002521d698Sbellard #define TARGET_NSIGFPE 8 9012521d698Sbellard 9022521d698Sbellard /* 9032521d698Sbellard * SIGSEGV si_codes 9042521d698Sbellard */ 9052521d698Sbellard #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ 9062521d698Sbellard #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ 907de2fdd56SChen Gang #define TARGET_SEGV_BNDERR (3) /* failed address bound checks */ 9082521d698Sbellard 9092521d698Sbellard /* 910ffa65c3bSbellard * SIGBUS si_codes 911ffa65c3bSbellard */ 912ffa65c3bSbellard #define TARGET_BUS_ADRALN (1) /* invalid address alignment */ 913b4916d7bSDong Xu Wang #define TARGET_BUS_ADRERR (2) /* non-existent physical address */ 914ffa65c3bSbellard #define TARGET_BUS_OBJERR (3) /* object specific hardware error */ 915de2fdd56SChen Gang /* hardware memory error consumed on a machine check: action required */ 916de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AR (4) 917de2fdd56SChen Gang /* hardware memory error detected in process but not consumed: action optional*/ 918de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AO (5) 919ffa65c3bSbellard 920ffa65c3bSbellard /* 9212521d698Sbellard * SIGTRAP si_codes 9222521d698Sbellard */ 9232521d698Sbellard #define TARGET_TRAP_BRKPT (1) /* process breakpoint */ 9242521d698Sbellard #define TARGET_TRAP_TRACE (2) /* process trace trap */ 925de2fdd56SChen Gang #define TARGET_TRAP_BRANCH (3) /* process taken branch trap */ 926de2fdd56SChen Gang #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */ 9272521d698Sbellard 9282521d698Sbellard #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */ 9292521d698Sbellard 9309de5e440Sbellard struct target_rlimit { 931992f48a0Sblueswir1 abi_ulong rlim_cur; 932992f48a0Sblueswir1 abi_ulong rlim_max; 9339de5e440Sbellard }; 9349de5e440Sbellard 93581bbe906Stakasi-y@ops.dti.ne.jp #if defined(TARGET_ALPHA) 936e476492eSAurelien Jarno #define TARGET_RLIM_INFINITY 0x7fffffffffffffffull 9376cafd027SMatthias Braun #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32) 93881bbe906Stakasi-y@ops.dti.ne.jp #define TARGET_RLIM_INFINITY 0x7fffffffUL 93981bbe906Stakasi-y@ops.dti.ne.jp #else 94026b746dbSMatthias Braun #define TARGET_RLIM_INFINITY ((abi_ulong)-1) 94181bbe906Stakasi-y@ops.dti.ne.jp #endif 94281bbe906Stakasi-y@ops.dti.ne.jp 943e22b7015SWesley W. Terpstra #if defined(TARGET_MIPS) 944e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 945e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 946e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 947e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 948e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 949e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 7 950e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 8 951e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 5 952e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 9 953e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 6 954e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 955e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 956e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 957e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 958e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 959e22b7015SWesley W. Terpstra #else 960e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 961e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 962e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 963e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 964e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 965e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 5 9666cafd027SMatthias Braun #if defined(TARGET_SPARC) 9676cafd027SMatthias Braun #define TARGET_RLIMIT_NOFILE 6 9686cafd027SMatthias Braun #define TARGET_RLIMIT_NPROC 7 9696cafd027SMatthias Braun #else 970e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 6 971e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 7 9726cafd027SMatthias Braun #endif 973e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 8 974e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 9 975e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 976e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 977e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 978e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 979e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 980e22b7015SWesley W. Terpstra #endif 981e22b7015SWesley W. Terpstra 9829de5e440Sbellard struct target_pollfd { 9839de5e440Sbellard int fd; /* file descriptor */ 9849de5e440Sbellard short events; /* requested events */ 9859de5e440Sbellard short revents; /* returned events */ 9869de5e440Sbellard }; 9879de5e440Sbellard 9888e5a0667Sbellard /* virtual terminal ioctls */ 9890221cfcdSbellard #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ 9900221cfcdSbellard #define TARGET_KDMKTONE 0x4B30 /* generate tone */ 9918e5a0667Sbellard #define TARGET_KDGKBTYPE 0x4b33 992f7680a55SUlrich Hecht #define TARGET_KDSETMODE 0x4b3a 993f7680a55SUlrich Hecht #define TARGET_KDGKBMODE 0x4b44 994f7680a55SUlrich Hecht #define TARGET_KDSKBMODE 0x4b45 9950221cfcdSbellard #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ 9960221cfcdSbellard #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ 997e6fe18fbSCédric VINCENT #define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ 998e6fe18fbSCédric VINCENT #define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ 999e6fe18fbSCédric VINCENT #define TARGET_KDGETLED 0x4B31 /* return current led state */ 1000e6fe18fbSCédric VINCENT #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */ 1001ca56f5b5SPaul Burton #define TARGET_KDSIGACCEPT 0x4B4E 10028e5a0667Sbellard 1003e1be1606SAleksandar Markovic #if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) 1004e1be1606SAleksandar Markovic #define TARGET_SIOCATMARK TARGET_IOR('s', 7, int) 1005405b4915SHelge Deller #define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t) 1006e1be1606SAleksandar Markovic #else 10072521d698Sbellard #define TARGET_SIOCATMARK 0x8905 1008405b4915SHelge Deller #define TARGET_SIOCGPGRP 0x8904 1009e1be1606SAleksandar Markovic #endif 1010405b4915SHelge Deller #define TARGET_SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ 1011405b4915SHelge Deller #define TARGET_SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ 10122521d698Sbellard 101331e31b8aSbellard /* Networking ioctls */ 101431e31b8aSbellard #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ 101531e31b8aSbellard #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ 101631e31b8aSbellard #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ 101731e31b8aSbellard #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ 101831e31b8aSbellard #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ 101931e31b8aSbellard #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ 102031e31b8aSbellard #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ 102131e31b8aSbellard #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ 102231e31b8aSbellard #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ 102331e31b8aSbellard #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ 102431e31b8aSbellard #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ 102531e31b8aSbellard #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ 102631e31b8aSbellard #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ 102731e31b8aSbellard #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ 102831e31b8aSbellard #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ 102931e31b8aSbellard #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ 103031e31b8aSbellard #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ 103131e31b8aSbellard #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ 103231e31b8aSbellard #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ 103331e31b8aSbellard #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ 103431e31b8aSbellard #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ 103531e31b8aSbellard #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ 103631e31b8aSbellard #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ 103731e31b8aSbellard #define TARGET_SIOCSIFENCAP 0x8926 103831e31b8aSbellard #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ 103931e31b8aSbellard #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ 104031e31b8aSbellard #define TARGET_SIOCSIFSLAVE 0x8930 104131e31b8aSbellard #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ 104231e31b8aSbellard #define TARGET_SIOCDELMULTI 0x8932 1043f63eb01aSPaul Burton #define TARGET_SIOCGIFINDEX 0x8933 104431e31b8aSbellard 104531e31b8aSbellard /* Bridging control calls */ 104631e31b8aSbellard #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ 104731e31b8aSbellard #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ 104831e31b8aSbellard 104931e31b8aSbellard #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ 105031e31b8aSbellard #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ 105131e31b8aSbellard 105231e31b8aSbellard /* ARP cache control calls. */ 105331e31b8aSbellard #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ 105431e31b8aSbellard #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ 105531e31b8aSbellard #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ 105631e31b8aSbellard #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ 105731e31b8aSbellard #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ 105831e31b8aSbellard #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ 105931e31b8aSbellard 106031e31b8aSbellard /* RARP cache control calls. */ 106131e31b8aSbellard #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ 106231e31b8aSbellard #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ 106331e31b8aSbellard #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ 106431e31b8aSbellard 106531e31b8aSbellard /* Driver configuration calls */ 106631e31b8aSbellard #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ 106731e31b8aSbellard #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ 106831e31b8aSbellard 106931e31b8aSbellard /* DLCI configuration calls */ 107031e31b8aSbellard #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ 107131e31b8aSbellard #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ 107231e31b8aSbellard 107386fcd946SLaurent Vivier /* From <linux/wireless.h> */ 107486fcd946SLaurent Vivier 107586fcd946SLaurent Vivier #define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ 107631e31b8aSbellard 1077d6d6d6feSMarco A L Barbosa /* From <linux/random.h> */ 1078d6d6d6feSMarco A L Barbosa 1079d6d6d6feSMarco A L Barbosa #define TARGET_RNDGETENTCNT TARGET_IOR('R', 0x00, int) 1080d6d6d6feSMarco A L Barbosa #define TARGET_RNDADDTOENTCNT TARGET_IOW('R', 0x01, int) 1081d6d6d6feSMarco A L Barbosa #define TARGET_RNDZAPENTCNT TARGET_IO('R', 0x04) 1082d6d6d6feSMarco A L Barbosa #define TARGET_RNDCLEARPOOL TARGET_IO('R', 0x06) 1083d6d6d6feSMarco A L Barbosa 108431e31b8aSbellard /* From <linux/fs.h> */ 108531e31b8aSbellard 108631e31b8aSbellard #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ 108731e31b8aSbellard #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ 108831e31b8aSbellard #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ 108931e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ 109031e31b8aSbellard #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ 109131e31b8aSbellard #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ 109231e31b8aSbellard #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ 109331e31b8aSbellard #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ 109431e31b8aSbellard #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ 109531e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ 109631e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ 109731e31b8aSbellard #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ 1098fff8c539SAndreas Färber #define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */ 109931e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */ 1100c8b0bf54SPeter Maydell #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong) 1101c8b0bf54SPeter Maydell #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong) 1102edafea13SAlexander Graf #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) 1103edafea13SAlexander Graf /* return device size in bytes 1104edafea13SAlexander Graf (u64 *arg) */ 11054715856aSPeter Maydell 11064715856aSPeter Maydell #define TARGET_BLKDISCARD TARGET_IO(0x12, 119) 11074715856aSPeter Maydell #define TARGET_BLKIOMIN TARGET_IO(0x12, 120) 11084715856aSPeter Maydell #define TARGET_BLKIOOPT TARGET_IO(0x12, 121) 11094715856aSPeter Maydell #define TARGET_BLKALIGNOFF TARGET_IO(0x12, 122) 11104715856aSPeter Maydell #define TARGET_BLKPBSZGET TARGET_IO(0x12, 123) 11114715856aSPeter Maydell #define TARGET_BLKDISCARDZEROES TARGET_IO(0x12, 124) 11124715856aSPeter Maydell #define TARGET_BLKSECDISCARD TARGET_IO(0x12, 125) 11134715856aSPeter Maydell #define TARGET_BLKROTATIONAL TARGET_IO(0x12, 126) 11144715856aSPeter Maydell #define TARGET_BLKZEROOUT TARGET_IO(0x12, 127) 11154715856aSPeter Maydell 111631e31b8aSbellard #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ 111731e31b8aSbellard #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ 111821992cb6SHelge Deller 111921992cb6SHelge Deller #define TARGET_FICLONE TARGET_IOW(0x94, 9, int) 112021992cb6SHelge Deller #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range) 112121992cb6SHelge Deller 112260807231SPeter Maydell /* Note that the ioctl numbers claim type "long" but the actual type 112360807231SPeter Maydell * used by the kernel is "int". 112460807231SPeter Maydell */ 11251847b7baSPeter Maydell #define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, abi_long) 11261847b7baSPeter Maydell #define TARGET_FS_IOC_SETFLAGS TARGET_IOW('f', 2, abi_long) 112760807231SPeter Maydell 1128285da2b9SPeter Maydell #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) 112931e31b8aSbellard 113031e31b8aSbellard /* cdrom commands */ 113131e31b8aSbellard #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ 113231e31b8aSbellard #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ 113331e31b8aSbellard #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ 113431e31b8aSbellard #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index 113531e31b8aSbellard (struct cdrom_ti) */ 113631e31b8aSbellard #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header 113731e31b8aSbellard (struct cdrom_tochdr) */ 113831e31b8aSbellard #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry 113931e31b8aSbellard (struct cdrom_tocentry) */ 114031e31b8aSbellard #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ 114131e31b8aSbellard #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ 114231e31b8aSbellard #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ 114331e31b8aSbellard #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume 114431e31b8aSbellard (struct cdrom_volctrl) */ 114531e31b8aSbellard #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data 114631e31b8aSbellard (struct cdrom_subchnl) */ 114731e31b8aSbellard #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) 114831e31b8aSbellard (struct cdrom_read) */ 114931e31b8aSbellard #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) 115031e31b8aSbellard (struct cdrom_read) */ 115131e31b8aSbellard #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ 115231e31b8aSbellard #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ 115331e31b8aSbellard #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session 115431e31b8aSbellard address of multi session disks 115531e31b8aSbellard (struct cdrom_multisession) */ 115631e31b8aSbellard #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" 115731e31b8aSbellard if available (struct cdrom_mcn) */ 115867cc32ebSVeres Lajos #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is deprecated, 1159b4916d7bSDong Xu Wang but here anyway for compatibility */ 116031e31b8aSbellard #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ 116131e31b8aSbellard #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting 116231e31b8aSbellard (struct cdrom_volctrl) */ 116331e31b8aSbellard #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) 116431e31b8aSbellard (struct cdrom_read) */ 116531e31b8aSbellard /* 116631e31b8aSbellard * These ioctls are used only used in aztcd.c and optcd.c 116731e31b8aSbellard */ 116831e31b8aSbellard #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ 116931e31b8aSbellard #define TARGET_CDROMSEEK 0x5316 /* seek msf address */ 117031e31b8aSbellard 117131e31b8aSbellard /* 117231e31b8aSbellard * This ioctl is only used by the scsi-cd driver. 117331e31b8aSbellard It is for playing audio in logical block addressing mode. 117431e31b8aSbellard */ 117531e31b8aSbellard #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ 117631e31b8aSbellard 117731e31b8aSbellard /* 117831e31b8aSbellard * These ioctls are only used in optcd.c 117931e31b8aSbellard */ 118031e31b8aSbellard #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ 118131e31b8aSbellard 118231e31b8aSbellard /* 118331e31b8aSbellard * These ioctls are (now) only in ide-cd.c for controlling 118431e31b8aSbellard * drive spindown time. They should be implemented in the 118531e31b8aSbellard * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, 118631e31b8aSbellard * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... 118731e31b8aSbellard * -Erik 118831e31b8aSbellard */ 118931e31b8aSbellard #define TARGET_CDROMGETSPINDOWN 0x531d 119031e31b8aSbellard #define TARGET_CDROMSETSPINDOWN 0x531e 119131e31b8aSbellard 119231e31b8aSbellard /* 119331e31b8aSbellard * These ioctls are implemented through the uniform CD-ROM driver 119431e31b8aSbellard * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM 119531e31b8aSbellard * drivers are eventually ported to the uniform CD-ROM driver interface. 119631e31b8aSbellard */ 119731e31b8aSbellard #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ 119831e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ 119931e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ 120031e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ 120131e31b8aSbellard #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ 120231e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ 120331e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ 120431e31b8aSbellard #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ 120531e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ 120631e31b8aSbellard #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ 120731e31b8aSbellard #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ 120831e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ 120931e31b8aSbellard 121031e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. 121131e31b8aSbellard * Future CDROM ioctls should be kept below 0x537F 121231e31b8aSbellard */ 121331e31b8aSbellard 121431e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */ 121531e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ 121631e31b8aSbellard /* conflict with SCSI_IOCTL_GET_IDLUN */ 121731e31b8aSbellard 121831e31b8aSbellard /* DVD-ROM Specific ioctls */ 121931e31b8aSbellard #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ 122031e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ 122131e31b8aSbellard #define TARGET_DVD_AUTH 0x5392 /* Authentication */ 122231e31b8aSbellard 122331e31b8aSbellard #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ 122431e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ 122531e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ 122631e31b8aSbellard 122731e31b8aSbellard /* HD commands */ 122831e31b8aSbellard 122931e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ 123031e31b8aSbellard #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ 123131e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ 123231e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ 123331e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ 123431e31b8aSbellard #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ 123531e31b8aSbellard #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ 123631e31b8aSbellard #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ 12372521d698Sbellard #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ 123831e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ 123931e31b8aSbellard 124031e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ 124131e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ 124231e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ 124331e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ 124431e31b8aSbellard #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ 124531e31b8aSbellard #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ 124631e31b8aSbellard #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ 124731e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ 12482521d698Sbellard 1249b8005914Sbalrog /* loop ioctls */ 1250b8005914Sbalrog #define TARGET_LOOP_SET_FD 0x4C00 1251b8005914Sbalrog #define TARGET_LOOP_CLR_FD 0x4C01 1252b8005914Sbalrog #define TARGET_LOOP_SET_STATUS 0x4C02 1253b8005914Sbalrog #define TARGET_LOOP_GET_STATUS 0x4C03 1254b8005914Sbalrog #define TARGET_LOOP_SET_STATUS64 0x4C04 1255b8005914Sbalrog #define TARGET_LOOP_GET_STATUS64 0x4C05 1256b8005914Sbalrog #define TARGET_LOOP_CHANGE_FD 0x4C06 12572521d698Sbellard 1258884cdc48SPeter Maydell #define TARGET_LOOP_CTL_ADD 0x4C80 1259884cdc48SPeter Maydell #define TARGET_LOOP_CTL_REMOVE 0x4C81 1260884cdc48SPeter Maydell #define TARGET_LOOP_CTL_GET_FREE 0x4C82 1261884cdc48SPeter Maydell 1262f7680a55SUlrich Hecht /* fb ioctls */ 1263f7680a55SUlrich Hecht #define TARGET_FBIOGET_VSCREENINFO 0x4600 1264f7680a55SUlrich Hecht #define TARGET_FBIOPUT_VSCREENINFO 0x4601 1265f7680a55SUlrich Hecht #define TARGET_FBIOGET_FSCREENINFO 0x4602 126612b81b71SCédric VINCENT #define TARGET_FBIOGETCMAP 0x4604 126712b81b71SCédric VINCENT #define TARGET_FBIOPUTCMAP 0x4605 126812b81b71SCédric VINCENT #define TARGET_FBIOPAN_DISPLAY 0x4606 126912b81b71SCédric VINCENT #define TARGET_FBIOGET_CON2FBMAP 0x460F 127012b81b71SCédric VINCENT #define TARGET_FBIOPUT_CON2FBMAP 0x4610 1271f7680a55SUlrich Hecht 1272f7680a55SUlrich Hecht /* vt ioctls */ 1273f7680a55SUlrich Hecht #define TARGET_VT_OPENQRY 0x5600 1274f7680a55SUlrich Hecht #define TARGET_VT_GETSTATE 0x5603 1275f7680a55SUlrich Hecht #define TARGET_VT_ACTIVATE 0x5606 1276f7680a55SUlrich Hecht #define TARGET_VT_WAITACTIVE 0x5607 1277f7680a55SUlrich Hecht #define TARGET_VT_LOCKSWITCH 0x560b 1278f7680a55SUlrich Hecht #define TARGET_VT_UNLOCKSWITCH 0x560c 1279774750c0SCédric VINCENT #define TARGET_VT_GETMODE 0x5601 1280774750c0SCédric VINCENT #define TARGET_VT_SETMODE 0x5602 1281774750c0SCédric VINCENT #define TARGET_VT_RELDISP 0x5605 1282774750c0SCédric VINCENT #define TARGET_VT_DISALLOCATE 0x5608 1283f7680a55SUlrich Hecht 128456e904ecSAlexander Graf /* device mapper */ 128556e904ecSAlexander Graf #define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00) 128656e904ecSAlexander Graf #define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01) 128756e904ecSAlexander Graf #define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02) 128856e904ecSAlexander Graf #define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03) 128956e904ecSAlexander Graf #define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04) 129056e904ecSAlexander Graf #define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05) 129156e904ecSAlexander Graf #define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06) 129256e904ecSAlexander Graf #define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07) 129356e904ecSAlexander Graf #define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08) 129456e904ecSAlexander Graf #define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09) 129556e904ecSAlexander Graf #define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a) 129656e904ecSAlexander Graf #define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b) 129756e904ecSAlexander Graf #define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c) 129856e904ecSAlexander Graf #define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d) 129956e904ecSAlexander Graf #define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e) 130056e904ecSAlexander Graf #define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f) 130156e904ecSAlexander Graf 13022521d698Sbellard /* from asm/termbits.h */ 13032521d698Sbellard 13043bfd9da1Sbellard #define TARGET_NCC 8 13053bfd9da1Sbellard struct target_termio { 13063bfd9da1Sbellard unsigned short c_iflag; /* input mode flags */ 13073bfd9da1Sbellard unsigned short c_oflag; /* output mode flags */ 13083bfd9da1Sbellard unsigned short c_cflag; /* control mode flags */ 13093bfd9da1Sbellard unsigned short c_lflag; /* local mode flags */ 13102521d698Sbellard unsigned char c_line; /* line discipline */ 13113bfd9da1Sbellard unsigned char c_cc[TARGET_NCC]; /* control characters */ 13122521d698Sbellard }; 13132521d698Sbellard 13143bfd9da1Sbellard struct target_winsize { 13153bfd9da1Sbellard unsigned short ws_row; 13163bfd9da1Sbellard unsigned short ws_col; 13173bfd9da1Sbellard unsigned short ws_xpixel; 13183bfd9da1Sbellard unsigned short ws_ypixel; 13193bfd9da1Sbellard }; 13202521d698Sbellard 13213bfd9da1Sbellard #include "termbits.h" 13222521d698Sbellard 13239e0b74a4SPaul Brook #if defined(TARGET_MIPS) 13249e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x10 13259e0b74a4SPaul Brook #else 13269e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x08 13279e0b74a4SPaul Brook #endif 13289e0b74a4SPaul Brook 1329e44a3e79Saurel32 /* Common */ 13302521d698Sbellard #define TARGET_MAP_SHARED 0x01 /* Share changes */ 13312521d698Sbellard #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ 1332e65be6a7SHelge Deller #if defined(TARGET_HPPA) 1333e65be6a7SHelge Deller #define TARGET_MAP_TYPE 0x03 /* Mask for type of mapping */ 1334e65be6a7SHelge Deller #else 13352521d698Sbellard #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ 1336e65be6a7SHelge Deller #endif 1337e44a3e79Saurel32 1338e44a3e79Saurel32 /* Target specific */ 1339048f6b4dSbellard #if defined(TARGET_MIPS) 1340e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1341048f6b4dSbellard #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 1342048f6b4dSbellard #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 1343048f6b4dSbellard #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 1344048f6b4dSbellard #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 1345048f6b4dSbellard #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 1346048f6b4dSbellard #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 1347540635baSths #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 1348540635baSths #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1349541e1690SHelge Deller #define TARGET_MAP_STACK 0x40000 /* ignored */ 1350541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ 1351e44a3e79Saurel32 #elif defined(TARGET_PPC) 1352e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 13532521d698Sbellard #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 13542521d698Sbellard #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 13552521d698Sbellard #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 13562521d698Sbellard #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 13577ec93196Sj_mayer #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ 13587ec93196Sj_mayer #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ 1359e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1360e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1361541e1690SHelge Deller #define TARGET_MAP_STACK 0x20000 /* ignored */ 1362541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ 1363e44a3e79Saurel32 #elif defined(TARGET_ALPHA) 1364e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1365e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ 1366e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ 1367e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ 1368e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ 1369e44a3e79Saurel32 #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ 1370e44a3e79Saurel32 #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ 1371e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ 1372e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ 1373541e1690SHelge Deller #define TARGET_MAP_STACK 0x80000 /* ignored */ 1374541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x100000 /* create a huge page mapping */ 1375a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 1376a10d1e50SRichard Henderson #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1377a10d1e50SRichard Henderson #define TARGET_MAP_FIXED 0x04 /* Interpret addr exactly */ 1378a10d1e50SRichard Henderson #define TARGET_MAP_GROWSDOWN 0x08000 /* stack-like segment */ 1379a10d1e50SRichard Henderson #define TARGET_MAP_DENYWRITE 0x00800 /* ETXTBSY */ 1380a10d1e50SRichard Henderson #define TARGET_MAP_EXECUTABLE 0x01000 /* mark it as an executable */ 1381a10d1e50SRichard Henderson #define TARGET_MAP_LOCKED 0x02000 /* lock the mapping */ 1382a10d1e50SRichard Henderson #define TARGET_MAP_NORESERVE 0x04000 /* no check for reservations */ 1383a10d1e50SRichard Henderson #define TARGET_MAP_POPULATE 0x10000 /* pop (prefault) pagetables */ 1384a10d1e50SRichard Henderson #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1385541e1690SHelge Deller #define TARGET_MAP_STACK 0x40000 /* ignored */ 1386541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ 1387ba7651fbSMax Filippov #elif defined(TARGET_XTENSA) 1388ba7651fbSMax Filippov #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1389ba7651fbSMax Filippov #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 1390ba7651fbSMax Filippov #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 1391ba7651fbSMax Filippov #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 1392ba7651fbSMax Filippov #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 1393ba7651fbSMax Filippov #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 1394ba7651fbSMax Filippov #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 1395ba7651fbSMax Filippov #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 1396ba7651fbSMax Filippov #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1397ba7651fbSMax Filippov #define TARGET_MAP_STACK 0x40000 1398ba7651fbSMax Filippov #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ 13997ec93196Sj_mayer #else 1400e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1401e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 1402e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 1403e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 1404e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 14052521d698Sbellard #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ 14062521d698Sbellard #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ 1407540635baSths #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1408540635baSths #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1409541e1690SHelge Deller #define TARGET_MAP_STACK 0x20000 /* ignored */ 1410541e1690SHelge Deller #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ 1411906c1b8eSMike Frysinger #define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ 14127ec93196Sj_mayer #endif 14132521d698Sbellard 141409701199SAlexander Graf #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 141509701199SAlexander Graf || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 1416daa4374aSPeter Maydell || defined(TARGET_CRIS) 14172521d698Sbellard struct target_stat { 14182521d698Sbellard unsigned short st_dev; 14192521d698Sbellard unsigned short __pad1; 1420992f48a0Sblueswir1 abi_ulong st_ino; 14212521d698Sbellard unsigned short st_mode; 14222521d698Sbellard unsigned short st_nlink; 14232521d698Sbellard unsigned short st_uid; 14242521d698Sbellard unsigned short st_gid; 14252521d698Sbellard unsigned short st_rdev; 14262521d698Sbellard unsigned short __pad2; 1427992f48a0Sblueswir1 abi_ulong st_size; 1428992f48a0Sblueswir1 abi_ulong st_blksize; 1429992f48a0Sblueswir1 abi_ulong st_blocks; 1430992f48a0Sblueswir1 abi_ulong target_st_atime; 1431992f48a0Sblueswir1 abi_ulong __unused1; 1432992f48a0Sblueswir1 abi_ulong target_st_mtime; 1433992f48a0Sblueswir1 abi_ulong __unused2; 1434992f48a0Sblueswir1 abi_ulong target_st_ctime; 1435992f48a0Sblueswir1 abi_ulong __unused3; 1436992f48a0Sblueswir1 abi_ulong __unused4; 1437992f48a0Sblueswir1 abi_ulong __unused5; 14382521d698Sbellard }; 14392521d698Sbellard 14402521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely 14412521d698Sbellard * insane amounts of padding around dev_t's. 14422521d698Sbellard */ 144320d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 14442521d698Sbellard struct target_stat64 { 14452521d698Sbellard unsigned short st_dev; 14462521d698Sbellard unsigned char __pad0[10]; 14472521d698Sbellard 14482521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1449992f48a0Sblueswir1 abi_ulong __st_ino; 14502521d698Sbellard 14512521d698Sbellard unsigned int st_mode; 14522521d698Sbellard unsigned int st_nlink; 14532521d698Sbellard 1454992f48a0Sblueswir1 abi_ulong st_uid; 1455992f48a0Sblueswir1 abi_ulong st_gid; 14562521d698Sbellard 14572521d698Sbellard unsigned short st_rdev; 14582521d698Sbellard unsigned char __pad3[10]; 14592521d698Sbellard 14602521d698Sbellard long long st_size; 1461992f48a0Sblueswir1 abi_ulong st_blksize; 14622521d698Sbellard 1463992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1464992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 14652521d698Sbellard 1466992f48a0Sblueswir1 abi_ulong target_st_atime; 1467992f48a0Sblueswir1 abi_ulong __pad5; 14682521d698Sbellard 1469992f48a0Sblueswir1 abi_ulong target_st_mtime; 1470992f48a0Sblueswir1 abi_ulong __pad6; 14712521d698Sbellard 1472992f48a0Sblueswir1 abi_ulong target_st_ctime; 1473992f48a0Sblueswir1 abi_ulong __pad7; /* will be high 32 bits of ctime someday */ 14742521d698Sbellard 14752521d698Sbellard unsigned long long st_ino; 1476541dc0d4SStefan Weil } QEMU_PACKED; 14772521d698Sbellard 1478ce4defa0Spbrook #ifdef TARGET_ARM 147920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1480ce4defa0Spbrook struct target_eabi_stat64 { 1481ce4defa0Spbrook unsigned long long st_dev; 1482ce4defa0Spbrook unsigned int __pad1; 1483992f48a0Sblueswir1 abi_ulong __st_ino; 1484ce4defa0Spbrook unsigned int st_mode; 1485ce4defa0Spbrook unsigned int st_nlink; 1486ce4defa0Spbrook 1487992f48a0Sblueswir1 abi_ulong st_uid; 1488992f48a0Sblueswir1 abi_ulong st_gid; 1489ce4defa0Spbrook 1490ce4defa0Spbrook unsigned long long st_rdev; 1491ce4defa0Spbrook unsigned int __pad2[2]; 1492ce4defa0Spbrook 1493ce4defa0Spbrook long long st_size; 1494992f48a0Sblueswir1 abi_ulong st_blksize; 1495ce4defa0Spbrook unsigned int __pad3; 1496ce4defa0Spbrook unsigned long long st_blocks; 1497ce4defa0Spbrook 1498992f48a0Sblueswir1 abi_ulong target_st_atime; 1499992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1500ce4defa0Spbrook 1501992f48a0Sblueswir1 abi_ulong target_st_mtime; 1502992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1503ce4defa0Spbrook 1504992f48a0Sblueswir1 abi_ulong target_st_ctime; 1505992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1506ce4defa0Spbrook 1507ce4defa0Spbrook unsigned long long st_ino; 1508541dc0d4SStefan Weil } QEMU_PACKED; 1509ce4defa0Spbrook #endif 1510ce4defa0Spbrook 1511992f48a0Sblueswir1 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 15121b8dd648Sblueswir1 struct target_stat { 15131b8dd648Sblueswir1 unsigned int st_dev; 1514992f48a0Sblueswir1 abi_ulong st_ino; 15151b8dd648Sblueswir1 unsigned int st_mode; 15161b8dd648Sblueswir1 unsigned int st_nlink; 15171b8dd648Sblueswir1 unsigned int st_uid; 15181b8dd648Sblueswir1 unsigned int st_gid; 15191b8dd648Sblueswir1 unsigned int st_rdev; 1520992f48a0Sblueswir1 abi_long st_size; 1521992f48a0Sblueswir1 abi_long target_st_atime; 1522992f48a0Sblueswir1 abi_long target_st_mtime; 1523992f48a0Sblueswir1 abi_long target_st_ctime; 1524992f48a0Sblueswir1 abi_long st_blksize; 1525992f48a0Sblueswir1 abi_long st_blocks; 1526992f48a0Sblueswir1 abi_ulong __unused4[2]; 15271b8dd648Sblueswir1 }; 15281b8dd648Sblueswir1 152920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 15301b8dd648Sblueswir1 struct target_stat64 { 15311b8dd648Sblueswir1 unsigned char __pad0[6]; 15321b8dd648Sblueswir1 unsigned short st_dev; 15331b8dd648Sblueswir1 15341b8dd648Sblueswir1 uint64_t st_ino; 15351b8dd648Sblueswir1 uint64_t st_nlink; 15361b8dd648Sblueswir1 15371b8dd648Sblueswir1 unsigned int st_mode; 15381b8dd648Sblueswir1 15391b8dd648Sblueswir1 unsigned int st_uid; 15401b8dd648Sblueswir1 unsigned int st_gid; 15411b8dd648Sblueswir1 15421b8dd648Sblueswir1 unsigned char __pad2[6]; 15431b8dd648Sblueswir1 unsigned short st_rdev; 15441b8dd648Sblueswir1 15451b8dd648Sblueswir1 int64_t st_size; 15461b8dd648Sblueswir1 int64_t st_blksize; 15471b8dd648Sblueswir1 15481b8dd648Sblueswir1 unsigned char __pad4[4]; 15491b8dd648Sblueswir1 unsigned int st_blocks; 15501b8dd648Sblueswir1 1551992f48a0Sblueswir1 abi_ulong target_st_atime; 1552992f48a0Sblueswir1 abi_ulong __unused1; 15531b8dd648Sblueswir1 1554992f48a0Sblueswir1 abi_ulong target_st_mtime; 1555992f48a0Sblueswir1 abi_ulong __unused2; 15561b8dd648Sblueswir1 1557992f48a0Sblueswir1 abi_ulong target_st_ctime; 1558992f48a0Sblueswir1 abi_ulong __unused3; 15591b8dd648Sblueswir1 1560992f48a0Sblueswir1 abi_ulong __unused4[3]; 15611b8dd648Sblueswir1 }; 15621b8dd648Sblueswir1 15633bfd9da1Sbellard #elif defined(TARGET_SPARC) 15643bfd9da1Sbellard 15653bfd9da1Sbellard struct target_stat { 15663bfd9da1Sbellard unsigned short st_dev; 1567992f48a0Sblueswir1 abi_ulong st_ino; 15683bfd9da1Sbellard unsigned short st_mode; 15693bfd9da1Sbellard short st_nlink; 15703bfd9da1Sbellard unsigned short st_uid; 15713bfd9da1Sbellard unsigned short st_gid; 15723bfd9da1Sbellard unsigned short st_rdev; 1573992f48a0Sblueswir1 abi_long st_size; 1574992f48a0Sblueswir1 abi_long target_st_atime; 1575992f48a0Sblueswir1 abi_ulong __unused1; 1576992f48a0Sblueswir1 abi_long target_st_mtime; 1577992f48a0Sblueswir1 abi_ulong __unused2; 1578992f48a0Sblueswir1 abi_long target_st_ctime; 1579992f48a0Sblueswir1 abi_ulong __unused3; 1580992f48a0Sblueswir1 abi_long st_blksize; 1581992f48a0Sblueswir1 abi_long st_blocks; 1582992f48a0Sblueswir1 abi_ulong __unused4[2]; 15833bfd9da1Sbellard }; 15843bfd9da1Sbellard 158520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 15863bfd9da1Sbellard struct target_stat64 { 15873bfd9da1Sbellard unsigned char __pad0[6]; 15883bfd9da1Sbellard unsigned short st_dev; 15893bfd9da1Sbellard 15903bfd9da1Sbellard uint64_t st_ino; 15913bfd9da1Sbellard 15923bfd9da1Sbellard unsigned int st_mode; 15933bfd9da1Sbellard unsigned int st_nlink; 15943bfd9da1Sbellard 15953bfd9da1Sbellard unsigned int st_uid; 15963bfd9da1Sbellard unsigned int st_gid; 15973bfd9da1Sbellard 15983bfd9da1Sbellard unsigned char __pad2[6]; 15993bfd9da1Sbellard unsigned short st_rdev; 16003bfd9da1Sbellard 16013bfd9da1Sbellard unsigned char __pad3[8]; 16023bfd9da1Sbellard 16033bfd9da1Sbellard int64_t st_size; 16043bfd9da1Sbellard unsigned int st_blksize; 16053bfd9da1Sbellard 16063bfd9da1Sbellard unsigned char __pad4[8]; 16073bfd9da1Sbellard unsigned int st_blocks; 16083bfd9da1Sbellard 16093bfd9da1Sbellard unsigned int target_st_atime; 16103bfd9da1Sbellard unsigned int __unused1; 16113bfd9da1Sbellard 16123bfd9da1Sbellard unsigned int target_st_mtime; 16133bfd9da1Sbellard unsigned int __unused2; 16143bfd9da1Sbellard 16153bfd9da1Sbellard unsigned int target_st_ctime; 16163bfd9da1Sbellard unsigned int __unused3; 16173bfd9da1Sbellard 16183bfd9da1Sbellard unsigned int __unused4; 16193bfd9da1Sbellard unsigned int __unused5; 16203bfd9da1Sbellard }; 16213bfd9da1Sbellard 162267867308Sbellard #elif defined(TARGET_PPC) 162367867308Sbellard 162467867308Sbellard struct target_stat { 1625e32448e0Sj_mayer abi_ulong st_dev; 1626992f48a0Sblueswir1 abi_ulong st_ino; 1627325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1628e32448e0Sj_mayer abi_ulong st_nlink; 1629325e651fSj_mayer unsigned int st_mode; 1630325e651fSj_mayer #else 163167867308Sbellard unsigned int st_mode; 163267867308Sbellard unsigned short st_nlink; 1633325e651fSj_mayer #endif 163467867308Sbellard unsigned int st_uid; 163567867308Sbellard unsigned int st_gid; 1636e32448e0Sj_mayer abi_ulong st_rdev; 1637992f48a0Sblueswir1 abi_ulong st_size; 1638992f48a0Sblueswir1 abi_ulong st_blksize; 1639992f48a0Sblueswir1 abi_ulong st_blocks; 1640992f48a0Sblueswir1 abi_ulong target_st_atime; 1641e32448e0Sj_mayer abi_ulong target_st_atime_nsec; 1642992f48a0Sblueswir1 abi_ulong target_st_mtime; 1643e32448e0Sj_mayer abi_ulong target_st_mtime_nsec; 1644992f48a0Sblueswir1 abi_ulong target_st_ctime; 1645e32448e0Sj_mayer abi_ulong target_st_ctime_nsec; 1646992f48a0Sblueswir1 abi_ulong __unused4; 1647992f48a0Sblueswir1 abi_ulong __unused5; 1648325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1649325e651fSj_mayer abi_ulong __unused6; 1650325e651fSj_mayer #endif 165167867308Sbellard }; 165267867308Sbellard 165320d155bcSStefan Weil #if !defined(TARGET_PPC64) || defined(TARGET_ABI32) 165420d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1655541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 165667867308Sbellard unsigned long long st_dev; 165767867308Sbellard unsigned long long st_ino; 165867867308Sbellard unsigned int st_mode; 165967867308Sbellard unsigned int st_nlink; 166067867308Sbellard unsigned int st_uid; 166167867308Sbellard unsigned int st_gid; 166267867308Sbellard unsigned long long st_rdev; 1663e1ce5e40Saurel32 unsigned long long __pad0; 166467867308Sbellard long long st_size; 1665e32448e0Sj_mayer int st_blksize; 1666e1ce5e40Saurel32 unsigned int __pad1; 166761322e91SMax Filippov long long st_blocks; /* Number 512-byte blocks allocated. */ 1668e32448e0Sj_mayer int target_st_atime; 1669e32448e0Sj_mayer unsigned int target_st_atime_nsec; 1670e32448e0Sj_mayer int target_st_mtime; 1671e32448e0Sj_mayer unsigned int target_st_mtime_nsec; 1672e32448e0Sj_mayer int target_st_ctime; 1673e32448e0Sj_mayer unsigned int target_st_ctime_nsec; 1674e32448e0Sj_mayer unsigned int __unused4; 1675e32448e0Sj_mayer unsigned int __unused5; 167667867308Sbellard }; 167720d155bcSStefan Weil #endif 167867867308Sbellard 1679b779e29eSEdgar E. Iglesias #elif defined(TARGET_MICROBLAZE) 1680b779e29eSEdgar E. Iglesias 1681b779e29eSEdgar E. Iglesias struct target_stat { 1682b779e29eSEdgar E. Iglesias abi_ulong st_dev; 1683b779e29eSEdgar E. Iglesias abi_ulong st_ino; 1684b779e29eSEdgar E. Iglesias unsigned int st_mode; 1685b779e29eSEdgar E. Iglesias unsigned short st_nlink; 1686b779e29eSEdgar E. Iglesias unsigned int st_uid; 1687b779e29eSEdgar E. Iglesias unsigned int st_gid; 1688b779e29eSEdgar E. Iglesias abi_ulong st_rdev; 1689b779e29eSEdgar E. Iglesias abi_ulong st_size; 1690b779e29eSEdgar E. Iglesias abi_ulong st_blksize; 1691b779e29eSEdgar E. Iglesias abi_ulong st_blocks; 1692b779e29eSEdgar E. Iglesias abi_ulong target_st_atime; 1693b779e29eSEdgar E. Iglesias abi_ulong target_st_atime_nsec; 1694b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime; 1695b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime_nsec; 1696b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime; 1697b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime_nsec; 1698b779e29eSEdgar E. Iglesias abi_ulong __unused4; 1699b779e29eSEdgar E. Iglesias abi_ulong __unused5; 1700b779e29eSEdgar E. Iglesias }; 1701b779e29eSEdgar E. Iglesias 1702b779e29eSEdgar E. Iglesias /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ 170320d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1704541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 1705b779e29eSEdgar E. Iglesias uint64_t st_dev; 1706a523eb06SEdgar E. Iglesias #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1707a523eb06SEdgar E. Iglesias uint32_t pad0; 1708a523eb06SEdgar E. Iglesias uint32_t __st_ino; 1709a523eb06SEdgar E. Iglesias 1710b779e29eSEdgar E. Iglesias uint32_t st_mode; 1711b779e29eSEdgar E. Iglesias uint32_t st_nlink; 1712b779e29eSEdgar E. Iglesias uint32_t st_uid; 1713b779e29eSEdgar E. Iglesias uint32_t st_gid; 1714b779e29eSEdgar E. Iglesias uint64_t st_rdev; 171521ebeb23SEdgar E. Iglesias uint64_t __pad1; 1716b779e29eSEdgar E. Iglesias 1717b779e29eSEdgar E. Iglesias int64_t st_size; 1718b779e29eSEdgar E. Iglesias int32_t st_blksize; 171921ebeb23SEdgar E. Iglesias uint32_t __pad2; 1720b779e29eSEdgar E. Iglesias int64_t st_blocks; /* Number 512-byte blocks allocated. */ 1721b779e29eSEdgar E. Iglesias 1722b779e29eSEdgar E. Iglesias int target_st_atime; 1723b779e29eSEdgar E. Iglesias unsigned int target_st_atime_nsec; 1724b779e29eSEdgar E. Iglesias int target_st_mtime; 1725b779e29eSEdgar E. Iglesias unsigned int target_st_mtime_nsec; 1726b779e29eSEdgar E. Iglesias int target_st_ctime; 1727b779e29eSEdgar E. Iglesias unsigned int target_st_ctime_nsec; 1728a523eb06SEdgar E. Iglesias uint64_t st_ino; 1729b779e29eSEdgar E. Iglesias }; 1730b779e29eSEdgar E. Iglesias 1731e6e5906bSpbrook #elif defined(TARGET_M68K) 1732e6e5906bSpbrook 1733e6e5906bSpbrook struct target_stat { 1734e6e5906bSpbrook unsigned short st_dev; 1735e6e5906bSpbrook unsigned short __pad1; 1736992f48a0Sblueswir1 abi_ulong st_ino; 1737e6e5906bSpbrook unsigned short st_mode; 1738e6e5906bSpbrook unsigned short st_nlink; 1739e6e5906bSpbrook unsigned short st_uid; 1740e6e5906bSpbrook unsigned short st_gid; 1741e6e5906bSpbrook unsigned short st_rdev; 1742e6e5906bSpbrook unsigned short __pad2; 1743992f48a0Sblueswir1 abi_ulong st_size; 1744992f48a0Sblueswir1 abi_ulong st_blksize; 1745992f48a0Sblueswir1 abi_ulong st_blocks; 1746992f48a0Sblueswir1 abi_ulong target_st_atime; 1747992f48a0Sblueswir1 abi_ulong __unused1; 1748992f48a0Sblueswir1 abi_ulong target_st_mtime; 1749992f48a0Sblueswir1 abi_ulong __unused2; 1750992f48a0Sblueswir1 abi_ulong target_st_ctime; 1751992f48a0Sblueswir1 abi_ulong __unused3; 1752992f48a0Sblueswir1 abi_ulong __unused4; 1753992f48a0Sblueswir1 abi_ulong __unused5; 1754e6e5906bSpbrook }; 1755e6e5906bSpbrook 1756e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely 1757e6e5906bSpbrook * insane amounts of padding around dev_t's. 1758e6e5906bSpbrook */ 175920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1760e6e5906bSpbrook struct target_stat64 { 1761e6e5906bSpbrook unsigned long long st_dev; 1762e6e5906bSpbrook unsigned char __pad1[2]; 1763e6e5906bSpbrook 1764e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1765992f48a0Sblueswir1 abi_ulong __st_ino; 1766e6e5906bSpbrook 1767e6e5906bSpbrook unsigned int st_mode; 1768e6e5906bSpbrook unsigned int st_nlink; 1769e6e5906bSpbrook 1770992f48a0Sblueswir1 abi_ulong st_uid; 1771992f48a0Sblueswir1 abi_ulong st_gid; 1772e6e5906bSpbrook 1773e6e5906bSpbrook unsigned long long st_rdev; 1774e6e5906bSpbrook unsigned char __pad3[2]; 1775e6e5906bSpbrook 1776e6e5906bSpbrook long long st_size; 1777992f48a0Sblueswir1 abi_ulong st_blksize; 1778e6e5906bSpbrook 1779992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 1780992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1781e6e5906bSpbrook 1782992f48a0Sblueswir1 abi_ulong target_st_atime; 1783992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1784e6e5906bSpbrook 1785992f48a0Sblueswir1 abi_ulong target_st_mtime; 1786992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1787e6e5906bSpbrook 1788992f48a0Sblueswir1 abi_ulong target_st_ctime; 1789992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1790e6e5906bSpbrook 1791e6e5906bSpbrook unsigned long long st_ino; 1792541dc0d4SStefan Weil } QEMU_PACKED; 1793e6e5906bSpbrook 1794d26bc211Sths #elif defined(TARGET_ABI_MIPSN64) 1795540635baSths 1796540635baSths /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ 1797540635baSths struct target_stat { 1798540635baSths unsigned int st_dev; 1799540635baSths unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ 1800540635baSths 1801992f48a0Sblueswir1 abi_ulong st_ino; 1802540635baSths 1803540635baSths unsigned int st_mode; 1804540635baSths unsigned int st_nlink; 1805540635baSths 1806540635baSths int st_uid; 1807540635baSths int st_gid; 1808540635baSths 1809540635baSths unsigned int st_rdev; 1810540635baSths unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ 1811540635baSths 1812992f48a0Sblueswir1 abi_ulong st_size; 1813540635baSths 1814540635baSths /* 1815540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1816540635baSths * but we don't have it under Linux. 1817540635baSths */ 1818540635baSths unsigned int target_st_atime; 1819540635baSths unsigned int target_st_atime_nsec; 1820540635baSths 1821540635baSths unsigned int target_st_mtime; 1822540635baSths unsigned int target_st_mtime_nsec; 1823540635baSths 1824540635baSths unsigned int target_st_ctime; 1825540635baSths unsigned int target_st_ctime_nsec; 1826540635baSths 1827540635baSths unsigned int st_blksize; 1828540635baSths unsigned int st_pad2; 1829540635baSths 1830992f48a0Sblueswir1 abi_ulong st_blocks; 1831540635baSths }; 1832540635baSths 1833d26bc211Sths #elif defined(TARGET_ABI_MIPSN32) 1834540635baSths 1835540635baSths struct target_stat { 18361ab2aea2SLeon Alrae abi_ulong st_dev; 18371ab2aea2SLeon Alrae abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 18381ab2aea2SLeon Alrae uint64_t st_ino; 1839540635baSths unsigned int st_mode; 1840540635baSths unsigned int st_nlink; 1841540635baSths int st_uid; 1842540635baSths int st_gid; 18431ab2aea2SLeon Alrae abi_ulong st_rdev; 18441ab2aea2SLeon Alrae abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 18451ab2aea2SLeon Alrae int64_t st_size; 18461ab2aea2SLeon Alrae abi_long target_st_atime; 18471ab2aea2SLeon Alrae abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 18481ab2aea2SLeon Alrae abi_long target_st_mtime; 18491ab2aea2SLeon Alrae abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 18501ab2aea2SLeon Alrae abi_long target_st_ctime; 18511ab2aea2SLeon Alrae abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 18521ab2aea2SLeon Alrae abi_ulong st_blksize; 18531ab2aea2SLeon Alrae abi_ulong st_pad2; 18541ab2aea2SLeon Alrae int64_t st_blocks; 1855540635baSths }; 1856540635baSths 1857d26bc211Sths #elif defined(TARGET_ABI_MIPSO32) 1858048f6b4dSbellard 1859048f6b4dSbellard struct target_stat { 1860048f6b4dSbellard unsigned st_dev; 1861992f48a0Sblueswir1 abi_long st_pad1[3]; /* Reserved for network id */ 1862992f48a0Sblueswir1 abi_ulong st_ino; 1863048f6b4dSbellard unsigned int st_mode; 1864048f6b4dSbellard unsigned int st_nlink; 1865048f6b4dSbellard int st_uid; 1866048f6b4dSbellard int st_gid; 1867048f6b4dSbellard unsigned st_rdev; 1868992f48a0Sblueswir1 abi_long st_pad2[2]; 1869992f48a0Sblueswir1 abi_long st_size; 1870992f48a0Sblueswir1 abi_long st_pad3; 1871048f6b4dSbellard /* 1872048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1873048f6b4dSbellard * but we don't have it under Linux. 1874048f6b4dSbellard */ 1875992f48a0Sblueswir1 abi_long target_st_atime; 1876992f48a0Sblueswir1 abi_long target_st_atime_nsec; 1877992f48a0Sblueswir1 abi_long target_st_mtime; 1878992f48a0Sblueswir1 abi_long target_st_mtime_nsec; 1879992f48a0Sblueswir1 abi_long target_st_ctime; 1880992f48a0Sblueswir1 abi_long target_st_ctime_nsec; 1881992f48a0Sblueswir1 abi_long st_blksize; 1882992f48a0Sblueswir1 abi_long st_blocks; 1883992f48a0Sblueswir1 abi_long st_pad4[14]; 1884048f6b4dSbellard }; 1885048f6b4dSbellard 1886048f6b4dSbellard /* 1887048f6b4dSbellard * This matches struct stat64 in glibc2.1, hence the absolutely insane 1888048f6b4dSbellard * amounts of padding around dev_t's. The memory layout is the same as of 1889048f6b4dSbellard * struct stat of the 64-bit kernel. 1890048f6b4dSbellard */ 1891048f6b4dSbellard 189220d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1893048f6b4dSbellard struct target_stat64 { 1894992f48a0Sblueswir1 abi_ulong st_dev; 1895992f48a0Sblueswir1 abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 1896048f6b4dSbellard 1897048f6b4dSbellard uint64_t st_ino; 1898048f6b4dSbellard 1899048f6b4dSbellard unsigned int st_mode; 1900048f6b4dSbellard unsigned int st_nlink; 1901048f6b4dSbellard 1902048f6b4dSbellard int st_uid; 1903048f6b4dSbellard int st_gid; 1904048f6b4dSbellard 1905992f48a0Sblueswir1 abi_ulong st_rdev; 1906992f48a0Sblueswir1 abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 1907048f6b4dSbellard 1908048f6b4dSbellard int64_t st_size; 1909048f6b4dSbellard 1910048f6b4dSbellard /* 1911048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1912048f6b4dSbellard * but we don't have it under Linux. 1913048f6b4dSbellard */ 1914992f48a0Sblueswir1 abi_long target_st_atime; 1915992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 1916048f6b4dSbellard 1917992f48a0Sblueswir1 abi_long target_st_mtime; 1918992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 1919048f6b4dSbellard 1920992f48a0Sblueswir1 abi_long target_st_ctime; 1921992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 1922048f6b4dSbellard 1923992f48a0Sblueswir1 abi_ulong st_blksize; 1924992f48a0Sblueswir1 abi_ulong st_pad2; 1925048f6b4dSbellard 1926048f6b4dSbellard int64_t st_blocks; 1927048f6b4dSbellard }; 19287a3148a9Sj_mayer 19297a3148a9Sj_mayer #elif defined(TARGET_ALPHA) 19307a3148a9Sj_mayer 19317a3148a9Sj_mayer struct target_stat { 19327a3148a9Sj_mayer unsigned int st_dev; 19337a3148a9Sj_mayer unsigned int st_ino; 19347a3148a9Sj_mayer unsigned int st_mode; 19357a3148a9Sj_mayer unsigned int st_nlink; 19367a3148a9Sj_mayer unsigned int st_uid; 19377a3148a9Sj_mayer unsigned int st_gid; 19387a3148a9Sj_mayer unsigned int st_rdev; 1939992f48a0Sblueswir1 abi_long st_size; 1940992f48a0Sblueswir1 abi_ulong target_st_atime; 1941992f48a0Sblueswir1 abi_ulong target_st_mtime; 1942992f48a0Sblueswir1 abi_ulong target_st_ctime; 19437a3148a9Sj_mayer unsigned int st_blksize; 19447a3148a9Sj_mayer unsigned int st_blocks; 19457a3148a9Sj_mayer unsigned int st_flags; 19467a3148a9Sj_mayer unsigned int st_gen; 19477a3148a9Sj_mayer }; 19487a3148a9Sj_mayer 194920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 19507a3148a9Sj_mayer struct target_stat64 { 1951992f48a0Sblueswir1 abi_ulong st_dev; 1952992f48a0Sblueswir1 abi_ulong st_ino; 1953992f48a0Sblueswir1 abi_ulong st_rdev; 1954992f48a0Sblueswir1 abi_long st_size; 1955992f48a0Sblueswir1 abi_ulong st_blocks; 19567a3148a9Sj_mayer 19577a3148a9Sj_mayer unsigned int st_mode; 19587a3148a9Sj_mayer unsigned int st_uid; 19597a3148a9Sj_mayer unsigned int st_gid; 19607a3148a9Sj_mayer unsigned int st_blksize; 19617a3148a9Sj_mayer unsigned int st_nlink; 19627a3148a9Sj_mayer unsigned int __pad0; 19637a3148a9Sj_mayer 1964992f48a0Sblueswir1 abi_ulong target_st_atime; 1965992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1966992f48a0Sblueswir1 abi_ulong target_st_mtime; 1967992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1968992f48a0Sblueswir1 abi_ulong target_st_ctime; 1969992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1970992f48a0Sblueswir1 abi_long __unused[3]; 19717a3148a9Sj_mayer }; 19727a3148a9Sj_mayer 19736db45e65Sths #elif defined(TARGET_SH4) 19746db45e65Sths 19756db45e65Sths struct target_stat { 1976992f48a0Sblueswir1 abi_ulong st_dev; 1977992f48a0Sblueswir1 abi_ulong st_ino; 19786db45e65Sths unsigned short st_mode; 19796db45e65Sths unsigned short st_nlink; 19806db45e65Sths unsigned short st_uid; 19816db45e65Sths unsigned short st_gid; 1982992f48a0Sblueswir1 abi_ulong st_rdev; 1983992f48a0Sblueswir1 abi_ulong st_size; 1984992f48a0Sblueswir1 abi_ulong st_blksize; 1985992f48a0Sblueswir1 abi_ulong st_blocks; 1986992f48a0Sblueswir1 abi_ulong target_st_atime; 1987992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1988992f48a0Sblueswir1 abi_ulong target_st_mtime; 1989992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1990992f48a0Sblueswir1 abi_ulong target_st_ctime; 1991992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1992992f48a0Sblueswir1 abi_ulong __unused4; 1993992f48a0Sblueswir1 abi_ulong __unused5; 19946db45e65Sths }; 19956db45e65Sths 19966db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely 19976db45e65Sths * insane amounts of padding around dev_t's. 19986db45e65Sths */ 199920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 2000541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 20016db45e65Sths unsigned long long st_dev; 20026db45e65Sths unsigned char __pad0[4]; 20036db45e65Sths 20046db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 2005992f48a0Sblueswir1 abi_ulong __st_ino; 20066db45e65Sths 20076db45e65Sths unsigned int st_mode; 20086db45e65Sths unsigned int st_nlink; 20096db45e65Sths 2010992f48a0Sblueswir1 abi_ulong st_uid; 2011992f48a0Sblueswir1 abi_ulong st_gid; 20126db45e65Sths 20136db45e65Sths unsigned long long st_rdev; 20146db45e65Sths unsigned char __pad3[4]; 20156db45e65Sths 20166db45e65Sths long long st_size; 2017992f48a0Sblueswir1 abi_ulong st_blksize; 20186db45e65Sths 20196db45e65Sths unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ 20206db45e65Sths 2021992f48a0Sblueswir1 abi_ulong target_st_atime; 2022992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 20236db45e65Sths 2024992f48a0Sblueswir1 abi_ulong target_st_mtime; 2025992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 20266db45e65Sths 2027992f48a0Sblueswir1 abi_ulong target_st_ctime; 2028992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 20296db45e65Sths 20306db45e65Sths unsigned long long st_ino; 20316db45e65Sths }; 20326db45e65Sths 2033d2fd1af7Sbellard #elif defined(TARGET_I386) && !defined(TARGET_ABI32) 2034d2fd1af7Sbellard struct target_stat { 2035d2fd1af7Sbellard abi_ulong st_dev; 2036d2fd1af7Sbellard abi_ulong st_ino; 2037d2fd1af7Sbellard abi_ulong st_nlink; 2038d2fd1af7Sbellard 2039d2fd1af7Sbellard unsigned int st_mode; 2040d2fd1af7Sbellard unsigned int st_uid; 2041d2fd1af7Sbellard unsigned int st_gid; 2042d2fd1af7Sbellard unsigned int __pad0; 2043d2fd1af7Sbellard abi_ulong st_rdev; 2044d2fd1af7Sbellard abi_long st_size; 2045d2fd1af7Sbellard abi_long st_blksize; 2046d2fd1af7Sbellard abi_long st_blocks; /* Number 512-byte blocks allocated. */ 2047d2fd1af7Sbellard 2048d2fd1af7Sbellard abi_ulong target_st_atime; 2049d2fd1af7Sbellard abi_ulong target_st_atime_nsec; 2050d2fd1af7Sbellard abi_ulong target_st_mtime; 2051d2fd1af7Sbellard abi_ulong target_st_mtime_nsec; 2052d2fd1af7Sbellard abi_ulong target_st_ctime; 2053d2fd1af7Sbellard abi_ulong target_st_ctime_nsec; 2054d2fd1af7Sbellard 2055d2fd1af7Sbellard abi_long __unused[3]; 2056d2fd1af7Sbellard }; 2057a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 2058a4c075f1SUlrich Hecht struct target_stat { 2059a4c075f1SUlrich Hecht abi_ulong st_dev; 2060a4c075f1SUlrich Hecht abi_ulong st_ino; 2061a4c075f1SUlrich Hecht abi_ulong st_nlink; 2062a4c075f1SUlrich Hecht unsigned int st_mode; 2063a4c075f1SUlrich Hecht unsigned int st_uid; 2064a4c075f1SUlrich Hecht unsigned int st_gid; 2065a4c075f1SUlrich Hecht unsigned int __pad1; 2066a4c075f1SUlrich Hecht abi_ulong st_rdev; 2067a4c075f1SUlrich Hecht abi_ulong st_size; 2068a4c075f1SUlrich Hecht abi_ulong target_st_atime; 2069a4c075f1SUlrich Hecht abi_ulong target_st_atime_nsec; 2070a4c075f1SUlrich Hecht abi_ulong target_st_mtime; 2071a4c075f1SUlrich Hecht abi_ulong target_st_mtime_nsec; 2072a4c075f1SUlrich Hecht abi_ulong target_st_ctime; 2073a4c075f1SUlrich Hecht abi_ulong target_st_ctime_nsec; 2074a4c075f1SUlrich Hecht abi_ulong st_blksize; 2075a4c075f1SUlrich Hecht abi_long st_blocks; 2076a4c075f1SUlrich Hecht abi_ulong __unused[3]; 2077a4c075f1SUlrich Hecht }; 207809701199SAlexander Graf #elif defined(TARGET_AARCH64) 207909701199SAlexander Graf struct target_stat { 208009701199SAlexander Graf abi_ulong st_dev; 208109701199SAlexander Graf abi_ulong st_ino; 208209701199SAlexander Graf unsigned int st_mode; 208309701199SAlexander Graf unsigned int st_nlink; 208409701199SAlexander Graf unsigned int st_uid; 208509701199SAlexander Graf unsigned int st_gid; 208609701199SAlexander Graf abi_ulong st_rdev; 208709701199SAlexander Graf abi_ulong _pad1; 208809701199SAlexander Graf abi_long st_size; 208909701199SAlexander Graf int st_blksize; 209009701199SAlexander Graf int __pad2; 209109701199SAlexander Graf abi_long st_blocks; 209209701199SAlexander Graf abi_long target_st_atime; 209309701199SAlexander Graf abi_ulong target_st_atime_nsec; 209409701199SAlexander Graf abi_long target_st_mtime; 209509701199SAlexander Graf abi_ulong target_st_mtime_nsec; 209609701199SAlexander Graf abi_long target_st_ctime; 209709701199SAlexander Graf abi_ulong target_st_ctime_nsec; 209809701199SAlexander Graf unsigned int __unused[2]; 209909701199SAlexander Graf }; 2100ba7651fbSMax Filippov #elif defined(TARGET_XTENSA) 2101ba7651fbSMax Filippov struct target_stat { 2102ba7651fbSMax Filippov abi_ulong st_dev; 2103ba7651fbSMax Filippov abi_ulong st_ino; 2104ba7651fbSMax Filippov unsigned int st_mode; 2105ba7651fbSMax Filippov unsigned int st_nlink; 2106ba7651fbSMax Filippov unsigned int st_uid; 2107ba7651fbSMax Filippov unsigned int st_gid; 2108ba7651fbSMax Filippov abi_ulong st_rdev; 2109ba7651fbSMax Filippov abi_long st_size; 2110ba7651fbSMax Filippov abi_ulong st_blksize; 2111ba7651fbSMax Filippov abi_ulong st_blocks; 2112ba7651fbSMax Filippov abi_ulong target_st_atime; 2113ba7651fbSMax Filippov abi_ulong target_st_atime_nsec; 2114ba7651fbSMax Filippov abi_ulong target_st_mtime; 2115ba7651fbSMax Filippov abi_ulong target_st_mtime_nsec; 2116ba7651fbSMax Filippov abi_ulong target_st_ctime; 2117ba7651fbSMax Filippov abi_ulong target_st_ctime_nsec; 2118ba7651fbSMax Filippov abi_ulong __unused4; 2119ba7651fbSMax Filippov abi_ulong __unused5; 2120ba7651fbSMax Filippov }; 2121ba7651fbSMax Filippov 2122ba7651fbSMax Filippov #define TARGET_HAS_STRUCT_STAT64 2123ba7651fbSMax Filippov struct target_stat64 { 2124ba7651fbSMax Filippov uint64_t st_dev; /* Device */ 2125ba7651fbSMax Filippov uint64_t st_ino; /* File serial number */ 2126ba7651fbSMax Filippov unsigned int st_mode; /* File mode. */ 2127ba7651fbSMax Filippov unsigned int st_nlink; /* Link count. */ 2128ba7651fbSMax Filippov unsigned int st_uid; /* User ID of the file's owner. */ 2129ba7651fbSMax Filippov unsigned int st_gid; /* Group ID of the file's group. */ 2130ba7651fbSMax Filippov uint64_t st_rdev; /* Device number, if device. */ 2131ba7651fbSMax Filippov int64_t st_size; /* Size of file, in bytes. */ 2132ba7651fbSMax Filippov abi_ulong st_blksize; /* Optimal block size for I/O. */ 2133ba7651fbSMax Filippov abi_ulong __unused2; 2134ba7651fbSMax Filippov uint64_t st_blocks; /* Number 512-byte blocks allocated. */ 2135ba7651fbSMax Filippov abi_ulong target_st_atime; /* Time of last access. */ 2136ba7651fbSMax Filippov abi_ulong target_st_atime_nsec; 2137ba7651fbSMax Filippov abi_ulong target_st_mtime; /* Time of last modification. */ 2138ba7651fbSMax Filippov abi_ulong target_st_mtime_nsec; 2139ba7651fbSMax Filippov abi_ulong target_st_ctime; /* Time of last status change. */ 2140ba7651fbSMax Filippov abi_ulong target_st_ctime_nsec; 2141ba7651fbSMax Filippov abi_ulong __unused4; 2142ba7651fbSMax Filippov abi_ulong __unused5; 2143ba7651fbSMax Filippov }; 2144ba7651fbSMax Filippov 2145a0a839b6SMarek Vasut #elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) || \ 214647ae93cdSMichael Clark defined(TARGET_NIOS2) || defined(TARGET_RISCV) 2147c7819dfbSPeter Maydell 2148c7819dfbSPeter Maydell /* These are the asm-generic versions of the stat and stat64 structures */ 2149c7819dfbSPeter Maydell 2150d962783eSJia Liu struct target_stat { 2151d962783eSJia Liu abi_ulong st_dev; 2152d962783eSJia Liu abi_ulong st_ino; 2153d962783eSJia Liu unsigned int st_mode; 2154c7819dfbSPeter Maydell unsigned int st_nlink; 2155d962783eSJia Liu unsigned int st_uid; 2156d962783eSJia Liu unsigned int st_gid; 2157d962783eSJia Liu abi_ulong st_rdev; 2158c7819dfbSPeter Maydell abi_ulong __pad1; 2159d962783eSJia Liu abi_long st_size; 2160c7819dfbSPeter Maydell int st_blksize; 2161c7819dfbSPeter Maydell int __pad2; 2162c7819dfbSPeter Maydell abi_long st_blocks; 2163c7819dfbSPeter Maydell abi_long target_st_atime; 2164d962783eSJia Liu abi_ulong target_st_atime_nsec; 2165c7819dfbSPeter Maydell abi_long target_st_mtime; 2166d962783eSJia Liu abi_ulong target_st_mtime_nsec; 2167c7819dfbSPeter Maydell abi_long target_st_ctime; 2168d962783eSJia Liu abi_ulong target_st_ctime_nsec; 2169c7819dfbSPeter Maydell unsigned int __unused4; 2170c7819dfbSPeter Maydell unsigned int __unused5; 2171d962783eSJia Liu }; 2172c7819dfbSPeter Maydell 217347ae93cdSMichael Clark #if !defined(TARGET_RISCV64) 217420d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 2175c7819dfbSPeter Maydell struct target_stat64 { 2176c7819dfbSPeter Maydell uint64_t st_dev; 2177c7819dfbSPeter Maydell uint64_t st_ino; 2178c7819dfbSPeter Maydell unsigned int st_mode; 2179c7819dfbSPeter Maydell unsigned int st_nlink; 2180c7819dfbSPeter Maydell unsigned int st_uid; 2181c7819dfbSPeter Maydell unsigned int st_gid; 2182c7819dfbSPeter Maydell uint64_t st_rdev; 2183c7819dfbSPeter Maydell uint64_t __pad1; 2184c7819dfbSPeter Maydell int64_t st_size; 2185c7819dfbSPeter Maydell int st_blksize; 2186c7819dfbSPeter Maydell int __pad2; 2187c7819dfbSPeter Maydell int64_t st_blocks; 2188c7819dfbSPeter Maydell int target_st_atime; 2189c7819dfbSPeter Maydell unsigned int target_st_atime_nsec; 2190c7819dfbSPeter Maydell int target_st_mtime; 2191c7819dfbSPeter Maydell unsigned int target_st_mtime_nsec; 2192c7819dfbSPeter Maydell int target_st_ctime; 2193c7819dfbSPeter Maydell unsigned int target_st_ctime_nsec; 2194c7819dfbSPeter Maydell unsigned int __unused4; 2195c7819dfbSPeter Maydell unsigned int __unused5; 2196c7819dfbSPeter Maydell }; 219747ae93cdSMichael Clark #endif 2198c7819dfbSPeter Maydell 2199a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 2200a10d1e50SRichard Henderson 2201a10d1e50SRichard Henderson struct target_stat { 2202a10d1e50SRichard Henderson abi_uint st_dev; 2203a10d1e50SRichard Henderson abi_uint st_ino; 2204a10d1e50SRichard Henderson abi_ushort st_mode; 2205a10d1e50SRichard Henderson abi_ushort st_nlink; 2206a10d1e50SRichard Henderson abi_ushort _res1; 2207a10d1e50SRichard Henderson abi_ushort _res2; 2208a10d1e50SRichard Henderson abi_uint st_rdev; 2209a10d1e50SRichard Henderson abi_int st_size; 2210a10d1e50SRichard Henderson abi_int target_st_atime; 2211a10d1e50SRichard Henderson abi_uint target_st_atime_nsec; 2212a10d1e50SRichard Henderson abi_int target_st_mtime; 2213a10d1e50SRichard Henderson abi_uint target_st_mtime_nsec; 2214a10d1e50SRichard Henderson abi_int target_st_ctime; 2215a10d1e50SRichard Henderson abi_uint target_st_ctime_nsec; 2216a10d1e50SRichard Henderson abi_int st_blksize; 2217a10d1e50SRichard Henderson abi_int st_blocks; 2218a10d1e50SRichard Henderson abi_uint _unused1; 2219a10d1e50SRichard Henderson abi_uint _unused2; 2220a10d1e50SRichard Henderson abi_uint _unused3; 2221a10d1e50SRichard Henderson abi_uint _unused4; 2222a10d1e50SRichard Henderson abi_ushort _unused5; 2223a10d1e50SRichard Henderson abi_short st_fstype; 2224a10d1e50SRichard Henderson abi_uint st_realdev; 2225a10d1e50SRichard Henderson abi_ushort st_basemode; 2226a10d1e50SRichard Henderson abi_ushort _unused6; 2227a10d1e50SRichard Henderson abi_uint st_uid; 2228a10d1e50SRichard Henderson abi_uint st_gid; 2229a10d1e50SRichard Henderson abi_uint _unused7[3]; 2230a10d1e50SRichard Henderson }; 2231a10d1e50SRichard Henderson 2232a10d1e50SRichard Henderson #define TARGET_HAS_STRUCT_STAT64 2233a10d1e50SRichard Henderson struct target_stat64 { 2234a10d1e50SRichard Henderson uint64_t st_dev; 2235a10d1e50SRichard Henderson abi_uint _pad1; 2236a10d1e50SRichard Henderson abi_uint _res1; 2237a10d1e50SRichard Henderson abi_uint st_mode; 2238a10d1e50SRichard Henderson abi_uint st_nlink; 2239a10d1e50SRichard Henderson abi_uint st_uid; 2240a10d1e50SRichard Henderson abi_uint st_gid; 2241a10d1e50SRichard Henderson uint64_t st_rdev; 2242a10d1e50SRichard Henderson abi_uint _pad2; 2243a10d1e50SRichard Henderson int64_t st_size; 2244a10d1e50SRichard Henderson abi_int st_blksize; 2245a10d1e50SRichard Henderson int64_t st_blocks; 2246a10d1e50SRichard Henderson abi_int target_st_atime; 2247a10d1e50SRichard Henderson abi_uint target_st_atime_nsec; 2248a10d1e50SRichard Henderson abi_int target_st_mtime; 2249a10d1e50SRichard Henderson abi_uint target_st_mtime_nsec; 2250a10d1e50SRichard Henderson abi_int target_st_ctime; 2251a10d1e50SRichard Henderson abi_uint target_st_ctime_nsec; 2252a10d1e50SRichard Henderson uint64_t st_ino; 2253a10d1e50SRichard Henderson }; 2254a10d1e50SRichard Henderson 2255048f6b4dSbellard #else 2256048f6b4dSbellard #error unsupported CPU 2257048f6b4dSbellard #endif 22582521d698Sbellard 22594ce6f8deSths typedef struct { 22604ce6f8deSths int val[2]; 2261c227f099SAnthony Liguori } target_fsid_t; 22624ce6f8deSths 226356c8f68fSbellard #ifdef TARGET_MIPS 2264d26bc211Sths #ifdef TARGET_ABI_MIPSN32 2265540635baSths struct target_statfs { 2266540635baSths int32_t f_type; 2267540635baSths int32_t f_bsize; 2268540635baSths int32_t f_frsize; /* Fragment size - unsupported */ 2269540635baSths int32_t f_blocks; 2270540635baSths int32_t f_bfree; 2271540635baSths int32_t f_files; 2272540635baSths int32_t f_ffree; 2273540635baSths int32_t f_bavail; 2274540635baSths 2275540635baSths /* Linux specials */ 2276c227f099SAnthony Liguori target_fsid_t f_fsid; 2277540635baSths int32_t f_namelen; 2278d4247ec2SShea Levy int32_t f_flags; 2279d4247ec2SShea Levy int32_t f_spare[5]; 2280540635baSths }; 2281540635baSths #else 228256c8f68fSbellard struct target_statfs { 2283992f48a0Sblueswir1 abi_long f_type; 2284992f48a0Sblueswir1 abi_long f_bsize; 2285992f48a0Sblueswir1 abi_long f_frsize; /* Fragment size - unsupported */ 2286992f48a0Sblueswir1 abi_long f_blocks; 2287992f48a0Sblueswir1 abi_long f_bfree; 2288992f48a0Sblueswir1 abi_long f_files; 2289992f48a0Sblueswir1 abi_long f_ffree; 2290992f48a0Sblueswir1 abi_long f_bavail; 229156c8f68fSbellard 229256c8f68fSbellard /* Linux specials */ 2293c227f099SAnthony Liguori target_fsid_t f_fsid; 2294992f48a0Sblueswir1 abi_long f_namelen; 2295d4247ec2SShea Levy abi_long f_flags; 2296d4247ec2SShea Levy abi_long f_spare[5]; 229756c8f68fSbellard }; 2298540635baSths #endif 229956c8f68fSbellard 230056c8f68fSbellard struct target_statfs64 { 230156c8f68fSbellard uint32_t f_type; 230256c8f68fSbellard uint32_t f_bsize; 230356c8f68fSbellard uint32_t f_frsize; /* Fragment size - unsupported */ 230456c8f68fSbellard uint32_t __pad; 230556c8f68fSbellard uint64_t f_blocks; 230656c8f68fSbellard uint64_t f_bfree; 230756c8f68fSbellard uint64_t f_files; 230856c8f68fSbellard uint64_t f_ffree; 230956c8f68fSbellard uint64_t f_bavail; 2310c227f099SAnthony Liguori target_fsid_t f_fsid; 231156c8f68fSbellard uint32_t f_namelen; 2312d4247ec2SShea Levy uint32_t f_flags; 2313d4247ec2SShea Levy uint32_t f_spare[5]; 231456c8f68fSbellard }; 2315c4d10628Sbalrog #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ 231647ae93cdSMichael Clark defined(TARGET_SPARC64) || defined(TARGET_AARCH64) || \ 231747ae93cdSMichael Clark defined(TARGET_RISCV)) && !defined(TARGET_ABI32) 2318325e651fSj_mayer struct target_statfs { 2319325e651fSj_mayer abi_long f_type; 2320325e651fSj_mayer abi_long f_bsize; 2321325e651fSj_mayer abi_long f_blocks; 2322325e651fSj_mayer abi_long f_bfree; 2323325e651fSj_mayer abi_long f_bavail; 2324325e651fSj_mayer abi_long f_files; 2325325e651fSj_mayer abi_long f_ffree; 2326c227f099SAnthony Liguori target_fsid_t f_fsid; 2327325e651fSj_mayer abi_long f_namelen; 2328325e651fSj_mayer abi_long f_frsize; 2329d4247ec2SShea Levy abi_long f_flags; 2330d4247ec2SShea Levy abi_long f_spare[4]; 2331325e651fSj_mayer }; 2332325e651fSj_mayer 2333325e651fSj_mayer struct target_statfs64 { 2334325e651fSj_mayer abi_long f_type; 2335325e651fSj_mayer abi_long f_bsize; 2336325e651fSj_mayer abi_long f_blocks; 2337325e651fSj_mayer abi_long f_bfree; 2338325e651fSj_mayer abi_long f_bavail; 2339325e651fSj_mayer abi_long f_files; 2340325e651fSj_mayer abi_long f_ffree; 2341c227f099SAnthony Liguori target_fsid_t f_fsid; 2342325e651fSj_mayer abi_long f_namelen; 2343325e651fSj_mayer abi_long f_frsize; 2344d4247ec2SShea Levy abi_long f_flags; 2345d4247ec2SShea Levy abi_long f_spare[4]; 2346325e651fSj_mayer }; 2347a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 2348a4c075f1SUlrich Hecht struct target_statfs { 2349a4c075f1SUlrich Hecht int32_t f_type; 2350a4c075f1SUlrich Hecht int32_t f_bsize; 2351a4c075f1SUlrich Hecht abi_long f_blocks; 2352a4c075f1SUlrich Hecht abi_long f_bfree; 2353a4c075f1SUlrich Hecht abi_long f_bavail; 2354a4c075f1SUlrich Hecht abi_long f_files; 2355a4c075f1SUlrich Hecht abi_long f_ffree; 2356a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2357a4c075f1SUlrich Hecht int32_t f_namelen; 2358a4c075f1SUlrich Hecht int32_t f_frsize; 2359d4247ec2SShea Levy int32_t f_flags; 2360d4247ec2SShea Levy int32_t f_spare[4]; 2361d4247ec2SShea Levy 2362a4c075f1SUlrich Hecht }; 2363a4c075f1SUlrich Hecht 2364a4c075f1SUlrich Hecht struct target_statfs64 { 2365a4c075f1SUlrich Hecht int32_t f_type; 2366a4c075f1SUlrich Hecht int32_t f_bsize; 2367a4c075f1SUlrich Hecht abi_long f_blocks; 2368a4c075f1SUlrich Hecht abi_long f_bfree; 2369a4c075f1SUlrich Hecht abi_long f_bavail; 2370a4c075f1SUlrich Hecht abi_long f_files; 2371a4c075f1SUlrich Hecht abi_long f_ffree; 2372a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2373a4c075f1SUlrich Hecht int32_t f_namelen; 2374a4c075f1SUlrich Hecht int32_t f_frsize; 2375d4247ec2SShea Levy int32_t f_flags; 2376d4247ec2SShea Levy int32_t f_spare[4]; 2377a4c075f1SUlrich Hecht }; 237856c8f68fSbellard #else 237956c8f68fSbellard struct target_statfs { 238056c8f68fSbellard uint32_t f_type; 238156c8f68fSbellard uint32_t f_bsize; 238256c8f68fSbellard uint32_t f_blocks; 238356c8f68fSbellard uint32_t f_bfree; 238456c8f68fSbellard uint32_t f_bavail; 238556c8f68fSbellard uint32_t f_files; 238656c8f68fSbellard uint32_t f_ffree; 2387c227f099SAnthony Liguori target_fsid_t f_fsid; 238856c8f68fSbellard uint32_t f_namelen; 238956c8f68fSbellard uint32_t f_frsize; 2390d4247ec2SShea Levy uint32_t f_flags; 2391d4247ec2SShea Levy uint32_t f_spare[4]; 239256c8f68fSbellard }; 239356c8f68fSbellard 239456c8f68fSbellard struct target_statfs64 { 239556c8f68fSbellard uint32_t f_type; 239656c8f68fSbellard uint32_t f_bsize; 239756c8f68fSbellard uint64_t f_blocks; 239856c8f68fSbellard uint64_t f_bfree; 239956c8f68fSbellard uint64_t f_bavail; 240056c8f68fSbellard uint64_t f_files; 240156c8f68fSbellard uint64_t f_ffree; 2402c227f099SAnthony Liguori target_fsid_t f_fsid; 240356c8f68fSbellard uint32_t f_namelen; 240456c8f68fSbellard uint32_t f_frsize; 2405d4247ec2SShea Levy uint32_t f_flags; 2406d4247ec2SShea Levy uint32_t f_spare[4]; 240756c8f68fSbellard }; 240856c8f68fSbellard #endif 240956c8f68fSbellard 241056c8f68fSbellard 24112521d698Sbellard #define TARGET_F_DUPFD 0 /* dup */ 24122521d698Sbellard #define TARGET_F_GETFD 1 /* get close_on_exec */ 24132521d698Sbellard #define TARGET_F_SETFD 2 /* set/clear close_on_exec */ 24142521d698Sbellard #define TARGET_F_GETFL 3 /* get file->f_flags */ 24152521d698Sbellard #define TARGET_F_SETFL 4 /* set file->f_flags */ 24162521d698Sbellard 24172521d698Sbellard #if defined(TARGET_ALPHA) 24182521d698Sbellard #define TARGET_F_GETLK 7 24192521d698Sbellard #define TARGET_F_SETLK 8 24202521d698Sbellard #define TARGET_F_SETLKW 9 24212521d698Sbellard #define TARGET_F_SETOWN 5 /* for sockets. */ 24222521d698Sbellard #define TARGET_F_GETOWN 6 /* for sockets. */ 24232ba7f730SLaurent Vivier 24242ba7f730SLaurent Vivier #define TARGET_F_RDLCK 1 24252ba7f730SLaurent Vivier #define TARGET_F_WRLCK 2 24262ba7f730SLaurent Vivier #define TARGET_F_UNLCK 8 24272ba7f730SLaurent Vivier #define TARGET_F_EXLCK 16 24282ba7f730SLaurent Vivier #define TARGET_F_SHLCK 32 24295f106811SArnaud Patard (Rtp) #elif defined(TARGET_MIPS) 24305f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK 14 24315f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK 6 24325f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW 7 24335f106811SArnaud Patard (Rtp) #define TARGET_F_SETOWN 24 /* for sockets. */ 24343a87a954SAleksandar Markovic #define TARGET_F_GETOWN 23 /* for sockets. */ 2435b5c375e2SHelge Deller #elif defined(TARGET_HPPA) 24363d60c84dSHelge Deller #define TARGET_F_RDLCK 1 24373d60c84dSHelge Deller #define TARGET_F_WRLCK 2 24383d60c84dSHelge Deller #define TARGET_F_UNLCK 3 2439b5c375e2SHelge Deller #define TARGET_F_GETLK 5 2440b5c375e2SHelge Deller #define TARGET_F_SETLK 6 2441b5c375e2SHelge Deller #define TARGET_F_SETLKW 7 2442b5c375e2SHelge Deller #define TARGET_F_GETOWN 11 /* for sockets. */ 2443b5c375e2SHelge Deller #define TARGET_F_SETOWN 12 /* for sockets. */ 24442521d698Sbellard #else 24452521d698Sbellard #define TARGET_F_GETLK 5 24462521d698Sbellard #define TARGET_F_SETLK 6 24472521d698Sbellard #define TARGET_F_SETLKW 7 24482521d698Sbellard #define TARGET_F_SETOWN 8 /* for sockets. */ 24492521d698Sbellard #define TARGET_F_GETOWN 9 /* for sockets. */ 24502521d698Sbellard #endif 24518d5d3004SAndreas Schwab #define TARGET_F_SETOWN_EX 15 24528d5d3004SAndreas Schwab #define TARGET_F_GETOWN_EX 16 24532521d698Sbellard 24542ba7f730SLaurent Vivier #ifndef TARGET_F_RDLCK 24552ba7f730SLaurent Vivier #define TARGET_F_RDLCK 0 24562ba7f730SLaurent Vivier #define TARGET_F_WRLCK 1 24572ba7f730SLaurent Vivier #define TARGET_F_UNLCK 2 24582ba7f730SLaurent Vivier #endif 24592ba7f730SLaurent Vivier 24602ba7f730SLaurent Vivier #ifndef TARGET_F_EXLCK 24612ba7f730SLaurent Vivier #define TARGET_F_EXLCK 4 24622ba7f730SLaurent Vivier #define TARGET_F_SHLCK 8 24632ba7f730SLaurent Vivier #endif 24642ba7f730SLaurent Vivier 24652ba7f730SLaurent Vivier 2466b5c375e2SHelge Deller #if defined(TARGET_HPPA) 2467b5c375e2SHelge Deller #define TARGET_F_SETSIG 13 /* for sockets. */ 2468b5c375e2SHelge Deller #define TARGET_F_GETSIG 14 /* for sockets. */ 2469b5c375e2SHelge Deller #else 24702521d698Sbellard #define TARGET_F_SETSIG 10 /* for sockets. */ 24712521d698Sbellard #define TARGET_F_GETSIG 11 /* for sockets. */ 2472b5c375e2SHelge Deller #endif 24732521d698Sbellard 24745f106811SArnaud Patard (Rtp) #if defined(TARGET_MIPS) 24755f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK64 33 /* using 'struct flock64' */ 24765f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK64 34 24775f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW64 35 2478b5c375e2SHelge Deller #elif defined(TARGET_HPPA) 2479b5c375e2SHelge Deller #define TARGET_F_GETLK64 8 /* using 'struct flock64' */ 2480b5c375e2SHelge Deller #define TARGET_F_SETLK64 9 2481b5c375e2SHelge Deller #define TARGET_F_SETLKW64 10 24825f106811SArnaud Patard (Rtp) #else 24832521d698Sbellard #define TARGET_F_GETLK64 12 /* using 'struct flock64' */ 24842521d698Sbellard #define TARGET_F_SETLK64 13 24852521d698Sbellard #define TARGET_F_SETLKW64 14 24865f106811SArnaud Patard (Rtp) #endif 24877e22e546SUlrich Hecht 24887e22e546SUlrich Hecht #define TARGET_F_LINUX_SPECIFIC_BASE 1024 24897e22e546SUlrich Hecht #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0) 24907e22e546SUlrich Hecht #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1) 24917e22e546SUlrich Hecht #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) 24927e3b92ecSPeter Maydell #define TARGET_F_SETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 7) 24937e3b92ecSPeter Maydell #define TARGET_F_GETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 8) 24947e22e546SUlrich Hecht #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2) 24957e22e546SUlrich Hecht 24964eeea4f3SRichard Henderson #if defined(TARGET_ALPHA) 24974eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK 04 24984eeea4f3SRichard Henderson #define TARGET_O_APPEND 010 24994eeea4f3SRichard Henderson #define TARGET_O_CREAT 01000 /* not fcntl */ 25004eeea4f3SRichard Henderson #define TARGET_O_TRUNC 02000 /* not fcntl */ 25014eeea4f3SRichard Henderson #define TARGET_O_EXCL 04000 /* not fcntl */ 25024eeea4f3SRichard Henderson #define TARGET_O_NOCTTY 010000 /* not fcntl */ 25034eeea4f3SRichard Henderson #define TARGET_O_DSYNC 040000 25044eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0 /* not necessary, always 64-bit */ 25054eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY 0100000 /* must be a directory */ 25064eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW 0200000 /* don't follow links */ 25074eeea4f3SRichard Henderson #define TARGET_O_DIRECT 02000000 /* direct disk access hint */ 25084eeea4f3SRichard Henderson #define TARGET_O_NOATIME 04000000 25094eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 010000000 25104eeea4f3SRichard Henderson #define TARGET___O_SYNC 020000000 25114eeea4f3SRichard Henderson #define TARGET_O_PATH 040000000 2512a10d1e50SRichard Henderson #elif defined(TARGET_HPPA) 2513a10d1e50SRichard Henderson #define TARGET_O_NONBLOCK 000200004 /* HPUX has separate NDELAY & NONBLOCK */ 2514a10d1e50SRichard Henderson #define TARGET_O_APPEND 000000010 2515a10d1e50SRichard Henderson #define TARGET_O_CREAT 000000400 /* not fcntl */ 2516a10d1e50SRichard Henderson #define TARGET_O_EXCL 000002000 /* not fcntl */ 2517a10d1e50SRichard Henderson #define TARGET_O_NOCTTY 000400000 /* not fcntl */ 2518a10d1e50SRichard Henderson #define TARGET_O_DSYNC 001000000 2519a10d1e50SRichard Henderson #define TARGET_O_LARGEFILE 000004000 2520a10d1e50SRichard Henderson #define TARGET_O_DIRECTORY 000010000 /* must be a directory */ 2521a10d1e50SRichard Henderson #define TARGET_O_NOFOLLOW 000000200 /* don't follow links */ 2522a10d1e50SRichard Henderson #define TARGET_O_NOATIME 004000000 2523a10d1e50SRichard Henderson #define TARGET_O_CLOEXEC 010000000 2524a10d1e50SRichard Henderson #define TARGET___O_SYNC 000100000 2525a10d1e50SRichard Henderson #define TARGET_O_PATH 020000000 25265f9cee46SRiku Voipio #elif defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_AARCH64) 2527f09936acSbellard #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 2528f09936acSbellard #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 2529f09936acSbellard #define TARGET_O_DIRECT 0200000 /* direct disk access hint */ 2530f09936acSbellard #define TARGET_O_LARGEFILE 0400000 2531048f6b4dSbellard #elif defined(TARGET_MIPS) 2532048f6b4dSbellard #define TARGET_O_APPEND 0x0008 25334eeea4f3SRichard Henderson #define TARGET_O_DSYNC 0x0010 2534048f6b4dSbellard #define TARGET_O_NONBLOCK 0x0080 2535048f6b4dSbellard #define TARGET_O_CREAT 0x0100 /* not fcntl */ 2536048f6b4dSbellard #define TARGET_O_TRUNC 0x0200 /* not fcntl */ 2537048f6b4dSbellard #define TARGET_O_EXCL 0x0400 /* not fcntl */ 2538048f6b4dSbellard #define TARGET_O_NOCTTY 0x0800 /* not fcntl */ 2539048f6b4dSbellard #define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */ 2540048f6b4dSbellard #define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */ 25414eeea4f3SRichard Henderson #define TARGET___O_SYNC 0x4000 2542048f6b4dSbellard #define TARGET_O_DIRECT 0x8000 /* direct disk access hint */ 25434eeea4f3SRichard Henderson #elif defined (TARGET_PPC) 25444eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 25454eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 25464eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0200000 25474eeea4f3SRichard Henderson #define TARGET_O_DIRECT 0400000 /* direct disk access hint */ 25484eeea4f3SRichard Henderson #elif defined (TARGET_SPARC) 25491f961124Saurel32 #define TARGET_O_APPEND 0x0008 25504eeea4f3SRichard Henderson #define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */ 25511f961124Saurel32 #define TARGET_O_CREAT 0x0200 /* not fcntl */ 25521f961124Saurel32 #define TARGET_O_TRUNC 0x0400 /* not fcntl */ 25531f961124Saurel32 #define TARGET_O_EXCL 0x0800 /* not fcntl */ 25544eeea4f3SRichard Henderson #define TARGET_O_DSYNC 0x2000 25554eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK 0x4000 25564eeea4f3SRichard Henderson # ifdef TARGET_SPARC64 25574eeea4f3SRichard Henderson # define TARGET_O_NDELAY 0x0004 2558ffa65c3bSbellard # else 25594eeea4f3SRichard Henderson # define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK) 25604eeea4f3SRichard Henderson # endif 25614eeea4f3SRichard Henderson #define TARGET_O_NOCTTY 0x8000 /* not fcntl */ 25624eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0x40000 25634eeea4f3SRichard Henderson #define TARGET_O_DIRECT 0x100000 /* direct disk access hint */ 25644eeea4f3SRichard Henderson #define TARGET_O_NOATIME 0x200000 25654eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 0x400000 25664eeea4f3SRichard Henderson #define TARGET___O_SYNC 0x800000 25674eeea4f3SRichard Henderson #define TARGET_O_PATH 0x1000000 25684eeea4f3SRichard Henderson #endif 25694eeea4f3SRichard Henderson 25704eeea4f3SRichard Henderson /* <asm-generic/fcntl.h> values follow. */ 2571ffa65c3bSbellard #define TARGET_O_ACCMODE 0003 2572ffa65c3bSbellard #define TARGET_O_RDONLY 00 2573ffa65c3bSbellard #define TARGET_O_WRONLY 01 2574ffa65c3bSbellard #define TARGET_O_RDWR 02 25754eeea4f3SRichard Henderson #ifndef TARGET_O_CREAT 2576ffa65c3bSbellard #define TARGET_O_CREAT 0100 /* not fcntl */ 25774eeea4f3SRichard Henderson #endif 25784eeea4f3SRichard Henderson #ifndef TARGET_O_EXCL 2579ffa65c3bSbellard #define TARGET_O_EXCL 0200 /* not fcntl */ 25804eeea4f3SRichard Henderson #endif 25814eeea4f3SRichard Henderson #ifndef TARGET_O_NOCTTY 2582ffa65c3bSbellard #define TARGET_O_NOCTTY 0400 /* not fcntl */ 25834eeea4f3SRichard Henderson #endif 25844eeea4f3SRichard Henderson #ifndef TARGET_O_TRUNC 2585ffa65c3bSbellard #define TARGET_O_TRUNC 01000 /* not fcntl */ 25864eeea4f3SRichard Henderson #endif 25874eeea4f3SRichard Henderson #ifndef TARGET_O_APPEND 2588ffa65c3bSbellard #define TARGET_O_APPEND 02000 25894eeea4f3SRichard Henderson #endif 25904eeea4f3SRichard Henderson #ifndef TARGET_O_NONBLOCK 2591ffa65c3bSbellard #define TARGET_O_NONBLOCK 04000 25924eeea4f3SRichard Henderson #endif 25934eeea4f3SRichard Henderson #ifndef TARGET_O_DSYNC 25944eeea4f3SRichard Henderson #define TARGET_O_DSYNC 010000 25954eeea4f3SRichard Henderson #endif 25964eeea4f3SRichard Henderson #ifndef TARGET_FASYNC 2597ffa65c3bSbellard #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ 25984eeea4f3SRichard Henderson #endif 25994eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECT 2600ffa65c3bSbellard #define TARGET_O_DIRECT 040000 /* direct disk access hint */ 26014eeea4f3SRichard Henderson #endif 26024eeea4f3SRichard Henderson #ifndef TARGET_O_LARGEFILE 2603ffa65c3bSbellard #define TARGET_O_LARGEFILE 0100000 26044eeea4f3SRichard Henderson #endif 26054eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECTORY 2606ffa65c3bSbellard #define TARGET_O_DIRECTORY 0200000 /* must be a directory */ 26074eeea4f3SRichard Henderson #endif 26084eeea4f3SRichard Henderson #ifndef TARGET_O_NOFOLLOW 2609ffa65c3bSbellard #define TARGET_O_NOFOLLOW 0400000 /* don't follow links */ 2610ffa65c3bSbellard #endif 26114eeea4f3SRichard Henderson #ifndef TARGET_O_NOATIME 26124eeea4f3SRichard Henderson #define TARGET_O_NOATIME 01000000 26134eeea4f3SRichard Henderson #endif 26144eeea4f3SRichard Henderson #ifndef TARGET_O_CLOEXEC 26154eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 02000000 26164eeea4f3SRichard Henderson #endif 26174eeea4f3SRichard Henderson #ifndef TARGET___O_SYNC 26184eeea4f3SRichard Henderson #define TARGET___O_SYNC 04000000 26194eeea4f3SRichard Henderson #endif 26204eeea4f3SRichard Henderson #ifndef TARGET_O_PATH 26214eeea4f3SRichard Henderson #define TARGET_O_PATH 010000000 26224eeea4f3SRichard Henderson #endif 26235f9cee46SRiku Voipio #ifndef TARGET___O_TMPFILE 26245f9cee46SRiku Voipio #define TARGET___O_TMPFILE 020000000 26255f9cee46SRiku Voipio #endif 26265f9cee46SRiku Voipio #ifndef TARGET_O_TMPFILE 26275f9cee46SRiku Voipio #define TARGET_O_TMPFILE (TARGET___O_TMPFILE | TARGET_O_DIRECTORY) 26285f9cee46SRiku Voipio #endif 26294eeea4f3SRichard Henderson #ifndef TARGET_O_NDELAY 26304eeea4f3SRichard Henderson #define TARGET_O_NDELAY TARGET_O_NONBLOCK 26314eeea4f3SRichard Henderson #endif 26324eeea4f3SRichard Henderson #ifndef TARGET_O_SYNC 26334eeea4f3SRichard Henderson #define TARGET_O_SYNC (TARGET___O_SYNC | TARGET_O_DSYNC) 26344eeea4f3SRichard Henderson #endif 2635ffa65c3bSbellard 26362521d698Sbellard struct target_flock { 26372521d698Sbellard short l_type; 26382521d698Sbellard short l_whence; 26398efb2ed5SPeter Maydell abi_long l_start; 26408efb2ed5SPeter Maydell abi_long l_len; 26418a8001b1SAleksandar Markovic #if defined(TARGET_MIPS) 26428a8001b1SAleksandar Markovic abi_long l_sysid; 26438a8001b1SAleksandar Markovic #endif 26442521d698Sbellard int l_pid; 26458a8001b1SAleksandar Markovic #if defined(TARGET_MIPS) 26468a8001b1SAleksandar Markovic abi_long pad[4]; 26478a8001b1SAleksandar Markovic #endif 26482521d698Sbellard }; 26492521d698Sbellard 26502521d698Sbellard struct target_flock64 { 26512521d698Sbellard short l_type; 26522521d698Sbellard short l_whence; 2653429b31a2SRichard Henderson #if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) \ 2654429b31a2SRichard Henderson || defined(TARGET_SPARC) || defined(TARGET_HPPA) \ 2655ba7651fbSMax Filippov || defined(TARGET_MICROBLAZE) || defined(TARGET_TILEGX) \ 2656ba7651fbSMax Filippov || defined(TARGET_XTENSA) 2657ce3f0e2fSaurel32 int __pad; 2658ce3f0e2fSaurel32 #endif 26598efb2ed5SPeter Maydell abi_llong l_start; 26608efb2ed5SPeter Maydell abi_llong l_len; 26612521d698Sbellard int l_pid; 2662541dc0d4SStefan Weil } QEMU_PACKED; 26632521d698Sbellard 2664ce4defa0Spbrook #ifdef TARGET_ARM 2665ce4defa0Spbrook struct target_eabi_flock64 { 2666ce4defa0Spbrook short l_type; 2667ce4defa0Spbrook short l_whence; 2668ce4defa0Spbrook int __pad; 26698efb2ed5SPeter Maydell abi_llong l_start; 26708efb2ed5SPeter Maydell abi_llong l_len; 2671ce4defa0Spbrook int l_pid; 2672541dc0d4SStefan Weil } QEMU_PACKED; 2673ce4defa0Spbrook #endif 26742521d698Sbellard 26758d5d3004SAndreas Schwab struct target_f_owner_ex { 26768d5d3004SAndreas Schwab int type; /* Owner type of ID. */ 26778d5d3004SAndreas Schwab int pid; /* ID of owner. */ 26788d5d3004SAndreas Schwab }; 26798d5d3004SAndreas Schwab 26802521d698Sbellard /* soundcard defines */ 268167cc32ebSVeres Lajos /* XXX: convert them all to arch independent entries */ 26822521d698Sbellard #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); 26832521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 26842521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 26852521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 26862521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA 0xc0144302 26872521d698Sbellard #define TARGET_SNDCTL_COPR_RESET 0x00004300 26882521d698Sbellard #define TARGET_SNDCTL_COPR_RUN 0xc0144306 26892521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 26902521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE 0x40144305 26912521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA 0x40144304 26922521d698Sbellard #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) 26932521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) 26942521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) 26952521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) 26962521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) 26972521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) 26982521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) 26992521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) 27002521d698Sbellard #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) 27012521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) 27022521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) 27032521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) 27042521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) 27052521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) 27062521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) 27072521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) 27082521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) 27092521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) 27105f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19) 27115f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20) 27122521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e 27132521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 27142521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 27152521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 27162521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 27172521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f 27182521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 27192521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO 0xc074510c 27202521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 27212521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 27222521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 27232521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 27242521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 27252521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 27262521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 27272521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 27282521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b 27292521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a 27302521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 27312521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC 0x00005111 27322521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 27332521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET 0x00005100 27342521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 27352521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC 0x00005101 27362521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 27372521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d 27382521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d 27392521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 27402521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e 27412521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 27422521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME 0x40045407 27432521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT 0x40045408 27442521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 27452521d698Sbellard #define TARGET_SNDCTL_TMR_START 0x00005402 27462521d698Sbellard #define TARGET_SNDCTL_TMR_STOP 0x00005403 27472521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 27482521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 27492521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE 0x80045002 27502521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 27512521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS 0x80045005 27522521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 27532521d698Sbellard #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) 27542521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 27552521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) 27562521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) 27572521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) 27582521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) 27592521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) 27602521d698Sbellard 27612521d698Sbellard #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) 27622521d698Sbellard 27632521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) 27642521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) 27652521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) 27662521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) 27672521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) 27682521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) 27692521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) 27702521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) 27712521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) 27722521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) 27732521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) 27742521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) 27752521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) 27762521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) 27772521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) 27782521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) 27792521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) 27802521d698Sbellard 27812521d698Sbellard /* Obsolete macros */ 27822521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) 27832521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) 27842521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) 27852521d698Sbellard 27862521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) 27872521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) 27882521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) 27892521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) 27902521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) 27912521d698Sbellard 27922521d698Sbellard #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) 27932521d698Sbellard 27942521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) 27952521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) 27962521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) 27972521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) 27982521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) 27992521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) 28002521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) 28012521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) 28022521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) 28032521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) 28042521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) 28052521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) 28062521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) 28072521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) 28082521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) 28092521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) 28102521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) 28112521d698Sbellard 28122521d698Sbellard /* Obsolete macros */ 28132521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) 28142521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) 28152521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) 28162521d698Sbellard 28172521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) 28182521d698Sbellard 28192521d698Sbellard /* vfat ioctls */ 28202521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) 28212521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) 2822a5448a7dSbellard 2823f443e396SPeter Maydell struct target_mtop { 2824f443e396SPeter Maydell abi_short mt_op; 2825f443e396SPeter Maydell abi_int mt_count; 2826f443e396SPeter Maydell }; 2827f443e396SPeter Maydell 2828f443e396SPeter Maydell #if defined(TARGET_SPARC) || defined(TARGET_MIPS) 2829f443e396SPeter Maydell typedef abi_long target_kernel_daddr_t; 2830f443e396SPeter Maydell #else 2831f443e396SPeter Maydell typedef abi_int target_kernel_daddr_t; 2832f443e396SPeter Maydell #endif 2833f443e396SPeter Maydell 2834f443e396SPeter Maydell struct target_mtget { 2835f443e396SPeter Maydell abi_long mt_type; 2836f443e396SPeter Maydell abi_long mt_resid; 2837f443e396SPeter Maydell abi_long mt_dsreg; 2838f443e396SPeter Maydell abi_long mt_gstat; 2839f443e396SPeter Maydell abi_long mt_erreg; 2840f443e396SPeter Maydell target_kernel_daddr_t mt_fileno; 2841f443e396SPeter Maydell target_kernel_daddr_t mt_blkno; 2842f443e396SPeter Maydell }; 2843f443e396SPeter Maydell 2844f443e396SPeter Maydell struct target_mtpos { 2845f443e396SPeter Maydell abi_long mt_blkno; 2846f443e396SPeter Maydell }; 2847f443e396SPeter Maydell 2848f443e396SPeter Maydell #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct target_mtop) 2849f443e396SPeter Maydell #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct target_mtget) 2850f443e396SPeter Maydell #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct target_mtpos) 28518fbd6b52Sbalrog 2852a5448a7dSbellard struct target_sysinfo { 2853992f48a0Sblueswir1 abi_long uptime; /* Seconds since boot */ 2854992f48a0Sblueswir1 abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */ 2855992f48a0Sblueswir1 abi_ulong totalram; /* Total usable main memory size */ 2856992f48a0Sblueswir1 abi_ulong freeram; /* Available memory size */ 2857992f48a0Sblueswir1 abi_ulong sharedram; /* Amount of shared memory */ 2858992f48a0Sblueswir1 abi_ulong bufferram; /* Memory used by buffers */ 2859992f48a0Sblueswir1 abi_ulong totalswap; /* Total swap space size */ 2860992f48a0Sblueswir1 abi_ulong freeswap; /* swap space still available */ 2861a5448a7dSbellard unsigned short procs; /* Number of current processes */ 2862a5448a7dSbellard unsigned short pad; /* explicit padding for m68k */ 2863992f48a0Sblueswir1 abi_ulong totalhigh; /* Total high memory size */ 2864992f48a0Sblueswir1 abi_ulong freehigh; /* Available high memory size */ 2865a5448a7dSbellard unsigned int mem_unit; /* Memory unit size in bytes */ 2866992f48a0Sblueswir1 char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 2867a5448a7dSbellard }; 28683532fa74Sbellard 28696556a833Saurel32 struct linux_dirent { 28706556a833Saurel32 long d_ino; 28716556a833Saurel32 unsigned long d_off; 28726556a833Saurel32 unsigned short d_reclen; 28736556a833Saurel32 char d_name[256]; /* We must not include limits.h! */ 28746556a833Saurel32 }; 28756556a833Saurel32 28766556a833Saurel32 struct linux_dirent64 { 28776556a833Saurel32 uint64_t d_ino; 28786556a833Saurel32 int64_t d_off; 28796556a833Saurel32 unsigned short d_reclen; 28806556a833Saurel32 unsigned char d_type; 28816556a833Saurel32 char d_name[256]; 28826556a833Saurel32 }; 28836556a833Saurel32 288424e1003aSaurel32 struct target_mq_attr { 288524e1003aSaurel32 abi_long mq_flags; 288624e1003aSaurel32 abi_long mq_maxmsg; 288724e1003aSaurel32 abi_long mq_msgsize; 288824e1003aSaurel32 abi_long mq_curmsgs; 288924e1003aSaurel32 }; 289024e1003aSaurel32 28913532fa74Sbellard #include "socket.h" 2892637947f1Sths 2893637947f1Sths #include "errno_defs.h" 289403dfe9f8SRiku Voipio 289503dfe9f8SRiku Voipio #define FUTEX_WAIT 0 289603dfe9f8SRiku Voipio #define FUTEX_WAKE 1 289703dfe9f8SRiku Voipio #define FUTEX_FD 2 289803dfe9f8SRiku Voipio #define FUTEX_REQUEUE 3 289903dfe9f8SRiku Voipio #define FUTEX_CMP_REQUEUE 4 290003dfe9f8SRiku Voipio #define FUTEX_WAKE_OP 5 290103dfe9f8SRiku Voipio #define FUTEX_LOCK_PI 6 290203dfe9f8SRiku Voipio #define FUTEX_UNLOCK_PI 7 290303dfe9f8SRiku Voipio #define FUTEX_TRYLOCK_PI 8 290403dfe9f8SRiku Voipio #define FUTEX_WAIT_BITSET 9 290503dfe9f8SRiku Voipio #define FUTEX_WAKE_BITSET 10 290603dfe9f8SRiku Voipio 290703dfe9f8SRiku Voipio #define FUTEX_PRIVATE_FLAG 128 290803dfe9f8SRiku Voipio #define FUTEX_CLOCK_REALTIME 256 290903dfe9f8SRiku Voipio #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) 291003dfe9f8SRiku Voipio 29113b6edd16SPeter Maydell #ifdef CONFIG_EPOLL 2912928bed6aSLaurent Vivier #if defined(TARGET_X86_64) 2913928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED QEMU_PACKED 2914928bed6aSLaurent Vivier #else 2915928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED 2916928bed6aSLaurent Vivier #endif 2917928bed6aSLaurent Vivier 29183b6edd16SPeter Maydell typedef union target_epoll_data { 29193b6edd16SPeter Maydell abi_ulong ptr; 2920928bed6aSLaurent Vivier abi_int fd; 2921928bed6aSLaurent Vivier abi_uint u32; 2922928bed6aSLaurent Vivier abi_ullong u64; 29233b6edd16SPeter Maydell } target_epoll_data_t; 29243b6edd16SPeter Maydell 29253b6edd16SPeter Maydell struct target_epoll_event { 2926928bed6aSLaurent Vivier abi_uint events; 29273b6edd16SPeter Maydell target_epoll_data_t data; 2928928bed6aSLaurent Vivier } TARGET_EPOLL_PACKED; 29292ba7fae3SPeter Maydell 29302ba7fae3SPeter Maydell #define TARGET_EP_MAX_EVENTS (INT_MAX / sizeof(struct target_epoll_event)) 29312ba7fae3SPeter Maydell 29323b6edd16SPeter Maydell #endif 2933163a05a8SPeter Maydell struct target_rlimit64 { 2934163a05a8SPeter Maydell uint64_t rlim_cur; 2935163a05a8SPeter Maydell uint64_t rlim_max; 2936163a05a8SPeter Maydell }; 2937583359a6SAkos PASZTORY 2938583359a6SAkos PASZTORY struct target_ucred { 2939583359a6SAkos PASZTORY uint32_t pid; 2940583359a6SAkos PASZTORY uint32_t uid; 2941583359a6SAkos PASZTORY uint32_t gid; 2942583359a6SAkos PASZTORY }; 2943cb9c377fSPaolo Bonzini 2944aecc8861SAlexander Graf typedef int32_t target_timer_t; 2945905bba13SErik de Castro Lopo 294634d60862SNatanael Copa #define TARGET_SIGEV_MAX_SIZE 64 294734d60862SNatanael Copa 294834d60862SNatanael Copa /* This is architecture-specific but most architectures use the default */ 294934d60862SNatanael Copa #ifdef TARGET_MIPS 295034d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long)) 295134d60862SNatanael Copa #else 295234d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ 295334d60862SNatanael Copa + sizeof(target_sigval_t)) 295434d60862SNatanael Copa #endif 295534d60862SNatanael Copa 295634d60862SNatanael Copa #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ 295734d60862SNatanael Copa - TARGET_SIGEV_PREAMBLE_SIZE) \ 295834d60862SNatanael Copa / sizeof(int32_t)) 295934d60862SNatanael Copa 2960905bba13SErik de Castro Lopo struct target_sigevent { 2961905bba13SErik de Castro Lopo target_sigval_t sigev_value; 296217351c3fSPeter Maydell abi_int sigev_signo; 296317351c3fSPeter Maydell abi_int sigev_notify; 2964905bba13SErik de Castro Lopo union { 296517351c3fSPeter Maydell abi_int _pad[TARGET_SIGEV_PAD_SIZE]; 296617351c3fSPeter Maydell abi_int _tid; 2967905bba13SErik de Castro Lopo 296817351c3fSPeter Maydell /* The kernel (and thus QEMU) never looks at these; 296917351c3fSPeter Maydell * they're only used as part of the ABI between a 297017351c3fSPeter Maydell * userspace program and libc. 297117351c3fSPeter Maydell */ 2972905bba13SErik de Castro Lopo struct { 297317351c3fSPeter Maydell abi_ulong _function; 297417351c3fSPeter Maydell abi_ulong _attribute; 2975905bba13SErik de Castro Lopo } _sigev_thread; 2976905bba13SErik de Castro Lopo } _sigev_un; 2977905bba13SErik de Castro Lopo }; 2978e0eb210eSPeter Maydell 2979e0eb210eSPeter Maydell struct target_user_cap_header { 2980e0eb210eSPeter Maydell uint32_t version; 2981e0eb210eSPeter Maydell int pid; 2982e0eb210eSPeter Maydell }; 2983e0eb210eSPeter Maydell 2984e0eb210eSPeter Maydell struct target_user_cap_data { 2985e0eb210eSPeter Maydell uint32_t effective; 2986e0eb210eSPeter Maydell uint32_t permitted; 2987e0eb210eSPeter Maydell uint32_t inheritable; 2988e0eb210eSPeter Maydell }; 29891b3c4fdfSMarkus Armbruster 2990da2c8ad7SAleksandar Markovic /* from kernel's include/linux/syslog.h */ 2991da2c8ad7SAleksandar Markovic 2992da2c8ad7SAleksandar Markovic /* Close the log. Currently a NOP. */ 2993da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CLOSE 0 2994da2c8ad7SAleksandar Markovic /* Open the log. Currently a NOP. */ 2995da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_OPEN 1 2996da2c8ad7SAleksandar Markovic /* Read from the log. */ 2997da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ 2 2998da2c8ad7SAleksandar Markovic /* Read all messages remaining in the ring buffer. */ 2999da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ_ALL 3 3000da2c8ad7SAleksandar Markovic /* Read and clear all messages remaining in the ring buffer */ 3001da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_READ_CLEAR 4 3002da2c8ad7SAleksandar Markovic /* Clear ring buffer. */ 3003da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CLEAR 5 3004da2c8ad7SAleksandar Markovic /* Disable printk's to console */ 3005da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_OFF 6 3006da2c8ad7SAleksandar Markovic /* Enable printk's to console */ 3007da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_ON 7 3008da2c8ad7SAleksandar Markovic /* Set level of messages printed to console */ 3009da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_CONSOLE_LEVEL 8 3010da2c8ad7SAleksandar Markovic /* Return number of unread characters in the log buffer */ 3011da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_SIZE_UNREAD 9 3012da2c8ad7SAleksandar Markovic /* Return size of the log buffer */ 3013da2c8ad7SAleksandar Markovic #define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10 3014da2c8ad7SAleksandar Markovic 30151b3c4fdfSMarkus Armbruster #endif 3016