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 1231e31b8aSbellard #define SOCKOP_socket 1 1331e31b8aSbellard #define SOCKOP_bind 2 1431e31b8aSbellard #define SOCKOP_connect 3 1531e31b8aSbellard #define SOCKOP_listen 4 1631e31b8aSbellard #define SOCKOP_accept 5 1731e31b8aSbellard #define SOCKOP_getsockname 6 1831e31b8aSbellard #define SOCKOP_getpeername 7 1931e31b8aSbellard #define SOCKOP_socketpair 8 2031e31b8aSbellard #define SOCKOP_send 9 2131e31b8aSbellard #define SOCKOP_recv 10 2231e31b8aSbellard #define SOCKOP_sendto 11 2331e31b8aSbellard #define SOCKOP_recvfrom 12 2431e31b8aSbellard #define SOCKOP_shutdown 13 2531e31b8aSbellard #define SOCKOP_setsockopt 14 2631e31b8aSbellard #define SOCKOP_getsockopt 15 2731e31b8aSbellard #define SOCKOP_sendmsg 16 2831e31b8aSbellard #define SOCKOP_recvmsg 17 29b9d36eb2SAndré Hentschel #define SOCKOP_accept4 18 305a53dc50SJohn Paul Adrian Glaubitz #define SOCKOP_recvmmsg 19 315a53dc50SJohn Paul Adrian Glaubitz #define SOCKOP_sendmmsg 20 3231e31b8aSbellard 338853f86eSbellard #define IPCOP_semop 1 348853f86eSbellard #define IPCOP_semget 2 358853f86eSbellard #define IPCOP_semctl 3 368853f86eSbellard #define IPCOP_semtimedop 4 378853f86eSbellard #define IPCOP_msgsnd 11 388853f86eSbellard #define IPCOP_msgrcv 12 398853f86eSbellard #define IPCOP_msgget 13 408853f86eSbellard #define IPCOP_msgctl 14 418853f86eSbellard #define IPCOP_shmat 21 428853f86eSbellard #define IPCOP_shmdt 22 438853f86eSbellard #define IPCOP_shmget 23 448853f86eSbellard #define IPCOP_shmctl 24 458853f86eSbellard 462521d698Sbellard /* 472521d698Sbellard * The following is for compatibility across the various Linux 482521d698Sbellard * platforms. The i386 ioctl numbering scheme doesn't really enforce 492521d698Sbellard * a type field. De facto, however, the top 8 bits of the lower 16 502521d698Sbellard * bits are indeed used as a type field, so we might just as well make 512521d698Sbellard * this explicit here. Please be sure to use the decoding macros 522521d698Sbellard * below from now on. 532521d698Sbellard */ 542521d698Sbellard #define TARGET_IOC_NRBITS 8 552521d698Sbellard #define TARGET_IOC_TYPEBITS 8 562521d698Sbellard 57716f3fbeSPeter Maydell #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 58716f3fbeSPeter Maydell || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 59cd98d390SAndreas Schwab || defined(TARGET_SPARC) \ 600c866a7eSRiku Voipio || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) 6174d753acSMika Westerberg /* 16 bit uid wrappers emulation */ 6274d753acSMika Westerberg #define USE_UID16 630c866a7eSRiku Voipio #define target_id uint16_t 640c866a7eSRiku Voipio #else 650c866a7eSRiku Voipio #define target_id uint32_t 6674d753acSMika Westerberg #endif 6774d753acSMika Westerberg 68e6e5906bSpbrook #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ 69b16189b2SChen Gang || defined(TARGET_M68K) || defined(TARGET_CRIS) \ 70b16189b2SChen Gang || defined(TARGET_UNICORE32) || defined(TARGET_S390X) \ 71b16189b2SChen Gang || defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) 722521d698Sbellard 732521d698Sbellard #define TARGET_IOC_SIZEBITS 14 742521d698Sbellard #define TARGET_IOC_DIRBITS 2 752521d698Sbellard 762521d698Sbellard #define TARGET_IOC_NONE 0U 772521d698Sbellard #define TARGET_IOC_WRITE 1U 782521d698Sbellard #define TARGET_IOC_READ 2U 792521d698Sbellard 80048f6b4dSbellard #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ 81b779e29eSEdgar E. Iglesias defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \ 82b779e29eSEdgar E. Iglesias defined(TARGET_MIPS) 832521d698Sbellard 842521d698Sbellard #define TARGET_IOC_SIZEBITS 13 852521d698Sbellard #define TARGET_IOC_DIRBITS 3 862521d698Sbellard 872521d698Sbellard #define TARGET_IOC_NONE 1U 882521d698Sbellard #define TARGET_IOC_READ 2U 892521d698Sbellard #define TARGET_IOC_WRITE 4U 902521d698Sbellard 912521d698Sbellard #else 922521d698Sbellard #error unsupported CPU 932521d698Sbellard #endif 942521d698Sbellard 952521d698Sbellard #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) 962521d698Sbellard #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) 972521d698Sbellard #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) 982521d698Sbellard #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) 992521d698Sbellard 1002521d698Sbellard #define TARGET_IOC_NRSHIFT 0 1012521d698Sbellard #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) 1022521d698Sbellard #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) 1032521d698Sbellard #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) 1042521d698Sbellard 1052521d698Sbellard #define TARGET_IOC(dir,type,nr,size) \ 1062521d698Sbellard (((dir) << TARGET_IOC_DIRSHIFT) | \ 1072521d698Sbellard ((type) << TARGET_IOC_TYPESHIFT) | \ 1082521d698Sbellard ((nr) << TARGET_IOC_NRSHIFT) | \ 1092521d698Sbellard ((size) << TARGET_IOC_SIZESHIFT)) 1102521d698Sbellard 1112521d698Sbellard /* used to create numbers */ 1122521d698Sbellard #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) 1132521d698Sbellard #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) 1142521d698Sbellard #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1152521d698Sbellard #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1162521d698Sbellard 1172521d698Sbellard /* the size is automatically computed for these defines */ 1182521d698Sbellard #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) 1192521d698Sbellard #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1202521d698Sbellard #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1212521d698Sbellard 1227854b056Sbellard struct target_sockaddr { 1237854b056Sbellard uint16_t sa_family; 1247854b056Sbellard uint8_t sa_data[14]; 1257854b056Sbellard }; 1267854b056Sbellard 12733a29b51SJoakim Tjernlund struct target_sockaddr_ll { 12833a29b51SJoakim Tjernlund uint16_t sll_family; /* Always AF_PACKET */ 12933a29b51SJoakim Tjernlund uint16_t sll_protocol; /* Physical layer protocol */ 13033a29b51SJoakim Tjernlund int sll_ifindex; /* Interface number */ 13133a29b51SJoakim Tjernlund uint16_t sll_hatype; /* ARP hardware type */ 13233a29b51SJoakim Tjernlund uint8_t sll_pkttype; /* Packet type */ 13333a29b51SJoakim Tjernlund uint8_t sll_halen; /* Length of address */ 13433a29b51SJoakim Tjernlund uint8_t sll_addr[8]; /* Physical layer address */ 13533a29b51SJoakim Tjernlund }; 13633a29b51SJoakim Tjernlund 137fb3aabf3SLaurent Vivier struct target_sockaddr_un { 138fb3aabf3SLaurent Vivier uint16_t su_family; 139fb3aabf3SLaurent Vivier uint8_t sun_path[108]; 140fb3aabf3SLaurent Vivier }; 141fb3aabf3SLaurent Vivier 142fb3aabf3SLaurent Vivier struct target_in_addr { 143fb3aabf3SLaurent Vivier uint32_t s_addr; /* big endian */ 144fb3aabf3SLaurent Vivier }; 145fb3aabf3SLaurent Vivier 146fb3aabf3SLaurent Vivier struct target_sockaddr_in { 147fb3aabf3SLaurent Vivier uint16_t sin_family; 148fb3aabf3SLaurent Vivier int16_t sin_port; /* big endian */ 149fb3aabf3SLaurent Vivier struct target_in_addr sin_addr; 150fb3aabf3SLaurent Vivier uint8_t __pad[sizeof(struct target_sockaddr) - 151fb3aabf3SLaurent Vivier sizeof(uint16_t) - sizeof(int16_t) - 152fb3aabf3SLaurent Vivier sizeof(struct target_in_addr)]; 153fb3aabf3SLaurent Vivier }; 154fb3aabf3SLaurent Vivier 155f57d4192SLaurent Vivier struct target_sock_filter { 156f57d4192SLaurent Vivier abi_ushort code; 157f57d4192SLaurent Vivier uint8_t jt; 158f57d4192SLaurent Vivier uint8_t jf; 159f57d4192SLaurent Vivier abi_uint k; 160f57d4192SLaurent Vivier }; 161f57d4192SLaurent Vivier 162f57d4192SLaurent Vivier struct target_sock_fprog { 163f57d4192SLaurent Vivier abi_ushort len; 164f57d4192SLaurent Vivier abi_ulong filter; 165f57d4192SLaurent Vivier }; 166f57d4192SLaurent Vivier 167b975b83bSLionel Landwerlin struct target_ip_mreq { 168b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 169b975b83bSLionel Landwerlin struct target_in_addr imr_address; 170b975b83bSLionel Landwerlin }; 171b975b83bSLionel Landwerlin 172b975b83bSLionel Landwerlin struct target_ip_mreqn { 173b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 174b975b83bSLionel Landwerlin struct target_in_addr imr_address; 175b975b83bSLionel Landwerlin abi_long imr_ifindex; 176b975b83bSLionel Landwerlin }; 177b975b83bSLionel Landwerlin 1786e3cb58fSLionel Landwerlin struct target_ip_mreq_source { 1796e3cb58fSLionel Landwerlin /* big endian */ 1806e3cb58fSLionel Landwerlin uint32_t imr_multiaddr; 1816e3cb58fSLionel Landwerlin uint32_t imr_interface; 1826e3cb58fSLionel Landwerlin uint32_t imr_sourceaddr; 1836e3cb58fSLionel Landwerlin }; 1846e3cb58fSLionel Landwerlin 18531e31b8aSbellard struct target_timeval { 186992f48a0Sblueswir1 abi_long tv_sec; 187992f48a0Sblueswir1 abi_long tv_usec; 18831e31b8aSbellard }; 18931e31b8aSbellard 1901b6b029eSbellard struct target_timespec { 191992f48a0Sblueswir1 abi_long tv_sec; 192992f48a0Sblueswir1 abi_long tv_nsec; 1931b6b029eSbellard }; 1941b6b029eSbellard 195ef4467e9SPaul Burton struct target_timezone { 196ef4467e9SPaul Burton abi_int tz_minuteswest; 197ef4467e9SPaul Burton abi_int tz_dsttime; 198ef4467e9SPaul Burton }; 199ef4467e9SPaul Burton 20066fb9763Sbellard struct target_itimerval { 20166fb9763Sbellard struct target_timeval it_interval; 20266fb9763Sbellard struct target_timeval it_value; 20366fb9763Sbellard }; 20466fb9763Sbellard 205905bba13SErik de Castro Lopo struct target_itimerspec { 206905bba13SErik de Castro Lopo struct target_timespec it_interval; 207905bba13SErik de Castro Lopo struct target_timespec it_value; 208905bba13SErik de Castro Lopo }; 209905bba13SErik de Castro Lopo 210c227f099SAnthony Liguori typedef abi_long target_clock_t; 21132f36bceSbellard 212c596ed17Sbellard #define TARGET_HZ 100 213c596ed17Sbellard 21432f36bceSbellard struct target_tms { 215c227f099SAnthony Liguori target_clock_t tms_utime; 216c227f099SAnthony Liguori target_clock_t tms_stime; 217c227f099SAnthony Liguori target_clock_t tms_cutime; 218c227f099SAnthony Liguori target_clock_t tms_cstime; 21932f36bceSbellard }; 22032f36bceSbellard 2216180a181Sbellard struct target_utimbuf { 222992f48a0Sblueswir1 abi_long actime; 223992f48a0Sblueswir1 abi_long modtime; 2246180a181Sbellard }; 2256180a181Sbellard 226f2674e31Sbellard struct target_sel_arg_struct { 227992f48a0Sblueswir1 abi_long n; 228992f48a0Sblueswir1 abi_long inp, outp, exp; 229992f48a0Sblueswir1 abi_long tvp; 230f2674e31Sbellard }; 231f2674e31Sbellard 23231e31b8aSbellard struct target_iovec { 233992f48a0Sblueswir1 abi_long iov_base; /* Starting address */ 234992f48a0Sblueswir1 abi_long iov_len; /* Number of bytes */ 23531e31b8aSbellard }; 23631e31b8aSbellard 2371a9353d2Sbellard struct target_msghdr { 238992f48a0Sblueswir1 abi_long msg_name; /* Socket name */ 2391a9353d2Sbellard int msg_namelen; /* Length of name */ 240992f48a0Sblueswir1 abi_long msg_iov; /* Data blocks */ 241992f48a0Sblueswir1 abi_long msg_iovlen; /* Number of blocks */ 242992f48a0Sblueswir1 abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ 243992f48a0Sblueswir1 abi_long msg_controllen; /* Length of cmsg list */ 2441a9353d2Sbellard unsigned int msg_flags; 2451a9353d2Sbellard }; 2461a9353d2Sbellard 2477854b056Sbellard struct target_cmsghdr { 248992f48a0Sblueswir1 abi_long cmsg_len; 2497854b056Sbellard int cmsg_level; 2507854b056Sbellard int cmsg_type; 2517854b056Sbellard }; 2527854b056Sbellard 2537854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) 254ee104587SJonathan Neuschäfer #define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \ 255ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start) 256992f48a0Sblueswir1 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ 257992f48a0Sblueswir1 & (size_t) ~(sizeof (abi_long) - 1)) 2587854b056Sbellard #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \ 2597854b056Sbellard + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr))) 2607854b056Sbellard #define TARGET_CMSG_LEN(len) (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len)) 2617854b056Sbellard 2627854b056Sbellard static __inline__ struct target_cmsghdr * 263ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(struct target_msghdr *__mhdr, 264ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg, 265ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg_start) 2667854b056Sbellard { 2672b8bdefcSths struct target_cmsghdr *__ptr; 2687854b056Sbellard 2692b8bdefcSths __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg 270cbb21eedSMatthias Braun + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len))); 271ee104587SJonathan Neuschäfer if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start) 272ee104587SJonathan Neuschäfer > tswapal(__mhdr->msg_controllen)) { 2737854b056Sbellard /* No more entries. */ 2742b8bdefcSths return (struct target_cmsghdr *)0; 275ee104587SJonathan Neuschäfer } 276ee104587SJonathan Neuschäfer return __ptr; 2777854b056Sbellard } 2787854b056Sbellard 279f19e00d7SAlexander Graf struct target_mmsghdr { 280f19e00d7SAlexander Graf struct target_msghdr msg_hdr; /* Message header */ 281f19e00d7SAlexander Graf unsigned int msg_len; /* Number of bytes transmitted */ 282f19e00d7SAlexander Graf }; 2837854b056Sbellard 28431e31b8aSbellard struct target_rusage { 28531e31b8aSbellard struct target_timeval ru_utime; /* user time used */ 28631e31b8aSbellard struct target_timeval ru_stime; /* system time used */ 287992f48a0Sblueswir1 abi_long ru_maxrss; /* maximum resident set size */ 288992f48a0Sblueswir1 abi_long ru_ixrss; /* integral shared memory size */ 289992f48a0Sblueswir1 abi_long ru_idrss; /* integral unshared data size */ 290992f48a0Sblueswir1 abi_long ru_isrss; /* integral unshared stack size */ 291992f48a0Sblueswir1 abi_long ru_minflt; /* page reclaims */ 292992f48a0Sblueswir1 abi_long ru_majflt; /* page faults */ 293992f48a0Sblueswir1 abi_long ru_nswap; /* swaps */ 294992f48a0Sblueswir1 abi_long ru_inblock; /* block input operations */ 295992f48a0Sblueswir1 abi_long ru_oublock; /* block output operations */ 296992f48a0Sblueswir1 abi_long ru_msgsnd; /* messages sent */ 297992f48a0Sblueswir1 abi_long ru_msgrcv; /* messages received */ 298992f48a0Sblueswir1 abi_long ru_nsignals; /* signals received */ 299992f48a0Sblueswir1 abi_long ru_nvcsw; /* voluntary context switches */ 300992f48a0Sblueswir1 abi_long ru_nivcsw; /* involuntary " */ 30131e31b8aSbellard }; 30231e31b8aSbellard 30331e31b8aSbellard typedef struct { 30431e31b8aSbellard int val[2]; 305c227f099SAnthony Liguori } kernel_fsid_t; 30631e31b8aSbellard 30772f03900Sbellard struct kernel_statfs { 30831e31b8aSbellard int f_type; 30931e31b8aSbellard int f_bsize; 31031e31b8aSbellard int f_blocks; 31131e31b8aSbellard int f_bfree; 31231e31b8aSbellard int f_bavail; 31331e31b8aSbellard int f_files; 31431e31b8aSbellard int f_ffree; 315c227f099SAnthony Liguori kernel_fsid_t f_fsid; 31631e31b8aSbellard int f_namelen; 31731e31b8aSbellard int f_spare[6]; 31831e31b8aSbellard }; 31931e31b8aSbellard 320dab2ed99Sbellard struct target_dirent { 321992f48a0Sblueswir1 abi_long d_ino; 322992f48a0Sblueswir1 abi_long d_off; 323dab2ed99Sbellard unsigned short d_reclen; 324333858b7SDmitry V. Levin char d_name[]; 325dab2ed99Sbellard }; 326dab2ed99Sbellard 327dab2ed99Sbellard struct target_dirent64 { 328dab2ed99Sbellard uint64_t d_ino; 329dab2ed99Sbellard int64_t d_off; 330dab2ed99Sbellard unsigned short d_reclen; 331dab2ed99Sbellard unsigned char d_type; 332dab2ed99Sbellard char d_name[256]; 333dab2ed99Sbellard }; 334dab2ed99Sbellard 335dab2ed99Sbellard 33631e31b8aSbellard /* mostly generic signal stuff */ 337992f48a0Sblueswir1 #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ 338992f48a0Sblueswir1 #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ 339992f48a0Sblueswir1 #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ 34031e31b8aSbellard 34131e31b8aSbellard #ifdef TARGET_MIPS 34231e31b8aSbellard #define TARGET_NSIG 128 34331e31b8aSbellard #else 34431e31b8aSbellard #define TARGET_NSIG 64 34531e31b8aSbellard #endif 346992f48a0Sblueswir1 #define TARGET_NSIG_BPW TARGET_ABI_BITS 34731e31b8aSbellard #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) 34831e31b8aSbellard 34931e31b8aSbellard typedef struct { 350992f48a0Sblueswir1 abi_ulong sig[TARGET_NSIG_WORDS]; 351c227f099SAnthony Liguori } target_sigset_t; 35231e31b8aSbellard 35366fb9763Sbellard #ifdef BSWAP_NEEDED 354c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 35566fb9763Sbellard { 35666fb9763Sbellard int i; 35766fb9763Sbellard for(i = 0;i < TARGET_NSIG_WORDS; i++) 358cbb21eedSMatthias Braun d->sig[i] = tswapal(s->sig[i]); 35966fb9763Sbellard } 36066fb9763Sbellard #else 361c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 36266fb9763Sbellard { 36366fb9763Sbellard *d = *s; 36466fb9763Sbellard } 36566fb9763Sbellard #endif 36666fb9763Sbellard 367c227f099SAnthony Liguori static inline void target_siginitset(target_sigset_t *d, abi_ulong set) 36866fb9763Sbellard { 36966fb9763Sbellard int i; 37066fb9763Sbellard d->sig[0] = set; 37166fb9763Sbellard for(i = 1;i < TARGET_NSIG_WORDS; i++) 37266fb9763Sbellard d->sig[i] = 0; 37366fb9763Sbellard } 37466fb9763Sbellard 375c227f099SAnthony Liguori void host_to_target_sigset(target_sigset_t *d, const sigset_t *s); 376c227f099SAnthony Liguori void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); 377992f48a0Sblueswir1 void host_to_target_old_sigset(abi_ulong *old_sigset, 37866fb9763Sbellard const sigset_t *sigset); 37966fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset, 380992f48a0Sblueswir1 const abi_ulong *old_sigset); 38166fb9763Sbellard struct target_sigaction; 38266fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act, 38366fb9763Sbellard struct target_sigaction *oact); 38466fb9763Sbellard 385d2fbca94SGuan Xuetao #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \ 386d2fbca94SGuan Xuetao || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined(TARGET_SH4) \ 387d2fbca94SGuan Xuetao || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) \ 388a4c075f1SUlrich Hecht || defined(TARGET_MICROBLAZE) || defined(TARGET_UNICORE32) \ 389b16189b2SChen Gang || defined(TARGET_S390X) || defined(TARGET_OPENRISC) \ 390b16189b2SChen Gang || defined(TARGET_TILEGX) 3912521d698Sbellard 392048f6b4dSbellard #if defined(TARGET_SPARC) 393048f6b4dSbellard #define TARGET_SA_NOCLDSTOP 8u 394048f6b4dSbellard #define TARGET_SA_NOCLDWAIT 0x100u 395048f6b4dSbellard #define TARGET_SA_SIGINFO 0x200u 396048f6b4dSbellard #define TARGET_SA_ONSTACK 1u 397048f6b4dSbellard #define TARGET_SA_RESTART 2u 398048f6b4dSbellard #define TARGET_SA_NODEFER 0x20u 399048f6b4dSbellard #define TARGET_SA_RESETHAND 4u 400048f6b4dSbellard #elif defined(TARGET_MIPS) 401048f6b4dSbellard #define TARGET_SA_NOCLDSTOP 0x00000001 402048f6b4dSbellard #define TARGET_SA_NOCLDWAIT 0x00010000 403048f6b4dSbellard #define TARGET_SA_SIGINFO 0x00000008 404048f6b4dSbellard #define TARGET_SA_ONSTACK 0x08000000 405048f6b4dSbellard #define TARGET_SA_NODEFER 0x40000000 406048f6b4dSbellard #define TARGET_SA_RESTART 0x10000000 407048f6b4dSbellard #define TARGET_SA_RESETHAND 0x80000000 408d26bc211Sths #if !defined(TARGET_ABI_MIPSN32) && !defined(TARGET_ABI_MIPSN64) 409d26bc211Sths #define TARGET_SA_RESTORER 0x04000000 /* Only for O32 */ 410540635baSths #endif 411d962783eSJia Liu #elif defined(TARGET_OPENRISC) 412d962783eSJia Liu #define TARGET_SA_NOCLDSTOP 0x00000001 413d962783eSJia Liu #define TARGET_SA_NOCLDWAIT 0x00000002 414d962783eSJia Liu #define TARGET_SA_SIGINFO 0x00000004 415d962783eSJia Liu #define TARGET_SA_ONSTACK 0x08000000 416d962783eSJia Liu #define TARGET_SA_RESTART 0x10000000 417d962783eSJia Liu #define TARGET_SA_NODEFER 0x40000000 418d962783eSJia Liu #define TARGET_SA_RESETHAND 0x80000000 41957f18a95SRichard Henderson #elif defined(TARGET_ALPHA) 42057f18a95SRichard Henderson #define TARGET_SA_ONSTACK 0x00000001 42157f18a95SRichard Henderson #define TARGET_SA_RESTART 0x00000002 42257f18a95SRichard Henderson #define TARGET_SA_NOCLDSTOP 0x00000004 42357f18a95SRichard Henderson #define TARGET_SA_NODEFER 0x00000008 42457f18a95SRichard Henderson #define TARGET_SA_RESETHAND 0x00000010 42557f18a95SRichard Henderson #define TARGET_SA_NOCLDWAIT 0x00000020 /* not supported yet */ 42657f18a95SRichard Henderson #define TARGET_SA_SIGINFO 0x00000040 427048f6b4dSbellard #else 4282521d698Sbellard #define TARGET_SA_NOCLDSTOP 0x00000001 4292521d698Sbellard #define TARGET_SA_NOCLDWAIT 0x00000002 /* not supported yet */ 4302521d698Sbellard #define TARGET_SA_SIGINFO 0x00000004 4312521d698Sbellard #define TARGET_SA_ONSTACK 0x08000000 4322521d698Sbellard #define TARGET_SA_RESTART 0x10000000 4332521d698Sbellard #define TARGET_SA_NODEFER 0x40000000 4342521d698Sbellard #define TARGET_SA_RESETHAND 0x80000000 4352521d698Sbellard #define TARGET_SA_RESTORER 0x04000000 4366d5e216dSbellard #endif 4376d5e216dSbellard 438d0f20495SRichard Henderson #if defined(TARGET_ALPHA) 439d0f20495SRichard Henderson 440d0f20495SRichard Henderson #define TARGET_SIGHUP 1 441d0f20495SRichard Henderson #define TARGET_SIGINT 2 442d0f20495SRichard Henderson #define TARGET_SIGQUIT 3 443d0f20495SRichard Henderson #define TARGET_SIGILL 4 444d0f20495SRichard Henderson #define TARGET_SIGTRAP 5 445d0f20495SRichard Henderson #define TARGET_SIGABRT 6 446d0f20495SRichard Henderson #define TARGET_SIGSTKFLT 7 /* actually SIGEMT */ 447d0f20495SRichard Henderson #define TARGET_SIGFPE 8 448d0f20495SRichard Henderson #define TARGET_SIGKILL 9 449d0f20495SRichard Henderson #define TARGET_SIGBUS 10 450d0f20495SRichard Henderson #define TARGET_SIGSEGV 11 451d0f20495SRichard Henderson #define TARGET_SIGSYS 12 452d0f20495SRichard Henderson #define TARGET_SIGPIPE 13 453d0f20495SRichard Henderson #define TARGET_SIGALRM 14 454d0f20495SRichard Henderson #define TARGET_SIGTERM 15 455d0f20495SRichard Henderson #define TARGET_SIGURG 16 456d0f20495SRichard Henderson #define TARGET_SIGSTOP 17 457d0f20495SRichard Henderson #define TARGET_SIGTSTP 18 458d0f20495SRichard Henderson #define TARGET_SIGCONT 19 459d0f20495SRichard Henderson #define TARGET_SIGCHLD 20 460d0f20495SRichard Henderson #define TARGET_SIGTTIN 21 461d0f20495SRichard Henderson #define TARGET_SIGTTOU 22 462d0f20495SRichard Henderson #define TARGET_SIGIO 23 463d0f20495SRichard Henderson #define TARGET_SIGXCPU 24 464d0f20495SRichard Henderson #define TARGET_SIGXFSZ 25 465d0f20495SRichard Henderson #define TARGET_SIGVTALRM 26 466d0f20495SRichard Henderson #define TARGET_SIGPROF 27 467d0f20495SRichard Henderson #define TARGET_SIGWINCH 28 468d0f20495SRichard Henderson #define TARGET_SIGPWR 29 /* actually SIGINFO */ 469d0f20495SRichard Henderson #define TARGET_SIGUSR1 30 470d0f20495SRichard Henderson #define TARGET_SIGUSR2 31 471d0f20495SRichard Henderson #define TARGET_SIGRTMIN 32 472d0f20495SRichard Henderson 473d0f20495SRichard Henderson #define TARGET_SIG_BLOCK 1 474d0f20495SRichard Henderson #define TARGET_SIG_UNBLOCK 2 475d0f20495SRichard Henderson #define TARGET_SIG_SETMASK 3 476d0f20495SRichard Henderson 477d0f20495SRichard Henderson #elif defined(TARGET_SPARC) 4786d5e216dSbellard 4796d5e216dSbellard #define TARGET_SIGHUP 1 4806d5e216dSbellard #define TARGET_SIGINT 2 4816d5e216dSbellard #define TARGET_SIGQUIT 3 4826d5e216dSbellard #define TARGET_SIGILL 4 4836d5e216dSbellard #define TARGET_SIGTRAP 5 4846d5e216dSbellard #define TARGET_SIGABRT 6 4856d5e216dSbellard #define TARGET_SIGIOT 6 4866d5e216dSbellard #define TARGET_SIGSTKFLT 7 /* actually EMT */ 4876d5e216dSbellard #define TARGET_SIGFPE 8 4886d5e216dSbellard #define TARGET_SIGKILL 9 4896d5e216dSbellard #define TARGET_SIGBUS 10 4906d5e216dSbellard #define TARGET_SIGSEGV 11 4916d5e216dSbellard #define TARGET_SIGSYS 12 4926d5e216dSbellard #define TARGET_SIGPIPE 13 4936d5e216dSbellard #define TARGET_SIGALRM 14 4946d5e216dSbellard #define TARGET_SIGTERM 15 4956d5e216dSbellard #define TARGET_SIGURG 16 4966d5e216dSbellard #define TARGET_SIGSTOP 17 4976d5e216dSbellard #define TARGET_SIGTSTP 18 4986d5e216dSbellard #define TARGET_SIGCONT 19 4996d5e216dSbellard #define TARGET_SIGCHLD 20 5006d5e216dSbellard #define TARGET_SIGTTIN 21 5016d5e216dSbellard #define TARGET_SIGTTOU 22 5026d5e216dSbellard #define TARGET_SIGIO 23 5036d5e216dSbellard #define TARGET_SIGXCPU 24 5046d5e216dSbellard #define TARGET_SIGXFSZ 25 5056d5e216dSbellard #define TARGET_SIGVTALRM 26 5066d5e216dSbellard #define TARGET_SIGPROF 27 5076d5e216dSbellard #define TARGET_SIGWINCH 28 5086d5e216dSbellard #define TARGET_SIGPWR 29 5096d5e216dSbellard #define TARGET_SIGUSR1 30 5106d5e216dSbellard #define TARGET_SIGUSR2 31 5116d5e216dSbellard #define TARGET_SIGRTMIN 32 5126d5e216dSbellard 5136d5e216dSbellard #define TARGET_SIG_BLOCK 0x01 /* for blocking signals */ 5146d5e216dSbellard #define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */ 5156d5e216dSbellard #define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */ 5166d5e216dSbellard 517048f6b4dSbellard #elif defined(TARGET_MIPS) 518048f6b4dSbellard 519048f6b4dSbellard #define TARGET_SIGHUP 1 /* Hangup (POSIX). */ 520048f6b4dSbellard #define TARGET_SIGINT 2 /* Interrupt (ANSI). */ 521048f6b4dSbellard #define TARGET_SIGQUIT 3 /* Quit (POSIX). */ 522048f6b4dSbellard #define TARGET_SIGILL 4 /* Illegal instruction (ANSI). */ 523048f6b4dSbellard #define TARGET_SIGTRAP 5 /* Trace trap (POSIX). */ 524048f6b4dSbellard #define TARGET_SIGIOT 6 /* IOT trap (4.2 BSD). */ 525048f6b4dSbellard #define TARGET_SIGABRT TARGET_SIGIOT /* Abort (ANSI). */ 526048f6b4dSbellard #define TARGET_SIGEMT 7 527048f6b4dSbellard #define TARGET_SIGSTKFLT 7 /* XXX: incorrect */ 528048f6b4dSbellard #define TARGET_SIGFPE 8 /* Floating-point exception (ANSI). */ 529048f6b4dSbellard #define TARGET_SIGKILL 9 /* Kill, unblockable (POSIX). */ 530048f6b4dSbellard #define TARGET_SIGBUS 10 /* BUS error (4.2 BSD). */ 531048f6b4dSbellard #define TARGET_SIGSEGV 11 /* Segmentation violation (ANSI). */ 532048f6b4dSbellard #define TARGET_SIGSYS 12 533048f6b4dSbellard #define TARGET_SIGPIPE 13 /* Broken pipe (POSIX). */ 534048f6b4dSbellard #define TARGET_SIGALRM 14 /* Alarm clock (POSIX). */ 535048f6b4dSbellard #define TARGET_SIGTERM 15 /* Termination (ANSI). */ 536048f6b4dSbellard #define TARGET_SIGUSR1 16 /* User-defined signal 1 (POSIX). */ 537048f6b4dSbellard #define TARGET_SIGUSR2 17 /* User-defined signal 2 (POSIX). */ 538048f6b4dSbellard #define TARGET_SIGCHLD 18 /* Child status has changed (POSIX). */ 539048f6b4dSbellard #define TARGET_SIGCLD TARGET_SIGCHLD /* Same as TARGET_SIGCHLD (System V). */ 540048f6b4dSbellard #define TARGET_SIGPWR 19 /* Power failure restart (System V). */ 541048f6b4dSbellard #define TARGET_SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */ 542048f6b4dSbellard #define TARGET_SIGURG 21 /* Urgent condition on socket (4.2 BSD). */ 543048f6b4dSbellard #define TARGET_SIGIO 22 /* I/O now possible (4.2 BSD). */ 544048f6b4dSbellard #define TARGET_SIGPOLL TARGET_SIGIO /* Pollable event occurred (System V). */ 545048f6b4dSbellard #define TARGET_SIGSTOP 23 /* Stop, unblockable (POSIX). */ 546048f6b4dSbellard #define TARGET_SIGTSTP 24 /* Keyboard stop (POSIX). */ 547048f6b4dSbellard #define TARGET_SIGCONT 25 /* Continue (POSIX). */ 548048f6b4dSbellard #define TARGET_SIGTTIN 26 /* Background read from tty (POSIX). */ 549048f6b4dSbellard #define TARGET_SIGTTOU 27 /* Background write to tty (POSIX). */ 550048f6b4dSbellard #define TARGET_SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */ 551048f6b4dSbellard #define TARGET_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */ 552048f6b4dSbellard #define TARGET_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ 553048f6b4dSbellard #define TARGET_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ 554048f6b4dSbellard #define TARGET_SIGRTMIN 32 555048f6b4dSbellard 556048f6b4dSbellard #define TARGET_SIG_BLOCK 1 /* for blocking signals */ 557048f6b4dSbellard #define TARGET_SIG_UNBLOCK 2 /* for unblocking signals */ 558048f6b4dSbellard #define TARGET_SIG_SETMASK 3 /* for setting the signal mask */ 559048f6b4dSbellard 5606d5e216dSbellard #else 5612521d698Sbellard 562d962783eSJia Liu /* OpenRISC Using the general signals */ 5632521d698Sbellard #define TARGET_SIGHUP 1 5642521d698Sbellard #define TARGET_SIGINT 2 5652521d698Sbellard #define TARGET_SIGQUIT 3 5662521d698Sbellard #define TARGET_SIGILL 4 5672521d698Sbellard #define TARGET_SIGTRAP 5 5682521d698Sbellard #define TARGET_SIGABRT 6 5692521d698Sbellard #define TARGET_SIGIOT 6 5702521d698Sbellard #define TARGET_SIGBUS 7 5712521d698Sbellard #define TARGET_SIGFPE 8 5722521d698Sbellard #define TARGET_SIGKILL 9 5732521d698Sbellard #define TARGET_SIGUSR1 10 5742521d698Sbellard #define TARGET_SIGSEGV 11 5752521d698Sbellard #define TARGET_SIGUSR2 12 5762521d698Sbellard #define TARGET_SIGPIPE 13 5772521d698Sbellard #define TARGET_SIGALRM 14 5782521d698Sbellard #define TARGET_SIGTERM 15 5792521d698Sbellard #define TARGET_SIGSTKFLT 16 5802521d698Sbellard #define TARGET_SIGCHLD 17 5812521d698Sbellard #define TARGET_SIGCONT 18 5822521d698Sbellard #define TARGET_SIGSTOP 19 5832521d698Sbellard #define TARGET_SIGTSTP 20 5842521d698Sbellard #define TARGET_SIGTTIN 21 5852521d698Sbellard #define TARGET_SIGTTOU 22 5862521d698Sbellard #define TARGET_SIGURG 23 5872521d698Sbellard #define TARGET_SIGXCPU 24 5882521d698Sbellard #define TARGET_SIGXFSZ 25 5892521d698Sbellard #define TARGET_SIGVTALRM 26 5902521d698Sbellard #define TARGET_SIGPROF 27 5912521d698Sbellard #define TARGET_SIGWINCH 28 5922521d698Sbellard #define TARGET_SIGIO 29 593c596ed17Sbellard #define TARGET_SIGPWR 30 594c596ed17Sbellard #define TARGET_SIGSYS 31 5952521d698Sbellard #define TARGET_SIGRTMIN 32 5962521d698Sbellard 5972521d698Sbellard #define TARGET_SIG_BLOCK 0 /* for blocking signals */ 5982521d698Sbellard #define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */ 5992521d698Sbellard #define TARGET_SIG_SETMASK 2 /* for setting the signal mask */ 6002521d698Sbellard 6016d5e216dSbellard #endif 6026d5e216dSbellard 6036049f4f8SRichard Henderson #if defined(TARGET_ALPHA) 6046049f4f8SRichard Henderson struct target_old_sigaction { 6056049f4f8SRichard Henderson abi_ulong _sa_handler; 6066049f4f8SRichard Henderson abi_ulong sa_mask; 607d2565875SRichard Henderson int32_t sa_flags; 6086049f4f8SRichard Henderson }; 609106ec879Sbellard 6106049f4f8SRichard Henderson struct target_rt_sigaction { 6116049f4f8SRichard Henderson abi_ulong _sa_handler; 6126049f4f8SRichard Henderson abi_ulong sa_flags; 6136049f4f8SRichard Henderson target_sigset_t sa_mask; 6146049f4f8SRichard Henderson }; 6156049f4f8SRichard Henderson 6166049f4f8SRichard Henderson /* This is the struct used inside the kernel. The ka_restorer 6176049f4f8SRichard Henderson field comes from the 5th argument to sys_rt_sigaction. */ 6186049f4f8SRichard Henderson struct target_sigaction { 6196049f4f8SRichard Henderson abi_ulong _sa_handler; 6206049f4f8SRichard Henderson abi_ulong sa_flags; 6216049f4f8SRichard Henderson target_sigset_t sa_mask; 6226049f4f8SRichard Henderson abi_ulong sa_restorer; 6236049f4f8SRichard Henderson }; 6246049f4f8SRichard Henderson #elif defined(TARGET_MIPS) 625106ec879Sbellard struct target_sigaction { 626540635baSths uint32_t sa_flags; 627d26bc211Sths #if defined(TARGET_ABI_MIPSN32) 628540635baSths uint32_t _sa_handler; 629540635baSths #else 630992f48a0Sblueswir1 abi_ulong _sa_handler; 631540635baSths #endif 632c227f099SAnthony Liguori target_sigset_t sa_mask; 633106ec879Sbellard }; 634106ec879Sbellard #else 6352521d698Sbellard struct target_old_sigaction { 636992f48a0Sblueswir1 abi_ulong _sa_handler; 637992f48a0Sblueswir1 abi_ulong sa_mask; 638992f48a0Sblueswir1 abi_ulong sa_flags; 639992f48a0Sblueswir1 abi_ulong sa_restorer; 6402521d698Sbellard }; 6412521d698Sbellard 6422521d698Sbellard struct target_sigaction { 643992f48a0Sblueswir1 abi_ulong _sa_handler; 644992f48a0Sblueswir1 abi_ulong sa_flags; 645992f48a0Sblueswir1 abi_ulong sa_restorer; 646c227f099SAnthony Liguori target_sigset_t sa_mask; 6472521d698Sbellard }; 648106ec879Sbellard #endif 6492521d698Sbellard 6502521d698Sbellard typedef union target_sigval { 6512521d698Sbellard int sival_int; 652992f48a0Sblueswir1 abi_ulong sival_ptr; 653c227f099SAnthony Liguori } target_sigval_t; 6546d5e216dSbellard #if 0 6556d5e216dSbellard #if defined (TARGET_SPARC) 6566d5e216dSbellard typedef struct { 6576d5e216dSbellard struct { 658992f48a0Sblueswir1 abi_ulong psr; 659992f48a0Sblueswir1 abi_ulong pc; 660992f48a0Sblueswir1 abi_ulong npc; 661992f48a0Sblueswir1 abi_ulong y; 662992f48a0Sblueswir1 abi_ulong u_regs[16]; /* globals and ins */ 6636d5e216dSbellard } si_regs; 6646d5e216dSbellard int si_mask; 6656d5e216dSbellard } __siginfo_t; 6666d5e216dSbellard 6676d5e216dSbellard typedef struct { 6686d5e216dSbellard unsigned long si_float_regs [32]; 6696d5e216dSbellard unsigned long si_fsr; 6706d5e216dSbellard unsigned long si_fpqdepth; 6716d5e216dSbellard struct { 6726d5e216dSbellard unsigned long *insn_addr; 6736d5e216dSbellard unsigned long insn; 6746d5e216dSbellard } si_fpqueue [16]; 6756d5e216dSbellard } __siginfo_fpu_t; 6766d5e216dSbellard #endif 6776d5e216dSbellard #endif 6782521d698Sbellard 6792521d698Sbellard #define TARGET_SI_MAX_SIZE 128 680aa5e03d2SMaxim Ostapenko 681aa5e03d2SMaxim Ostapenko #if TARGET_ABI_BITS == 32 682aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int)) 683aa5e03d2SMaxim Ostapenko #else 684aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int)) 685aa5e03d2SMaxim Ostapenko #endif 686aa5e03d2SMaxim Ostapenko 687aa5e03d2SMaxim Ostapenko #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int)) 6882521d698Sbellard 689a70dadc7SPeter Maydell /* Within QEMU the top 16 bits of si_code indicate which of the parts of 690a70dadc7SPeter Maydell * the union in target_siginfo is valid. This only applies between 691a70dadc7SPeter Maydell * host_to_target_siginfo_noswap() and tswap_siginfo(); it does not 692a70dadc7SPeter Maydell * appear either within host siginfo_t or in target_siginfo structures 693a70dadc7SPeter Maydell * which we get from the guest userspace program. (The Linux kernel 694a70dadc7SPeter Maydell * does a similar thing with using the top bits for its own internal 695a70dadc7SPeter Maydell * purposes but not letting them be visible to userspace.) 696a70dadc7SPeter Maydell */ 697a70dadc7SPeter Maydell #define QEMU_SI_KILL 0 698a70dadc7SPeter Maydell #define QEMU_SI_TIMER 1 699a70dadc7SPeter Maydell #define QEMU_SI_POLL 2 700a70dadc7SPeter Maydell #define QEMU_SI_FAULT 3 701a70dadc7SPeter Maydell #define QEMU_SI_CHLD 4 702a70dadc7SPeter Maydell #define QEMU_SI_RT 5 703a70dadc7SPeter Maydell 7042521d698Sbellard typedef struct target_siginfo { 7053f53d546Spbrook #ifdef TARGET_MIPS 7063f53d546Spbrook int si_signo; 7073f53d546Spbrook int si_code; 7083f53d546Spbrook int si_errno; 7093f53d546Spbrook #else 7102521d698Sbellard int si_signo; 7112521d698Sbellard int si_errno; 7122521d698Sbellard int si_code; 7133f53d546Spbrook #endif 7142521d698Sbellard 7152521d698Sbellard union { 7162521d698Sbellard int _pad[TARGET_SI_PAD_SIZE]; 7172521d698Sbellard 7182521d698Sbellard /* kill() */ 7192521d698Sbellard struct { 7202521d698Sbellard pid_t _pid; /* sender's pid */ 7212521d698Sbellard uid_t _uid; /* sender's uid */ 7222521d698Sbellard } _kill; 7232521d698Sbellard 7242521d698Sbellard /* POSIX.1b timers */ 7252521d698Sbellard struct { 7262521d698Sbellard unsigned int _timer1; 7272521d698Sbellard unsigned int _timer2; 7282521d698Sbellard } _timer; 7292521d698Sbellard 7302521d698Sbellard /* POSIX.1b signals */ 7312521d698Sbellard struct { 7322521d698Sbellard pid_t _pid; /* sender's pid */ 7332521d698Sbellard uid_t _uid; /* sender's uid */ 734c227f099SAnthony Liguori target_sigval_t _sigval; 7352521d698Sbellard } _rt; 7362521d698Sbellard 7372521d698Sbellard /* SIGCHLD */ 7382521d698Sbellard struct { 7392521d698Sbellard pid_t _pid; /* which child */ 7402521d698Sbellard uid_t _uid; /* sender's uid */ 7412521d698Sbellard int _status; /* exit code */ 742c227f099SAnthony Liguori target_clock_t _utime; 743c227f099SAnthony Liguori target_clock_t _stime; 7442521d698Sbellard } _sigchld; 7452521d698Sbellard 7462521d698Sbellard /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 7472521d698Sbellard struct { 748992f48a0Sblueswir1 abi_ulong _addr; /* faulting insn/memory ref. */ 7492521d698Sbellard } _sigfault; 7502521d698Sbellard 7512521d698Sbellard /* SIGPOLL */ 7522521d698Sbellard struct { 7532521d698Sbellard int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 7542521d698Sbellard int _fd; 7552521d698Sbellard } _sigpoll; 7562521d698Sbellard } _sifields; 757c227f099SAnthony Liguori } target_siginfo_t; 7582521d698Sbellard 7592521d698Sbellard /* 7602521d698Sbellard * si_code values 7612521d698Sbellard * Digital reserves positive values for kernel-generated signals. 7622521d698Sbellard */ 7632521d698Sbellard #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ 7642521d698Sbellard #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 7652521d698Sbellard #define TARGET_SI_QUEUE -1 /* sent by sigqueue */ 7662521d698Sbellard #define TARGET_SI_TIMER -2 /* sent by timer expiration */ 7672521d698Sbellard #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ 7682521d698Sbellard #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ 7692521d698Sbellard #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ 7702521d698Sbellard 7712521d698Sbellard /* 7722521d698Sbellard * SIGILL si_codes 7732521d698Sbellard */ 774ffa65c3bSbellard #define TARGET_ILL_ILLOPC (1) /* illegal opcode */ 7752521d698Sbellard #define TARGET_ILL_ILLOPN (2) /* illegal operand */ 776ffa65c3bSbellard #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ 777ffa65c3bSbellard #define TARGET_ILL_ILLTRP (4) /* illegal trap */ 778ffa65c3bSbellard #define TARGET_ILL_PRVOPC (5) /* privileged opcode */ 779ffa65c3bSbellard #define TARGET_ILL_PRVREG (6) /* privileged register */ 780ffa65c3bSbellard #define TARGET_ILL_COPROC (7) /* coprocessor error */ 781ffa65c3bSbellard #define TARGET_ILL_BADSTK (8) /* internal stack error */ 782de2fdd56SChen Gang #ifdef TARGET_TILEGX 783de2fdd56SChen Gang #define TARGET_ILL_DBLFLT (9) /* double fault */ 784de2fdd56SChen Gang #define TARGET_ILL_HARDWALL (10) /* user networks hardwall violation */ 785de2fdd56SChen Gang #endif 7862521d698Sbellard 7872521d698Sbellard /* 7882521d698Sbellard * SIGFPE si_codes 7892521d698Sbellard */ 7902521d698Sbellard #define TARGET_FPE_INTDIV (1) /* integer divide by zero */ 7912521d698Sbellard #define TARGET_FPE_INTOVF (2) /* integer overflow */ 7922521d698Sbellard #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ 7932521d698Sbellard #define TARGET_FPE_FLTOVF (4) /* floating point overflow */ 7942521d698Sbellard #define TARGET_FPE_FLTUND (5) /* floating point underflow */ 7952521d698Sbellard #define TARGET_FPE_FLTRES (6) /* floating point inexact result */ 7962521d698Sbellard #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ 7972521d698Sbellard #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ 7982521d698Sbellard #define TARGET_NSIGFPE 8 7992521d698Sbellard 8002521d698Sbellard /* 8012521d698Sbellard * SIGSEGV si_codes 8022521d698Sbellard */ 8032521d698Sbellard #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ 8042521d698Sbellard #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ 805de2fdd56SChen Gang #define TARGET_SEGV_BNDERR (3) /* failed address bound checks */ 8062521d698Sbellard 8072521d698Sbellard /* 808ffa65c3bSbellard * SIGBUS si_codes 809ffa65c3bSbellard */ 810ffa65c3bSbellard #define TARGET_BUS_ADRALN (1) /* invalid address alignment */ 811b4916d7bSDong Xu Wang #define TARGET_BUS_ADRERR (2) /* non-existent physical address */ 812ffa65c3bSbellard #define TARGET_BUS_OBJERR (3) /* object specific hardware error */ 813de2fdd56SChen Gang /* hardware memory error consumed on a machine check: action required */ 814de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AR (4) 815de2fdd56SChen Gang /* hardware memory error detected in process but not consumed: action optional*/ 816de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AO (5) 817ffa65c3bSbellard 818ffa65c3bSbellard /* 8192521d698Sbellard * SIGTRAP si_codes 8202521d698Sbellard */ 8212521d698Sbellard #define TARGET_TRAP_BRKPT (1) /* process breakpoint */ 8222521d698Sbellard #define TARGET_TRAP_TRACE (2) /* process trace trap */ 823de2fdd56SChen Gang #define TARGET_TRAP_BRANCH (3) /* process taken branch trap */ 824de2fdd56SChen Gang #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */ 8252521d698Sbellard 8262521d698Sbellard #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */ 8272521d698Sbellard 8289de5e440Sbellard struct target_rlimit { 829992f48a0Sblueswir1 abi_ulong rlim_cur; 830992f48a0Sblueswir1 abi_ulong rlim_max; 8319de5e440Sbellard }; 8329de5e440Sbellard 83381bbe906Stakasi-y@ops.dti.ne.jp #if defined(TARGET_ALPHA) 834e476492eSAurelien Jarno #define TARGET_RLIM_INFINITY 0x7fffffffffffffffull 8356cafd027SMatthias Braun #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32) 83681bbe906Stakasi-y@ops.dti.ne.jp #define TARGET_RLIM_INFINITY 0x7fffffffUL 83781bbe906Stakasi-y@ops.dti.ne.jp #else 83826b746dbSMatthias Braun #define TARGET_RLIM_INFINITY ((abi_ulong)-1) 83981bbe906Stakasi-y@ops.dti.ne.jp #endif 84081bbe906Stakasi-y@ops.dti.ne.jp 841e22b7015SWesley W. Terpstra #if defined(TARGET_MIPS) 842e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 843e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 844e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 845e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 846e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 847e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 7 848e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 8 849e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 5 850e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 9 851e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 6 852e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 853e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 854e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 855e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 856e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 857e22b7015SWesley W. Terpstra #else 858e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 859e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 860e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 861e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 862e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 863e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 5 8646cafd027SMatthias Braun #if defined(TARGET_SPARC) 8656cafd027SMatthias Braun #define TARGET_RLIMIT_NOFILE 6 8666cafd027SMatthias Braun #define TARGET_RLIMIT_NPROC 7 8676cafd027SMatthias Braun #else 868e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 6 869e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 7 8706cafd027SMatthias Braun #endif 871e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 8 872e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 9 873e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 874e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 875e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 876e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 877e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 878e22b7015SWesley W. Terpstra #endif 879e22b7015SWesley W. Terpstra 8809de5e440Sbellard struct target_pollfd { 8819de5e440Sbellard int fd; /* file descriptor */ 8829de5e440Sbellard short events; /* requested events */ 8839de5e440Sbellard short revents; /* returned events */ 8849de5e440Sbellard }; 8859de5e440Sbellard 8868e5a0667Sbellard /* virtual terminal ioctls */ 8870221cfcdSbellard #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ 8880221cfcdSbellard #define TARGET_KDMKTONE 0x4B30 /* generate tone */ 8898e5a0667Sbellard #define TARGET_KDGKBTYPE 0x4b33 890f7680a55SUlrich Hecht #define TARGET_KDSETMODE 0x4b3a 891f7680a55SUlrich Hecht #define TARGET_KDGKBMODE 0x4b44 892f7680a55SUlrich Hecht #define TARGET_KDSKBMODE 0x4b45 8930221cfcdSbellard #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ 8940221cfcdSbellard #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ 895e6fe18fbSCédric VINCENT #define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ 896e6fe18fbSCédric VINCENT #define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ 897e6fe18fbSCédric VINCENT #define TARGET_KDGETLED 0x4B31 /* return current led state */ 898e6fe18fbSCédric VINCENT #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */ 899ca56f5b5SPaul Burton #define TARGET_KDSIGACCEPT 0x4B4E 9008e5a0667Sbellard 9012521d698Sbellard #define TARGET_SIOCATMARK 0x8905 9022521d698Sbellard 90331e31b8aSbellard /* Networking ioctls */ 90431e31b8aSbellard #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ 90531e31b8aSbellard #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ 90631e31b8aSbellard #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ 90731e31b8aSbellard #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ 90831e31b8aSbellard #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ 90931e31b8aSbellard #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ 91031e31b8aSbellard #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ 91131e31b8aSbellard #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ 91231e31b8aSbellard #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ 91331e31b8aSbellard #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ 91431e31b8aSbellard #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ 91531e31b8aSbellard #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ 91631e31b8aSbellard #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ 91731e31b8aSbellard #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ 91831e31b8aSbellard #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ 91931e31b8aSbellard #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ 92031e31b8aSbellard #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ 92131e31b8aSbellard #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ 92231e31b8aSbellard #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ 92331e31b8aSbellard #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ 92431e31b8aSbellard #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ 92531e31b8aSbellard #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ 92631e31b8aSbellard #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ 92731e31b8aSbellard #define TARGET_SIOCSIFENCAP 0x8926 92831e31b8aSbellard #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ 92931e31b8aSbellard #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ 93031e31b8aSbellard #define TARGET_SIOCSIFSLAVE 0x8930 93131e31b8aSbellard #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ 93231e31b8aSbellard #define TARGET_SIOCDELMULTI 0x8932 933f63eb01aSPaul Burton #define TARGET_SIOCGIFINDEX 0x8933 93431e31b8aSbellard 93531e31b8aSbellard /* Bridging control calls */ 93631e31b8aSbellard #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ 93731e31b8aSbellard #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ 93831e31b8aSbellard 93931e31b8aSbellard #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ 94031e31b8aSbellard #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ 94131e31b8aSbellard 94231e31b8aSbellard /* ARP cache control calls. */ 94331e31b8aSbellard #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ 94431e31b8aSbellard #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ 94531e31b8aSbellard #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ 94631e31b8aSbellard #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ 94731e31b8aSbellard #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ 94831e31b8aSbellard #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ 94931e31b8aSbellard 95031e31b8aSbellard /* RARP cache control calls. */ 95131e31b8aSbellard #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ 95231e31b8aSbellard #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ 95331e31b8aSbellard #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ 95431e31b8aSbellard 95531e31b8aSbellard /* Driver configuration calls */ 95631e31b8aSbellard #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ 95731e31b8aSbellard #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ 95831e31b8aSbellard 95931e31b8aSbellard /* DLCI configuration calls */ 96031e31b8aSbellard #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ 96131e31b8aSbellard #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ 96231e31b8aSbellard 96386fcd946SLaurent Vivier /* From <linux/wireless.h> */ 96486fcd946SLaurent Vivier 96586fcd946SLaurent Vivier #define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ 96631e31b8aSbellard 96731e31b8aSbellard /* From <linux/fs.h> */ 96831e31b8aSbellard 96931e31b8aSbellard #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ 97031e31b8aSbellard #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ 97131e31b8aSbellard #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ 97231e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ 97331e31b8aSbellard #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ 97431e31b8aSbellard #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ 97531e31b8aSbellard #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ 97631e31b8aSbellard #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ 97731e31b8aSbellard #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ 97831e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ 97931e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ 98031e31b8aSbellard #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ 981fff8c539SAndreas Färber #define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */ 98231e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */ 983c8b0bf54SPeter Maydell #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong) 984c8b0bf54SPeter Maydell #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong) 985edafea13SAlexander Graf #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) 986edafea13SAlexander Graf /* return device size in bytes 987edafea13SAlexander Graf (u64 *arg) */ 988*4715856aSPeter Maydell 989*4715856aSPeter Maydell #define TARGET_BLKDISCARD TARGET_IO(0x12, 119) 990*4715856aSPeter Maydell #define TARGET_BLKIOMIN TARGET_IO(0x12, 120) 991*4715856aSPeter Maydell #define TARGET_BLKIOOPT TARGET_IO(0x12, 121) 992*4715856aSPeter Maydell #define TARGET_BLKALIGNOFF TARGET_IO(0x12, 122) 993*4715856aSPeter Maydell #define TARGET_BLKPBSZGET TARGET_IO(0x12, 123) 994*4715856aSPeter Maydell #define TARGET_BLKDISCARDZEROES TARGET_IO(0x12, 124) 995*4715856aSPeter Maydell #define TARGET_BLKSECDISCARD TARGET_IO(0x12, 125) 996*4715856aSPeter Maydell #define TARGET_BLKROTATIONAL TARGET_IO(0x12, 126) 997*4715856aSPeter Maydell #define TARGET_BLKZEROOUT TARGET_IO(0x12, 127) 998*4715856aSPeter Maydell 99931e31b8aSbellard #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ 100031e31b8aSbellard #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ 1001285da2b9SPeter Maydell #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) 100231e31b8aSbellard 100331e31b8aSbellard /* cdrom commands */ 100431e31b8aSbellard #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ 100531e31b8aSbellard #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ 100631e31b8aSbellard #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ 100731e31b8aSbellard #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index 100831e31b8aSbellard (struct cdrom_ti) */ 100931e31b8aSbellard #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header 101031e31b8aSbellard (struct cdrom_tochdr) */ 101131e31b8aSbellard #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry 101231e31b8aSbellard (struct cdrom_tocentry) */ 101331e31b8aSbellard #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ 101431e31b8aSbellard #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ 101531e31b8aSbellard #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ 101631e31b8aSbellard #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume 101731e31b8aSbellard (struct cdrom_volctrl) */ 101831e31b8aSbellard #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data 101931e31b8aSbellard (struct cdrom_subchnl) */ 102031e31b8aSbellard #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) 102131e31b8aSbellard (struct cdrom_read) */ 102231e31b8aSbellard #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) 102331e31b8aSbellard (struct cdrom_read) */ 102431e31b8aSbellard #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ 102531e31b8aSbellard #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ 102631e31b8aSbellard #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session 102731e31b8aSbellard address of multi session disks 102831e31b8aSbellard (struct cdrom_multisession) */ 102931e31b8aSbellard #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" 103031e31b8aSbellard if available (struct cdrom_mcn) */ 103167cc32ebSVeres Lajos #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is deprecated, 1032b4916d7bSDong Xu Wang but here anyway for compatibility */ 103331e31b8aSbellard #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ 103431e31b8aSbellard #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting 103531e31b8aSbellard (struct cdrom_volctrl) */ 103631e31b8aSbellard #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) 103731e31b8aSbellard (struct cdrom_read) */ 103831e31b8aSbellard /* 103931e31b8aSbellard * These ioctls are used only used in aztcd.c and optcd.c 104031e31b8aSbellard */ 104131e31b8aSbellard #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ 104231e31b8aSbellard #define TARGET_CDROMSEEK 0x5316 /* seek msf address */ 104331e31b8aSbellard 104431e31b8aSbellard /* 104531e31b8aSbellard * This ioctl is only used by the scsi-cd driver. 104631e31b8aSbellard It is for playing audio in logical block addressing mode. 104731e31b8aSbellard */ 104831e31b8aSbellard #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ 104931e31b8aSbellard 105031e31b8aSbellard /* 105131e31b8aSbellard * These ioctls are only used in optcd.c 105231e31b8aSbellard */ 105331e31b8aSbellard #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ 105431e31b8aSbellard 105531e31b8aSbellard /* 105631e31b8aSbellard * These ioctls are (now) only in ide-cd.c for controlling 105731e31b8aSbellard * drive spindown time. They should be implemented in the 105831e31b8aSbellard * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, 105931e31b8aSbellard * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... 106031e31b8aSbellard * -Erik 106131e31b8aSbellard */ 106231e31b8aSbellard #define TARGET_CDROMGETSPINDOWN 0x531d 106331e31b8aSbellard #define TARGET_CDROMSETSPINDOWN 0x531e 106431e31b8aSbellard 106531e31b8aSbellard /* 106631e31b8aSbellard * These ioctls are implemented through the uniform CD-ROM driver 106731e31b8aSbellard * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM 106831e31b8aSbellard * drivers are eventually ported to the uniform CD-ROM driver interface. 106931e31b8aSbellard */ 107031e31b8aSbellard #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ 107131e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ 107231e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ 107331e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ 107431e31b8aSbellard #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ 107531e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ 107631e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ 107731e31b8aSbellard #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ 107831e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ 107931e31b8aSbellard #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ 108031e31b8aSbellard #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ 108131e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ 108231e31b8aSbellard 108331e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. 108431e31b8aSbellard * Future CDROM ioctls should be kept below 0x537F 108531e31b8aSbellard */ 108631e31b8aSbellard 108731e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */ 108831e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ 108931e31b8aSbellard /* conflict with SCSI_IOCTL_GET_IDLUN */ 109031e31b8aSbellard 109131e31b8aSbellard /* DVD-ROM Specific ioctls */ 109231e31b8aSbellard #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ 109331e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ 109431e31b8aSbellard #define TARGET_DVD_AUTH 0x5392 /* Authentication */ 109531e31b8aSbellard 109631e31b8aSbellard #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ 109731e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ 109831e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ 109931e31b8aSbellard 110031e31b8aSbellard /* HD commands */ 110131e31b8aSbellard 110231e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ 110331e31b8aSbellard #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ 110431e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ 110531e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ 110631e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ 110731e31b8aSbellard #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ 110831e31b8aSbellard #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ 110931e31b8aSbellard #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ 11102521d698Sbellard #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ 111131e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ 111231e31b8aSbellard 111331e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ 111431e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ 111531e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ 111631e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ 111731e31b8aSbellard #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ 111831e31b8aSbellard #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ 111931e31b8aSbellard #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ 112031e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ 11212521d698Sbellard 1122b8005914Sbalrog /* loop ioctls */ 1123b8005914Sbalrog #define TARGET_LOOP_SET_FD 0x4C00 1124b8005914Sbalrog #define TARGET_LOOP_CLR_FD 0x4C01 1125b8005914Sbalrog #define TARGET_LOOP_SET_STATUS 0x4C02 1126b8005914Sbalrog #define TARGET_LOOP_GET_STATUS 0x4C03 1127b8005914Sbalrog #define TARGET_LOOP_SET_STATUS64 0x4C04 1128b8005914Sbalrog #define TARGET_LOOP_GET_STATUS64 0x4C05 1129b8005914Sbalrog #define TARGET_LOOP_CHANGE_FD 0x4C06 11302521d698Sbellard 1131884cdc48SPeter Maydell #define TARGET_LOOP_CTL_ADD 0x4C80 1132884cdc48SPeter Maydell #define TARGET_LOOP_CTL_REMOVE 0x4C81 1133884cdc48SPeter Maydell #define TARGET_LOOP_CTL_GET_FREE 0x4C82 1134884cdc48SPeter Maydell 1135f7680a55SUlrich Hecht /* fb ioctls */ 1136f7680a55SUlrich Hecht #define TARGET_FBIOGET_VSCREENINFO 0x4600 1137f7680a55SUlrich Hecht #define TARGET_FBIOPUT_VSCREENINFO 0x4601 1138f7680a55SUlrich Hecht #define TARGET_FBIOGET_FSCREENINFO 0x4602 113912b81b71SCédric VINCENT #define TARGET_FBIOGETCMAP 0x4604 114012b81b71SCédric VINCENT #define TARGET_FBIOPUTCMAP 0x4605 114112b81b71SCédric VINCENT #define TARGET_FBIOPAN_DISPLAY 0x4606 114212b81b71SCédric VINCENT #define TARGET_FBIOGET_CON2FBMAP 0x460F 114312b81b71SCédric VINCENT #define TARGET_FBIOPUT_CON2FBMAP 0x4610 1144f7680a55SUlrich Hecht 1145f7680a55SUlrich Hecht /* vt ioctls */ 1146f7680a55SUlrich Hecht #define TARGET_VT_OPENQRY 0x5600 1147f7680a55SUlrich Hecht #define TARGET_VT_GETSTATE 0x5603 1148f7680a55SUlrich Hecht #define TARGET_VT_ACTIVATE 0x5606 1149f7680a55SUlrich Hecht #define TARGET_VT_WAITACTIVE 0x5607 1150f7680a55SUlrich Hecht #define TARGET_VT_LOCKSWITCH 0x560b 1151f7680a55SUlrich Hecht #define TARGET_VT_UNLOCKSWITCH 0x560c 1152774750c0SCédric VINCENT #define TARGET_VT_GETMODE 0x5601 1153774750c0SCédric VINCENT #define TARGET_VT_SETMODE 0x5602 1154774750c0SCédric VINCENT #define TARGET_VT_RELDISP 0x5605 1155774750c0SCédric VINCENT #define TARGET_VT_DISALLOCATE 0x5608 1156f7680a55SUlrich Hecht 115756e904ecSAlexander Graf /* device mapper */ 115856e904ecSAlexander Graf #define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00) 115956e904ecSAlexander Graf #define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01) 116056e904ecSAlexander Graf #define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02) 116156e904ecSAlexander Graf #define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03) 116256e904ecSAlexander Graf #define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04) 116356e904ecSAlexander Graf #define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05) 116456e904ecSAlexander Graf #define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06) 116556e904ecSAlexander Graf #define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07) 116656e904ecSAlexander Graf #define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08) 116756e904ecSAlexander Graf #define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09) 116856e904ecSAlexander Graf #define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a) 116956e904ecSAlexander Graf #define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b) 117056e904ecSAlexander Graf #define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c) 117156e904ecSAlexander Graf #define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d) 117256e904ecSAlexander Graf #define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e) 117356e904ecSAlexander Graf #define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f) 117456e904ecSAlexander Graf 11752521d698Sbellard /* from asm/termbits.h */ 11762521d698Sbellard 11773bfd9da1Sbellard #define TARGET_NCC 8 11783bfd9da1Sbellard struct target_termio { 11793bfd9da1Sbellard unsigned short c_iflag; /* input mode flags */ 11803bfd9da1Sbellard unsigned short c_oflag; /* output mode flags */ 11813bfd9da1Sbellard unsigned short c_cflag; /* control mode flags */ 11823bfd9da1Sbellard unsigned short c_lflag; /* local mode flags */ 11832521d698Sbellard unsigned char c_line; /* line discipline */ 11843bfd9da1Sbellard unsigned char c_cc[TARGET_NCC]; /* control characters */ 11852521d698Sbellard }; 11862521d698Sbellard 11873bfd9da1Sbellard struct target_winsize { 11883bfd9da1Sbellard unsigned short ws_row; 11893bfd9da1Sbellard unsigned short ws_col; 11903bfd9da1Sbellard unsigned short ws_xpixel; 11913bfd9da1Sbellard unsigned short ws_ypixel; 11923bfd9da1Sbellard }; 11932521d698Sbellard 11943bfd9da1Sbellard #include "termbits.h" 11952521d698Sbellard 11969e0b74a4SPaul Brook #if defined(TARGET_MIPS) 11979e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x10 11989e0b74a4SPaul Brook #else 11999e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x08 12009e0b74a4SPaul Brook #endif 12019e0b74a4SPaul Brook 1202e44a3e79Saurel32 /* Common */ 12032521d698Sbellard #define TARGET_MAP_SHARED 0x01 /* Share changes */ 12042521d698Sbellard #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ 12052521d698Sbellard #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ 1206e44a3e79Saurel32 1207e44a3e79Saurel32 /* Target specific */ 1208048f6b4dSbellard #if defined(TARGET_MIPS) 1209e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1210048f6b4dSbellard #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 1211048f6b4dSbellard #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 1212048f6b4dSbellard #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 1213048f6b4dSbellard #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 1214048f6b4dSbellard #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 1215048f6b4dSbellard #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 1216540635baSths #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 1217540635baSths #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1218e44a3e79Saurel32 #elif defined(TARGET_PPC) 1219e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 12202521d698Sbellard #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 12212521d698Sbellard #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 12222521d698Sbellard #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 12232521d698Sbellard #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 12247ec93196Sj_mayer #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ 12257ec93196Sj_mayer #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ 1226e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1227e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1228e44a3e79Saurel32 #elif defined(TARGET_ALPHA) 1229e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1230e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ 1231e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ 1232e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ 1233e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ 1234e44a3e79Saurel32 #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ 1235e44a3e79Saurel32 #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ 1236e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ 1237e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ 12387ec93196Sj_mayer #else 1239e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1240e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 1241e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 1242e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 1243e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 12442521d698Sbellard #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ 12452521d698Sbellard #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ 1246540635baSths #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1247540635baSths #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1248906c1b8eSMike Frysinger #define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ 12497ec93196Sj_mayer #endif 12502521d698Sbellard 125109701199SAlexander Graf #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 125209701199SAlexander Graf || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 1253c7819dfbSPeter Maydell || defined(TARGET_CRIS) || defined(TARGET_UNICORE32) 12542521d698Sbellard struct target_stat { 12552521d698Sbellard unsigned short st_dev; 12562521d698Sbellard unsigned short __pad1; 1257992f48a0Sblueswir1 abi_ulong st_ino; 12582521d698Sbellard unsigned short st_mode; 12592521d698Sbellard unsigned short st_nlink; 12602521d698Sbellard unsigned short st_uid; 12612521d698Sbellard unsigned short st_gid; 12622521d698Sbellard unsigned short st_rdev; 12632521d698Sbellard unsigned short __pad2; 1264992f48a0Sblueswir1 abi_ulong st_size; 1265992f48a0Sblueswir1 abi_ulong st_blksize; 1266992f48a0Sblueswir1 abi_ulong st_blocks; 1267992f48a0Sblueswir1 abi_ulong target_st_atime; 1268992f48a0Sblueswir1 abi_ulong __unused1; 1269992f48a0Sblueswir1 abi_ulong target_st_mtime; 1270992f48a0Sblueswir1 abi_ulong __unused2; 1271992f48a0Sblueswir1 abi_ulong target_st_ctime; 1272992f48a0Sblueswir1 abi_ulong __unused3; 1273992f48a0Sblueswir1 abi_ulong __unused4; 1274992f48a0Sblueswir1 abi_ulong __unused5; 12752521d698Sbellard }; 12762521d698Sbellard 12772521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely 12782521d698Sbellard * insane amounts of padding around dev_t's. 12792521d698Sbellard */ 128020d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 12812521d698Sbellard struct target_stat64 { 12822521d698Sbellard unsigned short st_dev; 12832521d698Sbellard unsigned char __pad0[10]; 12842521d698Sbellard 12852521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1286992f48a0Sblueswir1 abi_ulong __st_ino; 12872521d698Sbellard 12882521d698Sbellard unsigned int st_mode; 12892521d698Sbellard unsigned int st_nlink; 12902521d698Sbellard 1291992f48a0Sblueswir1 abi_ulong st_uid; 1292992f48a0Sblueswir1 abi_ulong st_gid; 12932521d698Sbellard 12942521d698Sbellard unsigned short st_rdev; 12952521d698Sbellard unsigned char __pad3[10]; 12962521d698Sbellard 12972521d698Sbellard long long st_size; 1298992f48a0Sblueswir1 abi_ulong st_blksize; 12992521d698Sbellard 1300992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1301992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 13022521d698Sbellard 1303992f48a0Sblueswir1 abi_ulong target_st_atime; 1304992f48a0Sblueswir1 abi_ulong __pad5; 13052521d698Sbellard 1306992f48a0Sblueswir1 abi_ulong target_st_mtime; 1307992f48a0Sblueswir1 abi_ulong __pad6; 13082521d698Sbellard 1309992f48a0Sblueswir1 abi_ulong target_st_ctime; 1310992f48a0Sblueswir1 abi_ulong __pad7; /* will be high 32 bits of ctime someday */ 13112521d698Sbellard 13122521d698Sbellard unsigned long long st_ino; 1313541dc0d4SStefan Weil } QEMU_PACKED; 13142521d698Sbellard 1315ce4defa0Spbrook #ifdef TARGET_ARM 131620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1317ce4defa0Spbrook struct target_eabi_stat64 { 1318ce4defa0Spbrook unsigned long long st_dev; 1319ce4defa0Spbrook unsigned int __pad1; 1320992f48a0Sblueswir1 abi_ulong __st_ino; 1321ce4defa0Spbrook unsigned int st_mode; 1322ce4defa0Spbrook unsigned int st_nlink; 1323ce4defa0Spbrook 1324992f48a0Sblueswir1 abi_ulong st_uid; 1325992f48a0Sblueswir1 abi_ulong st_gid; 1326ce4defa0Spbrook 1327ce4defa0Spbrook unsigned long long st_rdev; 1328ce4defa0Spbrook unsigned int __pad2[2]; 1329ce4defa0Spbrook 1330ce4defa0Spbrook long long st_size; 1331992f48a0Sblueswir1 abi_ulong st_blksize; 1332ce4defa0Spbrook unsigned int __pad3; 1333ce4defa0Spbrook unsigned long long st_blocks; 1334ce4defa0Spbrook 1335992f48a0Sblueswir1 abi_ulong target_st_atime; 1336992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1337ce4defa0Spbrook 1338992f48a0Sblueswir1 abi_ulong target_st_mtime; 1339992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1340ce4defa0Spbrook 1341992f48a0Sblueswir1 abi_ulong target_st_ctime; 1342992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1343ce4defa0Spbrook 1344ce4defa0Spbrook unsigned long long st_ino; 1345541dc0d4SStefan Weil } QEMU_PACKED; 1346ce4defa0Spbrook #endif 1347ce4defa0Spbrook 1348992f48a0Sblueswir1 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 13491b8dd648Sblueswir1 struct target_stat { 13501b8dd648Sblueswir1 unsigned int st_dev; 1351992f48a0Sblueswir1 abi_ulong st_ino; 13521b8dd648Sblueswir1 unsigned int st_mode; 13531b8dd648Sblueswir1 unsigned int st_nlink; 13541b8dd648Sblueswir1 unsigned int st_uid; 13551b8dd648Sblueswir1 unsigned int st_gid; 13561b8dd648Sblueswir1 unsigned int st_rdev; 1357992f48a0Sblueswir1 abi_long st_size; 1358992f48a0Sblueswir1 abi_long target_st_atime; 1359992f48a0Sblueswir1 abi_long target_st_mtime; 1360992f48a0Sblueswir1 abi_long target_st_ctime; 1361992f48a0Sblueswir1 abi_long st_blksize; 1362992f48a0Sblueswir1 abi_long st_blocks; 1363992f48a0Sblueswir1 abi_ulong __unused4[2]; 13641b8dd648Sblueswir1 }; 13651b8dd648Sblueswir1 136620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 13671b8dd648Sblueswir1 struct target_stat64 { 13681b8dd648Sblueswir1 unsigned char __pad0[6]; 13691b8dd648Sblueswir1 unsigned short st_dev; 13701b8dd648Sblueswir1 13711b8dd648Sblueswir1 uint64_t st_ino; 13721b8dd648Sblueswir1 uint64_t st_nlink; 13731b8dd648Sblueswir1 13741b8dd648Sblueswir1 unsigned int st_mode; 13751b8dd648Sblueswir1 13761b8dd648Sblueswir1 unsigned int st_uid; 13771b8dd648Sblueswir1 unsigned int st_gid; 13781b8dd648Sblueswir1 13791b8dd648Sblueswir1 unsigned char __pad2[6]; 13801b8dd648Sblueswir1 unsigned short st_rdev; 13811b8dd648Sblueswir1 13821b8dd648Sblueswir1 int64_t st_size; 13831b8dd648Sblueswir1 int64_t st_blksize; 13841b8dd648Sblueswir1 13851b8dd648Sblueswir1 unsigned char __pad4[4]; 13861b8dd648Sblueswir1 unsigned int st_blocks; 13871b8dd648Sblueswir1 1388992f48a0Sblueswir1 abi_ulong target_st_atime; 1389992f48a0Sblueswir1 abi_ulong __unused1; 13901b8dd648Sblueswir1 1391992f48a0Sblueswir1 abi_ulong target_st_mtime; 1392992f48a0Sblueswir1 abi_ulong __unused2; 13931b8dd648Sblueswir1 1394992f48a0Sblueswir1 abi_ulong target_st_ctime; 1395992f48a0Sblueswir1 abi_ulong __unused3; 13961b8dd648Sblueswir1 1397992f48a0Sblueswir1 abi_ulong __unused4[3]; 13981b8dd648Sblueswir1 }; 13991b8dd648Sblueswir1 14003bfd9da1Sbellard #elif defined(TARGET_SPARC) 14013bfd9da1Sbellard 14023bfd9da1Sbellard struct target_stat { 14033bfd9da1Sbellard unsigned short st_dev; 1404992f48a0Sblueswir1 abi_ulong st_ino; 14053bfd9da1Sbellard unsigned short st_mode; 14063bfd9da1Sbellard short st_nlink; 14073bfd9da1Sbellard unsigned short st_uid; 14083bfd9da1Sbellard unsigned short st_gid; 14093bfd9da1Sbellard unsigned short st_rdev; 1410992f48a0Sblueswir1 abi_long st_size; 1411992f48a0Sblueswir1 abi_long target_st_atime; 1412992f48a0Sblueswir1 abi_ulong __unused1; 1413992f48a0Sblueswir1 abi_long target_st_mtime; 1414992f48a0Sblueswir1 abi_ulong __unused2; 1415992f48a0Sblueswir1 abi_long target_st_ctime; 1416992f48a0Sblueswir1 abi_ulong __unused3; 1417992f48a0Sblueswir1 abi_long st_blksize; 1418992f48a0Sblueswir1 abi_long st_blocks; 1419992f48a0Sblueswir1 abi_ulong __unused4[2]; 14203bfd9da1Sbellard }; 14213bfd9da1Sbellard 142220d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 14233bfd9da1Sbellard struct target_stat64 { 14243bfd9da1Sbellard unsigned char __pad0[6]; 14253bfd9da1Sbellard unsigned short st_dev; 14263bfd9da1Sbellard 14273bfd9da1Sbellard uint64_t st_ino; 14283bfd9da1Sbellard 14293bfd9da1Sbellard unsigned int st_mode; 14303bfd9da1Sbellard unsigned int st_nlink; 14313bfd9da1Sbellard 14323bfd9da1Sbellard unsigned int st_uid; 14333bfd9da1Sbellard unsigned int st_gid; 14343bfd9da1Sbellard 14353bfd9da1Sbellard unsigned char __pad2[6]; 14363bfd9da1Sbellard unsigned short st_rdev; 14373bfd9da1Sbellard 14383bfd9da1Sbellard unsigned char __pad3[8]; 14393bfd9da1Sbellard 14403bfd9da1Sbellard int64_t st_size; 14413bfd9da1Sbellard unsigned int st_blksize; 14423bfd9da1Sbellard 14433bfd9da1Sbellard unsigned char __pad4[8]; 14443bfd9da1Sbellard unsigned int st_blocks; 14453bfd9da1Sbellard 14463bfd9da1Sbellard unsigned int target_st_atime; 14473bfd9da1Sbellard unsigned int __unused1; 14483bfd9da1Sbellard 14493bfd9da1Sbellard unsigned int target_st_mtime; 14503bfd9da1Sbellard unsigned int __unused2; 14513bfd9da1Sbellard 14523bfd9da1Sbellard unsigned int target_st_ctime; 14533bfd9da1Sbellard unsigned int __unused3; 14543bfd9da1Sbellard 14553bfd9da1Sbellard unsigned int __unused4; 14563bfd9da1Sbellard unsigned int __unused5; 14573bfd9da1Sbellard }; 14583bfd9da1Sbellard 145967867308Sbellard #elif defined(TARGET_PPC) 146067867308Sbellard 146167867308Sbellard struct target_stat { 1462e32448e0Sj_mayer abi_ulong st_dev; 1463992f48a0Sblueswir1 abi_ulong st_ino; 1464325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1465e32448e0Sj_mayer abi_ulong st_nlink; 1466325e651fSj_mayer unsigned int st_mode; 1467325e651fSj_mayer #else 146867867308Sbellard unsigned int st_mode; 146967867308Sbellard unsigned short st_nlink; 1470325e651fSj_mayer #endif 147167867308Sbellard unsigned int st_uid; 147267867308Sbellard unsigned int st_gid; 1473e32448e0Sj_mayer abi_ulong st_rdev; 1474992f48a0Sblueswir1 abi_ulong st_size; 1475992f48a0Sblueswir1 abi_ulong st_blksize; 1476992f48a0Sblueswir1 abi_ulong st_blocks; 1477992f48a0Sblueswir1 abi_ulong target_st_atime; 1478e32448e0Sj_mayer abi_ulong target_st_atime_nsec; 1479992f48a0Sblueswir1 abi_ulong target_st_mtime; 1480e32448e0Sj_mayer abi_ulong target_st_mtime_nsec; 1481992f48a0Sblueswir1 abi_ulong target_st_ctime; 1482e32448e0Sj_mayer abi_ulong target_st_ctime_nsec; 1483992f48a0Sblueswir1 abi_ulong __unused4; 1484992f48a0Sblueswir1 abi_ulong __unused5; 1485325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1486325e651fSj_mayer abi_ulong __unused6; 1487325e651fSj_mayer #endif 148867867308Sbellard }; 148967867308Sbellard 149020d155bcSStefan Weil #if !defined(TARGET_PPC64) || defined(TARGET_ABI32) 149120d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1492541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 149367867308Sbellard unsigned long long st_dev; 149467867308Sbellard unsigned long long st_ino; 149567867308Sbellard unsigned int st_mode; 149667867308Sbellard unsigned int st_nlink; 149767867308Sbellard unsigned int st_uid; 149867867308Sbellard unsigned int st_gid; 149967867308Sbellard unsigned long long st_rdev; 1500e1ce5e40Saurel32 unsigned long long __pad0; 150167867308Sbellard long long st_size; 1502e32448e0Sj_mayer int st_blksize; 1503e1ce5e40Saurel32 unsigned int __pad1; 150461322e91SMax Filippov long long st_blocks; /* Number 512-byte blocks allocated. */ 1505e32448e0Sj_mayer int target_st_atime; 1506e32448e0Sj_mayer unsigned int target_st_atime_nsec; 1507e32448e0Sj_mayer int target_st_mtime; 1508e32448e0Sj_mayer unsigned int target_st_mtime_nsec; 1509e32448e0Sj_mayer int target_st_ctime; 1510e32448e0Sj_mayer unsigned int target_st_ctime_nsec; 1511e32448e0Sj_mayer unsigned int __unused4; 1512e32448e0Sj_mayer unsigned int __unused5; 151367867308Sbellard }; 151420d155bcSStefan Weil #endif 151567867308Sbellard 1516b779e29eSEdgar E. Iglesias #elif defined(TARGET_MICROBLAZE) 1517b779e29eSEdgar E. Iglesias 1518b779e29eSEdgar E. Iglesias struct target_stat { 1519b779e29eSEdgar E. Iglesias abi_ulong st_dev; 1520b779e29eSEdgar E. Iglesias abi_ulong st_ino; 1521b779e29eSEdgar E. Iglesias unsigned int st_mode; 1522b779e29eSEdgar E. Iglesias unsigned short st_nlink; 1523b779e29eSEdgar E. Iglesias unsigned int st_uid; 1524b779e29eSEdgar E. Iglesias unsigned int st_gid; 1525b779e29eSEdgar E. Iglesias abi_ulong st_rdev; 1526b779e29eSEdgar E. Iglesias abi_ulong st_size; 1527b779e29eSEdgar E. Iglesias abi_ulong st_blksize; 1528b779e29eSEdgar E. Iglesias abi_ulong st_blocks; 1529b779e29eSEdgar E. Iglesias abi_ulong target_st_atime; 1530b779e29eSEdgar E. Iglesias abi_ulong target_st_atime_nsec; 1531b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime; 1532b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime_nsec; 1533b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime; 1534b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime_nsec; 1535b779e29eSEdgar E. Iglesias abi_ulong __unused4; 1536b779e29eSEdgar E. Iglesias abi_ulong __unused5; 1537b779e29eSEdgar E. Iglesias }; 1538b779e29eSEdgar E. Iglesias 1539b779e29eSEdgar E. Iglesias /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ 154020d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1541541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 1542b779e29eSEdgar E. Iglesias uint64_t st_dev; 1543a523eb06SEdgar E. Iglesias #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1544a523eb06SEdgar E. Iglesias uint32_t pad0; 1545a523eb06SEdgar E. Iglesias uint32_t __st_ino; 1546a523eb06SEdgar E. Iglesias 1547b779e29eSEdgar E. Iglesias uint32_t st_mode; 1548b779e29eSEdgar E. Iglesias uint32_t st_nlink; 1549b779e29eSEdgar E. Iglesias uint32_t st_uid; 1550b779e29eSEdgar E. Iglesias uint32_t st_gid; 1551b779e29eSEdgar E. Iglesias uint64_t st_rdev; 155221ebeb23SEdgar E. Iglesias uint64_t __pad1; 1553b779e29eSEdgar E. Iglesias 1554b779e29eSEdgar E. Iglesias int64_t st_size; 1555b779e29eSEdgar E. Iglesias int32_t st_blksize; 155621ebeb23SEdgar E. Iglesias uint32_t __pad2; 1557b779e29eSEdgar E. Iglesias int64_t st_blocks; /* Number 512-byte blocks allocated. */ 1558b779e29eSEdgar E. Iglesias 1559b779e29eSEdgar E. Iglesias int target_st_atime; 1560b779e29eSEdgar E. Iglesias unsigned int target_st_atime_nsec; 1561b779e29eSEdgar E. Iglesias int target_st_mtime; 1562b779e29eSEdgar E. Iglesias unsigned int target_st_mtime_nsec; 1563b779e29eSEdgar E. Iglesias int target_st_ctime; 1564b779e29eSEdgar E. Iglesias unsigned int target_st_ctime_nsec; 1565a523eb06SEdgar E. Iglesias uint64_t st_ino; 1566b779e29eSEdgar E. Iglesias }; 1567b779e29eSEdgar E. Iglesias 1568e6e5906bSpbrook #elif defined(TARGET_M68K) 1569e6e5906bSpbrook 1570e6e5906bSpbrook struct target_stat { 1571e6e5906bSpbrook unsigned short st_dev; 1572e6e5906bSpbrook unsigned short __pad1; 1573992f48a0Sblueswir1 abi_ulong st_ino; 1574e6e5906bSpbrook unsigned short st_mode; 1575e6e5906bSpbrook unsigned short st_nlink; 1576e6e5906bSpbrook unsigned short st_uid; 1577e6e5906bSpbrook unsigned short st_gid; 1578e6e5906bSpbrook unsigned short st_rdev; 1579e6e5906bSpbrook unsigned short __pad2; 1580992f48a0Sblueswir1 abi_ulong st_size; 1581992f48a0Sblueswir1 abi_ulong st_blksize; 1582992f48a0Sblueswir1 abi_ulong st_blocks; 1583992f48a0Sblueswir1 abi_ulong target_st_atime; 1584992f48a0Sblueswir1 abi_ulong __unused1; 1585992f48a0Sblueswir1 abi_ulong target_st_mtime; 1586992f48a0Sblueswir1 abi_ulong __unused2; 1587992f48a0Sblueswir1 abi_ulong target_st_ctime; 1588992f48a0Sblueswir1 abi_ulong __unused3; 1589992f48a0Sblueswir1 abi_ulong __unused4; 1590992f48a0Sblueswir1 abi_ulong __unused5; 1591e6e5906bSpbrook }; 1592e6e5906bSpbrook 1593e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely 1594e6e5906bSpbrook * insane amounts of padding around dev_t's. 1595e6e5906bSpbrook */ 159620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1597e6e5906bSpbrook struct target_stat64 { 1598e6e5906bSpbrook unsigned long long st_dev; 1599e6e5906bSpbrook unsigned char __pad1[2]; 1600e6e5906bSpbrook 1601e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1602992f48a0Sblueswir1 abi_ulong __st_ino; 1603e6e5906bSpbrook 1604e6e5906bSpbrook unsigned int st_mode; 1605e6e5906bSpbrook unsigned int st_nlink; 1606e6e5906bSpbrook 1607992f48a0Sblueswir1 abi_ulong st_uid; 1608992f48a0Sblueswir1 abi_ulong st_gid; 1609e6e5906bSpbrook 1610e6e5906bSpbrook unsigned long long st_rdev; 1611e6e5906bSpbrook unsigned char __pad3[2]; 1612e6e5906bSpbrook 1613e6e5906bSpbrook long long st_size; 1614992f48a0Sblueswir1 abi_ulong st_blksize; 1615e6e5906bSpbrook 1616992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 1617992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1618e6e5906bSpbrook 1619992f48a0Sblueswir1 abi_ulong target_st_atime; 1620992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1621e6e5906bSpbrook 1622992f48a0Sblueswir1 abi_ulong target_st_mtime; 1623992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1624e6e5906bSpbrook 1625992f48a0Sblueswir1 abi_ulong target_st_ctime; 1626992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1627e6e5906bSpbrook 1628e6e5906bSpbrook unsigned long long st_ino; 1629541dc0d4SStefan Weil } QEMU_PACKED; 1630e6e5906bSpbrook 1631d26bc211Sths #elif defined(TARGET_ABI_MIPSN64) 1632540635baSths 1633540635baSths /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ 1634540635baSths struct target_stat { 1635540635baSths unsigned int st_dev; 1636540635baSths unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ 1637540635baSths 1638992f48a0Sblueswir1 abi_ulong st_ino; 1639540635baSths 1640540635baSths unsigned int st_mode; 1641540635baSths unsigned int st_nlink; 1642540635baSths 1643540635baSths int st_uid; 1644540635baSths int st_gid; 1645540635baSths 1646540635baSths unsigned int st_rdev; 1647540635baSths unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ 1648540635baSths 1649992f48a0Sblueswir1 abi_ulong st_size; 1650540635baSths 1651540635baSths /* 1652540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1653540635baSths * but we don't have it under Linux. 1654540635baSths */ 1655540635baSths unsigned int target_st_atime; 1656540635baSths unsigned int target_st_atime_nsec; 1657540635baSths 1658540635baSths unsigned int target_st_mtime; 1659540635baSths unsigned int target_st_mtime_nsec; 1660540635baSths 1661540635baSths unsigned int target_st_ctime; 1662540635baSths unsigned int target_st_ctime_nsec; 1663540635baSths 1664540635baSths unsigned int st_blksize; 1665540635baSths unsigned int st_pad2; 1666540635baSths 1667992f48a0Sblueswir1 abi_ulong st_blocks; 1668540635baSths }; 1669540635baSths 1670d26bc211Sths #elif defined(TARGET_ABI_MIPSN32) 1671540635baSths 1672540635baSths struct target_stat { 16731ab2aea2SLeon Alrae abi_ulong st_dev; 16741ab2aea2SLeon Alrae abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 16751ab2aea2SLeon Alrae uint64_t st_ino; 1676540635baSths unsigned int st_mode; 1677540635baSths unsigned int st_nlink; 1678540635baSths int st_uid; 1679540635baSths int st_gid; 16801ab2aea2SLeon Alrae abi_ulong st_rdev; 16811ab2aea2SLeon Alrae abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 16821ab2aea2SLeon Alrae int64_t st_size; 16831ab2aea2SLeon Alrae abi_long target_st_atime; 16841ab2aea2SLeon Alrae abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 16851ab2aea2SLeon Alrae abi_long target_st_mtime; 16861ab2aea2SLeon Alrae abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 16871ab2aea2SLeon Alrae abi_long target_st_ctime; 16881ab2aea2SLeon Alrae abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 16891ab2aea2SLeon Alrae abi_ulong st_blksize; 16901ab2aea2SLeon Alrae abi_ulong st_pad2; 16911ab2aea2SLeon Alrae int64_t st_blocks; 1692540635baSths }; 1693540635baSths 1694d26bc211Sths #elif defined(TARGET_ABI_MIPSO32) 1695048f6b4dSbellard 1696048f6b4dSbellard struct target_stat { 1697048f6b4dSbellard unsigned st_dev; 1698992f48a0Sblueswir1 abi_long st_pad1[3]; /* Reserved for network id */ 1699992f48a0Sblueswir1 abi_ulong st_ino; 1700048f6b4dSbellard unsigned int st_mode; 1701048f6b4dSbellard unsigned int st_nlink; 1702048f6b4dSbellard int st_uid; 1703048f6b4dSbellard int st_gid; 1704048f6b4dSbellard unsigned st_rdev; 1705992f48a0Sblueswir1 abi_long st_pad2[2]; 1706992f48a0Sblueswir1 abi_long st_size; 1707992f48a0Sblueswir1 abi_long st_pad3; 1708048f6b4dSbellard /* 1709048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1710048f6b4dSbellard * but we don't have it under Linux. 1711048f6b4dSbellard */ 1712992f48a0Sblueswir1 abi_long target_st_atime; 1713992f48a0Sblueswir1 abi_long target_st_atime_nsec; 1714992f48a0Sblueswir1 abi_long target_st_mtime; 1715992f48a0Sblueswir1 abi_long target_st_mtime_nsec; 1716992f48a0Sblueswir1 abi_long target_st_ctime; 1717992f48a0Sblueswir1 abi_long target_st_ctime_nsec; 1718992f48a0Sblueswir1 abi_long st_blksize; 1719992f48a0Sblueswir1 abi_long st_blocks; 1720992f48a0Sblueswir1 abi_long st_pad4[14]; 1721048f6b4dSbellard }; 1722048f6b4dSbellard 1723048f6b4dSbellard /* 1724048f6b4dSbellard * This matches struct stat64 in glibc2.1, hence the absolutely insane 1725048f6b4dSbellard * amounts of padding around dev_t's. The memory layout is the same as of 1726048f6b4dSbellard * struct stat of the 64-bit kernel. 1727048f6b4dSbellard */ 1728048f6b4dSbellard 172920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1730048f6b4dSbellard struct target_stat64 { 1731992f48a0Sblueswir1 abi_ulong st_dev; 1732992f48a0Sblueswir1 abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 1733048f6b4dSbellard 1734048f6b4dSbellard uint64_t st_ino; 1735048f6b4dSbellard 1736048f6b4dSbellard unsigned int st_mode; 1737048f6b4dSbellard unsigned int st_nlink; 1738048f6b4dSbellard 1739048f6b4dSbellard int st_uid; 1740048f6b4dSbellard int st_gid; 1741048f6b4dSbellard 1742992f48a0Sblueswir1 abi_ulong st_rdev; 1743992f48a0Sblueswir1 abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 1744048f6b4dSbellard 1745048f6b4dSbellard int64_t st_size; 1746048f6b4dSbellard 1747048f6b4dSbellard /* 1748048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1749048f6b4dSbellard * but we don't have it under Linux. 1750048f6b4dSbellard */ 1751992f48a0Sblueswir1 abi_long target_st_atime; 1752992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 1753048f6b4dSbellard 1754992f48a0Sblueswir1 abi_long target_st_mtime; 1755992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 1756048f6b4dSbellard 1757992f48a0Sblueswir1 abi_long target_st_ctime; 1758992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 1759048f6b4dSbellard 1760992f48a0Sblueswir1 abi_ulong st_blksize; 1761992f48a0Sblueswir1 abi_ulong st_pad2; 1762048f6b4dSbellard 1763048f6b4dSbellard int64_t st_blocks; 1764048f6b4dSbellard }; 17657a3148a9Sj_mayer 17667a3148a9Sj_mayer #elif defined(TARGET_ALPHA) 17677a3148a9Sj_mayer 17687a3148a9Sj_mayer struct target_stat { 17697a3148a9Sj_mayer unsigned int st_dev; 17707a3148a9Sj_mayer unsigned int st_ino; 17717a3148a9Sj_mayer unsigned int st_mode; 17727a3148a9Sj_mayer unsigned int st_nlink; 17737a3148a9Sj_mayer unsigned int st_uid; 17747a3148a9Sj_mayer unsigned int st_gid; 17757a3148a9Sj_mayer unsigned int st_rdev; 1776992f48a0Sblueswir1 abi_long st_size; 1777992f48a0Sblueswir1 abi_ulong target_st_atime; 1778992f48a0Sblueswir1 abi_ulong target_st_mtime; 1779992f48a0Sblueswir1 abi_ulong target_st_ctime; 17807a3148a9Sj_mayer unsigned int st_blksize; 17817a3148a9Sj_mayer unsigned int st_blocks; 17827a3148a9Sj_mayer unsigned int st_flags; 17837a3148a9Sj_mayer unsigned int st_gen; 17847a3148a9Sj_mayer }; 17857a3148a9Sj_mayer 178620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 17877a3148a9Sj_mayer struct target_stat64 { 1788992f48a0Sblueswir1 abi_ulong st_dev; 1789992f48a0Sblueswir1 abi_ulong st_ino; 1790992f48a0Sblueswir1 abi_ulong st_rdev; 1791992f48a0Sblueswir1 abi_long st_size; 1792992f48a0Sblueswir1 abi_ulong st_blocks; 17937a3148a9Sj_mayer 17947a3148a9Sj_mayer unsigned int st_mode; 17957a3148a9Sj_mayer unsigned int st_uid; 17967a3148a9Sj_mayer unsigned int st_gid; 17977a3148a9Sj_mayer unsigned int st_blksize; 17987a3148a9Sj_mayer unsigned int st_nlink; 17997a3148a9Sj_mayer unsigned int __pad0; 18007a3148a9Sj_mayer 1801992f48a0Sblueswir1 abi_ulong target_st_atime; 1802992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1803992f48a0Sblueswir1 abi_ulong target_st_mtime; 1804992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1805992f48a0Sblueswir1 abi_ulong target_st_ctime; 1806992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1807992f48a0Sblueswir1 abi_long __unused[3]; 18087a3148a9Sj_mayer }; 18097a3148a9Sj_mayer 18106db45e65Sths #elif defined(TARGET_SH4) 18116db45e65Sths 18126db45e65Sths struct target_stat { 1813992f48a0Sblueswir1 abi_ulong st_dev; 1814992f48a0Sblueswir1 abi_ulong st_ino; 18156db45e65Sths unsigned short st_mode; 18166db45e65Sths unsigned short st_nlink; 18176db45e65Sths unsigned short st_uid; 18186db45e65Sths unsigned short st_gid; 1819992f48a0Sblueswir1 abi_ulong st_rdev; 1820992f48a0Sblueswir1 abi_ulong st_size; 1821992f48a0Sblueswir1 abi_ulong st_blksize; 1822992f48a0Sblueswir1 abi_ulong st_blocks; 1823992f48a0Sblueswir1 abi_ulong target_st_atime; 1824992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1825992f48a0Sblueswir1 abi_ulong target_st_mtime; 1826992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1827992f48a0Sblueswir1 abi_ulong target_st_ctime; 1828992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1829992f48a0Sblueswir1 abi_ulong __unused4; 1830992f48a0Sblueswir1 abi_ulong __unused5; 18316db45e65Sths }; 18326db45e65Sths 18336db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely 18346db45e65Sths * insane amounts of padding around dev_t's. 18356db45e65Sths */ 183620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1837541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 18386db45e65Sths unsigned long long st_dev; 18396db45e65Sths unsigned char __pad0[4]; 18406db45e65Sths 18416db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1842992f48a0Sblueswir1 abi_ulong __st_ino; 18436db45e65Sths 18446db45e65Sths unsigned int st_mode; 18456db45e65Sths unsigned int st_nlink; 18466db45e65Sths 1847992f48a0Sblueswir1 abi_ulong st_uid; 1848992f48a0Sblueswir1 abi_ulong st_gid; 18496db45e65Sths 18506db45e65Sths unsigned long long st_rdev; 18516db45e65Sths unsigned char __pad3[4]; 18526db45e65Sths 18536db45e65Sths long long st_size; 1854992f48a0Sblueswir1 abi_ulong st_blksize; 18556db45e65Sths 18566db45e65Sths unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ 18576db45e65Sths 1858992f48a0Sblueswir1 abi_ulong target_st_atime; 1859992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 18606db45e65Sths 1861992f48a0Sblueswir1 abi_ulong target_st_mtime; 1862992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 18636db45e65Sths 1864992f48a0Sblueswir1 abi_ulong target_st_ctime; 1865992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 18666db45e65Sths 18676db45e65Sths unsigned long long st_ino; 18686db45e65Sths }; 18696db45e65Sths 1870d2fd1af7Sbellard #elif defined(TARGET_I386) && !defined(TARGET_ABI32) 1871d2fd1af7Sbellard struct target_stat { 1872d2fd1af7Sbellard abi_ulong st_dev; 1873d2fd1af7Sbellard abi_ulong st_ino; 1874d2fd1af7Sbellard abi_ulong st_nlink; 1875d2fd1af7Sbellard 1876d2fd1af7Sbellard unsigned int st_mode; 1877d2fd1af7Sbellard unsigned int st_uid; 1878d2fd1af7Sbellard unsigned int st_gid; 1879d2fd1af7Sbellard unsigned int __pad0; 1880d2fd1af7Sbellard abi_ulong st_rdev; 1881d2fd1af7Sbellard abi_long st_size; 1882d2fd1af7Sbellard abi_long st_blksize; 1883d2fd1af7Sbellard abi_long st_blocks; /* Number 512-byte blocks allocated. */ 1884d2fd1af7Sbellard 1885d2fd1af7Sbellard abi_ulong target_st_atime; 1886d2fd1af7Sbellard abi_ulong target_st_atime_nsec; 1887d2fd1af7Sbellard abi_ulong target_st_mtime; 1888d2fd1af7Sbellard abi_ulong target_st_mtime_nsec; 1889d2fd1af7Sbellard abi_ulong target_st_ctime; 1890d2fd1af7Sbellard abi_ulong target_st_ctime_nsec; 1891d2fd1af7Sbellard 1892d2fd1af7Sbellard abi_long __unused[3]; 1893d2fd1af7Sbellard }; 1894a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 1895a4c075f1SUlrich Hecht struct target_stat { 1896a4c075f1SUlrich Hecht abi_ulong st_dev; 1897a4c075f1SUlrich Hecht abi_ulong st_ino; 1898a4c075f1SUlrich Hecht abi_ulong st_nlink; 1899a4c075f1SUlrich Hecht unsigned int st_mode; 1900a4c075f1SUlrich Hecht unsigned int st_uid; 1901a4c075f1SUlrich Hecht unsigned int st_gid; 1902a4c075f1SUlrich Hecht unsigned int __pad1; 1903a4c075f1SUlrich Hecht abi_ulong st_rdev; 1904a4c075f1SUlrich Hecht abi_ulong st_size; 1905a4c075f1SUlrich Hecht abi_ulong target_st_atime; 1906a4c075f1SUlrich Hecht abi_ulong target_st_atime_nsec; 1907a4c075f1SUlrich Hecht abi_ulong target_st_mtime; 1908a4c075f1SUlrich Hecht abi_ulong target_st_mtime_nsec; 1909a4c075f1SUlrich Hecht abi_ulong target_st_ctime; 1910a4c075f1SUlrich Hecht abi_ulong target_st_ctime_nsec; 1911a4c075f1SUlrich Hecht abi_ulong st_blksize; 1912a4c075f1SUlrich Hecht abi_long st_blocks; 1913a4c075f1SUlrich Hecht abi_ulong __unused[3]; 1914a4c075f1SUlrich Hecht }; 191509701199SAlexander Graf #elif defined(TARGET_AARCH64) 191609701199SAlexander Graf struct target_stat { 191709701199SAlexander Graf abi_ulong st_dev; 191809701199SAlexander Graf abi_ulong st_ino; 191909701199SAlexander Graf unsigned int st_mode; 192009701199SAlexander Graf unsigned int st_nlink; 192109701199SAlexander Graf unsigned int st_uid; 192209701199SAlexander Graf unsigned int st_gid; 192309701199SAlexander Graf abi_ulong st_rdev; 192409701199SAlexander Graf abi_ulong _pad1; 192509701199SAlexander Graf abi_long st_size; 192609701199SAlexander Graf int st_blksize; 192709701199SAlexander Graf int __pad2; 192809701199SAlexander Graf abi_long st_blocks; 192909701199SAlexander Graf abi_long target_st_atime; 193009701199SAlexander Graf abi_ulong target_st_atime_nsec; 193109701199SAlexander Graf abi_long target_st_mtime; 193209701199SAlexander Graf abi_ulong target_st_mtime_nsec; 193309701199SAlexander Graf abi_long target_st_ctime; 193409701199SAlexander Graf abi_ulong target_st_ctime_nsec; 193509701199SAlexander Graf unsigned int __unused[2]; 193609701199SAlexander Graf }; 1937b16189b2SChen Gang #elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) 1938c7819dfbSPeter Maydell 1939c7819dfbSPeter Maydell /* These are the asm-generic versions of the stat and stat64 structures */ 1940c7819dfbSPeter Maydell 1941d962783eSJia Liu struct target_stat { 1942d962783eSJia Liu abi_ulong st_dev; 1943d962783eSJia Liu abi_ulong st_ino; 1944d962783eSJia Liu unsigned int st_mode; 1945c7819dfbSPeter Maydell unsigned int st_nlink; 1946d962783eSJia Liu unsigned int st_uid; 1947d962783eSJia Liu unsigned int st_gid; 1948d962783eSJia Liu abi_ulong st_rdev; 1949c7819dfbSPeter Maydell abi_ulong __pad1; 1950d962783eSJia Liu abi_long st_size; 1951c7819dfbSPeter Maydell int st_blksize; 1952c7819dfbSPeter Maydell int __pad2; 1953c7819dfbSPeter Maydell abi_long st_blocks; 1954c7819dfbSPeter Maydell abi_long target_st_atime; 1955d962783eSJia Liu abi_ulong target_st_atime_nsec; 1956c7819dfbSPeter Maydell abi_long target_st_mtime; 1957d962783eSJia Liu abi_ulong target_st_mtime_nsec; 1958c7819dfbSPeter Maydell abi_long target_st_ctime; 1959d962783eSJia Liu abi_ulong target_st_ctime_nsec; 1960c7819dfbSPeter Maydell unsigned int __unused4; 1961c7819dfbSPeter Maydell unsigned int __unused5; 1962d962783eSJia Liu }; 1963c7819dfbSPeter Maydell 196420d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1965c7819dfbSPeter Maydell struct target_stat64 { 1966c7819dfbSPeter Maydell uint64_t st_dev; 1967c7819dfbSPeter Maydell uint64_t st_ino; 1968c7819dfbSPeter Maydell unsigned int st_mode; 1969c7819dfbSPeter Maydell unsigned int st_nlink; 1970c7819dfbSPeter Maydell unsigned int st_uid; 1971c7819dfbSPeter Maydell unsigned int st_gid; 1972c7819dfbSPeter Maydell uint64_t st_rdev; 1973c7819dfbSPeter Maydell uint64_t __pad1; 1974c7819dfbSPeter Maydell int64_t st_size; 1975c7819dfbSPeter Maydell int st_blksize; 1976c7819dfbSPeter Maydell int __pad2; 1977c7819dfbSPeter Maydell int64_t st_blocks; 1978c7819dfbSPeter Maydell int target_st_atime; 1979c7819dfbSPeter Maydell unsigned int target_st_atime_nsec; 1980c7819dfbSPeter Maydell int target_st_mtime; 1981c7819dfbSPeter Maydell unsigned int target_st_mtime_nsec; 1982c7819dfbSPeter Maydell int target_st_ctime; 1983c7819dfbSPeter Maydell unsigned int target_st_ctime_nsec; 1984c7819dfbSPeter Maydell unsigned int __unused4; 1985c7819dfbSPeter Maydell unsigned int __unused5; 1986c7819dfbSPeter Maydell }; 1987c7819dfbSPeter Maydell 1988048f6b4dSbellard #else 1989048f6b4dSbellard #error unsupported CPU 1990048f6b4dSbellard #endif 19912521d698Sbellard 19924ce6f8deSths typedef struct { 19934ce6f8deSths int val[2]; 1994c227f099SAnthony Liguori } target_fsid_t; 19954ce6f8deSths 199656c8f68fSbellard #ifdef TARGET_MIPS 1997d26bc211Sths #ifdef TARGET_ABI_MIPSN32 1998540635baSths struct target_statfs { 1999540635baSths int32_t f_type; 2000540635baSths int32_t f_bsize; 2001540635baSths int32_t f_frsize; /* Fragment size - unsupported */ 2002540635baSths int32_t f_blocks; 2003540635baSths int32_t f_bfree; 2004540635baSths int32_t f_files; 2005540635baSths int32_t f_ffree; 2006540635baSths int32_t f_bavail; 2007540635baSths 2008540635baSths /* Linux specials */ 2009c227f099SAnthony Liguori target_fsid_t f_fsid; 2010540635baSths int32_t f_namelen; 2011540635baSths int32_t f_spare[6]; 2012540635baSths }; 2013540635baSths #else 201456c8f68fSbellard struct target_statfs { 2015992f48a0Sblueswir1 abi_long f_type; 2016992f48a0Sblueswir1 abi_long f_bsize; 2017992f48a0Sblueswir1 abi_long f_frsize; /* Fragment size - unsupported */ 2018992f48a0Sblueswir1 abi_long f_blocks; 2019992f48a0Sblueswir1 abi_long f_bfree; 2020992f48a0Sblueswir1 abi_long f_files; 2021992f48a0Sblueswir1 abi_long f_ffree; 2022992f48a0Sblueswir1 abi_long f_bavail; 202356c8f68fSbellard 202456c8f68fSbellard /* Linux specials */ 2025c227f099SAnthony Liguori target_fsid_t f_fsid; 2026992f48a0Sblueswir1 abi_long f_namelen; 2027992f48a0Sblueswir1 abi_long f_spare[6]; 202856c8f68fSbellard }; 2029540635baSths #endif 203056c8f68fSbellard 203156c8f68fSbellard struct target_statfs64 { 203256c8f68fSbellard uint32_t f_type; 203356c8f68fSbellard uint32_t f_bsize; 203456c8f68fSbellard uint32_t f_frsize; /* Fragment size - unsupported */ 203556c8f68fSbellard uint32_t __pad; 203656c8f68fSbellard uint64_t f_blocks; 203756c8f68fSbellard uint64_t f_bfree; 203856c8f68fSbellard uint64_t f_files; 203956c8f68fSbellard uint64_t f_ffree; 204056c8f68fSbellard uint64_t f_bavail; 2041c227f099SAnthony Liguori target_fsid_t f_fsid; 204256c8f68fSbellard uint32_t f_namelen; 204356c8f68fSbellard uint32_t f_spare[6]; 204456c8f68fSbellard }; 2045c4d10628Sbalrog #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ 204609701199SAlexander Graf defined(TARGET_SPARC64) || defined(TARGET_AARCH64)) && \ 204709701199SAlexander Graf !defined(TARGET_ABI32) 2048325e651fSj_mayer struct target_statfs { 2049325e651fSj_mayer abi_long f_type; 2050325e651fSj_mayer abi_long f_bsize; 2051325e651fSj_mayer abi_long f_blocks; 2052325e651fSj_mayer abi_long f_bfree; 2053325e651fSj_mayer abi_long f_bavail; 2054325e651fSj_mayer abi_long f_files; 2055325e651fSj_mayer abi_long f_ffree; 2056c227f099SAnthony Liguori target_fsid_t f_fsid; 2057325e651fSj_mayer abi_long f_namelen; 2058325e651fSj_mayer abi_long f_frsize; 2059325e651fSj_mayer abi_long f_spare[5]; 2060325e651fSj_mayer }; 2061325e651fSj_mayer 2062325e651fSj_mayer struct target_statfs64 { 2063325e651fSj_mayer abi_long f_type; 2064325e651fSj_mayer abi_long f_bsize; 2065325e651fSj_mayer abi_long f_blocks; 2066325e651fSj_mayer abi_long f_bfree; 2067325e651fSj_mayer abi_long f_bavail; 2068325e651fSj_mayer abi_long f_files; 2069325e651fSj_mayer abi_long f_ffree; 2070c227f099SAnthony Liguori target_fsid_t f_fsid; 2071325e651fSj_mayer abi_long f_namelen; 2072325e651fSj_mayer abi_long f_frsize; 2073325e651fSj_mayer abi_long f_spare[5]; 2074325e651fSj_mayer }; 2075a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 2076a4c075f1SUlrich Hecht struct target_statfs { 2077a4c075f1SUlrich Hecht int32_t f_type; 2078a4c075f1SUlrich Hecht int32_t f_bsize; 2079a4c075f1SUlrich Hecht abi_long f_blocks; 2080a4c075f1SUlrich Hecht abi_long f_bfree; 2081a4c075f1SUlrich Hecht abi_long f_bavail; 2082a4c075f1SUlrich Hecht abi_long f_files; 2083a4c075f1SUlrich Hecht abi_long f_ffree; 2084a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2085a4c075f1SUlrich Hecht int32_t f_namelen; 2086a4c075f1SUlrich Hecht int32_t f_frsize; 2087a4c075f1SUlrich Hecht int32_t f_spare[5]; 2088a4c075f1SUlrich Hecht }; 2089a4c075f1SUlrich Hecht 2090a4c075f1SUlrich Hecht struct target_statfs64 { 2091a4c075f1SUlrich Hecht int32_t f_type; 2092a4c075f1SUlrich Hecht int32_t f_bsize; 2093a4c075f1SUlrich Hecht abi_long f_blocks; 2094a4c075f1SUlrich Hecht abi_long f_bfree; 2095a4c075f1SUlrich Hecht abi_long f_bavail; 2096a4c075f1SUlrich Hecht abi_long f_files; 2097a4c075f1SUlrich Hecht abi_long f_ffree; 2098a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2099a4c075f1SUlrich Hecht int32_t f_namelen; 2100a4c075f1SUlrich Hecht int32_t f_frsize; 2101a4c075f1SUlrich Hecht int32_t f_spare[5]; 2102a4c075f1SUlrich Hecht }; 210356c8f68fSbellard #else 210456c8f68fSbellard struct target_statfs { 210556c8f68fSbellard uint32_t f_type; 210656c8f68fSbellard uint32_t f_bsize; 210756c8f68fSbellard uint32_t f_blocks; 210856c8f68fSbellard uint32_t f_bfree; 210956c8f68fSbellard uint32_t f_bavail; 211056c8f68fSbellard uint32_t f_files; 211156c8f68fSbellard uint32_t f_ffree; 2112c227f099SAnthony Liguori target_fsid_t f_fsid; 211356c8f68fSbellard uint32_t f_namelen; 211456c8f68fSbellard uint32_t f_frsize; 211556c8f68fSbellard uint32_t f_spare[5]; 211656c8f68fSbellard }; 211756c8f68fSbellard 211856c8f68fSbellard struct target_statfs64 { 211956c8f68fSbellard uint32_t f_type; 212056c8f68fSbellard uint32_t f_bsize; 212156c8f68fSbellard uint64_t f_blocks; 212256c8f68fSbellard uint64_t f_bfree; 212356c8f68fSbellard uint64_t f_bavail; 212456c8f68fSbellard uint64_t f_files; 212556c8f68fSbellard uint64_t f_ffree; 2126c227f099SAnthony Liguori target_fsid_t f_fsid; 212756c8f68fSbellard uint32_t f_namelen; 212856c8f68fSbellard uint32_t f_frsize; 212956c8f68fSbellard uint32_t f_spare[5]; 213056c8f68fSbellard }; 213156c8f68fSbellard #endif 213256c8f68fSbellard 213356c8f68fSbellard 21342521d698Sbellard #define TARGET_F_DUPFD 0 /* dup */ 21352521d698Sbellard #define TARGET_F_GETFD 1 /* get close_on_exec */ 21362521d698Sbellard #define TARGET_F_SETFD 2 /* set/clear close_on_exec */ 21372521d698Sbellard #define TARGET_F_GETFL 3 /* get file->f_flags */ 21382521d698Sbellard #define TARGET_F_SETFL 4 /* set file->f_flags */ 21392521d698Sbellard 21402521d698Sbellard #if defined(TARGET_ALPHA) 21412521d698Sbellard #define TARGET_F_GETLK 7 21422521d698Sbellard #define TARGET_F_SETLK 8 21432521d698Sbellard #define TARGET_F_SETLKW 9 21442521d698Sbellard #define TARGET_F_SETOWN 5 /* for sockets. */ 21452521d698Sbellard #define TARGET_F_GETOWN 6 /* for sockets. */ 21462ba7f730SLaurent Vivier 21472ba7f730SLaurent Vivier #define TARGET_F_RDLCK 1 21482ba7f730SLaurent Vivier #define TARGET_F_WRLCK 2 21492ba7f730SLaurent Vivier #define TARGET_F_UNLCK 8 21502ba7f730SLaurent Vivier #define TARGET_F_EXLCK 16 21512ba7f730SLaurent Vivier #define TARGET_F_SHLCK 32 21525f106811SArnaud Patard (Rtp) #elif defined(TARGET_MIPS) 21535f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK 14 21545f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK 6 21555f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW 7 21565f106811SArnaud Patard (Rtp) #define TARGET_F_SETOWN 24 /* for sockets. */ 21575f106811SArnaud Patard (Rtp) #define TARGET_F_GETOWN 25 /* for sockets. */ 21582521d698Sbellard #else 21592521d698Sbellard #define TARGET_F_GETLK 5 21602521d698Sbellard #define TARGET_F_SETLK 6 21612521d698Sbellard #define TARGET_F_SETLKW 7 21622521d698Sbellard #define TARGET_F_SETOWN 8 /* for sockets. */ 21632521d698Sbellard #define TARGET_F_GETOWN 9 /* for sockets. */ 21642521d698Sbellard #endif 21658d5d3004SAndreas Schwab #define TARGET_F_SETOWN_EX 15 21668d5d3004SAndreas Schwab #define TARGET_F_GETOWN_EX 16 21672521d698Sbellard 21682ba7f730SLaurent Vivier #ifndef TARGET_F_RDLCK 21692ba7f730SLaurent Vivier #define TARGET_F_RDLCK 0 21702ba7f730SLaurent Vivier #define TARGET_F_WRLCK 1 21712ba7f730SLaurent Vivier #define TARGET_F_UNLCK 2 21722ba7f730SLaurent Vivier #endif 21732ba7f730SLaurent Vivier 21742ba7f730SLaurent Vivier #ifndef TARGET_F_EXLCK 21752ba7f730SLaurent Vivier #define TARGET_F_EXLCK 4 21762ba7f730SLaurent Vivier #define TARGET_F_SHLCK 8 21772ba7f730SLaurent Vivier #endif 21782ba7f730SLaurent Vivier 21792ba7f730SLaurent Vivier 21802521d698Sbellard #define TARGET_F_SETSIG 10 /* for sockets. */ 21812521d698Sbellard #define TARGET_F_GETSIG 11 /* for sockets. */ 21822521d698Sbellard 21835f106811SArnaud Patard (Rtp) #if defined(TARGET_MIPS) 21845f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK64 33 /* using 'struct flock64' */ 21855f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK64 34 21865f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW64 35 21875f106811SArnaud Patard (Rtp) #else 21882521d698Sbellard #define TARGET_F_GETLK64 12 /* using 'struct flock64' */ 21892521d698Sbellard #define TARGET_F_SETLK64 13 21902521d698Sbellard #define TARGET_F_SETLKW64 14 21915f106811SArnaud Patard (Rtp) #endif 21927e22e546SUlrich Hecht 21937e22e546SUlrich Hecht #define TARGET_F_LINUX_SPECIFIC_BASE 1024 21947e22e546SUlrich Hecht #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0) 21957e22e546SUlrich Hecht #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1) 21967e22e546SUlrich Hecht #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) 21977e3b92ecSPeter Maydell #define TARGET_F_SETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 7) 21987e3b92ecSPeter Maydell #define TARGET_F_GETPIPE_SZ (TARGET_F_LINUX_SPECIFIC_BASE + 8) 21997e22e546SUlrich Hecht #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2) 22007e22e546SUlrich Hecht 22014eeea4f3SRichard Henderson #if defined(TARGET_ALPHA) 22024eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK 04 22034eeea4f3SRichard Henderson #define TARGET_O_APPEND 010 22044eeea4f3SRichard Henderson #define TARGET_O_CREAT 01000 /* not fcntl */ 22054eeea4f3SRichard Henderson #define TARGET_O_TRUNC 02000 /* not fcntl */ 22064eeea4f3SRichard Henderson #define TARGET_O_EXCL 04000 /* not fcntl */ 22074eeea4f3SRichard Henderson #define TARGET_O_NOCTTY 010000 /* not fcntl */ 22084eeea4f3SRichard Henderson #define TARGET_O_DSYNC 040000 22094eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0 /* not necessary, always 64-bit */ 22104eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY 0100000 /* must be a directory */ 22114eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW 0200000 /* don't follow links */ 22124eeea4f3SRichard Henderson #define TARGET_O_DIRECT 02000000 /* direct disk access hint */ 22134eeea4f3SRichard Henderson #define TARGET_O_NOATIME 04000000 22144eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 010000000 22154eeea4f3SRichard Henderson #define TARGET___O_SYNC 020000000 22164eeea4f3SRichard Henderson #define TARGET_O_PATH 040000000 22174eeea4f3SRichard Henderson #elif defined(TARGET_ARM) || defined(TARGET_M68K) 2218f09936acSbellard #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 2219f09936acSbellard #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 2220f09936acSbellard #define TARGET_O_DIRECT 0200000 /* direct disk access hint */ 2221f09936acSbellard #define TARGET_O_LARGEFILE 0400000 2222048f6b4dSbellard #elif defined(TARGET_MIPS) 2223048f6b4dSbellard #define TARGET_O_APPEND 0x0008 22244eeea4f3SRichard Henderson #define TARGET_O_DSYNC 0x0010 2225048f6b4dSbellard #define TARGET_O_NONBLOCK 0x0080 2226048f6b4dSbellard #define TARGET_O_CREAT 0x0100 /* not fcntl */ 2227048f6b4dSbellard #define TARGET_O_TRUNC 0x0200 /* not fcntl */ 2228048f6b4dSbellard #define TARGET_O_EXCL 0x0400 /* not fcntl */ 2229048f6b4dSbellard #define TARGET_O_NOCTTY 0x0800 /* not fcntl */ 2230048f6b4dSbellard #define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */ 2231048f6b4dSbellard #define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */ 22324eeea4f3SRichard Henderson #define TARGET___O_SYNC 0x4000 2233048f6b4dSbellard #define TARGET_O_DIRECT 0x8000 /* direct disk access hint */ 22344eeea4f3SRichard Henderson #elif defined (TARGET_PPC) 22354eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 22364eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 22374eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0200000 22384eeea4f3SRichard Henderson #define TARGET_O_DIRECT 0400000 /* direct disk access hint */ 22394eeea4f3SRichard Henderson #elif defined (TARGET_SPARC) 22401f961124Saurel32 #define TARGET_O_APPEND 0x0008 22414eeea4f3SRichard Henderson #define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */ 22421f961124Saurel32 #define TARGET_O_CREAT 0x0200 /* not fcntl */ 22431f961124Saurel32 #define TARGET_O_TRUNC 0x0400 /* not fcntl */ 22441f961124Saurel32 #define TARGET_O_EXCL 0x0800 /* not fcntl */ 22454eeea4f3SRichard Henderson #define TARGET_O_DSYNC 0x2000 22464eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK 0x4000 22474eeea4f3SRichard Henderson # ifdef TARGET_SPARC64 22484eeea4f3SRichard Henderson # define TARGET_O_NDELAY 0x0004 2249ffa65c3bSbellard # else 22504eeea4f3SRichard Henderson # define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK) 22514eeea4f3SRichard Henderson # endif 22524eeea4f3SRichard Henderson #define TARGET_O_NOCTTY 0x8000 /* not fcntl */ 22534eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0x40000 22544eeea4f3SRichard Henderson #define TARGET_O_DIRECT 0x100000 /* direct disk access hint */ 22554eeea4f3SRichard Henderson #define TARGET_O_NOATIME 0x200000 22564eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 0x400000 22574eeea4f3SRichard Henderson #define TARGET___O_SYNC 0x800000 22584eeea4f3SRichard Henderson #define TARGET_O_PATH 0x1000000 22594eeea4f3SRichard Henderson #endif 22604eeea4f3SRichard Henderson 22614eeea4f3SRichard Henderson /* <asm-generic/fcntl.h> values follow. */ 2262ffa65c3bSbellard #define TARGET_O_ACCMODE 0003 2263ffa65c3bSbellard #define TARGET_O_RDONLY 00 2264ffa65c3bSbellard #define TARGET_O_WRONLY 01 2265ffa65c3bSbellard #define TARGET_O_RDWR 02 22664eeea4f3SRichard Henderson #ifndef TARGET_O_CREAT 2267ffa65c3bSbellard #define TARGET_O_CREAT 0100 /* not fcntl */ 22684eeea4f3SRichard Henderson #endif 22694eeea4f3SRichard Henderson #ifndef TARGET_O_EXCL 2270ffa65c3bSbellard #define TARGET_O_EXCL 0200 /* not fcntl */ 22714eeea4f3SRichard Henderson #endif 22724eeea4f3SRichard Henderson #ifndef TARGET_O_NOCTTY 2273ffa65c3bSbellard #define TARGET_O_NOCTTY 0400 /* not fcntl */ 22744eeea4f3SRichard Henderson #endif 22754eeea4f3SRichard Henderson #ifndef TARGET_O_TRUNC 2276ffa65c3bSbellard #define TARGET_O_TRUNC 01000 /* not fcntl */ 22774eeea4f3SRichard Henderson #endif 22784eeea4f3SRichard Henderson #ifndef TARGET_O_APPEND 2279ffa65c3bSbellard #define TARGET_O_APPEND 02000 22804eeea4f3SRichard Henderson #endif 22814eeea4f3SRichard Henderson #ifndef TARGET_O_NONBLOCK 2282ffa65c3bSbellard #define TARGET_O_NONBLOCK 04000 22834eeea4f3SRichard Henderson #endif 22844eeea4f3SRichard Henderson #ifndef TARGET_O_DSYNC 22854eeea4f3SRichard Henderson #define TARGET_O_DSYNC 010000 22864eeea4f3SRichard Henderson #endif 22874eeea4f3SRichard Henderson #ifndef TARGET_FASYNC 2288ffa65c3bSbellard #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ 22894eeea4f3SRichard Henderson #endif 22904eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECT 2291ffa65c3bSbellard #define TARGET_O_DIRECT 040000 /* direct disk access hint */ 22924eeea4f3SRichard Henderson #endif 22934eeea4f3SRichard Henderson #ifndef TARGET_O_LARGEFILE 2294ffa65c3bSbellard #define TARGET_O_LARGEFILE 0100000 22954eeea4f3SRichard Henderson #endif 22964eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECTORY 2297ffa65c3bSbellard #define TARGET_O_DIRECTORY 0200000 /* must be a directory */ 22984eeea4f3SRichard Henderson #endif 22994eeea4f3SRichard Henderson #ifndef TARGET_O_NOFOLLOW 2300ffa65c3bSbellard #define TARGET_O_NOFOLLOW 0400000 /* don't follow links */ 2301ffa65c3bSbellard #endif 23024eeea4f3SRichard Henderson #ifndef TARGET_O_NOATIME 23034eeea4f3SRichard Henderson #define TARGET_O_NOATIME 01000000 23044eeea4f3SRichard Henderson #endif 23054eeea4f3SRichard Henderson #ifndef TARGET_O_CLOEXEC 23064eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 02000000 23074eeea4f3SRichard Henderson #endif 23084eeea4f3SRichard Henderson #ifndef TARGET___O_SYNC 23094eeea4f3SRichard Henderson #define TARGET___O_SYNC 04000000 23104eeea4f3SRichard Henderson #endif 23114eeea4f3SRichard Henderson #ifndef TARGET_O_PATH 23124eeea4f3SRichard Henderson #define TARGET_O_PATH 010000000 23134eeea4f3SRichard Henderson #endif 23144eeea4f3SRichard Henderson #ifndef TARGET_O_NDELAY 23154eeea4f3SRichard Henderson #define TARGET_O_NDELAY TARGET_O_NONBLOCK 23164eeea4f3SRichard Henderson #endif 23174eeea4f3SRichard Henderson #ifndef TARGET_O_SYNC 23184eeea4f3SRichard Henderson #define TARGET_O_SYNC (TARGET___O_SYNC | TARGET_O_DSYNC) 23194eeea4f3SRichard Henderson #endif 2320ffa65c3bSbellard 23212521d698Sbellard struct target_flock { 23222521d698Sbellard short l_type; 23232521d698Sbellard short l_whence; 23248efb2ed5SPeter Maydell abi_long l_start; 23258efb2ed5SPeter Maydell abi_long l_len; 23262521d698Sbellard int l_pid; 23272521d698Sbellard }; 23282521d698Sbellard 23292521d698Sbellard struct target_flock64 { 23302521d698Sbellard short l_type; 23312521d698Sbellard short l_whence; 2332b16189b2SChen Gang #if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) \ 2333b16189b2SChen Gang || defined(TARGET_SPARC) || defined(TARGET_HPPA) \ 2334b16189b2SChen Gang || defined(TARGET_MICROBLAZE) || defined(TARGET_TILEGX) 2335ce3f0e2fSaurel32 int __pad; 2336ce3f0e2fSaurel32 #endif 23378efb2ed5SPeter Maydell abi_llong l_start; 23388efb2ed5SPeter Maydell abi_llong l_len; 23392521d698Sbellard int l_pid; 2340541dc0d4SStefan Weil } QEMU_PACKED; 23412521d698Sbellard 2342ce4defa0Spbrook #ifdef TARGET_ARM 2343ce4defa0Spbrook struct target_eabi_flock64 { 2344ce4defa0Spbrook short l_type; 2345ce4defa0Spbrook short l_whence; 2346ce4defa0Spbrook int __pad; 23478efb2ed5SPeter Maydell abi_llong l_start; 23488efb2ed5SPeter Maydell abi_llong l_len; 2349ce4defa0Spbrook int l_pid; 2350541dc0d4SStefan Weil } QEMU_PACKED; 2351ce4defa0Spbrook #endif 23522521d698Sbellard 23538d5d3004SAndreas Schwab struct target_f_owner_ex { 23548d5d3004SAndreas Schwab int type; /* Owner type of ID. */ 23558d5d3004SAndreas Schwab int pid; /* ID of owner. */ 23568d5d3004SAndreas Schwab }; 23578d5d3004SAndreas Schwab 23582521d698Sbellard /* soundcard defines */ 235967cc32ebSVeres Lajos /* XXX: convert them all to arch independent entries */ 23602521d698Sbellard #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); 23612521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 23622521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 23632521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 23642521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA 0xc0144302 23652521d698Sbellard #define TARGET_SNDCTL_COPR_RESET 0x00004300 23662521d698Sbellard #define TARGET_SNDCTL_COPR_RUN 0xc0144306 23672521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 23682521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE 0x40144305 23692521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA 0x40144304 23702521d698Sbellard #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) 23712521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) 23722521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) 23732521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) 23742521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) 23752521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) 23762521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) 23772521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) 23782521d698Sbellard #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) 23792521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) 23802521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) 23812521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) 23822521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) 23832521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) 23842521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) 23852521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) 23862521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) 23872521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) 23885f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19) 23895f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20) 23902521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e 23912521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 23922521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 23932521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 23942521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 23952521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f 23962521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 23972521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO 0xc074510c 23982521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 23992521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 24002521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 24012521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 24022521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 24032521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 24042521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 24052521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 24062521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b 24072521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a 24082521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 24092521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC 0x00005111 24102521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 24112521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET 0x00005100 24122521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 24132521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC 0x00005101 24142521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 24152521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d 24162521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d 24172521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 24182521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e 24192521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 24202521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME 0x40045407 24212521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT 0x40045408 24222521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 24232521d698Sbellard #define TARGET_SNDCTL_TMR_START 0x00005402 24242521d698Sbellard #define TARGET_SNDCTL_TMR_STOP 0x00005403 24252521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 24262521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 24272521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE 0x80045002 24282521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 24292521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS 0x80045005 24302521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 24312521d698Sbellard #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) 24322521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 24332521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) 24342521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) 24352521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) 24362521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) 24372521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) 24382521d698Sbellard 24392521d698Sbellard #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) 24402521d698Sbellard 24412521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) 24422521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) 24432521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) 24442521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) 24452521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) 24462521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) 24472521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) 24482521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) 24492521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) 24502521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) 24512521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) 24522521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) 24532521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) 24542521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) 24552521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) 24562521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) 24572521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) 24582521d698Sbellard 24592521d698Sbellard /* Obsolete macros */ 24602521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) 24612521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) 24622521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) 24632521d698Sbellard 24642521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) 24652521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) 24662521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) 24672521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) 24682521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) 24692521d698Sbellard 24702521d698Sbellard #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) 24712521d698Sbellard 24722521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) 24732521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) 24742521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) 24752521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) 24762521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) 24772521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) 24782521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) 24792521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) 24802521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) 24812521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) 24822521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) 24832521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) 24842521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) 24852521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) 24862521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) 24872521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) 24882521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) 24892521d698Sbellard 24902521d698Sbellard /* Obsolete macros */ 24912521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) 24922521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) 24932521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) 24942521d698Sbellard 24952521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) 24962521d698Sbellard 24972521d698Sbellard /* vfat ioctls */ 24982521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) 24992521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) 2500a5448a7dSbellard 25018fbd6b52Sbalrog #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct mtop) 25028fbd6b52Sbalrog #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct mtget) 25038fbd6b52Sbalrog #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct mtpos) 25048fbd6b52Sbalrog 2505a5448a7dSbellard struct target_sysinfo { 2506992f48a0Sblueswir1 abi_long uptime; /* Seconds since boot */ 2507992f48a0Sblueswir1 abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */ 2508992f48a0Sblueswir1 abi_ulong totalram; /* Total usable main memory size */ 2509992f48a0Sblueswir1 abi_ulong freeram; /* Available memory size */ 2510992f48a0Sblueswir1 abi_ulong sharedram; /* Amount of shared memory */ 2511992f48a0Sblueswir1 abi_ulong bufferram; /* Memory used by buffers */ 2512992f48a0Sblueswir1 abi_ulong totalswap; /* Total swap space size */ 2513992f48a0Sblueswir1 abi_ulong freeswap; /* swap space still available */ 2514a5448a7dSbellard unsigned short procs; /* Number of current processes */ 2515a5448a7dSbellard unsigned short pad; /* explicit padding for m68k */ 2516992f48a0Sblueswir1 abi_ulong totalhigh; /* Total high memory size */ 2517992f48a0Sblueswir1 abi_ulong freehigh; /* Available high memory size */ 2518a5448a7dSbellard unsigned int mem_unit; /* Memory unit size in bytes */ 2519992f48a0Sblueswir1 char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 2520a5448a7dSbellard }; 25213532fa74Sbellard 25226556a833Saurel32 struct linux_dirent { 25236556a833Saurel32 long d_ino; 25246556a833Saurel32 unsigned long d_off; 25256556a833Saurel32 unsigned short d_reclen; 25266556a833Saurel32 char d_name[256]; /* We must not include limits.h! */ 25276556a833Saurel32 }; 25286556a833Saurel32 25296556a833Saurel32 struct linux_dirent64 { 25306556a833Saurel32 uint64_t d_ino; 25316556a833Saurel32 int64_t d_off; 25326556a833Saurel32 unsigned short d_reclen; 25336556a833Saurel32 unsigned char d_type; 25346556a833Saurel32 char d_name[256]; 25356556a833Saurel32 }; 25366556a833Saurel32 253724e1003aSaurel32 struct target_mq_attr { 253824e1003aSaurel32 abi_long mq_flags; 253924e1003aSaurel32 abi_long mq_maxmsg; 254024e1003aSaurel32 abi_long mq_msgsize; 254124e1003aSaurel32 abi_long mq_curmsgs; 254224e1003aSaurel32 }; 254324e1003aSaurel32 25443532fa74Sbellard #include "socket.h" 2545637947f1Sths 2546637947f1Sths #include "errno_defs.h" 254703dfe9f8SRiku Voipio 254803dfe9f8SRiku Voipio #define FUTEX_WAIT 0 254903dfe9f8SRiku Voipio #define FUTEX_WAKE 1 255003dfe9f8SRiku Voipio #define FUTEX_FD 2 255103dfe9f8SRiku Voipio #define FUTEX_REQUEUE 3 255203dfe9f8SRiku Voipio #define FUTEX_CMP_REQUEUE 4 255303dfe9f8SRiku Voipio #define FUTEX_WAKE_OP 5 255403dfe9f8SRiku Voipio #define FUTEX_LOCK_PI 6 255503dfe9f8SRiku Voipio #define FUTEX_UNLOCK_PI 7 255603dfe9f8SRiku Voipio #define FUTEX_TRYLOCK_PI 8 255703dfe9f8SRiku Voipio #define FUTEX_WAIT_BITSET 9 255803dfe9f8SRiku Voipio #define FUTEX_WAKE_BITSET 10 255903dfe9f8SRiku Voipio 256003dfe9f8SRiku Voipio #define FUTEX_PRIVATE_FLAG 128 256103dfe9f8SRiku Voipio #define FUTEX_CLOCK_REALTIME 256 256203dfe9f8SRiku Voipio #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) 256303dfe9f8SRiku Voipio 25643b6edd16SPeter Maydell #ifdef CONFIG_EPOLL 2565928bed6aSLaurent Vivier #if defined(TARGET_X86_64) 2566928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED QEMU_PACKED 2567928bed6aSLaurent Vivier #else 2568928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED 2569928bed6aSLaurent Vivier #endif 2570928bed6aSLaurent Vivier 25713b6edd16SPeter Maydell typedef union target_epoll_data { 25723b6edd16SPeter Maydell abi_ulong ptr; 2573928bed6aSLaurent Vivier abi_int fd; 2574928bed6aSLaurent Vivier abi_uint u32; 2575928bed6aSLaurent Vivier abi_ullong u64; 25763b6edd16SPeter Maydell } target_epoll_data_t; 25773b6edd16SPeter Maydell 25783b6edd16SPeter Maydell struct target_epoll_event { 2579928bed6aSLaurent Vivier abi_uint events; 25803b6edd16SPeter Maydell target_epoll_data_t data; 2581928bed6aSLaurent Vivier } TARGET_EPOLL_PACKED; 25823b6edd16SPeter Maydell #endif 2583163a05a8SPeter Maydell struct target_rlimit64 { 2584163a05a8SPeter Maydell uint64_t rlim_cur; 2585163a05a8SPeter Maydell uint64_t rlim_max; 2586163a05a8SPeter Maydell }; 2587583359a6SAkos PASZTORY 2588583359a6SAkos PASZTORY struct target_ucred { 2589583359a6SAkos PASZTORY uint32_t pid; 2590583359a6SAkos PASZTORY uint32_t uid; 2591583359a6SAkos PASZTORY uint32_t gid; 2592583359a6SAkos PASZTORY }; 2593cb9c377fSPaolo Bonzini 2594aecc8861SAlexander Graf typedef int32_t target_timer_t; 2595905bba13SErik de Castro Lopo 259634d60862SNatanael Copa #define TARGET_SIGEV_MAX_SIZE 64 259734d60862SNatanael Copa 259834d60862SNatanael Copa /* This is architecture-specific but most architectures use the default */ 259934d60862SNatanael Copa #ifdef TARGET_MIPS 260034d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long)) 260134d60862SNatanael Copa #else 260234d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ 260334d60862SNatanael Copa + sizeof(target_sigval_t)) 260434d60862SNatanael Copa #endif 260534d60862SNatanael Copa 260634d60862SNatanael Copa #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ 260734d60862SNatanael Copa - TARGET_SIGEV_PREAMBLE_SIZE) \ 260834d60862SNatanael Copa / sizeof(int32_t)) 260934d60862SNatanael Copa 2610905bba13SErik de Castro Lopo struct target_sigevent { 2611905bba13SErik de Castro Lopo target_sigval_t sigev_value; 2612905bba13SErik de Castro Lopo int32_t sigev_signo; 2613905bba13SErik de Castro Lopo int32_t sigev_notify; 2614905bba13SErik de Castro Lopo union { 261534d60862SNatanael Copa int32_t _pad[TARGET_SIGEV_PAD_SIZE]; 2616905bba13SErik de Castro Lopo int32_t _tid; 2617905bba13SErik de Castro Lopo 2618905bba13SErik de Castro Lopo struct { 2619905bba13SErik de Castro Lopo void (*_function)(sigval_t); 2620905bba13SErik de Castro Lopo void *_attribute; 2621905bba13SErik de Castro Lopo } _sigev_thread; 2622905bba13SErik de Castro Lopo } _sigev_un; 2623905bba13SErik de Castro Lopo }; 2624e0eb210eSPeter Maydell 2625e0eb210eSPeter Maydell struct target_user_cap_header { 2626e0eb210eSPeter Maydell uint32_t version; 2627e0eb210eSPeter Maydell int pid; 2628e0eb210eSPeter Maydell }; 2629e0eb210eSPeter Maydell 2630e0eb210eSPeter Maydell struct target_user_cap_data { 2631e0eb210eSPeter Maydell uint32_t effective; 2632e0eb210eSPeter Maydell uint32_t permitted; 2633e0eb210eSPeter Maydell uint32_t inheritable; 2634e0eb210eSPeter Maydell }; 26351b3c4fdfSMarkus Armbruster 26361b3c4fdfSMarkus Armbruster #endif 2637