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 315a53dc50SJohn Paul Adrian Glaubitz #define SOCKOP_recvmmsg 19 325a53dc50SJohn Paul Adrian Glaubitz #define SOCKOP_sendmmsg 20 3331e31b8aSbellard 348853f86eSbellard #define IPCOP_semop 1 358853f86eSbellard #define IPCOP_semget 2 368853f86eSbellard #define IPCOP_semctl 3 378853f86eSbellard #define IPCOP_semtimedop 4 388853f86eSbellard #define IPCOP_msgsnd 11 398853f86eSbellard #define IPCOP_msgrcv 12 408853f86eSbellard #define IPCOP_msgget 13 418853f86eSbellard #define IPCOP_msgctl 14 428853f86eSbellard #define IPCOP_shmat 21 438853f86eSbellard #define IPCOP_shmdt 22 448853f86eSbellard #define IPCOP_shmget 23 458853f86eSbellard #define IPCOP_shmctl 24 468853f86eSbellard 472521d698Sbellard /* 482521d698Sbellard * The following is for compatibility across the various Linux 492521d698Sbellard * platforms. The i386 ioctl numbering scheme doesn't really enforce 502521d698Sbellard * a type field. De facto, however, the top 8 bits of the lower 16 512521d698Sbellard * bits are indeed used as a type field, so we might just as well make 522521d698Sbellard * this explicit here. Please be sure to use the decoding macros 532521d698Sbellard * below from now on. 542521d698Sbellard */ 552521d698Sbellard #define TARGET_IOC_NRBITS 8 562521d698Sbellard #define TARGET_IOC_TYPEBITS 8 572521d698Sbellard 58716f3fbeSPeter Maydell #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 59716f3fbeSPeter Maydell || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 60cd98d390SAndreas Schwab || defined(TARGET_SPARC) \ 610c866a7eSRiku Voipio || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) 6274d753acSMika Westerberg /* 16 bit uid wrappers emulation */ 6374d753acSMika Westerberg #define USE_UID16 640c866a7eSRiku Voipio #define target_id uint16_t 650c866a7eSRiku Voipio #else 660c866a7eSRiku Voipio #define target_id uint32_t 6774d753acSMika Westerberg #endif 6874d753acSMika Westerberg 69e6e5906bSpbrook #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ 70b16189b2SChen Gang || defined(TARGET_M68K) || defined(TARGET_CRIS) \ 71b16189b2SChen Gang || defined(TARGET_UNICORE32) || defined(TARGET_S390X) \ 72b16189b2SChen Gang || defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) 732521d698Sbellard 742521d698Sbellard #define TARGET_IOC_SIZEBITS 14 752521d698Sbellard #define TARGET_IOC_DIRBITS 2 762521d698Sbellard 772521d698Sbellard #define TARGET_IOC_NONE 0U 782521d698Sbellard #define TARGET_IOC_WRITE 1U 792521d698Sbellard #define TARGET_IOC_READ 2U 802521d698Sbellard 81048f6b4dSbellard #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ 82b779e29eSEdgar E. Iglesias defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \ 83b779e29eSEdgar E. Iglesias defined(TARGET_MIPS) 842521d698Sbellard 852521d698Sbellard #define TARGET_IOC_SIZEBITS 13 862521d698Sbellard #define TARGET_IOC_DIRBITS 3 872521d698Sbellard 882521d698Sbellard #define TARGET_IOC_NONE 1U 892521d698Sbellard #define TARGET_IOC_READ 2U 902521d698Sbellard #define TARGET_IOC_WRITE 4U 912521d698Sbellard 922521d698Sbellard #else 932521d698Sbellard #error unsupported CPU 942521d698Sbellard #endif 952521d698Sbellard 962521d698Sbellard #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) 972521d698Sbellard #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) 982521d698Sbellard #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) 992521d698Sbellard #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) 1002521d698Sbellard 1012521d698Sbellard #define TARGET_IOC_NRSHIFT 0 1022521d698Sbellard #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) 1032521d698Sbellard #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) 1042521d698Sbellard #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) 1052521d698Sbellard 1062521d698Sbellard #define TARGET_IOC(dir,type,nr,size) \ 1072521d698Sbellard (((dir) << TARGET_IOC_DIRSHIFT) | \ 1082521d698Sbellard ((type) << TARGET_IOC_TYPESHIFT) | \ 1092521d698Sbellard ((nr) << TARGET_IOC_NRSHIFT) | \ 1102521d698Sbellard ((size) << TARGET_IOC_SIZESHIFT)) 1112521d698Sbellard 1122521d698Sbellard /* used to create numbers */ 1132521d698Sbellard #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) 1142521d698Sbellard #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) 1152521d698Sbellard #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1162521d698Sbellard #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 1172521d698Sbellard 1182521d698Sbellard /* the size is automatically computed for these defines */ 1192521d698Sbellard #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) 1202521d698Sbellard #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1212521d698Sbellard #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1222521d698Sbellard 1237854b056Sbellard struct target_sockaddr { 1247854b056Sbellard uint16_t sa_family; 1257854b056Sbellard uint8_t sa_data[14]; 1267854b056Sbellard }; 1277854b056Sbellard 12833a29b51SJoakim Tjernlund struct target_sockaddr_ll { 12933a29b51SJoakim Tjernlund uint16_t sll_family; /* Always AF_PACKET */ 13033a29b51SJoakim Tjernlund uint16_t sll_protocol; /* Physical layer protocol */ 13133a29b51SJoakim Tjernlund int sll_ifindex; /* Interface number */ 13233a29b51SJoakim Tjernlund uint16_t sll_hatype; /* ARP hardware type */ 13333a29b51SJoakim Tjernlund uint8_t sll_pkttype; /* Packet type */ 13433a29b51SJoakim Tjernlund uint8_t sll_halen; /* Length of address */ 13533a29b51SJoakim Tjernlund uint8_t sll_addr[8]; /* Physical layer address */ 13633a29b51SJoakim Tjernlund }; 13733a29b51SJoakim Tjernlund 138f57d4192SLaurent Vivier struct target_sock_filter { 139f57d4192SLaurent Vivier abi_ushort code; 140f57d4192SLaurent Vivier uint8_t jt; 141f57d4192SLaurent Vivier uint8_t jf; 142f57d4192SLaurent Vivier abi_uint k; 143f57d4192SLaurent Vivier }; 144f57d4192SLaurent Vivier 145f57d4192SLaurent Vivier struct target_sock_fprog { 146f57d4192SLaurent Vivier abi_ushort len; 147f57d4192SLaurent Vivier abi_ulong filter; 148f57d4192SLaurent Vivier }; 149f57d4192SLaurent Vivier 150b975b83bSLionel Landwerlin struct target_in_addr { 151b975b83bSLionel Landwerlin uint32_t s_addr; /* big endian */ 152b975b83bSLionel Landwerlin }; 153b975b83bSLionel Landwerlin 154b975b83bSLionel Landwerlin struct target_ip_mreq { 155b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 156b975b83bSLionel Landwerlin struct target_in_addr imr_address; 157b975b83bSLionel Landwerlin }; 158b975b83bSLionel Landwerlin 159b975b83bSLionel Landwerlin struct target_ip_mreqn { 160b975b83bSLionel Landwerlin struct target_in_addr imr_multiaddr; 161b975b83bSLionel Landwerlin struct target_in_addr imr_address; 162b975b83bSLionel Landwerlin abi_long imr_ifindex; 163b975b83bSLionel Landwerlin }; 164b975b83bSLionel Landwerlin 1656e3cb58fSLionel Landwerlin struct target_ip_mreq_source { 1666e3cb58fSLionel Landwerlin /* big endian */ 1676e3cb58fSLionel Landwerlin uint32_t imr_multiaddr; 1686e3cb58fSLionel Landwerlin uint32_t imr_interface; 1696e3cb58fSLionel Landwerlin uint32_t imr_sourceaddr; 1706e3cb58fSLionel Landwerlin }; 1716e3cb58fSLionel Landwerlin 17231e31b8aSbellard struct target_timeval { 173992f48a0Sblueswir1 abi_long tv_sec; 174992f48a0Sblueswir1 abi_long tv_usec; 17531e31b8aSbellard }; 17631e31b8aSbellard 1771b6b029eSbellard struct target_timespec { 178992f48a0Sblueswir1 abi_long tv_sec; 179992f48a0Sblueswir1 abi_long tv_nsec; 1801b6b029eSbellard }; 1811b6b029eSbellard 182ef4467e9SPaul Burton struct target_timezone { 183ef4467e9SPaul Burton abi_int tz_minuteswest; 184ef4467e9SPaul Burton abi_int tz_dsttime; 185ef4467e9SPaul Burton }; 186ef4467e9SPaul Burton 18766fb9763Sbellard struct target_itimerval { 18866fb9763Sbellard struct target_timeval it_interval; 18966fb9763Sbellard struct target_timeval it_value; 19066fb9763Sbellard }; 19166fb9763Sbellard 192905bba13SErik de Castro Lopo struct target_itimerspec { 193905bba13SErik de Castro Lopo struct target_timespec it_interval; 194905bba13SErik de Castro Lopo struct target_timespec it_value; 195905bba13SErik de Castro Lopo }; 196905bba13SErik de Castro Lopo 197c227f099SAnthony Liguori typedef abi_long target_clock_t; 19832f36bceSbellard 199c596ed17Sbellard #define TARGET_HZ 100 200c596ed17Sbellard 20132f36bceSbellard struct target_tms { 202c227f099SAnthony Liguori target_clock_t tms_utime; 203c227f099SAnthony Liguori target_clock_t tms_stime; 204c227f099SAnthony Liguori target_clock_t tms_cutime; 205c227f099SAnthony Liguori target_clock_t tms_cstime; 20632f36bceSbellard }; 20732f36bceSbellard 2086180a181Sbellard struct target_utimbuf { 209992f48a0Sblueswir1 abi_long actime; 210992f48a0Sblueswir1 abi_long modtime; 2116180a181Sbellard }; 2126180a181Sbellard 213f2674e31Sbellard struct target_sel_arg_struct { 214992f48a0Sblueswir1 abi_long n; 215992f48a0Sblueswir1 abi_long inp, outp, exp; 216992f48a0Sblueswir1 abi_long tvp; 217f2674e31Sbellard }; 218f2674e31Sbellard 21931e31b8aSbellard struct target_iovec { 220992f48a0Sblueswir1 abi_long iov_base; /* Starting address */ 221992f48a0Sblueswir1 abi_long iov_len; /* Number of bytes */ 22231e31b8aSbellard }; 22331e31b8aSbellard 2241a9353d2Sbellard struct target_msghdr { 225992f48a0Sblueswir1 abi_long msg_name; /* Socket name */ 2261a9353d2Sbellard int msg_namelen; /* Length of name */ 227992f48a0Sblueswir1 abi_long msg_iov; /* Data blocks */ 228992f48a0Sblueswir1 abi_long msg_iovlen; /* Number of blocks */ 229992f48a0Sblueswir1 abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ 230992f48a0Sblueswir1 abi_long msg_controllen; /* Length of cmsg list */ 2311a9353d2Sbellard unsigned int msg_flags; 2321a9353d2Sbellard }; 2331a9353d2Sbellard 2347854b056Sbellard struct target_cmsghdr { 235992f48a0Sblueswir1 abi_long cmsg_len; 2367854b056Sbellard int cmsg_level; 2377854b056Sbellard int cmsg_type; 2387854b056Sbellard }; 2397854b056Sbellard 2407854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) 241ee104587SJonathan Neuschäfer #define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \ 242ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start) 243992f48a0Sblueswir1 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ 244992f48a0Sblueswir1 & (size_t) ~(sizeof (abi_long) - 1)) 2457854b056Sbellard #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \ 2467854b056Sbellard + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr))) 2477854b056Sbellard #define TARGET_CMSG_LEN(len) (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len)) 2487854b056Sbellard 2497854b056Sbellard static __inline__ struct target_cmsghdr * 250ee104587SJonathan Neuschäfer __target_cmsg_nxthdr(struct target_msghdr *__mhdr, 251ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg, 252ee104587SJonathan Neuschäfer struct target_cmsghdr *__cmsg_start) 2537854b056Sbellard { 2542b8bdefcSths struct target_cmsghdr *__ptr; 2557854b056Sbellard 2562b8bdefcSths __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg 257cbb21eedSMatthias Braun + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len))); 258ee104587SJonathan Neuschäfer if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start) 259ee104587SJonathan Neuschäfer > tswapal(__mhdr->msg_controllen)) { 2607854b056Sbellard /* No more entries. */ 2612b8bdefcSths return (struct target_cmsghdr *)0; 262ee104587SJonathan Neuschäfer } 263ee104587SJonathan Neuschäfer return __ptr; 2647854b056Sbellard } 2657854b056Sbellard 266f19e00d7SAlexander Graf struct target_mmsghdr { 267f19e00d7SAlexander Graf struct target_msghdr msg_hdr; /* Message header */ 268f19e00d7SAlexander Graf unsigned int msg_len; /* Number of bytes transmitted */ 269f19e00d7SAlexander Graf }; 2707854b056Sbellard 27131e31b8aSbellard struct target_rusage { 27231e31b8aSbellard struct target_timeval ru_utime; /* user time used */ 27331e31b8aSbellard struct target_timeval ru_stime; /* system time used */ 274992f48a0Sblueswir1 abi_long ru_maxrss; /* maximum resident set size */ 275992f48a0Sblueswir1 abi_long ru_ixrss; /* integral shared memory size */ 276992f48a0Sblueswir1 abi_long ru_idrss; /* integral unshared data size */ 277992f48a0Sblueswir1 abi_long ru_isrss; /* integral unshared stack size */ 278992f48a0Sblueswir1 abi_long ru_minflt; /* page reclaims */ 279992f48a0Sblueswir1 abi_long ru_majflt; /* page faults */ 280992f48a0Sblueswir1 abi_long ru_nswap; /* swaps */ 281992f48a0Sblueswir1 abi_long ru_inblock; /* block input operations */ 282992f48a0Sblueswir1 abi_long ru_oublock; /* block output operations */ 283992f48a0Sblueswir1 abi_long ru_msgsnd; /* messages sent */ 284992f48a0Sblueswir1 abi_long ru_msgrcv; /* messages received */ 285992f48a0Sblueswir1 abi_long ru_nsignals; /* signals received */ 286992f48a0Sblueswir1 abi_long ru_nvcsw; /* voluntary context switches */ 287992f48a0Sblueswir1 abi_long ru_nivcsw; /* involuntary " */ 28831e31b8aSbellard }; 28931e31b8aSbellard 29031e31b8aSbellard typedef struct { 29131e31b8aSbellard int val[2]; 292c227f099SAnthony Liguori } kernel_fsid_t; 29331e31b8aSbellard 29472f03900Sbellard struct kernel_statfs { 29531e31b8aSbellard int f_type; 29631e31b8aSbellard int f_bsize; 29731e31b8aSbellard int f_blocks; 29831e31b8aSbellard int f_bfree; 29931e31b8aSbellard int f_bavail; 30031e31b8aSbellard int f_files; 30131e31b8aSbellard int f_ffree; 302c227f099SAnthony Liguori kernel_fsid_t f_fsid; 30331e31b8aSbellard int f_namelen; 30431e31b8aSbellard int f_spare[6]; 30531e31b8aSbellard }; 30631e31b8aSbellard 307dab2ed99Sbellard struct target_dirent { 308992f48a0Sblueswir1 abi_long d_ino; 309992f48a0Sblueswir1 abi_long d_off; 310dab2ed99Sbellard unsigned short d_reclen; 311333858b7SDmitry V. Levin char d_name[]; 312dab2ed99Sbellard }; 313dab2ed99Sbellard 314dab2ed99Sbellard struct target_dirent64 { 315dab2ed99Sbellard uint64_t d_ino; 316dab2ed99Sbellard int64_t d_off; 317dab2ed99Sbellard unsigned short d_reclen; 318dab2ed99Sbellard unsigned char d_type; 319dab2ed99Sbellard char d_name[256]; 320dab2ed99Sbellard }; 321dab2ed99Sbellard 322dab2ed99Sbellard 32331e31b8aSbellard /* mostly generic signal stuff */ 324992f48a0Sblueswir1 #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ 325992f48a0Sblueswir1 #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ 326992f48a0Sblueswir1 #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ 32731e31b8aSbellard 32831e31b8aSbellard #ifdef TARGET_MIPS 32931e31b8aSbellard #define TARGET_NSIG 128 33031e31b8aSbellard #else 33131e31b8aSbellard #define TARGET_NSIG 64 33231e31b8aSbellard #endif 333992f48a0Sblueswir1 #define TARGET_NSIG_BPW TARGET_ABI_BITS 33431e31b8aSbellard #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) 33531e31b8aSbellard 33631e31b8aSbellard typedef struct { 337992f48a0Sblueswir1 abi_ulong sig[TARGET_NSIG_WORDS]; 338c227f099SAnthony Liguori } target_sigset_t; 33931e31b8aSbellard 34066fb9763Sbellard #ifdef BSWAP_NEEDED 341c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 34266fb9763Sbellard { 34366fb9763Sbellard int i; 34466fb9763Sbellard for(i = 0;i < TARGET_NSIG_WORDS; i++) 345cbb21eedSMatthias Braun d->sig[i] = tswapal(s->sig[i]); 34666fb9763Sbellard } 34766fb9763Sbellard #else 348c227f099SAnthony Liguori static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 34966fb9763Sbellard { 35066fb9763Sbellard *d = *s; 35166fb9763Sbellard } 35266fb9763Sbellard #endif 35366fb9763Sbellard 354c227f099SAnthony Liguori static inline void target_siginitset(target_sigset_t *d, abi_ulong set) 35566fb9763Sbellard { 35666fb9763Sbellard int i; 35766fb9763Sbellard d->sig[0] = set; 35866fb9763Sbellard for(i = 1;i < TARGET_NSIG_WORDS; i++) 35966fb9763Sbellard d->sig[i] = 0; 36066fb9763Sbellard } 36166fb9763Sbellard 362c227f099SAnthony Liguori void host_to_target_sigset(target_sigset_t *d, const sigset_t *s); 363c227f099SAnthony Liguori void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); 364992f48a0Sblueswir1 void host_to_target_old_sigset(abi_ulong *old_sigset, 36566fb9763Sbellard const sigset_t *sigset); 36666fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset, 367992f48a0Sblueswir1 const abi_ulong *old_sigset); 36866fb9763Sbellard struct target_sigaction; 36966fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act, 37066fb9763Sbellard struct target_sigaction *oact); 37166fb9763Sbellard 372d2fbca94SGuan Xuetao #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \ 373d2fbca94SGuan Xuetao || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined(TARGET_SH4) \ 374d2fbca94SGuan Xuetao || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) \ 375a4c075f1SUlrich Hecht || defined(TARGET_MICROBLAZE) || defined(TARGET_UNICORE32) \ 376b16189b2SChen Gang || defined(TARGET_S390X) || defined(TARGET_OPENRISC) \ 377b16189b2SChen Gang || defined(TARGET_TILEGX) 3782521d698Sbellard 379048f6b4dSbellard #if defined(TARGET_SPARC) 380048f6b4dSbellard #define TARGET_SA_NOCLDSTOP 8u 381048f6b4dSbellard #define TARGET_SA_NOCLDWAIT 0x100u 382048f6b4dSbellard #define TARGET_SA_SIGINFO 0x200u 383048f6b4dSbellard #define TARGET_SA_ONSTACK 1u 384048f6b4dSbellard #define TARGET_SA_RESTART 2u 385048f6b4dSbellard #define TARGET_SA_NODEFER 0x20u 386048f6b4dSbellard #define TARGET_SA_RESETHAND 4u 387048f6b4dSbellard #elif defined(TARGET_MIPS) 388048f6b4dSbellard #define TARGET_SA_NOCLDSTOP 0x00000001 389048f6b4dSbellard #define TARGET_SA_NOCLDWAIT 0x00010000 390048f6b4dSbellard #define TARGET_SA_SIGINFO 0x00000008 391048f6b4dSbellard #define TARGET_SA_ONSTACK 0x08000000 392048f6b4dSbellard #define TARGET_SA_NODEFER 0x40000000 393048f6b4dSbellard #define TARGET_SA_RESTART 0x10000000 394048f6b4dSbellard #define TARGET_SA_RESETHAND 0x80000000 395d26bc211Sths #if !defined(TARGET_ABI_MIPSN32) && !defined(TARGET_ABI_MIPSN64) 396d26bc211Sths #define TARGET_SA_RESTORER 0x04000000 /* Only for O32 */ 397540635baSths #endif 398d962783eSJia Liu #elif defined(TARGET_OPENRISC) 399d962783eSJia Liu #define TARGET_SA_NOCLDSTOP 0x00000001 400d962783eSJia Liu #define TARGET_SA_NOCLDWAIT 0x00000002 401d962783eSJia Liu #define TARGET_SA_SIGINFO 0x00000004 402d962783eSJia Liu #define TARGET_SA_ONSTACK 0x08000000 403d962783eSJia Liu #define TARGET_SA_RESTART 0x10000000 404d962783eSJia Liu #define TARGET_SA_NODEFER 0x40000000 405d962783eSJia Liu #define TARGET_SA_RESETHAND 0x80000000 40657f18a95SRichard Henderson #elif defined(TARGET_ALPHA) 40757f18a95SRichard Henderson #define TARGET_SA_ONSTACK 0x00000001 40857f18a95SRichard Henderson #define TARGET_SA_RESTART 0x00000002 40957f18a95SRichard Henderson #define TARGET_SA_NOCLDSTOP 0x00000004 41057f18a95SRichard Henderson #define TARGET_SA_NODEFER 0x00000008 41157f18a95SRichard Henderson #define TARGET_SA_RESETHAND 0x00000010 41257f18a95SRichard Henderson #define TARGET_SA_NOCLDWAIT 0x00000020 /* not supported yet */ 41357f18a95SRichard Henderson #define TARGET_SA_SIGINFO 0x00000040 414048f6b4dSbellard #else 4152521d698Sbellard #define TARGET_SA_NOCLDSTOP 0x00000001 4162521d698Sbellard #define TARGET_SA_NOCLDWAIT 0x00000002 /* not supported yet */ 4172521d698Sbellard #define TARGET_SA_SIGINFO 0x00000004 4182521d698Sbellard #define TARGET_SA_ONSTACK 0x08000000 4192521d698Sbellard #define TARGET_SA_RESTART 0x10000000 4202521d698Sbellard #define TARGET_SA_NODEFER 0x40000000 4212521d698Sbellard #define TARGET_SA_RESETHAND 0x80000000 4222521d698Sbellard #define TARGET_SA_RESTORER 0x04000000 4236d5e216dSbellard #endif 4246d5e216dSbellard 425d0f20495SRichard Henderson #if defined(TARGET_ALPHA) 426d0f20495SRichard Henderson 427d0f20495SRichard Henderson #define TARGET_SIGHUP 1 428d0f20495SRichard Henderson #define TARGET_SIGINT 2 429d0f20495SRichard Henderson #define TARGET_SIGQUIT 3 430d0f20495SRichard Henderson #define TARGET_SIGILL 4 431d0f20495SRichard Henderson #define TARGET_SIGTRAP 5 432d0f20495SRichard Henderson #define TARGET_SIGABRT 6 433d0f20495SRichard Henderson #define TARGET_SIGSTKFLT 7 /* actually SIGEMT */ 434d0f20495SRichard Henderson #define TARGET_SIGFPE 8 435d0f20495SRichard Henderson #define TARGET_SIGKILL 9 436d0f20495SRichard Henderson #define TARGET_SIGBUS 10 437d0f20495SRichard Henderson #define TARGET_SIGSEGV 11 438d0f20495SRichard Henderson #define TARGET_SIGSYS 12 439d0f20495SRichard Henderson #define TARGET_SIGPIPE 13 440d0f20495SRichard Henderson #define TARGET_SIGALRM 14 441d0f20495SRichard Henderson #define TARGET_SIGTERM 15 442d0f20495SRichard Henderson #define TARGET_SIGURG 16 443d0f20495SRichard Henderson #define TARGET_SIGSTOP 17 444d0f20495SRichard Henderson #define TARGET_SIGTSTP 18 445d0f20495SRichard Henderson #define TARGET_SIGCONT 19 446d0f20495SRichard Henderson #define TARGET_SIGCHLD 20 447d0f20495SRichard Henderson #define TARGET_SIGTTIN 21 448d0f20495SRichard Henderson #define TARGET_SIGTTOU 22 449d0f20495SRichard Henderson #define TARGET_SIGIO 23 450d0f20495SRichard Henderson #define TARGET_SIGXCPU 24 451d0f20495SRichard Henderson #define TARGET_SIGXFSZ 25 452d0f20495SRichard Henderson #define TARGET_SIGVTALRM 26 453d0f20495SRichard Henderson #define TARGET_SIGPROF 27 454d0f20495SRichard Henderson #define TARGET_SIGWINCH 28 455d0f20495SRichard Henderson #define TARGET_SIGPWR 29 /* actually SIGINFO */ 456d0f20495SRichard Henderson #define TARGET_SIGUSR1 30 457d0f20495SRichard Henderson #define TARGET_SIGUSR2 31 458d0f20495SRichard Henderson #define TARGET_SIGRTMIN 32 459d0f20495SRichard Henderson 460d0f20495SRichard Henderson #define TARGET_SIG_BLOCK 1 461d0f20495SRichard Henderson #define TARGET_SIG_UNBLOCK 2 462d0f20495SRichard Henderson #define TARGET_SIG_SETMASK 3 463d0f20495SRichard Henderson 464d0f20495SRichard Henderson #elif defined(TARGET_SPARC) 4656d5e216dSbellard 4666d5e216dSbellard #define TARGET_SIGHUP 1 4676d5e216dSbellard #define TARGET_SIGINT 2 4686d5e216dSbellard #define TARGET_SIGQUIT 3 4696d5e216dSbellard #define TARGET_SIGILL 4 4706d5e216dSbellard #define TARGET_SIGTRAP 5 4716d5e216dSbellard #define TARGET_SIGABRT 6 4726d5e216dSbellard #define TARGET_SIGIOT 6 4736d5e216dSbellard #define TARGET_SIGSTKFLT 7 /* actually EMT */ 4746d5e216dSbellard #define TARGET_SIGFPE 8 4756d5e216dSbellard #define TARGET_SIGKILL 9 4766d5e216dSbellard #define TARGET_SIGBUS 10 4776d5e216dSbellard #define TARGET_SIGSEGV 11 4786d5e216dSbellard #define TARGET_SIGSYS 12 4796d5e216dSbellard #define TARGET_SIGPIPE 13 4806d5e216dSbellard #define TARGET_SIGALRM 14 4816d5e216dSbellard #define TARGET_SIGTERM 15 4826d5e216dSbellard #define TARGET_SIGURG 16 4836d5e216dSbellard #define TARGET_SIGSTOP 17 4846d5e216dSbellard #define TARGET_SIGTSTP 18 4856d5e216dSbellard #define TARGET_SIGCONT 19 4866d5e216dSbellard #define TARGET_SIGCHLD 20 4876d5e216dSbellard #define TARGET_SIGTTIN 21 4886d5e216dSbellard #define TARGET_SIGTTOU 22 4896d5e216dSbellard #define TARGET_SIGIO 23 4906d5e216dSbellard #define TARGET_SIGXCPU 24 4916d5e216dSbellard #define TARGET_SIGXFSZ 25 4926d5e216dSbellard #define TARGET_SIGVTALRM 26 4936d5e216dSbellard #define TARGET_SIGPROF 27 4946d5e216dSbellard #define TARGET_SIGWINCH 28 4956d5e216dSbellard #define TARGET_SIGPWR 29 4966d5e216dSbellard #define TARGET_SIGUSR1 30 4976d5e216dSbellard #define TARGET_SIGUSR2 31 4986d5e216dSbellard #define TARGET_SIGRTMIN 32 4996d5e216dSbellard 5006d5e216dSbellard #define TARGET_SIG_BLOCK 0x01 /* for blocking signals */ 5016d5e216dSbellard #define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */ 5026d5e216dSbellard #define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */ 5036d5e216dSbellard 504048f6b4dSbellard #elif defined(TARGET_MIPS) 505048f6b4dSbellard 506048f6b4dSbellard #define TARGET_SIGHUP 1 /* Hangup (POSIX). */ 507048f6b4dSbellard #define TARGET_SIGINT 2 /* Interrupt (ANSI). */ 508048f6b4dSbellard #define TARGET_SIGQUIT 3 /* Quit (POSIX). */ 509048f6b4dSbellard #define TARGET_SIGILL 4 /* Illegal instruction (ANSI). */ 510048f6b4dSbellard #define TARGET_SIGTRAP 5 /* Trace trap (POSIX). */ 511048f6b4dSbellard #define TARGET_SIGIOT 6 /* IOT trap (4.2 BSD). */ 512048f6b4dSbellard #define TARGET_SIGABRT TARGET_SIGIOT /* Abort (ANSI). */ 513048f6b4dSbellard #define TARGET_SIGEMT 7 514048f6b4dSbellard #define TARGET_SIGSTKFLT 7 /* XXX: incorrect */ 515048f6b4dSbellard #define TARGET_SIGFPE 8 /* Floating-point exception (ANSI). */ 516048f6b4dSbellard #define TARGET_SIGKILL 9 /* Kill, unblockable (POSIX). */ 517048f6b4dSbellard #define TARGET_SIGBUS 10 /* BUS error (4.2 BSD). */ 518048f6b4dSbellard #define TARGET_SIGSEGV 11 /* Segmentation violation (ANSI). */ 519048f6b4dSbellard #define TARGET_SIGSYS 12 520048f6b4dSbellard #define TARGET_SIGPIPE 13 /* Broken pipe (POSIX). */ 521048f6b4dSbellard #define TARGET_SIGALRM 14 /* Alarm clock (POSIX). */ 522048f6b4dSbellard #define TARGET_SIGTERM 15 /* Termination (ANSI). */ 523048f6b4dSbellard #define TARGET_SIGUSR1 16 /* User-defined signal 1 (POSIX). */ 524048f6b4dSbellard #define TARGET_SIGUSR2 17 /* User-defined signal 2 (POSIX). */ 525048f6b4dSbellard #define TARGET_SIGCHLD 18 /* Child status has changed (POSIX). */ 526048f6b4dSbellard #define TARGET_SIGCLD TARGET_SIGCHLD /* Same as TARGET_SIGCHLD (System V). */ 527048f6b4dSbellard #define TARGET_SIGPWR 19 /* Power failure restart (System V). */ 528048f6b4dSbellard #define TARGET_SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */ 529048f6b4dSbellard #define TARGET_SIGURG 21 /* Urgent condition on socket (4.2 BSD). */ 530048f6b4dSbellard #define TARGET_SIGIO 22 /* I/O now possible (4.2 BSD). */ 531048f6b4dSbellard #define TARGET_SIGPOLL TARGET_SIGIO /* Pollable event occurred (System V). */ 532048f6b4dSbellard #define TARGET_SIGSTOP 23 /* Stop, unblockable (POSIX). */ 533048f6b4dSbellard #define TARGET_SIGTSTP 24 /* Keyboard stop (POSIX). */ 534048f6b4dSbellard #define TARGET_SIGCONT 25 /* Continue (POSIX). */ 535048f6b4dSbellard #define TARGET_SIGTTIN 26 /* Background read from tty (POSIX). */ 536048f6b4dSbellard #define TARGET_SIGTTOU 27 /* Background write to tty (POSIX). */ 537048f6b4dSbellard #define TARGET_SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */ 538048f6b4dSbellard #define TARGET_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */ 539048f6b4dSbellard #define TARGET_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ 540048f6b4dSbellard #define TARGET_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ 541048f6b4dSbellard #define TARGET_SIGRTMIN 32 542048f6b4dSbellard 543048f6b4dSbellard #define TARGET_SIG_BLOCK 1 /* for blocking signals */ 544048f6b4dSbellard #define TARGET_SIG_UNBLOCK 2 /* for unblocking signals */ 545048f6b4dSbellard #define TARGET_SIG_SETMASK 3 /* for setting the signal mask */ 546048f6b4dSbellard 5476d5e216dSbellard #else 5482521d698Sbellard 549d962783eSJia Liu /* OpenRISC Using the general signals */ 5502521d698Sbellard #define TARGET_SIGHUP 1 5512521d698Sbellard #define TARGET_SIGINT 2 5522521d698Sbellard #define TARGET_SIGQUIT 3 5532521d698Sbellard #define TARGET_SIGILL 4 5542521d698Sbellard #define TARGET_SIGTRAP 5 5552521d698Sbellard #define TARGET_SIGABRT 6 5562521d698Sbellard #define TARGET_SIGIOT 6 5572521d698Sbellard #define TARGET_SIGBUS 7 5582521d698Sbellard #define TARGET_SIGFPE 8 5592521d698Sbellard #define TARGET_SIGKILL 9 5602521d698Sbellard #define TARGET_SIGUSR1 10 5612521d698Sbellard #define TARGET_SIGSEGV 11 5622521d698Sbellard #define TARGET_SIGUSR2 12 5632521d698Sbellard #define TARGET_SIGPIPE 13 5642521d698Sbellard #define TARGET_SIGALRM 14 5652521d698Sbellard #define TARGET_SIGTERM 15 5662521d698Sbellard #define TARGET_SIGSTKFLT 16 5672521d698Sbellard #define TARGET_SIGCHLD 17 5682521d698Sbellard #define TARGET_SIGCONT 18 5692521d698Sbellard #define TARGET_SIGSTOP 19 5702521d698Sbellard #define TARGET_SIGTSTP 20 5712521d698Sbellard #define TARGET_SIGTTIN 21 5722521d698Sbellard #define TARGET_SIGTTOU 22 5732521d698Sbellard #define TARGET_SIGURG 23 5742521d698Sbellard #define TARGET_SIGXCPU 24 5752521d698Sbellard #define TARGET_SIGXFSZ 25 5762521d698Sbellard #define TARGET_SIGVTALRM 26 5772521d698Sbellard #define TARGET_SIGPROF 27 5782521d698Sbellard #define TARGET_SIGWINCH 28 5792521d698Sbellard #define TARGET_SIGIO 29 580c596ed17Sbellard #define TARGET_SIGPWR 30 581c596ed17Sbellard #define TARGET_SIGSYS 31 5822521d698Sbellard #define TARGET_SIGRTMIN 32 5832521d698Sbellard 5842521d698Sbellard #define TARGET_SIG_BLOCK 0 /* for blocking signals */ 5852521d698Sbellard #define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */ 5862521d698Sbellard #define TARGET_SIG_SETMASK 2 /* for setting the signal mask */ 5872521d698Sbellard 5886d5e216dSbellard #endif 5896d5e216dSbellard 5906049f4f8SRichard Henderson #if defined(TARGET_ALPHA) 5916049f4f8SRichard Henderson struct target_old_sigaction { 5926049f4f8SRichard Henderson abi_ulong _sa_handler; 5936049f4f8SRichard Henderson abi_ulong sa_mask; 594d2565875SRichard Henderson int32_t sa_flags; 5956049f4f8SRichard Henderson }; 596106ec879Sbellard 5976049f4f8SRichard Henderson struct target_rt_sigaction { 5986049f4f8SRichard Henderson abi_ulong _sa_handler; 5996049f4f8SRichard Henderson abi_ulong sa_flags; 6006049f4f8SRichard Henderson target_sigset_t sa_mask; 6016049f4f8SRichard Henderson }; 6026049f4f8SRichard Henderson 6036049f4f8SRichard Henderson /* This is the struct used inside the kernel. The ka_restorer 6046049f4f8SRichard Henderson field comes from the 5th argument to sys_rt_sigaction. */ 6056049f4f8SRichard Henderson struct target_sigaction { 6066049f4f8SRichard Henderson abi_ulong _sa_handler; 6076049f4f8SRichard Henderson abi_ulong sa_flags; 6086049f4f8SRichard Henderson target_sigset_t sa_mask; 6096049f4f8SRichard Henderson abi_ulong sa_restorer; 6106049f4f8SRichard Henderson }; 6116049f4f8SRichard Henderson #elif defined(TARGET_MIPS) 612106ec879Sbellard struct target_sigaction { 613540635baSths uint32_t sa_flags; 614d26bc211Sths #if defined(TARGET_ABI_MIPSN32) 615540635baSths uint32_t _sa_handler; 616540635baSths #else 617992f48a0Sblueswir1 abi_ulong _sa_handler; 618540635baSths #endif 619c227f099SAnthony Liguori target_sigset_t sa_mask; 620106ec879Sbellard }; 621106ec879Sbellard #else 6222521d698Sbellard struct target_old_sigaction { 623992f48a0Sblueswir1 abi_ulong _sa_handler; 624992f48a0Sblueswir1 abi_ulong sa_mask; 625992f48a0Sblueswir1 abi_ulong sa_flags; 626992f48a0Sblueswir1 abi_ulong sa_restorer; 6272521d698Sbellard }; 6282521d698Sbellard 6292521d698Sbellard struct target_sigaction { 630992f48a0Sblueswir1 abi_ulong _sa_handler; 631992f48a0Sblueswir1 abi_ulong sa_flags; 632992f48a0Sblueswir1 abi_ulong sa_restorer; 633c227f099SAnthony Liguori target_sigset_t sa_mask; 6342521d698Sbellard }; 635106ec879Sbellard #endif 6362521d698Sbellard 6372521d698Sbellard typedef union target_sigval { 6382521d698Sbellard int sival_int; 639992f48a0Sblueswir1 abi_ulong sival_ptr; 640c227f099SAnthony Liguori } target_sigval_t; 6416d5e216dSbellard #if 0 6426d5e216dSbellard #if defined (TARGET_SPARC) 6436d5e216dSbellard typedef struct { 6446d5e216dSbellard struct { 645992f48a0Sblueswir1 abi_ulong psr; 646992f48a0Sblueswir1 abi_ulong pc; 647992f48a0Sblueswir1 abi_ulong npc; 648992f48a0Sblueswir1 abi_ulong y; 649992f48a0Sblueswir1 abi_ulong u_regs[16]; /* globals and ins */ 6506d5e216dSbellard } si_regs; 6516d5e216dSbellard int si_mask; 6526d5e216dSbellard } __siginfo_t; 6536d5e216dSbellard 6546d5e216dSbellard typedef struct { 6556d5e216dSbellard unsigned long si_float_regs [32]; 6566d5e216dSbellard unsigned long si_fsr; 6576d5e216dSbellard unsigned long si_fpqdepth; 6586d5e216dSbellard struct { 6596d5e216dSbellard unsigned long *insn_addr; 6606d5e216dSbellard unsigned long insn; 6616d5e216dSbellard } si_fpqueue [16]; 6626d5e216dSbellard } __siginfo_fpu_t; 6636d5e216dSbellard #endif 6646d5e216dSbellard #endif 6652521d698Sbellard 6662521d698Sbellard #define TARGET_SI_MAX_SIZE 128 667aa5e03d2SMaxim Ostapenko 668aa5e03d2SMaxim Ostapenko #if TARGET_ABI_BITS == 32 669aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int)) 670aa5e03d2SMaxim Ostapenko #else 671aa5e03d2SMaxim Ostapenko #define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int)) 672aa5e03d2SMaxim Ostapenko #endif 673aa5e03d2SMaxim Ostapenko 674aa5e03d2SMaxim Ostapenko #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int)) 6752521d698Sbellard 676*a70dadc7SPeter Maydell /* Within QEMU the top 16 bits of si_code indicate which of the parts of 677*a70dadc7SPeter Maydell * the union in target_siginfo is valid. This only applies between 678*a70dadc7SPeter Maydell * host_to_target_siginfo_noswap() and tswap_siginfo(); it does not 679*a70dadc7SPeter Maydell * appear either within host siginfo_t or in target_siginfo structures 680*a70dadc7SPeter Maydell * which we get from the guest userspace program. (The Linux kernel 681*a70dadc7SPeter Maydell * does a similar thing with using the top bits for its own internal 682*a70dadc7SPeter Maydell * purposes but not letting them be visible to userspace.) 683*a70dadc7SPeter Maydell */ 684*a70dadc7SPeter Maydell #define QEMU_SI_KILL 0 685*a70dadc7SPeter Maydell #define QEMU_SI_TIMER 1 686*a70dadc7SPeter Maydell #define QEMU_SI_POLL 2 687*a70dadc7SPeter Maydell #define QEMU_SI_FAULT 3 688*a70dadc7SPeter Maydell #define QEMU_SI_CHLD 4 689*a70dadc7SPeter Maydell #define QEMU_SI_RT 5 690*a70dadc7SPeter Maydell 6912521d698Sbellard typedef struct target_siginfo { 6923f53d546Spbrook #ifdef TARGET_MIPS 6933f53d546Spbrook int si_signo; 6943f53d546Spbrook int si_code; 6953f53d546Spbrook int si_errno; 6963f53d546Spbrook #else 6972521d698Sbellard int si_signo; 6982521d698Sbellard int si_errno; 6992521d698Sbellard int si_code; 7003f53d546Spbrook #endif 7012521d698Sbellard 7022521d698Sbellard union { 7032521d698Sbellard int _pad[TARGET_SI_PAD_SIZE]; 7042521d698Sbellard 7052521d698Sbellard /* kill() */ 7062521d698Sbellard struct { 7072521d698Sbellard pid_t _pid; /* sender's pid */ 7082521d698Sbellard uid_t _uid; /* sender's uid */ 7092521d698Sbellard } _kill; 7102521d698Sbellard 7112521d698Sbellard /* POSIX.1b timers */ 7122521d698Sbellard struct { 7132521d698Sbellard unsigned int _timer1; 7142521d698Sbellard unsigned int _timer2; 7152521d698Sbellard } _timer; 7162521d698Sbellard 7172521d698Sbellard /* POSIX.1b signals */ 7182521d698Sbellard struct { 7192521d698Sbellard pid_t _pid; /* sender's pid */ 7202521d698Sbellard uid_t _uid; /* sender's uid */ 721c227f099SAnthony Liguori target_sigval_t _sigval; 7222521d698Sbellard } _rt; 7232521d698Sbellard 7242521d698Sbellard /* SIGCHLD */ 7252521d698Sbellard struct { 7262521d698Sbellard pid_t _pid; /* which child */ 7272521d698Sbellard uid_t _uid; /* sender's uid */ 7282521d698Sbellard int _status; /* exit code */ 729c227f099SAnthony Liguori target_clock_t _utime; 730c227f099SAnthony Liguori target_clock_t _stime; 7312521d698Sbellard } _sigchld; 7322521d698Sbellard 7332521d698Sbellard /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 7342521d698Sbellard struct { 735992f48a0Sblueswir1 abi_ulong _addr; /* faulting insn/memory ref. */ 7362521d698Sbellard } _sigfault; 7372521d698Sbellard 7382521d698Sbellard /* SIGPOLL */ 7392521d698Sbellard struct { 7402521d698Sbellard int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 7412521d698Sbellard int _fd; 7422521d698Sbellard } _sigpoll; 7432521d698Sbellard } _sifields; 744c227f099SAnthony Liguori } target_siginfo_t; 7452521d698Sbellard 7462521d698Sbellard /* 7472521d698Sbellard * si_code values 7482521d698Sbellard * Digital reserves positive values for kernel-generated signals. 7492521d698Sbellard */ 7502521d698Sbellard #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ 7512521d698Sbellard #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 7522521d698Sbellard #define TARGET_SI_QUEUE -1 /* sent by sigqueue */ 7532521d698Sbellard #define TARGET_SI_TIMER -2 /* sent by timer expiration */ 7542521d698Sbellard #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ 7552521d698Sbellard #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ 7562521d698Sbellard #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ 7572521d698Sbellard 7582521d698Sbellard /* 7592521d698Sbellard * SIGILL si_codes 7602521d698Sbellard */ 761ffa65c3bSbellard #define TARGET_ILL_ILLOPC (1) /* illegal opcode */ 7622521d698Sbellard #define TARGET_ILL_ILLOPN (2) /* illegal operand */ 763ffa65c3bSbellard #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ 764ffa65c3bSbellard #define TARGET_ILL_ILLTRP (4) /* illegal trap */ 765ffa65c3bSbellard #define TARGET_ILL_PRVOPC (5) /* privileged opcode */ 766ffa65c3bSbellard #define TARGET_ILL_PRVREG (6) /* privileged register */ 767ffa65c3bSbellard #define TARGET_ILL_COPROC (7) /* coprocessor error */ 768ffa65c3bSbellard #define TARGET_ILL_BADSTK (8) /* internal stack error */ 769de2fdd56SChen Gang #ifdef TARGET_TILEGX 770de2fdd56SChen Gang #define TARGET_ILL_DBLFLT (9) /* double fault */ 771de2fdd56SChen Gang #define TARGET_ILL_HARDWALL (10) /* user networks hardwall violation */ 772de2fdd56SChen Gang #endif 7732521d698Sbellard 7742521d698Sbellard /* 7752521d698Sbellard * SIGFPE si_codes 7762521d698Sbellard */ 7772521d698Sbellard #define TARGET_FPE_INTDIV (1) /* integer divide by zero */ 7782521d698Sbellard #define TARGET_FPE_INTOVF (2) /* integer overflow */ 7792521d698Sbellard #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ 7802521d698Sbellard #define TARGET_FPE_FLTOVF (4) /* floating point overflow */ 7812521d698Sbellard #define TARGET_FPE_FLTUND (5) /* floating point underflow */ 7822521d698Sbellard #define TARGET_FPE_FLTRES (6) /* floating point inexact result */ 7832521d698Sbellard #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ 7842521d698Sbellard #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ 7852521d698Sbellard #define TARGET_NSIGFPE 8 7862521d698Sbellard 7872521d698Sbellard /* 7882521d698Sbellard * SIGSEGV si_codes 7892521d698Sbellard */ 7902521d698Sbellard #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ 7912521d698Sbellard #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ 792de2fdd56SChen Gang #define TARGET_SEGV_BNDERR (3) /* failed address bound checks */ 7932521d698Sbellard 7942521d698Sbellard /* 795ffa65c3bSbellard * SIGBUS si_codes 796ffa65c3bSbellard */ 797ffa65c3bSbellard #define TARGET_BUS_ADRALN (1) /* invalid address alignment */ 798b4916d7bSDong Xu Wang #define TARGET_BUS_ADRERR (2) /* non-existent physical address */ 799ffa65c3bSbellard #define TARGET_BUS_OBJERR (3) /* object specific hardware error */ 800de2fdd56SChen Gang /* hardware memory error consumed on a machine check: action required */ 801de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AR (4) 802de2fdd56SChen Gang /* hardware memory error detected in process but not consumed: action optional*/ 803de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AO (5) 804ffa65c3bSbellard 805ffa65c3bSbellard /* 8062521d698Sbellard * SIGTRAP si_codes 8072521d698Sbellard */ 8082521d698Sbellard #define TARGET_TRAP_BRKPT (1) /* process breakpoint */ 8092521d698Sbellard #define TARGET_TRAP_TRACE (2) /* process trace trap */ 810de2fdd56SChen Gang #define TARGET_TRAP_BRANCH (3) /* process taken branch trap */ 811de2fdd56SChen Gang #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */ 8122521d698Sbellard 8132521d698Sbellard #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */ 8142521d698Sbellard 8159de5e440Sbellard struct target_rlimit { 816992f48a0Sblueswir1 abi_ulong rlim_cur; 817992f48a0Sblueswir1 abi_ulong rlim_max; 8189de5e440Sbellard }; 8199de5e440Sbellard 82081bbe906Stakasi-y@ops.dti.ne.jp #if defined(TARGET_ALPHA) 821e476492eSAurelien Jarno #define TARGET_RLIM_INFINITY 0x7fffffffffffffffull 8226cafd027SMatthias Braun #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32) 82381bbe906Stakasi-y@ops.dti.ne.jp #define TARGET_RLIM_INFINITY 0x7fffffffUL 82481bbe906Stakasi-y@ops.dti.ne.jp #else 82526b746dbSMatthias Braun #define TARGET_RLIM_INFINITY ((abi_ulong)-1) 82681bbe906Stakasi-y@ops.dti.ne.jp #endif 82781bbe906Stakasi-y@ops.dti.ne.jp 828e22b7015SWesley W. Terpstra #if defined(TARGET_MIPS) 829e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 830e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 831e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 832e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 833e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 834e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 7 835e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 8 836e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 5 837e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 9 838e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 6 839e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 840e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 841e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 842e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 843e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 844e22b7015SWesley W. Terpstra #else 845e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 846e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 847e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 848e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 849e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 850e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 5 8516cafd027SMatthias Braun #if defined(TARGET_SPARC) 8526cafd027SMatthias Braun #define TARGET_RLIMIT_NOFILE 6 8536cafd027SMatthias Braun #define TARGET_RLIMIT_NPROC 7 8546cafd027SMatthias Braun #else 855e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 6 856e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 7 8576cafd027SMatthias Braun #endif 858e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 8 859e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 9 860e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 861e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 862e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 863e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 864e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 865e22b7015SWesley W. Terpstra #endif 866e22b7015SWesley W. Terpstra 8679de5e440Sbellard struct target_pollfd { 8689de5e440Sbellard int fd; /* file descriptor */ 8699de5e440Sbellard short events; /* requested events */ 8709de5e440Sbellard short revents; /* returned events */ 8719de5e440Sbellard }; 8729de5e440Sbellard 8738e5a0667Sbellard /* virtual terminal ioctls */ 8740221cfcdSbellard #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ 8750221cfcdSbellard #define TARGET_KDMKTONE 0x4B30 /* generate tone */ 8768e5a0667Sbellard #define TARGET_KDGKBTYPE 0x4b33 877f7680a55SUlrich Hecht #define TARGET_KDSETMODE 0x4b3a 878f7680a55SUlrich Hecht #define TARGET_KDGKBMODE 0x4b44 879f7680a55SUlrich Hecht #define TARGET_KDSKBMODE 0x4b45 8800221cfcdSbellard #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ 8810221cfcdSbellard #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ 882e6fe18fbSCédric VINCENT #define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ 883e6fe18fbSCédric VINCENT #define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ 884e6fe18fbSCédric VINCENT #define TARGET_KDGETLED 0x4B31 /* return current led state */ 885e6fe18fbSCédric VINCENT #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */ 886ca56f5b5SPaul Burton #define TARGET_KDSIGACCEPT 0x4B4E 8878e5a0667Sbellard 8882521d698Sbellard #define TARGET_SIOCATMARK 0x8905 8892521d698Sbellard 89031e31b8aSbellard /* Networking ioctls */ 89131e31b8aSbellard #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ 89231e31b8aSbellard #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ 89331e31b8aSbellard #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ 89431e31b8aSbellard #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ 89531e31b8aSbellard #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ 89631e31b8aSbellard #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ 89731e31b8aSbellard #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ 89831e31b8aSbellard #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ 89931e31b8aSbellard #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ 90031e31b8aSbellard #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ 90131e31b8aSbellard #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ 90231e31b8aSbellard #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ 90331e31b8aSbellard #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ 90431e31b8aSbellard #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ 90531e31b8aSbellard #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ 90631e31b8aSbellard #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ 90731e31b8aSbellard #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ 90831e31b8aSbellard #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ 90931e31b8aSbellard #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ 91031e31b8aSbellard #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ 91131e31b8aSbellard #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ 91231e31b8aSbellard #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ 91331e31b8aSbellard #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ 91431e31b8aSbellard #define TARGET_SIOCSIFENCAP 0x8926 91531e31b8aSbellard #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ 91631e31b8aSbellard #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ 91731e31b8aSbellard #define TARGET_SIOCSIFSLAVE 0x8930 91831e31b8aSbellard #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ 91931e31b8aSbellard #define TARGET_SIOCDELMULTI 0x8932 920f63eb01aSPaul Burton #define TARGET_SIOCGIFINDEX 0x8933 92131e31b8aSbellard 92231e31b8aSbellard /* Bridging control calls */ 92331e31b8aSbellard #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ 92431e31b8aSbellard #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ 92531e31b8aSbellard 92631e31b8aSbellard #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ 92731e31b8aSbellard #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ 92831e31b8aSbellard 92931e31b8aSbellard /* ARP cache control calls. */ 93031e31b8aSbellard #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ 93131e31b8aSbellard #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ 93231e31b8aSbellard #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ 93331e31b8aSbellard #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ 93431e31b8aSbellard #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ 93531e31b8aSbellard #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ 93631e31b8aSbellard 93731e31b8aSbellard /* RARP cache control calls. */ 93831e31b8aSbellard #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ 93931e31b8aSbellard #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ 94031e31b8aSbellard #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ 94131e31b8aSbellard 94231e31b8aSbellard /* Driver configuration calls */ 94331e31b8aSbellard #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ 94431e31b8aSbellard #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ 94531e31b8aSbellard 94631e31b8aSbellard /* DLCI configuration calls */ 94731e31b8aSbellard #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ 94831e31b8aSbellard #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ 94931e31b8aSbellard 95086fcd946SLaurent Vivier /* From <linux/wireless.h> */ 95186fcd946SLaurent Vivier 95286fcd946SLaurent Vivier #define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ 95331e31b8aSbellard 95431e31b8aSbellard /* From <linux/fs.h> */ 95531e31b8aSbellard 95631e31b8aSbellard #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ 95731e31b8aSbellard #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ 95831e31b8aSbellard #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ 95931e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ 96031e31b8aSbellard #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ 96131e31b8aSbellard #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ 96231e31b8aSbellard #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ 96331e31b8aSbellard #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ 96431e31b8aSbellard #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ 96531e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ 96631e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ 96731e31b8aSbellard #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ 968fff8c539SAndreas Färber #define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */ 96931e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */ 970c8b0bf54SPeter Maydell #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong) 971c8b0bf54SPeter Maydell #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong) 972edafea13SAlexander Graf #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) 973edafea13SAlexander Graf /* return device size in bytes 974edafea13SAlexander Graf (u64 *arg) */ 97531e31b8aSbellard #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ 97631e31b8aSbellard #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ 977285da2b9SPeter Maydell #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) 97831e31b8aSbellard 97931e31b8aSbellard /* cdrom commands */ 98031e31b8aSbellard #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ 98131e31b8aSbellard #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ 98231e31b8aSbellard #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ 98331e31b8aSbellard #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index 98431e31b8aSbellard (struct cdrom_ti) */ 98531e31b8aSbellard #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header 98631e31b8aSbellard (struct cdrom_tochdr) */ 98731e31b8aSbellard #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry 98831e31b8aSbellard (struct cdrom_tocentry) */ 98931e31b8aSbellard #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ 99031e31b8aSbellard #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ 99131e31b8aSbellard #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ 99231e31b8aSbellard #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume 99331e31b8aSbellard (struct cdrom_volctrl) */ 99431e31b8aSbellard #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data 99531e31b8aSbellard (struct cdrom_subchnl) */ 99631e31b8aSbellard #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) 99731e31b8aSbellard (struct cdrom_read) */ 99831e31b8aSbellard #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) 99931e31b8aSbellard (struct cdrom_read) */ 100031e31b8aSbellard #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ 100131e31b8aSbellard #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ 100231e31b8aSbellard #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session 100331e31b8aSbellard address of multi session disks 100431e31b8aSbellard (struct cdrom_multisession) */ 100531e31b8aSbellard #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" 100631e31b8aSbellard if available (struct cdrom_mcn) */ 100767cc32ebSVeres Lajos #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is deprecated, 1008b4916d7bSDong Xu Wang but here anyway for compatibility */ 100931e31b8aSbellard #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ 101031e31b8aSbellard #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting 101131e31b8aSbellard (struct cdrom_volctrl) */ 101231e31b8aSbellard #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) 101331e31b8aSbellard (struct cdrom_read) */ 101431e31b8aSbellard /* 101531e31b8aSbellard * These ioctls are used only used in aztcd.c and optcd.c 101631e31b8aSbellard */ 101731e31b8aSbellard #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ 101831e31b8aSbellard #define TARGET_CDROMSEEK 0x5316 /* seek msf address */ 101931e31b8aSbellard 102031e31b8aSbellard /* 102131e31b8aSbellard * This ioctl is only used by the scsi-cd driver. 102231e31b8aSbellard It is for playing audio in logical block addressing mode. 102331e31b8aSbellard */ 102431e31b8aSbellard #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ 102531e31b8aSbellard 102631e31b8aSbellard /* 102731e31b8aSbellard * These ioctls are only used in optcd.c 102831e31b8aSbellard */ 102931e31b8aSbellard #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ 103031e31b8aSbellard 103131e31b8aSbellard /* 103231e31b8aSbellard * These ioctls are (now) only in ide-cd.c for controlling 103331e31b8aSbellard * drive spindown time. They should be implemented in the 103431e31b8aSbellard * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, 103531e31b8aSbellard * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... 103631e31b8aSbellard * -Erik 103731e31b8aSbellard */ 103831e31b8aSbellard #define TARGET_CDROMGETSPINDOWN 0x531d 103931e31b8aSbellard #define TARGET_CDROMSETSPINDOWN 0x531e 104031e31b8aSbellard 104131e31b8aSbellard /* 104231e31b8aSbellard * These ioctls are implemented through the uniform CD-ROM driver 104331e31b8aSbellard * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM 104431e31b8aSbellard * drivers are eventually ported to the uniform CD-ROM driver interface. 104531e31b8aSbellard */ 104631e31b8aSbellard #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ 104731e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ 104831e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ 104931e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ 105031e31b8aSbellard #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ 105131e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ 105231e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ 105331e31b8aSbellard #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ 105431e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ 105531e31b8aSbellard #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ 105631e31b8aSbellard #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ 105731e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ 105831e31b8aSbellard 105931e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. 106031e31b8aSbellard * Future CDROM ioctls should be kept below 0x537F 106131e31b8aSbellard */ 106231e31b8aSbellard 106331e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */ 106431e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ 106531e31b8aSbellard /* conflict with SCSI_IOCTL_GET_IDLUN */ 106631e31b8aSbellard 106731e31b8aSbellard /* DVD-ROM Specific ioctls */ 106831e31b8aSbellard #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ 106931e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ 107031e31b8aSbellard #define TARGET_DVD_AUTH 0x5392 /* Authentication */ 107131e31b8aSbellard 107231e31b8aSbellard #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ 107331e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ 107431e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ 107531e31b8aSbellard 107631e31b8aSbellard /* HD commands */ 107731e31b8aSbellard 107831e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ 107931e31b8aSbellard #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ 108031e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ 108131e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ 108231e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ 108331e31b8aSbellard #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ 108431e31b8aSbellard #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ 108531e31b8aSbellard #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ 10862521d698Sbellard #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ 108731e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ 108831e31b8aSbellard 108931e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ 109031e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ 109131e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ 109231e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ 109331e31b8aSbellard #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ 109431e31b8aSbellard #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ 109531e31b8aSbellard #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ 109631e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ 10972521d698Sbellard 1098b8005914Sbalrog /* loop ioctls */ 1099b8005914Sbalrog #define TARGET_LOOP_SET_FD 0x4C00 1100b8005914Sbalrog #define TARGET_LOOP_CLR_FD 0x4C01 1101b8005914Sbalrog #define TARGET_LOOP_SET_STATUS 0x4C02 1102b8005914Sbalrog #define TARGET_LOOP_GET_STATUS 0x4C03 1103b8005914Sbalrog #define TARGET_LOOP_SET_STATUS64 0x4C04 1104b8005914Sbalrog #define TARGET_LOOP_GET_STATUS64 0x4C05 1105b8005914Sbalrog #define TARGET_LOOP_CHANGE_FD 0x4C06 11062521d698Sbellard 1107f7680a55SUlrich Hecht /* fb ioctls */ 1108f7680a55SUlrich Hecht #define TARGET_FBIOGET_VSCREENINFO 0x4600 1109f7680a55SUlrich Hecht #define TARGET_FBIOPUT_VSCREENINFO 0x4601 1110f7680a55SUlrich Hecht #define TARGET_FBIOGET_FSCREENINFO 0x4602 111112b81b71SCédric VINCENT #define TARGET_FBIOGETCMAP 0x4604 111212b81b71SCédric VINCENT #define TARGET_FBIOPUTCMAP 0x4605 111312b81b71SCédric VINCENT #define TARGET_FBIOPAN_DISPLAY 0x4606 111412b81b71SCédric VINCENT #define TARGET_FBIOGET_CON2FBMAP 0x460F 111512b81b71SCédric VINCENT #define TARGET_FBIOPUT_CON2FBMAP 0x4610 1116f7680a55SUlrich Hecht 1117f7680a55SUlrich Hecht /* vt ioctls */ 1118f7680a55SUlrich Hecht #define TARGET_VT_OPENQRY 0x5600 1119f7680a55SUlrich Hecht #define TARGET_VT_GETSTATE 0x5603 1120f7680a55SUlrich Hecht #define TARGET_VT_ACTIVATE 0x5606 1121f7680a55SUlrich Hecht #define TARGET_VT_WAITACTIVE 0x5607 1122f7680a55SUlrich Hecht #define TARGET_VT_LOCKSWITCH 0x560b 1123f7680a55SUlrich Hecht #define TARGET_VT_UNLOCKSWITCH 0x560c 1124774750c0SCédric VINCENT #define TARGET_VT_GETMODE 0x5601 1125774750c0SCédric VINCENT #define TARGET_VT_SETMODE 0x5602 1126774750c0SCédric VINCENT #define TARGET_VT_RELDISP 0x5605 1127774750c0SCédric VINCENT #define TARGET_VT_DISALLOCATE 0x5608 1128f7680a55SUlrich Hecht 112956e904ecSAlexander Graf /* device mapper */ 113056e904ecSAlexander Graf #define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00) 113156e904ecSAlexander Graf #define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01) 113256e904ecSAlexander Graf #define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02) 113356e904ecSAlexander Graf #define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03) 113456e904ecSAlexander Graf #define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04) 113556e904ecSAlexander Graf #define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05) 113656e904ecSAlexander Graf #define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06) 113756e904ecSAlexander Graf #define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07) 113856e904ecSAlexander Graf #define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08) 113956e904ecSAlexander Graf #define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09) 114056e904ecSAlexander Graf #define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a) 114156e904ecSAlexander Graf #define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b) 114256e904ecSAlexander Graf #define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c) 114356e904ecSAlexander Graf #define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d) 114456e904ecSAlexander Graf #define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e) 114556e904ecSAlexander Graf #define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f) 114656e904ecSAlexander Graf 11472521d698Sbellard /* from asm/termbits.h */ 11482521d698Sbellard 11493bfd9da1Sbellard #define TARGET_NCC 8 11503bfd9da1Sbellard struct target_termio { 11513bfd9da1Sbellard unsigned short c_iflag; /* input mode flags */ 11523bfd9da1Sbellard unsigned short c_oflag; /* output mode flags */ 11533bfd9da1Sbellard unsigned short c_cflag; /* control mode flags */ 11543bfd9da1Sbellard unsigned short c_lflag; /* local mode flags */ 11552521d698Sbellard unsigned char c_line; /* line discipline */ 11563bfd9da1Sbellard unsigned char c_cc[TARGET_NCC]; /* control characters */ 11572521d698Sbellard }; 11582521d698Sbellard 11593bfd9da1Sbellard struct target_winsize { 11603bfd9da1Sbellard unsigned short ws_row; 11613bfd9da1Sbellard unsigned short ws_col; 11623bfd9da1Sbellard unsigned short ws_xpixel; 11633bfd9da1Sbellard unsigned short ws_ypixel; 11643bfd9da1Sbellard }; 11652521d698Sbellard 11663bfd9da1Sbellard #include "termbits.h" 11672521d698Sbellard 11689e0b74a4SPaul Brook #if defined(TARGET_MIPS) 11699e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x10 11709e0b74a4SPaul Brook #else 11719e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x08 11729e0b74a4SPaul Brook #endif 11739e0b74a4SPaul Brook 1174e44a3e79Saurel32 /* Common */ 11752521d698Sbellard #define TARGET_MAP_SHARED 0x01 /* Share changes */ 11762521d698Sbellard #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ 11772521d698Sbellard #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ 1178e44a3e79Saurel32 1179e44a3e79Saurel32 /* Target specific */ 1180048f6b4dSbellard #if defined(TARGET_MIPS) 1181e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1182048f6b4dSbellard #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 1183048f6b4dSbellard #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 1184048f6b4dSbellard #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 1185048f6b4dSbellard #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 1186048f6b4dSbellard #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 1187048f6b4dSbellard #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 1188540635baSths #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 1189540635baSths #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1190e44a3e79Saurel32 #elif defined(TARGET_PPC) 1191e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 11922521d698Sbellard #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 11932521d698Sbellard #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 11942521d698Sbellard #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 11952521d698Sbellard #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 11967ec93196Sj_mayer #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ 11977ec93196Sj_mayer #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ 1198e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1199e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1200e44a3e79Saurel32 #elif defined(TARGET_ALPHA) 1201e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1202e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ 1203e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ 1204e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ 1205e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ 1206e44a3e79Saurel32 #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ 1207e44a3e79Saurel32 #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ 1208e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ 1209e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ 12107ec93196Sj_mayer #else 1211e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1212e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 1213e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 1214e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 1215e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 12162521d698Sbellard #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ 12172521d698Sbellard #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ 1218540635baSths #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1219540635baSths #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1220906c1b8eSMike Frysinger #define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ 12217ec93196Sj_mayer #endif 12222521d698Sbellard 122309701199SAlexander Graf #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 122409701199SAlexander Graf || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 1225c7819dfbSPeter Maydell || defined(TARGET_CRIS) || defined(TARGET_UNICORE32) 12262521d698Sbellard struct target_stat { 12272521d698Sbellard unsigned short st_dev; 12282521d698Sbellard unsigned short __pad1; 1229992f48a0Sblueswir1 abi_ulong st_ino; 12302521d698Sbellard unsigned short st_mode; 12312521d698Sbellard unsigned short st_nlink; 12322521d698Sbellard unsigned short st_uid; 12332521d698Sbellard unsigned short st_gid; 12342521d698Sbellard unsigned short st_rdev; 12352521d698Sbellard unsigned short __pad2; 1236992f48a0Sblueswir1 abi_ulong st_size; 1237992f48a0Sblueswir1 abi_ulong st_blksize; 1238992f48a0Sblueswir1 abi_ulong st_blocks; 1239992f48a0Sblueswir1 abi_ulong target_st_atime; 1240992f48a0Sblueswir1 abi_ulong __unused1; 1241992f48a0Sblueswir1 abi_ulong target_st_mtime; 1242992f48a0Sblueswir1 abi_ulong __unused2; 1243992f48a0Sblueswir1 abi_ulong target_st_ctime; 1244992f48a0Sblueswir1 abi_ulong __unused3; 1245992f48a0Sblueswir1 abi_ulong __unused4; 1246992f48a0Sblueswir1 abi_ulong __unused5; 12472521d698Sbellard }; 12482521d698Sbellard 12492521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely 12502521d698Sbellard * insane amounts of padding around dev_t's. 12512521d698Sbellard */ 125220d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 12532521d698Sbellard struct target_stat64 { 12542521d698Sbellard unsigned short st_dev; 12552521d698Sbellard unsigned char __pad0[10]; 12562521d698Sbellard 12572521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1258992f48a0Sblueswir1 abi_ulong __st_ino; 12592521d698Sbellard 12602521d698Sbellard unsigned int st_mode; 12612521d698Sbellard unsigned int st_nlink; 12622521d698Sbellard 1263992f48a0Sblueswir1 abi_ulong st_uid; 1264992f48a0Sblueswir1 abi_ulong st_gid; 12652521d698Sbellard 12662521d698Sbellard unsigned short st_rdev; 12672521d698Sbellard unsigned char __pad3[10]; 12682521d698Sbellard 12692521d698Sbellard long long st_size; 1270992f48a0Sblueswir1 abi_ulong st_blksize; 12712521d698Sbellard 1272992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1273992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 12742521d698Sbellard 1275992f48a0Sblueswir1 abi_ulong target_st_atime; 1276992f48a0Sblueswir1 abi_ulong __pad5; 12772521d698Sbellard 1278992f48a0Sblueswir1 abi_ulong target_st_mtime; 1279992f48a0Sblueswir1 abi_ulong __pad6; 12802521d698Sbellard 1281992f48a0Sblueswir1 abi_ulong target_st_ctime; 1282992f48a0Sblueswir1 abi_ulong __pad7; /* will be high 32 bits of ctime someday */ 12832521d698Sbellard 12842521d698Sbellard unsigned long long st_ino; 1285541dc0d4SStefan Weil } QEMU_PACKED; 12862521d698Sbellard 1287ce4defa0Spbrook #ifdef TARGET_ARM 128820d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1289ce4defa0Spbrook struct target_eabi_stat64 { 1290ce4defa0Spbrook unsigned long long st_dev; 1291ce4defa0Spbrook unsigned int __pad1; 1292992f48a0Sblueswir1 abi_ulong __st_ino; 1293ce4defa0Spbrook unsigned int st_mode; 1294ce4defa0Spbrook unsigned int st_nlink; 1295ce4defa0Spbrook 1296992f48a0Sblueswir1 abi_ulong st_uid; 1297992f48a0Sblueswir1 abi_ulong st_gid; 1298ce4defa0Spbrook 1299ce4defa0Spbrook unsigned long long st_rdev; 1300ce4defa0Spbrook unsigned int __pad2[2]; 1301ce4defa0Spbrook 1302ce4defa0Spbrook long long st_size; 1303992f48a0Sblueswir1 abi_ulong st_blksize; 1304ce4defa0Spbrook unsigned int __pad3; 1305ce4defa0Spbrook unsigned long long st_blocks; 1306ce4defa0Spbrook 1307992f48a0Sblueswir1 abi_ulong target_st_atime; 1308992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1309ce4defa0Spbrook 1310992f48a0Sblueswir1 abi_ulong target_st_mtime; 1311992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1312ce4defa0Spbrook 1313992f48a0Sblueswir1 abi_ulong target_st_ctime; 1314992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1315ce4defa0Spbrook 1316ce4defa0Spbrook unsigned long long st_ino; 1317541dc0d4SStefan Weil } QEMU_PACKED; 1318ce4defa0Spbrook #endif 1319ce4defa0Spbrook 1320992f48a0Sblueswir1 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 13211b8dd648Sblueswir1 struct target_stat { 13221b8dd648Sblueswir1 unsigned int st_dev; 1323992f48a0Sblueswir1 abi_ulong st_ino; 13241b8dd648Sblueswir1 unsigned int st_mode; 13251b8dd648Sblueswir1 unsigned int st_nlink; 13261b8dd648Sblueswir1 unsigned int st_uid; 13271b8dd648Sblueswir1 unsigned int st_gid; 13281b8dd648Sblueswir1 unsigned int st_rdev; 1329992f48a0Sblueswir1 abi_long st_size; 1330992f48a0Sblueswir1 abi_long target_st_atime; 1331992f48a0Sblueswir1 abi_long target_st_mtime; 1332992f48a0Sblueswir1 abi_long target_st_ctime; 1333992f48a0Sblueswir1 abi_long st_blksize; 1334992f48a0Sblueswir1 abi_long st_blocks; 1335992f48a0Sblueswir1 abi_ulong __unused4[2]; 13361b8dd648Sblueswir1 }; 13371b8dd648Sblueswir1 133820d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 13391b8dd648Sblueswir1 struct target_stat64 { 13401b8dd648Sblueswir1 unsigned char __pad0[6]; 13411b8dd648Sblueswir1 unsigned short st_dev; 13421b8dd648Sblueswir1 13431b8dd648Sblueswir1 uint64_t st_ino; 13441b8dd648Sblueswir1 uint64_t st_nlink; 13451b8dd648Sblueswir1 13461b8dd648Sblueswir1 unsigned int st_mode; 13471b8dd648Sblueswir1 13481b8dd648Sblueswir1 unsigned int st_uid; 13491b8dd648Sblueswir1 unsigned int st_gid; 13501b8dd648Sblueswir1 13511b8dd648Sblueswir1 unsigned char __pad2[6]; 13521b8dd648Sblueswir1 unsigned short st_rdev; 13531b8dd648Sblueswir1 13541b8dd648Sblueswir1 int64_t st_size; 13551b8dd648Sblueswir1 int64_t st_blksize; 13561b8dd648Sblueswir1 13571b8dd648Sblueswir1 unsigned char __pad4[4]; 13581b8dd648Sblueswir1 unsigned int st_blocks; 13591b8dd648Sblueswir1 1360992f48a0Sblueswir1 abi_ulong target_st_atime; 1361992f48a0Sblueswir1 abi_ulong __unused1; 13621b8dd648Sblueswir1 1363992f48a0Sblueswir1 abi_ulong target_st_mtime; 1364992f48a0Sblueswir1 abi_ulong __unused2; 13651b8dd648Sblueswir1 1366992f48a0Sblueswir1 abi_ulong target_st_ctime; 1367992f48a0Sblueswir1 abi_ulong __unused3; 13681b8dd648Sblueswir1 1369992f48a0Sblueswir1 abi_ulong __unused4[3]; 13701b8dd648Sblueswir1 }; 13711b8dd648Sblueswir1 13723bfd9da1Sbellard #elif defined(TARGET_SPARC) 13733bfd9da1Sbellard 13743bfd9da1Sbellard struct target_stat { 13753bfd9da1Sbellard unsigned short st_dev; 1376992f48a0Sblueswir1 abi_ulong st_ino; 13773bfd9da1Sbellard unsigned short st_mode; 13783bfd9da1Sbellard short st_nlink; 13793bfd9da1Sbellard unsigned short st_uid; 13803bfd9da1Sbellard unsigned short st_gid; 13813bfd9da1Sbellard unsigned short st_rdev; 1382992f48a0Sblueswir1 abi_long st_size; 1383992f48a0Sblueswir1 abi_long target_st_atime; 1384992f48a0Sblueswir1 abi_ulong __unused1; 1385992f48a0Sblueswir1 abi_long target_st_mtime; 1386992f48a0Sblueswir1 abi_ulong __unused2; 1387992f48a0Sblueswir1 abi_long target_st_ctime; 1388992f48a0Sblueswir1 abi_ulong __unused3; 1389992f48a0Sblueswir1 abi_long st_blksize; 1390992f48a0Sblueswir1 abi_long st_blocks; 1391992f48a0Sblueswir1 abi_ulong __unused4[2]; 13923bfd9da1Sbellard }; 13933bfd9da1Sbellard 139420d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 13953bfd9da1Sbellard struct target_stat64 { 13963bfd9da1Sbellard unsigned char __pad0[6]; 13973bfd9da1Sbellard unsigned short st_dev; 13983bfd9da1Sbellard 13993bfd9da1Sbellard uint64_t st_ino; 14003bfd9da1Sbellard 14013bfd9da1Sbellard unsigned int st_mode; 14023bfd9da1Sbellard unsigned int st_nlink; 14033bfd9da1Sbellard 14043bfd9da1Sbellard unsigned int st_uid; 14053bfd9da1Sbellard unsigned int st_gid; 14063bfd9da1Sbellard 14073bfd9da1Sbellard unsigned char __pad2[6]; 14083bfd9da1Sbellard unsigned short st_rdev; 14093bfd9da1Sbellard 14103bfd9da1Sbellard unsigned char __pad3[8]; 14113bfd9da1Sbellard 14123bfd9da1Sbellard int64_t st_size; 14133bfd9da1Sbellard unsigned int st_blksize; 14143bfd9da1Sbellard 14153bfd9da1Sbellard unsigned char __pad4[8]; 14163bfd9da1Sbellard unsigned int st_blocks; 14173bfd9da1Sbellard 14183bfd9da1Sbellard unsigned int target_st_atime; 14193bfd9da1Sbellard unsigned int __unused1; 14203bfd9da1Sbellard 14213bfd9da1Sbellard unsigned int target_st_mtime; 14223bfd9da1Sbellard unsigned int __unused2; 14233bfd9da1Sbellard 14243bfd9da1Sbellard unsigned int target_st_ctime; 14253bfd9da1Sbellard unsigned int __unused3; 14263bfd9da1Sbellard 14273bfd9da1Sbellard unsigned int __unused4; 14283bfd9da1Sbellard unsigned int __unused5; 14293bfd9da1Sbellard }; 14303bfd9da1Sbellard 143167867308Sbellard #elif defined(TARGET_PPC) 143267867308Sbellard 143367867308Sbellard struct target_stat { 1434e32448e0Sj_mayer abi_ulong st_dev; 1435992f48a0Sblueswir1 abi_ulong st_ino; 1436325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1437e32448e0Sj_mayer abi_ulong st_nlink; 1438325e651fSj_mayer unsigned int st_mode; 1439325e651fSj_mayer #else 144067867308Sbellard unsigned int st_mode; 144167867308Sbellard unsigned short st_nlink; 1442325e651fSj_mayer #endif 144367867308Sbellard unsigned int st_uid; 144467867308Sbellard unsigned int st_gid; 1445e32448e0Sj_mayer abi_ulong st_rdev; 1446992f48a0Sblueswir1 abi_ulong st_size; 1447992f48a0Sblueswir1 abi_ulong st_blksize; 1448992f48a0Sblueswir1 abi_ulong st_blocks; 1449992f48a0Sblueswir1 abi_ulong target_st_atime; 1450e32448e0Sj_mayer abi_ulong target_st_atime_nsec; 1451992f48a0Sblueswir1 abi_ulong target_st_mtime; 1452e32448e0Sj_mayer abi_ulong target_st_mtime_nsec; 1453992f48a0Sblueswir1 abi_ulong target_st_ctime; 1454e32448e0Sj_mayer abi_ulong target_st_ctime_nsec; 1455992f48a0Sblueswir1 abi_ulong __unused4; 1456992f48a0Sblueswir1 abi_ulong __unused5; 1457325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1458325e651fSj_mayer abi_ulong __unused6; 1459325e651fSj_mayer #endif 146067867308Sbellard }; 146167867308Sbellard 146220d155bcSStefan Weil #if !defined(TARGET_PPC64) || defined(TARGET_ABI32) 146320d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1464541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 146567867308Sbellard unsigned long long st_dev; 146667867308Sbellard unsigned long long st_ino; 146767867308Sbellard unsigned int st_mode; 146867867308Sbellard unsigned int st_nlink; 146967867308Sbellard unsigned int st_uid; 147067867308Sbellard unsigned int st_gid; 147167867308Sbellard unsigned long long st_rdev; 1472e1ce5e40Saurel32 unsigned long long __pad0; 147367867308Sbellard long long st_size; 1474e32448e0Sj_mayer int st_blksize; 1475e1ce5e40Saurel32 unsigned int __pad1; 147661322e91SMax Filippov long long st_blocks; /* Number 512-byte blocks allocated. */ 1477e32448e0Sj_mayer int target_st_atime; 1478e32448e0Sj_mayer unsigned int target_st_atime_nsec; 1479e32448e0Sj_mayer int target_st_mtime; 1480e32448e0Sj_mayer unsigned int target_st_mtime_nsec; 1481e32448e0Sj_mayer int target_st_ctime; 1482e32448e0Sj_mayer unsigned int target_st_ctime_nsec; 1483e32448e0Sj_mayer unsigned int __unused4; 1484e32448e0Sj_mayer unsigned int __unused5; 148567867308Sbellard }; 148620d155bcSStefan Weil #endif 148767867308Sbellard 1488b779e29eSEdgar E. Iglesias #elif defined(TARGET_MICROBLAZE) 1489b779e29eSEdgar E. Iglesias 1490b779e29eSEdgar E. Iglesias struct target_stat { 1491b779e29eSEdgar E. Iglesias abi_ulong st_dev; 1492b779e29eSEdgar E. Iglesias abi_ulong st_ino; 1493b779e29eSEdgar E. Iglesias unsigned int st_mode; 1494b779e29eSEdgar E. Iglesias unsigned short st_nlink; 1495b779e29eSEdgar E. Iglesias unsigned int st_uid; 1496b779e29eSEdgar E. Iglesias unsigned int st_gid; 1497b779e29eSEdgar E. Iglesias abi_ulong st_rdev; 1498b779e29eSEdgar E. Iglesias abi_ulong st_size; 1499b779e29eSEdgar E. Iglesias abi_ulong st_blksize; 1500b779e29eSEdgar E. Iglesias abi_ulong st_blocks; 1501b779e29eSEdgar E. Iglesias abi_ulong target_st_atime; 1502b779e29eSEdgar E. Iglesias abi_ulong target_st_atime_nsec; 1503b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime; 1504b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime_nsec; 1505b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime; 1506b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime_nsec; 1507b779e29eSEdgar E. Iglesias abi_ulong __unused4; 1508b779e29eSEdgar E. Iglesias abi_ulong __unused5; 1509b779e29eSEdgar E. Iglesias }; 1510b779e29eSEdgar E. Iglesias 1511b779e29eSEdgar E. Iglesias /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ 151220d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1513541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 1514b779e29eSEdgar E. Iglesias uint64_t st_dev; 1515a523eb06SEdgar E. Iglesias #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1516a523eb06SEdgar E. Iglesias uint32_t pad0; 1517a523eb06SEdgar E. Iglesias uint32_t __st_ino; 1518a523eb06SEdgar E. Iglesias 1519b779e29eSEdgar E. Iglesias uint32_t st_mode; 1520b779e29eSEdgar E. Iglesias uint32_t st_nlink; 1521b779e29eSEdgar E. Iglesias uint32_t st_uid; 1522b779e29eSEdgar E. Iglesias uint32_t st_gid; 1523b779e29eSEdgar E. Iglesias uint64_t st_rdev; 152421ebeb23SEdgar E. Iglesias uint64_t __pad1; 1525b779e29eSEdgar E. Iglesias 1526b779e29eSEdgar E. Iglesias int64_t st_size; 1527b779e29eSEdgar E. Iglesias int32_t st_blksize; 152821ebeb23SEdgar E. Iglesias uint32_t __pad2; 1529b779e29eSEdgar E. Iglesias int64_t st_blocks; /* Number 512-byte blocks allocated. */ 1530b779e29eSEdgar E. Iglesias 1531b779e29eSEdgar E. Iglesias int target_st_atime; 1532b779e29eSEdgar E. Iglesias unsigned int target_st_atime_nsec; 1533b779e29eSEdgar E. Iglesias int target_st_mtime; 1534b779e29eSEdgar E. Iglesias unsigned int target_st_mtime_nsec; 1535b779e29eSEdgar E. Iglesias int target_st_ctime; 1536b779e29eSEdgar E. Iglesias unsigned int target_st_ctime_nsec; 1537a523eb06SEdgar E. Iglesias uint64_t st_ino; 1538b779e29eSEdgar E. Iglesias }; 1539b779e29eSEdgar E. Iglesias 1540e6e5906bSpbrook #elif defined(TARGET_M68K) 1541e6e5906bSpbrook 1542e6e5906bSpbrook struct target_stat { 1543e6e5906bSpbrook unsigned short st_dev; 1544e6e5906bSpbrook unsigned short __pad1; 1545992f48a0Sblueswir1 abi_ulong st_ino; 1546e6e5906bSpbrook unsigned short st_mode; 1547e6e5906bSpbrook unsigned short st_nlink; 1548e6e5906bSpbrook unsigned short st_uid; 1549e6e5906bSpbrook unsigned short st_gid; 1550e6e5906bSpbrook unsigned short st_rdev; 1551e6e5906bSpbrook unsigned short __pad2; 1552992f48a0Sblueswir1 abi_ulong st_size; 1553992f48a0Sblueswir1 abi_ulong st_blksize; 1554992f48a0Sblueswir1 abi_ulong st_blocks; 1555992f48a0Sblueswir1 abi_ulong target_st_atime; 1556992f48a0Sblueswir1 abi_ulong __unused1; 1557992f48a0Sblueswir1 abi_ulong target_st_mtime; 1558992f48a0Sblueswir1 abi_ulong __unused2; 1559992f48a0Sblueswir1 abi_ulong target_st_ctime; 1560992f48a0Sblueswir1 abi_ulong __unused3; 1561992f48a0Sblueswir1 abi_ulong __unused4; 1562992f48a0Sblueswir1 abi_ulong __unused5; 1563e6e5906bSpbrook }; 1564e6e5906bSpbrook 1565e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely 1566e6e5906bSpbrook * insane amounts of padding around dev_t's. 1567e6e5906bSpbrook */ 156820d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1569e6e5906bSpbrook struct target_stat64 { 1570e6e5906bSpbrook unsigned long long st_dev; 1571e6e5906bSpbrook unsigned char __pad1[2]; 1572e6e5906bSpbrook 1573e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1574992f48a0Sblueswir1 abi_ulong __st_ino; 1575e6e5906bSpbrook 1576e6e5906bSpbrook unsigned int st_mode; 1577e6e5906bSpbrook unsigned int st_nlink; 1578e6e5906bSpbrook 1579992f48a0Sblueswir1 abi_ulong st_uid; 1580992f48a0Sblueswir1 abi_ulong st_gid; 1581e6e5906bSpbrook 1582e6e5906bSpbrook unsigned long long st_rdev; 1583e6e5906bSpbrook unsigned char __pad3[2]; 1584e6e5906bSpbrook 1585e6e5906bSpbrook long long st_size; 1586992f48a0Sblueswir1 abi_ulong st_blksize; 1587e6e5906bSpbrook 1588992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 1589992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1590e6e5906bSpbrook 1591992f48a0Sblueswir1 abi_ulong target_st_atime; 1592992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1593e6e5906bSpbrook 1594992f48a0Sblueswir1 abi_ulong target_st_mtime; 1595992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1596e6e5906bSpbrook 1597992f48a0Sblueswir1 abi_ulong target_st_ctime; 1598992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1599e6e5906bSpbrook 1600e6e5906bSpbrook unsigned long long st_ino; 1601541dc0d4SStefan Weil } QEMU_PACKED; 1602e6e5906bSpbrook 1603d26bc211Sths #elif defined(TARGET_ABI_MIPSN64) 1604540635baSths 1605540635baSths /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ 1606540635baSths struct target_stat { 1607540635baSths unsigned int st_dev; 1608540635baSths unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ 1609540635baSths 1610992f48a0Sblueswir1 abi_ulong st_ino; 1611540635baSths 1612540635baSths unsigned int st_mode; 1613540635baSths unsigned int st_nlink; 1614540635baSths 1615540635baSths int st_uid; 1616540635baSths int st_gid; 1617540635baSths 1618540635baSths unsigned int st_rdev; 1619540635baSths unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ 1620540635baSths 1621992f48a0Sblueswir1 abi_ulong st_size; 1622540635baSths 1623540635baSths /* 1624540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1625540635baSths * but we don't have it under Linux. 1626540635baSths */ 1627540635baSths unsigned int target_st_atime; 1628540635baSths unsigned int target_st_atime_nsec; 1629540635baSths 1630540635baSths unsigned int target_st_mtime; 1631540635baSths unsigned int target_st_mtime_nsec; 1632540635baSths 1633540635baSths unsigned int target_st_ctime; 1634540635baSths unsigned int target_st_ctime_nsec; 1635540635baSths 1636540635baSths unsigned int st_blksize; 1637540635baSths unsigned int st_pad2; 1638540635baSths 1639992f48a0Sblueswir1 abi_ulong st_blocks; 1640540635baSths }; 1641540635baSths 1642d26bc211Sths #elif defined(TARGET_ABI_MIPSN32) 1643540635baSths 1644540635baSths struct target_stat { 16451ab2aea2SLeon Alrae abi_ulong st_dev; 16461ab2aea2SLeon Alrae abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 16471ab2aea2SLeon Alrae uint64_t st_ino; 1648540635baSths unsigned int st_mode; 1649540635baSths unsigned int st_nlink; 1650540635baSths int st_uid; 1651540635baSths int st_gid; 16521ab2aea2SLeon Alrae abi_ulong st_rdev; 16531ab2aea2SLeon Alrae abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 16541ab2aea2SLeon Alrae int64_t st_size; 16551ab2aea2SLeon Alrae abi_long target_st_atime; 16561ab2aea2SLeon Alrae abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 16571ab2aea2SLeon Alrae abi_long target_st_mtime; 16581ab2aea2SLeon Alrae abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 16591ab2aea2SLeon Alrae abi_long target_st_ctime; 16601ab2aea2SLeon Alrae abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 16611ab2aea2SLeon Alrae abi_ulong st_blksize; 16621ab2aea2SLeon Alrae abi_ulong st_pad2; 16631ab2aea2SLeon Alrae int64_t st_blocks; 1664540635baSths }; 1665540635baSths 1666d26bc211Sths #elif defined(TARGET_ABI_MIPSO32) 1667048f6b4dSbellard 1668048f6b4dSbellard struct target_stat { 1669048f6b4dSbellard unsigned st_dev; 1670992f48a0Sblueswir1 abi_long st_pad1[3]; /* Reserved for network id */ 1671992f48a0Sblueswir1 abi_ulong st_ino; 1672048f6b4dSbellard unsigned int st_mode; 1673048f6b4dSbellard unsigned int st_nlink; 1674048f6b4dSbellard int st_uid; 1675048f6b4dSbellard int st_gid; 1676048f6b4dSbellard unsigned st_rdev; 1677992f48a0Sblueswir1 abi_long st_pad2[2]; 1678992f48a0Sblueswir1 abi_long st_size; 1679992f48a0Sblueswir1 abi_long st_pad3; 1680048f6b4dSbellard /* 1681048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1682048f6b4dSbellard * but we don't have it under Linux. 1683048f6b4dSbellard */ 1684992f48a0Sblueswir1 abi_long target_st_atime; 1685992f48a0Sblueswir1 abi_long target_st_atime_nsec; 1686992f48a0Sblueswir1 abi_long target_st_mtime; 1687992f48a0Sblueswir1 abi_long target_st_mtime_nsec; 1688992f48a0Sblueswir1 abi_long target_st_ctime; 1689992f48a0Sblueswir1 abi_long target_st_ctime_nsec; 1690992f48a0Sblueswir1 abi_long st_blksize; 1691992f48a0Sblueswir1 abi_long st_blocks; 1692992f48a0Sblueswir1 abi_long st_pad4[14]; 1693048f6b4dSbellard }; 1694048f6b4dSbellard 1695048f6b4dSbellard /* 1696048f6b4dSbellard * This matches struct stat64 in glibc2.1, hence the absolutely insane 1697048f6b4dSbellard * amounts of padding around dev_t's. The memory layout is the same as of 1698048f6b4dSbellard * struct stat of the 64-bit kernel. 1699048f6b4dSbellard */ 1700048f6b4dSbellard 170120d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1702048f6b4dSbellard struct target_stat64 { 1703992f48a0Sblueswir1 abi_ulong st_dev; 1704992f48a0Sblueswir1 abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 1705048f6b4dSbellard 1706048f6b4dSbellard uint64_t st_ino; 1707048f6b4dSbellard 1708048f6b4dSbellard unsigned int st_mode; 1709048f6b4dSbellard unsigned int st_nlink; 1710048f6b4dSbellard 1711048f6b4dSbellard int st_uid; 1712048f6b4dSbellard int st_gid; 1713048f6b4dSbellard 1714992f48a0Sblueswir1 abi_ulong st_rdev; 1715992f48a0Sblueswir1 abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 1716048f6b4dSbellard 1717048f6b4dSbellard int64_t st_size; 1718048f6b4dSbellard 1719048f6b4dSbellard /* 1720048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1721048f6b4dSbellard * but we don't have it under Linux. 1722048f6b4dSbellard */ 1723992f48a0Sblueswir1 abi_long target_st_atime; 1724992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 1725048f6b4dSbellard 1726992f48a0Sblueswir1 abi_long target_st_mtime; 1727992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 1728048f6b4dSbellard 1729992f48a0Sblueswir1 abi_long target_st_ctime; 1730992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 1731048f6b4dSbellard 1732992f48a0Sblueswir1 abi_ulong st_blksize; 1733992f48a0Sblueswir1 abi_ulong st_pad2; 1734048f6b4dSbellard 1735048f6b4dSbellard int64_t st_blocks; 1736048f6b4dSbellard }; 17377a3148a9Sj_mayer 17387a3148a9Sj_mayer #elif defined(TARGET_ALPHA) 17397a3148a9Sj_mayer 17407a3148a9Sj_mayer struct target_stat { 17417a3148a9Sj_mayer unsigned int st_dev; 17427a3148a9Sj_mayer unsigned int st_ino; 17437a3148a9Sj_mayer unsigned int st_mode; 17447a3148a9Sj_mayer unsigned int st_nlink; 17457a3148a9Sj_mayer unsigned int st_uid; 17467a3148a9Sj_mayer unsigned int st_gid; 17477a3148a9Sj_mayer unsigned int st_rdev; 1748992f48a0Sblueswir1 abi_long st_size; 1749992f48a0Sblueswir1 abi_ulong target_st_atime; 1750992f48a0Sblueswir1 abi_ulong target_st_mtime; 1751992f48a0Sblueswir1 abi_ulong target_st_ctime; 17527a3148a9Sj_mayer unsigned int st_blksize; 17537a3148a9Sj_mayer unsigned int st_blocks; 17547a3148a9Sj_mayer unsigned int st_flags; 17557a3148a9Sj_mayer unsigned int st_gen; 17567a3148a9Sj_mayer }; 17577a3148a9Sj_mayer 175820d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 17597a3148a9Sj_mayer struct target_stat64 { 1760992f48a0Sblueswir1 abi_ulong st_dev; 1761992f48a0Sblueswir1 abi_ulong st_ino; 1762992f48a0Sblueswir1 abi_ulong st_rdev; 1763992f48a0Sblueswir1 abi_long st_size; 1764992f48a0Sblueswir1 abi_ulong st_blocks; 17657a3148a9Sj_mayer 17667a3148a9Sj_mayer unsigned int st_mode; 17677a3148a9Sj_mayer unsigned int st_uid; 17687a3148a9Sj_mayer unsigned int st_gid; 17697a3148a9Sj_mayer unsigned int st_blksize; 17707a3148a9Sj_mayer unsigned int st_nlink; 17717a3148a9Sj_mayer unsigned int __pad0; 17727a3148a9Sj_mayer 1773992f48a0Sblueswir1 abi_ulong target_st_atime; 1774992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1775992f48a0Sblueswir1 abi_ulong target_st_mtime; 1776992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1777992f48a0Sblueswir1 abi_ulong target_st_ctime; 1778992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1779992f48a0Sblueswir1 abi_long __unused[3]; 17807a3148a9Sj_mayer }; 17817a3148a9Sj_mayer 17826db45e65Sths #elif defined(TARGET_SH4) 17836db45e65Sths 17846db45e65Sths struct target_stat { 1785992f48a0Sblueswir1 abi_ulong st_dev; 1786992f48a0Sblueswir1 abi_ulong st_ino; 17876db45e65Sths unsigned short st_mode; 17886db45e65Sths unsigned short st_nlink; 17896db45e65Sths unsigned short st_uid; 17906db45e65Sths unsigned short st_gid; 1791992f48a0Sblueswir1 abi_ulong st_rdev; 1792992f48a0Sblueswir1 abi_ulong st_size; 1793992f48a0Sblueswir1 abi_ulong st_blksize; 1794992f48a0Sblueswir1 abi_ulong st_blocks; 1795992f48a0Sblueswir1 abi_ulong target_st_atime; 1796992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1797992f48a0Sblueswir1 abi_ulong target_st_mtime; 1798992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1799992f48a0Sblueswir1 abi_ulong target_st_ctime; 1800992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1801992f48a0Sblueswir1 abi_ulong __unused4; 1802992f48a0Sblueswir1 abi_ulong __unused5; 18036db45e65Sths }; 18046db45e65Sths 18056db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely 18066db45e65Sths * insane amounts of padding around dev_t's. 18076db45e65Sths */ 180820d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1809541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 18106db45e65Sths unsigned long long st_dev; 18116db45e65Sths unsigned char __pad0[4]; 18126db45e65Sths 18136db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1814992f48a0Sblueswir1 abi_ulong __st_ino; 18156db45e65Sths 18166db45e65Sths unsigned int st_mode; 18176db45e65Sths unsigned int st_nlink; 18186db45e65Sths 1819992f48a0Sblueswir1 abi_ulong st_uid; 1820992f48a0Sblueswir1 abi_ulong st_gid; 18216db45e65Sths 18226db45e65Sths unsigned long long st_rdev; 18236db45e65Sths unsigned char __pad3[4]; 18246db45e65Sths 18256db45e65Sths long long st_size; 1826992f48a0Sblueswir1 abi_ulong st_blksize; 18276db45e65Sths 18286db45e65Sths unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ 18296db45e65Sths 1830992f48a0Sblueswir1 abi_ulong target_st_atime; 1831992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 18326db45e65Sths 1833992f48a0Sblueswir1 abi_ulong target_st_mtime; 1834992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 18356db45e65Sths 1836992f48a0Sblueswir1 abi_ulong target_st_ctime; 1837992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 18386db45e65Sths 18396db45e65Sths unsigned long long st_ino; 18406db45e65Sths }; 18416db45e65Sths 1842d2fd1af7Sbellard #elif defined(TARGET_I386) && !defined(TARGET_ABI32) 1843d2fd1af7Sbellard struct target_stat { 1844d2fd1af7Sbellard abi_ulong st_dev; 1845d2fd1af7Sbellard abi_ulong st_ino; 1846d2fd1af7Sbellard abi_ulong st_nlink; 1847d2fd1af7Sbellard 1848d2fd1af7Sbellard unsigned int st_mode; 1849d2fd1af7Sbellard unsigned int st_uid; 1850d2fd1af7Sbellard unsigned int st_gid; 1851d2fd1af7Sbellard unsigned int __pad0; 1852d2fd1af7Sbellard abi_ulong st_rdev; 1853d2fd1af7Sbellard abi_long st_size; 1854d2fd1af7Sbellard abi_long st_blksize; 1855d2fd1af7Sbellard abi_long st_blocks; /* Number 512-byte blocks allocated. */ 1856d2fd1af7Sbellard 1857d2fd1af7Sbellard abi_ulong target_st_atime; 1858d2fd1af7Sbellard abi_ulong target_st_atime_nsec; 1859d2fd1af7Sbellard abi_ulong target_st_mtime; 1860d2fd1af7Sbellard abi_ulong target_st_mtime_nsec; 1861d2fd1af7Sbellard abi_ulong target_st_ctime; 1862d2fd1af7Sbellard abi_ulong target_st_ctime_nsec; 1863d2fd1af7Sbellard 1864d2fd1af7Sbellard abi_long __unused[3]; 1865d2fd1af7Sbellard }; 1866a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 1867a4c075f1SUlrich Hecht struct target_stat { 1868a4c075f1SUlrich Hecht abi_ulong st_dev; 1869a4c075f1SUlrich Hecht abi_ulong st_ino; 1870a4c075f1SUlrich Hecht abi_ulong st_nlink; 1871a4c075f1SUlrich Hecht unsigned int st_mode; 1872a4c075f1SUlrich Hecht unsigned int st_uid; 1873a4c075f1SUlrich Hecht unsigned int st_gid; 1874a4c075f1SUlrich Hecht unsigned int __pad1; 1875a4c075f1SUlrich Hecht abi_ulong st_rdev; 1876a4c075f1SUlrich Hecht abi_ulong st_size; 1877a4c075f1SUlrich Hecht abi_ulong target_st_atime; 1878a4c075f1SUlrich Hecht abi_ulong target_st_atime_nsec; 1879a4c075f1SUlrich Hecht abi_ulong target_st_mtime; 1880a4c075f1SUlrich Hecht abi_ulong target_st_mtime_nsec; 1881a4c075f1SUlrich Hecht abi_ulong target_st_ctime; 1882a4c075f1SUlrich Hecht abi_ulong target_st_ctime_nsec; 1883a4c075f1SUlrich Hecht abi_ulong st_blksize; 1884a4c075f1SUlrich Hecht abi_long st_blocks; 1885a4c075f1SUlrich Hecht abi_ulong __unused[3]; 1886a4c075f1SUlrich Hecht }; 188709701199SAlexander Graf #elif defined(TARGET_AARCH64) 188809701199SAlexander Graf struct target_stat { 188909701199SAlexander Graf abi_ulong st_dev; 189009701199SAlexander Graf abi_ulong st_ino; 189109701199SAlexander Graf unsigned int st_mode; 189209701199SAlexander Graf unsigned int st_nlink; 189309701199SAlexander Graf unsigned int st_uid; 189409701199SAlexander Graf unsigned int st_gid; 189509701199SAlexander Graf abi_ulong st_rdev; 189609701199SAlexander Graf abi_ulong _pad1; 189709701199SAlexander Graf abi_long st_size; 189809701199SAlexander Graf int st_blksize; 189909701199SAlexander Graf int __pad2; 190009701199SAlexander Graf abi_long st_blocks; 190109701199SAlexander Graf abi_long target_st_atime; 190209701199SAlexander Graf abi_ulong target_st_atime_nsec; 190309701199SAlexander Graf abi_long target_st_mtime; 190409701199SAlexander Graf abi_ulong target_st_mtime_nsec; 190509701199SAlexander Graf abi_long target_st_ctime; 190609701199SAlexander Graf abi_ulong target_st_ctime_nsec; 190709701199SAlexander Graf unsigned int __unused[2]; 190809701199SAlexander Graf }; 1909b16189b2SChen Gang #elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) 1910c7819dfbSPeter Maydell 1911c7819dfbSPeter Maydell /* These are the asm-generic versions of the stat and stat64 structures */ 1912c7819dfbSPeter Maydell 1913d962783eSJia Liu struct target_stat { 1914d962783eSJia Liu abi_ulong st_dev; 1915d962783eSJia Liu abi_ulong st_ino; 1916d962783eSJia Liu unsigned int st_mode; 1917c7819dfbSPeter Maydell unsigned int st_nlink; 1918d962783eSJia Liu unsigned int st_uid; 1919d962783eSJia Liu unsigned int st_gid; 1920d962783eSJia Liu abi_ulong st_rdev; 1921c7819dfbSPeter Maydell abi_ulong __pad1; 1922d962783eSJia Liu abi_long st_size; 1923c7819dfbSPeter Maydell int st_blksize; 1924c7819dfbSPeter Maydell int __pad2; 1925c7819dfbSPeter Maydell abi_long st_blocks; 1926c7819dfbSPeter Maydell abi_long target_st_atime; 1927d962783eSJia Liu abi_ulong target_st_atime_nsec; 1928c7819dfbSPeter Maydell abi_long target_st_mtime; 1929d962783eSJia Liu abi_ulong target_st_mtime_nsec; 1930c7819dfbSPeter Maydell abi_long target_st_ctime; 1931d962783eSJia Liu abi_ulong target_st_ctime_nsec; 1932c7819dfbSPeter Maydell unsigned int __unused4; 1933c7819dfbSPeter Maydell unsigned int __unused5; 1934d962783eSJia Liu }; 1935c7819dfbSPeter Maydell 193620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1937c7819dfbSPeter Maydell struct target_stat64 { 1938c7819dfbSPeter Maydell uint64_t st_dev; 1939c7819dfbSPeter Maydell uint64_t st_ino; 1940c7819dfbSPeter Maydell unsigned int st_mode; 1941c7819dfbSPeter Maydell unsigned int st_nlink; 1942c7819dfbSPeter Maydell unsigned int st_uid; 1943c7819dfbSPeter Maydell unsigned int st_gid; 1944c7819dfbSPeter Maydell uint64_t st_rdev; 1945c7819dfbSPeter Maydell uint64_t __pad1; 1946c7819dfbSPeter Maydell int64_t st_size; 1947c7819dfbSPeter Maydell int st_blksize; 1948c7819dfbSPeter Maydell int __pad2; 1949c7819dfbSPeter Maydell int64_t st_blocks; 1950c7819dfbSPeter Maydell int target_st_atime; 1951c7819dfbSPeter Maydell unsigned int target_st_atime_nsec; 1952c7819dfbSPeter Maydell int target_st_mtime; 1953c7819dfbSPeter Maydell unsigned int target_st_mtime_nsec; 1954c7819dfbSPeter Maydell int target_st_ctime; 1955c7819dfbSPeter Maydell unsigned int target_st_ctime_nsec; 1956c7819dfbSPeter Maydell unsigned int __unused4; 1957c7819dfbSPeter Maydell unsigned int __unused5; 1958c7819dfbSPeter Maydell }; 1959c7819dfbSPeter Maydell 1960048f6b4dSbellard #else 1961048f6b4dSbellard #error unsupported CPU 1962048f6b4dSbellard #endif 19632521d698Sbellard 19644ce6f8deSths typedef struct { 19654ce6f8deSths int val[2]; 1966c227f099SAnthony Liguori } target_fsid_t; 19674ce6f8deSths 196856c8f68fSbellard #ifdef TARGET_MIPS 1969d26bc211Sths #ifdef TARGET_ABI_MIPSN32 1970540635baSths struct target_statfs { 1971540635baSths int32_t f_type; 1972540635baSths int32_t f_bsize; 1973540635baSths int32_t f_frsize; /* Fragment size - unsupported */ 1974540635baSths int32_t f_blocks; 1975540635baSths int32_t f_bfree; 1976540635baSths int32_t f_files; 1977540635baSths int32_t f_ffree; 1978540635baSths int32_t f_bavail; 1979540635baSths 1980540635baSths /* Linux specials */ 1981c227f099SAnthony Liguori target_fsid_t f_fsid; 1982540635baSths int32_t f_namelen; 1983540635baSths int32_t f_spare[6]; 1984540635baSths }; 1985540635baSths #else 198656c8f68fSbellard struct target_statfs { 1987992f48a0Sblueswir1 abi_long f_type; 1988992f48a0Sblueswir1 abi_long f_bsize; 1989992f48a0Sblueswir1 abi_long f_frsize; /* Fragment size - unsupported */ 1990992f48a0Sblueswir1 abi_long f_blocks; 1991992f48a0Sblueswir1 abi_long f_bfree; 1992992f48a0Sblueswir1 abi_long f_files; 1993992f48a0Sblueswir1 abi_long f_ffree; 1994992f48a0Sblueswir1 abi_long f_bavail; 199556c8f68fSbellard 199656c8f68fSbellard /* Linux specials */ 1997c227f099SAnthony Liguori target_fsid_t f_fsid; 1998992f48a0Sblueswir1 abi_long f_namelen; 1999992f48a0Sblueswir1 abi_long f_spare[6]; 200056c8f68fSbellard }; 2001540635baSths #endif 200256c8f68fSbellard 200356c8f68fSbellard struct target_statfs64 { 200456c8f68fSbellard uint32_t f_type; 200556c8f68fSbellard uint32_t f_bsize; 200656c8f68fSbellard uint32_t f_frsize; /* Fragment size - unsupported */ 200756c8f68fSbellard uint32_t __pad; 200856c8f68fSbellard uint64_t f_blocks; 200956c8f68fSbellard uint64_t f_bfree; 201056c8f68fSbellard uint64_t f_files; 201156c8f68fSbellard uint64_t f_ffree; 201256c8f68fSbellard uint64_t f_bavail; 2013c227f099SAnthony Liguori target_fsid_t f_fsid; 201456c8f68fSbellard uint32_t f_namelen; 201556c8f68fSbellard uint32_t f_spare[6]; 201656c8f68fSbellard }; 2017c4d10628Sbalrog #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ 201809701199SAlexander Graf defined(TARGET_SPARC64) || defined(TARGET_AARCH64)) && \ 201909701199SAlexander Graf !defined(TARGET_ABI32) 2020325e651fSj_mayer struct target_statfs { 2021325e651fSj_mayer abi_long f_type; 2022325e651fSj_mayer abi_long f_bsize; 2023325e651fSj_mayer abi_long f_blocks; 2024325e651fSj_mayer abi_long f_bfree; 2025325e651fSj_mayer abi_long f_bavail; 2026325e651fSj_mayer abi_long f_files; 2027325e651fSj_mayer abi_long f_ffree; 2028c227f099SAnthony Liguori target_fsid_t f_fsid; 2029325e651fSj_mayer abi_long f_namelen; 2030325e651fSj_mayer abi_long f_frsize; 2031325e651fSj_mayer abi_long f_spare[5]; 2032325e651fSj_mayer }; 2033325e651fSj_mayer 2034325e651fSj_mayer struct target_statfs64 { 2035325e651fSj_mayer abi_long f_type; 2036325e651fSj_mayer abi_long f_bsize; 2037325e651fSj_mayer abi_long f_blocks; 2038325e651fSj_mayer abi_long f_bfree; 2039325e651fSj_mayer abi_long f_bavail; 2040325e651fSj_mayer abi_long f_files; 2041325e651fSj_mayer abi_long f_ffree; 2042c227f099SAnthony Liguori target_fsid_t f_fsid; 2043325e651fSj_mayer abi_long f_namelen; 2044325e651fSj_mayer abi_long f_frsize; 2045325e651fSj_mayer abi_long f_spare[5]; 2046325e651fSj_mayer }; 2047a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 2048a4c075f1SUlrich Hecht struct target_statfs { 2049a4c075f1SUlrich Hecht int32_t f_type; 2050a4c075f1SUlrich Hecht int32_t f_bsize; 2051a4c075f1SUlrich Hecht abi_long f_blocks; 2052a4c075f1SUlrich Hecht abi_long f_bfree; 2053a4c075f1SUlrich Hecht abi_long f_bavail; 2054a4c075f1SUlrich Hecht abi_long f_files; 2055a4c075f1SUlrich Hecht abi_long f_ffree; 2056a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2057a4c075f1SUlrich Hecht int32_t f_namelen; 2058a4c075f1SUlrich Hecht int32_t f_frsize; 2059a4c075f1SUlrich Hecht int32_t f_spare[5]; 2060a4c075f1SUlrich Hecht }; 2061a4c075f1SUlrich Hecht 2062a4c075f1SUlrich Hecht struct target_statfs64 { 2063a4c075f1SUlrich Hecht int32_t f_type; 2064a4c075f1SUlrich Hecht int32_t f_bsize; 2065a4c075f1SUlrich Hecht abi_long f_blocks; 2066a4c075f1SUlrich Hecht abi_long f_bfree; 2067a4c075f1SUlrich Hecht abi_long f_bavail; 2068a4c075f1SUlrich Hecht abi_long f_files; 2069a4c075f1SUlrich Hecht abi_long f_ffree; 2070a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2071a4c075f1SUlrich Hecht int32_t f_namelen; 2072a4c075f1SUlrich Hecht int32_t f_frsize; 2073a4c075f1SUlrich Hecht int32_t f_spare[5]; 2074a4c075f1SUlrich Hecht }; 207556c8f68fSbellard #else 207656c8f68fSbellard struct target_statfs { 207756c8f68fSbellard uint32_t f_type; 207856c8f68fSbellard uint32_t f_bsize; 207956c8f68fSbellard uint32_t f_blocks; 208056c8f68fSbellard uint32_t f_bfree; 208156c8f68fSbellard uint32_t f_bavail; 208256c8f68fSbellard uint32_t f_files; 208356c8f68fSbellard uint32_t f_ffree; 2084c227f099SAnthony Liguori target_fsid_t f_fsid; 208556c8f68fSbellard uint32_t f_namelen; 208656c8f68fSbellard uint32_t f_frsize; 208756c8f68fSbellard uint32_t f_spare[5]; 208856c8f68fSbellard }; 208956c8f68fSbellard 209056c8f68fSbellard struct target_statfs64 { 209156c8f68fSbellard uint32_t f_type; 209256c8f68fSbellard uint32_t f_bsize; 209356c8f68fSbellard uint64_t f_blocks; 209456c8f68fSbellard uint64_t f_bfree; 209556c8f68fSbellard uint64_t f_bavail; 209656c8f68fSbellard uint64_t f_files; 209756c8f68fSbellard uint64_t f_ffree; 2098c227f099SAnthony Liguori target_fsid_t f_fsid; 209956c8f68fSbellard uint32_t f_namelen; 210056c8f68fSbellard uint32_t f_frsize; 210156c8f68fSbellard uint32_t f_spare[5]; 210256c8f68fSbellard }; 210356c8f68fSbellard #endif 210456c8f68fSbellard 210556c8f68fSbellard 21062521d698Sbellard #define TARGET_F_DUPFD 0 /* dup */ 21072521d698Sbellard #define TARGET_F_GETFD 1 /* get close_on_exec */ 21082521d698Sbellard #define TARGET_F_SETFD 2 /* set/clear close_on_exec */ 21092521d698Sbellard #define TARGET_F_GETFL 3 /* get file->f_flags */ 21102521d698Sbellard #define TARGET_F_SETFL 4 /* set file->f_flags */ 21112521d698Sbellard 21122521d698Sbellard #if defined(TARGET_ALPHA) 21132521d698Sbellard #define TARGET_F_GETLK 7 21142521d698Sbellard #define TARGET_F_SETLK 8 21152521d698Sbellard #define TARGET_F_SETLKW 9 21162521d698Sbellard #define TARGET_F_SETOWN 5 /* for sockets. */ 21172521d698Sbellard #define TARGET_F_GETOWN 6 /* for sockets. */ 21182ba7f730SLaurent Vivier 21192ba7f730SLaurent Vivier #define TARGET_F_RDLCK 1 21202ba7f730SLaurent Vivier #define TARGET_F_WRLCK 2 21212ba7f730SLaurent Vivier #define TARGET_F_UNLCK 8 21222ba7f730SLaurent Vivier #define TARGET_F_EXLCK 16 21232ba7f730SLaurent Vivier #define TARGET_F_SHLCK 32 21245f106811SArnaud Patard (Rtp) #elif defined(TARGET_MIPS) 21255f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK 14 21265f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK 6 21275f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW 7 21285f106811SArnaud Patard (Rtp) #define TARGET_F_SETOWN 24 /* for sockets. */ 21295f106811SArnaud Patard (Rtp) #define TARGET_F_GETOWN 25 /* for sockets. */ 21302521d698Sbellard #else 21312521d698Sbellard #define TARGET_F_GETLK 5 21322521d698Sbellard #define TARGET_F_SETLK 6 21332521d698Sbellard #define TARGET_F_SETLKW 7 21342521d698Sbellard #define TARGET_F_SETOWN 8 /* for sockets. */ 21352521d698Sbellard #define TARGET_F_GETOWN 9 /* for sockets. */ 21362521d698Sbellard #endif 21378d5d3004SAndreas Schwab #define TARGET_F_SETOWN_EX 15 21388d5d3004SAndreas Schwab #define TARGET_F_GETOWN_EX 16 21392521d698Sbellard 21402ba7f730SLaurent Vivier #ifndef TARGET_F_RDLCK 21412ba7f730SLaurent Vivier #define TARGET_F_RDLCK 0 21422ba7f730SLaurent Vivier #define TARGET_F_WRLCK 1 21432ba7f730SLaurent Vivier #define TARGET_F_UNLCK 2 21442ba7f730SLaurent Vivier #endif 21452ba7f730SLaurent Vivier 21462ba7f730SLaurent Vivier #ifndef TARGET_F_EXLCK 21472ba7f730SLaurent Vivier #define TARGET_F_EXLCK 4 21482ba7f730SLaurent Vivier #define TARGET_F_SHLCK 8 21492ba7f730SLaurent Vivier #endif 21502ba7f730SLaurent Vivier 21512ba7f730SLaurent Vivier 21522521d698Sbellard #define TARGET_F_SETSIG 10 /* for sockets. */ 21532521d698Sbellard #define TARGET_F_GETSIG 11 /* for sockets. */ 21542521d698Sbellard 21555f106811SArnaud Patard (Rtp) #if defined(TARGET_MIPS) 21565f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK64 33 /* using 'struct flock64' */ 21575f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK64 34 21585f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW64 35 21595f106811SArnaud Patard (Rtp) #else 21602521d698Sbellard #define TARGET_F_GETLK64 12 /* using 'struct flock64' */ 21612521d698Sbellard #define TARGET_F_SETLK64 13 21622521d698Sbellard #define TARGET_F_SETLKW64 14 21635f106811SArnaud Patard (Rtp) #endif 21647e22e546SUlrich Hecht 21657e22e546SUlrich Hecht #define TARGET_F_LINUX_SPECIFIC_BASE 1024 21667e22e546SUlrich Hecht #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0) 21677e22e546SUlrich Hecht #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1) 21687e22e546SUlrich Hecht #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) 21697e22e546SUlrich Hecht #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2) 21707e22e546SUlrich Hecht 21714eeea4f3SRichard Henderson #if defined(TARGET_ALPHA) 21724eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK 04 21734eeea4f3SRichard Henderson #define TARGET_O_APPEND 010 21744eeea4f3SRichard Henderson #define TARGET_O_CREAT 01000 /* not fcntl */ 21754eeea4f3SRichard Henderson #define TARGET_O_TRUNC 02000 /* not fcntl */ 21764eeea4f3SRichard Henderson #define TARGET_O_EXCL 04000 /* not fcntl */ 21774eeea4f3SRichard Henderson #define TARGET_O_NOCTTY 010000 /* not fcntl */ 21784eeea4f3SRichard Henderson #define TARGET_O_DSYNC 040000 21794eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0 /* not necessary, always 64-bit */ 21804eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY 0100000 /* must be a directory */ 21814eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW 0200000 /* don't follow links */ 21824eeea4f3SRichard Henderson #define TARGET_O_DIRECT 02000000 /* direct disk access hint */ 21834eeea4f3SRichard Henderson #define TARGET_O_NOATIME 04000000 21844eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 010000000 21854eeea4f3SRichard Henderson #define TARGET___O_SYNC 020000000 21864eeea4f3SRichard Henderson #define TARGET_O_PATH 040000000 21874eeea4f3SRichard Henderson #elif defined(TARGET_ARM) || defined(TARGET_M68K) 2188f09936acSbellard #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 2189f09936acSbellard #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 2190f09936acSbellard #define TARGET_O_DIRECT 0200000 /* direct disk access hint */ 2191f09936acSbellard #define TARGET_O_LARGEFILE 0400000 2192048f6b4dSbellard #elif defined(TARGET_MIPS) 2193048f6b4dSbellard #define TARGET_O_APPEND 0x0008 21944eeea4f3SRichard Henderson #define TARGET_O_DSYNC 0x0010 2195048f6b4dSbellard #define TARGET_O_NONBLOCK 0x0080 2196048f6b4dSbellard #define TARGET_O_CREAT 0x0100 /* not fcntl */ 2197048f6b4dSbellard #define TARGET_O_TRUNC 0x0200 /* not fcntl */ 2198048f6b4dSbellard #define TARGET_O_EXCL 0x0400 /* not fcntl */ 2199048f6b4dSbellard #define TARGET_O_NOCTTY 0x0800 /* not fcntl */ 2200048f6b4dSbellard #define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */ 2201048f6b4dSbellard #define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */ 22024eeea4f3SRichard Henderson #define TARGET___O_SYNC 0x4000 2203048f6b4dSbellard #define TARGET_O_DIRECT 0x8000 /* direct disk access hint */ 22044eeea4f3SRichard Henderson #elif defined (TARGET_PPC) 22054eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 22064eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 22074eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0200000 22084eeea4f3SRichard Henderson #define TARGET_O_DIRECT 0400000 /* direct disk access hint */ 22094eeea4f3SRichard Henderson #elif defined (TARGET_SPARC) 22101f961124Saurel32 #define TARGET_O_APPEND 0x0008 22114eeea4f3SRichard Henderson #define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */ 22121f961124Saurel32 #define TARGET_O_CREAT 0x0200 /* not fcntl */ 22131f961124Saurel32 #define TARGET_O_TRUNC 0x0400 /* not fcntl */ 22141f961124Saurel32 #define TARGET_O_EXCL 0x0800 /* not fcntl */ 22154eeea4f3SRichard Henderson #define TARGET_O_DSYNC 0x2000 22164eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK 0x4000 22174eeea4f3SRichard Henderson # ifdef TARGET_SPARC64 22184eeea4f3SRichard Henderson # define TARGET_O_NDELAY 0x0004 2219ffa65c3bSbellard # else 22204eeea4f3SRichard Henderson # define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK) 22214eeea4f3SRichard Henderson # endif 22224eeea4f3SRichard Henderson #define TARGET_O_NOCTTY 0x8000 /* not fcntl */ 22234eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0x40000 22244eeea4f3SRichard Henderson #define TARGET_O_DIRECT 0x100000 /* direct disk access hint */ 22254eeea4f3SRichard Henderson #define TARGET_O_NOATIME 0x200000 22264eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 0x400000 22274eeea4f3SRichard Henderson #define TARGET___O_SYNC 0x800000 22284eeea4f3SRichard Henderson #define TARGET_O_PATH 0x1000000 22294eeea4f3SRichard Henderson #endif 22304eeea4f3SRichard Henderson 22314eeea4f3SRichard Henderson /* <asm-generic/fcntl.h> values follow. */ 2232ffa65c3bSbellard #define TARGET_O_ACCMODE 0003 2233ffa65c3bSbellard #define TARGET_O_RDONLY 00 2234ffa65c3bSbellard #define TARGET_O_WRONLY 01 2235ffa65c3bSbellard #define TARGET_O_RDWR 02 22364eeea4f3SRichard Henderson #ifndef TARGET_O_CREAT 2237ffa65c3bSbellard #define TARGET_O_CREAT 0100 /* not fcntl */ 22384eeea4f3SRichard Henderson #endif 22394eeea4f3SRichard Henderson #ifndef TARGET_O_EXCL 2240ffa65c3bSbellard #define TARGET_O_EXCL 0200 /* not fcntl */ 22414eeea4f3SRichard Henderson #endif 22424eeea4f3SRichard Henderson #ifndef TARGET_O_NOCTTY 2243ffa65c3bSbellard #define TARGET_O_NOCTTY 0400 /* not fcntl */ 22444eeea4f3SRichard Henderson #endif 22454eeea4f3SRichard Henderson #ifndef TARGET_O_TRUNC 2246ffa65c3bSbellard #define TARGET_O_TRUNC 01000 /* not fcntl */ 22474eeea4f3SRichard Henderson #endif 22484eeea4f3SRichard Henderson #ifndef TARGET_O_APPEND 2249ffa65c3bSbellard #define TARGET_O_APPEND 02000 22504eeea4f3SRichard Henderson #endif 22514eeea4f3SRichard Henderson #ifndef TARGET_O_NONBLOCK 2252ffa65c3bSbellard #define TARGET_O_NONBLOCK 04000 22534eeea4f3SRichard Henderson #endif 22544eeea4f3SRichard Henderson #ifndef TARGET_O_DSYNC 22554eeea4f3SRichard Henderson #define TARGET_O_DSYNC 010000 22564eeea4f3SRichard Henderson #endif 22574eeea4f3SRichard Henderson #ifndef TARGET_FASYNC 2258ffa65c3bSbellard #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ 22594eeea4f3SRichard Henderson #endif 22604eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECT 2261ffa65c3bSbellard #define TARGET_O_DIRECT 040000 /* direct disk access hint */ 22624eeea4f3SRichard Henderson #endif 22634eeea4f3SRichard Henderson #ifndef TARGET_O_LARGEFILE 2264ffa65c3bSbellard #define TARGET_O_LARGEFILE 0100000 22654eeea4f3SRichard Henderson #endif 22664eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECTORY 2267ffa65c3bSbellard #define TARGET_O_DIRECTORY 0200000 /* must be a directory */ 22684eeea4f3SRichard Henderson #endif 22694eeea4f3SRichard Henderson #ifndef TARGET_O_NOFOLLOW 2270ffa65c3bSbellard #define TARGET_O_NOFOLLOW 0400000 /* don't follow links */ 2271ffa65c3bSbellard #endif 22724eeea4f3SRichard Henderson #ifndef TARGET_O_NOATIME 22734eeea4f3SRichard Henderson #define TARGET_O_NOATIME 01000000 22744eeea4f3SRichard Henderson #endif 22754eeea4f3SRichard Henderson #ifndef TARGET_O_CLOEXEC 22764eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 02000000 22774eeea4f3SRichard Henderson #endif 22784eeea4f3SRichard Henderson #ifndef TARGET___O_SYNC 22794eeea4f3SRichard Henderson #define TARGET___O_SYNC 04000000 22804eeea4f3SRichard Henderson #endif 22814eeea4f3SRichard Henderson #ifndef TARGET_O_PATH 22824eeea4f3SRichard Henderson #define TARGET_O_PATH 010000000 22834eeea4f3SRichard Henderson #endif 22844eeea4f3SRichard Henderson #ifndef TARGET_O_NDELAY 22854eeea4f3SRichard Henderson #define TARGET_O_NDELAY TARGET_O_NONBLOCK 22864eeea4f3SRichard Henderson #endif 22874eeea4f3SRichard Henderson #ifndef TARGET_O_SYNC 22884eeea4f3SRichard Henderson #define TARGET_O_SYNC (TARGET___O_SYNC | TARGET_O_DSYNC) 22894eeea4f3SRichard Henderson #endif 2290ffa65c3bSbellard 22912521d698Sbellard struct target_flock { 22922521d698Sbellard short l_type; 22932521d698Sbellard short l_whence; 2294992f48a0Sblueswir1 abi_ulong l_start; 2295992f48a0Sblueswir1 abi_ulong l_len; 22962521d698Sbellard int l_pid; 22972521d698Sbellard }; 22982521d698Sbellard 22992521d698Sbellard struct target_flock64 { 23002521d698Sbellard short l_type; 23012521d698Sbellard short l_whence; 2302b16189b2SChen Gang #if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) \ 2303b16189b2SChen Gang || defined(TARGET_SPARC) || defined(TARGET_HPPA) \ 2304b16189b2SChen Gang || defined(TARGET_MICROBLAZE) || defined(TARGET_TILEGX) 2305ce3f0e2fSaurel32 int __pad; 2306ce3f0e2fSaurel32 #endif 23072521d698Sbellard unsigned long long l_start; 23082521d698Sbellard unsigned long long l_len; 23092521d698Sbellard int l_pid; 2310541dc0d4SStefan Weil } QEMU_PACKED; 23112521d698Sbellard 2312ce4defa0Spbrook #ifdef TARGET_ARM 2313ce4defa0Spbrook struct target_eabi_flock64 { 2314ce4defa0Spbrook short l_type; 2315ce4defa0Spbrook short l_whence; 2316ce4defa0Spbrook int __pad; 2317ce4defa0Spbrook unsigned long long l_start; 2318ce4defa0Spbrook unsigned long long l_len; 2319ce4defa0Spbrook int l_pid; 2320541dc0d4SStefan Weil } QEMU_PACKED; 2321ce4defa0Spbrook #endif 23222521d698Sbellard 23238d5d3004SAndreas Schwab struct target_f_owner_ex { 23248d5d3004SAndreas Schwab int type; /* Owner type of ID. */ 23258d5d3004SAndreas Schwab int pid; /* ID of owner. */ 23268d5d3004SAndreas Schwab }; 23278d5d3004SAndreas Schwab 23282521d698Sbellard /* soundcard defines */ 232967cc32ebSVeres Lajos /* XXX: convert them all to arch independent entries */ 23302521d698Sbellard #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); 23312521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 23322521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 23332521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 23342521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA 0xc0144302 23352521d698Sbellard #define TARGET_SNDCTL_COPR_RESET 0x00004300 23362521d698Sbellard #define TARGET_SNDCTL_COPR_RUN 0xc0144306 23372521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 23382521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE 0x40144305 23392521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA 0x40144304 23402521d698Sbellard #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) 23412521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) 23422521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) 23432521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) 23442521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) 23452521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) 23462521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) 23472521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) 23482521d698Sbellard #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) 23492521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) 23502521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) 23512521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) 23522521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) 23532521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) 23542521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) 23552521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) 23562521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) 23572521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) 23585f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19) 23595f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20) 23602521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e 23612521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 23622521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 23632521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 23642521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 23652521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f 23662521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 23672521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO 0xc074510c 23682521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 23692521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 23702521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 23712521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 23722521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 23732521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 23742521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 23752521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 23762521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b 23772521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a 23782521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 23792521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC 0x00005111 23802521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 23812521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET 0x00005100 23822521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 23832521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC 0x00005101 23842521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 23852521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d 23862521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d 23872521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 23882521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e 23892521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 23902521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME 0x40045407 23912521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT 0x40045408 23922521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 23932521d698Sbellard #define TARGET_SNDCTL_TMR_START 0x00005402 23942521d698Sbellard #define TARGET_SNDCTL_TMR_STOP 0x00005403 23952521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 23962521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 23972521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE 0x80045002 23982521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 23992521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS 0x80045005 24002521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 24012521d698Sbellard #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) 24022521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 24032521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) 24042521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) 24052521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) 24062521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) 24072521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) 24082521d698Sbellard 24092521d698Sbellard #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) 24102521d698Sbellard 24112521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) 24122521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) 24132521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) 24142521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) 24152521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) 24162521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) 24172521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) 24182521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) 24192521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) 24202521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) 24212521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) 24222521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) 24232521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) 24242521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) 24252521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) 24262521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) 24272521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) 24282521d698Sbellard 24292521d698Sbellard /* Obsolete macros */ 24302521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) 24312521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) 24322521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) 24332521d698Sbellard 24342521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) 24352521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) 24362521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) 24372521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) 24382521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) 24392521d698Sbellard 24402521d698Sbellard #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) 24412521d698Sbellard 24422521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) 24432521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) 24442521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) 24452521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) 24462521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) 24472521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) 24482521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) 24492521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) 24502521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) 24512521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) 24522521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) 24532521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) 24542521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) 24552521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) 24562521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) 24572521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) 24582521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) 24592521d698Sbellard 24602521d698Sbellard /* Obsolete macros */ 24612521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) 24622521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) 24632521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) 24642521d698Sbellard 24652521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) 24662521d698Sbellard 24672521d698Sbellard /* vfat ioctls */ 24682521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) 24692521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) 2470a5448a7dSbellard 24718fbd6b52Sbalrog #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct mtop) 24728fbd6b52Sbalrog #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct mtget) 24738fbd6b52Sbalrog #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct mtpos) 24748fbd6b52Sbalrog 2475a5448a7dSbellard struct target_sysinfo { 2476992f48a0Sblueswir1 abi_long uptime; /* Seconds since boot */ 2477992f48a0Sblueswir1 abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */ 2478992f48a0Sblueswir1 abi_ulong totalram; /* Total usable main memory size */ 2479992f48a0Sblueswir1 abi_ulong freeram; /* Available memory size */ 2480992f48a0Sblueswir1 abi_ulong sharedram; /* Amount of shared memory */ 2481992f48a0Sblueswir1 abi_ulong bufferram; /* Memory used by buffers */ 2482992f48a0Sblueswir1 abi_ulong totalswap; /* Total swap space size */ 2483992f48a0Sblueswir1 abi_ulong freeswap; /* swap space still available */ 2484a5448a7dSbellard unsigned short procs; /* Number of current processes */ 2485a5448a7dSbellard unsigned short pad; /* explicit padding for m68k */ 2486992f48a0Sblueswir1 abi_ulong totalhigh; /* Total high memory size */ 2487992f48a0Sblueswir1 abi_ulong freehigh; /* Available high memory size */ 2488a5448a7dSbellard unsigned int mem_unit; /* Memory unit size in bytes */ 2489992f48a0Sblueswir1 char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 2490a5448a7dSbellard }; 24913532fa74Sbellard 24926556a833Saurel32 struct linux_dirent { 24936556a833Saurel32 long d_ino; 24946556a833Saurel32 unsigned long d_off; 24956556a833Saurel32 unsigned short d_reclen; 24966556a833Saurel32 char d_name[256]; /* We must not include limits.h! */ 24976556a833Saurel32 }; 24986556a833Saurel32 24996556a833Saurel32 struct linux_dirent64 { 25006556a833Saurel32 uint64_t d_ino; 25016556a833Saurel32 int64_t d_off; 25026556a833Saurel32 unsigned short d_reclen; 25036556a833Saurel32 unsigned char d_type; 25046556a833Saurel32 char d_name[256]; 25056556a833Saurel32 }; 25066556a833Saurel32 250724e1003aSaurel32 struct target_mq_attr { 250824e1003aSaurel32 abi_long mq_flags; 250924e1003aSaurel32 abi_long mq_maxmsg; 251024e1003aSaurel32 abi_long mq_msgsize; 251124e1003aSaurel32 abi_long mq_curmsgs; 251224e1003aSaurel32 }; 251324e1003aSaurel32 25143532fa74Sbellard #include "socket.h" 2515637947f1Sths 2516637947f1Sths #include "errno_defs.h" 251703dfe9f8SRiku Voipio 251803dfe9f8SRiku Voipio #define FUTEX_WAIT 0 251903dfe9f8SRiku Voipio #define FUTEX_WAKE 1 252003dfe9f8SRiku Voipio #define FUTEX_FD 2 252103dfe9f8SRiku Voipio #define FUTEX_REQUEUE 3 252203dfe9f8SRiku Voipio #define FUTEX_CMP_REQUEUE 4 252303dfe9f8SRiku Voipio #define FUTEX_WAKE_OP 5 252403dfe9f8SRiku Voipio #define FUTEX_LOCK_PI 6 252503dfe9f8SRiku Voipio #define FUTEX_UNLOCK_PI 7 252603dfe9f8SRiku Voipio #define FUTEX_TRYLOCK_PI 8 252703dfe9f8SRiku Voipio #define FUTEX_WAIT_BITSET 9 252803dfe9f8SRiku Voipio #define FUTEX_WAKE_BITSET 10 252903dfe9f8SRiku Voipio 253003dfe9f8SRiku Voipio #define FUTEX_PRIVATE_FLAG 128 253103dfe9f8SRiku Voipio #define FUTEX_CLOCK_REALTIME 256 253203dfe9f8SRiku Voipio #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) 253303dfe9f8SRiku Voipio 25343b6edd16SPeter Maydell #ifdef CONFIG_EPOLL 2535928bed6aSLaurent Vivier #if defined(TARGET_X86_64) 2536928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED QEMU_PACKED 2537928bed6aSLaurent Vivier #else 2538928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED 2539928bed6aSLaurent Vivier #endif 2540928bed6aSLaurent Vivier 25413b6edd16SPeter Maydell typedef union target_epoll_data { 25423b6edd16SPeter Maydell abi_ulong ptr; 2543928bed6aSLaurent Vivier abi_int fd; 2544928bed6aSLaurent Vivier abi_uint u32; 2545928bed6aSLaurent Vivier abi_ullong u64; 25463b6edd16SPeter Maydell } target_epoll_data_t; 25473b6edd16SPeter Maydell 25483b6edd16SPeter Maydell struct target_epoll_event { 2549928bed6aSLaurent Vivier abi_uint events; 25503b6edd16SPeter Maydell target_epoll_data_t data; 2551928bed6aSLaurent Vivier } TARGET_EPOLL_PACKED; 25523b6edd16SPeter Maydell #endif 2553163a05a8SPeter Maydell struct target_rlimit64 { 2554163a05a8SPeter Maydell uint64_t rlim_cur; 2555163a05a8SPeter Maydell uint64_t rlim_max; 2556163a05a8SPeter Maydell }; 2557583359a6SAkos PASZTORY 2558583359a6SAkos PASZTORY struct target_ucred { 2559583359a6SAkos PASZTORY uint32_t pid; 2560583359a6SAkos PASZTORY uint32_t uid; 2561583359a6SAkos PASZTORY uint32_t gid; 2562583359a6SAkos PASZTORY }; 2563cb9c377fSPaolo Bonzini 2564cb9c377fSPaolo Bonzini #endif 2565905bba13SErik de Castro Lopo 2566aecc8861SAlexander Graf typedef int32_t target_timer_t; 2567905bba13SErik de Castro Lopo 256834d60862SNatanael Copa #define TARGET_SIGEV_MAX_SIZE 64 256934d60862SNatanael Copa 257034d60862SNatanael Copa /* This is architecture-specific but most architectures use the default */ 257134d60862SNatanael Copa #ifdef TARGET_MIPS 257234d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long)) 257334d60862SNatanael Copa #else 257434d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ 257534d60862SNatanael Copa + sizeof(target_sigval_t)) 257634d60862SNatanael Copa #endif 257734d60862SNatanael Copa 257834d60862SNatanael Copa #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ 257934d60862SNatanael Copa - TARGET_SIGEV_PREAMBLE_SIZE) \ 258034d60862SNatanael Copa / sizeof(int32_t)) 258134d60862SNatanael Copa 2582905bba13SErik de Castro Lopo struct target_sigevent { 2583905bba13SErik de Castro Lopo target_sigval_t sigev_value; 2584905bba13SErik de Castro Lopo int32_t sigev_signo; 2585905bba13SErik de Castro Lopo int32_t sigev_notify; 2586905bba13SErik de Castro Lopo union { 258734d60862SNatanael Copa int32_t _pad[TARGET_SIGEV_PAD_SIZE]; 2588905bba13SErik de Castro Lopo int32_t _tid; 2589905bba13SErik de Castro Lopo 2590905bba13SErik de Castro Lopo struct { 2591905bba13SErik de Castro Lopo void (*_function)(sigval_t); 2592905bba13SErik de Castro Lopo void *_attribute; 2593905bba13SErik de Castro Lopo } _sigev_thread; 2594905bba13SErik de Castro Lopo } _sigev_un; 2595905bba13SErik de Castro Lopo }; 2596e0eb210eSPeter Maydell 2597e0eb210eSPeter Maydell struct target_user_cap_header { 2598e0eb210eSPeter Maydell uint32_t version; 2599e0eb210eSPeter Maydell int pid; 2600e0eb210eSPeter Maydell }; 2601e0eb210eSPeter Maydell 2602e0eb210eSPeter Maydell struct target_user_cap_data { 2603e0eb210eSPeter Maydell uint32_t effective; 2604e0eb210eSPeter Maydell uint32_t permitted; 2605e0eb210eSPeter Maydell uint32_t inheritable; 2606e0eb210eSPeter Maydell }; 2607