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 12*ff71a454SAleksandar Markovic 13*ff71a454SAleksandar Markovic /* socket operations for socketcall() */ 14*ff71a454SAleksandar Markovic #define TARGET_SYS_SOCKET 1 /* socket() */ 15*ff71a454SAleksandar Markovic #define TARGET_SYS_BIND 2 /* bind() */ 16*ff71a454SAleksandar Markovic #define TARGET_SYS_CONNECT 3 /* connect() */ 17*ff71a454SAleksandar Markovic #define TARGET_SYS_LISTEN 4 /* listen() */ 18*ff71a454SAleksandar Markovic #define TARGET_SYS_ACCEPT 5 /* accept() */ 19*ff71a454SAleksandar Markovic #define TARGET_SYS_GETSOCKNAME 6 /* getsockname() */ 20*ff71a454SAleksandar Markovic #define TARGET_SYS_GETPEERNAME 7 /* getpeername() */ 21*ff71a454SAleksandar Markovic #define TARGET_SYS_SOCKETPAIR 8 /* socketpair() */ 22*ff71a454SAleksandar Markovic #define TARGET_SYS_SEND 9 /* send() */ 23*ff71a454SAleksandar Markovic #define TARGET_SYS_RECV 10 /* recv() */ 24*ff71a454SAleksandar Markovic #define TARGET_SYS_SENDTO 11 /* sendto() */ 25*ff71a454SAleksandar Markovic #define TARGET_SYS_RECVFROM 12 /* recvfrom() */ 26*ff71a454SAleksandar Markovic #define TARGET_SYS_SHUTDOWN 13 /* shutdown() */ 27*ff71a454SAleksandar Markovic #define TARGET_SYS_SETSOCKOPT 14 /* setsockopt() */ 28*ff71a454SAleksandar Markovic #define TARGET_SYS_GETSOCKOPT 15 /* getsockopt() */ 29*ff71a454SAleksandar Markovic #define TARGET_SYS_SENDMSG 16 /* sendmsg() */ 30*ff71a454SAleksandar Markovic #define TARGET_SYS_RECVMSG 17 /* recvmsg() */ 31*ff71a454SAleksandar Markovic #define TARGET_SYS_ACCEPT4 18 /* accept4() */ 32*ff71a454SAleksandar Markovic #define TARGET_SYS_RECVMMSG 19 /* recvmmsg() */ 33*ff71a454SAleksandar Markovic #define TARGET_SYS_SENDMMSG 20 /* sendmmsg() */ 3431e31b8aSbellard 358853f86eSbellard #define IPCOP_semop 1 368853f86eSbellard #define IPCOP_semget 2 378853f86eSbellard #define IPCOP_semctl 3 388853f86eSbellard #define IPCOP_semtimedop 4 398853f86eSbellard #define IPCOP_msgsnd 11 408853f86eSbellard #define IPCOP_msgrcv 12 418853f86eSbellard #define IPCOP_msgget 13 428853f86eSbellard #define IPCOP_msgctl 14 438853f86eSbellard #define IPCOP_shmat 21 448853f86eSbellard #define IPCOP_shmdt 22 458853f86eSbellard #define IPCOP_shmget 23 468853f86eSbellard #define IPCOP_shmctl 24 478853f86eSbellard 482521d698Sbellard /* 492521d698Sbellard * The following is for compatibility across the various Linux 502521d698Sbellard * platforms. The i386 ioctl numbering scheme doesn't really enforce 512521d698Sbellard * a type field. De facto, however, the top 8 bits of the lower 16 522521d698Sbellard * bits are indeed used as a type field, so we might just as well make 532521d698Sbellard * this explicit here. Please be sure to use the decoding macros 542521d698Sbellard * below from now on. 552521d698Sbellard */ 562521d698Sbellard #define TARGET_IOC_NRBITS 8 572521d698Sbellard #define TARGET_IOC_TYPEBITS 8 582521d698Sbellard 59716f3fbeSPeter Maydell #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 60716f3fbeSPeter Maydell || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 61cd98d390SAndreas Schwab || defined(TARGET_SPARC) \ 620c866a7eSRiku Voipio || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) 6374d753acSMika Westerberg /* 16 bit uid wrappers emulation */ 6474d753acSMika Westerberg #define USE_UID16 650c866a7eSRiku Voipio #define target_id uint16_t 660c866a7eSRiku Voipio #else 670c866a7eSRiku Voipio #define target_id uint32_t 6874d753acSMika Westerberg #endif 6974d753acSMika Westerberg 70e6e5906bSpbrook #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ 71b16189b2SChen Gang || defined(TARGET_M68K) || defined(TARGET_CRIS) \ 72b16189b2SChen Gang || defined(TARGET_UNICORE32) || defined(TARGET_S390X) \ 73b16189b2SChen Gang || defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) 742521d698Sbellard 752521d698Sbellard #define TARGET_IOC_SIZEBITS 14 762521d698Sbellard #define TARGET_IOC_DIRBITS 2 772521d698Sbellard 782521d698Sbellard #define TARGET_IOC_NONE 0U 792521d698Sbellard #define TARGET_IOC_WRITE 1U 802521d698Sbellard #define TARGET_IOC_READ 2U 812521d698Sbellard 82048f6b4dSbellard #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ 83b779e29eSEdgar E. Iglesias defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \ 84b779e29eSEdgar E. Iglesias defined(TARGET_MIPS) 852521d698Sbellard 862521d698Sbellard #define TARGET_IOC_SIZEBITS 13 872521d698Sbellard #define TARGET_IOC_DIRBITS 3 882521d698Sbellard 892521d698Sbellard #define TARGET_IOC_NONE 1U 902521d698Sbellard #define TARGET_IOC_READ 2U 912521d698Sbellard #define TARGET_IOC_WRITE 4U 922521d698Sbellard 932521d698Sbellard #else 942521d698Sbellard #error unsupported CPU 952521d698Sbellard #endif 962521d698Sbellard 972521d698Sbellard #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) 982521d698Sbellard #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) 992521d698Sbellard #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) 1002521d698Sbellard #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) 1012521d698Sbellard 1022521d698Sbellard #define TARGET_IOC_NRSHIFT 0 1032521d698Sbellard #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) 1042521d698Sbellard #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) 1052521d698Sbellard #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) 1062521d698Sbellard 1072521d698Sbellard #define TARGET_IOC(dir,type,nr,size) \ 1082521d698Sbellard (((dir) << TARGET_IOC_DIRSHIFT) | \ 1092521d698Sbellard ((type) << TARGET_IOC_TYPESHIFT) | \ 1102521d698Sbellard ((nr) << TARGET_IOC_NRSHIFT) | \ 1112521d698Sbellard ((size) << TARGET_IOC_SIZESHIFT)) 1122521d698Sbellard 1132521d698Sbellard /* used to create numbers */ 1142521d698Sbellard #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) 1152521d698Sbellard #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) 1162521d698Sbellard #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1172521d698Sbellard #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1182521d698Sbellard 1192521d698Sbellard /* the size is automatically computed for these defines */ 1202521d698Sbellard #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) 1212521d698Sbellard #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1222521d698Sbellard #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1232521d698Sbellard 1247854b056Sbellard struct target_sockaddr { 1257854b056Sbellard uint16_t sa_family; 1267854b056Sbellard uint8_t sa_data[14]; 1277854b056Sbellard }; 1287854b056Sbellard 12933a29b51SJoakim Tjernlund struct target_sockaddr_ll { 13033a29b51SJoakim Tjernlund uint16_t sll_family; /* Always AF_PACKET */ 13133a29b51SJoakim Tjernlund uint16_t sll_protocol; /* Physical layer protocol */ 13233a29b51SJoakim Tjernlund int sll_ifindex; /* Interface number */ 13333a29b51SJoakim Tjernlund uint16_t sll_hatype; /* ARP hardware type */ 13433a29b51SJoakim Tjernlund uint8_t sll_pkttype; /* Packet type */ 13533a29b51SJoakim Tjernlund uint8_t sll_halen; /* Length of address */ 13633a29b51SJoakim Tjernlund uint8_t sll_addr[8]; /* Physical layer address */ 13733a29b51SJoakim Tjernlund }; 13833a29b51SJoakim Tjernlund 139fb3aabf3SLaurent Vivier struct target_sockaddr_un { 140fb3aabf3SLaurent Vivier uint16_t su_family; 141fb3aabf3SLaurent Vivier uint8_t sun_path[108]; 142fb3aabf3SLaurent Vivier }; 143fb3aabf3SLaurent Vivier 144fb3aabf3SLaurent Vivier struct target_in_addr { 145fb3aabf3SLaurent Vivier uint32_t s_addr; /* big endian */ 146fb3aabf3SLaurent Vivier }; 147fb3aabf3SLaurent Vivier 148fb3aabf3SLaurent Vivier struct target_sockaddr_in { 149fb3aabf3SLaurent Vivier uint16_t sin_family; 150fb3aabf3SLaurent Vivier int16_t sin_port; /* big endian */ 151fb3aabf3SLaurent Vivier struct target_in_addr sin_addr; 152fb3aabf3SLaurent Vivier uint8_t __pad[sizeof(struct target_sockaddr) - 153fb3aabf3SLaurent Vivier sizeof(uint16_t) - sizeof(int16_t) - 154fb3aabf3SLaurent Vivier sizeof(struct target_in_addr)]; 155fb3aabf3SLaurent Vivier }; 156fb3aabf3SLaurent Vivier 157f57d4192SLaurent Vivier struct target_sock_filter { 158f57d4192SLaurent Vivier abi_ushort code; 159f57d4192SLaurent Vivier uint8_t jt; 160f57d4192SLaurent Vivier uint8_t jf; 161f57d4192SLaurent Vivier abi_uint k; 162f57d4192SLaurent Vivier }; 163f57d4192SLaurent Vivier 164f57d4192SLaurent Vivier struct target_sock_fprog { 165f57d4192SLaurent Vivier abi_ushort len; 166f57d4192SLaurent Vivier abi_ulong filter; 167f57d4192SLaurent Vivier }; 168f57d4192SLaurent Vivier 169b975b83bSLionel Landwerlin struct target_ip_mreq { 170b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 171b975b83bSLionel Landwerlin struct target_in_addr imr_address; 172b975b83bSLionel Landwerlin }; 173b975b83bSLionel Landwerlin 174b975b83bSLionel Landwerlin struct target_ip_mreqn { 175b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 176b975b83bSLionel Landwerlin struct target_in_addr imr_address; 177b975b83bSLionel Landwerlin abi_long imr_ifindex; 178b975b83bSLionel Landwerlin }; 179b975b83bSLionel Landwerlin 1806e3cb58fSLionel Landwerlin struct target_ip_mreq_source { 1816e3cb58fSLionel Landwerlin /* big endian */ 1826e3cb58fSLionel Landwerlin uint32_t imr_multiaddr; 1836e3cb58fSLionel Landwerlin uint32_t imr_interface; 1846e3cb58fSLionel Landwerlin uint32_t imr_sourceaddr; 1856e3cb58fSLionel Landwerlin }; 1866e3cb58fSLionel Landwerlin 18731e31b8aSbellard struct target_timeval { 188992f48a0Sblueswir1 abi_long tv_sec; 189992f48a0Sblueswir1 abi_long tv_usec; 19031e31b8aSbellard }; 19131e31b8aSbellard 1921b6b029eSbellard struct target_timespec { 193992f48a0Sblueswir1 abi_long tv_sec; 194992f48a0Sblueswir1 abi_long tv_nsec; 1951b6b029eSbellard }; 1961b6b029eSbellard 197ef4467e9SPaul Burton struct target_timezone { 198ef4467e9SPaul Burton abi_int tz_minuteswest; 199ef4467e9SPaul Burton abi_int tz_dsttime; 200ef4467e9SPaul Burton }; 201ef4467e9SPaul Burton 20266fb9763Sbellard struct target_itimerval { 20366fb9763Sbellard struct target_timeval it_interval; 20466fb9763Sbellard struct target_timeval it_value; 20566fb9763Sbellard }; 20666fb9763Sbellard 207905bba13SErik de Castro Lopo struct target_itimerspec { 208905bba13SErik de Castro Lopo struct target_timespec it_interval; 209905bba13SErik de Castro Lopo struct target_timespec it_value; 210905bba13SErik de Castro Lopo }; 211905bba13SErik de Castro Lopo 21219f59bceSAleksandar Markovic struct target_timex { 21319f59bceSAleksandar Markovic abi_uint modes; /* Mode selector */ 21419f59bceSAleksandar Markovic abi_long offset; /* Time offset */ 21519f59bceSAleksandar Markovic abi_long freq; /* Frequency offset */ 21619f59bceSAleksandar Markovic abi_long maxerror; /* Maximum error (microseconds) */ 21719f59bceSAleksandar Markovic abi_long esterror; /* Estimated error (microseconds) */ 21819f59bceSAleksandar Markovic abi_int status; /* Clock command/status */ 21919f59bceSAleksandar Markovic abi_long constant; /* PLL (phase-locked loop) time constant */ 22019f59bceSAleksandar Markovic abi_long precision; /* Clock precision (microseconds, ro) */ 22119f59bceSAleksandar Markovic abi_long tolerance; /* Clock freq. tolerance (ppm, ro) */ 22219f59bceSAleksandar Markovic struct target_timeval time; /* Current time */ 22319f59bceSAleksandar Markovic abi_long tick; /* Microseconds between clock ticks */ 22419f59bceSAleksandar Markovic abi_long ppsfreq; /* PPS (pulse per second) frequency */ 22519f59bceSAleksandar Markovic abi_long jitter; /* PPS jitter (ro); nanoseconds */ 22619f59bceSAleksandar Markovic abi_int shift; /* PPS interval duration (seconds) */ 22719f59bceSAleksandar Markovic abi_long stabil; /* PPS stability */ 22819f59bceSAleksandar Markovic abi_long jitcnt; /* PPS jitter limit exceeded (ro) */ 22919f59bceSAleksandar Markovic abi_long calcnt; /* PPS calibration intervals */ 23019f59bceSAleksandar Markovic abi_long errcnt; /* PPS calibration errors */ 23119f59bceSAleksandar Markovic abi_long stbcnt; /* PPS stability limit exceeded */ 23219f59bceSAleksandar Markovic abi_int tai; /* TAI offset */ 23319f59bceSAleksandar Markovic 23419f59bceSAleksandar Markovic /* Further padding bytes to allow for future expansion */ 23519f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; abi_int:32; 23619f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; abi_int:32; 23719f59bceSAleksandar Markovic abi_int:32; abi_int:32; abi_int:32; 23819f59bceSAleksandar Markovic }; 23919f59bceSAleksandar Markovic 240c227f099SAnthony Liguori typedef abi_long target_clock_t; 24132f36bceSbellard 242c596ed17Sbellard #define TARGET_HZ 100 243c596ed17Sbellard 24432f36bceSbellard struct target_tms { 245c227f099SAnthony Liguori target_clock_t tms_utime; 246c227f099SAnthony Liguori target_clock_t tms_stime; 247c227f099SAnthony Liguori target_clock_t tms_cutime; 248c227f099SAnthony Liguori target_clock_t tms_cstime; 24932f36bceSbellard }; 25032f36bceSbellard 2516180a181Sbellard struct target_utimbuf { 252992f48a0Sblueswir1 abi_long actime; 253992f48a0Sblueswir1 abi_long modtime; 2546180a181Sbellard }; 2556180a181Sbellard 256f2674e31Sbellard struct target_sel_arg_struct { 257992f48a0Sblueswir1 abi_long n; 258992f48a0Sblueswir1 abi_long inp, outp, exp; 259992f48a0Sblueswir1 abi_long tvp; 260f2674e31Sbellard }; 261f2674e31Sbellard 26231e31b8aSbellard struct target_iovec { 263992f48a0Sblueswir1 abi_long iov_base; /* Starting address */ 264992f48a0Sblueswir1 abi_long iov_len; /* Number of bytes */ 26531e31b8aSbellard }; 26631e31b8aSbellard 2671a9353d2Sbellard struct target_msghdr { 268992f48a0Sblueswir1 abi_long msg_name; /* Socket name */ 2691a9353d2Sbellard int msg_namelen; /* Length of name */ 270992f48a0Sblueswir1 abi_long msg_iov; /* Data blocks */ 271992f48a0Sblueswir1 abi_long msg_iovlen; /* Number of blocks */ 272992f48a0Sblueswir1 abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ 273992f48a0Sblueswir1 abi_long msg_controllen; /* Length of cmsg list */ 2741a9353d2Sbellard unsigned int msg_flags; 2751a9353d2Sbellard }; 2761a9353d2Sbellard 2777854b056Sbellard struct target_cmsghdr { 278992f48a0Sblueswir1 abi_long cmsg_len; 2797854b056Sbellard int cmsg_level; 2807854b056Sbellard int cmsg_type; 2817854b056Sbellard }; 2827854b056Sbellard 2837854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) 284ee104587SJonathan Neuschäfer #define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \ 285ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start) 286992f48a0Sblueswir1 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ 287992f48a0Sblueswir1 & (size_t) ~(sizeof (abi_long) - 1)) 2887854b056Sbellard #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \ 2897854b056Sbellard + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr))) 2907854b056Sbellard #define TARGET_CMSG_LEN(len) (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len)) 2917854b056Sbellard 2927854b056Sbellard static __inline__ struct target_cmsghdr * 293ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(struct target_msghdr *__mhdr, 294ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg, 295ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg_start) 2967854b056Sbellard { 2972b8bdefcSths struct target_cmsghdr *__ptr; 2987854b056Sbellard 2992b8bdefcSths __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg 300cbb21eedSMatthias Braun + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len))); 301ee104587SJonathan Neuschäfer if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start) 302ee104587SJonathan Neuschäfer > tswapal(__mhdr->msg_controllen)) { 3037854b056Sbellard /* No more entries. */ 3042b8bdefcSths return (struct target_cmsghdr *)0; 305ee104587SJonathan Neuschäfer } 306ee104587SJonathan Neuschäfer return __ptr; 3077854b056Sbellard } 3087854b056Sbellard 309f19e00d7SAlexander Graf struct target_mmsghdr { 310f19e00d7SAlexander Graf struct target_msghdr msg_hdr; /* Message header */ 311f19e00d7SAlexander Graf unsigned int msg_len; /* Number of bytes transmitted */ 312f19e00d7SAlexander Graf }; 3137854b056Sbellard 31431e31b8aSbellard struct target_rusage { 31531e31b8aSbellard struct target_timeval ru_utime; /* user time used */ 31631e31b8aSbellard struct target_timeval ru_stime; /* system time used */ 317992f48a0Sblueswir1 abi_long ru_maxrss; /* maximum resident set size */ 318992f48a0Sblueswir1 abi_long ru_ixrss; /* integral shared memory size */ 319992f48a0Sblueswir1 abi_long ru_idrss; /* integral unshared data size */ 320992f48a0Sblueswir1 abi_long ru_isrss; /* integral unshared stack size */ 321992f48a0Sblueswir1 abi_long ru_minflt; /* page reclaims */ 322992f48a0Sblueswir1 abi_long ru_majflt; /* page faults */ 323992f48a0Sblueswir1 abi_long ru_nswap; /* swaps */ 324992f48a0Sblueswir1 abi_long ru_inblock; /* block input operations */ 325992f48a0Sblueswir1 abi_long ru_oublock; /* block output operations */ 326992f48a0Sblueswir1 abi_long ru_msgsnd; /* messages sent */ 327992f48a0Sblueswir1 abi_long ru_msgrcv; /* messages received */ 328992f48a0Sblueswir1 abi_long ru_nsignals; /* signals received */ 329992f48a0Sblueswir1 abi_long ru_nvcsw; /* voluntary context switches */ 330992f48a0Sblueswir1 abi_long ru_nivcsw; /* involuntary " */ 33131e31b8aSbellard }; 33231e31b8aSbellard 33331e31b8aSbellard typedef struct { 33431e31b8aSbellard int val[2]; 335c227f099SAnthony Liguori } kernel_fsid_t; 33631e31b8aSbellard 33772f03900Sbellard struct kernel_statfs { 33831e31b8aSbellard int f_type; 33931e31b8aSbellard int f_bsize; 34031e31b8aSbellard int f_blocks; 34131e31b8aSbellard int f_bfree; 34231e31b8aSbellard int f_bavail; 34331e31b8aSbellard int f_files; 34431e31b8aSbellard int f_ffree; 345c227f099SAnthony Liguori kernel_fsid_t f_fsid; 34631e31b8aSbellard int f_namelen; 34731e31b8aSbellard int f_spare[6]; 34831e31b8aSbellard }; 34931e31b8aSbellard 350dab2ed99Sbellard struct target_dirent { 351992f48a0Sblueswir1 abi_long d_ino; 352992f48a0Sblueswir1 abi_long d_off; 353dab2ed99Sbellard unsigned short d_reclen; 354333858b7SDmitry V. Levin char d_name[]; 355dab2ed99Sbellard }; 356dab2ed99Sbellard 357dab2ed99Sbellard struct target_dirent64 { 358dab2ed99Sbellard uint64_t d_ino; 359dab2ed99Sbellard int64_t d_off; 360dab2ed99Sbellard unsigned short d_reclen; 361dab2ed99Sbellard unsigned char d_type; 362dab2ed99Sbellard char d_name[256]; 363dab2ed99Sbellard }; 364dab2ed99Sbellard 365dab2ed99Sbellard 36631e31b8aSbellard /* mostly generic signal stuff */ 367992f48a0Sblueswir1 #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ 368992f48a0Sblueswir1 #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ 369992f48a0Sblueswir1 #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ 37031e31b8aSbellard 37131e31b8aSbellard #ifdef TARGET_MIPS 37231e31b8aSbellard #define TARGET_NSIG 128 37331e31b8aSbellard #else 37431e31b8aSbellard #define TARGET_NSIG 64 37531e31b8aSbellard #endif 376992f48a0Sblueswir1 #define TARGET_NSIG_BPW TARGET_ABI_BITS 37731e31b8aSbellard #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) 37831e31b8aSbellard 37931e31b8aSbellard typedef struct { 380992f48a0Sblueswir1 abi_ulong sig[TARGET_NSIG_WORDS]; 381c227f099SAnthony Liguori } target_sigset_t; 38231e31b8aSbellard 38366fb9763Sbellard #ifdef BSWAP_NEEDED 384c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 38566fb9763Sbellard { 38666fb9763Sbellard int i; 38766fb9763Sbellard for(i = 0;i < TARGET_NSIG_WORDS; i++) 388cbb21eedSMatthias Braun d->sig[i] = tswapal(s->sig[i]); 38966fb9763Sbellard } 39066fb9763Sbellard #else 391c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 39266fb9763Sbellard { 39366fb9763Sbellard *d = *s; 39466fb9763Sbellard } 39566fb9763Sbellard #endif 39666fb9763Sbellard 397c227f099SAnthony Liguori static inline void target_siginitset(target_sigset_t *d, abi_ulong set) 39866fb9763Sbellard { 39966fb9763Sbellard int i; 40066fb9763Sbellard d->sig[0] = set; 40166fb9763Sbellard for(i = 1;i < TARGET_NSIG_WORDS; i++) 40266fb9763Sbellard d->sig[i] = 0; 40366fb9763Sbellard } 40466fb9763Sbellard 405c227f099SAnthony Liguori void host_to_target_sigset(target_sigset_t *d, const sigset_t *s); 406c227f099SAnthony Liguori void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); 407992f48a0Sblueswir1 void host_to_target_old_sigset(abi_ulong *old_sigset, 40866fb9763Sbellard const sigset_t *sigset); 40966fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset, 410992f48a0Sblueswir1 const abi_ulong *old_sigset); 41166fb9763Sbellard struct target_sigaction; 41266fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act, 41366fb9763Sbellard struct target_sigaction *oact); 41466fb9763Sbellard 415d2fbca94SGuan Xuetao #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \ 416d2fbca94SGuan Xuetao || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined(TARGET_SH4) \ 417d2fbca94SGuan Xuetao || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) \ 418a4c075f1SUlrich Hecht || defined(TARGET_MICROBLAZE) || defined(TARGET_UNICORE32) \ 419b16189b2SChen Gang || defined(TARGET_S390X) || defined(TARGET_OPENRISC) \ 420b16189b2SChen Gang || defined(TARGET_TILEGX) 4212521d698Sbellard 422048f6b4dSbellard #if defined(TARGET_SPARC) 423048f6b4dSbellard #define TARGET_SA_NOCLDSTOP 8u 424048f6b4dSbellard #define TARGET_SA_NOCLDWAIT 0x100u 425048f6b4dSbellard #define TARGET_SA_SIGINFO 0x200u 426048f6b4dSbellard #define TARGET_SA_ONSTACK 1u 427048f6b4dSbellard #define TARGET_SA_RESTART 2u 428048f6b4dSbellard #define TARGET_SA_NODEFER 0x20u 429048f6b4dSbellard #define TARGET_SA_RESETHAND 4u 430048f6b4dSbellard #elif defined(TARGET_MIPS) 431048f6b4dSbellard #define TARGET_SA_NOCLDSTOP 0x00000001 432048f6b4dSbellard #define TARGET_SA_NOCLDWAIT 0x00010000 433048f6b4dSbellard #define TARGET_SA_SIGINFO 0x00000008 434048f6b4dSbellard #define TARGET_SA_ONSTACK 0x08000000 435048f6b4dSbellard #define TARGET_SA_NODEFER 0x40000000 436048f6b4dSbellard #define TARGET_SA_RESTART 0x10000000 437048f6b4dSbellard #define TARGET_SA_RESETHAND 0x80000000 438d26bc211Sths #if !defined(TARGET_ABI_MIPSN32) && !defined(TARGET_ABI_MIPSN64) 439d26bc211Sths #define TARGET_SA_RESTORER 0x04000000 /* Only for O32 */ 440540635baSths #endif 441d962783eSJia Liu #elif defined(TARGET_OPENRISC) 442d962783eSJia Liu #define TARGET_SA_NOCLDSTOP 0x00000001 443d962783eSJia Liu #define TARGET_SA_NOCLDWAIT 0x00000002 444d962783eSJia Liu #define TARGET_SA_SIGINFO 0x00000004 445d962783eSJia Liu #define TARGET_SA_ONSTACK 0x08000000 446d962783eSJia Liu #define TARGET_SA_RESTART 0x10000000 447d962783eSJia Liu #define TARGET_SA_NODEFER 0x40000000 448d962783eSJia Liu #define TARGET_SA_RESETHAND 0x80000000 44957f18a95SRichard Henderson #elif defined(TARGET_ALPHA) 45057f18a95SRichard Henderson #define TARGET_SA_ONSTACK 0x00000001 45157f18a95SRichard Henderson #define TARGET_SA_RESTART 0x00000002 45257f18a95SRichard Henderson #define TARGET_SA_NOCLDSTOP 0x00000004 45357f18a95SRichard Henderson #define TARGET_SA_NODEFER 0x00000008 45457f18a95SRichard Henderson #define TARGET_SA_RESETHAND 0x00000010 45557f18a95SRichard Henderson #define TARGET_SA_NOCLDWAIT 0x00000020 /* not supported yet */ 45657f18a95SRichard Henderson #define TARGET_SA_SIGINFO 0x00000040 457048f6b4dSbellard #else 4582521d698Sbellard #define TARGET_SA_NOCLDSTOP 0x00000001 4592521d698Sbellard #define TARGET_SA_NOCLDWAIT 0x00000002 /* not supported yet */ 4602521d698Sbellard #define TARGET_SA_SIGINFO 0x00000004 4612521d698Sbellard #define TARGET_SA_ONSTACK 0x08000000 4622521d698Sbellard #define TARGET_SA_RESTART 0x10000000 4632521d698Sbellard #define TARGET_SA_NODEFER 0x40000000 4642521d698Sbellard #define TARGET_SA_RESETHAND 0x80000000 4652521d698Sbellard #define TARGET_SA_RESTORER 0x04000000 4666d5e216dSbellard #endif 4676d5e216dSbellard 468d0f20495SRichard Henderson #if defined(TARGET_ALPHA) 469d0f20495SRichard Henderson 470d0f20495SRichard Henderson #define TARGET_SIGHUP 1 471d0f20495SRichard Henderson #define TARGET_SIGINT 2 472d0f20495SRichard Henderson #define TARGET_SIGQUIT 3 473d0f20495SRichard Henderson #define TARGET_SIGILL 4 474d0f20495SRichard Henderson #define TARGET_SIGTRAP 5 475d0f20495SRichard Henderson #define TARGET_SIGABRT 6 476d0f20495SRichard Henderson #define TARGET_SIGSTKFLT 7 /* actually SIGEMT */ 477d0f20495SRichard Henderson #define TARGET_SIGFPE 8 478d0f20495SRichard Henderson #define TARGET_SIGKILL 9 479d0f20495SRichard Henderson #define TARGET_SIGBUS 10 480d0f20495SRichard Henderson #define TARGET_SIGSEGV 11 481d0f20495SRichard Henderson #define TARGET_SIGSYS 12 482d0f20495SRichard Henderson #define TARGET_SIGPIPE 13 483d0f20495SRichard Henderson #define TARGET_SIGALRM 14 484d0f20495SRichard Henderson #define TARGET_SIGTERM 15 485d0f20495SRichard Henderson #define TARGET_SIGURG 16 486d0f20495SRichard Henderson #define TARGET_SIGSTOP 17 487d0f20495SRichard Henderson #define TARGET_SIGTSTP 18 488d0f20495SRichard Henderson #define TARGET_SIGCONT 19 489d0f20495SRichard Henderson #define TARGET_SIGCHLD 20 490d0f20495SRichard Henderson #define TARGET_SIGTTIN 21 491d0f20495SRichard Henderson #define TARGET_SIGTTOU 22 492d0f20495SRichard Henderson #define TARGET_SIGIO 23 493d0f20495SRichard Henderson #define TARGET_SIGXCPU 24 494d0f20495SRichard Henderson #define TARGET_SIGXFSZ 25 495d0f20495SRichard Henderson #define TARGET_SIGVTALRM 26 496d0f20495SRichard Henderson #define TARGET_SIGPROF 27 497d0f20495SRichard Henderson #define TARGET_SIGWINCH 28 498d0f20495SRichard Henderson #define TARGET_SIGPWR 29 /* actually SIGINFO */ 499d0f20495SRichard Henderson #define TARGET_SIGUSR1 30 500d0f20495SRichard Henderson #define TARGET_SIGUSR2 31 501d0f20495SRichard Henderson #define TARGET_SIGRTMIN 32 502d0f20495SRichard Henderson 503d0f20495SRichard Henderson #define TARGET_SIG_BLOCK 1 504d0f20495SRichard Henderson #define TARGET_SIG_UNBLOCK 2 505d0f20495SRichard Henderson #define TARGET_SIG_SETMASK 3 506d0f20495SRichard Henderson 507d0f20495SRichard Henderson #elif defined(TARGET_SPARC) 5086d5e216dSbellard 5096d5e216dSbellard #define TARGET_SIGHUP 1 5106d5e216dSbellard #define TARGET_SIGINT 2 5116d5e216dSbellard #define TARGET_SIGQUIT 3 5126d5e216dSbellard #define TARGET_SIGILL 4 5136d5e216dSbellard #define TARGET_SIGTRAP 5 5146d5e216dSbellard #define TARGET_SIGABRT 6 5156d5e216dSbellard #define TARGET_SIGIOT 6 5166d5e216dSbellard #define TARGET_SIGSTKFLT 7 /* actually EMT */ 5176d5e216dSbellard #define TARGET_SIGFPE 8 5186d5e216dSbellard #define TARGET_SIGKILL 9 5196d5e216dSbellard #define TARGET_SIGBUS 10 5206d5e216dSbellard #define TARGET_SIGSEGV 11 5216d5e216dSbellard #define TARGET_SIGSYS 12 5226d5e216dSbellard #define TARGET_SIGPIPE 13 5236d5e216dSbellard #define TARGET_SIGALRM 14 5246d5e216dSbellard #define TARGET_SIGTERM 15 5256d5e216dSbellard #define TARGET_SIGURG 16 5266d5e216dSbellard #define TARGET_SIGSTOP 17 5276d5e216dSbellard #define TARGET_SIGTSTP 18 5286d5e216dSbellard #define TARGET_SIGCONT 19 5296d5e216dSbellard #define TARGET_SIGCHLD 20 5306d5e216dSbellard #define TARGET_SIGTTIN 21 5316d5e216dSbellard #define TARGET_SIGTTOU 22 5326d5e216dSbellard #define TARGET_SIGIO 23 5336d5e216dSbellard #define TARGET_SIGXCPU 24 5346d5e216dSbellard #define TARGET_SIGXFSZ 25 5356d5e216dSbellard #define TARGET_SIGVTALRM 26 5366d5e216dSbellard #define TARGET_SIGPROF 27 5376d5e216dSbellard #define TARGET_SIGWINCH 28 5386d5e216dSbellard #define TARGET_SIGPWR 29 5396d5e216dSbellard #define TARGET_SIGUSR1 30 5406d5e216dSbellard #define TARGET_SIGUSR2 31 5416d5e216dSbellard #define TARGET_SIGRTMIN 32 5426d5e216dSbellard 5436d5e216dSbellard #define TARGET_SIG_BLOCK 0x01 /* for blocking signals */ 5446d5e216dSbellard #define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */ 5456d5e216dSbellard #define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */ 5466d5e216dSbellard 547048f6b4dSbellard #elif defined(TARGET_MIPS) 548048f6b4dSbellard 549048f6b4dSbellard #define TARGET_SIGHUP 1 /* Hangup (POSIX). */ 550048f6b4dSbellard #define TARGET_SIGINT 2 /* Interrupt (ANSI). */ 551048f6b4dSbellard #define TARGET_SIGQUIT 3 /* Quit (POSIX). */ 552048f6b4dSbellard #define TARGET_SIGILL 4 /* Illegal instruction (ANSI). */ 553048f6b4dSbellard #define TARGET_SIGTRAP 5 /* Trace trap (POSIX). */ 554048f6b4dSbellard #define TARGET_SIGIOT 6 /* IOT trap (4.2 BSD). */ 555048f6b4dSbellard #define TARGET_SIGABRT TARGET_SIGIOT /* Abort (ANSI). */ 556048f6b4dSbellard #define TARGET_SIGEMT 7 557048f6b4dSbellard #define TARGET_SIGSTKFLT 7 /* XXX: incorrect */ 558048f6b4dSbellard #define TARGET_SIGFPE 8 /* Floating-point exception (ANSI). */ 559048f6b4dSbellard #define TARGET_SIGKILL 9 /* Kill, unblockable (POSIX). */ 560048f6b4dSbellard #define TARGET_SIGBUS 10 /* BUS error (4.2 BSD). */ 561048f6b4dSbellard #define TARGET_SIGSEGV 11 /* Segmentation violation (ANSI). */ 562048f6b4dSbellard #define TARGET_SIGSYS 12 563048f6b4dSbellard #define TARGET_SIGPIPE 13 /* Broken pipe (POSIX). */ 564048f6b4dSbellard #define TARGET_SIGALRM 14 /* Alarm clock (POSIX). */ 565048f6b4dSbellard #define TARGET_SIGTERM 15 /* Termination (ANSI). */ 566048f6b4dSbellard #define TARGET_SIGUSR1 16 /* User-defined signal 1 (POSIX). */ 567048f6b4dSbellard #define TARGET_SIGUSR2 17 /* User-defined signal 2 (POSIX). */ 568048f6b4dSbellard #define TARGET_SIGCHLD 18 /* Child status has changed (POSIX). */ 569048f6b4dSbellard #define TARGET_SIGCLD TARGET_SIGCHLD /* Same as TARGET_SIGCHLD (System V). */ 570048f6b4dSbellard #define TARGET_SIGPWR 19 /* Power failure restart (System V). */ 571048f6b4dSbellard #define TARGET_SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */ 572048f6b4dSbellard #define TARGET_SIGURG 21 /* Urgent condition on socket (4.2 BSD). */ 573048f6b4dSbellard #define TARGET_SIGIO 22 /* I/O now possible (4.2 BSD). */ 574048f6b4dSbellard #define TARGET_SIGPOLL TARGET_SIGIO /* Pollable event occurred (System V). */ 575048f6b4dSbellard #define TARGET_SIGSTOP 23 /* Stop, unblockable (POSIX). */ 576048f6b4dSbellard #define TARGET_SIGTSTP 24 /* Keyboard stop (POSIX). */ 577048f6b4dSbellard #define TARGET_SIGCONT 25 /* Continue (POSIX). */ 578048f6b4dSbellard #define TARGET_SIGTTIN 26 /* Background read from tty (POSIX). */ 579048f6b4dSbellard #define TARGET_SIGTTOU 27 /* Background write to tty (POSIX). */ 580048f6b4dSbellard #define TARGET_SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */ 581048f6b4dSbellard #define TARGET_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */ 582048f6b4dSbellard #define TARGET_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ 583048f6b4dSbellard #define TARGET_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ 584048f6b4dSbellard #define TARGET_SIGRTMIN 32 585048f6b4dSbellard 586048f6b4dSbellard #define TARGET_SIG_BLOCK 1 /* for blocking signals */ 587048f6b4dSbellard #define TARGET_SIG_UNBLOCK 2 /* for unblocking signals */ 588048f6b4dSbellard #define TARGET_SIG_SETMASK 3 /* for setting the signal mask */ 589048f6b4dSbellard 5906d5e216dSbellard #else 5912521d698Sbellard 592d962783eSJia Liu /* OpenRISC Using the general signals */ 5932521d698Sbellard #define TARGET_SIGHUP 1 5942521d698Sbellard #define TARGET_SIGINT 2 5952521d698Sbellard #define TARGET_SIGQUIT 3 5962521d698Sbellard #define TARGET_SIGILL 4 5972521d698Sbellard #define TARGET_SIGTRAP 5 5982521d698Sbellard #define TARGET_SIGABRT 6 5992521d698Sbellard #define TARGET_SIGIOT 6 6002521d698Sbellard #define TARGET_SIGBUS 7 6012521d698Sbellard #define TARGET_SIGFPE 8 6022521d698Sbellard #define TARGET_SIGKILL 9 6032521d698Sbellard #define TARGET_SIGUSR1 10 6042521d698Sbellard #define TARGET_SIGSEGV 11 6052521d698Sbellard #define TARGET_SIGUSR2 12 6062521d698Sbellard #define TARGET_SIGPIPE 13 6072521d698Sbellard #define TARGET_SIGALRM 14 6082521d698Sbellard #define TARGET_SIGTERM 15 6092521d698Sbellard #define TARGET_SIGSTKFLT 16 6102521d698Sbellard #define TARGET_SIGCHLD 17 6112521d698Sbellard #define TARGET_SIGCONT 18 6122521d698Sbellard #define TARGET_SIGSTOP 19 6132521d698Sbellard #define TARGET_SIGTSTP 20 6142521d698Sbellard #define TARGET_SIGTTIN 21 6152521d698Sbellard #define TARGET_SIGTTOU 22 6162521d698Sbellard #define TARGET_SIGURG 23 6172521d698Sbellard #define TARGET_SIGXCPU 24 6182521d698Sbellard #define TARGET_SIGXFSZ 25 6192521d698Sbellard #define TARGET_SIGVTALRM 26 6202521d698Sbellard #define TARGET_SIGPROF 27 6212521d698Sbellard #define TARGET_SIGWINCH 28 6222521d698Sbellard #define TARGET_SIGIO 29 623c596ed17Sbellard #define TARGET_SIGPWR 30 624c596ed17Sbellard #define TARGET_SIGSYS 31 6252521d698Sbellard #define TARGET_SIGRTMIN 32 6262521d698Sbellard 6272521d698Sbellard #define TARGET_SIG_BLOCK 0 /* for blocking signals */ 6282521d698Sbellard #define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */ 6292521d698Sbellard #define TARGET_SIG_SETMASK 2 /* for setting the signal mask */ 6302521d698Sbellard 6316d5e216dSbellard #endif 6326d5e216dSbellard 6336049f4f8SRichard Henderson #if defined(TARGET_ALPHA) 6346049f4f8SRichard Henderson struct target_old_sigaction { 6356049f4f8SRichard Henderson abi_ulong _sa_handler; 6366049f4f8SRichard Henderson abi_ulong sa_mask; 637d2565875SRichard Henderson int32_t sa_flags; 6386049f4f8SRichard Henderson }; 639106ec879Sbellard 6406049f4f8SRichard Henderson struct target_rt_sigaction { 6416049f4f8SRichard Henderson abi_ulong _sa_handler; 6426049f4f8SRichard Henderson abi_ulong sa_flags; 6436049f4f8SRichard Henderson target_sigset_t sa_mask; 6446049f4f8SRichard Henderson }; 6456049f4f8SRichard Henderson 6466049f4f8SRichard Henderson /* This is the struct used inside the kernel. The ka_restorer 6476049f4f8SRichard Henderson field comes from the 5th argument to sys_rt_sigaction. */ 6486049f4f8SRichard Henderson struct target_sigaction { 6496049f4f8SRichard Henderson abi_ulong _sa_handler; 6506049f4f8SRichard Henderson abi_ulong sa_flags; 6516049f4f8SRichard Henderson target_sigset_t sa_mask; 6526049f4f8SRichard Henderson abi_ulong sa_restorer; 6536049f4f8SRichard Henderson }; 6546049f4f8SRichard Henderson #elif defined(TARGET_MIPS) 655106ec879Sbellard struct target_sigaction { 656540635baSths uint32_t sa_flags; 657d26bc211Sths #if defined(TARGET_ABI_MIPSN32) 658540635baSths uint32_t _sa_handler; 659540635baSths #else 660992f48a0Sblueswir1 abi_ulong _sa_handler; 661540635baSths #endif 662c227f099SAnthony Liguori target_sigset_t sa_mask; 663106ec879Sbellard }; 664106ec879Sbellard #else 6652521d698Sbellard struct target_old_sigaction { 666992f48a0Sblueswir1 abi_ulong _sa_handler; 667992f48a0Sblueswir1 abi_ulong sa_mask; 668992f48a0Sblueswir1 abi_ulong sa_flags; 669992f48a0Sblueswir1 abi_ulong sa_restorer; 6702521d698Sbellard }; 6712521d698Sbellard 6722521d698Sbellard struct target_sigaction { 673992f48a0Sblueswir1 abi_ulong _sa_handler; 674992f48a0Sblueswir1 abi_ulong sa_flags; 675992f48a0Sblueswir1 abi_ulong sa_restorer; 676c227f099SAnthony Liguori target_sigset_t sa_mask; 6772521d698Sbellard }; 678106ec879Sbellard #endif 6792521d698Sbellard 6802521d698Sbellard typedef union target_sigval { 6812521d698Sbellard int sival_int; 682992f48a0Sblueswir1 abi_ulong sival_ptr; 683c227f099SAnthony Liguori } target_sigval_t; 6846d5e216dSbellard #if 0 6856d5e216dSbellard #if defined (TARGET_SPARC) 6866d5e216dSbellard typedef struct { 6876d5e216dSbellard struct { 688992f48a0Sblueswir1 abi_ulong psr; 689992f48a0Sblueswir1 abi_ulong pc; 690992f48a0Sblueswir1 abi_ulong npc; 691992f48a0Sblueswir1 abi_ulong y; 692992f48a0Sblueswir1 abi_ulong u_regs[16]; /* globals and ins */ 6936d5e216dSbellard } si_regs; 6946d5e216dSbellard int si_mask; 6956d5e216dSbellard } __siginfo_t; 6966d5e216dSbellard 6976d5e216dSbellard typedef struct { 6986d5e216dSbellard unsigned long si_float_regs [32]; 6996d5e216dSbellard unsigned long si_fsr; 7006d5e216dSbellard unsigned long si_fpqdepth; 7016d5e216dSbellard struct { 7026d5e216dSbellard unsigned long *insn_addr; 7036d5e216dSbellard unsigned long insn; 7046d5e216dSbellard } si_fpqueue [16]; 7056d5e216dSbellard } __siginfo_fpu_t; 7066d5e216dSbellard #endif 7076d5e216dSbellard #endif 7082521d698Sbellard 7092521d698Sbellard #define TARGET_SI_MAX_SIZE 128 710aa5e03d2SMaxim Ostapenko 711aa5e03d2SMaxim Ostapenko #if TARGET_ABI_BITS == 32 712aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int)) 713aa5e03d2SMaxim Ostapenko #else 714aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int)) 715aa5e03d2SMaxim Ostapenko #endif 716aa5e03d2SMaxim Ostapenko 717aa5e03d2SMaxim Ostapenko #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int)) 7182521d698Sbellard 719a70dadc7SPeter Maydell /* Within QEMU the top 16 bits of si_code indicate which of the parts of 720a70dadc7SPeter Maydell * the union in target_siginfo is valid. This only applies between 721a70dadc7SPeter Maydell * host_to_target_siginfo_noswap() and tswap_siginfo(); it does not 722a70dadc7SPeter Maydell * appear either within host siginfo_t or in target_siginfo structures 723a70dadc7SPeter Maydell * which we get from the guest userspace program. (The Linux kernel 724a70dadc7SPeter Maydell * does a similar thing with using the top bits for its own internal 725a70dadc7SPeter Maydell * purposes but not letting them be visible to userspace.) 726a70dadc7SPeter Maydell */ 727a70dadc7SPeter Maydell #define QEMU_SI_KILL 0 728a70dadc7SPeter Maydell #define QEMU_SI_TIMER 1 729a70dadc7SPeter Maydell #define QEMU_SI_POLL 2 730a70dadc7SPeter Maydell #define QEMU_SI_FAULT 3 731a70dadc7SPeter Maydell #define QEMU_SI_CHLD 4 732a70dadc7SPeter Maydell #define QEMU_SI_RT 5 733a70dadc7SPeter Maydell 7342521d698Sbellard typedef struct target_siginfo { 7353f53d546Spbrook #ifdef TARGET_MIPS 7363f53d546Spbrook int si_signo; 7373f53d546Spbrook int si_code; 7383f53d546Spbrook int si_errno; 7393f53d546Spbrook #else 7402521d698Sbellard int si_signo; 7412521d698Sbellard int si_errno; 7422521d698Sbellard int si_code; 7433f53d546Spbrook #endif 7442521d698Sbellard 7452521d698Sbellard union { 7462521d698Sbellard int _pad[TARGET_SI_PAD_SIZE]; 7472521d698Sbellard 7482521d698Sbellard /* kill() */ 7492521d698Sbellard struct { 7502521d698Sbellard pid_t _pid; /* sender's pid */ 7512521d698Sbellard uid_t _uid; /* sender's uid */ 7522521d698Sbellard } _kill; 7532521d698Sbellard 7542521d698Sbellard /* POSIX.1b timers */ 7552521d698Sbellard struct { 7562521d698Sbellard unsigned int _timer1; 7572521d698Sbellard unsigned int _timer2; 7582521d698Sbellard } _timer; 7592521d698Sbellard 7602521d698Sbellard /* POSIX.1b signals */ 7612521d698Sbellard struct { 7622521d698Sbellard pid_t _pid; /* sender's pid */ 7632521d698Sbellard uid_t _uid; /* sender's uid */ 764c227f099SAnthony Liguori target_sigval_t _sigval; 7652521d698Sbellard } _rt; 7662521d698Sbellard 7672521d698Sbellard /* SIGCHLD */ 7682521d698Sbellard struct { 7692521d698Sbellard pid_t _pid; /* which child */ 7702521d698Sbellard uid_t _uid; /* sender's uid */ 7712521d698Sbellard int _status; /* exit code */ 772c227f099SAnthony Liguori target_clock_t _utime; 773c227f099SAnthony Liguori target_clock_t _stime; 7742521d698Sbellard } _sigchld; 7752521d698Sbellard 7762521d698Sbellard /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 7772521d698Sbellard struct { 778992f48a0Sblueswir1 abi_ulong _addr; /* faulting insn/memory ref. */ 7792521d698Sbellard } _sigfault; 7802521d698Sbellard 7812521d698Sbellard /* SIGPOLL */ 7822521d698Sbellard struct { 7832521d698Sbellard int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 7842521d698Sbellard int _fd; 7852521d698Sbellard } _sigpoll; 7862521d698Sbellard } _sifields; 787c227f099SAnthony Liguori } target_siginfo_t; 7882521d698Sbellard 7892521d698Sbellard /* 7902521d698Sbellard * si_code values 7912521d698Sbellard * Digital reserves positive values for kernel-generated signals. 7922521d698Sbellard */ 7932521d698Sbellard #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ 7942521d698Sbellard #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 7952521d698Sbellard #define TARGET_SI_QUEUE -1 /* sent by sigqueue */ 7962521d698Sbellard #define TARGET_SI_TIMER -2 /* sent by timer expiration */ 7972521d698Sbellard #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ 7982521d698Sbellard #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ 7992521d698Sbellard #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ 8002521d698Sbellard 8012521d698Sbellard /* 8022521d698Sbellard * SIGILL si_codes 8032521d698Sbellard */ 804ffa65c3bSbellard #define TARGET_ILL_ILLOPC (1) /* illegal opcode */ 8052521d698Sbellard #define TARGET_ILL_ILLOPN (2) /* illegal operand */ 806ffa65c3bSbellard #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ 807ffa65c3bSbellard #define TARGET_ILL_ILLTRP (4) /* illegal trap */ 808ffa65c3bSbellard #define TARGET_ILL_PRVOPC (5) /* privileged opcode */ 809ffa65c3bSbellard #define TARGET_ILL_PRVREG (6) /* privileged register */ 810ffa65c3bSbellard #define TARGET_ILL_COPROC (7) /* coprocessor error */ 811ffa65c3bSbellard #define TARGET_ILL_BADSTK (8) /* internal stack error */ 812de2fdd56SChen Gang #ifdef TARGET_TILEGX 813de2fdd56SChen Gang #define TARGET_ILL_DBLFLT (9) /* double fault */ 814de2fdd56SChen Gang #define TARGET_ILL_HARDWALL (10) /* user networks hardwall violation */ 815de2fdd56SChen Gang #endif 8162521d698Sbellard 8172521d698Sbellard /* 8182521d698Sbellard * SIGFPE si_codes 8192521d698Sbellard */ 8202521d698Sbellard #define TARGET_FPE_INTDIV (1) /* integer divide by zero */ 8212521d698Sbellard #define TARGET_FPE_INTOVF (2) /* integer overflow */ 8222521d698Sbellard #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ 8232521d698Sbellard #define TARGET_FPE_FLTOVF (4) /* floating point overflow */ 8242521d698Sbellard #define TARGET_FPE_FLTUND (5) /* floating point underflow */ 8252521d698Sbellard #define TARGET_FPE_FLTRES (6) /* floating point inexact result */ 8262521d698Sbellard #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ 8272521d698Sbellard #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ 8282521d698Sbellard #define TARGET_NSIGFPE 8 8292521d698Sbellard 8302521d698Sbellard /* 8312521d698Sbellard * SIGSEGV si_codes 8322521d698Sbellard */ 8332521d698Sbellard #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ 8342521d698Sbellard #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ 835de2fdd56SChen Gang #define TARGET_SEGV_BNDERR (3) /* failed address bound checks */ 8362521d698Sbellard 8372521d698Sbellard /* 838ffa65c3bSbellard * SIGBUS si_codes 839ffa65c3bSbellard */ 840ffa65c3bSbellard #define TARGET_BUS_ADRALN (1) /* invalid address alignment */ 841b4916d7bSDong Xu Wang #define TARGET_BUS_ADRERR (2) /* non-existent physical address */ 842ffa65c3bSbellard #define TARGET_BUS_OBJERR (3) /* object specific hardware error */ 843de2fdd56SChen Gang /* hardware memory error consumed on a machine check: action required */ 844de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AR (4) 845de2fdd56SChen Gang /* hardware memory error detected in process but not consumed: action optional*/ 846de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AO (5) 847ffa65c3bSbellard 848ffa65c3bSbellard /* 8492521d698Sbellard * SIGTRAP si_codes 8502521d698Sbellard */ 8512521d698Sbellard #define TARGET_TRAP_BRKPT (1) /* process breakpoint */ 8522521d698Sbellard #define TARGET_TRAP_TRACE (2) /* process trace trap */ 853de2fdd56SChen Gang #define TARGET_TRAP_BRANCH (3) /* process taken branch trap */ 854de2fdd56SChen Gang #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */ 8552521d698Sbellard 8562521d698Sbellard #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */ 8572521d698Sbellard 8589de5e440Sbellard struct target_rlimit { 859992f48a0Sblueswir1 abi_ulong rlim_cur; 860992f48a0Sblueswir1 abi_ulong rlim_max; 8619de5e440Sbellard }; 8629de5e440Sbellard 86381bbe906Stakasi-y@ops.dti.ne.jp #if defined(TARGET_ALPHA) 864e476492eSAurelien Jarno #define TARGET_RLIM_INFINITY 0x7fffffffffffffffull 8656cafd027SMatthias Braun #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32) 86681bbe906Stakasi-y@ops.dti.ne.jp #define TARGET_RLIM_INFINITY 0x7fffffffUL 86781bbe906Stakasi-y@ops.dti.ne.jp #else 86826b746dbSMatthias Braun #define TARGET_RLIM_INFINITY ((abi_ulong)-1) 86981bbe906Stakasi-y@ops.dti.ne.jp #endif 87081bbe906Stakasi-y@ops.dti.ne.jp 871e22b7015SWesley W. Terpstra #if defined(TARGET_MIPS) 872e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 873e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 874e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 875e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 876e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 877e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 7 878e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 8 879e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 5 880e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 9 881e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 6 882e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 883e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 884e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 885e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 886e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 887e22b7015SWesley W. Terpstra #else 888e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 889e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 890e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 891e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 892e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 893e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 5 8946cafd027SMatthias Braun #if defined(TARGET_SPARC) 8956cafd027SMatthias Braun #define TARGET_RLIMIT_NOFILE 6 8966cafd027SMatthias Braun #define TARGET_RLIMIT_NPROC 7 8976cafd027SMatthias Braun #else 898e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 6 899e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 7 9006cafd027SMatthias Braun #endif 901e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 8 902e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 9 903e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 904e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 905e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 906e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 907e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 908e22b7015SWesley W. Terpstra #endif 909e22b7015SWesley W. Terpstra 9109de5e440Sbellard struct target_pollfd { 9119de5e440Sbellard int fd; /* file descriptor */ 9129de5e440Sbellard short events; /* requested events */ 9139de5e440Sbellard short revents; /* returned events */ 9149de5e440Sbellard }; 9159de5e440Sbellard 9168e5a0667Sbellard /* virtual terminal ioctls */ 9170221cfcdSbellard #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ 9180221cfcdSbellard #define TARGET_KDMKTONE 0x4B30 /* generate tone */ 9198e5a0667Sbellard #define TARGET_KDGKBTYPE 0x4b33 920f7680a55SUlrich Hecht #define TARGET_KDSETMODE 0x4b3a 921f7680a55SUlrich Hecht #define TARGET_KDGKBMODE 0x4b44 922f7680a55SUlrich Hecht #define TARGET_KDSKBMODE 0x4b45 9230221cfcdSbellard #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ 9240221cfcdSbellard #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ 925e6fe18fbSCédric VINCENT #define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ 926e6fe18fbSCédric VINCENT #define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ 927e6fe18fbSCédric VINCENT #define TARGET_KDGETLED 0x4B31 /* return current led state */ 928e6fe18fbSCédric VINCENT #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */ 929ca56f5b5SPaul Burton #define TARGET_KDSIGACCEPT 0x4B4E 9308e5a0667Sbellard 931e1be1606SAleksandar Markovic #if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) 932e1be1606SAleksandar Markovic #define TARGET_SIOCATMARK TARGET_IOR('s', 7, int) 933e1be1606SAleksandar Markovic #else 9342521d698Sbellard #define TARGET_SIOCATMARK 0x8905 935e1be1606SAleksandar Markovic #endif 9362521d698Sbellard 93731e31b8aSbellard /* Networking ioctls */ 93831e31b8aSbellard #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ 93931e31b8aSbellard #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ 94031e31b8aSbellard #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ 94131e31b8aSbellard #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ 94231e31b8aSbellard #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ 94331e31b8aSbellard #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ 94431e31b8aSbellard #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ 94531e31b8aSbellard #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ 94631e31b8aSbellard #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ 94731e31b8aSbellard #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ 94831e31b8aSbellard #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ 94931e31b8aSbellard #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ 95031e31b8aSbellard #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ 95131e31b8aSbellard #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ 95231e31b8aSbellard #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ 95331e31b8aSbellard #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ 95431e31b8aSbellard #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ 95531e31b8aSbellard #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ 95631e31b8aSbellard #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ 95731e31b8aSbellard #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ 95831e31b8aSbellard #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ 95931e31b8aSbellard #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ 96031e31b8aSbellard #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ 96131e31b8aSbellard #define TARGET_SIOCSIFENCAP 0x8926 96231e31b8aSbellard #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ 96331e31b8aSbellard #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ 96431e31b8aSbellard #define TARGET_SIOCSIFSLAVE 0x8930 96531e31b8aSbellard #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ 96631e31b8aSbellard #define TARGET_SIOCDELMULTI 0x8932 967f63eb01aSPaul Burton #define TARGET_SIOCGIFINDEX 0x8933 96831e31b8aSbellard 96931e31b8aSbellard /* Bridging control calls */ 97031e31b8aSbellard #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ 97131e31b8aSbellard #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ 97231e31b8aSbellard 97331e31b8aSbellard #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ 97431e31b8aSbellard #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ 97531e31b8aSbellard 97631e31b8aSbellard /* ARP cache control calls. */ 97731e31b8aSbellard #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ 97831e31b8aSbellard #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ 97931e31b8aSbellard #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ 98031e31b8aSbellard #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ 98131e31b8aSbellard #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ 98231e31b8aSbellard #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ 98331e31b8aSbellard 98431e31b8aSbellard /* RARP cache control calls. */ 98531e31b8aSbellard #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ 98631e31b8aSbellard #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ 98731e31b8aSbellard #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ 98831e31b8aSbellard 98931e31b8aSbellard /* Driver configuration calls */ 99031e31b8aSbellard #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ 99131e31b8aSbellard #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ 99231e31b8aSbellard 99331e31b8aSbellard /* DLCI configuration calls */ 99431e31b8aSbellard #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ 99531e31b8aSbellard #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ 99631e31b8aSbellard 99786fcd946SLaurent Vivier /* From <linux/wireless.h> */ 99886fcd946SLaurent Vivier 99986fcd946SLaurent Vivier #define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ 100031e31b8aSbellard 100131e31b8aSbellard /* From <linux/fs.h> */ 100231e31b8aSbellard 100331e31b8aSbellard #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ 100431e31b8aSbellard #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ 100531e31b8aSbellard #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ 100631e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ 100731e31b8aSbellard #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ 100831e31b8aSbellard #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ 100931e31b8aSbellard #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ 101031e31b8aSbellard #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ 101131e31b8aSbellard #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ 101231e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ 101331e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ 101431e31b8aSbellard #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ 1015fff8c539SAndreas Färber #define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */ 101631e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */ 1017c8b0bf54SPeter Maydell #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong) 1018c8b0bf54SPeter Maydell #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong) 1019edafea13SAlexander Graf #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) 1020edafea13SAlexander Graf /* return device size in bytes 1021edafea13SAlexander Graf (u64 *arg) */ 10224715856aSPeter Maydell 10234715856aSPeter Maydell #define TARGET_BLKDISCARD TARGET_IO(0x12, 119) 10244715856aSPeter Maydell #define TARGET_BLKIOMIN TARGET_IO(0x12, 120) 10254715856aSPeter Maydell #define TARGET_BLKIOOPT TARGET_IO(0x12, 121) 10264715856aSPeter Maydell #define TARGET_BLKALIGNOFF TARGET_IO(0x12, 122) 10274715856aSPeter Maydell #define TARGET_BLKPBSZGET TARGET_IO(0x12, 123) 10284715856aSPeter Maydell #define TARGET_BLKDISCARDZEROES TARGET_IO(0x12, 124) 10294715856aSPeter Maydell #define TARGET_BLKSECDISCARD TARGET_IO(0x12, 125) 10304715856aSPeter Maydell #define TARGET_BLKROTATIONAL TARGET_IO(0x12, 126) 10314715856aSPeter Maydell #define TARGET_BLKZEROOUT TARGET_IO(0x12, 127) 10324715856aSPeter Maydell 103331e31b8aSbellard #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ 103431e31b8aSbellard #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ 103560807231SPeter Maydell /* Note that the ioctl numbers claim type "long" but the actual type 103660807231SPeter Maydell * used by the kernel is "int". 103760807231SPeter Maydell */ 103860807231SPeter Maydell #define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, long) 103960807231SPeter Maydell #define TARGET_FS_IOC_SETFLAGS TARGET_IOW('f', 2, long) 104060807231SPeter Maydell 1041285da2b9SPeter Maydell #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) 104231e31b8aSbellard 104331e31b8aSbellard /* cdrom commands */ 104431e31b8aSbellard #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ 104531e31b8aSbellard #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ 104631e31b8aSbellard #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ 104731e31b8aSbellard #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index 104831e31b8aSbellard (struct cdrom_ti) */ 104931e31b8aSbellard #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header 105031e31b8aSbellard (struct cdrom_tochdr) */ 105131e31b8aSbellard #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry 105231e31b8aSbellard (struct cdrom_tocentry) */ 105331e31b8aSbellard #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ 105431e31b8aSbellard #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ 105531e31b8aSbellard #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ 105631e31b8aSbellard #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume 105731e31b8aSbellard (struct cdrom_volctrl) */ 105831e31b8aSbellard #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data 105931e31b8aSbellard (struct cdrom_subchnl) */ 106031e31b8aSbellard #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) 106131e31b8aSbellard (struct cdrom_read) */ 106231e31b8aSbellard #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) 106331e31b8aSbellard (struct cdrom_read) */ 106431e31b8aSbellard #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ 106531e31b8aSbellard #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ 106631e31b8aSbellard #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session 106731e31b8aSbellard address of multi session disks 106831e31b8aSbellard (struct cdrom_multisession) */ 106931e31b8aSbellard #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" 107031e31b8aSbellard if available (struct cdrom_mcn) */ 107167cc32ebSVeres Lajos #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is deprecated, 1072b4916d7bSDong Xu Wang but here anyway for compatibility */ 107331e31b8aSbellard #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ 107431e31b8aSbellard #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting 107531e31b8aSbellard (struct cdrom_volctrl) */ 107631e31b8aSbellard #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) 107731e31b8aSbellard (struct cdrom_read) */ 107831e31b8aSbellard /* 107931e31b8aSbellard * These ioctls are used only used in aztcd.c and optcd.c 108031e31b8aSbellard */ 108131e31b8aSbellard #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ 108231e31b8aSbellard #define TARGET_CDROMSEEK 0x5316 /* seek msf address */ 108331e31b8aSbellard 108431e31b8aSbellard /* 108531e31b8aSbellard * This ioctl is only used by the scsi-cd driver. 108631e31b8aSbellard It is for playing audio in logical block addressing mode. 108731e31b8aSbellard */ 108831e31b8aSbellard #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ 108931e31b8aSbellard 109031e31b8aSbellard /* 109131e31b8aSbellard * These ioctls are only used in optcd.c 109231e31b8aSbellard */ 109331e31b8aSbellard #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ 109431e31b8aSbellard 109531e31b8aSbellard /* 109631e31b8aSbellard * These ioctls are (now) only in ide-cd.c for controlling 109731e31b8aSbellard * drive spindown time. They should be implemented in the 109831e31b8aSbellard * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, 109931e31b8aSbellard * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... 110031e31b8aSbellard * -Erik 110131e31b8aSbellard */ 110231e31b8aSbellard #define TARGET_CDROMGETSPINDOWN 0x531d 110331e31b8aSbellard #define TARGET_CDROMSETSPINDOWN 0x531e 110431e31b8aSbellard 110531e31b8aSbellard /* 110631e31b8aSbellard * These ioctls are implemented through the uniform CD-ROM driver 110731e31b8aSbellard * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM 110831e31b8aSbellard * drivers are eventually ported to the uniform CD-ROM driver interface. 110931e31b8aSbellard */ 111031e31b8aSbellard #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ 111131e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ 111231e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ 111331e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ 111431e31b8aSbellard #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ 111531e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ 111631e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ 111731e31b8aSbellard #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ 111831e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ 111931e31b8aSbellard #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ 112031e31b8aSbellard #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ 112131e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ 112231e31b8aSbellard 112331e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. 112431e31b8aSbellard * Future CDROM ioctls should be kept below 0x537F 112531e31b8aSbellard */ 112631e31b8aSbellard 112731e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */ 112831e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ 112931e31b8aSbellard /* conflict with SCSI_IOCTL_GET_IDLUN */ 113031e31b8aSbellard 113131e31b8aSbellard /* DVD-ROM Specific ioctls */ 113231e31b8aSbellard #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ 113331e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ 113431e31b8aSbellard #define TARGET_DVD_AUTH 0x5392 /* Authentication */ 113531e31b8aSbellard 113631e31b8aSbellard #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ 113731e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ 113831e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ 113931e31b8aSbellard 114031e31b8aSbellard /* HD commands */ 114131e31b8aSbellard 114231e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ 114331e31b8aSbellard #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ 114431e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ 114531e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ 114631e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ 114731e31b8aSbellard #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ 114831e31b8aSbellard #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ 114931e31b8aSbellard #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ 11502521d698Sbellard #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ 115131e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ 115231e31b8aSbellard 115331e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ 115431e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ 115531e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ 115631e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ 115731e31b8aSbellard #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ 115831e31b8aSbellard #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ 115931e31b8aSbellard #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ 116031e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ 11612521d698Sbellard 1162b8005914Sbalrog /* loop ioctls */ 1163b8005914Sbalrog #define TARGET_LOOP_SET_FD 0x4C00 1164b8005914Sbalrog #define TARGET_LOOP_CLR_FD 0x4C01 1165b8005914Sbalrog #define TARGET_LOOP_SET_STATUS 0x4C02 1166b8005914Sbalrog #define TARGET_LOOP_GET_STATUS 0x4C03 1167b8005914Sbalrog #define TARGET_LOOP_SET_STATUS64 0x4C04 1168b8005914Sbalrog #define TARGET_LOOP_GET_STATUS64 0x4C05 1169b8005914Sbalrog #define TARGET_LOOP_CHANGE_FD 0x4C06 11702521d698Sbellard 1171884cdc48SPeter Maydell #define TARGET_LOOP_CTL_ADD 0x4C80 1172884cdc48SPeter Maydell #define TARGET_LOOP_CTL_REMOVE 0x4C81 1173884cdc48SPeter Maydell #define TARGET_LOOP_CTL_GET_FREE 0x4C82 1174884cdc48SPeter Maydell 1175f7680a55SUlrich Hecht /* fb ioctls */ 1176f7680a55SUlrich Hecht #define TARGET_FBIOGET_VSCREENINFO 0x4600 1177f7680a55SUlrich Hecht #define TARGET_FBIOPUT_VSCREENINFO 0x4601 1178f7680a55SUlrich Hecht #define TARGET_FBIOGET_FSCREENINFO 0x4602 117912b81b71SCédric VINCENT #define TARGET_FBIOGETCMAP 0x4604 118012b81b71SCédric VINCENT #define TARGET_FBIOPUTCMAP 0x4605 118112b81b71SCédric VINCENT #define TARGET_FBIOPAN_DISPLAY 0x4606 118212b81b71SCédric VINCENT #define TARGET_FBIOGET_CON2FBMAP 0x460F 118312b81b71SCédric VINCENT #define TARGET_FBIOPUT_CON2FBMAP 0x4610 1184f7680a55SUlrich Hecht 1185f7680a55SUlrich Hecht /* vt ioctls */ 1186f7680a55SUlrich Hecht #define TARGET_VT_OPENQRY 0x5600 1187f7680a55SUlrich Hecht #define TARGET_VT_GETSTATE 0x5603 1188f7680a55SUlrich Hecht #define TARGET_VT_ACTIVATE 0x5606 1189f7680a55SUlrich Hecht #define TARGET_VT_WAITACTIVE 0x5607 1190f7680a55SUlrich Hecht #define TARGET_VT_LOCKSWITCH 0x560b 1191f7680a55SUlrich Hecht #define TARGET_VT_UNLOCKSWITCH 0x560c 1192774750c0SCédric VINCENT #define TARGET_VT_GETMODE 0x5601 1193774750c0SCédric VINCENT #define TARGET_VT_SETMODE 0x5602 1194774750c0SCédric VINCENT #define TARGET_VT_RELDISP 0x5605 1195774750c0SCédric VINCENT #define TARGET_VT_DISALLOCATE 0x5608 1196f7680a55SUlrich Hecht 119756e904ecSAlexander Graf /* device mapper */ 119856e904ecSAlexander Graf #define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00) 119956e904ecSAlexander Graf #define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01) 120056e904ecSAlexander Graf #define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02) 120156e904ecSAlexander Graf #define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03) 120256e904ecSAlexander Graf #define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04) 120356e904ecSAlexander Graf #define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05) 120456e904ecSAlexander Graf #define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06) 120556e904ecSAlexander Graf #define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07) 120656e904ecSAlexander Graf #define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08) 120756e904ecSAlexander Graf #define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09) 120856e904ecSAlexander Graf #define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a) 120956e904ecSAlexander Graf #define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b) 121056e904ecSAlexander Graf #define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c) 121156e904ecSAlexander Graf #define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d) 121256e904ecSAlexander Graf #define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e) 121356e904ecSAlexander Graf #define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f) 121456e904ecSAlexander Graf 12152521d698Sbellard /* from asm/termbits.h */ 12162521d698Sbellard 12173bfd9da1Sbellard #define TARGET_NCC 8 12183bfd9da1Sbellard struct target_termio { 12193bfd9da1Sbellard unsigned short c_iflag; /* input mode flags */ 12203bfd9da1Sbellard unsigned short c_oflag; /* output mode flags */ 12213bfd9da1Sbellard unsigned short c_cflag; /* control mode flags */ 12223bfd9da1Sbellard unsigned short c_lflag; /* local mode flags */ 12232521d698Sbellard unsigned char c_line; /* line discipline */ 12243bfd9da1Sbellard unsigned char c_cc[TARGET_NCC]; /* control characters */ 12252521d698Sbellard }; 12262521d698Sbellard 12273bfd9da1Sbellard struct target_winsize { 12283bfd9da1Sbellard unsigned short ws_row; 12293bfd9da1Sbellard unsigned short ws_col; 12303bfd9da1Sbellard unsigned short ws_xpixel; 12313bfd9da1Sbellard unsigned short ws_ypixel; 12323bfd9da1Sbellard }; 12332521d698Sbellard 12343bfd9da1Sbellard #include "termbits.h" 12352521d698Sbellard 12369e0b74a4SPaul Brook #if defined(TARGET_MIPS) 12379e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x10 12389e0b74a4SPaul Brook #else 12399e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x08 12409e0b74a4SPaul Brook #endif 12419e0b74a4SPaul Brook 1242e44a3e79Saurel32 /* Common */ 12432521d698Sbellard #define TARGET_MAP_SHARED 0x01 /* Share changes */ 12442521d698Sbellard #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ 12452521d698Sbellard #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ 1246e44a3e79Saurel32 1247e44a3e79Saurel32 /* Target specific */ 1248048f6b4dSbellard #if defined(TARGET_MIPS) 1249e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1250048f6b4dSbellard #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 1251048f6b4dSbellard #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 1252048f6b4dSbellard #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 1253048f6b4dSbellard #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 1254048f6b4dSbellard #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 1255048f6b4dSbellard #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 1256540635baSths #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 1257540635baSths #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1258e44a3e79Saurel32 #elif defined(TARGET_PPC) 1259e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 12602521d698Sbellard #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 12612521d698Sbellard #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 12622521d698Sbellard #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 12632521d698Sbellard #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 12647ec93196Sj_mayer #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ 12657ec93196Sj_mayer #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ 1266e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1267e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1268e44a3e79Saurel32 #elif defined(TARGET_ALPHA) 1269e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1270e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ 1271e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ 1272e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ 1273e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ 1274e44a3e79Saurel32 #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ 1275e44a3e79Saurel32 #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ 1276e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ 1277e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ 12787ec93196Sj_mayer #else 1279e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1280e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 1281e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 1282e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 1283e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 12842521d698Sbellard #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ 12852521d698Sbellard #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ 1286540635baSths #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1287540635baSths #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1288906c1b8eSMike Frysinger #define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ 12897ec93196Sj_mayer #endif 12902521d698Sbellard 129109701199SAlexander Graf #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 129209701199SAlexander Graf || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 1293c7819dfbSPeter Maydell || defined(TARGET_CRIS) || defined(TARGET_UNICORE32) 12942521d698Sbellard struct target_stat { 12952521d698Sbellard unsigned short st_dev; 12962521d698Sbellard unsigned short __pad1; 1297992f48a0Sblueswir1 abi_ulong st_ino; 12982521d698Sbellard unsigned short st_mode; 12992521d698Sbellard unsigned short st_nlink; 13002521d698Sbellard unsigned short st_uid; 13012521d698Sbellard unsigned short st_gid; 13022521d698Sbellard unsigned short st_rdev; 13032521d698Sbellard unsigned short __pad2; 1304992f48a0Sblueswir1 abi_ulong st_size; 1305992f48a0Sblueswir1 abi_ulong st_blksize; 1306992f48a0Sblueswir1 abi_ulong st_blocks; 1307992f48a0Sblueswir1 abi_ulong target_st_atime; 1308992f48a0Sblueswir1 abi_ulong __unused1; 1309992f48a0Sblueswir1 abi_ulong target_st_mtime; 1310992f48a0Sblueswir1 abi_ulong __unused2; 1311992f48a0Sblueswir1 abi_ulong target_st_ctime; 1312992f48a0Sblueswir1 abi_ulong __unused3; 1313992f48a0Sblueswir1 abi_ulong __unused4; 1314992f48a0Sblueswir1 abi_ulong __unused5; 13152521d698Sbellard }; 13162521d698Sbellard 13172521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely 13182521d698Sbellard * insane amounts of padding around dev_t's. 13192521d698Sbellard */ 132020d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 13212521d698Sbellard struct target_stat64 { 13222521d698Sbellard unsigned short st_dev; 13232521d698Sbellard unsigned char __pad0[10]; 13242521d698Sbellard 13252521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1326992f48a0Sblueswir1 abi_ulong __st_ino; 13272521d698Sbellard 13282521d698Sbellard unsigned int st_mode; 13292521d698Sbellard unsigned int st_nlink; 13302521d698Sbellard 1331992f48a0Sblueswir1 abi_ulong st_uid; 1332992f48a0Sblueswir1 abi_ulong st_gid; 13332521d698Sbellard 13342521d698Sbellard unsigned short st_rdev; 13352521d698Sbellard unsigned char __pad3[10]; 13362521d698Sbellard 13372521d698Sbellard long long st_size; 1338992f48a0Sblueswir1 abi_ulong st_blksize; 13392521d698Sbellard 1340992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1341992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 13422521d698Sbellard 1343992f48a0Sblueswir1 abi_ulong target_st_atime; 1344992f48a0Sblueswir1 abi_ulong __pad5; 13452521d698Sbellard 1346992f48a0Sblueswir1 abi_ulong target_st_mtime; 1347992f48a0Sblueswir1 abi_ulong __pad6; 13482521d698Sbellard 1349992f48a0Sblueswir1 abi_ulong target_st_ctime; 1350992f48a0Sblueswir1 abi_ulong __pad7; /* will be high 32 bits of ctime someday */ 13512521d698Sbellard 13522521d698Sbellard unsigned long long st_ino; 1353541dc0d4SStefan Weil } QEMU_PACKED; 13542521d698Sbellard 1355ce4defa0Spbrook #ifdef TARGET_ARM 135620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1357ce4defa0Spbrook struct target_eabi_stat64 { 1358ce4defa0Spbrook unsigned long long st_dev; 1359ce4defa0Spbrook unsigned int __pad1; 1360992f48a0Sblueswir1 abi_ulong __st_ino; 1361ce4defa0Spbrook unsigned int st_mode; 1362ce4defa0Spbrook unsigned int st_nlink; 1363ce4defa0Spbrook 1364992f48a0Sblueswir1 abi_ulong st_uid; 1365992f48a0Sblueswir1 abi_ulong st_gid; 1366ce4defa0Spbrook 1367ce4defa0Spbrook unsigned long long st_rdev; 1368ce4defa0Spbrook unsigned int __pad2[2]; 1369ce4defa0Spbrook 1370ce4defa0Spbrook long long st_size; 1371992f48a0Sblueswir1 abi_ulong st_blksize; 1372ce4defa0Spbrook unsigned int __pad3; 1373ce4defa0Spbrook unsigned long long st_blocks; 1374ce4defa0Spbrook 1375992f48a0Sblueswir1 abi_ulong target_st_atime; 1376992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1377ce4defa0Spbrook 1378992f48a0Sblueswir1 abi_ulong target_st_mtime; 1379992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1380ce4defa0Spbrook 1381992f48a0Sblueswir1 abi_ulong target_st_ctime; 1382992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1383ce4defa0Spbrook 1384ce4defa0Spbrook unsigned long long st_ino; 1385541dc0d4SStefan Weil } QEMU_PACKED; 1386ce4defa0Spbrook #endif 1387ce4defa0Spbrook 1388992f48a0Sblueswir1 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 13891b8dd648Sblueswir1 struct target_stat { 13901b8dd648Sblueswir1 unsigned int st_dev; 1391992f48a0Sblueswir1 abi_ulong st_ino; 13921b8dd648Sblueswir1 unsigned int st_mode; 13931b8dd648Sblueswir1 unsigned int st_nlink; 13941b8dd648Sblueswir1 unsigned int st_uid; 13951b8dd648Sblueswir1 unsigned int st_gid; 13961b8dd648Sblueswir1 unsigned int st_rdev; 1397992f48a0Sblueswir1 abi_long st_size; 1398992f48a0Sblueswir1 abi_long target_st_atime; 1399992f48a0Sblueswir1 abi_long target_st_mtime; 1400992f48a0Sblueswir1 abi_long target_st_ctime; 1401992f48a0Sblueswir1 abi_long st_blksize; 1402992f48a0Sblueswir1 abi_long st_blocks; 1403992f48a0Sblueswir1 abi_ulong __unused4[2]; 14041b8dd648Sblueswir1 }; 14051b8dd648Sblueswir1 140620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 14071b8dd648Sblueswir1 struct target_stat64 { 14081b8dd648Sblueswir1 unsigned char __pad0[6]; 14091b8dd648Sblueswir1 unsigned short st_dev; 14101b8dd648Sblueswir1 14111b8dd648Sblueswir1 uint64_t st_ino; 14121b8dd648Sblueswir1 uint64_t st_nlink; 14131b8dd648Sblueswir1 14141b8dd648Sblueswir1 unsigned int st_mode; 14151b8dd648Sblueswir1 14161b8dd648Sblueswir1 unsigned int st_uid; 14171b8dd648Sblueswir1 unsigned int st_gid; 14181b8dd648Sblueswir1 14191b8dd648Sblueswir1 unsigned char __pad2[6]; 14201b8dd648Sblueswir1 unsigned short st_rdev; 14211b8dd648Sblueswir1 14221b8dd648Sblueswir1 int64_t st_size; 14231b8dd648Sblueswir1 int64_t st_blksize; 14241b8dd648Sblueswir1 14251b8dd648Sblueswir1 unsigned char __pad4[4]; 14261b8dd648Sblueswir1 unsigned int st_blocks; 14271b8dd648Sblueswir1 1428992f48a0Sblueswir1 abi_ulong target_st_atime; 1429992f48a0Sblueswir1 abi_ulong __unused1; 14301b8dd648Sblueswir1 1431992f48a0Sblueswir1 abi_ulong target_st_mtime; 1432992f48a0Sblueswir1 abi_ulong __unused2; 14331b8dd648Sblueswir1 1434992f48a0Sblueswir1 abi_ulong target_st_ctime; 1435992f48a0Sblueswir1 abi_ulong __unused3; 14361b8dd648Sblueswir1 1437992f48a0Sblueswir1 abi_ulong __unused4[3]; 14381b8dd648Sblueswir1 }; 14391b8dd648Sblueswir1 14403bfd9da1Sbellard #elif defined(TARGET_SPARC) 14413bfd9da1Sbellard 14423bfd9da1Sbellard struct target_stat { 14433bfd9da1Sbellard unsigned short st_dev; 1444992f48a0Sblueswir1 abi_ulong st_ino; 14453bfd9da1Sbellard unsigned short st_mode; 14463bfd9da1Sbellard short st_nlink; 14473bfd9da1Sbellard unsigned short st_uid; 14483bfd9da1Sbellard unsigned short st_gid; 14493bfd9da1Sbellard unsigned short st_rdev; 1450992f48a0Sblueswir1 abi_long st_size; 1451992f48a0Sblueswir1 abi_long target_st_atime; 1452992f48a0Sblueswir1 abi_ulong __unused1; 1453992f48a0Sblueswir1 abi_long target_st_mtime; 1454992f48a0Sblueswir1 abi_ulong __unused2; 1455992f48a0Sblueswir1 abi_long target_st_ctime; 1456992f48a0Sblueswir1 abi_ulong __unused3; 1457992f48a0Sblueswir1 abi_long st_blksize; 1458992f48a0Sblueswir1 abi_long st_blocks; 1459992f48a0Sblueswir1 abi_ulong __unused4[2]; 14603bfd9da1Sbellard }; 14613bfd9da1Sbellard 146220d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 14633bfd9da1Sbellard struct target_stat64 { 14643bfd9da1Sbellard unsigned char __pad0[6]; 14653bfd9da1Sbellard unsigned short st_dev; 14663bfd9da1Sbellard 14673bfd9da1Sbellard uint64_t st_ino; 14683bfd9da1Sbellard 14693bfd9da1Sbellard unsigned int st_mode; 14703bfd9da1Sbellard unsigned int st_nlink; 14713bfd9da1Sbellard 14723bfd9da1Sbellard unsigned int st_uid; 14733bfd9da1Sbellard unsigned int st_gid; 14743bfd9da1Sbellard 14753bfd9da1Sbellard unsigned char __pad2[6]; 14763bfd9da1Sbellard unsigned short st_rdev; 14773bfd9da1Sbellard 14783bfd9da1Sbellard unsigned char __pad3[8]; 14793bfd9da1Sbellard 14803bfd9da1Sbellard int64_t st_size; 14813bfd9da1Sbellard unsigned int st_blksize; 14823bfd9da1Sbellard 14833bfd9da1Sbellard unsigned char __pad4[8]; 14843bfd9da1Sbellard unsigned int st_blocks; 14853bfd9da1Sbellard 14863bfd9da1Sbellard unsigned int target_st_atime; 14873bfd9da1Sbellard unsigned int __unused1; 14883bfd9da1Sbellard 14893bfd9da1Sbellard unsigned int target_st_mtime; 14903bfd9da1Sbellard unsigned int __unused2; 14913bfd9da1Sbellard 14923bfd9da1Sbellard unsigned int target_st_ctime; 14933bfd9da1Sbellard unsigned int __unused3; 14943bfd9da1Sbellard 14953bfd9da1Sbellard unsigned int __unused4; 14963bfd9da1Sbellard unsigned int __unused5; 14973bfd9da1Sbellard }; 14983bfd9da1Sbellard 149967867308Sbellard #elif defined(TARGET_PPC) 150067867308Sbellard 150167867308Sbellard struct target_stat { 1502e32448e0Sj_mayer abi_ulong st_dev; 1503992f48a0Sblueswir1 abi_ulong st_ino; 1504325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1505e32448e0Sj_mayer abi_ulong st_nlink; 1506325e651fSj_mayer unsigned int st_mode; 1507325e651fSj_mayer #else 150867867308Sbellard unsigned int st_mode; 150967867308Sbellard unsigned short st_nlink; 1510325e651fSj_mayer #endif 151167867308Sbellard unsigned int st_uid; 151267867308Sbellard unsigned int st_gid; 1513e32448e0Sj_mayer abi_ulong st_rdev; 1514992f48a0Sblueswir1 abi_ulong st_size; 1515992f48a0Sblueswir1 abi_ulong st_blksize; 1516992f48a0Sblueswir1 abi_ulong st_blocks; 1517992f48a0Sblueswir1 abi_ulong target_st_atime; 1518e32448e0Sj_mayer abi_ulong target_st_atime_nsec; 1519992f48a0Sblueswir1 abi_ulong target_st_mtime; 1520e32448e0Sj_mayer abi_ulong target_st_mtime_nsec; 1521992f48a0Sblueswir1 abi_ulong target_st_ctime; 1522e32448e0Sj_mayer abi_ulong target_st_ctime_nsec; 1523992f48a0Sblueswir1 abi_ulong __unused4; 1524992f48a0Sblueswir1 abi_ulong __unused5; 1525325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1526325e651fSj_mayer abi_ulong __unused6; 1527325e651fSj_mayer #endif 152867867308Sbellard }; 152967867308Sbellard 153020d155bcSStefan Weil #if !defined(TARGET_PPC64) || defined(TARGET_ABI32) 153120d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1532541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 153367867308Sbellard unsigned long long st_dev; 153467867308Sbellard unsigned long long st_ino; 153567867308Sbellard unsigned int st_mode; 153667867308Sbellard unsigned int st_nlink; 153767867308Sbellard unsigned int st_uid; 153867867308Sbellard unsigned int st_gid; 153967867308Sbellard unsigned long long st_rdev; 1540e1ce5e40Saurel32 unsigned long long __pad0; 154167867308Sbellard long long st_size; 1542e32448e0Sj_mayer int st_blksize; 1543e1ce5e40Saurel32 unsigned int __pad1; 154461322e91SMax Filippov long long st_blocks; /* Number 512-byte blocks allocated. */ 1545e32448e0Sj_mayer int target_st_atime; 1546e32448e0Sj_mayer unsigned int target_st_atime_nsec; 1547e32448e0Sj_mayer int target_st_mtime; 1548e32448e0Sj_mayer unsigned int target_st_mtime_nsec; 1549e32448e0Sj_mayer int target_st_ctime; 1550e32448e0Sj_mayer unsigned int target_st_ctime_nsec; 1551e32448e0Sj_mayer unsigned int __unused4; 1552e32448e0Sj_mayer unsigned int __unused5; 155367867308Sbellard }; 155420d155bcSStefan Weil #endif 155567867308Sbellard 1556b779e29eSEdgar E. Iglesias #elif defined(TARGET_MICROBLAZE) 1557b779e29eSEdgar E. Iglesias 1558b779e29eSEdgar E. Iglesias struct target_stat { 1559b779e29eSEdgar E. Iglesias abi_ulong st_dev; 1560b779e29eSEdgar E. Iglesias abi_ulong st_ino; 1561b779e29eSEdgar E. Iglesias unsigned int st_mode; 1562b779e29eSEdgar E. Iglesias unsigned short st_nlink; 1563b779e29eSEdgar E. Iglesias unsigned int st_uid; 1564b779e29eSEdgar E. Iglesias unsigned int st_gid; 1565b779e29eSEdgar E. Iglesias abi_ulong st_rdev; 1566b779e29eSEdgar E. Iglesias abi_ulong st_size; 1567b779e29eSEdgar E. Iglesias abi_ulong st_blksize; 1568b779e29eSEdgar E. Iglesias abi_ulong st_blocks; 1569b779e29eSEdgar E. Iglesias abi_ulong target_st_atime; 1570b779e29eSEdgar E. Iglesias abi_ulong target_st_atime_nsec; 1571b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime; 1572b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime_nsec; 1573b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime; 1574b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime_nsec; 1575b779e29eSEdgar E. Iglesias abi_ulong __unused4; 1576b779e29eSEdgar E. Iglesias abi_ulong __unused5; 1577b779e29eSEdgar E. Iglesias }; 1578b779e29eSEdgar E. Iglesias 1579b779e29eSEdgar E. Iglesias /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ 158020d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1581541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 1582b779e29eSEdgar E. Iglesias uint64_t st_dev; 1583a523eb06SEdgar E. Iglesias #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1584a523eb06SEdgar E. Iglesias uint32_t pad0; 1585a523eb06SEdgar E. Iglesias uint32_t __st_ino; 1586a523eb06SEdgar E. Iglesias 1587b779e29eSEdgar E. Iglesias uint32_t st_mode; 1588b779e29eSEdgar E. Iglesias uint32_t st_nlink; 1589b779e29eSEdgar E. Iglesias uint32_t st_uid; 1590b779e29eSEdgar E. Iglesias uint32_t st_gid; 1591b779e29eSEdgar E. Iglesias uint64_t st_rdev; 159221ebeb23SEdgar E. Iglesias uint64_t __pad1; 1593b779e29eSEdgar E. Iglesias 1594b779e29eSEdgar E. Iglesias int64_t st_size; 1595b779e29eSEdgar E. Iglesias int32_t st_blksize; 159621ebeb23SEdgar E. Iglesias uint32_t __pad2; 1597b779e29eSEdgar E. Iglesias int64_t st_blocks; /* Number 512-byte blocks allocated. */ 1598b779e29eSEdgar E. Iglesias 1599b779e29eSEdgar E. Iglesias int target_st_atime; 1600b779e29eSEdgar E. Iglesias unsigned int target_st_atime_nsec; 1601b779e29eSEdgar E. Iglesias int target_st_mtime; 1602b779e29eSEdgar E. Iglesias unsigned int target_st_mtime_nsec; 1603b779e29eSEdgar E. Iglesias int target_st_ctime; 1604b779e29eSEdgar E. Iglesias unsigned int target_st_ctime_nsec; 1605a523eb06SEdgar E. Iglesias uint64_t st_ino; 1606b779e29eSEdgar E. Iglesias }; 1607b779e29eSEdgar E. Iglesias 1608e6e5906bSpbrook #elif defined(TARGET_M68K) 1609e6e5906bSpbrook 1610e6e5906bSpbrook struct target_stat { 1611e6e5906bSpbrook unsigned short st_dev; 1612e6e5906bSpbrook unsigned short __pad1; 1613992f48a0Sblueswir1 abi_ulong st_ino; 1614e6e5906bSpbrook unsigned short st_mode; 1615e6e5906bSpbrook unsigned short st_nlink; 1616e6e5906bSpbrook unsigned short st_uid; 1617e6e5906bSpbrook unsigned short st_gid; 1618e6e5906bSpbrook unsigned short st_rdev; 1619e6e5906bSpbrook unsigned short __pad2; 1620992f48a0Sblueswir1 abi_ulong st_size; 1621992f48a0Sblueswir1 abi_ulong st_blksize; 1622992f48a0Sblueswir1 abi_ulong st_blocks; 1623992f48a0Sblueswir1 abi_ulong target_st_atime; 1624992f48a0Sblueswir1 abi_ulong __unused1; 1625992f48a0Sblueswir1 abi_ulong target_st_mtime; 1626992f48a0Sblueswir1 abi_ulong __unused2; 1627992f48a0Sblueswir1 abi_ulong target_st_ctime; 1628992f48a0Sblueswir1 abi_ulong __unused3; 1629992f48a0Sblueswir1 abi_ulong __unused4; 1630992f48a0Sblueswir1 abi_ulong __unused5; 1631e6e5906bSpbrook }; 1632e6e5906bSpbrook 1633e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely 1634e6e5906bSpbrook * insane amounts of padding around dev_t's. 1635e6e5906bSpbrook */ 163620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1637e6e5906bSpbrook struct target_stat64 { 1638e6e5906bSpbrook unsigned long long st_dev; 1639e6e5906bSpbrook unsigned char __pad1[2]; 1640e6e5906bSpbrook 1641e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1642992f48a0Sblueswir1 abi_ulong __st_ino; 1643e6e5906bSpbrook 1644e6e5906bSpbrook unsigned int st_mode; 1645e6e5906bSpbrook unsigned int st_nlink; 1646e6e5906bSpbrook 1647992f48a0Sblueswir1 abi_ulong st_uid; 1648992f48a0Sblueswir1 abi_ulong st_gid; 1649e6e5906bSpbrook 1650e6e5906bSpbrook unsigned long long st_rdev; 1651e6e5906bSpbrook unsigned char __pad3[2]; 1652e6e5906bSpbrook 1653e6e5906bSpbrook long long st_size; 1654992f48a0Sblueswir1 abi_ulong st_blksize; 1655e6e5906bSpbrook 1656992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 1657992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1658e6e5906bSpbrook 1659992f48a0Sblueswir1 abi_ulong target_st_atime; 1660992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1661e6e5906bSpbrook 1662992f48a0Sblueswir1 abi_ulong target_st_mtime; 1663992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1664e6e5906bSpbrook 1665992f48a0Sblueswir1 abi_ulong target_st_ctime; 1666992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1667e6e5906bSpbrook 1668e6e5906bSpbrook unsigned long long st_ino; 1669541dc0d4SStefan Weil } QEMU_PACKED; 1670e6e5906bSpbrook 1671d26bc211Sths #elif defined(TARGET_ABI_MIPSN64) 1672540635baSths 1673540635baSths /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ 1674540635baSths struct target_stat { 1675540635baSths unsigned int st_dev; 1676540635baSths unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ 1677540635baSths 1678992f48a0Sblueswir1 abi_ulong st_ino; 1679540635baSths 1680540635baSths unsigned int st_mode; 1681540635baSths unsigned int st_nlink; 1682540635baSths 1683540635baSths int st_uid; 1684540635baSths int st_gid; 1685540635baSths 1686540635baSths unsigned int st_rdev; 1687540635baSths unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ 1688540635baSths 1689992f48a0Sblueswir1 abi_ulong st_size; 1690540635baSths 1691540635baSths /* 1692540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1693540635baSths * but we don't have it under Linux. 1694540635baSths */ 1695540635baSths unsigned int target_st_atime; 1696540635baSths unsigned int target_st_atime_nsec; 1697540635baSths 1698540635baSths unsigned int target_st_mtime; 1699540635baSths unsigned int target_st_mtime_nsec; 1700540635baSths 1701540635baSths unsigned int target_st_ctime; 1702540635baSths unsigned int target_st_ctime_nsec; 1703540635baSths 1704540635baSths unsigned int st_blksize; 1705540635baSths unsigned int st_pad2; 1706540635baSths 1707992f48a0Sblueswir1 abi_ulong st_blocks; 1708540635baSths }; 1709540635baSths 1710d26bc211Sths #elif defined(TARGET_ABI_MIPSN32) 1711540635baSths 1712540635baSths struct target_stat { 17131ab2aea2SLeon Alrae abi_ulong st_dev; 17141ab2aea2SLeon Alrae abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 17151ab2aea2SLeon Alrae uint64_t st_ino; 1716540635baSths unsigned int st_mode; 1717540635baSths unsigned int st_nlink; 1718540635baSths int st_uid; 1719540635baSths int st_gid; 17201ab2aea2SLeon Alrae abi_ulong st_rdev; 17211ab2aea2SLeon Alrae abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 17221ab2aea2SLeon Alrae int64_t st_size; 17231ab2aea2SLeon Alrae abi_long target_st_atime; 17241ab2aea2SLeon Alrae abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 17251ab2aea2SLeon Alrae abi_long target_st_mtime; 17261ab2aea2SLeon Alrae abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 17271ab2aea2SLeon Alrae abi_long target_st_ctime; 17281ab2aea2SLeon Alrae abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 17291ab2aea2SLeon Alrae abi_ulong st_blksize; 17301ab2aea2SLeon Alrae abi_ulong st_pad2; 17311ab2aea2SLeon Alrae int64_t st_blocks; 1732540635baSths }; 1733540635baSths 1734d26bc211Sths #elif defined(TARGET_ABI_MIPSO32) 1735048f6b4dSbellard 1736048f6b4dSbellard struct target_stat { 1737048f6b4dSbellard unsigned st_dev; 1738992f48a0Sblueswir1 abi_long st_pad1[3]; /* Reserved for network id */ 1739992f48a0Sblueswir1 abi_ulong st_ino; 1740048f6b4dSbellard unsigned int st_mode; 1741048f6b4dSbellard unsigned int st_nlink; 1742048f6b4dSbellard int st_uid; 1743048f6b4dSbellard int st_gid; 1744048f6b4dSbellard unsigned st_rdev; 1745992f48a0Sblueswir1 abi_long st_pad2[2]; 1746992f48a0Sblueswir1 abi_long st_size; 1747992f48a0Sblueswir1 abi_long st_pad3; 1748048f6b4dSbellard /* 1749048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1750048f6b4dSbellard * but we don't have it under Linux. 1751048f6b4dSbellard */ 1752992f48a0Sblueswir1 abi_long target_st_atime; 1753992f48a0Sblueswir1 abi_long target_st_atime_nsec; 1754992f48a0Sblueswir1 abi_long target_st_mtime; 1755992f48a0Sblueswir1 abi_long target_st_mtime_nsec; 1756992f48a0Sblueswir1 abi_long target_st_ctime; 1757992f48a0Sblueswir1 abi_long target_st_ctime_nsec; 1758992f48a0Sblueswir1 abi_long st_blksize; 1759992f48a0Sblueswir1 abi_long st_blocks; 1760992f48a0Sblueswir1 abi_long st_pad4[14]; 1761048f6b4dSbellard }; 1762048f6b4dSbellard 1763048f6b4dSbellard /* 1764048f6b4dSbellard * This matches struct stat64 in glibc2.1, hence the absolutely insane 1765048f6b4dSbellard * amounts of padding around dev_t's. The memory layout is the same as of 1766048f6b4dSbellard * struct stat of the 64-bit kernel. 1767048f6b4dSbellard */ 1768048f6b4dSbellard 176920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1770048f6b4dSbellard struct target_stat64 { 1771992f48a0Sblueswir1 abi_ulong st_dev; 1772992f48a0Sblueswir1 abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 1773048f6b4dSbellard 1774048f6b4dSbellard uint64_t st_ino; 1775048f6b4dSbellard 1776048f6b4dSbellard unsigned int st_mode; 1777048f6b4dSbellard unsigned int st_nlink; 1778048f6b4dSbellard 1779048f6b4dSbellard int st_uid; 1780048f6b4dSbellard int st_gid; 1781048f6b4dSbellard 1782992f48a0Sblueswir1 abi_ulong st_rdev; 1783992f48a0Sblueswir1 abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 1784048f6b4dSbellard 1785048f6b4dSbellard int64_t st_size; 1786048f6b4dSbellard 1787048f6b4dSbellard /* 1788048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1789048f6b4dSbellard * but we don't have it under Linux. 1790048f6b4dSbellard */ 1791992f48a0Sblueswir1 abi_long target_st_atime; 1792992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 1793048f6b4dSbellard 1794992f48a0Sblueswir1 abi_long target_st_mtime; 1795992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 1796048f6b4dSbellard 1797992f48a0Sblueswir1 abi_long target_st_ctime; 1798992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 1799048f6b4dSbellard 1800992f48a0Sblueswir1 abi_ulong st_blksize; 1801992f48a0Sblueswir1 abi_ulong st_pad2; 1802048f6b4dSbellard 1803048f6b4dSbellard int64_t st_blocks; 1804048f6b4dSbellard }; 18057a3148a9Sj_mayer 18067a3148a9Sj_mayer #elif defined(TARGET_ALPHA) 18077a3148a9Sj_mayer 18087a3148a9Sj_mayer struct target_stat { 18097a3148a9Sj_mayer unsigned int st_dev; 18107a3148a9Sj_mayer unsigned int st_ino; 18117a3148a9Sj_mayer unsigned int st_mode; 18127a3148a9Sj_mayer unsigned int st_nlink; 18137a3148a9Sj_mayer unsigned int st_uid; 18147a3148a9Sj_mayer unsigned int st_gid; 18157a3148a9Sj_mayer unsigned int st_rdev; 1816992f48a0Sblueswir1 abi_long st_size; 1817992f48a0Sblueswir1 abi_ulong target_st_atime; 1818992f48a0Sblueswir1 abi_ulong target_st_mtime; 1819992f48a0Sblueswir1 abi_ulong target_st_ctime; 18207a3148a9Sj_mayer unsigned int st_blksize; 18217a3148a9Sj_mayer unsigned int st_blocks; 18227a3148a9Sj_mayer unsigned int st_flags; 18237a3148a9Sj_mayer unsigned int st_gen; 18247a3148a9Sj_mayer }; 18257a3148a9Sj_mayer 182620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 18277a3148a9Sj_mayer struct target_stat64 { 1828992f48a0Sblueswir1 abi_ulong st_dev; 1829992f48a0Sblueswir1 abi_ulong st_ino; 1830992f48a0Sblueswir1 abi_ulong st_rdev; 1831992f48a0Sblueswir1 abi_long st_size; 1832992f48a0Sblueswir1 abi_ulong st_blocks; 18337a3148a9Sj_mayer 18347a3148a9Sj_mayer unsigned int st_mode; 18357a3148a9Sj_mayer unsigned int st_uid; 18367a3148a9Sj_mayer unsigned int st_gid; 18377a3148a9Sj_mayer unsigned int st_blksize; 18387a3148a9Sj_mayer unsigned int st_nlink; 18397a3148a9Sj_mayer unsigned int __pad0; 18407a3148a9Sj_mayer 1841992f48a0Sblueswir1 abi_ulong target_st_atime; 1842992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1843992f48a0Sblueswir1 abi_ulong target_st_mtime; 1844992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1845992f48a0Sblueswir1 abi_ulong target_st_ctime; 1846992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1847992f48a0Sblueswir1 abi_long __unused[3]; 18487a3148a9Sj_mayer }; 18497a3148a9Sj_mayer 18506db45e65Sths #elif defined(TARGET_SH4) 18516db45e65Sths 18526db45e65Sths struct target_stat { 1853992f48a0Sblueswir1 abi_ulong st_dev; 1854992f48a0Sblueswir1 abi_ulong st_ino; 18556db45e65Sths unsigned short st_mode; 18566db45e65Sths unsigned short st_nlink; 18576db45e65Sths unsigned short st_uid; 18586db45e65Sths unsigned short st_gid; 1859992f48a0Sblueswir1 abi_ulong st_rdev; 1860992f48a0Sblueswir1 abi_ulong st_size; 1861992f48a0Sblueswir1 abi_ulong st_blksize; 1862992f48a0Sblueswir1 abi_ulong st_blocks; 1863992f48a0Sblueswir1 abi_ulong target_st_atime; 1864992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1865992f48a0Sblueswir1 abi_ulong target_st_mtime; 1866992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1867992f48a0Sblueswir1 abi_ulong target_st_ctime; 1868992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1869992f48a0Sblueswir1 abi_ulong __unused4; 1870992f48a0Sblueswir1 abi_ulong __unused5; 18716db45e65Sths }; 18726db45e65Sths 18736db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely 18746db45e65Sths * insane amounts of padding around dev_t's. 18756db45e65Sths */ 187620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1877541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 18786db45e65Sths unsigned long long st_dev; 18796db45e65Sths unsigned char __pad0[4]; 18806db45e65Sths 18816db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1882992f48a0Sblueswir1 abi_ulong __st_ino; 18836db45e65Sths 18846db45e65Sths unsigned int st_mode; 18856db45e65Sths unsigned int st_nlink; 18866db45e65Sths 1887992f48a0Sblueswir1 abi_ulong st_uid; 1888992f48a0Sblueswir1 abi_ulong st_gid; 18896db45e65Sths 18906db45e65Sths unsigned long long st_rdev; 18916db45e65Sths unsigned char __pad3[4]; 18926db45e65Sths 18936db45e65Sths long long st_size; 1894992f48a0Sblueswir1 abi_ulong st_blksize; 18956db45e65Sths 18966db45e65Sths unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ 18976db45e65Sths 1898992f48a0Sblueswir1 abi_ulong target_st_atime; 1899992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 19006db45e65Sths 1901992f48a0Sblueswir1 abi_ulong target_st_mtime; 1902992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 19036db45e65Sths 1904992f48a0Sblueswir1 abi_ulong target_st_ctime; 1905992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 19066db45e65Sths 19076db45e65Sths unsigned long long st_ino; 19086db45e65Sths }; 19096db45e65Sths 1910d2fd1af7Sbellard #elif defined(TARGET_I386) && !defined(TARGET_ABI32) 1911d2fd1af7Sbellard struct target_stat { 1912d2fd1af7Sbellard abi_ulong st_dev; 1913d2fd1af7Sbellard abi_ulong st_ino; 1914d2fd1af7Sbellard abi_ulong st_nlink; 1915d2fd1af7Sbellard 1916d2fd1af7Sbellard unsigned int st_mode; 1917d2fd1af7Sbellard unsigned int st_uid; 1918d2fd1af7Sbellard unsigned int st_gid; 1919d2fd1af7Sbellard unsigned int __pad0; 1920d2fd1af7Sbellard abi_ulong st_rdev; 1921d2fd1af7Sbellard abi_long st_size; 1922d2fd1af7Sbellard abi_long st_blksize; 1923d2fd1af7Sbellard abi_long st_blocks; /* Number 512-byte blocks allocated. */ 1924d2fd1af7Sbellard 1925d2fd1af7Sbellard abi_ulong target_st_atime; 1926d2fd1af7Sbellard abi_ulong target_st_atime_nsec; 1927d2fd1af7Sbellard abi_ulong target_st_mtime; 1928d2fd1af7Sbellard abi_ulong target_st_mtime_nsec; 1929d2fd1af7Sbellard abi_ulong target_st_ctime; 1930d2fd1af7Sbellard abi_ulong target_st_ctime_nsec; 1931d2fd1af7Sbellard 1932d2fd1af7Sbellard abi_long __unused[3]; 1933d2fd1af7Sbellard }; 1934a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 1935a4c075f1SUlrich Hecht struct target_stat { 1936a4c075f1SUlrich Hecht abi_ulong st_dev; 1937a4c075f1SUlrich Hecht abi_ulong st_ino; 1938a4c075f1SUlrich Hecht abi_ulong st_nlink; 1939a4c075f1SUlrich Hecht unsigned int st_mode; 1940a4c075f1SUlrich Hecht unsigned int st_uid; 1941a4c075f1SUlrich Hecht unsigned int st_gid; 1942a4c075f1SUlrich Hecht unsigned int __pad1; 1943a4c075f1SUlrich Hecht abi_ulong st_rdev; 1944a4c075f1SUlrich Hecht abi_ulong st_size; 1945a4c075f1SUlrich Hecht abi_ulong target_st_atime; 1946a4c075f1SUlrich Hecht abi_ulong target_st_atime_nsec; 1947a4c075f1SUlrich Hecht abi_ulong target_st_mtime; 1948a4c075f1SUlrich Hecht abi_ulong target_st_mtime_nsec; 1949a4c075f1SUlrich Hecht abi_ulong target_st_ctime; 1950a4c075f1SUlrich Hecht abi_ulong target_st_ctime_nsec; 1951a4c075f1SUlrich Hecht abi_ulong st_blksize; 1952a4c075f1SUlrich Hecht abi_long st_blocks; 1953a4c075f1SUlrich Hecht abi_ulong __unused[3]; 1954a4c075f1SUlrich Hecht }; 195509701199SAlexander Graf #elif defined(TARGET_AARCH64) 195609701199SAlexander Graf struct target_stat { 195709701199SAlexander Graf abi_ulong st_dev; 195809701199SAlexander Graf abi_ulong st_ino; 195909701199SAlexander Graf unsigned int st_mode; 196009701199SAlexander Graf unsigned int st_nlink; 196109701199SAlexander Graf unsigned int st_uid; 196209701199SAlexander Graf unsigned int st_gid; 196309701199SAlexander Graf abi_ulong st_rdev; 196409701199SAlexander Graf abi_ulong _pad1; 196509701199SAlexander Graf abi_long st_size; 196609701199SAlexander Graf int st_blksize; 196709701199SAlexander Graf int __pad2; 196809701199SAlexander Graf abi_long st_blocks; 196909701199SAlexander Graf abi_long target_st_atime; 197009701199SAlexander Graf abi_ulong target_st_atime_nsec; 197109701199SAlexander Graf abi_long target_st_mtime; 197209701199SAlexander Graf abi_ulong target_st_mtime_nsec; 197309701199SAlexander Graf abi_long target_st_ctime; 197409701199SAlexander Graf abi_ulong target_st_ctime_nsec; 197509701199SAlexander Graf unsigned int __unused[2]; 197609701199SAlexander Graf }; 1977b16189b2SChen Gang #elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) 1978c7819dfbSPeter Maydell 1979c7819dfbSPeter Maydell /* These are the asm-generic versions of the stat and stat64 structures */ 1980c7819dfbSPeter Maydell 1981d962783eSJia Liu struct target_stat { 1982d962783eSJia Liu abi_ulong st_dev; 1983d962783eSJia Liu abi_ulong st_ino; 1984d962783eSJia Liu unsigned int st_mode; 1985c7819dfbSPeter Maydell unsigned int st_nlink; 1986d962783eSJia Liu unsigned int st_uid; 1987d962783eSJia Liu unsigned int st_gid; 1988d962783eSJia Liu abi_ulong st_rdev; 1989c7819dfbSPeter Maydell abi_ulong __pad1; 1990d962783eSJia Liu abi_long st_size; 1991c7819dfbSPeter Maydell int st_blksize; 1992c7819dfbSPeter Maydell int __pad2; 1993c7819dfbSPeter Maydell abi_long st_blocks; 1994c7819dfbSPeter Maydell abi_long target_st_atime; 1995d962783eSJia Liu abi_ulong target_st_atime_nsec; 1996c7819dfbSPeter Maydell abi_long target_st_mtime; 1997d962783eSJia Liu abi_ulong target_st_mtime_nsec; 1998c7819dfbSPeter Maydell abi_long target_st_ctime; 1999d962783eSJia Liu abi_ulong target_st_ctime_nsec; 2000c7819dfbSPeter Maydell unsigned int __unused4; 2001c7819dfbSPeter Maydell unsigned int __unused5; 2002d962783eSJia Liu }; 2003c7819dfbSPeter Maydell 200420d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 2005c7819dfbSPeter Maydell struct target_stat64 { 2006c7819dfbSPeter Maydell uint64_t st_dev; 2007c7819dfbSPeter Maydell uint64_t st_ino; 2008c7819dfbSPeter Maydell unsigned int st_mode; 2009c7819dfbSPeter Maydell unsigned int st_nlink; 2010c7819dfbSPeter Maydell unsigned int st_uid; 2011c7819dfbSPeter Maydell unsigned int st_gid; 2012c7819dfbSPeter Maydell uint64_t st_rdev; 2013c7819dfbSPeter Maydell uint64_t __pad1; 2014c7819dfbSPeter Maydell int64_t st_size; 2015c7819dfbSPeter Maydell int st_blksize; 2016c7819dfbSPeter Maydell int __pad2; 2017c7819dfbSPeter Maydell int64_t st_blocks; 2018c7819dfbSPeter Maydell int target_st_atime; 2019c7819dfbSPeter Maydell unsigned int target_st_atime_nsec; 2020c7819dfbSPeter Maydell int target_st_mtime; 2021c7819dfbSPeter Maydell unsigned int target_st_mtime_nsec; 2022c7819dfbSPeter Maydell int target_st_ctime; 2023c7819dfbSPeter Maydell unsigned int target_st_ctime_nsec; 2024c7819dfbSPeter Maydell unsigned int __unused4; 2025c7819dfbSPeter Maydell unsigned int __unused5; 2026c7819dfbSPeter Maydell }; 2027c7819dfbSPeter Maydell 2028048f6b4dSbellard #else 2029048f6b4dSbellard #error unsupported CPU 2030048f6b4dSbellard #endif 20312521d698Sbellard 20324ce6f8deSths typedef struct { 20334ce6f8deSths int val[2]; 2034c227f099SAnthony Liguori } target_fsid_t; 20354ce6f8deSths 203656c8f68fSbellard #ifdef TARGET_MIPS 2037d26bc211Sths #ifdef TARGET_ABI_MIPSN32 2038540635baSths struct target_statfs { 2039540635baSths int32_t f_type; 2040540635baSths int32_t f_bsize; 2041540635baSths int32_t f_frsize; /* Fragment size - unsupported */ 2042540635baSths int32_t f_blocks; 2043540635baSths int32_t f_bfree; 2044540635baSths int32_t f_files; 2045540635baSths int32_t f_ffree; 2046540635baSths int32_t f_bavail; 2047540635baSths 2048540635baSths /* Linux specials */ 2049c227f099SAnthony Liguori target_fsid_t f_fsid; 2050540635baSths int32_t f_namelen; 2051540635baSths int32_t f_spare[6]; 2052540635baSths }; 2053540635baSths #else 205456c8f68fSbellard struct target_statfs { 2055992f48a0Sblueswir1 abi_long f_type; 2056992f48a0Sblueswir1 abi_long f_bsize; 2057992f48a0Sblueswir1 abi_long f_frsize; /* Fragment size - unsupported */ 2058992f48a0Sblueswir1 abi_long f_blocks; 2059992f48a0Sblueswir1 abi_long f_bfree; 2060992f48a0Sblueswir1 abi_long f_files; 2061992f48a0Sblueswir1 abi_long f_ffree; 2062992f48a0Sblueswir1 abi_long f_bavail; 206356c8f68fSbellard 206456c8f68fSbellard /* Linux specials */ 2065c227f099SAnthony Liguori target_fsid_t f_fsid; 2066992f48a0Sblueswir1 abi_long f_namelen; 2067992f48a0Sblueswir1 abi_long f_spare[6]; 206856c8f68fSbellard }; 2069540635baSths #endif 207056c8f68fSbellard 207156c8f68fSbellard struct target_statfs64 { 207256c8f68fSbellard uint32_t f_type; 207356c8f68fSbellard uint32_t f_bsize; 207456c8f68fSbellard uint32_t f_frsize; /* Fragment size - unsupported */ 207556c8f68fSbellard uint32_t __pad; 207656c8f68fSbellard uint64_t f_blocks; 207756c8f68fSbellard uint64_t f_bfree; 207856c8f68fSbellard uint64_t f_files; 207956c8f68fSbellard uint64_t f_ffree; 208056c8f68fSbellard uint64_t f_bavail; 2081c227f099SAnthony Liguori target_fsid_t f_fsid; 208256c8f68fSbellard uint32_t f_namelen; 208356c8f68fSbellard uint32_t f_spare[6]; 208456c8f68fSbellard }; 2085c4d10628Sbalrog #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ 208609701199SAlexander Graf defined(TARGET_SPARC64) || defined(TARGET_AARCH64)) && \ 208709701199SAlexander Graf !defined(TARGET_ABI32) 2088325e651fSj_mayer struct target_statfs { 2089325e651fSj_mayer abi_long f_type; 2090325e651fSj_mayer abi_long f_bsize; 2091325e651fSj_mayer abi_long f_blocks; 2092325e651fSj_mayer abi_long f_bfree; 2093325e651fSj_mayer abi_long f_bavail; 2094325e651fSj_mayer abi_long f_files; 2095325e651fSj_mayer abi_long f_ffree; 2096c227f099SAnthony Liguori target_fsid_t f_fsid; 2097325e651fSj_mayer abi_long f_namelen; 2098325e651fSj_mayer abi_long f_frsize; 2099325e651fSj_mayer abi_long f_spare[5]; 2100325e651fSj_mayer }; 2101325e651fSj_mayer 2102325e651fSj_mayer struct target_statfs64 { 2103325e651fSj_mayer abi_long f_type; 2104325e651fSj_mayer abi_long f_bsize; 2105325e651fSj_mayer abi_long f_blocks; 2106325e651fSj_mayer abi_long f_bfree; 2107325e651fSj_mayer abi_long f_bavail; 2108325e651fSj_mayer abi_long f_files; 2109325e651fSj_mayer abi_long f_ffree; 2110c227f099SAnthony Liguori target_fsid_t f_fsid; 2111325e651fSj_mayer abi_long f_namelen; 2112325e651fSj_mayer abi_long f_frsize; 2113325e651fSj_mayer abi_long f_spare[5]; 2114325e651fSj_mayer }; 2115a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 2116a4c075f1SUlrich Hecht struct target_statfs { 2117a4c075f1SUlrich Hecht int32_t f_type; 2118a4c075f1SUlrich Hecht int32_t f_bsize; 2119a4c075f1SUlrich Hecht abi_long f_blocks; 2120a4c075f1SUlrich Hecht abi_long f_bfree; 2121a4c075f1SUlrich Hecht abi_long f_bavail; 2122a4c075f1SUlrich Hecht abi_long f_files; 2123a4c075f1SUlrich Hecht abi_long f_ffree; 2124a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2125a4c075f1SUlrich Hecht int32_t f_namelen; 2126a4c075f1SUlrich Hecht int32_t f_frsize; 2127a4c075f1SUlrich Hecht int32_t f_spare[5]; 2128a4c075f1SUlrich Hecht }; 2129a4c075f1SUlrich Hecht 2130a4c075f1SUlrich Hecht struct target_statfs64 { 2131a4c075f1SUlrich Hecht int32_t f_type; 2132a4c075f1SUlrich Hecht int32_t f_bsize; 2133a4c075f1SUlrich Hecht abi_long f_blocks; 2134a4c075f1SUlrich Hecht abi_long f_bfree; 2135a4c075f1SUlrich Hecht abi_long f_bavail; 2136a4c075f1SUlrich Hecht abi_long f_files; 2137a4c075f1SUlrich Hecht abi_long f_ffree; 2138a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2139a4c075f1SUlrich Hecht int32_t f_namelen; 2140a4c075f1SUlrich Hecht int32_t f_frsize; 2141a4c075f1SUlrich Hecht int32_t f_spare[5]; 2142a4c075f1SUlrich Hecht }; 214356c8f68fSbellard #else 214456c8f68fSbellard struct target_statfs { 214556c8f68fSbellard uint32_t f_type; 214656c8f68fSbellard uint32_t f_bsize; 214756c8f68fSbellard uint32_t f_blocks; 214856c8f68fSbellard uint32_t f_bfree; 214956c8f68fSbellard uint32_t f_bavail; 215056c8f68fSbellard uint32_t f_files; 215156c8f68fSbellard uint32_t f_ffree; 2152c227f099SAnthony Liguori target_fsid_t f_fsid; 215356c8f68fSbellard uint32_t f_namelen; 215456c8f68fSbellard uint32_t f_frsize; 215556c8f68fSbellard uint32_t f_spare[5]; 215656c8f68fSbellard }; 215756c8f68fSbellard 215856c8f68fSbellard struct target_statfs64 { 215956c8f68fSbellard uint32_t f_type; 216056c8f68fSbellard uint32_t f_bsize; 216156c8f68fSbellard uint64_t f_blocks; 216256c8f68fSbellard uint64_t f_bfree; 216356c8f68fSbellard uint64_t f_bavail; 216456c8f68fSbellard uint64_t f_files; 216556c8f68fSbellard uint64_t f_ffree; 2166c227f099SAnthony Liguori target_fsid_t f_fsid; 216756c8f68fSbellard uint32_t f_namelen; 216856c8f68fSbellard uint32_t f_frsize; 216956c8f68fSbellard uint32_t f_spare[5]; 217056c8f68fSbellard }; 217156c8f68fSbellard #endif 217256c8f68fSbellard 217356c8f68fSbellard 21742521d698Sbellard #define TARGET_F_DUPFD 0 /* dup */ 21752521d698Sbellard #define TARGET_F_GETFD 1 /* get close_on_exec */ 21762521d698Sbellard #define TARGET_F_SETFD 2 /* set/clear close_on_exec */ 21772521d698Sbellard #define TARGET_F_GETFL 3 /* get file->f_flags */ 21782521d698Sbellard #define TARGET_F_SETFL 4 /* set file->f_flags */ 21792521d698Sbellard 21802521d698Sbellard #if defined(TARGET_ALPHA) 21812521d698Sbellard #define TARGET_F_GETLK 7 21822521d698Sbellard #define TARGET_F_SETLK 8 21832521d698Sbellard #define TARGET_F_SETLKW 9 21842521d698Sbellard #define TARGET_F_SETOWN 5 /* for sockets. */ 21852521d698Sbellard #define TARGET_F_GETOWN 6 /* for sockets. */ 21862ba7f730SLaurent Vivier 21872ba7f730SLaurent Vivier #define TARGET_F_RDLCK 1 21882ba7f730SLaurent Vivier #define TARGET_F_WRLCK 2 21892ba7f730SLaurent Vivier #define TARGET_F_UNLCK 8 21902ba7f730SLaurent Vivier #define TARGET_F_EXLCK 16 21912ba7f730SLaurent Vivier #define TARGET_F_SHLCK 32 21925f106811SArnaud Patard (Rtp) #elif defined(TARGET_MIPS) 21935f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK 14 21945f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK 6 21955f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW 7 21965f106811SArnaud Patard (Rtp) #define TARGET_F_SETOWN 24 /* for sockets. */ 21973a87a954SAleksandar Markovic #define TARGET_F_GETOWN 23 /* for sockets. */ 21982521d698Sbellard #else 21992521d698Sbellard #define TARGET_F_GETLK 5 22002521d698Sbellard #define TARGET_F_SETLK 6 22012521d698Sbellard #define TARGET_F_SETLKW 7 22022521d698Sbellard #define TARGET_F_SETOWN 8 /* for sockets. */ 22032521d698Sbellard #define TARGET_F_GETOWN 9 /* for sockets. */ 22042521d698Sbellard #endif 22058d5d3004SAndreas Schwab #define TARGET_F_SETOWN_EX 15 22068d5d3004SAndreas Schwab #define TARGET_F_GETOWN_EX 16 22072521d698Sbellard 22082ba7f730SLaurent Vivier #ifndef TARGET_F_RDLCK 22092ba7f730SLaurent Vivier #define TARGET_F_RDLCK 0 22102ba7f730SLaurent Vivier #define TARGET_F_WRLCK 1 22112ba7f730SLaurent Vivier #define TARGET_F_UNLCK 2 22122ba7f730SLaurent Vivier #endif 22132ba7f730SLaurent Vivier 22142ba7f730SLaurent Vivier #ifndef TARGET_F_EXLCK 22152ba7f730SLaurent Vivier #define TARGET_F_EXLCK 4 22162ba7f730SLaurent Vivier #define TARGET_F_SHLCK 8 22172ba7f730SLaurent Vivier #endif 22182ba7f730SLaurent Vivier 22192ba7f730SLaurent Vivier 22202521d698Sbellard #define TARGET_F_SETSIG 10 /* for sockets. */ 22212521d698Sbellard #define TARGET_F_GETSIG 11 /* for sockets. */ 22222521d698Sbellard 22235f106811SArnaud Patard (Rtp) #if defined(TARGET_MIPS) 22245f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK64 33 /* using 'struct flock64' */ 22255f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK64 34 22265f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW64 35 22275f106811SArnaud Patard (Rtp) #else 22282521d698Sbellard #define TARGET_F_GETLK64 12 /* using 'struct flock64' */ 22292521d698Sbellard #define TARGET_F_SETLK64 13 22302521d698Sbellard #define TARGET_F_SETLKW64 14 22315f106811SArnaud Patard (Rtp) #endif 22327e22e546SUlrich Hecht 22337e22e546SUlrich Hecht #define TARGET_F_LINUX_SPECIFIC_BASE 1024 22347e22e546SUlrich Hecht #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0) 22357e22e546SUlrich Hecht #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1) 22367e22e546SUlrich Hecht #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) 22377e3b92ecSPeter Maydell #define TARGET_F_SETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 7) 22387e3b92ecSPeter Maydell #define TARGET_F_GETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 8) 22397e22e546SUlrich Hecht #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2) 22407e22e546SUlrich Hecht 22414eeea4f3SRichard Henderson #if defined(TARGET_ALPHA) 22424eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK 04 22434eeea4f3SRichard Henderson #define TARGET_O_APPEND 010 22444eeea4f3SRichard Henderson #define TARGET_O_CREAT 01000 /* not fcntl */ 22454eeea4f3SRichard Henderson #define TARGET_O_TRUNC 02000 /* not fcntl */ 22464eeea4f3SRichard Henderson #define TARGET_O_EXCL 04000 /* not fcntl */ 22474eeea4f3SRichard Henderson #define TARGET_O_NOCTTY 010000 /* not fcntl */ 22484eeea4f3SRichard Henderson #define TARGET_O_DSYNC 040000 22494eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0 /* not necessary, always 64-bit */ 22504eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY 0100000 /* must be a directory */ 22514eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW 0200000 /* don't follow links */ 22524eeea4f3SRichard Henderson #define TARGET_O_DIRECT 02000000 /* direct disk access hint */ 22534eeea4f3SRichard Henderson #define TARGET_O_NOATIME 04000000 22544eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 010000000 22554eeea4f3SRichard Henderson #define TARGET___O_SYNC 020000000 22564eeea4f3SRichard Henderson #define TARGET_O_PATH 040000000 22574eeea4f3SRichard Henderson #elif defined(TARGET_ARM) || defined(TARGET_M68K) 2258f09936acSbellard #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 2259f09936acSbellard #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 2260f09936acSbellard #define TARGET_O_DIRECT 0200000 /* direct disk access hint */ 2261f09936acSbellard #define TARGET_O_LARGEFILE 0400000 2262048f6b4dSbellard #elif defined(TARGET_MIPS) 2263048f6b4dSbellard #define TARGET_O_APPEND 0x0008 22644eeea4f3SRichard Henderson #define TARGET_O_DSYNC 0x0010 2265048f6b4dSbellard #define TARGET_O_NONBLOCK 0x0080 2266048f6b4dSbellard #define TARGET_O_CREAT 0x0100 /* not fcntl */ 2267048f6b4dSbellard #define TARGET_O_TRUNC 0x0200 /* not fcntl */ 2268048f6b4dSbellard #define TARGET_O_EXCL 0x0400 /* not fcntl */ 2269048f6b4dSbellard #define TARGET_O_NOCTTY 0x0800 /* not fcntl */ 2270048f6b4dSbellard #define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */ 2271048f6b4dSbellard #define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */ 22724eeea4f3SRichard Henderson #define TARGET___O_SYNC 0x4000 2273048f6b4dSbellard #define TARGET_O_DIRECT 0x8000 /* direct disk access hint */ 22744eeea4f3SRichard Henderson #elif defined (TARGET_PPC) 22754eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 22764eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 22774eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0200000 22784eeea4f3SRichard Henderson #define TARGET_O_DIRECT 0400000 /* direct disk access hint */ 22794eeea4f3SRichard Henderson #elif defined (TARGET_SPARC) 22801f961124Saurel32 #define TARGET_O_APPEND 0x0008 22814eeea4f3SRichard Henderson #define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */ 22821f961124Saurel32 #define TARGET_O_CREAT 0x0200 /* not fcntl */ 22831f961124Saurel32 #define TARGET_O_TRUNC 0x0400 /* not fcntl */ 22841f961124Saurel32 #define TARGET_O_EXCL 0x0800 /* not fcntl */ 22854eeea4f3SRichard Henderson #define TARGET_O_DSYNC 0x2000 22864eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK 0x4000 22874eeea4f3SRichard Henderson # ifdef TARGET_SPARC64 22884eeea4f3SRichard Henderson # define TARGET_O_NDELAY 0x0004 2289ffa65c3bSbellard # else 22904eeea4f3SRichard Henderson # define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK) 22914eeea4f3SRichard Henderson # endif 22924eeea4f3SRichard Henderson #define TARGET_O_NOCTTY 0x8000 /* not fcntl */ 22934eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0x40000 22944eeea4f3SRichard Henderson #define TARGET_O_DIRECT 0x100000 /* direct disk access hint */ 22954eeea4f3SRichard Henderson #define TARGET_O_NOATIME 0x200000 22964eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 0x400000 22974eeea4f3SRichard Henderson #define TARGET___O_SYNC 0x800000 22984eeea4f3SRichard Henderson #define TARGET_O_PATH 0x1000000 22994eeea4f3SRichard Henderson #endif 23004eeea4f3SRichard Henderson 23014eeea4f3SRichard Henderson /* <asm-generic/fcntl.h> values follow. */ 2302ffa65c3bSbellard #define TARGET_O_ACCMODE 0003 2303ffa65c3bSbellard #define TARGET_O_RDONLY 00 2304ffa65c3bSbellard #define TARGET_O_WRONLY 01 2305ffa65c3bSbellard #define TARGET_O_RDWR 02 23064eeea4f3SRichard Henderson #ifndef TARGET_O_CREAT 2307ffa65c3bSbellard #define TARGET_O_CREAT 0100 /* not fcntl */ 23084eeea4f3SRichard Henderson #endif 23094eeea4f3SRichard Henderson #ifndef TARGET_O_EXCL 2310ffa65c3bSbellard #define TARGET_O_EXCL 0200 /* not fcntl */ 23114eeea4f3SRichard Henderson #endif 23124eeea4f3SRichard Henderson #ifndef TARGET_O_NOCTTY 2313ffa65c3bSbellard #define TARGET_O_NOCTTY 0400 /* not fcntl */ 23144eeea4f3SRichard Henderson #endif 23154eeea4f3SRichard Henderson #ifndef TARGET_O_TRUNC 2316ffa65c3bSbellard #define TARGET_O_TRUNC 01000 /* not fcntl */ 23174eeea4f3SRichard Henderson #endif 23184eeea4f3SRichard Henderson #ifndef TARGET_O_APPEND 2319ffa65c3bSbellard #define TARGET_O_APPEND 02000 23204eeea4f3SRichard Henderson #endif 23214eeea4f3SRichard Henderson #ifndef TARGET_O_NONBLOCK 2322ffa65c3bSbellard #define TARGET_O_NONBLOCK 04000 23234eeea4f3SRichard Henderson #endif 23244eeea4f3SRichard Henderson #ifndef TARGET_O_DSYNC 23254eeea4f3SRichard Henderson #define TARGET_O_DSYNC 010000 23264eeea4f3SRichard Henderson #endif 23274eeea4f3SRichard Henderson #ifndef TARGET_FASYNC 2328ffa65c3bSbellard #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ 23294eeea4f3SRichard Henderson #endif 23304eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECT 2331ffa65c3bSbellard #define TARGET_O_DIRECT 040000 /* direct disk access hint */ 23324eeea4f3SRichard Henderson #endif 23334eeea4f3SRichard Henderson #ifndef TARGET_O_LARGEFILE 2334ffa65c3bSbellard #define TARGET_O_LARGEFILE 0100000 23354eeea4f3SRichard Henderson #endif 23364eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECTORY 2337ffa65c3bSbellard #define TARGET_O_DIRECTORY 0200000 /* must be a directory */ 23384eeea4f3SRichard Henderson #endif 23394eeea4f3SRichard Henderson #ifndef TARGET_O_NOFOLLOW 2340ffa65c3bSbellard #define TARGET_O_NOFOLLOW 0400000 /* don't follow links */ 2341ffa65c3bSbellard #endif 23424eeea4f3SRichard Henderson #ifndef TARGET_O_NOATIME 23434eeea4f3SRichard Henderson #define TARGET_O_NOATIME 01000000 23444eeea4f3SRichard Henderson #endif 23454eeea4f3SRichard Henderson #ifndef TARGET_O_CLOEXEC 23464eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 02000000 23474eeea4f3SRichard Henderson #endif 23484eeea4f3SRichard Henderson #ifndef TARGET___O_SYNC 23494eeea4f3SRichard Henderson #define TARGET___O_SYNC 04000000 23504eeea4f3SRichard Henderson #endif 23514eeea4f3SRichard Henderson #ifndef TARGET_O_PATH 23524eeea4f3SRichard Henderson #define TARGET_O_PATH 010000000 23534eeea4f3SRichard Henderson #endif 23544eeea4f3SRichard Henderson #ifndef TARGET_O_NDELAY 23554eeea4f3SRichard Henderson #define TARGET_O_NDELAY TARGET_O_NONBLOCK 23564eeea4f3SRichard Henderson #endif 23574eeea4f3SRichard Henderson #ifndef TARGET_O_SYNC 23584eeea4f3SRichard Henderson #define TARGET_O_SYNC (TARGET___O_SYNC | TARGET_O_DSYNC) 23594eeea4f3SRichard Henderson #endif 2360ffa65c3bSbellard 23612521d698Sbellard struct target_flock { 23622521d698Sbellard short l_type; 23632521d698Sbellard short l_whence; 23648efb2ed5SPeter Maydell abi_long l_start; 23658efb2ed5SPeter Maydell abi_long l_len; 23668a8001b1SAleksandar Markovic #if defined(TARGET_MIPS) 23678a8001b1SAleksandar Markovic abi_long l_sysid; 23688a8001b1SAleksandar Markovic #endif 23692521d698Sbellard int l_pid; 23708a8001b1SAleksandar Markovic #if defined(TARGET_MIPS) 23718a8001b1SAleksandar Markovic abi_long pad[4]; 23728a8001b1SAleksandar Markovic #endif 23732521d698Sbellard }; 23742521d698Sbellard 23752521d698Sbellard struct target_flock64 { 23762521d698Sbellard short l_type; 23772521d698Sbellard short l_whence; 2378d41f3c3cSThomas Huth #if defined(TARGET_PPC) || defined(TARGET_X86_64) \ 2379d41f3c3cSThomas Huth || defined(TARGET_MIPS) || defined(TARGET_SPARC) \ 2380b16189b2SChen Gang || defined(TARGET_MICROBLAZE) || defined(TARGET_TILEGX) 2381ce3f0e2fSaurel32 int __pad; 2382ce3f0e2fSaurel32 #endif 23838efb2ed5SPeter Maydell abi_llong l_start; 23848efb2ed5SPeter Maydell abi_llong l_len; 23852521d698Sbellard int l_pid; 2386541dc0d4SStefan Weil } QEMU_PACKED; 23872521d698Sbellard 2388ce4defa0Spbrook #ifdef TARGET_ARM 2389ce4defa0Spbrook struct target_eabi_flock64 { 2390ce4defa0Spbrook short l_type; 2391ce4defa0Spbrook short l_whence; 2392ce4defa0Spbrook int __pad; 23938efb2ed5SPeter Maydell abi_llong l_start; 23948efb2ed5SPeter Maydell abi_llong l_len; 2395ce4defa0Spbrook int l_pid; 2396541dc0d4SStefan Weil } QEMU_PACKED; 2397ce4defa0Spbrook #endif 23982521d698Sbellard 23998d5d3004SAndreas Schwab struct target_f_owner_ex { 24008d5d3004SAndreas Schwab int type; /* Owner type of ID. */ 24018d5d3004SAndreas Schwab int pid; /* ID of owner. */ 24028d5d3004SAndreas Schwab }; 24038d5d3004SAndreas Schwab 24042521d698Sbellard /* soundcard defines */ 240567cc32ebSVeres Lajos /* XXX: convert them all to arch independent entries */ 24062521d698Sbellard #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); 24072521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 24082521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 24092521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 24102521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA 0xc0144302 24112521d698Sbellard #define TARGET_SNDCTL_COPR_RESET 0x00004300 24122521d698Sbellard #define TARGET_SNDCTL_COPR_RUN 0xc0144306 24132521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 24142521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE 0x40144305 24152521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA 0x40144304 24162521d698Sbellard #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) 24172521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) 24182521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) 24192521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) 24202521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) 24212521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) 24222521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) 24232521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) 24242521d698Sbellard #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) 24252521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) 24262521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) 24272521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) 24282521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) 24292521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) 24302521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) 24312521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) 24322521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) 24332521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) 24345f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19) 24355f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20) 24362521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e 24372521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 24382521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 24392521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 24402521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 24412521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f 24422521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 24432521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO 0xc074510c 24442521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 24452521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 24462521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 24472521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 24482521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 24492521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 24502521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 24512521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 24522521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b 24532521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a 24542521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 24552521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC 0x00005111 24562521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 24572521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET 0x00005100 24582521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 24592521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC 0x00005101 24602521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 24612521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d 24622521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d 24632521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 24642521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e 24652521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 24662521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME 0x40045407 24672521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT 0x40045408 24682521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 24692521d698Sbellard #define TARGET_SNDCTL_TMR_START 0x00005402 24702521d698Sbellard #define TARGET_SNDCTL_TMR_STOP 0x00005403 24712521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 24722521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 24732521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE 0x80045002 24742521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 24752521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS 0x80045005 24762521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 24772521d698Sbellard #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) 24782521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 24792521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) 24802521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) 24812521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) 24822521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) 24832521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) 24842521d698Sbellard 24852521d698Sbellard #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) 24862521d698Sbellard 24872521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) 24882521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) 24892521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) 24902521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) 24912521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) 24922521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) 24932521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) 24942521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) 24952521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) 24962521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) 24972521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) 24982521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) 24992521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) 25002521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) 25012521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) 25022521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) 25032521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) 25042521d698Sbellard 25052521d698Sbellard /* Obsolete macros */ 25062521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) 25072521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) 25082521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) 25092521d698Sbellard 25102521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) 25112521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) 25122521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) 25132521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) 25142521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) 25152521d698Sbellard 25162521d698Sbellard #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) 25172521d698Sbellard 25182521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) 25192521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) 25202521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) 25212521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) 25222521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) 25232521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) 25242521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) 25252521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) 25262521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) 25272521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) 25282521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) 25292521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) 25302521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) 25312521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) 25322521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) 25332521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) 25342521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) 25352521d698Sbellard 25362521d698Sbellard /* Obsolete macros */ 25372521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) 25382521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) 25392521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) 25402521d698Sbellard 25412521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) 25422521d698Sbellard 25432521d698Sbellard /* vfat ioctls */ 25442521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) 25452521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) 2546a5448a7dSbellard 25478fbd6b52Sbalrog #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct mtop) 25488fbd6b52Sbalrog #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct mtget) 25498fbd6b52Sbalrog #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct mtpos) 25508fbd6b52Sbalrog 2551a5448a7dSbellard struct target_sysinfo { 2552992f48a0Sblueswir1 abi_long uptime; /* Seconds since boot */ 2553992f48a0Sblueswir1 abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */ 2554992f48a0Sblueswir1 abi_ulong totalram; /* Total usable main memory size */ 2555992f48a0Sblueswir1 abi_ulong freeram; /* Available memory size */ 2556992f48a0Sblueswir1 abi_ulong sharedram; /* Amount of shared memory */ 2557992f48a0Sblueswir1 abi_ulong bufferram; /* Memory used by buffers */ 2558992f48a0Sblueswir1 abi_ulong totalswap; /* Total swap space size */ 2559992f48a0Sblueswir1 abi_ulong freeswap; /* swap space still available */ 2560a5448a7dSbellard unsigned short procs; /* Number of current processes */ 2561a5448a7dSbellard unsigned short pad; /* explicit padding for m68k */ 2562992f48a0Sblueswir1 abi_ulong totalhigh; /* Total high memory size */ 2563992f48a0Sblueswir1 abi_ulong freehigh; /* Available high memory size */ 2564a5448a7dSbellard unsigned int mem_unit; /* Memory unit size in bytes */ 2565992f48a0Sblueswir1 char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 2566a5448a7dSbellard }; 25673532fa74Sbellard 25686556a833Saurel32 struct linux_dirent { 25696556a833Saurel32 long d_ino; 25706556a833Saurel32 unsigned long d_off; 25716556a833Saurel32 unsigned short d_reclen; 25726556a833Saurel32 char d_name[256]; /* We must not include limits.h! */ 25736556a833Saurel32 }; 25746556a833Saurel32 25756556a833Saurel32 struct linux_dirent64 { 25766556a833Saurel32 uint64_t d_ino; 25776556a833Saurel32 int64_t d_off; 25786556a833Saurel32 unsigned short d_reclen; 25796556a833Saurel32 unsigned char d_type; 25806556a833Saurel32 char d_name[256]; 25816556a833Saurel32 }; 25826556a833Saurel32 258324e1003aSaurel32 struct target_mq_attr { 258424e1003aSaurel32 abi_long mq_flags; 258524e1003aSaurel32 abi_long mq_maxmsg; 258624e1003aSaurel32 abi_long mq_msgsize; 258724e1003aSaurel32 abi_long mq_curmsgs; 258824e1003aSaurel32 }; 258924e1003aSaurel32 25903532fa74Sbellard #include "socket.h" 2591637947f1Sths 2592637947f1Sths #include "errno_defs.h" 259303dfe9f8SRiku Voipio 259403dfe9f8SRiku Voipio #define FUTEX_WAIT 0 259503dfe9f8SRiku Voipio #define FUTEX_WAKE 1 259603dfe9f8SRiku Voipio #define FUTEX_FD 2 259703dfe9f8SRiku Voipio #define FUTEX_REQUEUE 3 259803dfe9f8SRiku Voipio #define FUTEX_CMP_REQUEUE 4 259903dfe9f8SRiku Voipio #define FUTEX_WAKE_OP 5 260003dfe9f8SRiku Voipio #define FUTEX_LOCK_PI 6 260103dfe9f8SRiku Voipio #define FUTEX_UNLOCK_PI 7 260203dfe9f8SRiku Voipio #define FUTEX_TRYLOCK_PI 8 260303dfe9f8SRiku Voipio #define FUTEX_WAIT_BITSET 9 260403dfe9f8SRiku Voipio #define FUTEX_WAKE_BITSET 10 260503dfe9f8SRiku Voipio 260603dfe9f8SRiku Voipio #define FUTEX_PRIVATE_FLAG 128 260703dfe9f8SRiku Voipio #define FUTEX_CLOCK_REALTIME 256 260803dfe9f8SRiku Voipio #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) 260903dfe9f8SRiku Voipio 26103b6edd16SPeter Maydell #ifdef CONFIG_EPOLL 2611928bed6aSLaurent Vivier #if defined(TARGET_X86_64) 2612928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED QEMU_PACKED 2613928bed6aSLaurent Vivier #else 2614928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED 2615928bed6aSLaurent Vivier #endif 2616928bed6aSLaurent Vivier 26173b6edd16SPeter Maydell typedef union target_epoll_data { 26183b6edd16SPeter Maydell abi_ulong ptr; 2619928bed6aSLaurent Vivier abi_int fd; 2620928bed6aSLaurent Vivier abi_uint u32; 2621928bed6aSLaurent Vivier abi_ullong u64; 26223b6edd16SPeter Maydell } target_epoll_data_t; 26233b6edd16SPeter Maydell 26243b6edd16SPeter Maydell struct target_epoll_event { 2625928bed6aSLaurent Vivier abi_uint events; 26263b6edd16SPeter Maydell target_epoll_data_t data; 2627928bed6aSLaurent Vivier } TARGET_EPOLL_PACKED; 26282ba7fae3SPeter Maydell 26292ba7fae3SPeter Maydell #define TARGET_EP_MAX_EVENTS (INT_MAX / sizeof(struct target_epoll_event)) 26302ba7fae3SPeter Maydell 26313b6edd16SPeter Maydell #endif 2632163a05a8SPeter Maydell struct target_rlimit64 { 2633163a05a8SPeter Maydell uint64_t rlim_cur; 2634163a05a8SPeter Maydell uint64_t rlim_max; 2635163a05a8SPeter Maydell }; 2636583359a6SAkos PASZTORY 2637583359a6SAkos PASZTORY struct target_ucred { 2638583359a6SAkos PASZTORY uint32_t pid; 2639583359a6SAkos PASZTORY uint32_t uid; 2640583359a6SAkos PASZTORY uint32_t gid; 2641583359a6SAkos PASZTORY }; 2642cb9c377fSPaolo Bonzini 2643aecc8861SAlexander Graf typedef int32_t target_timer_t; 2644905bba13SErik de Castro Lopo 264534d60862SNatanael Copa #define TARGET_SIGEV_MAX_SIZE 64 264634d60862SNatanael Copa 264734d60862SNatanael Copa /* This is architecture-specific but most architectures use the default */ 264834d60862SNatanael Copa #ifdef TARGET_MIPS 264934d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long)) 265034d60862SNatanael Copa #else 265134d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ 265234d60862SNatanael Copa + sizeof(target_sigval_t)) 265334d60862SNatanael Copa #endif 265434d60862SNatanael Copa 265534d60862SNatanael Copa #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ 265634d60862SNatanael Copa - TARGET_SIGEV_PREAMBLE_SIZE) \ 265734d60862SNatanael Copa / sizeof(int32_t)) 265834d60862SNatanael Copa 2659905bba13SErik de Castro Lopo struct target_sigevent { 2660905bba13SErik de Castro Lopo target_sigval_t sigev_value; 2661905bba13SErik de Castro Lopo int32_t sigev_signo; 2662905bba13SErik de Castro Lopo int32_t sigev_notify; 2663905bba13SErik de Castro Lopo union { 266434d60862SNatanael Copa int32_t _pad[TARGET_SIGEV_PAD_SIZE]; 2665905bba13SErik de Castro Lopo int32_t _tid; 2666905bba13SErik de Castro Lopo 2667905bba13SErik de Castro Lopo struct { 2668905bba13SErik de Castro Lopo void (*_function)(sigval_t); 2669905bba13SErik de Castro Lopo void *_attribute; 2670905bba13SErik de Castro Lopo } _sigev_thread; 2671905bba13SErik de Castro Lopo } _sigev_un; 2672905bba13SErik de Castro Lopo }; 2673e0eb210eSPeter Maydell 2674e0eb210eSPeter Maydell struct target_user_cap_header { 2675e0eb210eSPeter Maydell uint32_t version; 2676e0eb210eSPeter Maydell int pid; 2677e0eb210eSPeter Maydell }; 2678e0eb210eSPeter Maydell 2679e0eb210eSPeter Maydell struct target_user_cap_data { 2680e0eb210eSPeter Maydell uint32_t effective; 2681e0eb210eSPeter Maydell uint32_t permitted; 2682e0eb210eSPeter Maydell uint32_t inheritable; 2683e0eb210eSPeter Maydell }; 26841b3c4fdfSMarkus Armbruster 26851b3c4fdfSMarkus Armbruster #endif 2686