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 58*716f3fbeSPeter Maydell #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 59*716f3fbeSPeter 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 6762521d698Sbellard typedef struct target_siginfo { 6773f53d546Spbrook #ifdef TARGET_MIPS 6783f53d546Spbrook int si_signo; 6793f53d546Spbrook int si_code; 6803f53d546Spbrook int si_errno; 6813f53d546Spbrook #else 6822521d698Sbellard int si_signo; 6832521d698Sbellard int si_errno; 6842521d698Sbellard int si_code; 6853f53d546Spbrook #endif 6862521d698Sbellard 6872521d698Sbellard union { 6882521d698Sbellard int _pad[TARGET_SI_PAD_SIZE]; 6892521d698Sbellard 6902521d698Sbellard /* kill() */ 6912521d698Sbellard struct { 6922521d698Sbellard pid_t _pid; /* sender's pid */ 6932521d698Sbellard uid_t _uid; /* sender's uid */ 6942521d698Sbellard } _kill; 6952521d698Sbellard 6962521d698Sbellard /* POSIX.1b timers */ 6972521d698Sbellard struct { 6982521d698Sbellard unsigned int _timer1; 6992521d698Sbellard unsigned int _timer2; 7002521d698Sbellard } _timer; 7012521d698Sbellard 7022521d698Sbellard /* POSIX.1b signals */ 7032521d698Sbellard struct { 7042521d698Sbellard pid_t _pid; /* sender's pid */ 7052521d698Sbellard uid_t _uid; /* sender's uid */ 706c227f099SAnthony Liguori target_sigval_t _sigval; 7072521d698Sbellard } _rt; 7082521d698Sbellard 7092521d698Sbellard /* SIGCHLD */ 7102521d698Sbellard struct { 7112521d698Sbellard pid_t _pid; /* which child */ 7122521d698Sbellard uid_t _uid; /* sender's uid */ 7132521d698Sbellard int _status; /* exit code */ 714c227f099SAnthony Liguori target_clock_t _utime; 715c227f099SAnthony Liguori target_clock_t _stime; 7162521d698Sbellard } _sigchld; 7172521d698Sbellard 7182521d698Sbellard /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 7192521d698Sbellard struct { 720992f48a0Sblueswir1 abi_ulong _addr; /* faulting insn/memory ref. */ 7212521d698Sbellard } _sigfault; 7222521d698Sbellard 7232521d698Sbellard /* SIGPOLL */ 7242521d698Sbellard struct { 7252521d698Sbellard int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 7262521d698Sbellard int _fd; 7272521d698Sbellard } _sigpoll; 7282521d698Sbellard } _sifields; 729c227f099SAnthony Liguori } target_siginfo_t; 7302521d698Sbellard 7312521d698Sbellard /* 7322521d698Sbellard * si_code values 7332521d698Sbellard * Digital reserves positive values for kernel-generated signals. 7342521d698Sbellard */ 7352521d698Sbellard #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ 7362521d698Sbellard #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 7372521d698Sbellard #define TARGET_SI_QUEUE -1 /* sent by sigqueue */ 7382521d698Sbellard #define TARGET_SI_TIMER -2 /* sent by timer expiration */ 7392521d698Sbellard #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ 7402521d698Sbellard #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ 7412521d698Sbellard #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ 7422521d698Sbellard 7432521d698Sbellard /* 7442521d698Sbellard * SIGILL si_codes 7452521d698Sbellard */ 746ffa65c3bSbellard #define TARGET_ILL_ILLOPC (1) /* illegal opcode */ 7472521d698Sbellard #define TARGET_ILL_ILLOPN (2) /* illegal operand */ 748ffa65c3bSbellard #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ 749ffa65c3bSbellard #define TARGET_ILL_ILLTRP (4) /* illegal trap */ 750ffa65c3bSbellard #define TARGET_ILL_PRVOPC (5) /* privileged opcode */ 751ffa65c3bSbellard #define TARGET_ILL_PRVREG (6) /* privileged register */ 752ffa65c3bSbellard #define TARGET_ILL_COPROC (7) /* coprocessor error */ 753ffa65c3bSbellard #define TARGET_ILL_BADSTK (8) /* internal stack error */ 754de2fdd56SChen Gang #ifdef TARGET_TILEGX 755de2fdd56SChen Gang #define TARGET_ILL_DBLFLT (9) /* double fault */ 756de2fdd56SChen Gang #define TARGET_ILL_HARDWALL (10) /* user networks hardwall violation */ 757de2fdd56SChen Gang #endif 7582521d698Sbellard 7592521d698Sbellard /* 7602521d698Sbellard * SIGFPE si_codes 7612521d698Sbellard */ 7622521d698Sbellard #define TARGET_FPE_INTDIV (1) /* integer divide by zero */ 7632521d698Sbellard #define TARGET_FPE_INTOVF (2) /* integer overflow */ 7642521d698Sbellard #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ 7652521d698Sbellard #define TARGET_FPE_FLTOVF (4) /* floating point overflow */ 7662521d698Sbellard #define TARGET_FPE_FLTUND (5) /* floating point underflow */ 7672521d698Sbellard #define TARGET_FPE_FLTRES (6) /* floating point inexact result */ 7682521d698Sbellard #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ 7692521d698Sbellard #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ 7702521d698Sbellard #define TARGET_NSIGFPE 8 7712521d698Sbellard 7722521d698Sbellard /* 7732521d698Sbellard * SIGSEGV si_codes 7742521d698Sbellard */ 7752521d698Sbellard #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ 7762521d698Sbellard #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ 777de2fdd56SChen Gang #define TARGET_SEGV_BNDERR (3) /* failed address bound checks */ 7782521d698Sbellard 7792521d698Sbellard /* 780ffa65c3bSbellard * SIGBUS si_codes 781ffa65c3bSbellard */ 782ffa65c3bSbellard #define TARGET_BUS_ADRALN (1) /* invalid address alignment */ 783b4916d7bSDong Xu Wang #define TARGET_BUS_ADRERR (2) /* non-existent physical address */ 784ffa65c3bSbellard #define TARGET_BUS_OBJERR (3) /* object specific hardware error */ 785de2fdd56SChen Gang /* hardware memory error consumed on a machine check: action required */ 786de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AR (4) 787de2fdd56SChen Gang /* hardware memory error detected in process but not consumed: action optional*/ 788de2fdd56SChen Gang #define TARGET_BUS_MCEERR_AO (5) 789ffa65c3bSbellard 790ffa65c3bSbellard /* 7912521d698Sbellard * SIGTRAP si_codes 7922521d698Sbellard */ 7932521d698Sbellard #define TARGET_TRAP_BRKPT (1) /* process breakpoint */ 7942521d698Sbellard #define TARGET_TRAP_TRACE (2) /* process trace trap */ 795de2fdd56SChen Gang #define TARGET_TRAP_BRANCH (3) /* process taken branch trap */ 796de2fdd56SChen Gang #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */ 7972521d698Sbellard 7982521d698Sbellard #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */ 7992521d698Sbellard 8009de5e440Sbellard struct target_rlimit { 801992f48a0Sblueswir1 abi_ulong rlim_cur; 802992f48a0Sblueswir1 abi_ulong rlim_max; 8039de5e440Sbellard }; 8049de5e440Sbellard 80581bbe906Stakasi-y@ops.dti.ne.jp #if defined(TARGET_ALPHA) 806e476492eSAurelien Jarno #define TARGET_RLIM_INFINITY 0x7fffffffffffffffull 8076cafd027SMatthias Braun #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32) 80881bbe906Stakasi-y@ops.dti.ne.jp #define TARGET_RLIM_INFINITY 0x7fffffffUL 80981bbe906Stakasi-y@ops.dti.ne.jp #else 81026b746dbSMatthias Braun #define TARGET_RLIM_INFINITY ((abi_ulong)-1) 81181bbe906Stakasi-y@ops.dti.ne.jp #endif 81281bbe906Stakasi-y@ops.dti.ne.jp 813e22b7015SWesley W. Terpstra #if defined(TARGET_MIPS) 814e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 815e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 816e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 817e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 818e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 819e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 7 820e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 8 821e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 5 822e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 9 823e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 6 824e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 825e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 826e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 827e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 828e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 829e22b7015SWesley W. Terpstra #else 830e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CPU 0 831e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_FSIZE 1 832e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_DATA 2 833e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_STACK 3 834e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_CORE 4 835e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RSS 5 8366cafd027SMatthias Braun #if defined(TARGET_SPARC) 8376cafd027SMatthias Braun #define TARGET_RLIMIT_NOFILE 6 8386cafd027SMatthias Braun #define TARGET_RLIMIT_NPROC 7 8396cafd027SMatthias Braun #else 840e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NPROC 6 841e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NOFILE 7 8426cafd027SMatthias Braun #endif 843e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MEMLOCK 8 844e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_AS 9 845e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_LOCKS 10 846e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_SIGPENDING 11 847e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_MSGQUEUE 12 848e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_NICE 13 849e22b7015SWesley W. Terpstra #define TARGET_RLIMIT_RTPRIO 14 850e22b7015SWesley W. Terpstra #endif 851e22b7015SWesley W. Terpstra 8529de5e440Sbellard struct target_pollfd { 8539de5e440Sbellard int fd; /* file descriptor */ 8549de5e440Sbellard short events; /* requested events */ 8559de5e440Sbellard short revents; /* returned events */ 8569de5e440Sbellard }; 8579de5e440Sbellard 8588e5a0667Sbellard /* virtual terminal ioctls */ 8590221cfcdSbellard #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ 8600221cfcdSbellard #define TARGET_KDMKTONE 0x4B30 /* generate tone */ 8618e5a0667Sbellard #define TARGET_KDGKBTYPE 0x4b33 862f7680a55SUlrich Hecht #define TARGET_KDSETMODE 0x4b3a 863f7680a55SUlrich Hecht #define TARGET_KDGKBMODE 0x4b44 864f7680a55SUlrich Hecht #define TARGET_KDSKBMODE 0x4b45 8650221cfcdSbellard #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ 8660221cfcdSbellard #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ 867e6fe18fbSCédric VINCENT #define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ 868e6fe18fbSCédric VINCENT #define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ 869e6fe18fbSCédric VINCENT #define TARGET_KDGETLED 0x4B31 /* return current led state */ 870e6fe18fbSCédric VINCENT #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */ 871ca56f5b5SPaul Burton #define TARGET_KDSIGACCEPT 0x4B4E 8728e5a0667Sbellard 8732521d698Sbellard #define TARGET_SIOCATMARK 0x8905 8742521d698Sbellard 87531e31b8aSbellard /* Networking ioctls */ 87631e31b8aSbellard #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ 87731e31b8aSbellard #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ 87831e31b8aSbellard #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ 87931e31b8aSbellard #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ 88031e31b8aSbellard #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ 88131e31b8aSbellard #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ 88231e31b8aSbellard #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ 88331e31b8aSbellard #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ 88431e31b8aSbellard #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ 88531e31b8aSbellard #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ 88631e31b8aSbellard #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ 88731e31b8aSbellard #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ 88831e31b8aSbellard #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ 88931e31b8aSbellard #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ 89031e31b8aSbellard #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ 89131e31b8aSbellard #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ 89231e31b8aSbellard #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ 89331e31b8aSbellard #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ 89431e31b8aSbellard #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ 89531e31b8aSbellard #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ 89631e31b8aSbellard #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ 89731e31b8aSbellard #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ 89831e31b8aSbellard #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ 89931e31b8aSbellard #define TARGET_SIOCSIFENCAP 0x8926 90031e31b8aSbellard #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ 90131e31b8aSbellard #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ 90231e31b8aSbellard #define TARGET_SIOCSIFSLAVE 0x8930 90331e31b8aSbellard #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ 90431e31b8aSbellard #define TARGET_SIOCDELMULTI 0x8932 905f63eb01aSPaul Burton #define TARGET_SIOCGIFINDEX 0x8933 90631e31b8aSbellard 90731e31b8aSbellard /* Bridging control calls */ 90831e31b8aSbellard #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ 90931e31b8aSbellard #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ 91031e31b8aSbellard 91131e31b8aSbellard #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ 91231e31b8aSbellard #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ 91331e31b8aSbellard 91431e31b8aSbellard /* ARP cache control calls. */ 91531e31b8aSbellard #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ 91631e31b8aSbellard #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ 91731e31b8aSbellard #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ 91831e31b8aSbellard #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ 91931e31b8aSbellard #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ 92031e31b8aSbellard #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ 92131e31b8aSbellard 92231e31b8aSbellard /* RARP cache control calls. */ 92331e31b8aSbellard #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ 92431e31b8aSbellard #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ 92531e31b8aSbellard #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ 92631e31b8aSbellard 92731e31b8aSbellard /* Driver configuration calls */ 92831e31b8aSbellard #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ 92931e31b8aSbellard #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ 93031e31b8aSbellard 93131e31b8aSbellard /* DLCI configuration calls */ 93231e31b8aSbellard #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ 93331e31b8aSbellard #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ 93431e31b8aSbellard 93586fcd946SLaurent Vivier /* From <linux/wireless.h> */ 93686fcd946SLaurent Vivier 93786fcd946SLaurent Vivier #define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ 93831e31b8aSbellard 93931e31b8aSbellard /* From <linux/fs.h> */ 94031e31b8aSbellard 94131e31b8aSbellard #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ 94231e31b8aSbellard #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ 94331e31b8aSbellard #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ 94431e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ 94531e31b8aSbellard #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ 94631e31b8aSbellard #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ 94731e31b8aSbellard #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ 94831e31b8aSbellard #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ 94931e31b8aSbellard #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ 95031e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ 95131e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ 95231e31b8aSbellard #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ 953fff8c539SAndreas Färber #define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */ 95431e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */ 955c8b0bf54SPeter Maydell #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong) 956c8b0bf54SPeter Maydell #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong) 957edafea13SAlexander Graf #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) 958edafea13SAlexander Graf /* return device size in bytes 959edafea13SAlexander Graf (u64 *arg) */ 96031e31b8aSbellard #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ 96131e31b8aSbellard #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ 962285da2b9SPeter Maydell #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) 96331e31b8aSbellard 96431e31b8aSbellard /* cdrom commands */ 96531e31b8aSbellard #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ 96631e31b8aSbellard #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ 96731e31b8aSbellard #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ 96831e31b8aSbellard #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index 96931e31b8aSbellard (struct cdrom_ti) */ 97031e31b8aSbellard #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header 97131e31b8aSbellard (struct cdrom_tochdr) */ 97231e31b8aSbellard #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry 97331e31b8aSbellard (struct cdrom_tocentry) */ 97431e31b8aSbellard #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ 97531e31b8aSbellard #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ 97631e31b8aSbellard #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ 97731e31b8aSbellard #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume 97831e31b8aSbellard (struct cdrom_volctrl) */ 97931e31b8aSbellard #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data 98031e31b8aSbellard (struct cdrom_subchnl) */ 98131e31b8aSbellard #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) 98231e31b8aSbellard (struct cdrom_read) */ 98331e31b8aSbellard #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) 98431e31b8aSbellard (struct cdrom_read) */ 98531e31b8aSbellard #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ 98631e31b8aSbellard #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ 98731e31b8aSbellard #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session 98831e31b8aSbellard address of multi session disks 98931e31b8aSbellard (struct cdrom_multisession) */ 99031e31b8aSbellard #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" 99131e31b8aSbellard if available (struct cdrom_mcn) */ 99267cc32ebSVeres Lajos #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is deprecated, 993b4916d7bSDong Xu Wang but here anyway for compatibility */ 99431e31b8aSbellard #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ 99531e31b8aSbellard #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting 99631e31b8aSbellard (struct cdrom_volctrl) */ 99731e31b8aSbellard #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) 99831e31b8aSbellard (struct cdrom_read) */ 99931e31b8aSbellard /* 100031e31b8aSbellard * These ioctls are used only used in aztcd.c and optcd.c 100131e31b8aSbellard */ 100231e31b8aSbellard #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ 100331e31b8aSbellard #define TARGET_CDROMSEEK 0x5316 /* seek msf address */ 100431e31b8aSbellard 100531e31b8aSbellard /* 100631e31b8aSbellard * This ioctl is only used by the scsi-cd driver. 100731e31b8aSbellard It is for playing audio in logical block addressing mode. 100831e31b8aSbellard */ 100931e31b8aSbellard #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ 101031e31b8aSbellard 101131e31b8aSbellard /* 101231e31b8aSbellard * These ioctls are only used in optcd.c 101331e31b8aSbellard */ 101431e31b8aSbellard #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ 101531e31b8aSbellard 101631e31b8aSbellard /* 101731e31b8aSbellard * These ioctls are (now) only in ide-cd.c for controlling 101831e31b8aSbellard * drive spindown time. They should be implemented in the 101931e31b8aSbellard * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, 102031e31b8aSbellard * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... 102131e31b8aSbellard * -Erik 102231e31b8aSbellard */ 102331e31b8aSbellard #define TARGET_CDROMGETSPINDOWN 0x531d 102431e31b8aSbellard #define TARGET_CDROMSETSPINDOWN 0x531e 102531e31b8aSbellard 102631e31b8aSbellard /* 102731e31b8aSbellard * These ioctls are implemented through the uniform CD-ROM driver 102831e31b8aSbellard * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM 102931e31b8aSbellard * drivers are eventually ported to the uniform CD-ROM driver interface. 103031e31b8aSbellard */ 103131e31b8aSbellard #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ 103231e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ 103331e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ 103431e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ 103531e31b8aSbellard #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ 103631e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ 103731e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ 103831e31b8aSbellard #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ 103931e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ 104031e31b8aSbellard #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ 104131e31b8aSbellard #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ 104231e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ 104331e31b8aSbellard 104431e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. 104531e31b8aSbellard * Future CDROM ioctls should be kept below 0x537F 104631e31b8aSbellard */ 104731e31b8aSbellard 104831e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */ 104931e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ 105031e31b8aSbellard /* conflict with SCSI_IOCTL_GET_IDLUN */ 105131e31b8aSbellard 105231e31b8aSbellard /* DVD-ROM Specific ioctls */ 105331e31b8aSbellard #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ 105431e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ 105531e31b8aSbellard #define TARGET_DVD_AUTH 0x5392 /* Authentication */ 105631e31b8aSbellard 105731e31b8aSbellard #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ 105831e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ 105931e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ 106031e31b8aSbellard 106131e31b8aSbellard /* HD commands */ 106231e31b8aSbellard 106331e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ 106431e31b8aSbellard #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ 106531e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ 106631e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ 106731e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ 106831e31b8aSbellard #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ 106931e31b8aSbellard #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ 107031e31b8aSbellard #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ 10712521d698Sbellard #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ 107231e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ 107331e31b8aSbellard 107431e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ 107531e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ 107631e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ 107731e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ 107831e31b8aSbellard #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ 107931e31b8aSbellard #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ 108031e31b8aSbellard #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ 108131e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ 10822521d698Sbellard 1083b8005914Sbalrog /* loop ioctls */ 1084b8005914Sbalrog #define TARGET_LOOP_SET_FD 0x4C00 1085b8005914Sbalrog #define TARGET_LOOP_CLR_FD 0x4C01 1086b8005914Sbalrog #define TARGET_LOOP_SET_STATUS 0x4C02 1087b8005914Sbalrog #define TARGET_LOOP_GET_STATUS 0x4C03 1088b8005914Sbalrog #define TARGET_LOOP_SET_STATUS64 0x4C04 1089b8005914Sbalrog #define TARGET_LOOP_GET_STATUS64 0x4C05 1090b8005914Sbalrog #define TARGET_LOOP_CHANGE_FD 0x4C06 10912521d698Sbellard 1092f7680a55SUlrich Hecht /* fb ioctls */ 1093f7680a55SUlrich Hecht #define TARGET_FBIOGET_VSCREENINFO 0x4600 1094f7680a55SUlrich Hecht #define TARGET_FBIOPUT_VSCREENINFO 0x4601 1095f7680a55SUlrich Hecht #define TARGET_FBIOGET_FSCREENINFO 0x4602 109612b81b71SCédric VINCENT #define TARGET_FBIOGETCMAP 0x4604 109712b81b71SCédric VINCENT #define TARGET_FBIOPUTCMAP 0x4605 109812b81b71SCédric VINCENT #define TARGET_FBIOPAN_DISPLAY 0x4606 109912b81b71SCédric VINCENT #define TARGET_FBIOGET_CON2FBMAP 0x460F 110012b81b71SCédric VINCENT #define TARGET_FBIOPUT_CON2FBMAP 0x4610 1101f7680a55SUlrich Hecht 1102f7680a55SUlrich Hecht /* vt ioctls */ 1103f7680a55SUlrich Hecht #define TARGET_VT_OPENQRY 0x5600 1104f7680a55SUlrich Hecht #define TARGET_VT_GETSTATE 0x5603 1105f7680a55SUlrich Hecht #define TARGET_VT_ACTIVATE 0x5606 1106f7680a55SUlrich Hecht #define TARGET_VT_WAITACTIVE 0x5607 1107f7680a55SUlrich Hecht #define TARGET_VT_LOCKSWITCH 0x560b 1108f7680a55SUlrich Hecht #define TARGET_VT_UNLOCKSWITCH 0x560c 1109774750c0SCédric VINCENT #define TARGET_VT_GETMODE 0x5601 1110774750c0SCédric VINCENT #define TARGET_VT_SETMODE 0x5602 1111774750c0SCédric VINCENT #define TARGET_VT_RELDISP 0x5605 1112774750c0SCédric VINCENT #define TARGET_VT_DISALLOCATE 0x5608 1113f7680a55SUlrich Hecht 111456e904ecSAlexander Graf /* device mapper */ 111556e904ecSAlexander Graf #define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00) 111656e904ecSAlexander Graf #define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01) 111756e904ecSAlexander Graf #define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02) 111856e904ecSAlexander Graf #define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03) 111956e904ecSAlexander Graf #define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04) 112056e904ecSAlexander Graf #define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05) 112156e904ecSAlexander Graf #define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06) 112256e904ecSAlexander Graf #define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07) 112356e904ecSAlexander Graf #define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08) 112456e904ecSAlexander Graf #define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09) 112556e904ecSAlexander Graf #define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a) 112656e904ecSAlexander Graf #define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b) 112756e904ecSAlexander Graf #define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c) 112856e904ecSAlexander Graf #define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d) 112956e904ecSAlexander Graf #define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e) 113056e904ecSAlexander Graf #define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f) 113156e904ecSAlexander Graf 11322521d698Sbellard /* from asm/termbits.h */ 11332521d698Sbellard 11343bfd9da1Sbellard #define TARGET_NCC 8 11353bfd9da1Sbellard struct target_termio { 11363bfd9da1Sbellard unsigned short c_iflag; /* input mode flags */ 11373bfd9da1Sbellard unsigned short c_oflag; /* output mode flags */ 11383bfd9da1Sbellard unsigned short c_cflag; /* control mode flags */ 11393bfd9da1Sbellard unsigned short c_lflag; /* local mode flags */ 11402521d698Sbellard unsigned char c_line; /* line discipline */ 11413bfd9da1Sbellard unsigned char c_cc[TARGET_NCC]; /* control characters */ 11422521d698Sbellard }; 11432521d698Sbellard 11443bfd9da1Sbellard struct target_winsize { 11453bfd9da1Sbellard unsigned short ws_row; 11463bfd9da1Sbellard unsigned short ws_col; 11473bfd9da1Sbellard unsigned short ws_xpixel; 11483bfd9da1Sbellard unsigned short ws_ypixel; 11493bfd9da1Sbellard }; 11502521d698Sbellard 11513bfd9da1Sbellard #include "termbits.h" 11522521d698Sbellard 11539e0b74a4SPaul Brook #if defined(TARGET_MIPS) 11549e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x10 11559e0b74a4SPaul Brook #else 11569e0b74a4SPaul Brook #define TARGET_PROT_SEM 0x08 11579e0b74a4SPaul Brook #endif 11589e0b74a4SPaul Brook 1159e44a3e79Saurel32 /* Common */ 11602521d698Sbellard #define TARGET_MAP_SHARED 0x01 /* Share changes */ 11612521d698Sbellard #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ 11622521d698Sbellard #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ 1163e44a3e79Saurel32 1164e44a3e79Saurel32 /* Target specific */ 1165048f6b4dSbellard #if defined(TARGET_MIPS) 1166e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1167048f6b4dSbellard #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 1168048f6b4dSbellard #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 1169048f6b4dSbellard #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 1170048f6b4dSbellard #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 1171048f6b4dSbellard #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 1172048f6b4dSbellard #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 1173540635baSths #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ 1174540635baSths #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ 1175e44a3e79Saurel32 #elif defined(TARGET_PPC) 1176e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 11772521d698Sbellard #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 11782521d698Sbellard #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 11792521d698Sbellard #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 11802521d698Sbellard #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 11817ec93196Sj_mayer #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ 11827ec93196Sj_mayer #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ 1183e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1184e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1185e44a3e79Saurel32 #elif defined(TARGET_ALPHA) 1186e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ 1187e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ 1188e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ 1189e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ 1190e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ 1191e44a3e79Saurel32 #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ 1192e44a3e79Saurel32 #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ 1193e44a3e79Saurel32 #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ 1194e44a3e79Saurel32 #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ 11957ec93196Sj_mayer #else 1196e44a3e79Saurel32 #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 1197e44a3e79Saurel32 #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 1198e44a3e79Saurel32 #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 1199e44a3e79Saurel32 #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 1200e44a3e79Saurel32 #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 12012521d698Sbellard #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ 12022521d698Sbellard #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ 1203540635baSths #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ 1204540635baSths #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ 1205906c1b8eSMike Frysinger #define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ 12067ec93196Sj_mayer #endif 12072521d698Sbellard 120809701199SAlexander Graf #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ 120909701199SAlexander Graf || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ 1210c7819dfbSPeter Maydell || defined(TARGET_CRIS) || defined(TARGET_UNICORE32) 12112521d698Sbellard struct target_stat { 12122521d698Sbellard unsigned short st_dev; 12132521d698Sbellard unsigned short __pad1; 1214992f48a0Sblueswir1 abi_ulong st_ino; 12152521d698Sbellard unsigned short st_mode; 12162521d698Sbellard unsigned short st_nlink; 12172521d698Sbellard unsigned short st_uid; 12182521d698Sbellard unsigned short st_gid; 12192521d698Sbellard unsigned short st_rdev; 12202521d698Sbellard unsigned short __pad2; 1221992f48a0Sblueswir1 abi_ulong st_size; 1222992f48a0Sblueswir1 abi_ulong st_blksize; 1223992f48a0Sblueswir1 abi_ulong st_blocks; 1224992f48a0Sblueswir1 abi_ulong target_st_atime; 1225992f48a0Sblueswir1 abi_ulong __unused1; 1226992f48a0Sblueswir1 abi_ulong target_st_mtime; 1227992f48a0Sblueswir1 abi_ulong __unused2; 1228992f48a0Sblueswir1 abi_ulong target_st_ctime; 1229992f48a0Sblueswir1 abi_ulong __unused3; 1230992f48a0Sblueswir1 abi_ulong __unused4; 1231992f48a0Sblueswir1 abi_ulong __unused5; 12322521d698Sbellard }; 12332521d698Sbellard 12342521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely 12352521d698Sbellard * insane amounts of padding around dev_t's. 12362521d698Sbellard */ 123720d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 12382521d698Sbellard struct target_stat64 { 12392521d698Sbellard unsigned short st_dev; 12402521d698Sbellard unsigned char __pad0[10]; 12412521d698Sbellard 12422521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1243992f48a0Sblueswir1 abi_ulong __st_ino; 12442521d698Sbellard 12452521d698Sbellard unsigned int st_mode; 12462521d698Sbellard unsigned int st_nlink; 12472521d698Sbellard 1248992f48a0Sblueswir1 abi_ulong st_uid; 1249992f48a0Sblueswir1 abi_ulong st_gid; 12502521d698Sbellard 12512521d698Sbellard unsigned short st_rdev; 12522521d698Sbellard unsigned char __pad3[10]; 12532521d698Sbellard 12542521d698Sbellard long long st_size; 1255992f48a0Sblueswir1 abi_ulong st_blksize; 12562521d698Sbellard 1257992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1258992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 12592521d698Sbellard 1260992f48a0Sblueswir1 abi_ulong target_st_atime; 1261992f48a0Sblueswir1 abi_ulong __pad5; 12622521d698Sbellard 1263992f48a0Sblueswir1 abi_ulong target_st_mtime; 1264992f48a0Sblueswir1 abi_ulong __pad6; 12652521d698Sbellard 1266992f48a0Sblueswir1 abi_ulong target_st_ctime; 1267992f48a0Sblueswir1 abi_ulong __pad7; /* will be high 32 bits of ctime someday */ 12682521d698Sbellard 12692521d698Sbellard unsigned long long st_ino; 1270541dc0d4SStefan Weil } QEMU_PACKED; 12712521d698Sbellard 1272ce4defa0Spbrook #ifdef TARGET_ARM 127320d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1274ce4defa0Spbrook struct target_eabi_stat64 { 1275ce4defa0Spbrook unsigned long long st_dev; 1276ce4defa0Spbrook unsigned int __pad1; 1277992f48a0Sblueswir1 abi_ulong __st_ino; 1278ce4defa0Spbrook unsigned int st_mode; 1279ce4defa0Spbrook unsigned int st_nlink; 1280ce4defa0Spbrook 1281992f48a0Sblueswir1 abi_ulong st_uid; 1282992f48a0Sblueswir1 abi_ulong st_gid; 1283ce4defa0Spbrook 1284ce4defa0Spbrook unsigned long long st_rdev; 1285ce4defa0Spbrook unsigned int __pad2[2]; 1286ce4defa0Spbrook 1287ce4defa0Spbrook long long st_size; 1288992f48a0Sblueswir1 abi_ulong st_blksize; 1289ce4defa0Spbrook unsigned int __pad3; 1290ce4defa0Spbrook unsigned long long st_blocks; 1291ce4defa0Spbrook 1292992f48a0Sblueswir1 abi_ulong target_st_atime; 1293992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1294ce4defa0Spbrook 1295992f48a0Sblueswir1 abi_ulong target_st_mtime; 1296992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1297ce4defa0Spbrook 1298992f48a0Sblueswir1 abi_ulong target_st_ctime; 1299992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1300ce4defa0Spbrook 1301ce4defa0Spbrook unsigned long long st_ino; 1302541dc0d4SStefan Weil } QEMU_PACKED; 1303ce4defa0Spbrook #endif 1304ce4defa0Spbrook 1305992f48a0Sblueswir1 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) 13061b8dd648Sblueswir1 struct target_stat { 13071b8dd648Sblueswir1 unsigned int st_dev; 1308992f48a0Sblueswir1 abi_ulong st_ino; 13091b8dd648Sblueswir1 unsigned int st_mode; 13101b8dd648Sblueswir1 unsigned int st_nlink; 13111b8dd648Sblueswir1 unsigned int st_uid; 13121b8dd648Sblueswir1 unsigned int st_gid; 13131b8dd648Sblueswir1 unsigned int st_rdev; 1314992f48a0Sblueswir1 abi_long st_size; 1315992f48a0Sblueswir1 abi_long target_st_atime; 1316992f48a0Sblueswir1 abi_long target_st_mtime; 1317992f48a0Sblueswir1 abi_long target_st_ctime; 1318992f48a0Sblueswir1 abi_long st_blksize; 1319992f48a0Sblueswir1 abi_long st_blocks; 1320992f48a0Sblueswir1 abi_ulong __unused4[2]; 13211b8dd648Sblueswir1 }; 13221b8dd648Sblueswir1 132320d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 13241b8dd648Sblueswir1 struct target_stat64 { 13251b8dd648Sblueswir1 unsigned char __pad0[6]; 13261b8dd648Sblueswir1 unsigned short st_dev; 13271b8dd648Sblueswir1 13281b8dd648Sblueswir1 uint64_t st_ino; 13291b8dd648Sblueswir1 uint64_t st_nlink; 13301b8dd648Sblueswir1 13311b8dd648Sblueswir1 unsigned int st_mode; 13321b8dd648Sblueswir1 13331b8dd648Sblueswir1 unsigned int st_uid; 13341b8dd648Sblueswir1 unsigned int st_gid; 13351b8dd648Sblueswir1 13361b8dd648Sblueswir1 unsigned char __pad2[6]; 13371b8dd648Sblueswir1 unsigned short st_rdev; 13381b8dd648Sblueswir1 13391b8dd648Sblueswir1 int64_t st_size; 13401b8dd648Sblueswir1 int64_t st_blksize; 13411b8dd648Sblueswir1 13421b8dd648Sblueswir1 unsigned char __pad4[4]; 13431b8dd648Sblueswir1 unsigned int st_blocks; 13441b8dd648Sblueswir1 1345992f48a0Sblueswir1 abi_ulong target_st_atime; 1346992f48a0Sblueswir1 abi_ulong __unused1; 13471b8dd648Sblueswir1 1348992f48a0Sblueswir1 abi_ulong target_st_mtime; 1349992f48a0Sblueswir1 abi_ulong __unused2; 13501b8dd648Sblueswir1 1351992f48a0Sblueswir1 abi_ulong target_st_ctime; 1352992f48a0Sblueswir1 abi_ulong __unused3; 13531b8dd648Sblueswir1 1354992f48a0Sblueswir1 abi_ulong __unused4[3]; 13551b8dd648Sblueswir1 }; 13561b8dd648Sblueswir1 13573bfd9da1Sbellard #elif defined(TARGET_SPARC) 13583bfd9da1Sbellard 13593bfd9da1Sbellard struct target_stat { 13603bfd9da1Sbellard unsigned short st_dev; 1361992f48a0Sblueswir1 abi_ulong st_ino; 13623bfd9da1Sbellard unsigned short st_mode; 13633bfd9da1Sbellard short st_nlink; 13643bfd9da1Sbellard unsigned short st_uid; 13653bfd9da1Sbellard unsigned short st_gid; 13663bfd9da1Sbellard unsigned short st_rdev; 1367992f48a0Sblueswir1 abi_long st_size; 1368992f48a0Sblueswir1 abi_long target_st_atime; 1369992f48a0Sblueswir1 abi_ulong __unused1; 1370992f48a0Sblueswir1 abi_long target_st_mtime; 1371992f48a0Sblueswir1 abi_ulong __unused2; 1372992f48a0Sblueswir1 abi_long target_st_ctime; 1373992f48a0Sblueswir1 abi_ulong __unused3; 1374992f48a0Sblueswir1 abi_long st_blksize; 1375992f48a0Sblueswir1 abi_long st_blocks; 1376992f48a0Sblueswir1 abi_ulong __unused4[2]; 13773bfd9da1Sbellard }; 13783bfd9da1Sbellard 137920d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 13803bfd9da1Sbellard struct target_stat64 { 13813bfd9da1Sbellard unsigned char __pad0[6]; 13823bfd9da1Sbellard unsigned short st_dev; 13833bfd9da1Sbellard 13843bfd9da1Sbellard uint64_t st_ino; 13853bfd9da1Sbellard 13863bfd9da1Sbellard unsigned int st_mode; 13873bfd9da1Sbellard unsigned int st_nlink; 13883bfd9da1Sbellard 13893bfd9da1Sbellard unsigned int st_uid; 13903bfd9da1Sbellard unsigned int st_gid; 13913bfd9da1Sbellard 13923bfd9da1Sbellard unsigned char __pad2[6]; 13933bfd9da1Sbellard unsigned short st_rdev; 13943bfd9da1Sbellard 13953bfd9da1Sbellard unsigned char __pad3[8]; 13963bfd9da1Sbellard 13973bfd9da1Sbellard int64_t st_size; 13983bfd9da1Sbellard unsigned int st_blksize; 13993bfd9da1Sbellard 14003bfd9da1Sbellard unsigned char __pad4[8]; 14013bfd9da1Sbellard unsigned int st_blocks; 14023bfd9da1Sbellard 14033bfd9da1Sbellard unsigned int target_st_atime; 14043bfd9da1Sbellard unsigned int __unused1; 14053bfd9da1Sbellard 14063bfd9da1Sbellard unsigned int target_st_mtime; 14073bfd9da1Sbellard unsigned int __unused2; 14083bfd9da1Sbellard 14093bfd9da1Sbellard unsigned int target_st_ctime; 14103bfd9da1Sbellard unsigned int __unused3; 14113bfd9da1Sbellard 14123bfd9da1Sbellard unsigned int __unused4; 14133bfd9da1Sbellard unsigned int __unused5; 14143bfd9da1Sbellard }; 14153bfd9da1Sbellard 141667867308Sbellard #elif defined(TARGET_PPC) 141767867308Sbellard 141867867308Sbellard struct target_stat { 1419e32448e0Sj_mayer abi_ulong st_dev; 1420992f48a0Sblueswir1 abi_ulong st_ino; 1421325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1422e32448e0Sj_mayer abi_ulong st_nlink; 1423325e651fSj_mayer unsigned int st_mode; 1424325e651fSj_mayer #else 142567867308Sbellard unsigned int st_mode; 142667867308Sbellard unsigned short st_nlink; 1427325e651fSj_mayer #endif 142867867308Sbellard unsigned int st_uid; 142967867308Sbellard unsigned int st_gid; 1430e32448e0Sj_mayer abi_ulong st_rdev; 1431992f48a0Sblueswir1 abi_ulong st_size; 1432992f48a0Sblueswir1 abi_ulong st_blksize; 1433992f48a0Sblueswir1 abi_ulong st_blocks; 1434992f48a0Sblueswir1 abi_ulong target_st_atime; 1435e32448e0Sj_mayer abi_ulong target_st_atime_nsec; 1436992f48a0Sblueswir1 abi_ulong target_st_mtime; 1437e32448e0Sj_mayer abi_ulong target_st_mtime_nsec; 1438992f48a0Sblueswir1 abi_ulong target_st_ctime; 1439e32448e0Sj_mayer abi_ulong target_st_ctime_nsec; 1440992f48a0Sblueswir1 abi_ulong __unused4; 1441992f48a0Sblueswir1 abi_ulong __unused5; 1442325e651fSj_mayer #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) 1443325e651fSj_mayer abi_ulong __unused6; 1444325e651fSj_mayer #endif 144567867308Sbellard }; 144667867308Sbellard 144720d155bcSStefan Weil #if !defined(TARGET_PPC64) || defined(TARGET_ABI32) 144820d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1449541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 145067867308Sbellard unsigned long long st_dev; 145167867308Sbellard unsigned long long st_ino; 145267867308Sbellard unsigned int st_mode; 145367867308Sbellard unsigned int st_nlink; 145467867308Sbellard unsigned int st_uid; 145567867308Sbellard unsigned int st_gid; 145667867308Sbellard unsigned long long st_rdev; 1457e1ce5e40Saurel32 unsigned long long __pad0; 145867867308Sbellard long long st_size; 1459e32448e0Sj_mayer int st_blksize; 1460e1ce5e40Saurel32 unsigned int __pad1; 146161322e91SMax Filippov long long st_blocks; /* Number 512-byte blocks allocated. */ 1462e32448e0Sj_mayer int target_st_atime; 1463e32448e0Sj_mayer unsigned int target_st_atime_nsec; 1464e32448e0Sj_mayer int target_st_mtime; 1465e32448e0Sj_mayer unsigned int target_st_mtime_nsec; 1466e32448e0Sj_mayer int target_st_ctime; 1467e32448e0Sj_mayer unsigned int target_st_ctime_nsec; 1468e32448e0Sj_mayer unsigned int __unused4; 1469e32448e0Sj_mayer unsigned int __unused5; 147067867308Sbellard }; 147120d155bcSStefan Weil #endif 147267867308Sbellard 1473b779e29eSEdgar E. Iglesias #elif defined(TARGET_MICROBLAZE) 1474b779e29eSEdgar E. Iglesias 1475b779e29eSEdgar E. Iglesias struct target_stat { 1476b779e29eSEdgar E. Iglesias abi_ulong st_dev; 1477b779e29eSEdgar E. Iglesias abi_ulong st_ino; 1478b779e29eSEdgar E. Iglesias unsigned int st_mode; 1479b779e29eSEdgar E. Iglesias unsigned short st_nlink; 1480b779e29eSEdgar E. Iglesias unsigned int st_uid; 1481b779e29eSEdgar E. Iglesias unsigned int st_gid; 1482b779e29eSEdgar E. Iglesias abi_ulong st_rdev; 1483b779e29eSEdgar E. Iglesias abi_ulong st_size; 1484b779e29eSEdgar E. Iglesias abi_ulong st_blksize; 1485b779e29eSEdgar E. Iglesias abi_ulong st_blocks; 1486b779e29eSEdgar E. Iglesias abi_ulong target_st_atime; 1487b779e29eSEdgar E. Iglesias abi_ulong target_st_atime_nsec; 1488b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime; 1489b779e29eSEdgar E. Iglesias abi_ulong target_st_mtime_nsec; 1490b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime; 1491b779e29eSEdgar E. Iglesias abi_ulong target_st_ctime_nsec; 1492b779e29eSEdgar E. Iglesias abi_ulong __unused4; 1493b779e29eSEdgar E. Iglesias abi_ulong __unused5; 1494b779e29eSEdgar E. Iglesias }; 1495b779e29eSEdgar E. Iglesias 1496b779e29eSEdgar E. Iglesias /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ 149720d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1498541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 1499b779e29eSEdgar E. Iglesias uint64_t st_dev; 1500a523eb06SEdgar E. Iglesias #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1501a523eb06SEdgar E. Iglesias uint32_t pad0; 1502a523eb06SEdgar E. Iglesias uint32_t __st_ino; 1503a523eb06SEdgar E. Iglesias 1504b779e29eSEdgar E. Iglesias uint32_t st_mode; 1505b779e29eSEdgar E. Iglesias uint32_t st_nlink; 1506b779e29eSEdgar E. Iglesias uint32_t st_uid; 1507b779e29eSEdgar E. Iglesias uint32_t st_gid; 1508b779e29eSEdgar E. Iglesias uint64_t st_rdev; 150921ebeb23SEdgar E. Iglesias uint64_t __pad1; 1510b779e29eSEdgar E. Iglesias 1511b779e29eSEdgar E. Iglesias int64_t st_size; 1512b779e29eSEdgar E. Iglesias int32_t st_blksize; 151321ebeb23SEdgar E. Iglesias uint32_t __pad2; 1514b779e29eSEdgar E. Iglesias int64_t st_blocks; /* Number 512-byte blocks allocated. */ 1515b779e29eSEdgar E. Iglesias 1516b779e29eSEdgar E. Iglesias int target_st_atime; 1517b779e29eSEdgar E. Iglesias unsigned int target_st_atime_nsec; 1518b779e29eSEdgar E. Iglesias int target_st_mtime; 1519b779e29eSEdgar E. Iglesias unsigned int target_st_mtime_nsec; 1520b779e29eSEdgar E. Iglesias int target_st_ctime; 1521b779e29eSEdgar E. Iglesias unsigned int target_st_ctime_nsec; 1522a523eb06SEdgar E. Iglesias uint64_t st_ino; 1523b779e29eSEdgar E. Iglesias }; 1524b779e29eSEdgar E. Iglesias 1525e6e5906bSpbrook #elif defined(TARGET_M68K) 1526e6e5906bSpbrook 1527e6e5906bSpbrook struct target_stat { 1528e6e5906bSpbrook unsigned short st_dev; 1529e6e5906bSpbrook unsigned short __pad1; 1530992f48a0Sblueswir1 abi_ulong st_ino; 1531e6e5906bSpbrook unsigned short st_mode; 1532e6e5906bSpbrook unsigned short st_nlink; 1533e6e5906bSpbrook unsigned short st_uid; 1534e6e5906bSpbrook unsigned short st_gid; 1535e6e5906bSpbrook unsigned short st_rdev; 1536e6e5906bSpbrook unsigned short __pad2; 1537992f48a0Sblueswir1 abi_ulong st_size; 1538992f48a0Sblueswir1 abi_ulong st_blksize; 1539992f48a0Sblueswir1 abi_ulong st_blocks; 1540992f48a0Sblueswir1 abi_ulong target_st_atime; 1541992f48a0Sblueswir1 abi_ulong __unused1; 1542992f48a0Sblueswir1 abi_ulong target_st_mtime; 1543992f48a0Sblueswir1 abi_ulong __unused2; 1544992f48a0Sblueswir1 abi_ulong target_st_ctime; 1545992f48a0Sblueswir1 abi_ulong __unused3; 1546992f48a0Sblueswir1 abi_ulong __unused4; 1547992f48a0Sblueswir1 abi_ulong __unused5; 1548e6e5906bSpbrook }; 1549e6e5906bSpbrook 1550e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely 1551e6e5906bSpbrook * insane amounts of padding around dev_t's. 1552e6e5906bSpbrook */ 155320d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1554e6e5906bSpbrook struct target_stat64 { 1555e6e5906bSpbrook unsigned long long st_dev; 1556e6e5906bSpbrook unsigned char __pad1[2]; 1557e6e5906bSpbrook 1558e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1559992f48a0Sblueswir1 abi_ulong __st_ino; 1560e6e5906bSpbrook 1561e6e5906bSpbrook unsigned int st_mode; 1562e6e5906bSpbrook unsigned int st_nlink; 1563e6e5906bSpbrook 1564992f48a0Sblueswir1 abi_ulong st_uid; 1565992f48a0Sblueswir1 abi_ulong st_gid; 1566e6e5906bSpbrook 1567e6e5906bSpbrook unsigned long long st_rdev; 1568e6e5906bSpbrook unsigned char __pad3[2]; 1569e6e5906bSpbrook 1570e6e5906bSpbrook long long st_size; 1571992f48a0Sblueswir1 abi_ulong st_blksize; 1572e6e5906bSpbrook 1573992f48a0Sblueswir1 abi_ulong __pad4; /* future possible st_blocks high bits */ 1574992f48a0Sblueswir1 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1575e6e5906bSpbrook 1576992f48a0Sblueswir1 abi_ulong target_st_atime; 1577992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1578e6e5906bSpbrook 1579992f48a0Sblueswir1 abi_ulong target_st_mtime; 1580992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1581e6e5906bSpbrook 1582992f48a0Sblueswir1 abi_ulong target_st_ctime; 1583992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1584e6e5906bSpbrook 1585e6e5906bSpbrook unsigned long long st_ino; 1586541dc0d4SStefan Weil } QEMU_PACKED; 1587e6e5906bSpbrook 1588d26bc211Sths #elif defined(TARGET_ABI_MIPSN64) 1589540635baSths 1590540635baSths /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ 1591540635baSths struct target_stat { 1592540635baSths unsigned int st_dev; 1593540635baSths unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ 1594540635baSths 1595992f48a0Sblueswir1 abi_ulong st_ino; 1596540635baSths 1597540635baSths unsigned int st_mode; 1598540635baSths unsigned int st_nlink; 1599540635baSths 1600540635baSths int st_uid; 1601540635baSths int st_gid; 1602540635baSths 1603540635baSths unsigned int st_rdev; 1604540635baSths unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ 1605540635baSths 1606992f48a0Sblueswir1 abi_ulong st_size; 1607540635baSths 1608540635baSths /* 1609540635baSths * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1610540635baSths * but we don't have it under Linux. 1611540635baSths */ 1612540635baSths unsigned int target_st_atime; 1613540635baSths unsigned int target_st_atime_nsec; 1614540635baSths 1615540635baSths unsigned int target_st_mtime; 1616540635baSths unsigned int target_st_mtime_nsec; 1617540635baSths 1618540635baSths unsigned int target_st_ctime; 1619540635baSths unsigned int target_st_ctime_nsec; 1620540635baSths 1621540635baSths unsigned int st_blksize; 1622540635baSths unsigned int st_pad2; 1623540635baSths 1624992f48a0Sblueswir1 abi_ulong st_blocks; 1625540635baSths }; 1626540635baSths 1627d26bc211Sths #elif defined(TARGET_ABI_MIPSN32) 1628540635baSths 1629540635baSths struct target_stat { 16301ab2aea2SLeon Alrae abi_ulong st_dev; 16311ab2aea2SLeon Alrae abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 16321ab2aea2SLeon Alrae uint64_t st_ino; 1633540635baSths unsigned int st_mode; 1634540635baSths unsigned int st_nlink; 1635540635baSths int st_uid; 1636540635baSths int st_gid; 16371ab2aea2SLeon Alrae abi_ulong st_rdev; 16381ab2aea2SLeon Alrae abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 16391ab2aea2SLeon Alrae int64_t st_size; 16401ab2aea2SLeon Alrae abi_long target_st_atime; 16411ab2aea2SLeon Alrae abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 16421ab2aea2SLeon Alrae abi_long target_st_mtime; 16431ab2aea2SLeon Alrae abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 16441ab2aea2SLeon Alrae abi_long target_st_ctime; 16451ab2aea2SLeon Alrae abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 16461ab2aea2SLeon Alrae abi_ulong st_blksize; 16471ab2aea2SLeon Alrae abi_ulong st_pad2; 16481ab2aea2SLeon Alrae int64_t st_blocks; 1649540635baSths }; 1650540635baSths 1651d26bc211Sths #elif defined(TARGET_ABI_MIPSO32) 1652048f6b4dSbellard 1653048f6b4dSbellard struct target_stat { 1654048f6b4dSbellard unsigned st_dev; 1655992f48a0Sblueswir1 abi_long st_pad1[3]; /* Reserved for network id */ 1656992f48a0Sblueswir1 abi_ulong st_ino; 1657048f6b4dSbellard unsigned int st_mode; 1658048f6b4dSbellard unsigned int st_nlink; 1659048f6b4dSbellard int st_uid; 1660048f6b4dSbellard int st_gid; 1661048f6b4dSbellard unsigned st_rdev; 1662992f48a0Sblueswir1 abi_long st_pad2[2]; 1663992f48a0Sblueswir1 abi_long st_size; 1664992f48a0Sblueswir1 abi_long st_pad3; 1665048f6b4dSbellard /* 1666048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1667048f6b4dSbellard * but we don't have it under Linux. 1668048f6b4dSbellard */ 1669992f48a0Sblueswir1 abi_long target_st_atime; 1670992f48a0Sblueswir1 abi_long target_st_atime_nsec; 1671992f48a0Sblueswir1 abi_long target_st_mtime; 1672992f48a0Sblueswir1 abi_long target_st_mtime_nsec; 1673992f48a0Sblueswir1 abi_long target_st_ctime; 1674992f48a0Sblueswir1 abi_long target_st_ctime_nsec; 1675992f48a0Sblueswir1 abi_long st_blksize; 1676992f48a0Sblueswir1 abi_long st_blocks; 1677992f48a0Sblueswir1 abi_long st_pad4[14]; 1678048f6b4dSbellard }; 1679048f6b4dSbellard 1680048f6b4dSbellard /* 1681048f6b4dSbellard * This matches struct stat64 in glibc2.1, hence the absolutely insane 1682048f6b4dSbellard * amounts of padding around dev_t's. The memory layout is the same as of 1683048f6b4dSbellard * struct stat of the 64-bit kernel. 1684048f6b4dSbellard */ 1685048f6b4dSbellard 168620d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1687048f6b4dSbellard struct target_stat64 { 1688992f48a0Sblueswir1 abi_ulong st_dev; 1689992f48a0Sblueswir1 abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 1690048f6b4dSbellard 1691048f6b4dSbellard uint64_t st_ino; 1692048f6b4dSbellard 1693048f6b4dSbellard unsigned int st_mode; 1694048f6b4dSbellard unsigned int st_nlink; 1695048f6b4dSbellard 1696048f6b4dSbellard int st_uid; 1697048f6b4dSbellard int st_gid; 1698048f6b4dSbellard 1699992f48a0Sblueswir1 abi_ulong st_rdev; 1700992f48a0Sblueswir1 abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 1701048f6b4dSbellard 1702048f6b4dSbellard int64_t st_size; 1703048f6b4dSbellard 1704048f6b4dSbellard /* 1705048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1706048f6b4dSbellard * but we don't have it under Linux. 1707048f6b4dSbellard */ 1708992f48a0Sblueswir1 abi_long target_st_atime; 1709992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 1710048f6b4dSbellard 1711992f48a0Sblueswir1 abi_long target_st_mtime; 1712992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 1713048f6b4dSbellard 1714992f48a0Sblueswir1 abi_long target_st_ctime; 1715992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 1716048f6b4dSbellard 1717992f48a0Sblueswir1 abi_ulong st_blksize; 1718992f48a0Sblueswir1 abi_ulong st_pad2; 1719048f6b4dSbellard 1720048f6b4dSbellard int64_t st_blocks; 1721048f6b4dSbellard }; 17227a3148a9Sj_mayer 17237a3148a9Sj_mayer #elif defined(TARGET_ALPHA) 17247a3148a9Sj_mayer 17257a3148a9Sj_mayer struct target_stat { 17267a3148a9Sj_mayer unsigned int st_dev; 17277a3148a9Sj_mayer unsigned int st_ino; 17287a3148a9Sj_mayer unsigned int st_mode; 17297a3148a9Sj_mayer unsigned int st_nlink; 17307a3148a9Sj_mayer unsigned int st_uid; 17317a3148a9Sj_mayer unsigned int st_gid; 17327a3148a9Sj_mayer unsigned int st_rdev; 1733992f48a0Sblueswir1 abi_long st_size; 1734992f48a0Sblueswir1 abi_ulong target_st_atime; 1735992f48a0Sblueswir1 abi_ulong target_st_mtime; 1736992f48a0Sblueswir1 abi_ulong target_st_ctime; 17377a3148a9Sj_mayer unsigned int st_blksize; 17387a3148a9Sj_mayer unsigned int st_blocks; 17397a3148a9Sj_mayer unsigned int st_flags; 17407a3148a9Sj_mayer unsigned int st_gen; 17417a3148a9Sj_mayer }; 17427a3148a9Sj_mayer 174320d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 17447a3148a9Sj_mayer struct target_stat64 { 1745992f48a0Sblueswir1 abi_ulong st_dev; 1746992f48a0Sblueswir1 abi_ulong st_ino; 1747992f48a0Sblueswir1 abi_ulong st_rdev; 1748992f48a0Sblueswir1 abi_long st_size; 1749992f48a0Sblueswir1 abi_ulong st_blocks; 17507a3148a9Sj_mayer 17517a3148a9Sj_mayer unsigned int st_mode; 17527a3148a9Sj_mayer unsigned int st_uid; 17537a3148a9Sj_mayer unsigned int st_gid; 17547a3148a9Sj_mayer unsigned int st_blksize; 17557a3148a9Sj_mayer unsigned int st_nlink; 17567a3148a9Sj_mayer unsigned int __pad0; 17577a3148a9Sj_mayer 1758992f48a0Sblueswir1 abi_ulong target_st_atime; 1759992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1760992f48a0Sblueswir1 abi_ulong target_st_mtime; 1761992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1762992f48a0Sblueswir1 abi_ulong target_st_ctime; 1763992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1764992f48a0Sblueswir1 abi_long __unused[3]; 17657a3148a9Sj_mayer }; 17667a3148a9Sj_mayer 17676db45e65Sths #elif defined(TARGET_SH4) 17686db45e65Sths 17696db45e65Sths struct target_stat { 1770992f48a0Sblueswir1 abi_ulong st_dev; 1771992f48a0Sblueswir1 abi_ulong st_ino; 17726db45e65Sths unsigned short st_mode; 17736db45e65Sths unsigned short st_nlink; 17746db45e65Sths unsigned short st_uid; 17756db45e65Sths unsigned short st_gid; 1776992f48a0Sblueswir1 abi_ulong st_rdev; 1777992f48a0Sblueswir1 abi_ulong st_size; 1778992f48a0Sblueswir1 abi_ulong st_blksize; 1779992f48a0Sblueswir1 abi_ulong st_blocks; 1780992f48a0Sblueswir1 abi_ulong target_st_atime; 1781992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 1782992f48a0Sblueswir1 abi_ulong target_st_mtime; 1783992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 1784992f48a0Sblueswir1 abi_ulong target_st_ctime; 1785992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 1786992f48a0Sblueswir1 abi_ulong __unused4; 1787992f48a0Sblueswir1 abi_ulong __unused5; 17886db45e65Sths }; 17896db45e65Sths 17906db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely 17916db45e65Sths * insane amounts of padding around dev_t's. 17926db45e65Sths */ 179320d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1794541dc0d4SStefan Weil struct QEMU_PACKED target_stat64 { 17956db45e65Sths unsigned long long st_dev; 17966db45e65Sths unsigned char __pad0[4]; 17976db45e65Sths 17986db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1799992f48a0Sblueswir1 abi_ulong __st_ino; 18006db45e65Sths 18016db45e65Sths unsigned int st_mode; 18026db45e65Sths unsigned int st_nlink; 18036db45e65Sths 1804992f48a0Sblueswir1 abi_ulong st_uid; 1805992f48a0Sblueswir1 abi_ulong st_gid; 18066db45e65Sths 18076db45e65Sths unsigned long long st_rdev; 18086db45e65Sths unsigned char __pad3[4]; 18096db45e65Sths 18106db45e65Sths long long st_size; 1811992f48a0Sblueswir1 abi_ulong st_blksize; 18126db45e65Sths 18136db45e65Sths unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ 18146db45e65Sths 1815992f48a0Sblueswir1 abi_ulong target_st_atime; 1816992f48a0Sblueswir1 abi_ulong target_st_atime_nsec; 18176db45e65Sths 1818992f48a0Sblueswir1 abi_ulong target_st_mtime; 1819992f48a0Sblueswir1 abi_ulong target_st_mtime_nsec; 18206db45e65Sths 1821992f48a0Sblueswir1 abi_ulong target_st_ctime; 1822992f48a0Sblueswir1 abi_ulong target_st_ctime_nsec; 18236db45e65Sths 18246db45e65Sths unsigned long long st_ino; 18256db45e65Sths }; 18266db45e65Sths 1827d2fd1af7Sbellard #elif defined(TARGET_I386) && !defined(TARGET_ABI32) 1828d2fd1af7Sbellard struct target_stat { 1829d2fd1af7Sbellard abi_ulong st_dev; 1830d2fd1af7Sbellard abi_ulong st_ino; 1831d2fd1af7Sbellard abi_ulong st_nlink; 1832d2fd1af7Sbellard 1833d2fd1af7Sbellard unsigned int st_mode; 1834d2fd1af7Sbellard unsigned int st_uid; 1835d2fd1af7Sbellard unsigned int st_gid; 1836d2fd1af7Sbellard unsigned int __pad0; 1837d2fd1af7Sbellard abi_ulong st_rdev; 1838d2fd1af7Sbellard abi_long st_size; 1839d2fd1af7Sbellard abi_long st_blksize; 1840d2fd1af7Sbellard abi_long st_blocks; /* Number 512-byte blocks allocated. */ 1841d2fd1af7Sbellard 1842d2fd1af7Sbellard abi_ulong target_st_atime; 1843d2fd1af7Sbellard abi_ulong target_st_atime_nsec; 1844d2fd1af7Sbellard abi_ulong target_st_mtime; 1845d2fd1af7Sbellard abi_ulong target_st_mtime_nsec; 1846d2fd1af7Sbellard abi_ulong target_st_ctime; 1847d2fd1af7Sbellard abi_ulong target_st_ctime_nsec; 1848d2fd1af7Sbellard 1849d2fd1af7Sbellard abi_long __unused[3]; 1850d2fd1af7Sbellard }; 1851a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 1852a4c075f1SUlrich Hecht struct target_stat { 1853a4c075f1SUlrich Hecht abi_ulong st_dev; 1854a4c075f1SUlrich Hecht abi_ulong st_ino; 1855a4c075f1SUlrich Hecht abi_ulong st_nlink; 1856a4c075f1SUlrich Hecht unsigned int st_mode; 1857a4c075f1SUlrich Hecht unsigned int st_uid; 1858a4c075f1SUlrich Hecht unsigned int st_gid; 1859a4c075f1SUlrich Hecht unsigned int __pad1; 1860a4c075f1SUlrich Hecht abi_ulong st_rdev; 1861a4c075f1SUlrich Hecht abi_ulong st_size; 1862a4c075f1SUlrich Hecht abi_ulong target_st_atime; 1863a4c075f1SUlrich Hecht abi_ulong target_st_atime_nsec; 1864a4c075f1SUlrich Hecht abi_ulong target_st_mtime; 1865a4c075f1SUlrich Hecht abi_ulong target_st_mtime_nsec; 1866a4c075f1SUlrich Hecht abi_ulong target_st_ctime; 1867a4c075f1SUlrich Hecht abi_ulong target_st_ctime_nsec; 1868a4c075f1SUlrich Hecht abi_ulong st_blksize; 1869a4c075f1SUlrich Hecht abi_long st_blocks; 1870a4c075f1SUlrich Hecht abi_ulong __unused[3]; 1871a4c075f1SUlrich Hecht }; 187209701199SAlexander Graf #elif defined(TARGET_AARCH64) 187309701199SAlexander Graf struct target_stat { 187409701199SAlexander Graf abi_ulong st_dev; 187509701199SAlexander Graf abi_ulong st_ino; 187609701199SAlexander Graf unsigned int st_mode; 187709701199SAlexander Graf unsigned int st_nlink; 187809701199SAlexander Graf unsigned int st_uid; 187909701199SAlexander Graf unsigned int st_gid; 188009701199SAlexander Graf abi_ulong st_rdev; 188109701199SAlexander Graf abi_ulong _pad1; 188209701199SAlexander Graf abi_long st_size; 188309701199SAlexander Graf int st_blksize; 188409701199SAlexander Graf int __pad2; 188509701199SAlexander Graf abi_long st_blocks; 188609701199SAlexander Graf abi_long target_st_atime; 188709701199SAlexander Graf abi_ulong target_st_atime_nsec; 188809701199SAlexander Graf abi_long target_st_mtime; 188909701199SAlexander Graf abi_ulong target_st_mtime_nsec; 189009701199SAlexander Graf abi_long target_st_ctime; 189109701199SAlexander Graf abi_ulong target_st_ctime_nsec; 189209701199SAlexander Graf unsigned int __unused[2]; 189309701199SAlexander Graf }; 1894b16189b2SChen Gang #elif defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) 1895c7819dfbSPeter Maydell 1896c7819dfbSPeter Maydell /* These are the asm-generic versions of the stat and stat64 structures */ 1897c7819dfbSPeter Maydell 1898d962783eSJia Liu struct target_stat { 1899d962783eSJia Liu abi_ulong st_dev; 1900d962783eSJia Liu abi_ulong st_ino; 1901d962783eSJia Liu unsigned int st_mode; 1902c7819dfbSPeter Maydell unsigned int st_nlink; 1903d962783eSJia Liu unsigned int st_uid; 1904d962783eSJia Liu unsigned int st_gid; 1905d962783eSJia Liu abi_ulong st_rdev; 1906c7819dfbSPeter Maydell abi_ulong __pad1; 1907d962783eSJia Liu abi_long st_size; 1908c7819dfbSPeter Maydell int st_blksize; 1909c7819dfbSPeter Maydell int __pad2; 1910c7819dfbSPeter Maydell abi_long st_blocks; 1911c7819dfbSPeter Maydell abi_long target_st_atime; 1912d962783eSJia Liu abi_ulong target_st_atime_nsec; 1913c7819dfbSPeter Maydell abi_long target_st_mtime; 1914d962783eSJia Liu abi_ulong target_st_mtime_nsec; 1915c7819dfbSPeter Maydell abi_long target_st_ctime; 1916d962783eSJia Liu abi_ulong target_st_ctime_nsec; 1917c7819dfbSPeter Maydell unsigned int __unused4; 1918c7819dfbSPeter Maydell unsigned int __unused5; 1919d962783eSJia Liu }; 1920c7819dfbSPeter Maydell 192120d155bcSStefan Weil #define TARGET_HAS_STRUCT_STAT64 1922c7819dfbSPeter Maydell struct target_stat64 { 1923c7819dfbSPeter Maydell uint64_t st_dev; 1924c7819dfbSPeter Maydell uint64_t st_ino; 1925c7819dfbSPeter Maydell unsigned int st_mode; 1926c7819dfbSPeter Maydell unsigned int st_nlink; 1927c7819dfbSPeter Maydell unsigned int st_uid; 1928c7819dfbSPeter Maydell unsigned int st_gid; 1929c7819dfbSPeter Maydell uint64_t st_rdev; 1930c7819dfbSPeter Maydell uint64_t __pad1; 1931c7819dfbSPeter Maydell int64_t st_size; 1932c7819dfbSPeter Maydell int st_blksize; 1933c7819dfbSPeter Maydell int __pad2; 1934c7819dfbSPeter Maydell int64_t st_blocks; 1935c7819dfbSPeter Maydell int target_st_atime; 1936c7819dfbSPeter Maydell unsigned int target_st_atime_nsec; 1937c7819dfbSPeter Maydell int target_st_mtime; 1938c7819dfbSPeter Maydell unsigned int target_st_mtime_nsec; 1939c7819dfbSPeter Maydell int target_st_ctime; 1940c7819dfbSPeter Maydell unsigned int target_st_ctime_nsec; 1941c7819dfbSPeter Maydell unsigned int __unused4; 1942c7819dfbSPeter Maydell unsigned int __unused5; 1943c7819dfbSPeter Maydell }; 1944c7819dfbSPeter Maydell 1945048f6b4dSbellard #else 1946048f6b4dSbellard #error unsupported CPU 1947048f6b4dSbellard #endif 19482521d698Sbellard 19494ce6f8deSths typedef struct { 19504ce6f8deSths int val[2]; 1951c227f099SAnthony Liguori } target_fsid_t; 19524ce6f8deSths 195356c8f68fSbellard #ifdef TARGET_MIPS 1954d26bc211Sths #ifdef TARGET_ABI_MIPSN32 1955540635baSths struct target_statfs { 1956540635baSths int32_t f_type; 1957540635baSths int32_t f_bsize; 1958540635baSths int32_t f_frsize; /* Fragment size - unsupported */ 1959540635baSths int32_t f_blocks; 1960540635baSths int32_t f_bfree; 1961540635baSths int32_t f_files; 1962540635baSths int32_t f_ffree; 1963540635baSths int32_t f_bavail; 1964540635baSths 1965540635baSths /* Linux specials */ 1966c227f099SAnthony Liguori target_fsid_t f_fsid; 1967540635baSths int32_t f_namelen; 1968540635baSths int32_t f_spare[6]; 1969540635baSths }; 1970540635baSths #else 197156c8f68fSbellard struct target_statfs { 1972992f48a0Sblueswir1 abi_long f_type; 1973992f48a0Sblueswir1 abi_long f_bsize; 1974992f48a0Sblueswir1 abi_long f_frsize; /* Fragment size - unsupported */ 1975992f48a0Sblueswir1 abi_long f_blocks; 1976992f48a0Sblueswir1 abi_long f_bfree; 1977992f48a0Sblueswir1 abi_long f_files; 1978992f48a0Sblueswir1 abi_long f_ffree; 1979992f48a0Sblueswir1 abi_long f_bavail; 198056c8f68fSbellard 198156c8f68fSbellard /* Linux specials */ 1982c227f099SAnthony Liguori target_fsid_t f_fsid; 1983992f48a0Sblueswir1 abi_long f_namelen; 1984992f48a0Sblueswir1 abi_long f_spare[6]; 198556c8f68fSbellard }; 1986540635baSths #endif 198756c8f68fSbellard 198856c8f68fSbellard struct target_statfs64 { 198956c8f68fSbellard uint32_t f_type; 199056c8f68fSbellard uint32_t f_bsize; 199156c8f68fSbellard uint32_t f_frsize; /* Fragment size - unsupported */ 199256c8f68fSbellard uint32_t __pad; 199356c8f68fSbellard uint64_t f_blocks; 199456c8f68fSbellard uint64_t f_bfree; 199556c8f68fSbellard uint64_t f_files; 199656c8f68fSbellard uint64_t f_ffree; 199756c8f68fSbellard uint64_t f_bavail; 1998c227f099SAnthony Liguori target_fsid_t f_fsid; 199956c8f68fSbellard uint32_t f_namelen; 200056c8f68fSbellard uint32_t f_spare[6]; 200156c8f68fSbellard }; 2002c4d10628Sbalrog #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ 200309701199SAlexander Graf defined(TARGET_SPARC64) || defined(TARGET_AARCH64)) && \ 200409701199SAlexander Graf !defined(TARGET_ABI32) 2005325e651fSj_mayer struct target_statfs { 2006325e651fSj_mayer abi_long f_type; 2007325e651fSj_mayer abi_long f_bsize; 2008325e651fSj_mayer abi_long f_blocks; 2009325e651fSj_mayer abi_long f_bfree; 2010325e651fSj_mayer abi_long f_bavail; 2011325e651fSj_mayer abi_long f_files; 2012325e651fSj_mayer abi_long f_ffree; 2013c227f099SAnthony Liguori target_fsid_t f_fsid; 2014325e651fSj_mayer abi_long f_namelen; 2015325e651fSj_mayer abi_long f_frsize; 2016325e651fSj_mayer abi_long f_spare[5]; 2017325e651fSj_mayer }; 2018325e651fSj_mayer 2019325e651fSj_mayer struct target_statfs64 { 2020325e651fSj_mayer abi_long f_type; 2021325e651fSj_mayer abi_long f_bsize; 2022325e651fSj_mayer abi_long f_blocks; 2023325e651fSj_mayer abi_long f_bfree; 2024325e651fSj_mayer abi_long f_bavail; 2025325e651fSj_mayer abi_long f_files; 2026325e651fSj_mayer abi_long f_ffree; 2027c227f099SAnthony Liguori target_fsid_t f_fsid; 2028325e651fSj_mayer abi_long f_namelen; 2029325e651fSj_mayer abi_long f_frsize; 2030325e651fSj_mayer abi_long f_spare[5]; 2031325e651fSj_mayer }; 2032a4c075f1SUlrich Hecht #elif defined(TARGET_S390X) 2033a4c075f1SUlrich Hecht struct target_statfs { 2034a4c075f1SUlrich Hecht int32_t f_type; 2035a4c075f1SUlrich Hecht int32_t f_bsize; 2036a4c075f1SUlrich Hecht abi_long f_blocks; 2037a4c075f1SUlrich Hecht abi_long f_bfree; 2038a4c075f1SUlrich Hecht abi_long f_bavail; 2039a4c075f1SUlrich Hecht abi_long f_files; 2040a4c075f1SUlrich Hecht abi_long f_ffree; 2041a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2042a4c075f1SUlrich Hecht int32_t f_namelen; 2043a4c075f1SUlrich Hecht int32_t f_frsize; 2044a4c075f1SUlrich Hecht int32_t f_spare[5]; 2045a4c075f1SUlrich Hecht }; 2046a4c075f1SUlrich Hecht 2047a4c075f1SUlrich Hecht struct target_statfs64 { 2048a4c075f1SUlrich Hecht int32_t f_type; 2049a4c075f1SUlrich Hecht int32_t f_bsize; 2050a4c075f1SUlrich Hecht abi_long f_blocks; 2051a4c075f1SUlrich Hecht abi_long f_bfree; 2052a4c075f1SUlrich Hecht abi_long f_bavail; 2053a4c075f1SUlrich Hecht abi_long f_files; 2054a4c075f1SUlrich Hecht abi_long f_ffree; 2055a4c075f1SUlrich Hecht kernel_fsid_t f_fsid; 2056a4c075f1SUlrich Hecht int32_t f_namelen; 2057a4c075f1SUlrich Hecht int32_t f_frsize; 2058a4c075f1SUlrich Hecht int32_t f_spare[5]; 2059a4c075f1SUlrich Hecht }; 206056c8f68fSbellard #else 206156c8f68fSbellard struct target_statfs { 206256c8f68fSbellard uint32_t f_type; 206356c8f68fSbellard uint32_t f_bsize; 206456c8f68fSbellard uint32_t f_blocks; 206556c8f68fSbellard uint32_t f_bfree; 206656c8f68fSbellard uint32_t f_bavail; 206756c8f68fSbellard uint32_t f_files; 206856c8f68fSbellard uint32_t f_ffree; 2069c227f099SAnthony Liguori target_fsid_t f_fsid; 207056c8f68fSbellard uint32_t f_namelen; 207156c8f68fSbellard uint32_t f_frsize; 207256c8f68fSbellard uint32_t f_spare[5]; 207356c8f68fSbellard }; 207456c8f68fSbellard 207556c8f68fSbellard struct target_statfs64 { 207656c8f68fSbellard uint32_t f_type; 207756c8f68fSbellard uint32_t f_bsize; 207856c8f68fSbellard uint64_t f_blocks; 207956c8f68fSbellard uint64_t f_bfree; 208056c8f68fSbellard uint64_t f_bavail; 208156c8f68fSbellard uint64_t f_files; 208256c8f68fSbellard uint64_t f_ffree; 2083c227f099SAnthony Liguori target_fsid_t f_fsid; 208456c8f68fSbellard uint32_t f_namelen; 208556c8f68fSbellard uint32_t f_frsize; 208656c8f68fSbellard uint32_t f_spare[5]; 208756c8f68fSbellard }; 208856c8f68fSbellard #endif 208956c8f68fSbellard 209056c8f68fSbellard 20912521d698Sbellard #define TARGET_F_DUPFD 0 /* dup */ 20922521d698Sbellard #define TARGET_F_GETFD 1 /* get close_on_exec */ 20932521d698Sbellard #define TARGET_F_SETFD 2 /* set/clear close_on_exec */ 20942521d698Sbellard #define TARGET_F_GETFL 3 /* get file->f_flags */ 20952521d698Sbellard #define TARGET_F_SETFL 4 /* set file->f_flags */ 20962521d698Sbellard 20972521d698Sbellard #if defined(TARGET_ALPHA) 20982521d698Sbellard #define TARGET_F_GETLK 7 20992521d698Sbellard #define TARGET_F_SETLK 8 21002521d698Sbellard #define TARGET_F_SETLKW 9 21012521d698Sbellard #define TARGET_F_SETOWN 5 /* for sockets. */ 21022521d698Sbellard #define TARGET_F_GETOWN 6 /* for sockets. */ 21032ba7f730SLaurent Vivier 21042ba7f730SLaurent Vivier #define TARGET_F_RDLCK 1 21052ba7f730SLaurent Vivier #define TARGET_F_WRLCK 2 21062ba7f730SLaurent Vivier #define TARGET_F_UNLCK 8 21072ba7f730SLaurent Vivier #define TARGET_F_EXLCK 16 21082ba7f730SLaurent Vivier #define TARGET_F_SHLCK 32 21095f106811SArnaud Patard (Rtp) #elif defined(TARGET_MIPS) 21105f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK 14 21115f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK 6 21125f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW 7 21135f106811SArnaud Patard (Rtp) #define TARGET_F_SETOWN 24 /* for sockets. */ 21145f106811SArnaud Patard (Rtp) #define TARGET_F_GETOWN 25 /* for sockets. */ 21152521d698Sbellard #else 21162521d698Sbellard #define TARGET_F_GETLK 5 21172521d698Sbellard #define TARGET_F_SETLK 6 21182521d698Sbellard #define TARGET_F_SETLKW 7 21192521d698Sbellard #define TARGET_F_SETOWN 8 /* for sockets. */ 21202521d698Sbellard #define TARGET_F_GETOWN 9 /* for sockets. */ 21212521d698Sbellard #endif 21228d5d3004SAndreas Schwab #define TARGET_F_SETOWN_EX 15 21238d5d3004SAndreas Schwab #define TARGET_F_GETOWN_EX 16 21242521d698Sbellard 21252ba7f730SLaurent Vivier #ifndef TARGET_F_RDLCK 21262ba7f730SLaurent Vivier #define TARGET_F_RDLCK 0 21272ba7f730SLaurent Vivier #define TARGET_F_WRLCK 1 21282ba7f730SLaurent Vivier #define TARGET_F_UNLCK 2 21292ba7f730SLaurent Vivier #endif 21302ba7f730SLaurent Vivier 21312ba7f730SLaurent Vivier #ifndef TARGET_F_EXLCK 21322ba7f730SLaurent Vivier #define TARGET_F_EXLCK 4 21332ba7f730SLaurent Vivier #define TARGET_F_SHLCK 8 21342ba7f730SLaurent Vivier #endif 21352ba7f730SLaurent Vivier 21362ba7f730SLaurent Vivier 21372521d698Sbellard #define TARGET_F_SETSIG 10 /* for sockets. */ 21382521d698Sbellard #define TARGET_F_GETSIG 11 /* for sockets. */ 21392521d698Sbellard 21405f106811SArnaud Patard (Rtp) #if defined(TARGET_MIPS) 21415f106811SArnaud Patard (Rtp) #define TARGET_F_GETLK64 33 /* using 'struct flock64' */ 21425f106811SArnaud Patard (Rtp) #define TARGET_F_SETLK64 34 21435f106811SArnaud Patard (Rtp) #define TARGET_F_SETLKW64 35 21445f106811SArnaud Patard (Rtp) #else 21452521d698Sbellard #define TARGET_F_GETLK64 12 /* using 'struct flock64' */ 21462521d698Sbellard #define TARGET_F_SETLK64 13 21472521d698Sbellard #define TARGET_F_SETLKW64 14 21485f106811SArnaud Patard (Rtp) #endif 21497e22e546SUlrich Hecht 21507e22e546SUlrich Hecht #define TARGET_F_LINUX_SPECIFIC_BASE 1024 21517e22e546SUlrich Hecht #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0) 21527e22e546SUlrich Hecht #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1) 21537e22e546SUlrich Hecht #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) 21547e22e546SUlrich Hecht #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2) 21557e22e546SUlrich Hecht 21564eeea4f3SRichard Henderson #if defined(TARGET_ALPHA) 21574eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK 04 21584eeea4f3SRichard Henderson #define TARGET_O_APPEND 010 21594eeea4f3SRichard Henderson #define TARGET_O_CREAT 01000 /* not fcntl */ 21604eeea4f3SRichard Henderson #define TARGET_O_TRUNC 02000 /* not fcntl */ 21614eeea4f3SRichard Henderson #define TARGET_O_EXCL 04000 /* not fcntl */ 21624eeea4f3SRichard Henderson #define TARGET_O_NOCTTY 010000 /* not fcntl */ 21634eeea4f3SRichard Henderson #define TARGET_O_DSYNC 040000 21644eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0 /* not necessary, always 64-bit */ 21654eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY 0100000 /* must be a directory */ 21664eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW 0200000 /* don't follow links */ 21674eeea4f3SRichard Henderson #define TARGET_O_DIRECT 02000000 /* direct disk access hint */ 21684eeea4f3SRichard Henderson #define TARGET_O_NOATIME 04000000 21694eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 010000000 21704eeea4f3SRichard Henderson #define TARGET___O_SYNC 020000000 21714eeea4f3SRichard Henderson #define TARGET_O_PATH 040000000 21724eeea4f3SRichard Henderson #elif defined(TARGET_ARM) || defined(TARGET_M68K) 2173f09936acSbellard #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 2174f09936acSbellard #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 2175f09936acSbellard #define TARGET_O_DIRECT 0200000 /* direct disk access hint */ 2176f09936acSbellard #define TARGET_O_LARGEFILE 0400000 2177048f6b4dSbellard #elif defined(TARGET_MIPS) 2178048f6b4dSbellard #define TARGET_O_APPEND 0x0008 21794eeea4f3SRichard Henderson #define TARGET_O_DSYNC 0x0010 2180048f6b4dSbellard #define TARGET_O_NONBLOCK 0x0080 2181048f6b4dSbellard #define TARGET_O_CREAT 0x0100 /* not fcntl */ 2182048f6b4dSbellard #define TARGET_O_TRUNC 0x0200 /* not fcntl */ 2183048f6b4dSbellard #define TARGET_O_EXCL 0x0400 /* not fcntl */ 2184048f6b4dSbellard #define TARGET_O_NOCTTY 0x0800 /* not fcntl */ 2185048f6b4dSbellard #define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */ 2186048f6b4dSbellard #define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */ 21874eeea4f3SRichard Henderson #define TARGET___O_SYNC 0x4000 2188048f6b4dSbellard #define TARGET_O_DIRECT 0x8000 /* direct disk access hint */ 21894eeea4f3SRichard Henderson #elif defined (TARGET_PPC) 21904eeea4f3SRichard Henderson #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 21914eeea4f3SRichard Henderson #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 21924eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0200000 21934eeea4f3SRichard Henderson #define TARGET_O_DIRECT 0400000 /* direct disk access hint */ 21944eeea4f3SRichard Henderson #elif defined (TARGET_SPARC) 21951f961124Saurel32 #define TARGET_O_APPEND 0x0008 21964eeea4f3SRichard Henderson #define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */ 21971f961124Saurel32 #define TARGET_O_CREAT 0x0200 /* not fcntl */ 21981f961124Saurel32 #define TARGET_O_TRUNC 0x0400 /* not fcntl */ 21991f961124Saurel32 #define TARGET_O_EXCL 0x0800 /* not fcntl */ 22004eeea4f3SRichard Henderson #define TARGET_O_DSYNC 0x2000 22014eeea4f3SRichard Henderson #define TARGET_O_NONBLOCK 0x4000 22024eeea4f3SRichard Henderson # ifdef TARGET_SPARC64 22034eeea4f3SRichard Henderson # define TARGET_O_NDELAY 0x0004 2204ffa65c3bSbellard # else 22054eeea4f3SRichard Henderson # define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK) 22064eeea4f3SRichard Henderson # endif 22074eeea4f3SRichard Henderson #define TARGET_O_NOCTTY 0x8000 /* not fcntl */ 22084eeea4f3SRichard Henderson #define TARGET_O_LARGEFILE 0x40000 22094eeea4f3SRichard Henderson #define TARGET_O_DIRECT 0x100000 /* direct disk access hint */ 22104eeea4f3SRichard Henderson #define TARGET_O_NOATIME 0x200000 22114eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 0x400000 22124eeea4f3SRichard Henderson #define TARGET___O_SYNC 0x800000 22134eeea4f3SRichard Henderson #define TARGET_O_PATH 0x1000000 22144eeea4f3SRichard Henderson #endif 22154eeea4f3SRichard Henderson 22164eeea4f3SRichard Henderson /* <asm-generic/fcntl.h> values follow. */ 2217ffa65c3bSbellard #define TARGET_O_ACCMODE 0003 2218ffa65c3bSbellard #define TARGET_O_RDONLY 00 2219ffa65c3bSbellard #define TARGET_O_WRONLY 01 2220ffa65c3bSbellard #define TARGET_O_RDWR 02 22214eeea4f3SRichard Henderson #ifndef TARGET_O_CREAT 2222ffa65c3bSbellard #define TARGET_O_CREAT 0100 /* not fcntl */ 22234eeea4f3SRichard Henderson #endif 22244eeea4f3SRichard Henderson #ifndef TARGET_O_EXCL 2225ffa65c3bSbellard #define TARGET_O_EXCL 0200 /* not fcntl */ 22264eeea4f3SRichard Henderson #endif 22274eeea4f3SRichard Henderson #ifndef TARGET_O_NOCTTY 2228ffa65c3bSbellard #define TARGET_O_NOCTTY 0400 /* not fcntl */ 22294eeea4f3SRichard Henderson #endif 22304eeea4f3SRichard Henderson #ifndef TARGET_O_TRUNC 2231ffa65c3bSbellard #define TARGET_O_TRUNC 01000 /* not fcntl */ 22324eeea4f3SRichard Henderson #endif 22334eeea4f3SRichard Henderson #ifndef TARGET_O_APPEND 2234ffa65c3bSbellard #define TARGET_O_APPEND 02000 22354eeea4f3SRichard Henderson #endif 22364eeea4f3SRichard Henderson #ifndef TARGET_O_NONBLOCK 2237ffa65c3bSbellard #define TARGET_O_NONBLOCK 04000 22384eeea4f3SRichard Henderson #endif 22394eeea4f3SRichard Henderson #ifndef TARGET_O_DSYNC 22404eeea4f3SRichard Henderson #define TARGET_O_DSYNC 010000 22414eeea4f3SRichard Henderson #endif 22424eeea4f3SRichard Henderson #ifndef TARGET_FASYNC 2243ffa65c3bSbellard #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ 22444eeea4f3SRichard Henderson #endif 22454eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECT 2246ffa65c3bSbellard #define TARGET_O_DIRECT 040000 /* direct disk access hint */ 22474eeea4f3SRichard Henderson #endif 22484eeea4f3SRichard Henderson #ifndef TARGET_O_LARGEFILE 2249ffa65c3bSbellard #define TARGET_O_LARGEFILE 0100000 22504eeea4f3SRichard Henderson #endif 22514eeea4f3SRichard Henderson #ifndef TARGET_O_DIRECTORY 2252ffa65c3bSbellard #define TARGET_O_DIRECTORY 0200000 /* must be a directory */ 22534eeea4f3SRichard Henderson #endif 22544eeea4f3SRichard Henderson #ifndef TARGET_O_NOFOLLOW 2255ffa65c3bSbellard #define TARGET_O_NOFOLLOW 0400000 /* don't follow links */ 2256ffa65c3bSbellard #endif 22574eeea4f3SRichard Henderson #ifndef TARGET_O_NOATIME 22584eeea4f3SRichard Henderson #define TARGET_O_NOATIME 01000000 22594eeea4f3SRichard Henderson #endif 22604eeea4f3SRichard Henderson #ifndef TARGET_O_CLOEXEC 22614eeea4f3SRichard Henderson #define TARGET_O_CLOEXEC 02000000 22624eeea4f3SRichard Henderson #endif 22634eeea4f3SRichard Henderson #ifndef TARGET___O_SYNC 22644eeea4f3SRichard Henderson #define TARGET___O_SYNC 04000000 22654eeea4f3SRichard Henderson #endif 22664eeea4f3SRichard Henderson #ifndef TARGET_O_PATH 22674eeea4f3SRichard Henderson #define TARGET_O_PATH 010000000 22684eeea4f3SRichard Henderson #endif 22694eeea4f3SRichard Henderson #ifndef TARGET_O_NDELAY 22704eeea4f3SRichard Henderson #define TARGET_O_NDELAY TARGET_O_NONBLOCK 22714eeea4f3SRichard Henderson #endif 22724eeea4f3SRichard Henderson #ifndef TARGET_O_SYNC 22734eeea4f3SRichard Henderson #define TARGET_O_SYNC (TARGET___O_SYNC | TARGET_O_DSYNC) 22744eeea4f3SRichard Henderson #endif 2275ffa65c3bSbellard 22762521d698Sbellard struct target_flock { 22772521d698Sbellard short l_type; 22782521d698Sbellard short l_whence; 2279992f48a0Sblueswir1 abi_ulong l_start; 2280992f48a0Sblueswir1 abi_ulong l_len; 22812521d698Sbellard int l_pid; 22822521d698Sbellard }; 22832521d698Sbellard 22842521d698Sbellard struct target_flock64 { 22852521d698Sbellard short l_type; 22862521d698Sbellard short l_whence; 2287b16189b2SChen Gang #if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) \ 2288b16189b2SChen Gang || defined(TARGET_SPARC) || defined(TARGET_HPPA) \ 2289b16189b2SChen Gang || defined(TARGET_MICROBLAZE) || defined(TARGET_TILEGX) 2290ce3f0e2fSaurel32 int __pad; 2291ce3f0e2fSaurel32 #endif 22922521d698Sbellard unsigned long long l_start; 22932521d698Sbellard unsigned long long l_len; 22942521d698Sbellard int l_pid; 2295541dc0d4SStefan Weil } QEMU_PACKED; 22962521d698Sbellard 2297ce4defa0Spbrook #ifdef TARGET_ARM 2298ce4defa0Spbrook struct target_eabi_flock64 { 2299ce4defa0Spbrook short l_type; 2300ce4defa0Spbrook short l_whence; 2301ce4defa0Spbrook int __pad; 2302ce4defa0Spbrook unsigned long long l_start; 2303ce4defa0Spbrook unsigned long long l_len; 2304ce4defa0Spbrook int l_pid; 2305541dc0d4SStefan Weil } QEMU_PACKED; 2306ce4defa0Spbrook #endif 23072521d698Sbellard 23088d5d3004SAndreas Schwab struct target_f_owner_ex { 23098d5d3004SAndreas Schwab int type; /* Owner type of ID. */ 23108d5d3004SAndreas Schwab int pid; /* ID of owner. */ 23118d5d3004SAndreas Schwab }; 23128d5d3004SAndreas Schwab 23132521d698Sbellard /* soundcard defines */ 231467cc32ebSVeres Lajos /* XXX: convert them all to arch independent entries */ 23152521d698Sbellard #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); 23162521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 23172521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 23182521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 23192521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA 0xc0144302 23202521d698Sbellard #define TARGET_SNDCTL_COPR_RESET 0x00004300 23212521d698Sbellard #define TARGET_SNDCTL_COPR_RUN 0xc0144306 23222521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 23232521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE 0x40144305 23242521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA 0x40144304 23252521d698Sbellard #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) 23262521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) 23272521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) 23282521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) 23292521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) 23302521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) 23312521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) 23322521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) 23332521d698Sbellard #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) 23342521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) 23352521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) 23362521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) 23372521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) 23382521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) 23392521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) 23402521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) 23412521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) 23422521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) 23435f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19) 23445f72307dSPeter Maydell #define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20) 23452521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e 23462521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 23472521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 23482521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 23492521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 23502521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f 23512521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 23522521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO 0xc074510c 23532521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 23542521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 23552521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 23562521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 23572521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 23582521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 23592521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 23602521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 23612521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b 23622521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a 23632521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 23642521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC 0x00005111 23652521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 23662521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET 0x00005100 23672521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 23682521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC 0x00005101 23692521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 23702521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d 23712521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d 23722521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 23732521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e 23742521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 23752521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME 0x40045407 23762521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT 0x40045408 23772521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 23782521d698Sbellard #define TARGET_SNDCTL_TMR_START 0x00005402 23792521d698Sbellard #define TARGET_SNDCTL_TMR_STOP 0x00005403 23802521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 23812521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 23822521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE 0x80045002 23832521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 23842521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS 0x80045005 23852521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 23862521d698Sbellard #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) 23872521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 23882521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) 23892521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) 23902521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) 23912521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) 23922521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) 23932521d698Sbellard 23942521d698Sbellard #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) 23952521d698Sbellard 23962521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) 23972521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) 23982521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) 23992521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) 24002521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) 24012521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) 24022521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) 24032521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) 24042521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) 24052521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) 24062521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) 24072521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) 24082521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) 24092521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) 24102521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) 24112521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) 24122521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) 24132521d698Sbellard 24142521d698Sbellard /* Obsolete macros */ 24152521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) 24162521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) 24172521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) 24182521d698Sbellard 24192521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) 24202521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) 24212521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) 24222521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) 24232521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) 24242521d698Sbellard 24252521d698Sbellard #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) 24262521d698Sbellard 24272521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) 24282521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) 24292521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) 24302521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) 24312521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) 24322521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) 24332521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) 24342521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) 24352521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) 24362521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) 24372521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) 24382521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) 24392521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) 24402521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) 24412521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) 24422521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) 24432521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) 24442521d698Sbellard 24452521d698Sbellard /* Obsolete macros */ 24462521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) 24472521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) 24482521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) 24492521d698Sbellard 24502521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) 24512521d698Sbellard 24522521d698Sbellard /* vfat ioctls */ 24532521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) 24542521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) 2455a5448a7dSbellard 24568fbd6b52Sbalrog #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct mtop) 24578fbd6b52Sbalrog #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct mtget) 24588fbd6b52Sbalrog #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct mtpos) 24598fbd6b52Sbalrog 2460a5448a7dSbellard struct target_sysinfo { 2461992f48a0Sblueswir1 abi_long uptime; /* Seconds since boot */ 2462992f48a0Sblueswir1 abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */ 2463992f48a0Sblueswir1 abi_ulong totalram; /* Total usable main memory size */ 2464992f48a0Sblueswir1 abi_ulong freeram; /* Available memory size */ 2465992f48a0Sblueswir1 abi_ulong sharedram; /* Amount of shared memory */ 2466992f48a0Sblueswir1 abi_ulong bufferram; /* Memory used by buffers */ 2467992f48a0Sblueswir1 abi_ulong totalswap; /* Total swap space size */ 2468992f48a0Sblueswir1 abi_ulong freeswap; /* swap space still available */ 2469a5448a7dSbellard unsigned short procs; /* Number of current processes */ 2470a5448a7dSbellard unsigned short pad; /* explicit padding for m68k */ 2471992f48a0Sblueswir1 abi_ulong totalhigh; /* Total high memory size */ 2472992f48a0Sblueswir1 abi_ulong freehigh; /* Available high memory size */ 2473a5448a7dSbellard unsigned int mem_unit; /* Memory unit size in bytes */ 2474992f48a0Sblueswir1 char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 2475a5448a7dSbellard }; 24763532fa74Sbellard 24776556a833Saurel32 struct linux_dirent { 24786556a833Saurel32 long d_ino; 24796556a833Saurel32 unsigned long d_off; 24806556a833Saurel32 unsigned short d_reclen; 24816556a833Saurel32 char d_name[256]; /* We must not include limits.h! */ 24826556a833Saurel32 }; 24836556a833Saurel32 24846556a833Saurel32 struct linux_dirent64 { 24856556a833Saurel32 uint64_t d_ino; 24866556a833Saurel32 int64_t d_off; 24876556a833Saurel32 unsigned short d_reclen; 24886556a833Saurel32 unsigned char d_type; 24896556a833Saurel32 char d_name[256]; 24906556a833Saurel32 }; 24916556a833Saurel32 249224e1003aSaurel32 struct target_mq_attr { 249324e1003aSaurel32 abi_long mq_flags; 249424e1003aSaurel32 abi_long mq_maxmsg; 249524e1003aSaurel32 abi_long mq_msgsize; 249624e1003aSaurel32 abi_long mq_curmsgs; 249724e1003aSaurel32 }; 249824e1003aSaurel32 24993532fa74Sbellard #include "socket.h" 2500637947f1Sths 2501637947f1Sths #include "errno_defs.h" 250203dfe9f8SRiku Voipio 250303dfe9f8SRiku Voipio #define FUTEX_WAIT 0 250403dfe9f8SRiku Voipio #define FUTEX_WAKE 1 250503dfe9f8SRiku Voipio #define FUTEX_FD 2 250603dfe9f8SRiku Voipio #define FUTEX_REQUEUE 3 250703dfe9f8SRiku Voipio #define FUTEX_CMP_REQUEUE 4 250803dfe9f8SRiku Voipio #define FUTEX_WAKE_OP 5 250903dfe9f8SRiku Voipio #define FUTEX_LOCK_PI 6 251003dfe9f8SRiku Voipio #define FUTEX_UNLOCK_PI 7 251103dfe9f8SRiku Voipio #define FUTEX_TRYLOCK_PI 8 251203dfe9f8SRiku Voipio #define FUTEX_WAIT_BITSET 9 251303dfe9f8SRiku Voipio #define FUTEX_WAKE_BITSET 10 251403dfe9f8SRiku Voipio 251503dfe9f8SRiku Voipio #define FUTEX_PRIVATE_FLAG 128 251603dfe9f8SRiku Voipio #define FUTEX_CLOCK_REALTIME 256 251703dfe9f8SRiku Voipio #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) 251803dfe9f8SRiku Voipio 25193b6edd16SPeter Maydell #ifdef CONFIG_EPOLL 2520928bed6aSLaurent Vivier #if defined(TARGET_X86_64) 2521928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED QEMU_PACKED 2522928bed6aSLaurent Vivier #else 2523928bed6aSLaurent Vivier #define TARGET_EPOLL_PACKED 2524928bed6aSLaurent Vivier #endif 2525928bed6aSLaurent Vivier 25263b6edd16SPeter Maydell typedef union target_epoll_data { 25273b6edd16SPeter Maydell abi_ulong ptr; 2528928bed6aSLaurent Vivier abi_int fd; 2529928bed6aSLaurent Vivier abi_uint u32; 2530928bed6aSLaurent Vivier abi_ullong u64; 25313b6edd16SPeter Maydell } target_epoll_data_t; 25323b6edd16SPeter Maydell 25333b6edd16SPeter Maydell struct target_epoll_event { 2534928bed6aSLaurent Vivier abi_uint events; 25353b6edd16SPeter Maydell target_epoll_data_t data; 2536928bed6aSLaurent Vivier } TARGET_EPOLL_PACKED; 25373b6edd16SPeter Maydell #endif 2538163a05a8SPeter Maydell struct target_rlimit64 { 2539163a05a8SPeter Maydell uint64_t rlim_cur; 2540163a05a8SPeter Maydell uint64_t rlim_max; 2541163a05a8SPeter Maydell }; 2542583359a6SAkos PASZTORY 2543583359a6SAkos PASZTORY struct target_ucred { 2544583359a6SAkos PASZTORY uint32_t pid; 2545583359a6SAkos PASZTORY uint32_t uid; 2546583359a6SAkos PASZTORY uint32_t gid; 2547583359a6SAkos PASZTORY }; 2548cb9c377fSPaolo Bonzini 2549cb9c377fSPaolo Bonzini #endif 2550905bba13SErik de Castro Lopo 2551aecc8861SAlexander Graf typedef int32_t target_timer_t; 2552905bba13SErik de Castro Lopo 255334d60862SNatanael Copa #define TARGET_SIGEV_MAX_SIZE 64 255434d60862SNatanael Copa 255534d60862SNatanael Copa /* This is architecture-specific but most architectures use the default */ 255634d60862SNatanael Copa #ifdef TARGET_MIPS 255734d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long)) 255834d60862SNatanael Copa #else 255934d60862SNatanael Copa #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ 256034d60862SNatanael Copa + sizeof(target_sigval_t)) 256134d60862SNatanael Copa #endif 256234d60862SNatanael Copa 256334d60862SNatanael Copa #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ 256434d60862SNatanael Copa - TARGET_SIGEV_PREAMBLE_SIZE) \ 256534d60862SNatanael Copa / sizeof(int32_t)) 256634d60862SNatanael Copa 2567905bba13SErik de Castro Lopo struct target_sigevent { 2568905bba13SErik de Castro Lopo target_sigval_t sigev_value; 2569905bba13SErik de Castro Lopo int32_t sigev_signo; 2570905bba13SErik de Castro Lopo int32_t sigev_notify; 2571905bba13SErik de Castro Lopo union { 257234d60862SNatanael Copa int32_t _pad[TARGET_SIGEV_PAD_SIZE]; 2573905bba13SErik de Castro Lopo int32_t _tid; 2574905bba13SErik de Castro Lopo 2575905bba13SErik de Castro Lopo struct { 2576905bba13SErik de Castro Lopo void (*_function)(sigval_t); 2577905bba13SErik de Castro Lopo void *_attribute; 2578905bba13SErik de Castro Lopo } _sigev_thread; 2579905bba13SErik de Castro Lopo } _sigev_un; 2580905bba13SErik de Castro Lopo }; 2581e0eb210eSPeter Maydell 2582e0eb210eSPeter Maydell struct target_user_cap_header { 2583e0eb210eSPeter Maydell uint32_t version; 2584e0eb210eSPeter Maydell int pid; 2585e0eb210eSPeter Maydell }; 2586e0eb210eSPeter Maydell 2587e0eb210eSPeter Maydell struct target_user_cap_data { 2588e0eb210eSPeter Maydell uint32_t effective; 2589e0eb210eSPeter Maydell uint32_t permitted; 2590e0eb210eSPeter Maydell uint32_t inheritable; 2591e0eb210eSPeter Maydell }; 2592