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 8cb9c377fSPaolo Bonzini #define SYSCALL_DEFS_H 1 9cb9c377fSPaolo Bonzini 10cb9c377fSPaolo Bonzini 116180a181Sbellard #include "syscall_nr.h" 122521d698Sbellard 1331e31b8aSbellard #define SOCKOP_socket 1 1431e31b8aSbellard #define SOCKOP_bind 2 1531e31b8aSbellard #define SOCKOP_connect 3 1631e31b8aSbellard #define SOCKOP_listen 4 1731e31b8aSbellard #define SOCKOP_accept 5 1831e31b8aSbellard #define SOCKOP_getsockname 6 1931e31b8aSbellard #define SOCKOP_getpeername 7 2031e31b8aSbellard #define SOCKOP_socketpair 8 2131e31b8aSbellard #define SOCKOP_send 9 2231e31b8aSbellard #define SOCKOP_recv 10 2331e31b8aSbellard #define SOCKOP_sendto 11 2431e31b8aSbellard #define SOCKOP_recvfrom 12 2531e31b8aSbellard #define SOCKOP_shutdown 13 2631e31b8aSbellard #define SOCKOP_setsockopt 14 2731e31b8aSbellard #define SOCKOP_getsockopt 15 2831e31b8aSbellard #define SOCKOP_sendmsg 16 2931e31b8aSbellard #define SOCKOP_recvmsg 17 30b9d36eb2SAndré Hentschel #define SOCKOP_accept4 18 3131e31b8aSbellard 328853f86eSbellard #define IPCOP_semop 1 338853f86eSbellard #define IPCOP_semget 2 348853f86eSbellard #define IPCOP_semctl 3 358853f86eSbellard #define IPCOP_semtimedop 4 368853f86eSbellard #define IPCOP_msgsnd 11 378853f86eSbellard #define IPCOP_msgrcv 12 388853f86eSbellard #define IPCOP_msgget 13 398853f86eSbellard #define IPCOP_msgctl 14 408853f86eSbellard #define IPCOP_shmat 21 418853f86eSbellard #define IPCOP_shmdt 22 428853f86eSbellard #define IPCOP_shmget 23 438853f86eSbellard #define IPCOP_shmctl 24 448853f86eSbellard 452521d698Sbellard /* 462521d698Sbellard * The following is for compatibility across the various Linux 472521d698Sbellard * platforms. The i386 ioctl numbering scheme doesn't really enforce 482521d698Sbellard * a type field. De facto, however, the top 8 bits of the lower 16 492521d698Sbellard * bits are indeed used as a type field, so we might just as well make 502521d698Sbellard * this explicit here. Please be sure to use the decoding macros 512521d698Sbellard * below from now on. 522521d698Sbellard */ 532521d698Sbellard #define TARGET_IOC_NRBITS 8 542521d698Sbellard #define TARGET_IOC_TYPEBITS 8 552521d698Sbellard 56cd98d390SAndreas Schwab #if defined(TARGET_I386) || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 57cd98d390SAndreas Schwab || defined(TARGET_SPARC) \ 580c866a7eSRiku Voipio || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) 5974d753acSMika Westerberg /* 16 bit uid wrappers emulation */ 6074d753acSMika Westerberg #define USE_UID16 610c866a7eSRiku Voipio #define target_id uint16_t 620c866a7eSRiku Voipio #else 630c866a7eSRiku Voipio #define target_id uint32_t 6474d753acSMika Westerberg #endif 6574d753acSMika Westerberg 66e6e5906bSpbrook #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ 67b16189b2SChen Gang || defined(TARGET_M68K) || defined(TARGET_CRIS) \ 68b16189b2SChen Gang || defined(TARGET_UNICORE32) || defined(TARGET_S390X) \ 69b16189b2SChen Gang || defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) 702521d698Sbellard 712521d698Sbellard #define TARGET_IOC_SIZEBITS 14 722521d698Sbellard #define TARGET_IOC_DIRBITS 2 732521d698Sbellard 742521d698Sbellard #define TARGET_IOC_NONE 0U 752521d698Sbellard #define TARGET_IOC_WRITE 1U 762521d698Sbellard #define TARGET_IOC_READ 2U 772521d698Sbellard 78048f6b4dSbellard #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ 79b779e29eSEdgar E. Iglesias defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \ 80b779e29eSEdgar E. Iglesias defined(TARGET_MIPS) 812521d698Sbellard 822521d698Sbellard #define TARGET_IOC_SIZEBITS 13 832521d698Sbellard #define TARGET_IOC_DIRBITS 3 842521d698Sbellard 852521d698Sbellard #define TARGET_IOC_NONE 1U 862521d698Sbellard #define TARGET_IOC_READ 2U 872521d698Sbellard #define TARGET_IOC_WRITE 4U 882521d698Sbellard 892521d698Sbellard #else 902521d698Sbellard #error unsupported CPU 912521d698Sbellard #endif 922521d698Sbellard 932521d698Sbellard #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) 942521d698Sbellard #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) 952521d698Sbellard #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) 962521d698Sbellard #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) 972521d698Sbellard 982521d698Sbellard #define TARGET_IOC_NRSHIFT 0 992521d698Sbellard #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) 1002521d698Sbellard #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) 1012521d698Sbellard #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) 1022521d698Sbellard 1032521d698Sbellard #define TARGET_IOC(dir,type,nr,size) \ 1042521d698Sbellard (((dir) << TARGET_IOC_DIRSHIFT) | \ 1052521d698Sbellard ((type) << TARGET_IOC_TYPESHIFT) | \ 1062521d698Sbellard ((nr) << TARGET_IOC_NRSHIFT) | \ 1072521d698Sbellard ((size) << TARGET_IOC_SIZESHIFT)) 1082521d698Sbellard 1092521d698Sbellard /* used to create numbers */ 1102521d698Sbellard #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) 1112521d698Sbellard #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) 1122521d698Sbellard #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1132521d698Sbellard #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1142521d698Sbellard 1152521d698Sbellard /* the size is automatically computed for these defines */ 1162521d698Sbellard #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) 1172521d698Sbellard #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1182521d698Sbellard #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1192521d698Sbellard 1207854b056Sbellard struct target_sockaddr { 1217854b056Sbellard uint16_t sa_family; 1227854b056Sbellard uint8_t sa_data[14]; 1237854b056Sbellard }; 1247854b056Sbellard 12533a29b51SJoakim Tjernlund struct target_sockaddr_ll { 12633a29b51SJoakim Tjernlund uint16_t sll_family; /* Always AF_PACKET */ 12733a29b51SJoakim Tjernlund uint16_t sll_protocol; /* Physical layer protocol */ 12833a29b51SJoakim Tjernlund int sll_ifindex; /* Interface number */ 12933a29b51SJoakim Tjernlund uint16_t sll_hatype; /* ARP hardware type */ 13033a29b51SJoakim Tjernlund uint8_t sll_pkttype; /* Packet type */ 13133a29b51SJoakim Tjernlund uint8_t sll_halen; /* Length of address */ 13233a29b51SJoakim Tjernlund uint8_t sll_addr[8]; /* Physical layer address */ 13333a29b51SJoakim Tjernlund }; 13433a29b51SJoakim Tjernlund 135f57d4192SLaurent Vivier struct target_sock_filter { 136f57d4192SLaurent Vivier abi_ushort code; 137f57d4192SLaurent Vivier uint8_t jt; 138f57d4192SLaurent Vivier uint8_t jf; 139f57d4192SLaurent Vivier abi_uint k; 140f57d4192SLaurent Vivier }; 141f57d4192SLaurent Vivier 142f57d4192SLaurent Vivier struct target_sock_fprog { 143f57d4192SLaurent Vivier abi_ushort len; 144f57d4192SLaurent Vivier abi_ulong filter; 145f57d4192SLaurent Vivier }; 146f57d4192SLaurent Vivier 147b975b83bSLionel Landwerlin struct target_in_addr { 148b975b83bSLionel Landwerlin uint32_t s_addr; /* big endian */ 149b975b83bSLionel Landwerlin }; 150b975b83bSLionel Landwerlin 151b975b83bSLionel Landwerlin struct target_ip_mreq { 152b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 153b975b83bSLionel Landwerlin struct target_in_addr imr_address; 154b975b83bSLionel Landwerlin }; 155b975b83bSLionel Landwerlin 156b975b83bSLionel Landwerlin struct target_ip_mreqn { 157b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 158b975b83bSLionel Landwerlin struct target_in_addr imr_address; 159b975b83bSLionel Landwerlin abi_long imr_ifindex; 160b975b83bSLionel Landwerlin }; 161b975b83bSLionel Landwerlin 1626e3cb58fSLionel Landwerlin struct target_ip_mreq_source { 1636e3cb58fSLionel Landwerlin /* big endian */ 1646e3cb58fSLionel Landwerlin uint32_t imr_multiaddr; 1656e3cb58fSLionel Landwerlin uint32_t imr_interface; 1666e3cb58fSLionel Landwerlin uint32_t imr_sourceaddr; 1676e3cb58fSLionel Landwerlin }; 1686e3cb58fSLionel Landwerlin 16931e31b8aSbellard struct target_timeval { 170992f48a0Sblueswir1 abi_long tv_sec; 171992f48a0Sblueswir1 abi_long tv_usec; 17231e31b8aSbellard }; 17331e31b8aSbellard 1741b6b029eSbellard struct target_timespec { 175992f48a0Sblueswir1 abi_long tv_sec; 176992f48a0Sblueswir1 abi_long tv_nsec; 1771b6b029eSbellard }; 1781b6b029eSbellard 179ef4467e9SPaul Burton struct target_timezone { 180ef4467e9SPaul Burton abi_int tz_minuteswest; 181ef4467e9SPaul Burton abi_int tz_dsttime; 182ef4467e9SPaul Burton }; 183ef4467e9SPaul Burton 18466fb9763Sbellard struct target_itimerval { 18566fb9763Sbellard struct target_timeval it_interval; 18666fb9763Sbellard struct target_timeval it_value; 18766fb9763Sbellard }; 18866fb9763Sbellard 189905bba13SErik de Castro Lopo struct target_itimerspec { 190905bba13SErik de Castro Lopo struct target_timespec it_interval; 191905bba13SErik de Castro Lopo struct target_timespec it_value; 192905bba13SErik de Castro Lopo }; 193905bba13SErik de Castro Lopo 194c227f099SAnthony Liguori typedef abi_long target_clock_t; 19532f36bceSbellard 196c596ed17Sbellard #define TARGET_HZ 100 197c596ed17Sbellard 19832f36bceSbellard struct target_tms { 199c227f099SAnthony Liguori target_clock_t tms_utime; 200c227f099SAnthony Liguori target_clock_t tms_stime; 201c227f099SAnthony Liguori target_clock_t tms_cutime; 202c227f099SAnthony Liguori target_clock_t tms_cstime; 20332f36bceSbellard }; 20432f36bceSbellard 2056180a181Sbellard struct target_utimbuf { 206992f48a0Sblueswir1 abi_long actime; 207992f48a0Sblueswir1 abi_long modtime; 2086180a181Sbellard }; 2096180a181Sbellard 210f2674e31Sbellard struct target_sel_arg_struct { 211992f48a0Sblueswir1 abi_long n; 212992f48a0Sblueswir1 abi_long inp, outp, exp; 213992f48a0Sblueswir1 abi_long tvp; 214f2674e31Sbellard }; 215f2674e31Sbellard 21631e31b8aSbellard struct target_iovec { 217992f48a0Sblueswir1 abi_long iov_base; /* Starting address */ 218992f48a0Sblueswir1 abi_long iov_len; /* Number of bytes */ 21931e31b8aSbellard }; 22031e31b8aSbellard 2211a9353d2Sbellard struct target_msghdr { 222992f48a0Sblueswir1 abi_long msg_name; /* Socket name */ 2231a9353d2Sbellard int msg_namelen; /* Length of name */ 224992f48a0Sblueswir1 abi_long msg_iov; /* Data blocks */ 225992f48a0Sblueswir1 abi_long msg_iovlen; /* Number of blocks */ 226992f48a0Sblueswir1 abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ 227992f48a0Sblueswir1 abi_long msg_controllen; /* Length of cmsg list */ 2281a9353d2Sbellard unsigned int msg_flags; 2291a9353d2Sbellard }; 2301a9353d2Sbellard 2317854b056Sbellard struct target_cmsghdr { 232992f48a0Sblueswir1 abi_long cmsg_len; 2337854b056Sbellard int cmsg_level; 2347854b056Sbellard int cmsg_type; 2357854b056Sbellard }; 2367854b056Sbellard 2377854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) 238ee104587SJonathan Neuschäfer #define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \ 239ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start) 240992f48a0Sblueswir1 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ 241992f48a0Sblueswir1 & (size_t) ~(sizeof (abi_long) - 1)) 2427854b056Sbellard #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \ 2437854b056Sbellard + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr))) 2447854b056Sbellard #define TARGET_CMSG_LEN(len) (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len)) 2457854b056Sbellard 2467854b056Sbellard static __inline__ struct target_cmsghdr * 247ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(struct target_msghdr *__mhdr, 248ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg, 249ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg_start) 2507854b056Sbellard { 2512b8bdefcSths struct target_cmsghdr *__ptr; 2527854b056Sbellard 2532b8bdefcSths __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg 254cbb21eedSMatthias Braun + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len))); 255ee104587SJonathan Neuschäfer if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start) 256ee104587SJonathan Neuschäfer > tswapal(__mhdr->msg_controllen)) { 2577854b056Sbellard /* No more entries. */ 2582b8bdefcSths return (struct target_cmsghdr *)0; 259ee104587SJonathan Neuschäfer } 260ee104587SJonathan Neuschäfer return __ptr; 2617854b056Sbellard } 2627854b056Sbellard 263f19e00d7SAlexander Graf struct target_mmsghdr { 264f19e00d7SAlexander Graf struct target_msghdr msg_hdr; /* Message header */ 265f19e00d7SAlexander Graf unsigned int msg_len; /* Number of bytes transmitted */ 266f19e00d7SAlexander Graf }; 2677854b056Sbellard 26831e31b8aSbellard struct target_rusage { 26931e31b8aSbellard struct target_timeval ru_utime; /* user time used */ 27031e31b8aSbellard struct target_timeval ru_stime; /* system time used */ 271992f48a0Sblueswir1 abi_long ru_maxrss; /* maximum resident set size */ 272992f48a0Sblueswir1 abi_long ru_ixrss; /* integral shared memory size */ 273992f48a0Sblueswir1 abi_long ru_idrss; /* integral unshared data size */ 274992f48a0Sblueswir1 abi_long ru_isrss; /* integral unshared stack size */ 275992f48a0Sblueswir1 abi_long ru_minflt; /* page reclaims */ 276992f48a0Sblueswir1 abi_long ru_majflt; /* page faults */ 277992f48a0Sblueswir1 abi_long ru_nswap; /* swaps */ 278992f48a0Sblueswir1 abi_long ru_inblock; /* block input operations */ 279992f48a0Sblueswir1 abi_long ru_oublock; /* block output operations */ 280992f48a0Sblueswir1 abi_long ru_msgsnd; /* messages sent */ 281992f48a0Sblueswir1 abi_long ru_msgrcv; /* messages received */ 282992f48a0Sblueswir1 abi_long ru_nsignals; /* signals received */ 283992f48a0Sblueswir1 abi_long ru_nvcsw; /* voluntary context switches */ 284992f48a0Sblueswir1 abi_long ru_nivcsw; /* involuntary " */ 28531e31b8aSbellard }; 28631e31b8aSbellard 28731e31b8aSbellard typedef struct { 28831e31b8aSbellard int val[2]; 289c227f099SAnthony Liguori } kernel_fsid_t; 29031e31b8aSbellard 29172f03900Sbellard struct kernel_statfs { 29231e31b8aSbellard int f_type; 29331e31b8aSbellard int f_bsize; 29431e31b8aSbellard int f_blocks; 29531e31b8aSbellard int f_bfree; 29631e31b8aSbellard int f_bavail; 29731e31b8aSbellard int f_files; 29831e31b8aSbellard int f_ffree; 299c227f099SAnthony Liguori kernel_fsid_t f_fsid; 30031e31b8aSbellard int f_namelen; 30131e31b8aSbellard int f_spare[6]; 30231e31b8aSbellard }; 30331e31b8aSbellard 304dab2ed99Sbellard struct target_dirent { 305992f48a0Sblueswir1 abi_long d_ino; 306992f48a0Sblueswir1 abi_long d_off; 307dab2ed99Sbellard unsigned short d_reclen; 308333858b7SDmitry V. Levin char d_name[]; 309dab2ed99Sbellard }; 310dab2ed99Sbellard 311dab2ed99Sbellard struct target_dirent64 { 312dab2ed99Sbellard uint64_t d_ino; 313dab2ed99Sbellard int64_t d_off; 314dab2ed99Sbellard unsigned short d_reclen; 315dab2ed99Sbellard unsigned char d_type; 316dab2ed99Sbellard char d_name[256]; 317dab2ed99Sbellard }; 318dab2ed99Sbellard 319dab2ed99Sbellard 32031e31b8aSbellard /* mostly generic signal stuff */ 321992f48a0Sblueswir1 #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ 322992f48a0Sblueswir1 #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ 323992f48a0Sblueswir1 #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ 32431e31b8aSbellard 32531e31b8aSbellard #ifdef TARGET_MIPS 32631e31b8aSbellard #define TARGET_NSIG 128 32731e31b8aSbellard #else 32831e31b8aSbellard #define TARGET_NSIG 64 32931e31b8aSbellard #endif 330992f48a0Sblueswir1 #define TARGET_NSIG_BPW TARGET_ABI_BITS 33131e31b8aSbellard #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) 33231e31b8aSbellard 33331e31b8aSbellard typedef struct { 334992f48a0Sblueswir1 abi_ulong sig[TARGET_NSIG_WORDS]; 335c227f099SAnthony Liguori } target_sigset_t; 33631e31b8aSbellard 33766fb9763Sbellard #ifdef BSWAP_NEEDED 338c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 33966fb9763Sbellard { 34066fb9763Sbellard int i; 34166fb9763Sbellard for(i = 0;i < TARGET_NSIG_WORDS; i++) 342cbb21eedSMatthias Braun d->sig[i] = tswapal(s->sig[i]); 34366fb9763Sbellard } 34466fb9763Sbellard #else 345c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 34666fb9763Sbellard { 34766fb9763Sbellard *d = *s; 34866fb9763Sbellard } 34966fb9763Sbellard #endif 35066fb9763Sbellard 351c227f099SAnthony Liguori static inline void target_siginitset(target_sigset_t *d, abi_ulong set) 35266fb9763Sbellard { 35366fb9763Sbellard int i; 35466fb9763Sbellard d->sig[0] = set; 35566fb9763Sbellard for(i = 1;i < TARGET_NSIG_WORDS; i++) 35666fb9763Sbellard d->sig[i] = 0; 35766fb9763Sbellard } 35866fb9763Sbellard 359c227f099SAnthony Liguori void host_to_target_sigset(target_sigset_t *d, const sigset_t *s); 360c227f099SAnthony Liguori void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); 361992f48a0Sblueswir1 void host_to_target_old_sigset(abi_ulong *old_sigset, 36266fb9763Sbellard const sigset_t *sigset); 36366fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset, 364992f48a0Sblueswir1 const abi_ulong *old_sigset); 36566fb9763Sbellard struct target_sigaction; 36666fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act, 36766fb9763Sbellard struct target_sigaction *oact); 36866fb9763Sbellard 369d2fbca94SGuan Xuetao #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \ 370d2fbca94SGuan Xuetao || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined(TARGET_SH4) \ 371d2fbca94SGuan Xuetao || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) \ 372a4c075f1SUlrich Hecht || defined(TARGET_MICROBLAZE) || defined(TARGET_UNICORE32) \ 373b16189b2SChen Gang || defined(TARGET_S390X) || defined(TARGET_OPENRISC) \ 374b16189b2SChen Gang || defined(TARGET_TILEGX) 3752521d698Sbellard 376048f6b4dSbellard #if defined(TARGET_SPARC) 377048f6b4dSbellard #define TARGET_SA_NOCLDSTOP 8u 378048f6b4dSbellard #define TARGET_SA_NOCLDWAIT 0x100u 379048f6b4dSbellard #define TARGET_SA_SIGINFO 0x200u 380048f6b4dSbellard #define TARGET_SA_ONSTACK 1u 381048f6b4dSbellard #define TARGET_SA_RESTART 2u 382048f6b4dSbellard #define TARGET_SA_NODEFER 0x20u 383048f6b4dSbellard #define TARGET_SA_RESETHAND 4u 384048f6b4dSbellard #elif defined(TARGET_MIPS) 385048f6b4dSbellard #define TARGET_SA_NOCLDSTOP 0x00000001 386048f6b4dSbellard #define TARGET_SA_NOCLDWAIT 0x00010000 387048f6b4dSbellard #define TARGET_SA_SIGINFO 0x00000008 388048f6b4dSbellard #define TARGET_SA_ONSTACK 0x08000000 389048f6b4dSbellard #define TARGET_SA_NODEFER 0x40000000 390048f6b4dSbellard #define TARGET_SA_RESTART 0x10000000 391048f6b4dSbellard #define TARGET_SA_RESETHAND 0x80000000 392d26bc211Sths #if !defined(TARGET_ABI_MIPSN32) && !defined(TARGET_ABI_MIPSN64) 393d26bc211Sths #define TARGET_SA_RESTORER 0x04000000 /* Only for O32 */ 394540635baSths #endif 395d962783eSJia Liu #elif defined(TARGET_OPENRISC) 396d962783eSJia Liu #define TARGET_SA_NOCLDSTOP 0x00000001 397d962783eSJia Liu #define TARGET_SA_NOCLDWAIT 0x00000002 398d962783eSJia Liu #define TARGET_SA_SIGINFO 0x00000004 399d962783eSJia Liu #define TARGET_SA_ONSTACK 0x08000000 400d962783eSJia Liu #define TARGET_SA_RESTART 0x10000000 401d962783eSJia Liu #define TARGET_SA_NODEFER 0x40000000 402d962783eSJia Liu #define TARGET_SA_RESETHAND 0x80000000 40357f18a95SRichard Henderson #elif defined(TARGET_ALPHA) 40457f18a95SRichard Henderson #define TARGET_SA_ONSTACK 0x00000001 40557f18a95SRichard Henderson #define TARGET_SA_RESTART 0x00000002 40657f18a95SRichard Henderson #define TARGET_SA_NOCLDSTOP 0x00000004 40757f18a95SRichard Henderson #define TARGET_SA_NODEFER 0x00000008 40857f18a95SRichard Henderson #define TARGET_SA_RESETHAND 0x00000010 40957f18a95SRichard Henderson #define TARGET_SA_NOCLDWAIT 0x00000020 /* not supported yet */ 41057f18a95SRichard Henderson #define TARGET_SA_SIGINFO 0x00000040 411048f6b4dSbellard #else 4122521d698Sbellard #define TARGET_SA_NOCLDSTOP 0x00000001 4132521d698Sbellard #define TARGET_SA_NOCLDWAIT 0x00000002 /* not supported yet */ 4142521d698Sbellard #define TARGET_SA_SIGINFO 0x00000004 4152521d698Sbellard #define TARGET_SA_ONSTACK 0x08000000 4162521d698Sbellard #define TARGET_SA_RESTART 0x10000000 4172521d698Sbellard #define TARGET_SA_NODEFER 0x40000000 4182521d698Sbellard #define TARGET_SA_RESETHAND 0x80000000 4192521d698Sbellard #define TARGET_SA_RESTORER 0x04000000 4206d5e216dSbellard #endif 4216d5e216dSbellard 422d0f20495SRichard Henderson #if defined(TARGET_ALPHA) 423d0f20495SRichard Henderson 424d0f20495SRichard Henderson #define TARGET_SIGHUP 1 425d0f20495SRichard Henderson #define TARGET_SIGINT 2 426d0f20495SRichard Henderson #define TARGET_SIGQUIT 3 427d0f20495SRichard Henderson #define TARGET_SIGILL 4 428d0f20495SRichard Henderson #define TARGET_SIGTRAP 5 429d0f20495SRichard Henderson #define TARGET_SIGABRT 6 430d0f20495SRichard Henderson #define TARGET_SIGSTKFLT 7 /* actually SIGEMT */ 431d0f20495SRichard Henderson #define TARGET_SIGFPE 8 432d0f20495SRichard Henderson #define TARGET_SIGKILL 9 433d0f20495SRichard Henderson #define TARGET_SIGBUS 10 434d0f20495SRichard Henderson #define TARGET_SIGSEGV 11 435d0f20495SRichard Henderson #define TARGET_SIGSYS 12 436d0f20495SRichard Henderson #define TARGET_SIGPIPE 13 437d0f20495SRichard Henderson #define TARGET_SIGALRM 14 438d0f20495SRichard Henderson #define TARGET_SIGTERM 15 439d0f20495SRichard Henderson #define TARGET_SIGURG 16 440d0f20495SRichard Henderson #define TARGET_SIGSTOP 17 441d0f20495SRichard Henderson #define TARGET_SIGTSTP 18 442d0f20495SRichard Henderson #define TARGET_SIGCONT 19 443d0f20495SRichard Henderson #define TARGET_SIGCHLD 20 444d0f20495SRichard Henderson #define TARGET_SIGTTIN 21 445d0f20495SRichard Henderson #define TARGET_SIGTTOU 22 446d0f20495SRichard Henderson #define TARGET_SIGIO 23 447d0f20495SRichard Henderson #define TARGET_SIGXCPU 24 448d0f20495SRichard Henderson #define TARGET_SIGXFSZ 25 449d0f20495SRichard Henderson #define TARGET_SIGVTALRM 26 450d0f20495SRichard Henderson #define TARGET_SIGPROF 27 451d0f20495SRichard Henderson #define TARGET_SIGWINCH 28 452d0f20495SRichard Henderson #define TARGET_SIGPWR 29 /* actually SIGINFO */ 453d0f20495SRichard Henderson #define TARGET_SIGUSR1 30 454d0f20495SRichard Henderson #define TARGET_SIGUSR2 31 455d0f20495SRichard Henderson #define TARGET_SIGRTMIN 32 456d0f20495SRichard Henderson 457d0f20495SRichard Henderson #define TARGET_SIG_BLOCK 1 458d0f20495SRichard Henderson #define TARGET_SIG_UNBLOCK 2 459d0f20495SRichard Henderson #define TARGET_SIG_SETMASK 3 460d0f20495SRichard Henderson 461d0f20495SRichard Henderson #elif defined(TARGET_SPARC) 4626d5e216dSbellard 4636d5e216dSbellard #define TARGET_SIGHUP 1 4646d5e216dSbellard #define TARGET_SIGINT 2 4656d5e216dSbellard #define TARGET_SIGQUIT 3 4666d5e216dSbellard #define TARGET_SIGILL 4 4676d5e216dSbellard #define TARGET_SIGTRAP 5 4686d5e216dSbellard #define TARGET_SIGABRT 6 4696d5e216dSbellard #define TARGET_SIGIOT 6 4706d5e216dSbellard #define TARGET_SIGSTKFLT 7 /* actually EMT */ 4716d5e216dSbellard #define TARGET_SIGFPE 8 4726d5e216dSbellard #define TARGET_SIGKILL 9 4736d5e216dSbellard #define TARGET_SIGBUS 10 4746d5e216dSbellard #define TARGET_SIGSEGV 11 4756d5e216dSbellard #define TARGET_SIGSYS 12 4766d5e216dSbellard #define TARGET_SIGPIPE 13 4776d5e216dSbellard #define TARGET_SIGALRM 14 4786d5e216dSbellard #define TARGET_SIGTERM 15 4796d5e216dSbellard #define TARGET_SIGURG 16 4806d5e216dSbellard #define TARGET_SIGSTOP 17 4816d5e216dSbellard #define TARGET_SIGTSTP 18 4826d5e216dSbellard #define TARGET_SIGCONT 19 4836d5e216dSbellard #define TARGET_SIGCHLD 20 4846d5e216dSbellard #define TARGET_SIGTTIN 21 4856d5e216dSbellard #define TARGET_SIGTTOU 22 4866d5e216dSbellard #define TARGET_SIGIO 23 4876d5e216dSbellard #define TARGET_SIGXCPU 24 4886d5e216dSbellard #define TARGET_SIGXFSZ 25 4896d5e216dSbellard #define TARGET_SIGVTALRM 26 4906d5e216dSbellard #define TARGET_SIGPROF 27 4916d5e216dSbellard #define TARGET_SIGWINCH 28 4926d5e216dSbellard #define TARGET_SIGPWR 29 4936d5e216dSbellard #define TARGET_SIGUSR1 30 4946d5e216dSbellard #define TARGET_SIGUSR2 31 4956d5e216dSbellard #define TARGET_SIGRTMIN 32 4966d5e216dSbellard 4976d5e216dSbellard #define TARGET_SIG_BLOCK 0x01 /* for blocking signals */ 4986d5e216dSbellard #define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */ 4996d5e216dSbellard #define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */ 5006d5e216dSbellard 501048f6b4dSbellard #elif defined(TARGET_MIPS) 502048f6b4dSbellard 503048f6b4dSbellard #define TARGET_SIGHUP 1 /* Hangup (POSIX). */ 504048f6b4dSbellard #define TARGET_SIGINT 2 /* Interrupt (ANSI). */ 505048f6b4dSbellard #define TARGET_SIGQUIT 3 /* Quit (POSIX). */ 506048f6b4dSbellard #define TARGET_SIGILL 4 /* Illegal instruction (ANSI). */ 507048f6b4dSbellard #define TARGET_SIGTRAP 5 /* Trace trap (POSIX). */ 508048f6b4dSbellard #define TARGET_SIGIOT 6 /* IOT trap (4.2 BSD). */ 509048f6b4dSbellard #define TARGET_SIGABRT TARGET_SIGIOT /* Abort (ANSI). */ 510048f6b4dSbellard #define TARGET_SIGEMT 7 511048f6b4dSbellard #define TARGET_SIGSTKFLT 7 /* XXX: incorrect */ 512048f6b4dSbellard #define TARGET_SIGFPE 8 /* Floating-point exception (ANSI). */ 513048f6b4dSbellard #define TARGET_SIGKILL 9 /* Kill, unblockable (POSIX). */ 514048f6b4dSbellard #define TARGET_SIGBUS 10 /* BUS error (4.2 BSD). */ 515048f6b4dSbellard #define TARGET_SIGSEGV 11 /* Segmentation violation (ANSI). */ 516048f6b4dSbellard #define TARGET_SIGSYS 12 517048f6b4dSbellard #define TARGET_SIGPIPE 13 /* Broken pipe (POSIX). */ 518048f6b4dSbellard #define TARGET_SIGALRM 14 /* Alarm clock (POSIX). */ 519048f6b4dSbellard #define TARGET_SIGTERM 15 /* Termination (ANSI). */ 520048f6b4dSbellard #define TARGET_SIGUSR1 16 /* User-defined signal 1 (POSIX). */ 521048f6b4dSbellard #define TARGET_SIGUSR2 17 /* User-defined signal 2 (POSIX). */ 522048f6b4dSbellard #define TARGET_SIGCHLD 18 /* Child status has changed (POSIX). */ 523048f6b4dSbellard #define TARGET_SIGCLD TARGET_SIGCHLD /* Same as TARGET_SIGCHLD (System V). */ 524048f6b4dSbellard #define TARGET_SIGPWR 19 /* Power failure restart (System V). */ 525048f6b4dSbellard #define TARGET_SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */ 526048f6b4dSbellard #define TARGET_SIGURG 21 /* Urgent condition on socket (4.2 BSD). */ 527048f6b4dSbellard #define TARGET_SIGIO 22 /* I/O now possible (4.2 BSD). */ 528048f6b4dSbellard #define TARGET_SIGPOLL TARGET_SIGIO /* Pollable event occurred (System V). */ 529048f6b4dSbellard #define TARGET_SIGSTOP 23 /* Stop, unblockable (POSIX). */ 530048f6b4dSbellard #define TARGET_SIGTSTP 24 /* Keyboard stop (POSIX). */ 531048f6b4dSbellard #define TARGET_SIGCONT 25 /* Continue (POSIX). */ 532048f6b4dSbellard #define TARGET_SIGTTIN 26 /* Background read from tty (POSIX). */ 533048f6b4dSbellard #define TARGET_SIGTTOU 27 /* Background write to tty (POSIX). */ 534048f6b4dSbellard #define TARGET_SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */ 535048f6b4dSbellard #define TARGET_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */ 536048f6b4dSbellard #define TARGET_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ 537048f6b4dSbellard #define TARGET_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ 538048f6b4dSbellard #define TARGET_SIGRTMIN 32 539048f6b4dSbellard 540048f6b4dSbellard #define TARGET_SIG_BLOCK 1 /* for blocking signals */ 541048f6b4dSbellard #define TARGET_SIG_UNBLOCK 2 /* for unblocking signals */ 542048f6b4dSbellard #define TARGET_SIG_SETMASK 3 /* for setting the signal mask */ 543048f6b4dSbellard 5446d5e216dSbellard #else 5452521d698Sbellard 546d962783eSJia Liu /* OpenRISC Using the general signals */ 5472521d698Sbellard #define TARGET_SIGHUP 1 5482521d698Sbellard #define TARGET_SIGINT 2 5492521d698Sbellard #define TARGET_SIGQUIT 3 5502521d698Sbellard #define TARGET_SIGILL 4 5512521d698Sbellard #define TARGET_SIGTRAP 5 5522521d698Sbellard #define TARGET_SIGABRT 6 5532521d698Sbellard #define TARGET_SIGIOT 6 5542521d698Sbellard #define TARGET_SIGBUS 7 5552521d698Sbellard #define TARGET_SIGFPE 8 5562521d698Sbellard #define TARGET_SIGKILL 9 5572521d698Sbellard #define TARGET_SIGUSR1 10 5582521d698Sbellard #define TARGET_SIGSEGV 11 5592521d698Sbellard #define TARGET_SIGUSR2 12 5602521d698Sbellard #define TARGET_SIGPIPE 13 5612521d698Sbellard #define TARGET_SIGALRM 14 5622521d698Sbellard #define TARGET_SIGTERM 15 5632521d698Sbellard #define TARGET_SIGSTKFLT 16 5642521d698Sbellard #define TARGET_SIGCHLD 17 5652521d698Sbellard #define TARGET_SIGCONT 18 5662521d698Sbellard #define TARGET_SIGSTOP 19 5672521d698Sbellard #define TARGET_SIGTSTP 20 5682521d698Sbellard #define TARGET_SIGTTIN 21 5692521d698Sbellard #define TARGET_SIGTTOU 22 5702521d698Sbellard #define TARGET_SIGURG 23 5712521d698Sbellard #define TARGET_SIGXCPU 24 5722521d698Sbellard #define TARGET_SIGXFSZ 25 5732521d698Sbellard #define TARGET_SIGVTALRM 26 5742521d698Sbellard #define TARGET_SIGPROF 27 5752521d698Sbellard #define TARGET_SIGWINCH 28 5762521d698Sbellard #define TARGET_SIGIO 29 577c596ed17Sbellard #define TARGET_SIGPWR 30 578c596ed17Sbellard #define TARGET_SIGSYS 31 5792521d698Sbellard #define TARGET_SIGRTMIN 32 5802521d698Sbellard 5812521d698Sbellard #define TARGET_SIG_BLOCK 0 /* for blocking signals */ 5822521d698Sbellard #define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */ 5832521d698Sbellard #define TARGET_SIG_SETMASK 2 /* for setting the signal mask */ 5842521d698Sbellard 5856d5e216dSbellard #endif 5866d5e216dSbellard 5876049f4f8SRichard Henderson #if defined(TARGET_ALPHA) 5886049f4f8SRichard Henderson struct target_old_sigaction { 5896049f4f8SRichard Henderson abi_ulong _sa_handler; 5906049f4f8SRichard Henderson abi_ulong sa_mask; 591d2565875SRichard Henderson int32_t sa_flags; 5926049f4f8SRichard Henderson }; 593106ec879Sbellard 5946049f4f8SRichard Henderson struct target_rt_sigaction { 5956049f4f8SRichard Henderson abi_ulong _sa_handler; 5966049f4f8SRichard Henderson abi_ulong sa_flags; 5976049f4f8SRichard Henderson target_sigset_t sa_mask; 5986049f4f8SRichard Henderson }; 5996049f4f8SRichard Henderson 6006049f4f8SRichard Henderson /* This is the struct used inside the kernel. The ka_restorer 6016049f4f8SRichard Henderson field comes from the 5th argument to sys_rt_sigaction. */ 6026049f4f8SRichard Henderson struct target_sigaction { 6036049f4f8SRichard Henderson abi_ulong _sa_handler; 6046049f4f8SRichard Henderson abi_ulong sa_flags; 6056049f4f8SRichard Henderson target_sigset_t sa_mask; 6066049f4f8SRichard Henderson abi_ulong sa_restorer; 6076049f4f8SRichard Henderson }; 6086049f4f8SRichard Henderson #elif defined(TARGET_MIPS) 609106ec879Sbellard struct target_sigaction { 610540635baSths uint32_t sa_flags; 611d26bc211Sths #if defined(TARGET_ABI_MIPSN32) 612540635baSths uint32_t _sa_handler; 613540635baSths #else 614992f48a0Sblueswir1 abi_ulong _sa_handler; 615540635baSths #endif 616c227f099SAnthony Liguori target_sigset_t sa_mask; 617106ec879Sbellard }; 618106ec879Sbellard #else 6192521d698Sbellard struct target_old_sigaction { 620992f48a0Sblueswir1 abi_ulong _sa_handler; 621992f48a0Sblueswir1 abi_ulong sa_mask; 622992f48a0Sblueswir1 abi_ulong sa_flags; 623992f48a0Sblueswir1 abi_ulong sa_restorer; 6242521d698Sbellard }; 6252521d698Sbellard 6262521d698Sbellard struct target_sigaction { 627992f48a0Sblueswir1 abi_ulong _sa_handler; 628992f48a0Sblueswir1 abi_ulong sa_flags; 629992f48a0Sblueswir1 abi_ulong sa_restorer; 630c227f099SAnthony Liguori target_sigset_t sa_mask; 6312521d698Sbellard }; 632106ec879Sbellard #endif 6332521d698Sbellard 6342521d698Sbellard typedef union target_sigval { 6352521d698Sbellard int sival_int; 636992f48a0Sblueswir1 abi_ulong sival_ptr; 637c227f099SAnthony Liguori } target_sigval_t; 6386d5e216dSbellard #if 0 6396d5e216dSbellard #if defined (TARGET_SPARC) 6406d5e216dSbellard typedef struct { 6416d5e216dSbellard struct { 642992f48a0Sblueswir1 abi_ulong psr; 643992f48a0Sblueswir1 abi_ulong pc; 644992f48a0Sblueswir1 abi_ulong npc; 645992f48a0Sblueswir1 abi_ulong y; 646992f48a0Sblueswir1 abi_ulong u_regs[16]; /* globals and ins */ 6476d5e216dSbellard } si_regs; 6486d5e216dSbellard int si_mask; 6496d5e216dSbellard } __siginfo_t; 6506d5e216dSbellard 6516d5e216dSbellard typedef struct { 6526d5e216dSbellard unsigned long si_float_regs [32]; 6536d5e216dSbellard unsigned long si_fsr; 6546d5e216dSbellard unsigned long si_fpqdepth; 6556d5e216dSbellard struct { 6566d5e216dSbellard unsigned long *insn_addr; 6576d5e216dSbellard unsigned long insn; 6586d5e216dSbellard } si_fpqueue [16]; 6596d5e216dSbellard } __siginfo_fpu_t; 6606d5e216dSbellard #endif 6616d5e216dSbellard #endif 6622521d698Sbellard 6632521d698Sbellard #define TARGET_SI_MAX_SIZE 128 664aa5e03d2SMaxim Ostapenko 665aa5e03d2SMaxim Ostapenko #if TARGET_ABI_BITS == 32 666aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int)) 667aa5e03d2SMaxim Ostapenko #else 668aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int)) 669aa5e03d2SMaxim Ostapenko #endif 670aa5e03d2SMaxim Ostapenko 671aa5e03d2SMaxim Ostapenko #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int)) 6722521d698Sbellard 6732521d698Sbellard typedef struct target_siginfo { 6743f53d546Spbrook #ifdef TARGET_MIPS 6753f53d546Spbrook int si_signo; 6763f53d546Spbrook int si_code; 6773f53d546Spbrook int si_errno; 6783f53d546Spbrook #else 6792521d698Sbellard int si_signo; 6802521d698Sbellard int si_errno; 6812521d698Sbellard int si_code; 6823f53d546Spbrook #endif 6832521d698Sbellard 6842521d698Sbellard union { 6852521d698Sbellard int _pad[TARGET_SI_PAD_SIZE]; 6862521d698Sbellard 6872521d698Sbellard /* kill() */ 6882521d698Sbellard struct { 6892521d698Sbellard pid_t _pid; /* sender's pid */ 6902521d698Sbellard uid_t _uid; /* sender's uid */ 6912521d698Sbellard } _kill; 6922521d698Sbellard 6932521d698Sbellard /* POSIX.1b timers */ 6942521d698Sbellard struct { 6952521d698Sbellard unsigned int _timer1; 6962521d698Sbellard unsigned int _timer2; 6972521d698Sbellard } _timer; 6982521d698Sbellard 6992521d698Sbellard /* POSIX.1b signals */ 7002521d698Sbellard struct { 7012521d698Sbellard pid_t _pid; /* sender's pid */ 7022521d698Sbellard uid_t _uid; /* sender's uid */ 703c227f099SAnthony Liguori target_sigval_t _sigval; 7042521d698Sbellard } _rt; 7052521d698Sbellard 7062521d698Sbellard /* SIGCHLD */ 7072521d698Sbellard struct { 7082521d698Sbellard pid_t _pid; /* which child */ 7092521d698Sbellard uid_t _uid; /* sender's uid */ 7102521d698Sbellard int _status; /* exit code */ 711c227f099SAnthony Liguori target_clock_t _utime; 712c227f099SAnthony Liguori target_clock_t _stime; 7132521d698Sbellard } _sigchld; 7142521d698Sbellard 7152521d698Sbellard /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 7162521d698Sbellard struct { 717992f48a0Sblueswir1 abi_ulong _addr; /* faulting insn/memory ref. */ 7182521d698Sbellard } _sigfault; 7192521d698Sbellard 7202521d698Sbellard /* SIGPOLL */ 7212521d698Sbellard struct { 7222521d698Sbellard int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 7232521d698Sbellard int _fd; 7242521d698Sbellard } _sigpoll; 7252521d698Sbellard } _sifields; 726c227f099SAnthony Liguori } target_siginfo_t; 7272521d698Sbellard 7282521d698Sbellard /* 7292521d698Sbellard * si_code values 7302521d698Sbellard * Digital reserves positive values for kernel-generated signals. 7312521d698Sbellard */ 7322521d698Sbellard #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ 7332521d698Sbellard #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 7342521d698Sbellard #define TARGET_SI_QUEUE -1 /* sent by sigqueue */ 7352521d698Sbellard #define TARGET_SI_TIMER -2 /* sent by timer expiration */ 7362521d698Sbellard #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ 7372521d698Sbellard #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ 7382521d698Sbellard #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ 7392521d698Sbellard 7402521d698Sbellard /* 7412521d698Sbellard * SIGILL si_codes 7422521d698Sbellard */ 743ffa65c3bSbellard #define TARGET_ILL_ILLOPC (1) /* illegal opcode */ 7442521d698Sbellard #define TARGET_ILL_ILLOPN (2) /* illegal operand */ 745ffa65c3bSbellard #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ 746ffa65c3bSbellard #define TARGET_ILL_ILLTRP (4) /* illegal trap */ 747ffa65c3bSbellard #define TARGET_ILL_PRVOPC (5) /* privileged opcode */ 748ffa65c3bSbellard #define TARGET_ILL_PRVREG (6) /* privileged register */ 749ffa65c3bSbellard #define TARGET_ILL_COPROC (7) /* coprocessor error */ 750ffa65c3bSbellard #define TARGET_ILL_BADSTK (8) /* internal stack error */ 751de2fdd56SChen Gang #ifdef TARGET_TILEGX 752de2fdd56SChen Gang #define TARGET_ILL_DBLFLT (9) /* double fault */ 753de2fdd56SChen Gang #define TARGET_ILL_HARDWALL (10) /* user networks hardwall violation */ 754de2fdd56SChen Gang #endif 7552521d698Sbellard 7562521d698Sbellard /* 7572521d698Sbellard * SIGFPE si_codes 7582521d698Sbellard */ 7592521d698Sbellard #define TARGET_FPE_INTDIV (1) /* integer divide by zero */ 7602521d698Sbellard #define TARGET_FPE_INTOVF (2) /* integer overflow */ 7612521d698Sbellard #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ 7622521d698Sbellard #define TARGET_FPE_FLTOVF (4) /* floating point overflow */ 7632521d698Sbellard #define TARGET_FPE_FLTUND (5) /* floating point underflow */ 7642521d698Sbellard #define TARGET_FPE_FLTRES (6) /* floating point inexact result */ 7652521d698Sbellard #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ 7662521d698Sbellard #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ 7672521d698Sbellard #define TARGET_NSIGFPE 8 7682521d698Sbellard 7692521d698Sbellard /* 7702521d698Sbellard * SIGSEGV si_codes 7712521d698Sbellard */ 7722521d698Sbellard #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ 7732521d698Sbellard #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ 774de2fdd56SChen Gang #define TARGET_SEGV_BNDERR (3) /* failed address bound checks */ 7752521d698Sbellard 7762521d698Sbellard /* 777ffa65c3bSbellard * SIGBUS si_codes 778ffa65c3bSbellard */ 779ffa65c3bSbellard #define TARGET_BUS_ADRALN (1) /* invalid address alignment */ 780b4916d7bSDong Xu Wang #define TARGET_BUS_ADRERR (2) /* non-existent physical address */ 781ffa65c3bSbellard #define TARGET_BUS_OBJERR (3) /* object specific hardware error */ 782de2fdd56SChen Gang /* hardware memory error consumed on a machine check: action required */ 783de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AR (4) 784de2fdd56SChen Gang /* hardware memory error detected in process but not consumed: action optional*/ 785de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AO (5) 786ffa65c3bSbellard 787ffa65c3bSbellard /* 7882521d698Sbellard * SIGTRAP si_codes 7892521d698Sbellard */ 7902521d698Sbellard #define TARGET_TRAP_BRKPT (1) /* process breakpoint */ 7912521d698Sbellard #define TARGET_TRAP_TRACE (2) /* process trace trap */ 792de2fdd56SChen Gang #define TARGET_TRAP_BRANCH (3) /* process taken branch trap */ 793de2fdd56SChen Gang #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */ 7942521d698Sbellard 7952521d698Sbellard #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */ 7962521d698Sbellard 7979de5e440Sbellard struct target_rlimit { 798992f48a0Sblueswir1 abi_ulong rlim_cur; 799992f48a0Sblueswir1 abi_ulong rlim_max; 8009de5e440Sbellard }; 8019de5e440Sbellard 80281bbe906Stakasi-y@ops.dti.ne.jp #if defined(TARGET_ALPHA) 803e476492eSAurelien Jarno #define TARGET_RLIM_INFINITY 0x7fffffffffffffffull 8046cafd027SMatthias Braun #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32) 80581bbe906Stakasi-y@ops.dti.ne.jp #define TARGET_RLIM_INFINITY 0x7fffffffUL 80681bbe906Stakasi-y@ops.dti.ne.jp #else 80726b746dbSMatthias Braun #define TARGET_RLIM_INFINITY ((abi_ulong)-1) 80881bbe906Stakasi-y@ops.dti.ne.jp #endif 80981bbe906Stakasi-y@ops.dti.ne.jp 810e22b7015SWesley W. Terpstra #if defined(TARGET_MIPS) 811e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 812e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 813e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 814e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 815e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 816e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 7 817e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 8 818e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 5 819e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 9 820e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 6 821e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 822e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 823e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 824e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 825e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 826e22b7015SWesley W. Terpstra #else 827e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 828e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 829e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 830e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 831e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 832e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 5 8336cafd027SMatthias Braun #if defined(TARGET_SPARC) 8346cafd027SMatthias Braun #define TARGET_RLIMIT_NOFILE 6 8356cafd027SMatthias Braun #define TARGET_RLIMIT_NPROC 7 8366cafd027SMatthias Braun #else 837e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 6 838e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 7 8396cafd027SMatthias Braun #endif 840e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 8 841e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 9 842e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 843e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 844e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 845e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 846e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 847e22b7015SWesley W. Terpstra #endif 848e22b7015SWesley W. Terpstra 8499de5e440Sbellard struct target_pollfd { 8509de5e440Sbellard int fd; /* file descriptor */ 8519de5e440Sbellard short events; /* requested events */ 8529de5e440Sbellard short revents; /* returned events */ 8539de5e440Sbellard }; 8549de5e440Sbellard 8558e5a0667Sbellard /* virtual terminal ioctls */ 8560221cfcdSbellard #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ 8570221cfcdSbellard #define TARGET_KDMKTONE 0x4B30 /* generate tone */ 8588e5a0667Sbellard #define TARGET_KDGKBTYPE 0x4b33 859f7680a55SUlrich Hecht #define TARGET_KDSETMODE 0x4b3a 860f7680a55SUlrich Hecht #define TARGET_KDGKBMODE 0x4b44 861f7680a55SUlrich Hecht #define TARGET_KDSKBMODE 0x4b45 8620221cfcdSbellard #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ 8630221cfcdSbellard #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ 864e6fe18fbSCédric VINCENT #define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ 865e6fe18fbSCédric VINCENT #define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ 866e6fe18fbSCédric VINCENT #define TARGET_KDGETLED 0x4B31 /* return current led state */ 867e6fe18fbSCédric VINCENT #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */ 868ca56f5b5SPaul Burton #define TARGET_KDSIGACCEPT 0x4B4E 8698e5a0667Sbellard 8702521d698Sbellard #define TARGET_SIOCATMARK 0x8905 8712521d698Sbellard 87231e31b8aSbellard /* Networking ioctls */ 87331e31b8aSbellard #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ 87431e31b8aSbellard #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ 87531e31b8aSbellard #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ 87631e31b8aSbellard #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ 87731e31b8aSbellard #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ 87831e31b8aSbellard #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ 87931e31b8aSbellard #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ 88031e31b8aSbellard #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ 88131e31b8aSbellard #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ 88231e31b8aSbellard #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ 88331e31b8aSbellard #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ 88431e31b8aSbellard #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ 88531e31b8aSbellard #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ 88631e31b8aSbellard #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ 88731e31b8aSbellard #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ 88831e31b8aSbellard #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ 88931e31b8aSbellard #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ 89031e31b8aSbellard #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ 89131e31b8aSbellard #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ 89231e31b8aSbellard #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ 89331e31b8aSbellard #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ 89431e31b8aSbellard #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ 89531e31b8aSbellard #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ 89631e31b8aSbellard #define TARGET_SIOCSIFENCAP 0x8926 89731e31b8aSbellard #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ 89831e31b8aSbellard #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ 89931e31b8aSbellard #define TARGET_SIOCSIFSLAVE 0x8930 90031e31b8aSbellard #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ 90131e31b8aSbellard #define TARGET_SIOCDELMULTI 0x8932 902f63eb01aSPaul Burton #define TARGET_SIOCGIFINDEX 0x8933 90331e31b8aSbellard 90431e31b8aSbellard /* Bridging control calls */ 90531e31b8aSbellard #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ 90631e31b8aSbellard #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ 90731e31b8aSbellard 90831e31b8aSbellard #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ 90931e31b8aSbellard #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ 91031e31b8aSbellard 91131e31b8aSbellard /* ARP cache control calls. */ 91231e31b8aSbellard #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ 91331e31b8aSbellard #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ 91431e31b8aSbellard #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ 91531e31b8aSbellard #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ 91631e31b8aSbellard #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ 91731e31b8aSbellard #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ 91831e31b8aSbellard 91931e31b8aSbellard /* RARP cache control calls. */ 92031e31b8aSbellard #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ 92131e31b8aSbellard #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ 92231e31b8aSbellard #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ 92331e31b8aSbellard 92431e31b8aSbellard /* Driver configuration calls */ 92531e31b8aSbellard #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ 92631e31b8aSbellard #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ 92731e31b8aSbellard 92831e31b8aSbellard /* DLCI configuration calls */ 92931e31b8aSbellard #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ 93031e31b8aSbellard #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ 93131e31b8aSbellard 93286fcd946SLaurent Vivier /* From <linux/wireless.h> */ 93386fcd946SLaurent Vivier 93486fcd946SLaurent Vivier #define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ 93531e31b8aSbellard 93631e31b8aSbellard /* From <linux/fs.h> */ 93731e31b8aSbellard 93831e31b8aSbellard #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ 93931e31b8aSbellard #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ 94031e31b8aSbellard #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ 94131e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ 94231e31b8aSbellard #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ 94331e31b8aSbellard #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ 94431e31b8aSbellard #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ 94531e31b8aSbellard #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ 94631e31b8aSbellard #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ 94731e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ 94831e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ 94931e31b8aSbellard #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ 950fff8c539SAndreas Färber #define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */ 95131e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */ 952c8b0bf54SPeter Maydell #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong) 953c8b0bf54SPeter Maydell #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong) 954edafea13SAlexander Graf #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) 955edafea13SAlexander Graf /* return device size in bytes 956edafea13SAlexander Graf (u64 *arg) */ 95731e31b8aSbellard #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ 95831e31b8aSbellard #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ 959285da2b9SPeter Maydell #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) 96031e31b8aSbellard 96131e31b8aSbellard /* cdrom commands */ 96231e31b8aSbellard #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ 96331e31b8aSbellard #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ 96431e31b8aSbellard #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ 96531e31b8aSbellard #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index 96631e31b8aSbellard (struct cdrom_ti) */ 96731e31b8aSbellard #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header 96831e31b8aSbellard (struct cdrom_tochdr) */ 96931e31b8aSbellard #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry 97031e31b8aSbellard (struct cdrom_tocentry) */ 97131e31b8aSbellard #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ 97231e31b8aSbellard #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ 97331e31b8aSbellard #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ 97431e31b8aSbellard #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume 97531e31b8aSbellard (struct cdrom_volctrl) */ 97631e31b8aSbellard #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data 97731e31b8aSbellard (struct cdrom_subchnl) */ 97831e31b8aSbellard #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) 97931e31b8aSbellard (struct cdrom_read) */ 98031e31b8aSbellard #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) 98131e31b8aSbellard (struct cdrom_read) */ 98231e31b8aSbellard #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ 98331e31b8aSbellard #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ 98431e31b8aSbellard #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session 98531e31b8aSbellard address of multi session disks 98631e31b8aSbellard (struct cdrom_multisession) */ 98731e31b8aSbellard #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" 98831e31b8aSbellard if available (struct cdrom_mcn) */ 98967cc32ebSVeres Lajos #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is deprecated, 990b4916d7bSDong Xu Wang but here anyway for compatibility */ 99131e31b8aSbellard #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ 99231e31b8aSbellard #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting 99331e31b8aSbellard (struct cdrom_volctrl) */ 99431e31b8aSbellard #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) 99531e31b8aSbellard (struct cdrom_read) */ 99631e31b8aSbellard /* 99731e31b8aSbellard * These ioctls are used only used in aztcd.c and optcd.c 99831e31b8aSbellard */ 99931e31b8aSbellard #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ 100031e31b8aSbellard #define TARGET_CDROMSEEK 0x5316 /* seek msf address */ 100131e31b8aSbellard 100231e31b8aSbellard /* 100331e31b8aSbellard * This ioctl is only used by the scsi-cd driver. 100431e31b8aSbellard It is for playing audio in logical block addressing mode. 100531e31b8aSbellard */ 100631e31b8aSbellard #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ 100731e31b8aSbellard 100831e31b8aSbellard /* 100931e31b8aSbellard * These ioctls are only used in optcd.c 101031e31b8aSbellard */ 101131e31b8aSbellard #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ 101231e31b8aSbellard 101331e31b8aSbellard /* 101431e31b8aSbellard * These ioctls are (now) only in ide-cd.c for controlling 101531e31b8aSbellard * drive spindown time. They should be implemented in the 101631e31b8aSbellard * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, 101731e31b8aSbellard * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... 101831e31b8aSbellard * -Erik 101931e31b8aSbellard */ 102031e31b8aSbellard #define TARGET_CDROMGETSPINDOWN 0x531d 102131e31b8aSbellard #define TARGET_CDROMSETSPINDOWN 0x531e 102231e31b8aSbellard 102331e31b8aSbellard /* 102431e31b8aSbellard * These ioctls are implemented through the uniform CD-ROM driver 102531e31b8aSbellard * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM 102631e31b8aSbellard * drivers are eventually ported to the uniform CD-ROM driver interface. 102731e31b8aSbellard */ 102831e31b8aSbellard #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ 102931e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ 103031e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ 103131e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ 103231e31b8aSbellard #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ 103331e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ 103431e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ 103531e31b8aSbellard #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ 103631e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ 103731e31b8aSbellard #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ 103831e31b8aSbellard #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ 103931e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ 104031e31b8aSbellard 104131e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. 104231e31b8aSbellard * Future CDROM ioctls should be kept below 0x537F 104331e31b8aSbellard */ 104431e31b8aSbellard 104531e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */ 104631e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ 104731e31b8aSbellard /* conflict with SCSI_IOCTL_GET_IDLUN */ 104831e31b8aSbellard 104931e31b8aSbellard /* DVD-ROM Specific ioctls */ 105031e31b8aSbellard #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ 105131e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ 105231e31b8aSbellard #define TARGET_DVD_AUTH 0x5392 /* Authentication */ 105331e31b8aSbellard 105431e31b8aSbellard #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ 105531e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ 105631e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ 105731e31b8aSbellard 105831e31b8aSbellard /* HD commands */ 105931e31b8aSbellard 106031e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ 106131e31b8aSbellard #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ 106231e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ 106331e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ 106431e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ 106531e31b8aSbellard #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ 106631e31b8aSbellard #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ 106731e31b8aSbellard #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ 10682521d698Sbellard #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ 106931e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ 107031e31b8aSbellard 107131e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ 107231e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ 107331e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ 107431e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ 107531e31b8aSbellard #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ 107631e31b8aSbellard #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ 107731e31b8aSbellard #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ 107831e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ 10792521d698Sbellard 1080b8005914Sbalrog /* loop ioctls */ 1081b8005914Sbalrog #define TARGET_LOOP_SET_FD 0x4C00 1082b8005914Sbalrog #define TARGET_LOOP_CLR_FD 0x4C01 1083b8005914Sbalrog #define TARGET_LOOP_SET_STATUS 0x4C02 1084b8005914Sbalrog #define TARGET_LOOP_GET_STATUS 0x4C03 1085b8005914Sbalrog #define TARGET_LOOP_SET_STATUS64 0x4C04 1086b8005914Sbalrog #define TARGET_LOOP_GET_STATUS64 0x4C05 1087b8005914Sbalrog #define TARGET_LOOP_CHANGE_FD 0x4C06 10882521d698Sbellard 1089f7680a55SUlrich Hecht /* fb ioctls */ 1090f7680a55SUlrich Hecht #define TARGET_FBIOGET_VSCREENINFO 0x4600 1091f7680a55SUlrich Hecht #define TARGET_FBIOPUT_VSCREENINFO 0x4601 1092f7680a55SUlrich Hecht #define TARGET_FBIOGET_FSCREENINFO 0x4602 109312b81b71SCédric VINCENT #define TARGET_FBIOGETCMAP 0x4604 109412b81b71SCédric VINCENT #define TARGET_FBIOPUTCMAP 0x4605 109512b81b71SCédric VINCENT #define TARGET_FBIOPAN_DISPLAY 0x4606 109612b81b71SCédric VINCENT #define TARGET_FBIOGET_CON2FBMAP 0x460F 109712b81b71SCédric VINCENT #define TARGET_FBIOPUT_CON2FBMAP 0x4610 1098f7680a55SUlrich Hecht 1099f7680a55SUlrich Hecht /* vt ioctls */ 1100f7680a55SUlrich Hecht #define TARGET_VT_OPENQRY 0x5600 1101f7680a55SUlrich Hecht #define TARGET_VT_GETSTATE 0x5603 1102f7680a55SUlrich Hecht #define TARGET_VT_ACTIVATE 0x5606 1103f7680a55SUlrich Hecht #define TARGET_VT_WAITACTIVE 0x5607 1104f7680a55SUlrich Hecht #define TARGET_VT_LOCKSWITCH 0x560b 1105f7680a55SUlrich Hecht #define TARGET_VT_UNLOCKSWITCH 0x560c 1106774750c0SCédric VINCENT #define TARGET_VT_GETMODE 0x5601 1107774750c0SCédric VINCENT #define TARGET_VT_SETMODE 0x5602 1108774750c0SCédric VINCENT #define TARGET_VT_RELDISP 0x5605 1109774750c0SCédric VINCENT #define TARGET_VT_DISALLOCATE 0x5608 1110f7680a55SUlrich Hecht 111156e904ecSAlexander Graf /* device mapper */ 111256e904ecSAlexander Graf #define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00) 111356e904ecSAlexander Graf #define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01) 111456e904ecSAlexander Graf #define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02) 111556e904ecSAlexander Graf #define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03) 111656e904ecSAlexander Graf #define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04) 111756e904ecSAlexander Graf #define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05) 111856e904ecSAlexander Graf #define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06) 111956e904ecSAlexander Graf #define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07) 112056e904ecSAlexander Graf #define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08) 112156e904ecSAlexander Graf #define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09) 112256e904ecSAlexander Graf #define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a) 112356e904ecSAlexander Graf #define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b) 112456e904ecSAlexander Graf #define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c) 112556e904ecSAlexander Graf #define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d) 112656e904ecSAlexander Graf #define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e) 112756e904ecSAlexander Graf #define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f) 112856e904ecSAlexander Graf 11292521d698Sbellard /* from asm/termbits.h */ 11302521d698Sbellard 11313bfd9da1Sbellard #define TARGET_NCC 8 11323bfd9da1Sbellard struct target_termio { 11333bfd9da1Sbellard unsigned short c_iflag; /* input mode flags */ 11343bfd9da1Sbellard unsigned short c_oflag; /* output mode flags */ 11353bfd9da1Sbellard unsigned short c_cflag; /* control mode flags */ 11363bfd9da1Sbellard unsigned short c_lflag; /* local mode flags */ 11372521d698Sbellard unsigned char c_line; /* line discipline */ 11383bfd9da1Sbellard unsigned char c_cc[TARGET_NCC]; /* control characters */ 11392521d698Sbellard }; 11402521d698Sbellard 11413bfd9da1Sbellard struct target_winsize { 11423bfd9da1Sbellard unsigned short ws_row; 11433bfd9da1Sbellard unsigned short ws_col; 11443bfd9da1Sbellard unsigned short ws_xpixel; 11453bfd9da1Sbellard unsigned short ws_ypixel; 11463bfd9da1Sbellard }; 11472521d698Sbellard 11483bfd9da1Sbellard #include "termbits.h" 11492521d698Sbellard 11509e0b74a4SPaul Brook #if defined(TARGET_MIPS) 11519e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x10 11529e0b74a4SPaul Brook #else 11539e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x08 11549e0b74a4SPaul Brook #endif 11559e0b74a4SPaul Brook 1156e44a3e79Saurel32 /* Common */ 11572521d698Sbellard #define TARGET_MAP_SHARED 0x01 /* Share changes */ 11582521d698Sbellard #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ 11592521d698Sbellard #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ 1160e44a3e79Saurel32 1161e44a3e79Saurel32 /* Target specific */ 1162048f6b4dSbellard #if defined(TARGET_MIPS) 1163e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1164048f6b4dSbellard #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 1165048f6b4dSbellard #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 1166048f6b4dSbellard #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 1167048f6b4dSbellard #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 1168048f6b4dSbellard #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 1169048f6b4dSbellard #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 1170540635baSths #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 1171540635baSths #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1172e44a3e79Saurel32 #elif defined(TARGET_PPC) 1173e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 11742521d698Sbellard #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 11752521d698Sbellard #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 11762521d698Sbellard #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 11772521d698Sbellard #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 11787ec93196Sj_mayer #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ 11797ec93196Sj_mayer #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ 1180e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1181e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1182e44a3e79Saurel32 #elif defined(TARGET_ALPHA) 1183e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1184e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ 1185e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ 1186e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ 1187e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ 1188e44a3e79Saurel32 #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ 1189e44a3e79Saurel32 #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ 1190e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ 1191e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ 11927ec93196Sj_mayer #else 1193e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1194e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 1195e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 1196e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 1197e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 11982521d698Sbellard #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ 11992521d698Sbellard #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ 1200540635baSths #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1201540635baSths #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1202906c1b8eSMike Frysinger #define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ 12037ec93196Sj_mayer #endif 12042521d698Sbellard 120509701199SAlexander Graf #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 120609701199SAlexander Graf || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 1207c7819dfbSPeter Maydell || defined(TARGET_CRIS) || defined(TARGET_UNICORE32) 12082521d698Sbellard struct target_stat { 12092521d698Sbellard unsigned short st_dev; 12102521d698Sbellard unsigned short __pad1; 1211992f48a0Sblueswir1 abi_ulong st_ino; 12122521d698Sbellard unsigned short st_mode; 12132521d698Sbellard unsigned short st_nlink; 12142521d698Sbellard unsigned short st_uid; 12152521d698Sbellard unsigned short st_gid; 12162521d698Sbellard unsigned short st_rdev; 12172521d698Sbellard unsigned short __pad2; 1218992f48a0Sblueswir1 abi_ulong st_size; 1219992f48a0Sblueswir1 abi_ulong st_blksize; 1220992f48a0Sblueswir1 abi_ulong st_blocks; 1221992f48a0Sblueswir1 abi_ulong target_st_atime; 1222992f48a0Sblueswir1 abi_ulong __unused1; 1223992f48a0Sblueswir1 abi_ulong target_st_mtime; 1224992f48a0Sblueswir1 abi_ulong __unused2; 1225992f48a0Sblueswir1 abi_ulong target_st_ctime; 1226992f48a0Sblueswir1 abi_ulong __unused3; 1227992f48a0Sblueswir1 abi_ulong __unused4; 1228992f48a0Sblueswir1 abi_ulong __unused5; 12292521d698Sbellard }; 12302521d698Sbellard 12312521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely 12322521d698Sbellard * insane amounts of padding around dev_t's. 12332521d698Sbellard */ 123420d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 12352521d698Sbellard struct target_stat64 { 12362521d698Sbellard unsigned short st_dev; 12372521d698Sbellard unsigned char __pad0[10]; 12382521d698Sbellard 12392521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1240992f48a0Sblueswir1 abi_ulong __st_ino; 12412521d698Sbellard 12422521d698Sbellard unsigned int st_mode; 12432521d698Sbellard unsigned int st_nlink; 12442521d698Sbellard 1245992f48a0Sblueswir1 abi_ulong st_uid; 1246992f48a0Sblueswir1 abi_ulong st_gid; 12472521d698Sbellard 12482521d698Sbellard unsigned short st_rdev; 12492521d698Sbellard unsigned char __pad3[10]; 12502521d698Sbellard 12512521d698Sbellard long long st_size; 1252992f48a0Sblueswir1 abi_ulong st_blksize; 12532521d698Sbellard 1254992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1255992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 12562521d698Sbellard 1257992f48a0Sblueswir1 abi_ulong target_st_atime; 1258992f48a0Sblueswir1 abi_ulong __pad5; 12592521d698Sbellard 1260992f48a0Sblueswir1 abi_ulong target_st_mtime; 1261992f48a0Sblueswir1 abi_ulong __pad6; 12622521d698Sbellard 1263992f48a0Sblueswir1 abi_ulong target_st_ctime; 1264992f48a0Sblueswir1 abi_ulong __pad7; /* will be high 32 bits of ctime someday */ 12652521d698Sbellard 12662521d698Sbellard unsigned long long st_ino; 1267541dc0d4SStefan Weil } QEMU_PACKED; 12682521d698Sbellard 1269ce4defa0Spbrook #ifdef TARGET_ARM 127020d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1271ce4defa0Spbrook struct target_eabi_stat64 { 1272ce4defa0Spbrook unsigned long long st_dev; 1273ce4defa0Spbrook unsigned int __pad1; 1274992f48a0Sblueswir1 abi_ulong __st_ino; 1275ce4defa0Spbrook unsigned int st_mode; 1276ce4defa0Spbrook unsigned int st_nlink; 1277ce4defa0Spbrook 1278992f48a0Sblueswir1 abi_ulong st_uid; 1279992f48a0Sblueswir1 abi_ulong st_gid; 1280ce4defa0Spbrook 1281ce4defa0Spbrook unsigned long long st_rdev; 1282ce4defa0Spbrook unsigned int __pad2[2]; 1283ce4defa0Spbrook 1284ce4defa0Spbrook long long st_size; 1285992f48a0Sblueswir1 abi_ulong st_blksize; 1286ce4defa0Spbrook unsigned int __pad3; 1287ce4defa0Spbrook unsigned long long st_blocks; 1288ce4defa0Spbrook 1289992f48a0Sblueswir1 abi_ulong target_st_atime; 1290992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1291ce4defa0Spbrook 1292992f48a0Sblueswir1 abi_ulong target_st_mtime; 1293992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1294ce4defa0Spbrook 1295992f48a0Sblueswir1 abi_ulong target_st_ctime; 1296992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1297ce4defa0Spbrook 1298ce4defa0Spbrook unsigned long long st_ino; 1299541dc0d4SStefan Weil } QEMU_PACKED; 1300ce4defa0Spbrook #endif 1301ce4defa0Spbrook 1302992f48a0Sblueswir1 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 13031b8dd648Sblueswir1 struct target_stat { 13041b8dd648Sblueswir1 unsigned int st_dev; 1305992f48a0Sblueswir1 abi_ulong st_ino; 13061b8dd648Sblueswir1 unsigned int st_mode; 13071b8dd648Sblueswir1 unsigned int st_nlink; 13081b8dd648Sblueswir1 unsigned int st_uid; 13091b8dd648Sblueswir1 unsigned int st_gid; 13101b8dd648Sblueswir1 unsigned int st_rdev; 1311992f48a0Sblueswir1 abi_long st_size; 1312992f48a0Sblueswir1 abi_long target_st_atime; 1313992f48a0Sblueswir1 abi_long target_st_mtime; 1314992f48a0Sblueswir1 abi_long target_st_ctime; 1315992f48a0Sblueswir1 abi_long st_blksize; 1316992f48a0Sblueswir1 abi_long st_blocks; 1317992f48a0Sblueswir1 abi_ulong __unused4[2]; 13181b8dd648Sblueswir1 }; 13191b8dd648Sblueswir1 132020d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 13211b8dd648Sblueswir1 struct target_stat64 { 13221b8dd648Sblueswir1 unsigned char __pad0[6]; 13231b8dd648Sblueswir1 unsigned short st_dev; 13241b8dd648Sblueswir1 13251b8dd648Sblueswir1 uint64_t st_ino; 13261b8dd648Sblueswir1 uint64_t st_nlink; 13271b8dd648Sblueswir1 13281b8dd648Sblueswir1 unsigned int st_mode; 13291b8dd648Sblueswir1 13301b8dd648Sblueswir1 unsigned int st_uid; 13311b8dd648Sblueswir1 unsigned int st_gid; 13321b8dd648Sblueswir1 13331b8dd648Sblueswir1 unsigned char __pad2[6]; 13341b8dd648Sblueswir1 unsigned short st_rdev; 13351b8dd648Sblueswir1 13361b8dd648Sblueswir1 int64_t st_size; 13371b8dd648Sblueswir1 int64_t st_blksize; 13381b8dd648Sblueswir1 13391b8dd648Sblueswir1 unsigned char __pad4[4]; 13401b8dd648Sblueswir1 unsigned int st_blocks; 13411b8dd648Sblueswir1 1342992f48a0Sblueswir1 abi_ulong target_st_atime; 1343992f48a0Sblueswir1 abi_ulong __unused1; 13441b8dd648Sblueswir1 1345992f48a0Sblueswir1 abi_ulong target_st_mtime; 1346992f48a0Sblueswir1 abi_ulong __unused2; 13471b8dd648Sblueswir1 1348992f48a0Sblueswir1 abi_ulong target_st_ctime; 1349992f48a0Sblueswir1 abi_ulong __unused3; 13501b8dd648Sblueswir1 1351992f48a0Sblueswir1 abi_ulong __unused4[3]; 13521b8dd648Sblueswir1 }; 13531b8dd648Sblueswir1 13543bfd9da1Sbellard #elif defined(TARGET_SPARC) 13553bfd9da1Sbellard 13563bfd9da1Sbellard struct target_stat { 13573bfd9da1Sbellard unsigned short st_dev; 1358992f48a0Sblueswir1 abi_ulong st_ino; 13593bfd9da1Sbellard unsigned short st_mode; 13603bfd9da1Sbellard short st_nlink; 13613bfd9da1Sbellard unsigned short st_uid; 13623bfd9da1Sbellard unsigned short st_gid; 13633bfd9da1Sbellard unsigned short st_rdev; 1364992f48a0Sblueswir1 abi_long st_size; 1365992f48a0Sblueswir1 abi_long target_st_atime; 1366992f48a0Sblueswir1 abi_ulong __unused1; 1367992f48a0Sblueswir1 abi_long target_st_mtime; 1368992f48a0Sblueswir1 abi_ulong __unused2; 1369992f48a0Sblueswir1 abi_long target_st_ctime; 1370992f48a0Sblueswir1 abi_ulong __unused3; 1371992f48a0Sblueswir1 abi_long st_blksize; 1372992f48a0Sblueswir1 abi_long st_blocks; 1373992f48a0Sblueswir1 abi_ulong __unused4[2]; 13743bfd9da1Sbellard }; 13753bfd9da1Sbellard 137620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 13773bfd9da1Sbellard struct target_stat64 { 13783bfd9da1Sbellard unsigned char __pad0[6]; 13793bfd9da1Sbellard unsigned short st_dev; 13803bfd9da1Sbellard 13813bfd9da1Sbellard uint64_t st_ino; 13823bfd9da1Sbellard 13833bfd9da1Sbellard unsigned int st_mode; 13843bfd9da1Sbellard unsigned int st_nlink; 13853bfd9da1Sbellard 13863bfd9da1Sbellard unsigned int st_uid; 13873bfd9da1Sbellard unsigned int st_gid; 13883bfd9da1Sbellard 13893bfd9da1Sbellard unsigned char __pad2[6]; 13903bfd9da1Sbellard unsigned short st_rdev; 13913bfd9da1Sbellard 13923bfd9da1Sbellard unsigned char __pad3[8]; 13933bfd9da1Sbellard 13943bfd9da1Sbellard int64_t st_size; 13953bfd9da1Sbellard unsigned int st_blksize; 13963bfd9da1Sbellard 13973bfd9da1Sbellard unsigned char __pad4[8]; 13983bfd9da1Sbellard unsigned int st_blocks; 13993bfd9da1Sbellard 14003bfd9da1Sbellard unsigned int target_st_atime; 14013bfd9da1Sbellard unsigned int __unused1; 14023bfd9da1Sbellard 14033bfd9da1Sbellard unsigned int target_st_mtime; 14043bfd9da1Sbellard unsigned int __unused2; 14053bfd9da1Sbellard 14063bfd9da1Sbellard unsigned int target_st_ctime; 14073bfd9da1Sbellard unsigned int __unused3; 14083bfd9da1Sbellard 14093bfd9da1Sbellard unsigned int __unused4; 14103bfd9da1Sbellard unsigned int __unused5; 14113bfd9da1Sbellard }; 14123bfd9da1Sbellard 141367867308Sbellard #elif defined(TARGET_PPC) 141467867308Sbellard 141567867308Sbellard struct target_stat { 1416e32448e0Sj_mayer abi_ulong st_dev; 1417992f48a0Sblueswir1 abi_ulong st_ino; 1418325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1419e32448e0Sj_mayer abi_ulong st_nlink; 1420325e651fSj_mayer unsigned int st_mode; 1421325e651fSj_mayer #else 142267867308Sbellard unsigned int st_mode; 142367867308Sbellard unsigned short st_nlink; 1424325e651fSj_mayer #endif 142567867308Sbellard unsigned int st_uid; 142667867308Sbellard unsigned int st_gid; 1427e32448e0Sj_mayer abi_ulong st_rdev; 1428992f48a0Sblueswir1 abi_ulong st_size; 1429992f48a0Sblueswir1 abi_ulong st_blksize; 1430992f48a0Sblueswir1 abi_ulong st_blocks; 1431992f48a0Sblueswir1 abi_ulong target_st_atime; 1432e32448e0Sj_mayer abi_ulong target_st_atime_nsec; 1433992f48a0Sblueswir1 abi_ulong target_st_mtime; 1434e32448e0Sj_mayer abi_ulong target_st_mtime_nsec; 1435992f48a0Sblueswir1 abi_ulong target_st_ctime; 1436e32448e0Sj_mayer abi_ulong target_st_ctime_nsec; 1437992f48a0Sblueswir1 abi_ulong __unused4; 1438992f48a0Sblueswir1 abi_ulong __unused5; 1439325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1440325e651fSj_mayer abi_ulong __unused6; 1441325e651fSj_mayer #endif 144267867308Sbellard }; 144367867308Sbellard 144420d155bcSStefan Weil #if !defined(TARGET_PPC64) || defined(TARGET_ABI32) 144520d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1446541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 144767867308Sbellard unsigned long long st_dev; 144867867308Sbellard unsigned long long st_ino; 144967867308Sbellard unsigned int st_mode; 145067867308Sbellard unsigned int st_nlink; 145167867308Sbellard unsigned int st_uid; 145267867308Sbellard unsigned int st_gid; 145367867308Sbellard unsigned long long st_rdev; 1454e1ce5e40Saurel32 unsigned long long __pad0; 145567867308Sbellard long long st_size; 1456e32448e0Sj_mayer int st_blksize; 1457e1ce5e40Saurel32 unsigned int __pad1; 145861322e91SMax Filippov long long st_blocks; /* Number 512-byte blocks allocated. */ 1459e32448e0Sj_mayer int target_st_atime; 1460e32448e0Sj_mayer unsigned int target_st_atime_nsec; 1461e32448e0Sj_mayer int target_st_mtime; 1462e32448e0Sj_mayer unsigned int target_st_mtime_nsec; 1463e32448e0Sj_mayer int target_st_ctime; 1464e32448e0Sj_mayer unsigned int target_st_ctime_nsec; 1465e32448e0Sj_mayer unsigned int __unused4; 1466e32448e0Sj_mayer unsigned int __unused5; 146767867308Sbellard }; 146820d155bcSStefan Weil #endif 146967867308Sbellard 1470b779e29eSEdgar E. Iglesias #elif defined(TARGET_MICROBLAZE) 1471b779e29eSEdgar E. Iglesias 1472b779e29eSEdgar E. Iglesias struct target_stat { 1473b779e29eSEdgar E. Iglesias abi_ulong st_dev; 1474b779e29eSEdgar E. Iglesias abi_ulong st_ino; 1475b779e29eSEdgar E. Iglesias unsigned int st_mode; 1476b779e29eSEdgar E. Iglesias unsigned short st_nlink; 1477b779e29eSEdgar E. Iglesias unsigned int st_uid; 1478b779e29eSEdgar E. Iglesias unsigned int st_gid; 1479b779e29eSEdgar E. Iglesias abi_ulong st_rdev; 1480b779e29eSEdgar E. Iglesias abi_ulong st_size; 1481b779e29eSEdgar E. Iglesias abi_ulong st_blksize; 1482b779e29eSEdgar E. Iglesias abi_ulong st_blocks; 1483b779e29eSEdgar E. Iglesias abi_ulong target_st_atime; 1484b779e29eSEdgar E. Iglesias abi_ulong target_st_atime_nsec; 1485b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime; 1486b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime_nsec; 1487b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime; 1488b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime_nsec; 1489b779e29eSEdgar E. Iglesias abi_ulong __unused4; 1490b779e29eSEdgar E. Iglesias abi_ulong __unused5; 1491b779e29eSEdgar E. Iglesias }; 1492b779e29eSEdgar E. Iglesias 1493b779e29eSEdgar E. Iglesias /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ 149420d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1495541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 1496b779e29eSEdgar E. Iglesias uint64_t st_dev; 1497a523eb06SEdgar E. Iglesias #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1498a523eb06SEdgar E. Iglesias uint32_t pad0; 1499a523eb06SEdgar E. Iglesias uint32_t __st_ino; 1500a523eb06SEdgar E. Iglesias 1501b779e29eSEdgar E. Iglesias uint32_t st_mode; 1502b779e29eSEdgar E. Iglesias uint32_t st_nlink; 1503b779e29eSEdgar E. Iglesias uint32_t st_uid; 1504b779e29eSEdgar E. Iglesias uint32_t st_gid; 1505b779e29eSEdgar E. Iglesias uint64_t st_rdev; 150621ebeb23SEdgar E. Iglesias uint64_t __pad1; 1507b779e29eSEdgar E. Iglesias 1508b779e29eSEdgar E. Iglesias int64_t st_size; 1509b779e29eSEdgar E. Iglesias int32_t st_blksize; 151021ebeb23SEdgar E. Iglesias uint32_t __pad2; 1511b779e29eSEdgar E. Iglesias int64_t st_blocks; /* Number 512-byte blocks allocated. */ 1512b779e29eSEdgar E. Iglesias 1513b779e29eSEdgar E. Iglesias int target_st_atime; 1514b779e29eSEdgar E. Iglesias unsigned int target_st_atime_nsec; 1515b779e29eSEdgar E. Iglesias int target_st_mtime; 1516b779e29eSEdgar E. Iglesias unsigned int target_st_mtime_nsec; 1517b779e29eSEdgar E. Iglesias int target_st_ctime; 1518b779e29eSEdgar E. Iglesias unsigned int target_st_ctime_nsec; 1519a523eb06SEdgar E. Iglesias uint64_t st_ino; 1520b779e29eSEdgar E. Iglesias }; 1521b779e29eSEdgar E. Iglesias 1522e6e5906bSpbrook #elif defined(TARGET_M68K) 1523e6e5906bSpbrook 1524e6e5906bSpbrook struct target_stat { 1525e6e5906bSpbrook unsigned short st_dev; 1526e6e5906bSpbrook unsigned short __pad1; 1527992f48a0Sblueswir1 abi_ulong st_ino; 1528e6e5906bSpbrook unsigned short st_mode; 1529e6e5906bSpbrook unsigned short st_nlink; 1530e6e5906bSpbrook unsigned short st_uid; 1531e6e5906bSpbrook unsigned short st_gid; 1532e6e5906bSpbrook unsigned short st_rdev; 1533e6e5906bSpbrook unsigned short __pad2; 1534992f48a0Sblueswir1 abi_ulong st_size; 1535992f48a0Sblueswir1 abi_ulong st_blksize; 1536992f48a0Sblueswir1 abi_ulong st_blocks; 1537992f48a0Sblueswir1 abi_ulong target_st_atime; 1538992f48a0Sblueswir1 abi_ulong __unused1; 1539992f48a0Sblueswir1 abi_ulong target_st_mtime; 1540992f48a0Sblueswir1 abi_ulong __unused2; 1541992f48a0Sblueswir1 abi_ulong target_st_ctime; 1542992f48a0Sblueswir1 abi_ulong __unused3; 1543992f48a0Sblueswir1 abi_ulong __unused4; 1544992f48a0Sblueswir1 abi_ulong __unused5; 1545e6e5906bSpbrook }; 1546e6e5906bSpbrook 1547e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely 1548e6e5906bSpbrook * insane amounts of padding around dev_t's. 1549e6e5906bSpbrook */ 155020d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1551e6e5906bSpbrook struct target_stat64 { 1552e6e5906bSpbrook unsigned long long st_dev; 1553e6e5906bSpbrook unsigned char __pad1[2]; 1554e6e5906bSpbrook 1555e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1556992f48a0Sblueswir1 abi_ulong __st_ino; 1557e6e5906bSpbrook 1558e6e5906bSpbrook unsigned int st_mode; 1559e6e5906bSpbrook unsigned int st_nlink; 1560e6e5906bSpbrook 1561992f48a0Sblueswir1 abi_ulong st_uid; 1562992f48a0Sblueswir1 abi_ulong st_gid; 1563e6e5906bSpbrook 1564e6e5906bSpbrook unsigned long long st_rdev; 1565e6e5906bSpbrook unsigned char __pad3[2]; 1566e6e5906bSpbrook 1567e6e5906bSpbrook long long st_size; 1568992f48a0Sblueswir1 abi_ulong st_blksize; 1569e6e5906bSpbrook 1570992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 1571992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1572e6e5906bSpbrook 1573992f48a0Sblueswir1 abi_ulong target_st_atime; 1574992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1575e6e5906bSpbrook 1576992f48a0Sblueswir1 abi_ulong target_st_mtime; 1577992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1578e6e5906bSpbrook 1579992f48a0Sblueswir1 abi_ulong target_st_ctime; 1580992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1581e6e5906bSpbrook 1582e6e5906bSpbrook unsigned long long st_ino; 1583541dc0d4SStefan Weil } QEMU_PACKED; 1584e6e5906bSpbrook 1585d26bc211Sths #elif defined(TARGET_ABI_MIPSN64) 1586540635baSths 1587540635baSths /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ 1588540635baSths struct target_stat { 1589540635baSths unsigned int st_dev; 1590540635baSths unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ 1591540635baSths 1592992f48a0Sblueswir1 abi_ulong st_ino; 1593540635baSths 1594540635baSths unsigned int st_mode; 1595540635baSths unsigned int st_nlink; 1596540635baSths 1597540635baSths int st_uid; 1598540635baSths int st_gid; 1599540635baSths 1600540635baSths unsigned int st_rdev; 1601540635baSths unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ 1602540635baSths 1603992f48a0Sblueswir1 abi_ulong st_size; 1604540635baSths 1605540635baSths /* 1606540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1607540635baSths * but we don't have it under Linux. 1608540635baSths */ 1609540635baSths unsigned int target_st_atime; 1610540635baSths unsigned int target_st_atime_nsec; 1611540635baSths 1612540635baSths unsigned int target_st_mtime; 1613540635baSths unsigned int target_st_mtime_nsec; 1614540635baSths 1615540635baSths unsigned int target_st_ctime; 1616540635baSths unsigned int target_st_ctime_nsec; 1617540635baSths 1618540635baSths unsigned int st_blksize; 1619540635baSths unsigned int st_pad2; 1620540635baSths 1621992f48a0Sblueswir1 abi_ulong st_blocks; 1622540635baSths }; 1623540635baSths 1624d26bc211Sths #elif defined(TARGET_ABI_MIPSN32) 1625540635baSths 1626540635baSths struct target_stat { 16271ab2aea2SLeon Alrae abi_ulong st_dev; 16281ab2aea2SLeon Alrae abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 16291ab2aea2SLeon Alrae uint64_t st_ino; 1630540635baSths unsigned int st_mode; 1631540635baSths unsigned int st_nlink; 1632540635baSths int st_uid; 1633540635baSths int st_gid; 16341ab2aea2SLeon Alrae abi_ulong st_rdev; 16351ab2aea2SLeon Alrae abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 16361ab2aea2SLeon Alrae int64_t st_size; 16371ab2aea2SLeon Alrae abi_long target_st_atime; 16381ab2aea2SLeon Alrae abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 16391ab2aea2SLeon Alrae abi_long target_st_mtime; 16401ab2aea2SLeon Alrae abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 16411ab2aea2SLeon Alrae abi_long target_st_ctime; 16421ab2aea2SLeon Alrae abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 16431ab2aea2SLeon Alrae abi_ulong st_blksize; 16441ab2aea2SLeon Alrae abi_ulong st_pad2; 16451ab2aea2SLeon Alrae int64_t st_blocks; 1646540635baSths }; 1647540635baSths 1648d26bc211Sths #elif defined(TARGET_ABI_MIPSO32) 1649048f6b4dSbellard 1650048f6b4dSbellard struct target_stat { 1651048f6b4dSbellard unsigned st_dev; 1652992f48a0Sblueswir1 abi_long st_pad1[3]; /* Reserved for network id */ 1653992f48a0Sblueswir1 abi_ulong st_ino; 1654048f6b4dSbellard unsigned int st_mode; 1655048f6b4dSbellard unsigned int st_nlink; 1656048f6b4dSbellard int st_uid; 1657048f6b4dSbellard int st_gid; 1658048f6b4dSbellard unsigned st_rdev; 1659992f48a0Sblueswir1 abi_long st_pad2[2]; 1660992f48a0Sblueswir1 abi_long st_size; 1661992f48a0Sblueswir1 abi_long st_pad3; 1662048f6b4dSbellard /* 1663048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1664048f6b4dSbellard * but we don't have it under Linux. 1665048f6b4dSbellard */ 1666992f48a0Sblueswir1 abi_long target_st_atime; 1667992f48a0Sblueswir1 abi_long target_st_atime_nsec; 1668992f48a0Sblueswir1 abi_long target_st_mtime; 1669992f48a0Sblueswir1 abi_long target_st_mtime_nsec; 1670992f48a0Sblueswir1 abi_long target_st_ctime; 1671992f48a0Sblueswir1 abi_long target_st_ctime_nsec; 1672992f48a0Sblueswir1 abi_long st_blksize; 1673992f48a0Sblueswir1 abi_long st_blocks; 1674992f48a0Sblueswir1 abi_long st_pad4[14]; 1675048f6b4dSbellard }; 1676048f6b4dSbellard 1677048f6b4dSbellard /* 1678048f6b4dSbellard * This matches struct stat64 in glibc2.1, hence the absolutely insane 1679048f6b4dSbellard * amounts of padding around dev_t's. The memory layout is the same as of 1680048f6b4dSbellard * struct stat of the 64-bit kernel. 1681048f6b4dSbellard */ 1682048f6b4dSbellard 168320d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1684048f6b4dSbellard struct target_stat64 { 1685992f48a0Sblueswir1 abi_ulong st_dev; 1686992f48a0Sblueswir1 abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 1687048f6b4dSbellard 1688048f6b4dSbellard uint64_t st_ino; 1689048f6b4dSbellard 1690048f6b4dSbellard unsigned int st_mode; 1691048f6b4dSbellard unsigned int st_nlink; 1692048f6b4dSbellard 1693048f6b4dSbellard int st_uid; 1694048f6b4dSbellard int st_gid; 1695048f6b4dSbellard 1696992f48a0Sblueswir1 abi_ulong st_rdev; 1697992f48a0Sblueswir1 abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 1698048f6b4dSbellard 1699048f6b4dSbellard int64_t st_size; 1700048f6b4dSbellard 1701048f6b4dSbellard /* 1702048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1703048f6b4dSbellard * but we don't have it under Linux. 1704048f6b4dSbellard */ 1705992f48a0Sblueswir1 abi_long target_st_atime; 1706992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 1707048f6b4dSbellard 1708992f48a0Sblueswir1 abi_long target_st_mtime; 1709992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 1710048f6b4dSbellard 1711992f48a0Sblueswir1 abi_long target_st_ctime; 1712992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 1713048f6b4dSbellard 1714992f48a0Sblueswir1 abi_ulong st_blksize; 1715992f48a0Sblueswir1 abi_ulong st_pad2; 1716048f6b4dSbellard 1717048f6b4dSbellard int64_t st_blocks; 1718048f6b4dSbellard }; 17197a3148a9Sj_mayer 17207a3148a9Sj_mayer #elif defined(TARGET_ALPHA) 17217a3148a9Sj_mayer 17227a3148a9Sj_mayer struct target_stat { 17237a3148a9Sj_mayer unsigned int st_dev; 17247a3148a9Sj_mayer unsigned int st_ino; 17257a3148a9Sj_mayer unsigned int st_mode; 17267a3148a9Sj_mayer unsigned int st_nlink; 17277a3148a9Sj_mayer unsigned int st_uid; 17287a3148a9Sj_mayer unsigned int st_gid; 17297a3148a9Sj_mayer unsigned int st_rdev; 1730992f48a0Sblueswir1 abi_long st_size; 1731992f48a0Sblueswir1 abi_ulong target_st_atime; 1732992f48a0Sblueswir1 abi_ulong target_st_mtime; 1733992f48a0Sblueswir1 abi_ulong target_st_ctime; 17347a3148a9Sj_mayer unsigned int st_blksize; 17357a3148a9Sj_mayer unsigned int st_blocks; 17367a3148a9Sj_mayer unsigned int st_flags; 17377a3148a9Sj_mayer unsigned int st_gen; 17387a3148a9Sj_mayer }; 17397a3148a9Sj_mayer 174020d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 17417a3148a9Sj_mayer struct target_stat64 { 1742992f48a0Sblueswir1 abi_ulong st_dev; 1743992f48a0Sblueswir1 abi_ulong st_ino; 1744992f48a0Sblueswir1 abi_ulong st_rdev; 1745992f48a0Sblueswir1 abi_long st_size; 1746992f48a0Sblueswir1 abi_ulong st_blocks; 17477a3148a9Sj_mayer 17487a3148a9Sj_mayer unsigned int st_mode; 17497a3148a9Sj_mayer unsigned int st_uid; 17507a3148a9Sj_mayer unsigned int st_gid; 17517a3148a9Sj_mayer unsigned int st_blksize; 17527a3148a9Sj_mayer unsigned int st_nlink; 17537a3148a9Sj_mayer unsigned int __pad0; 17547a3148a9Sj_mayer 1755992f48a0Sblueswir1 abi_ulong target_st_atime; 1756992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1757992f48a0Sblueswir1 abi_ulong target_st_mtime; 1758992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1759992f48a0Sblueswir1 abi_ulong target_st_ctime; 1760992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1761992f48a0Sblueswir1 abi_long __unused[3]; 17627a3148a9Sj_mayer }; 17637a3148a9Sj_mayer 17646db45e65Sths #elif defined(TARGET_SH4) 17656db45e65Sths 17666db45e65Sths struct target_stat { 1767992f48a0Sblueswir1 abi_ulong st_dev; 1768992f48a0Sblueswir1 abi_ulong st_ino; 17696db45e65Sths unsigned short st_mode; 17706db45e65Sths unsigned short st_nlink; 17716db45e65Sths unsigned short st_uid; 17726db45e65Sths unsigned short st_gid; 1773992f48a0Sblueswir1 abi_ulong st_rdev; 1774992f48a0Sblueswir1 abi_ulong st_size; 1775992f48a0Sblueswir1 abi_ulong st_blksize; 1776992f48a0Sblueswir1 abi_ulong st_blocks; 1777992f48a0Sblueswir1 abi_ulong target_st_atime; 1778992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1779992f48a0Sblueswir1 abi_ulong target_st_mtime; 1780992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1781992f48a0Sblueswir1 abi_ulong target_st_ctime; 1782992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1783992f48a0Sblueswir1 abi_ulong __unused4; 1784992f48a0Sblueswir1 abi_ulong __unused5; 17856db45e65Sths }; 17866db45e65Sths 17876db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely 17886db45e65Sths * insane amounts of padding around dev_t's. 17896db45e65Sths */ 179020d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1791541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 17926db45e65Sths unsigned long long st_dev; 17936db45e65Sths unsigned char __pad0[4]; 17946db45e65Sths 17956db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1796992f48a0Sblueswir1 abi_ulong __st_ino; 17976db45e65Sths 17986db45e65Sths unsigned int st_mode; 17996db45e65Sths unsigned int st_nlink; 18006db45e65Sths 1801992f48a0Sblueswir1 abi_ulong st_uid; 1802992f48a0Sblueswir1 abi_ulong st_gid; 18036db45e65Sths 18046db45e65Sths unsigned long long st_rdev; 18056db45e65Sths unsigned char __pad3[4]; 18066db45e65Sths 18076db45e65Sths long long st_size; 1808992f48a0Sblueswir1 abi_ulong st_blksize; 18096db45e65Sths 18106db45e65Sths unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ 18116db45e65Sths 1812992f48a0Sblueswir1 abi_ulong target_st_atime; 1813992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 18146db45e65Sths 1815992f48a0Sblueswir1 abi_ulong target_st_mtime; 1816992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 18176db45e65Sths 1818992f48a0Sblueswir1 abi_ulong target_st_ctime; 1819992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 18206db45e65Sths 18216db45e65Sths unsigned long long st_ino; 18226db45e65Sths }; 18236db45e65Sths 1824d2fd1af7Sbellard #elif defined(TARGET_I386) && !defined(TARGET_ABI32) 1825d2fd1af7Sbellard struct target_stat { 1826d2fd1af7Sbellard abi_ulong st_dev; 1827d2fd1af7Sbellard abi_ulong st_ino; 1828d2fd1af7Sbellard abi_ulong st_nlink; 1829d2fd1af7Sbellard 1830d2fd1af7Sbellard unsigned int st_mode; 1831d2fd1af7Sbellard unsigned int st_uid; 1832d2fd1af7Sbellard unsigned int st_gid; 1833d2fd1af7Sbellard unsigned int __pad0; 1834d2fd1af7Sbellard abi_ulong st_rdev; 1835d2fd1af7Sbellard abi_long st_size; 1836d2fd1af7Sbellard abi_long st_blksize; 1837d2fd1af7Sbellard abi_long st_blocks; /* Number 512-byte blocks allocated. */ 1838d2fd1af7Sbellard 1839d2fd1af7Sbellard abi_ulong target_st_atime; 1840d2fd1af7Sbellard abi_ulong target_st_atime_nsec; 1841d2fd1af7Sbellard abi_ulong target_st_mtime; 1842d2fd1af7Sbellard abi_ulong target_st_mtime_nsec; 1843d2fd1af7Sbellard abi_ulong target_st_ctime; 1844d2fd1af7Sbellard abi_ulong target_st_ctime_nsec; 1845d2fd1af7Sbellard 1846d2fd1af7Sbellard abi_long __unused[3]; 1847d2fd1af7Sbellard }; 1848a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 1849a4c075f1SUlrich Hecht struct target_stat { 1850a4c075f1SUlrich Hecht abi_ulong st_dev; 1851a4c075f1SUlrich Hecht abi_ulong st_ino; 1852a4c075f1SUlrich Hecht abi_ulong st_nlink; 1853a4c075f1SUlrich Hecht unsigned int st_mode; 1854a4c075f1SUlrich Hecht unsigned int st_uid; 1855a4c075f1SUlrich Hecht unsigned int st_gid; 1856a4c075f1SUlrich Hecht unsigned int __pad1; 1857a4c075f1SUlrich Hecht abi_ulong st_rdev; 1858a4c075f1SUlrich Hecht abi_ulong st_size; 1859a4c075f1SUlrich Hecht abi_ulong target_st_atime; 1860a4c075f1SUlrich Hecht abi_ulong target_st_atime_nsec; 1861a4c075f1SUlrich Hecht abi_ulong target_st_mtime; 1862a4c075f1SUlrich Hecht abi_ulong target_st_mtime_nsec; 1863a4c075f1SUlrich Hecht abi_ulong target_st_ctime; 1864a4c075f1SUlrich Hecht abi_ulong target_st_ctime_nsec; 1865a4c075f1SUlrich Hecht abi_ulong st_blksize; 1866a4c075f1SUlrich Hecht abi_long st_blocks; 1867a4c075f1SUlrich Hecht abi_ulong __unused[3]; 1868a4c075f1SUlrich Hecht }; 186909701199SAlexander Graf #elif defined(TARGET_AARCH64) 187009701199SAlexander Graf struct target_stat { 187109701199SAlexander Graf abi_ulong st_dev; 187209701199SAlexander Graf abi_ulong st_ino; 187309701199SAlexander Graf unsigned int st_mode; 187409701199SAlexander Graf unsigned int st_nlink; 187509701199SAlexander Graf unsigned int st_uid; 187609701199SAlexander Graf unsigned int st_gid; 187709701199SAlexander Graf abi_ulong st_rdev; 187809701199SAlexander Graf abi_ulong _pad1; 187909701199SAlexander Graf abi_long st_size; 188009701199SAlexander Graf int st_blksize; 188109701199SAlexander Graf int __pad2; 188209701199SAlexander Graf abi_long st_blocks; 188309701199SAlexander Graf abi_long target_st_atime; 188409701199SAlexander Graf abi_ulong target_st_atime_nsec; 188509701199SAlexander Graf abi_long target_st_mtime; 188609701199SAlexander Graf abi_ulong target_st_mtime_nsec; 188709701199SAlexander Graf abi_long target_st_ctime; 188809701199SAlexander Graf abi_ulong target_st_ctime_nsec; 188909701199SAlexander Graf unsigned int __unused[2]; 189009701199SAlexander Graf }; 1891b16189b2SChen Gang #elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) 1892c7819dfbSPeter Maydell 1893c7819dfbSPeter Maydell /* These are the asm-generic versions of the stat and stat64 structures */ 1894c7819dfbSPeter Maydell 1895d962783eSJia Liu struct target_stat { 1896d962783eSJia Liu abi_ulong st_dev; 1897d962783eSJia Liu abi_ulong st_ino; 1898d962783eSJia Liu unsigned int st_mode; 1899c7819dfbSPeter Maydell unsigned int st_nlink; 1900d962783eSJia Liu unsigned int st_uid; 1901d962783eSJia Liu unsigned int st_gid; 1902d962783eSJia Liu abi_ulong st_rdev; 1903c7819dfbSPeter Maydell abi_ulong __pad1; 1904d962783eSJia Liu abi_long st_size; 1905c7819dfbSPeter Maydell int st_blksize; 1906c7819dfbSPeter Maydell int __pad2; 1907c7819dfbSPeter Maydell abi_long st_blocks; 1908c7819dfbSPeter Maydell abi_long target_st_atime; 1909d962783eSJia Liu abi_ulong target_st_atime_nsec; 1910c7819dfbSPeter Maydell abi_long target_st_mtime; 1911d962783eSJia Liu abi_ulong target_st_mtime_nsec; 1912c7819dfbSPeter Maydell abi_long target_st_ctime; 1913d962783eSJia Liu abi_ulong target_st_ctime_nsec; 1914c7819dfbSPeter Maydell unsigned int __unused4; 1915c7819dfbSPeter Maydell unsigned int __unused5; 1916d962783eSJia Liu }; 1917c7819dfbSPeter Maydell 191820d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1919c7819dfbSPeter Maydell struct target_stat64 { 1920c7819dfbSPeter Maydell uint64_t st_dev; 1921c7819dfbSPeter Maydell uint64_t st_ino; 1922c7819dfbSPeter Maydell unsigned int st_mode; 1923c7819dfbSPeter Maydell unsigned int st_nlink; 1924c7819dfbSPeter Maydell unsigned int st_uid; 1925c7819dfbSPeter Maydell unsigned int st_gid; 1926c7819dfbSPeter Maydell uint64_t st_rdev; 1927c7819dfbSPeter Maydell uint64_t __pad1; 1928c7819dfbSPeter Maydell int64_t st_size; 1929c7819dfbSPeter Maydell int st_blksize; 1930c7819dfbSPeter Maydell int __pad2; 1931c7819dfbSPeter Maydell int64_t st_blocks; 1932c7819dfbSPeter Maydell int target_st_atime; 1933c7819dfbSPeter Maydell unsigned int target_st_atime_nsec; 1934c7819dfbSPeter Maydell int target_st_mtime; 1935c7819dfbSPeter Maydell unsigned int target_st_mtime_nsec; 1936c7819dfbSPeter Maydell int target_st_ctime; 1937c7819dfbSPeter Maydell unsigned int target_st_ctime_nsec; 1938c7819dfbSPeter Maydell unsigned int __unused4; 1939c7819dfbSPeter Maydell unsigned int __unused5; 1940c7819dfbSPeter Maydell }; 1941c7819dfbSPeter Maydell 1942048f6b4dSbellard #else 1943048f6b4dSbellard #error unsupported CPU 1944048f6b4dSbellard #endif 19452521d698Sbellard 19464ce6f8deSths typedef struct { 19474ce6f8deSths int val[2]; 1948c227f099SAnthony Liguori } target_fsid_t; 19494ce6f8deSths 195056c8f68fSbellard #ifdef TARGET_MIPS 1951d26bc211Sths #ifdef TARGET_ABI_MIPSN32 1952540635baSths struct target_statfs { 1953540635baSths int32_t f_type; 1954540635baSths int32_t f_bsize; 1955540635baSths int32_t f_frsize; /* Fragment size - unsupported */ 1956540635baSths int32_t f_blocks; 1957540635baSths int32_t f_bfree; 1958540635baSths int32_t f_files; 1959540635baSths int32_t f_ffree; 1960540635baSths int32_t f_bavail; 1961540635baSths 1962540635baSths /* Linux specials */ 1963c227f099SAnthony Liguori target_fsid_t f_fsid; 1964540635baSths int32_t f_namelen; 1965540635baSths int32_t f_spare[6]; 1966540635baSths }; 1967540635baSths #else 196856c8f68fSbellard struct target_statfs { 1969992f48a0Sblueswir1 abi_long f_type; 1970992f48a0Sblueswir1 abi_long f_bsize; 1971992f48a0Sblueswir1 abi_long f_frsize; /* Fragment size - unsupported */ 1972992f48a0Sblueswir1 abi_long f_blocks; 1973992f48a0Sblueswir1 abi_long f_bfree; 1974992f48a0Sblueswir1 abi_long f_files; 1975992f48a0Sblueswir1 abi_long f_ffree; 1976992f48a0Sblueswir1 abi_long f_bavail; 197756c8f68fSbellard 197856c8f68fSbellard /* Linux specials */ 1979c227f099SAnthony Liguori target_fsid_t f_fsid; 1980992f48a0Sblueswir1 abi_long f_namelen; 1981992f48a0Sblueswir1 abi_long f_spare[6]; 198256c8f68fSbellard }; 1983540635baSths #endif 198456c8f68fSbellard 198556c8f68fSbellard struct target_statfs64 { 198656c8f68fSbellard uint32_t f_type; 198756c8f68fSbellard uint32_t f_bsize; 198856c8f68fSbellard uint32_t f_frsize; /* Fragment size - unsupported */ 198956c8f68fSbellard uint32_t __pad; 199056c8f68fSbellard uint64_t f_blocks; 199156c8f68fSbellard uint64_t f_bfree; 199256c8f68fSbellard uint64_t f_files; 199356c8f68fSbellard uint64_t f_ffree; 199456c8f68fSbellard uint64_t f_bavail; 1995c227f099SAnthony Liguori target_fsid_t f_fsid; 199656c8f68fSbellard uint32_t f_namelen; 199756c8f68fSbellard uint32_t f_spare[6]; 199856c8f68fSbellard }; 1999c4d10628Sbalrog #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ 200009701199SAlexander Graf defined(TARGET_SPARC64) || defined(TARGET_AARCH64)) && \ 200109701199SAlexander Graf !defined(TARGET_ABI32) 2002325e651fSj_mayer struct target_statfs { 2003325e651fSj_mayer abi_long f_type; 2004325e651fSj_mayer abi_long f_bsize; 2005325e651fSj_mayer abi_long f_blocks; 2006325e651fSj_mayer abi_long f_bfree; 2007325e651fSj_mayer abi_long f_bavail; 2008325e651fSj_mayer abi_long f_files; 2009325e651fSj_mayer abi_long f_ffree; 2010c227f099SAnthony Liguori target_fsid_t f_fsid; 2011325e651fSj_mayer abi_long f_namelen; 2012325e651fSj_mayer abi_long f_frsize; 2013325e651fSj_mayer abi_long f_spare[5]; 2014325e651fSj_mayer }; 2015325e651fSj_mayer 2016325e651fSj_mayer struct target_statfs64 { 2017325e651fSj_mayer abi_long f_type; 2018325e651fSj_mayer abi_long f_bsize; 2019325e651fSj_mayer abi_long f_blocks; 2020325e651fSj_mayer abi_long f_bfree; 2021325e651fSj_mayer abi_long f_bavail; 2022325e651fSj_mayer abi_long f_files; 2023325e651fSj_mayer abi_long f_ffree; 2024c227f099SAnthony Liguori target_fsid_t f_fsid; 2025325e651fSj_mayer abi_long f_namelen; 2026325e651fSj_mayer abi_long f_frsize; 2027325e651fSj_mayer abi_long f_spare[5]; 2028325e651fSj_mayer }; 2029a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 2030a4c075f1SUlrich Hecht struct target_statfs { 2031a4c075f1SUlrich Hecht int32_t f_type; 2032a4c075f1SUlrich Hecht int32_t f_bsize; 2033a4c075f1SUlrich Hecht abi_long f_blocks; 2034a4c075f1SUlrich Hecht abi_long f_bfree; 2035a4c075f1SUlrich Hecht abi_long f_bavail; 2036a4c075f1SUlrich Hecht abi_long f_files; 2037a4c075f1SUlrich Hecht abi_long f_ffree; 2038a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2039a4c075f1SUlrich Hecht int32_t f_namelen; 2040a4c075f1SUlrich Hecht int32_t f_frsize; 2041a4c075f1SUlrich Hecht int32_t f_spare[5]; 2042a4c075f1SUlrich Hecht }; 2043a4c075f1SUlrich Hecht 2044a4c075f1SUlrich Hecht struct target_statfs64 { 2045a4c075f1SUlrich Hecht int32_t f_type; 2046a4c075f1SUlrich Hecht int32_t f_bsize; 2047a4c075f1SUlrich Hecht abi_long f_blocks; 2048a4c075f1SUlrich Hecht abi_long f_bfree; 2049a4c075f1SUlrich Hecht abi_long f_bavail; 2050a4c075f1SUlrich Hecht abi_long f_files; 2051a4c075f1SUlrich Hecht abi_long f_ffree; 2052a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2053a4c075f1SUlrich Hecht int32_t f_namelen; 2054a4c075f1SUlrich Hecht int32_t f_frsize; 2055a4c075f1SUlrich Hecht int32_t f_spare[5]; 2056a4c075f1SUlrich Hecht }; 205756c8f68fSbellard #else 205856c8f68fSbellard struct target_statfs { 205956c8f68fSbellard uint32_t f_type; 206056c8f68fSbellard uint32_t f_bsize; 206156c8f68fSbellard uint32_t f_blocks; 206256c8f68fSbellard uint32_t f_bfree; 206356c8f68fSbellard uint32_t f_bavail; 206456c8f68fSbellard uint32_t f_files; 206556c8f68fSbellard uint32_t f_ffree; 2066c227f099SAnthony Liguori target_fsid_t f_fsid; 206756c8f68fSbellard uint32_t f_namelen; 206856c8f68fSbellard uint32_t f_frsize; 206956c8f68fSbellard uint32_t f_spare[5]; 207056c8f68fSbellard }; 207156c8f68fSbellard 207256c8f68fSbellard struct target_statfs64 { 207356c8f68fSbellard uint32_t f_type; 207456c8f68fSbellard uint32_t f_bsize; 207556c8f68fSbellard uint64_t f_blocks; 207656c8f68fSbellard uint64_t f_bfree; 207756c8f68fSbellard uint64_t f_bavail; 207856c8f68fSbellard uint64_t f_files; 207956c8f68fSbellard uint64_t f_ffree; 2080c227f099SAnthony Liguori target_fsid_t f_fsid; 208156c8f68fSbellard uint32_t f_namelen; 208256c8f68fSbellard uint32_t f_frsize; 208356c8f68fSbellard uint32_t f_spare[5]; 208456c8f68fSbellard }; 208556c8f68fSbellard #endif 208656c8f68fSbellard 208756c8f68fSbellard 20882521d698Sbellard #define TARGET_F_DUPFD 0 /* dup */ 20892521d698Sbellard #define TARGET_F_GETFD 1 /* get close_on_exec */ 20902521d698Sbellard #define TARGET_F_SETFD 2 /* set/clear close_on_exec */ 20912521d698Sbellard #define TARGET_F_GETFL 3 /* get file->f_flags */ 20922521d698Sbellard #define TARGET_F_SETFL 4 /* set file->f_flags */ 20932521d698Sbellard 20942521d698Sbellard #if defined(TARGET_ALPHA) 20952521d698Sbellard #define TARGET_F_GETLK 7 20962521d698Sbellard #define TARGET_F_SETLK 8 20972521d698Sbellard #define TARGET_F_SETLKW 9 20982521d698Sbellard #define TARGET_F_SETOWN 5 /* for sockets. */ 20992521d698Sbellard #define TARGET_F_GETOWN 6 /* for sockets. */ 21002ba7f730SLaurent Vivier 21012ba7f730SLaurent Vivier #define TARGET_F_RDLCK 1 21022ba7f730SLaurent Vivier #define TARGET_F_WRLCK 2 21032ba7f730SLaurent Vivier #define TARGET_F_UNLCK 8 21042ba7f730SLaurent Vivier #define TARGET_F_EXLCK 16 21052ba7f730SLaurent Vivier #define TARGET_F_SHLCK 32 21065f106811SArnaud Patard (Rtp) #elif defined(TARGET_MIPS) 21075f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK 14 21085f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK 6 21095f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW 7 21105f106811SArnaud Patard (Rtp) #define TARGET_F_SETOWN 24 /* for sockets. */ 21115f106811SArnaud Patard (Rtp) #define TARGET_F_GETOWN 25 /* for sockets. */ 21122521d698Sbellard #else 21132521d698Sbellard #define TARGET_F_GETLK 5 21142521d698Sbellard #define TARGET_F_SETLK 6 21152521d698Sbellard #define TARGET_F_SETLKW 7 21162521d698Sbellard #define TARGET_F_SETOWN 8 /* for sockets. */ 21172521d698Sbellard #define TARGET_F_GETOWN 9 /* for sockets. */ 21182521d698Sbellard #endif 21198d5d3004SAndreas Schwab #define TARGET_F_SETOWN_EX 15 21208d5d3004SAndreas Schwab #define TARGET_F_GETOWN_EX 16 21212521d698Sbellard 21222ba7f730SLaurent Vivier #ifndef TARGET_F_RDLCK 21232ba7f730SLaurent Vivier #define TARGET_F_RDLCK 0 21242ba7f730SLaurent Vivier #define TARGET_F_WRLCK 1 21252ba7f730SLaurent Vivier #define TARGET_F_UNLCK 2 21262ba7f730SLaurent Vivier #endif 21272ba7f730SLaurent Vivier 21282ba7f730SLaurent Vivier #ifndef TARGET_F_EXLCK 21292ba7f730SLaurent Vivier #define TARGET_F_EXLCK 4 21302ba7f730SLaurent Vivier #define TARGET_F_SHLCK 8 21312ba7f730SLaurent Vivier #endif 21322ba7f730SLaurent Vivier 21332ba7f730SLaurent Vivier 21342521d698Sbellard #define TARGET_F_SETSIG 10 /* for sockets. */ 21352521d698Sbellard #define TARGET_F_GETSIG 11 /* for sockets. */ 21362521d698Sbellard 21375f106811SArnaud Patard (Rtp) #if defined(TARGET_MIPS) 21385f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK64 33 /* using 'struct flock64' */ 21395f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK64 34 21405f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW64 35 21415f106811SArnaud Patard (Rtp) #else 21422521d698Sbellard #define TARGET_F_GETLK64 12 /* using 'struct flock64' */ 21432521d698Sbellard #define TARGET_F_SETLK64 13 21442521d698Sbellard #define TARGET_F_SETLKW64 14 21455f106811SArnaud Patard (Rtp) #endif 21467e22e546SUlrich Hecht 21477e22e546SUlrich Hecht #define TARGET_F_LINUX_SPECIFIC_BASE 1024 21487e22e546SUlrich Hecht #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0) 21497e22e546SUlrich Hecht #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1) 21507e22e546SUlrich Hecht #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) 21517e22e546SUlrich Hecht #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2) 21527e22e546SUlrich Hecht 21534eeea4f3SRichard Henderson #if defined(TARGET_ALPHA) 21544eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK 04 21554eeea4f3SRichard Henderson #define TARGET_O_APPEND 010 21564eeea4f3SRichard Henderson #define TARGET_O_CREAT 01000 /* not fcntl */ 21574eeea4f3SRichard Henderson #define TARGET_O_TRUNC 02000 /* not fcntl */ 21584eeea4f3SRichard Henderson #define TARGET_O_EXCL 04000 /* not fcntl */ 21594eeea4f3SRichard Henderson #define TARGET_O_NOCTTY 010000 /* not fcntl */ 21604eeea4f3SRichard Henderson #define TARGET_O_DSYNC 040000 21614eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0 /* not necessary, always 64-bit */ 21624eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY 0100000 /* must be a directory */ 21634eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW 0200000 /* don't follow links */ 21644eeea4f3SRichard Henderson #define TARGET_O_DIRECT 02000000 /* direct disk access hint */ 21654eeea4f3SRichard Henderson #define TARGET_O_NOATIME 04000000 21664eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 010000000 21674eeea4f3SRichard Henderson #define TARGET___O_SYNC 020000000 21684eeea4f3SRichard Henderson #define TARGET_O_PATH 040000000 21694eeea4f3SRichard Henderson #elif defined(TARGET_ARM) || defined(TARGET_M68K) 2170f09936acSbellard #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 2171f09936acSbellard #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 2172f09936acSbellard #define TARGET_O_DIRECT 0200000 /* direct disk access hint */ 2173f09936acSbellard #define TARGET_O_LARGEFILE 0400000 2174048f6b4dSbellard #elif defined(TARGET_MIPS) 2175048f6b4dSbellard #define TARGET_O_APPEND 0x0008 21764eeea4f3SRichard Henderson #define TARGET_O_DSYNC 0x0010 2177048f6b4dSbellard #define TARGET_O_NONBLOCK 0x0080 2178048f6b4dSbellard #define TARGET_O_CREAT 0x0100 /* not fcntl */ 2179048f6b4dSbellard #define TARGET_O_TRUNC 0x0200 /* not fcntl */ 2180048f6b4dSbellard #define TARGET_O_EXCL 0x0400 /* not fcntl */ 2181048f6b4dSbellard #define TARGET_O_NOCTTY 0x0800 /* not fcntl */ 2182048f6b4dSbellard #define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */ 2183048f6b4dSbellard #define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */ 21844eeea4f3SRichard Henderson #define TARGET___O_SYNC 0x4000 2185048f6b4dSbellard #define TARGET_O_DIRECT 0x8000 /* direct disk access hint */ 21864eeea4f3SRichard Henderson #elif defined (TARGET_PPC) 21874eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 21884eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 21894eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0200000 21904eeea4f3SRichard Henderson #define TARGET_O_DIRECT 0400000 /* direct disk access hint */ 21914eeea4f3SRichard Henderson #elif defined (TARGET_SPARC) 21921f961124Saurel32 #define TARGET_O_APPEND 0x0008 21934eeea4f3SRichard Henderson #define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */ 21941f961124Saurel32 #define TARGET_O_CREAT 0x0200 /* not fcntl */ 21951f961124Saurel32 #define TARGET_O_TRUNC 0x0400 /* not fcntl */ 21961f961124Saurel32 #define TARGET_O_EXCL 0x0800 /* not fcntl */ 21974eeea4f3SRichard Henderson #define TARGET_O_DSYNC 0x2000 21984eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK 0x4000 21994eeea4f3SRichard Henderson # ifdef TARGET_SPARC64 22004eeea4f3SRichard Henderson # define TARGET_O_NDELAY 0x0004 2201ffa65c3bSbellard # else 22024eeea4f3SRichard Henderson # define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK) 22034eeea4f3SRichard Henderson # endif 22044eeea4f3SRichard Henderson #define TARGET_O_NOCTTY 0x8000 /* not fcntl */ 22054eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0x40000 22064eeea4f3SRichard Henderson #define TARGET_O_DIRECT 0x100000 /* direct disk access hint */ 22074eeea4f3SRichard Henderson #define TARGET_O_NOATIME 0x200000 22084eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 0x400000 22094eeea4f3SRichard Henderson #define TARGET___O_SYNC 0x800000 22104eeea4f3SRichard Henderson #define TARGET_O_PATH 0x1000000 22114eeea4f3SRichard Henderson #endif 22124eeea4f3SRichard Henderson 22134eeea4f3SRichard Henderson /* <asm-generic/fcntl.h> values follow. */ 2214ffa65c3bSbellard #define TARGET_O_ACCMODE 0003 2215ffa65c3bSbellard #define TARGET_O_RDONLY 00 2216ffa65c3bSbellard #define TARGET_O_WRONLY 01 2217ffa65c3bSbellard #define TARGET_O_RDWR 02 22184eeea4f3SRichard Henderson #ifndef TARGET_O_CREAT 2219ffa65c3bSbellard #define TARGET_O_CREAT 0100 /* not fcntl */ 22204eeea4f3SRichard Henderson #endif 22214eeea4f3SRichard Henderson #ifndef TARGET_O_EXCL 2222ffa65c3bSbellard #define TARGET_O_EXCL 0200 /* not fcntl */ 22234eeea4f3SRichard Henderson #endif 22244eeea4f3SRichard Henderson #ifndef TARGET_O_NOCTTY 2225ffa65c3bSbellard #define TARGET_O_NOCTTY 0400 /* not fcntl */ 22264eeea4f3SRichard Henderson #endif 22274eeea4f3SRichard Henderson #ifndef TARGET_O_TRUNC 2228ffa65c3bSbellard #define TARGET_O_TRUNC 01000 /* not fcntl */ 22294eeea4f3SRichard Henderson #endif 22304eeea4f3SRichard Henderson #ifndef TARGET_O_APPEND 2231ffa65c3bSbellard #define TARGET_O_APPEND 02000 22324eeea4f3SRichard Henderson #endif 22334eeea4f3SRichard Henderson #ifndef TARGET_O_NONBLOCK 2234ffa65c3bSbellard #define TARGET_O_NONBLOCK 04000 22354eeea4f3SRichard Henderson #endif 22364eeea4f3SRichard Henderson #ifndef TARGET_O_DSYNC 22374eeea4f3SRichard Henderson #define TARGET_O_DSYNC 010000 22384eeea4f3SRichard Henderson #endif 22394eeea4f3SRichard Henderson #ifndef TARGET_FASYNC 2240ffa65c3bSbellard #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ 22414eeea4f3SRichard Henderson #endif 22424eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECT 2243ffa65c3bSbellard #define TARGET_O_DIRECT 040000 /* direct disk access hint */ 22444eeea4f3SRichard Henderson #endif 22454eeea4f3SRichard Henderson #ifndef TARGET_O_LARGEFILE 2246ffa65c3bSbellard #define TARGET_O_LARGEFILE 0100000 22474eeea4f3SRichard Henderson #endif 22484eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECTORY 2249ffa65c3bSbellard #define TARGET_O_DIRECTORY 0200000 /* must be a directory */ 22504eeea4f3SRichard Henderson #endif 22514eeea4f3SRichard Henderson #ifndef TARGET_O_NOFOLLOW 2252ffa65c3bSbellard #define TARGET_O_NOFOLLOW 0400000 /* don't follow links */ 2253ffa65c3bSbellard #endif 22544eeea4f3SRichard Henderson #ifndef TARGET_O_NOATIME 22554eeea4f3SRichard Henderson #define TARGET_O_NOATIME 01000000 22564eeea4f3SRichard Henderson #endif 22574eeea4f3SRichard Henderson #ifndef TARGET_O_CLOEXEC 22584eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 02000000 22594eeea4f3SRichard Henderson #endif 22604eeea4f3SRichard Henderson #ifndef TARGET___O_SYNC 22614eeea4f3SRichard Henderson #define TARGET___O_SYNC 04000000 22624eeea4f3SRichard Henderson #endif 22634eeea4f3SRichard Henderson #ifndef TARGET_O_PATH 22644eeea4f3SRichard Henderson #define TARGET_O_PATH 010000000 22654eeea4f3SRichard Henderson #endif 22664eeea4f3SRichard Henderson #ifndef TARGET_O_NDELAY 22674eeea4f3SRichard Henderson #define TARGET_O_NDELAY TARGET_O_NONBLOCK 22684eeea4f3SRichard Henderson #endif 22694eeea4f3SRichard Henderson #ifndef TARGET_O_SYNC 22704eeea4f3SRichard Henderson #define TARGET_O_SYNC (TARGET___O_SYNC | TARGET_O_DSYNC) 22714eeea4f3SRichard Henderson #endif 2272ffa65c3bSbellard 22732521d698Sbellard struct target_flock { 22742521d698Sbellard short l_type; 22752521d698Sbellard short l_whence; 2276992f48a0Sblueswir1 abi_ulong l_start; 2277992f48a0Sblueswir1 abi_ulong l_len; 22782521d698Sbellard int l_pid; 22792521d698Sbellard }; 22802521d698Sbellard 22812521d698Sbellard struct target_flock64 { 22822521d698Sbellard short l_type; 22832521d698Sbellard short l_whence; 2284b16189b2SChen Gang #if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) \ 2285b16189b2SChen Gang || defined(TARGET_SPARC) || defined(TARGET_HPPA) \ 2286b16189b2SChen Gang || defined(TARGET_MICROBLAZE) || defined(TARGET_TILEGX) 2287ce3f0e2fSaurel32 int __pad; 2288ce3f0e2fSaurel32 #endif 22892521d698Sbellard unsigned long long l_start; 22902521d698Sbellard unsigned long long l_len; 22912521d698Sbellard int l_pid; 2292541dc0d4SStefan Weil } QEMU_PACKED; 22932521d698Sbellard 2294ce4defa0Spbrook #ifdef TARGET_ARM 2295ce4defa0Spbrook struct target_eabi_flock64 { 2296ce4defa0Spbrook short l_type; 2297ce4defa0Spbrook short l_whence; 2298ce4defa0Spbrook int __pad; 2299ce4defa0Spbrook unsigned long long l_start; 2300ce4defa0Spbrook unsigned long long l_len; 2301ce4defa0Spbrook int l_pid; 2302541dc0d4SStefan Weil } QEMU_PACKED; 2303ce4defa0Spbrook #endif 23042521d698Sbellard 23058d5d3004SAndreas Schwab struct target_f_owner_ex { 23068d5d3004SAndreas Schwab int type; /* Owner type of ID. */ 23078d5d3004SAndreas Schwab int pid; /* ID of owner. */ 23088d5d3004SAndreas Schwab }; 23098d5d3004SAndreas Schwab 23102521d698Sbellard /* soundcard defines */ 231167cc32ebSVeres Lajos /* XXX: convert them all to arch independent entries */ 23122521d698Sbellard #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); 23132521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 23142521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 23152521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 23162521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA 0xc0144302 23172521d698Sbellard #define TARGET_SNDCTL_COPR_RESET 0x00004300 23182521d698Sbellard #define TARGET_SNDCTL_COPR_RUN 0xc0144306 23192521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 23202521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE 0x40144305 23212521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA 0x40144304 23222521d698Sbellard #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) 23232521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) 23242521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) 23252521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) 23262521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) 23272521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) 23282521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) 23292521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) 23302521d698Sbellard #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) 23312521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) 23322521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) 23332521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) 23342521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) 23352521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) 23362521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) 23372521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) 23382521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) 23392521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) 23405f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19) 23415f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20) 23422521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e 23432521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 23442521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 23452521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 23462521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 23472521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f 23482521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 23492521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO 0xc074510c 23502521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 23512521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 23522521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 23532521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 23542521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 23552521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 23562521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 23572521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 23582521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b 23592521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a 23602521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 23612521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC 0x00005111 23622521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 23632521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET 0x00005100 23642521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 23652521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC 0x00005101 23662521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 23672521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d 23682521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d 23692521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 23702521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e 23712521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 23722521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME 0x40045407 23732521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT 0x40045408 23742521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 23752521d698Sbellard #define TARGET_SNDCTL_TMR_START 0x00005402 23762521d698Sbellard #define TARGET_SNDCTL_TMR_STOP 0x00005403 23772521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 23782521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 23792521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE 0x80045002 23802521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 23812521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS 0x80045005 23822521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 23832521d698Sbellard #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) 23842521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 23852521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) 23862521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) 23872521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) 23882521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) 23892521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) 23902521d698Sbellard 23912521d698Sbellard #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) 23922521d698Sbellard 23932521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) 23942521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) 23952521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) 23962521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) 23972521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) 23982521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) 23992521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) 24002521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) 24012521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) 24022521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) 24032521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) 24042521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) 24052521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) 24062521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) 24072521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) 24082521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) 24092521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) 24102521d698Sbellard 24112521d698Sbellard /* Obsolete macros */ 24122521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) 24132521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) 24142521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) 24152521d698Sbellard 24162521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) 24172521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) 24182521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) 24192521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) 24202521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) 24212521d698Sbellard 24222521d698Sbellard #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) 24232521d698Sbellard 24242521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) 24252521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) 24262521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) 24272521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) 24282521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) 24292521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) 24302521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) 24312521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) 24322521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) 24332521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) 24342521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) 24352521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) 24362521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) 24372521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) 24382521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) 24392521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) 24402521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) 24412521d698Sbellard 24422521d698Sbellard /* Obsolete macros */ 24432521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) 24442521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) 24452521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) 24462521d698Sbellard 24472521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) 24482521d698Sbellard 24492521d698Sbellard /* vfat ioctls */ 24502521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) 24512521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) 2452a5448a7dSbellard 24538fbd6b52Sbalrog #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct mtop) 24548fbd6b52Sbalrog #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct mtget) 24558fbd6b52Sbalrog #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct mtpos) 24568fbd6b52Sbalrog 2457a5448a7dSbellard struct target_sysinfo { 2458992f48a0Sblueswir1 abi_long uptime; /* Seconds since boot */ 2459992f48a0Sblueswir1 abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */ 2460992f48a0Sblueswir1 abi_ulong totalram; /* Total usable main memory size */ 2461992f48a0Sblueswir1 abi_ulong freeram; /* Available memory size */ 2462992f48a0Sblueswir1 abi_ulong sharedram; /* Amount of shared memory */ 2463992f48a0Sblueswir1 abi_ulong bufferram; /* Memory used by buffers */ 2464992f48a0Sblueswir1 abi_ulong totalswap; /* Total swap space size */ 2465992f48a0Sblueswir1 abi_ulong freeswap; /* swap space still available */ 2466a5448a7dSbellard unsigned short procs; /* Number of current processes */ 2467a5448a7dSbellard unsigned short pad; /* explicit padding for m68k */ 2468992f48a0Sblueswir1 abi_ulong totalhigh; /* Total high memory size */ 2469992f48a0Sblueswir1 abi_ulong freehigh; /* Available high memory size */ 2470a5448a7dSbellard unsigned int mem_unit; /* Memory unit size in bytes */ 2471992f48a0Sblueswir1 char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 2472a5448a7dSbellard }; 24733532fa74Sbellard 24746556a833Saurel32 struct linux_dirent { 24756556a833Saurel32 long d_ino; 24766556a833Saurel32 unsigned long d_off; 24776556a833Saurel32 unsigned short d_reclen; 24786556a833Saurel32 char d_name[256]; /* We must not include limits.h! */ 24796556a833Saurel32 }; 24806556a833Saurel32 24816556a833Saurel32 struct linux_dirent64 { 24826556a833Saurel32 uint64_t d_ino; 24836556a833Saurel32 int64_t d_off; 24846556a833Saurel32 unsigned short d_reclen; 24856556a833Saurel32 unsigned char d_type; 24866556a833Saurel32 char d_name[256]; 24876556a833Saurel32 }; 24886556a833Saurel32 248924e1003aSaurel32 struct target_mq_attr { 249024e1003aSaurel32 abi_long mq_flags; 249124e1003aSaurel32 abi_long mq_maxmsg; 249224e1003aSaurel32 abi_long mq_msgsize; 249324e1003aSaurel32 abi_long mq_curmsgs; 249424e1003aSaurel32 }; 249524e1003aSaurel32 24963532fa74Sbellard #include "socket.h" 2497637947f1Sths 2498637947f1Sths #include "errno_defs.h" 249903dfe9f8SRiku Voipio 250003dfe9f8SRiku Voipio #define FUTEX_WAIT 0 250103dfe9f8SRiku Voipio #define FUTEX_WAKE 1 250203dfe9f8SRiku Voipio #define FUTEX_FD 2 250303dfe9f8SRiku Voipio #define FUTEX_REQUEUE 3 250403dfe9f8SRiku Voipio #define FUTEX_CMP_REQUEUE 4 250503dfe9f8SRiku Voipio #define FUTEX_WAKE_OP 5 250603dfe9f8SRiku Voipio #define FUTEX_LOCK_PI 6 250703dfe9f8SRiku Voipio #define FUTEX_UNLOCK_PI 7 250803dfe9f8SRiku Voipio #define FUTEX_TRYLOCK_PI 8 250903dfe9f8SRiku Voipio #define FUTEX_WAIT_BITSET 9 251003dfe9f8SRiku Voipio #define FUTEX_WAKE_BITSET 10 251103dfe9f8SRiku Voipio 251203dfe9f8SRiku Voipio #define FUTEX_PRIVATE_FLAG 128 251303dfe9f8SRiku Voipio #define FUTEX_CLOCK_REALTIME 256 251403dfe9f8SRiku Voipio #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) 251503dfe9f8SRiku Voipio 25163b6edd16SPeter Maydell #ifdef CONFIG_EPOLL 2517*928bed6aSLaurent Vivier #if defined(TARGET_X86_64) 2518*928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED QEMU_PACKED 2519*928bed6aSLaurent Vivier #else 2520*928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED 2521*928bed6aSLaurent Vivier #endif 2522*928bed6aSLaurent Vivier 25233b6edd16SPeter Maydell typedef union target_epoll_data { 25243b6edd16SPeter Maydell abi_ulong ptr; 2525*928bed6aSLaurent Vivier abi_int fd; 2526*928bed6aSLaurent Vivier abi_uint u32; 2527*928bed6aSLaurent Vivier abi_ullong u64; 25283b6edd16SPeter Maydell } target_epoll_data_t; 25293b6edd16SPeter Maydell 25303b6edd16SPeter Maydell struct target_epoll_event { 2531*928bed6aSLaurent Vivier abi_uint events; 25323b6edd16SPeter Maydell target_epoll_data_t data; 2533*928bed6aSLaurent Vivier } TARGET_EPOLL_PACKED; 25343b6edd16SPeter Maydell #endif 2535163a05a8SPeter Maydell struct target_rlimit64 { 2536163a05a8SPeter Maydell uint64_t rlim_cur; 2537163a05a8SPeter Maydell uint64_t rlim_max; 2538163a05a8SPeter Maydell }; 2539583359a6SAkos PASZTORY 2540583359a6SAkos PASZTORY struct target_ucred { 2541583359a6SAkos PASZTORY uint32_t pid; 2542583359a6SAkos PASZTORY uint32_t uid; 2543583359a6SAkos PASZTORY uint32_t gid; 2544583359a6SAkos PASZTORY }; 2545cb9c377fSPaolo Bonzini 2546cb9c377fSPaolo Bonzini #endif 2547905bba13SErik de Castro Lopo 2548aecc8861SAlexander Graf typedef int32_t target_timer_t; 2549905bba13SErik de Castro Lopo 255034d60862SNatanael Copa #define TARGET_SIGEV_MAX_SIZE 64 255134d60862SNatanael Copa 255234d60862SNatanael Copa /* This is architecture-specific but most architectures use the default */ 255334d60862SNatanael Copa #ifdef TARGET_MIPS 255434d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long)) 255534d60862SNatanael Copa #else 255634d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ 255734d60862SNatanael Copa + sizeof(target_sigval_t)) 255834d60862SNatanael Copa #endif 255934d60862SNatanael Copa 256034d60862SNatanael Copa #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ 256134d60862SNatanael Copa - TARGET_SIGEV_PREAMBLE_SIZE) \ 256234d60862SNatanael Copa / sizeof(int32_t)) 256334d60862SNatanael Copa 2564905bba13SErik de Castro Lopo struct target_sigevent { 2565905bba13SErik de Castro Lopo target_sigval_t sigev_value; 2566905bba13SErik de Castro Lopo int32_t sigev_signo; 2567905bba13SErik de Castro Lopo int32_t sigev_notify; 2568905bba13SErik de Castro Lopo union { 256934d60862SNatanael Copa int32_t _pad[TARGET_SIGEV_PAD_SIZE]; 2570905bba13SErik de Castro Lopo int32_t _tid; 2571905bba13SErik de Castro Lopo 2572905bba13SErik de Castro Lopo struct { 2573905bba13SErik de Castro Lopo void (*_function)(sigval_t); 2574905bba13SErik de Castro Lopo void *_attribute; 2575905bba13SErik de Castro Lopo } _sigev_thread; 2576905bba13SErik de Castro Lopo } _sigev_un; 2577905bba13SErik de Castro Lopo }; 2578e0eb210eSPeter Maydell 2579e0eb210eSPeter Maydell struct target_user_cap_header { 2580e0eb210eSPeter Maydell uint32_t version; 2581e0eb210eSPeter Maydell int pid; 2582e0eb210eSPeter Maydell }; 2583e0eb210eSPeter Maydell 2584e0eb210eSPeter Maydell struct target_user_cap_data { 2585e0eb210eSPeter Maydell uint32_t effective; 2586e0eb210eSPeter Maydell uint32_t permitted; 2587e0eb210eSPeter Maydell uint32_t inheritable; 2588e0eb210eSPeter Maydell }; 2589