131e31b8aSbellard /* common syscall defines for all architectures */ 231e31b8aSbellard 32521d698Sbellard /* Note: although the syscall numbers change between architectures, 42521d698Sbellard most of them stay the same, so we handle it by puting ifdefs if 52521d698Sbellard necessary */ 62521d698Sbellard 76180a181Sbellard #include "syscall_nr.h" 82521d698Sbellard 931e31b8aSbellard #define SOCKOP_socket 1 1031e31b8aSbellard #define SOCKOP_bind 2 1131e31b8aSbellard #define SOCKOP_connect 3 1231e31b8aSbellard #define SOCKOP_listen 4 1331e31b8aSbellard #define SOCKOP_accept 5 1431e31b8aSbellard #define SOCKOP_getsockname 6 1531e31b8aSbellard #define SOCKOP_getpeername 7 1631e31b8aSbellard #define SOCKOP_socketpair 8 1731e31b8aSbellard #define SOCKOP_send 9 1831e31b8aSbellard #define SOCKOP_recv 10 1931e31b8aSbellard #define SOCKOP_sendto 11 2031e31b8aSbellard #define SOCKOP_recvfrom 12 2131e31b8aSbellard #define SOCKOP_shutdown 13 2231e31b8aSbellard #define SOCKOP_setsockopt 14 2331e31b8aSbellard #define SOCKOP_getsockopt 15 2431e31b8aSbellard #define SOCKOP_sendmsg 16 2531e31b8aSbellard #define SOCKOP_recvmsg 17 2631e31b8aSbellard 278853f86eSbellard #define IPCOP_semop 1 288853f86eSbellard #define IPCOP_semget 2 298853f86eSbellard #define IPCOP_semctl 3 308853f86eSbellard #define IPCOP_semtimedop 4 318853f86eSbellard #define IPCOP_msgsnd 11 328853f86eSbellard #define IPCOP_msgrcv 12 338853f86eSbellard #define IPCOP_msgget 13 348853f86eSbellard #define IPCOP_msgctl 14 358853f86eSbellard #define IPCOP_shmat 21 368853f86eSbellard #define IPCOP_shmdt 22 378853f86eSbellard #define IPCOP_shmget 23 388853f86eSbellard #define IPCOP_shmctl 24 398853f86eSbellard 402521d698Sbellard /* 412521d698Sbellard * The following is for compatibility across the various Linux 422521d698Sbellard * platforms. The i386 ioctl numbering scheme doesn't really enforce 432521d698Sbellard * a type field. De facto, however, the top 8 bits of the lower 16 442521d698Sbellard * bits are indeed used as a type field, so we might just as well make 452521d698Sbellard * this explicit here. Please be sure to use the decoding macros 462521d698Sbellard * below from now on. 472521d698Sbellard */ 482521d698Sbellard #define TARGET_IOC_NRBITS 8 492521d698Sbellard #define TARGET_IOC_TYPEBITS 8 502521d698Sbellard 51e6e5906bSpbrook #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ 527a3148a9Sj_mayer || defined(TARGET_M68K) || defined(TARGET_ALPHA) 532521d698Sbellard 542521d698Sbellard #define TARGET_IOC_SIZEBITS 14 552521d698Sbellard #define TARGET_IOC_DIRBITS 2 562521d698Sbellard 572521d698Sbellard #define TARGET_IOC_NONE 0U 582521d698Sbellard #define TARGET_IOC_WRITE 1U 592521d698Sbellard #define TARGET_IOC_READ 2U 602521d698Sbellard 61048f6b4dSbellard #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ 62048f6b4dSbellard defined(TARGET_SPARC) || defined(TARGET_MIPS) 632521d698Sbellard 642521d698Sbellard #define TARGET_IOC_SIZEBITS 13 652521d698Sbellard #define TARGET_IOC_DIRBITS 3 662521d698Sbellard 672521d698Sbellard #define TARGET_IOC_NONE 1U 682521d698Sbellard #define TARGET_IOC_READ 2U 692521d698Sbellard #define TARGET_IOC_WRITE 4U 702521d698Sbellard 712521d698Sbellard #else 722521d698Sbellard #error unsupported CPU 732521d698Sbellard #endif 742521d698Sbellard 752521d698Sbellard #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) 762521d698Sbellard #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) 772521d698Sbellard #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) 782521d698Sbellard #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) 792521d698Sbellard 802521d698Sbellard #define TARGET_IOC_NRSHIFT 0 812521d698Sbellard #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) 822521d698Sbellard #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) 832521d698Sbellard #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) 842521d698Sbellard 852521d698Sbellard #define TARGET_IOC(dir,type,nr,size) \ 862521d698Sbellard (((dir) << TARGET_IOC_DIRSHIFT) | \ 872521d698Sbellard ((type) << TARGET_IOC_TYPESHIFT) | \ 882521d698Sbellard ((nr) << TARGET_IOC_NRSHIFT) | \ 892521d698Sbellard ((size) << TARGET_IOC_SIZESHIFT)) 902521d698Sbellard 912521d698Sbellard /* used to create numbers */ 922521d698Sbellard #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) 932521d698Sbellard #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) 942521d698Sbellard #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 952521d698Sbellard #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) 962521d698Sbellard 972521d698Sbellard /* the size is automatically computed for these defines */ 982521d698Sbellard #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) 992521d698Sbellard #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1002521d698Sbellard #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) 1012521d698Sbellard 1027854b056Sbellard struct target_sockaddr { 1037854b056Sbellard uint16_t sa_family; 1047854b056Sbellard uint8_t sa_data[14]; 1057854b056Sbellard }; 1067854b056Sbellard 10731e31b8aSbellard struct target_timeval { 10831e31b8aSbellard target_long tv_sec; 10931e31b8aSbellard target_long tv_usec; 11031e31b8aSbellard }; 11131e31b8aSbellard 1121b6b029eSbellard struct target_timespec { 1131b6b029eSbellard target_long tv_sec; 1141b6b029eSbellard target_long tv_nsec; 1151b6b029eSbellard }; 1161b6b029eSbellard 11766fb9763Sbellard struct target_itimerval { 11866fb9763Sbellard struct target_timeval it_interval; 11966fb9763Sbellard struct target_timeval it_value; 12066fb9763Sbellard }; 12166fb9763Sbellard 12232f36bceSbellard typedef target_long target_clock_t; 12332f36bceSbellard 124c596ed17Sbellard #define TARGET_HZ 100 125c596ed17Sbellard 12632f36bceSbellard struct target_tms { 12732f36bceSbellard target_clock_t tms_utime; 12832f36bceSbellard target_clock_t tms_stime; 12932f36bceSbellard target_clock_t tms_cutime; 13032f36bceSbellard target_clock_t tms_cstime; 13132f36bceSbellard }; 13232f36bceSbellard 1336180a181Sbellard struct target_utimbuf { 1346180a181Sbellard target_long actime; 1356180a181Sbellard target_long modtime; 1366180a181Sbellard }; 1376180a181Sbellard 138f2674e31Sbellard struct target_sel_arg_struct { 139f2674e31Sbellard target_long n; 140f2674e31Sbellard target_long inp, outp, exp; 141f2674e31Sbellard target_long tvp; 142f2674e31Sbellard }; 143f2674e31Sbellard 14431e31b8aSbellard struct target_iovec { 14531e31b8aSbellard target_long iov_base; /* Starting address */ 14631e31b8aSbellard target_long iov_len; /* Number of bytes */ 14731e31b8aSbellard }; 14831e31b8aSbellard 1491a9353d2Sbellard struct target_msghdr { 1501a9353d2Sbellard target_long msg_name; /* Socket name */ 1511a9353d2Sbellard int msg_namelen; /* Length of name */ 1521a9353d2Sbellard target_long msg_iov; /* Data blocks */ 1531a9353d2Sbellard target_long msg_iovlen; /* Number of blocks */ 1541a9353d2Sbellard target_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ 1551a9353d2Sbellard target_long msg_controllen; /* Length of cmsg list */ 1561a9353d2Sbellard unsigned int msg_flags; 1571a9353d2Sbellard }; 1581a9353d2Sbellard 1597854b056Sbellard struct target_cmsghdr { 1607854b056Sbellard target_long cmsg_len; 1617854b056Sbellard int cmsg_level; 1627854b056Sbellard int cmsg_type; 1637854b056Sbellard }; 1647854b056Sbellard 1657854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) 1667854b056Sbellard #define TARGET_CMSG_NXTHDR(mhdr, cmsg) __target_cmsg_nxthdr (mhdr, cmsg) 1677854b056Sbellard #define TARGET_CMSG_FIRSTHDR(mhdr) \ 1687854b056Sbellard ((size_t) tswapl((mhdr)->msg_controllen) >= sizeof (struct target_cmsghdr) \ 1697854b056Sbellard ? (struct target_cmsghdr *) tswapl((mhdr)->msg_control) : (struct target_cmsghdr *) NULL) 1707854b056Sbellard #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (target_long) - 1) \ 1717854b056Sbellard & (size_t) ~(sizeof (target_long) - 1)) 1727854b056Sbellard #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \ 1737854b056Sbellard + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr))) 1747854b056Sbellard #define TARGET_CMSG_LEN(len) (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len)) 1757854b056Sbellard 1767854b056Sbellard static __inline__ struct target_cmsghdr * 1777854b056Sbellard __target_cmsg_nxthdr (struct target_msghdr *__mhdr, struct target_cmsghdr *__cmsg) 1787854b056Sbellard { 1792b8bdefcSths struct target_cmsghdr *__ptr; 1807854b056Sbellard 1812b8bdefcSths __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg 1827854b056Sbellard + TARGET_CMSG_ALIGN (tswapl(__cmsg->cmsg_len))); 1832b8bdefcSths if ((unsigned long)((char *)(__ptr+1) - (char *)(size_t)tswapl(__mhdr->msg_control)) 1842b8bdefcSths > tswapl(__mhdr->msg_controllen)) 1857854b056Sbellard /* No more entries. */ 1862b8bdefcSths return (struct target_cmsghdr *)0; 1877854b056Sbellard return __cmsg; 1887854b056Sbellard } 1897854b056Sbellard 1907854b056Sbellard 19131e31b8aSbellard struct target_rusage { 19231e31b8aSbellard struct target_timeval ru_utime; /* user time used */ 19331e31b8aSbellard struct target_timeval ru_stime; /* system time used */ 19431e31b8aSbellard target_long ru_maxrss; /* maximum resident set size */ 19531e31b8aSbellard target_long ru_ixrss; /* integral shared memory size */ 19631e31b8aSbellard target_long ru_idrss; /* integral unshared data size */ 19731e31b8aSbellard target_long ru_isrss; /* integral unshared stack size */ 19831e31b8aSbellard target_long ru_minflt; /* page reclaims */ 19931e31b8aSbellard target_long ru_majflt; /* page faults */ 20031e31b8aSbellard target_long ru_nswap; /* swaps */ 20131e31b8aSbellard target_long ru_inblock; /* block input operations */ 20231e31b8aSbellard target_long ru_oublock; /* block output operations */ 20331e31b8aSbellard target_long ru_msgsnd; /* messages sent */ 20431e31b8aSbellard target_long ru_msgrcv; /* messages received */ 20531e31b8aSbellard target_long ru_nsignals; /* signals received */ 20631e31b8aSbellard target_long ru_nvcsw; /* voluntary context switches */ 20731e31b8aSbellard target_long ru_nivcsw; /* involuntary " */ 20831e31b8aSbellard }; 20931e31b8aSbellard 21031e31b8aSbellard typedef struct { 21131e31b8aSbellard int val[2]; 21231e31b8aSbellard } kernel_fsid_t; 21331e31b8aSbellard 21472f03900Sbellard struct kernel_statfs { 21531e31b8aSbellard int f_type; 21631e31b8aSbellard int f_bsize; 21731e31b8aSbellard int f_blocks; 21831e31b8aSbellard int f_bfree; 21931e31b8aSbellard int f_bavail; 22031e31b8aSbellard int f_files; 22131e31b8aSbellard int f_ffree; 22231e31b8aSbellard kernel_fsid_t f_fsid; 22331e31b8aSbellard int f_namelen; 22431e31b8aSbellard int f_spare[6]; 22531e31b8aSbellard }; 22631e31b8aSbellard 227dab2ed99Sbellard struct target_dirent { 228dab2ed99Sbellard target_long d_ino; 229dab2ed99Sbellard target_long d_off; 230dab2ed99Sbellard unsigned short d_reclen; 231dab2ed99Sbellard char d_name[256]; /* We must not include limits.h! */ 232dab2ed99Sbellard }; 233dab2ed99Sbellard 234dab2ed99Sbellard struct target_dirent64 { 235dab2ed99Sbellard uint64_t d_ino; 236dab2ed99Sbellard int64_t d_off; 237dab2ed99Sbellard unsigned short d_reclen; 238dab2ed99Sbellard unsigned char d_type; 239dab2ed99Sbellard char d_name[256]; 240dab2ed99Sbellard }; 241dab2ed99Sbellard 242dab2ed99Sbellard 24331e31b8aSbellard /* mostly generic signal stuff */ 24431e31b8aSbellard #define TARGET_SIG_DFL ((target_long)0) /* default signal handling */ 24531e31b8aSbellard #define TARGET_SIG_IGN ((target_long)1) /* ignore signal */ 24631e31b8aSbellard #define TARGET_SIG_ERR ((target_long)-1) /* error return from signal */ 24731e31b8aSbellard 24831e31b8aSbellard #ifdef TARGET_MIPS 24931e31b8aSbellard #define TARGET_NSIG 128 25031e31b8aSbellard #else 25131e31b8aSbellard #define TARGET_NSIG 64 25231e31b8aSbellard #endif 25331e31b8aSbellard #define TARGET_NSIG_BPW TARGET_LONG_BITS 25431e31b8aSbellard #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) 25531e31b8aSbellard 25631e31b8aSbellard typedef struct { 25731e31b8aSbellard target_ulong sig[TARGET_NSIG_WORDS]; 25831e31b8aSbellard } target_sigset_t; 25931e31b8aSbellard 26066fb9763Sbellard #ifdef BSWAP_NEEDED 26166fb9763Sbellard static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 26266fb9763Sbellard { 26366fb9763Sbellard int i; 26466fb9763Sbellard for(i = 0;i < TARGET_NSIG_WORDS; i++) 26566fb9763Sbellard d->sig[i] = tswapl(s->sig[i]); 26666fb9763Sbellard } 26766fb9763Sbellard #else 26866fb9763Sbellard static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) 26966fb9763Sbellard { 27066fb9763Sbellard *d = *s; 27166fb9763Sbellard } 27266fb9763Sbellard #endif 27366fb9763Sbellard 27466fb9763Sbellard static inline void target_siginitset(target_sigset_t *d, target_ulong set) 27566fb9763Sbellard { 27666fb9763Sbellard int i; 27766fb9763Sbellard d->sig[0] = set; 27866fb9763Sbellard for(i = 1;i < TARGET_NSIG_WORDS; i++) 27966fb9763Sbellard d->sig[i] = 0; 28066fb9763Sbellard } 28166fb9763Sbellard 282c596ed17Sbellard void host_to_target_sigset(target_sigset_t *d, const sigset_t *s); 283c596ed17Sbellard void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); 28466fb9763Sbellard void host_to_target_old_sigset(target_ulong *old_sigset, 28566fb9763Sbellard const sigset_t *sigset); 28666fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset, 28766fb9763Sbellard const target_ulong *old_sigset); 28866fb9763Sbellard struct target_sigaction; 28966fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act, 29066fb9763Sbellard struct target_sigaction *oact); 29166fb9763Sbellard 2927a3148a9Sj_mayer #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined (TARGET_SH4) || defined(TARGET_M68K) || defined(TARGET_ALPHA) 2932521d698Sbellard 294048f6b4dSbellard #if defined(TARGET_SPARC) 295048f6b4dSbellard #define TARGET_SA_NOCLDSTOP 8u 296048f6b4dSbellard #define TARGET_SA_NOCLDWAIT 0x100u 297048f6b4dSbellard #define TARGET_SA_SIGINFO 0x200u 298048f6b4dSbellard #define TARGET_SA_ONSTACK 1u 299048f6b4dSbellard #define TARGET_SA_RESTART 2u 300048f6b4dSbellard #define TARGET_SA_NODEFER 0x20u 301048f6b4dSbellard #define TARGET_SA_RESETHAND 4u 302048f6b4dSbellard #elif defined(TARGET_MIPS) 303048f6b4dSbellard #define TARGET_SA_NOCLDSTOP 0x00000001 304048f6b4dSbellard #define TARGET_SA_NOCLDWAIT 0x00010000 305048f6b4dSbellard #define TARGET_SA_SIGINFO 0x00000008 306048f6b4dSbellard #define TARGET_SA_ONSTACK 0x08000000 307048f6b4dSbellard #define TARGET_SA_NODEFER 0x40000000 308048f6b4dSbellard #define TARGET_SA_RESTART 0x10000000 309048f6b4dSbellard #define TARGET_SA_RESETHAND 0x80000000 310048f6b4dSbellard #define TARGET_SA_RESTORER 0x04000000 /* Only for o32 */ 311048f6b4dSbellard #else 3122521d698Sbellard #define TARGET_SA_NOCLDSTOP 0x00000001 3132521d698Sbellard #define TARGET_SA_NOCLDWAIT 0x00000002 /* not supported yet */ 3142521d698Sbellard #define TARGET_SA_SIGINFO 0x00000004 3152521d698Sbellard #define TARGET_SA_ONSTACK 0x08000000 3162521d698Sbellard #define TARGET_SA_RESTART 0x10000000 3172521d698Sbellard #define TARGET_SA_NODEFER 0x40000000 3182521d698Sbellard #define TARGET_SA_RESETHAND 0x80000000 3192521d698Sbellard #define TARGET_SA_RESTORER 0x04000000 3206d5e216dSbellard #endif 3216d5e216dSbellard 3226d5e216dSbellard #if defined(TARGET_SPARC) 3236d5e216dSbellard 3246d5e216dSbellard #define TARGET_SIGHUP 1 3256d5e216dSbellard #define TARGET_SIGINT 2 3266d5e216dSbellard #define TARGET_SIGQUIT 3 3276d5e216dSbellard #define TARGET_SIGILL 4 3286d5e216dSbellard #define TARGET_SIGTRAP 5 3296d5e216dSbellard #define TARGET_SIGABRT 6 3306d5e216dSbellard #define TARGET_SIGIOT 6 3316d5e216dSbellard #define TARGET_SIGSTKFLT 7 /* actually EMT */ 3326d5e216dSbellard #define TARGET_SIGFPE 8 3336d5e216dSbellard #define TARGET_SIGKILL 9 3346d5e216dSbellard #define TARGET_SIGBUS 10 3356d5e216dSbellard #define TARGET_SIGSEGV 11 3366d5e216dSbellard #define TARGET_SIGSYS 12 3376d5e216dSbellard #define TARGET_SIGPIPE 13 3386d5e216dSbellard #define TARGET_SIGALRM 14 3396d5e216dSbellard #define TARGET_SIGTERM 15 3406d5e216dSbellard #define TARGET_SIGURG 16 3416d5e216dSbellard #define TARGET_SIGSTOP 17 3426d5e216dSbellard #define TARGET_SIGTSTP 18 3436d5e216dSbellard #define TARGET_SIGCONT 19 3446d5e216dSbellard #define TARGET_SIGCHLD 20 3456d5e216dSbellard #define TARGET_SIGTTIN 21 3466d5e216dSbellard #define TARGET_SIGTTOU 22 3476d5e216dSbellard #define TARGET_SIGIO 23 3486d5e216dSbellard #define TARGET_SIGXCPU 24 3496d5e216dSbellard #define TARGET_SIGXFSZ 25 3506d5e216dSbellard #define TARGET_SIGVTALRM 26 3516d5e216dSbellard #define TARGET_SIGPROF 27 3526d5e216dSbellard #define TARGET_SIGWINCH 28 3536d5e216dSbellard #define TARGET_SIGPWR 29 3546d5e216dSbellard #define TARGET_SIGUSR1 30 3556d5e216dSbellard #define TARGET_SIGUSR2 31 3566d5e216dSbellard #define TARGET_SIGRTMIN 32 3576d5e216dSbellard 3586d5e216dSbellard #define TARGET_SIG_BLOCK 0x01 /* for blocking signals */ 3596d5e216dSbellard #define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */ 3606d5e216dSbellard #define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */ 3616d5e216dSbellard 362048f6b4dSbellard #elif defined(TARGET_MIPS) 363048f6b4dSbellard 364048f6b4dSbellard #define TARGET_SIGHUP 1 /* Hangup (POSIX). */ 365048f6b4dSbellard #define TARGET_SIGINT 2 /* Interrupt (ANSI). */ 366048f6b4dSbellard #define TARGET_SIGQUIT 3 /* Quit (POSIX). */ 367048f6b4dSbellard #define TARGET_SIGILL 4 /* Illegal instruction (ANSI). */ 368048f6b4dSbellard #define TARGET_SIGTRAP 5 /* Trace trap (POSIX). */ 369048f6b4dSbellard #define TARGET_SIGIOT 6 /* IOT trap (4.2 BSD). */ 370048f6b4dSbellard #define TARGET_SIGABRT TARGET_SIGIOT /* Abort (ANSI). */ 371048f6b4dSbellard #define TARGET_SIGEMT 7 372048f6b4dSbellard #define TARGET_SIGSTKFLT 7 /* XXX: incorrect */ 373048f6b4dSbellard #define TARGET_SIGFPE 8 /* Floating-point exception (ANSI). */ 374048f6b4dSbellard #define TARGET_SIGKILL 9 /* Kill, unblockable (POSIX). */ 375048f6b4dSbellard #define TARGET_SIGBUS 10 /* BUS error (4.2 BSD). */ 376048f6b4dSbellard #define TARGET_SIGSEGV 11 /* Segmentation violation (ANSI). */ 377048f6b4dSbellard #define TARGET_SIGSYS 12 378048f6b4dSbellard #define TARGET_SIGPIPE 13 /* Broken pipe (POSIX). */ 379048f6b4dSbellard #define TARGET_SIGALRM 14 /* Alarm clock (POSIX). */ 380048f6b4dSbellard #define TARGET_SIGTERM 15 /* Termination (ANSI). */ 381048f6b4dSbellard #define TARGET_SIGUSR1 16 /* User-defined signal 1 (POSIX). */ 382048f6b4dSbellard #define TARGET_SIGUSR2 17 /* User-defined signal 2 (POSIX). */ 383048f6b4dSbellard #define TARGET_SIGCHLD 18 /* Child status has changed (POSIX). */ 384048f6b4dSbellard #define TARGET_SIGCLD TARGET_SIGCHLD /* Same as TARGET_SIGCHLD (System V). */ 385048f6b4dSbellard #define TARGET_SIGPWR 19 /* Power failure restart (System V). */ 386048f6b4dSbellard #define TARGET_SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */ 387048f6b4dSbellard #define TARGET_SIGURG 21 /* Urgent condition on socket (4.2 BSD). */ 388048f6b4dSbellard #define TARGET_SIGIO 22 /* I/O now possible (4.2 BSD). */ 389048f6b4dSbellard #define TARGET_SIGPOLL TARGET_SIGIO /* Pollable event occurred (System V). */ 390048f6b4dSbellard #define TARGET_SIGSTOP 23 /* Stop, unblockable (POSIX). */ 391048f6b4dSbellard #define TARGET_SIGTSTP 24 /* Keyboard stop (POSIX). */ 392048f6b4dSbellard #define TARGET_SIGCONT 25 /* Continue (POSIX). */ 393048f6b4dSbellard #define TARGET_SIGTTIN 26 /* Background read from tty (POSIX). */ 394048f6b4dSbellard #define TARGET_SIGTTOU 27 /* Background write to tty (POSIX). */ 395048f6b4dSbellard #define TARGET_SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */ 396048f6b4dSbellard #define TARGET_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */ 397048f6b4dSbellard #define TARGET_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ 398048f6b4dSbellard #define TARGET_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ 399048f6b4dSbellard #define TARGET_SIGRTMIN 32 400048f6b4dSbellard 401048f6b4dSbellard #define TARGET_SIG_BLOCK 1 /* for blocking signals */ 402048f6b4dSbellard #define TARGET_SIG_UNBLOCK 2 /* for unblocking signals */ 403048f6b4dSbellard #define TARGET_SIG_SETMASK 3 /* for setting the signal mask */ 404048f6b4dSbellard 4056d5e216dSbellard #else 4062521d698Sbellard 4072521d698Sbellard #define TARGET_SIGHUP 1 4082521d698Sbellard #define TARGET_SIGINT 2 4092521d698Sbellard #define TARGET_SIGQUIT 3 4102521d698Sbellard #define TARGET_SIGILL 4 4112521d698Sbellard #define TARGET_SIGTRAP 5 4122521d698Sbellard #define TARGET_SIGABRT 6 4132521d698Sbellard #define TARGET_SIGIOT 6 4142521d698Sbellard #define TARGET_SIGBUS 7 4152521d698Sbellard #define TARGET_SIGFPE 8 4162521d698Sbellard #define TARGET_SIGKILL 9 4172521d698Sbellard #define TARGET_SIGUSR1 10 4182521d698Sbellard #define TARGET_SIGSEGV 11 4192521d698Sbellard #define TARGET_SIGUSR2 12 4202521d698Sbellard #define TARGET_SIGPIPE 13 4212521d698Sbellard #define TARGET_SIGALRM 14 4222521d698Sbellard #define TARGET_SIGTERM 15 4232521d698Sbellard #define TARGET_SIGSTKFLT 16 4242521d698Sbellard #define TARGET_SIGCHLD 17 4252521d698Sbellard #define TARGET_SIGCONT 18 4262521d698Sbellard #define TARGET_SIGSTOP 19 4272521d698Sbellard #define TARGET_SIGTSTP 20 4282521d698Sbellard #define TARGET_SIGTTIN 21 4292521d698Sbellard #define TARGET_SIGTTOU 22 4302521d698Sbellard #define TARGET_SIGURG 23 4312521d698Sbellard #define TARGET_SIGXCPU 24 4322521d698Sbellard #define TARGET_SIGXFSZ 25 4332521d698Sbellard #define TARGET_SIGVTALRM 26 4342521d698Sbellard #define TARGET_SIGPROF 27 4352521d698Sbellard #define TARGET_SIGWINCH 28 4362521d698Sbellard #define TARGET_SIGIO 29 437c596ed17Sbellard #define TARGET_SIGPWR 30 438c596ed17Sbellard #define TARGET_SIGSYS 31 4392521d698Sbellard #define TARGET_SIGRTMIN 32 4402521d698Sbellard 4412521d698Sbellard #define TARGET_SIG_BLOCK 0 /* for blocking signals */ 4422521d698Sbellard #define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */ 4432521d698Sbellard #define TARGET_SIG_SETMASK 2 /* for setting the signal mask */ 4442521d698Sbellard 4456d5e216dSbellard #endif 4466d5e216dSbellard 447106ec879Sbellard #if defined(TARGET_MIPS) 448106ec879Sbellard 449106ec879Sbellard struct target_sigaction { 450106ec879Sbellard target_ulong sa_flags; 451106ec879Sbellard target_ulong _sa_handler; 452106ec879Sbellard target_sigset_t sa_mask; 453106ec879Sbellard }; 454106ec879Sbellard 455106ec879Sbellard #else 4562521d698Sbellard struct target_old_sigaction { 4572521d698Sbellard target_ulong _sa_handler; 4582521d698Sbellard target_ulong sa_mask; 4592521d698Sbellard target_ulong sa_flags; 4602521d698Sbellard target_ulong sa_restorer; 4612521d698Sbellard }; 4622521d698Sbellard 4632521d698Sbellard struct target_sigaction { 4642521d698Sbellard target_ulong _sa_handler; 4652521d698Sbellard target_ulong sa_flags; 4662521d698Sbellard target_ulong sa_restorer; 4672521d698Sbellard target_sigset_t sa_mask; 4682521d698Sbellard }; 469106ec879Sbellard #endif 4702521d698Sbellard 4712521d698Sbellard typedef union target_sigval { 4722521d698Sbellard int sival_int; 4732521d698Sbellard target_ulong sival_ptr; 4742521d698Sbellard } target_sigval_t; 4756d5e216dSbellard #if 0 4766d5e216dSbellard #if defined (TARGET_SPARC) 4776d5e216dSbellard typedef struct { 4786d5e216dSbellard struct { 4796d5e216dSbellard target_ulong psr; 4806d5e216dSbellard target_ulong pc; 4816d5e216dSbellard target_ulong npc; 4826d5e216dSbellard target_ulong y; 4836d5e216dSbellard target_ulong u_regs[16]; /* globals and ins */ 4846d5e216dSbellard } si_regs; 4856d5e216dSbellard int si_mask; 4866d5e216dSbellard } __siginfo_t; 4876d5e216dSbellard 4886d5e216dSbellard typedef struct { 4896d5e216dSbellard unsigned long si_float_regs [32]; 4906d5e216dSbellard unsigned long si_fsr; 4916d5e216dSbellard unsigned long si_fpqdepth; 4926d5e216dSbellard struct { 4936d5e216dSbellard unsigned long *insn_addr; 4946d5e216dSbellard unsigned long insn; 4956d5e216dSbellard } si_fpqueue [16]; 4966d5e216dSbellard } __siginfo_fpu_t; 4976d5e216dSbellard #endif 4986d5e216dSbellard #endif 4992521d698Sbellard 5002521d698Sbellard #define TARGET_SI_MAX_SIZE 128 5012521d698Sbellard #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE/sizeof(int)) - 3) 5022521d698Sbellard 5032521d698Sbellard typedef struct target_siginfo { 5042521d698Sbellard int si_signo; 5052521d698Sbellard int si_errno; 5062521d698Sbellard int si_code; 5072521d698Sbellard 5082521d698Sbellard union { 5092521d698Sbellard int _pad[TARGET_SI_PAD_SIZE]; 5102521d698Sbellard 5112521d698Sbellard /* kill() */ 5122521d698Sbellard struct { 5132521d698Sbellard pid_t _pid; /* sender's pid */ 5142521d698Sbellard uid_t _uid; /* sender's uid */ 5152521d698Sbellard } _kill; 5162521d698Sbellard 5172521d698Sbellard /* POSIX.1b timers */ 5182521d698Sbellard struct { 5192521d698Sbellard unsigned int _timer1; 5202521d698Sbellard unsigned int _timer2; 5212521d698Sbellard } _timer; 5222521d698Sbellard 5232521d698Sbellard /* POSIX.1b signals */ 5242521d698Sbellard struct { 5252521d698Sbellard pid_t _pid; /* sender's pid */ 5262521d698Sbellard uid_t _uid; /* sender's uid */ 5272521d698Sbellard target_sigval_t _sigval; 5282521d698Sbellard } _rt; 5292521d698Sbellard 5302521d698Sbellard /* SIGCHLD */ 5312521d698Sbellard struct { 5322521d698Sbellard pid_t _pid; /* which child */ 5332521d698Sbellard uid_t _uid; /* sender's uid */ 5342521d698Sbellard int _status; /* exit code */ 5352521d698Sbellard target_clock_t _utime; 5362521d698Sbellard target_clock_t _stime; 5372521d698Sbellard } _sigchld; 5382521d698Sbellard 5392521d698Sbellard /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 5402521d698Sbellard struct { 5412521d698Sbellard target_ulong _addr; /* faulting insn/memory ref. */ 5422521d698Sbellard } _sigfault; 5432521d698Sbellard 5442521d698Sbellard /* SIGPOLL */ 5452521d698Sbellard struct { 5462521d698Sbellard int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 5472521d698Sbellard int _fd; 5482521d698Sbellard } _sigpoll; 5492521d698Sbellard } _sifields; 5502521d698Sbellard } target_siginfo_t; 5512521d698Sbellard 5522521d698Sbellard /* 5532521d698Sbellard * si_code values 5542521d698Sbellard * Digital reserves positive values for kernel-generated signals. 5552521d698Sbellard */ 5562521d698Sbellard #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ 5572521d698Sbellard #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ 5582521d698Sbellard #define TARGET_SI_QUEUE -1 /* sent by sigqueue */ 5592521d698Sbellard #define TARGET_SI_TIMER -2 /* sent by timer expiration */ 5602521d698Sbellard #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ 5612521d698Sbellard #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ 5622521d698Sbellard #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ 5632521d698Sbellard 5642521d698Sbellard /* 5652521d698Sbellard * SIGILL si_codes 5662521d698Sbellard */ 567ffa65c3bSbellard #define TARGET_ILL_ILLOPC (1) /* illegal opcode */ 5682521d698Sbellard #define TARGET_ILL_ILLOPN (2) /* illegal operand */ 569ffa65c3bSbellard #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ 570ffa65c3bSbellard #define TARGET_ILL_ILLTRP (4) /* illegal trap */ 571ffa65c3bSbellard #define TARGET_ILL_PRVOPC (5) /* privileged opcode */ 572ffa65c3bSbellard #define TARGET_ILL_PRVREG (6) /* privileged register */ 573ffa65c3bSbellard #define TARGET_ILL_COPROC (7) /* coprocessor error */ 574ffa65c3bSbellard #define TARGET_ILL_BADSTK (8) /* internal stack error */ 5752521d698Sbellard 5762521d698Sbellard /* 5772521d698Sbellard * SIGFPE si_codes 5782521d698Sbellard */ 5792521d698Sbellard #define TARGET_FPE_INTDIV (1) /* integer divide by zero */ 5802521d698Sbellard #define TARGET_FPE_INTOVF (2) /* integer overflow */ 5812521d698Sbellard #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ 5822521d698Sbellard #define TARGET_FPE_FLTOVF (4) /* floating point overflow */ 5832521d698Sbellard #define TARGET_FPE_FLTUND (5) /* floating point underflow */ 5842521d698Sbellard #define TARGET_FPE_FLTRES (6) /* floating point inexact result */ 5852521d698Sbellard #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ 5862521d698Sbellard #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ 5872521d698Sbellard #define TARGET_NSIGFPE 8 5882521d698Sbellard 5892521d698Sbellard /* 5902521d698Sbellard * SIGSEGV si_codes 5912521d698Sbellard */ 5922521d698Sbellard #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ 5932521d698Sbellard #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ 5942521d698Sbellard 5952521d698Sbellard /* 596ffa65c3bSbellard * SIGBUS si_codes 597ffa65c3bSbellard */ 598ffa65c3bSbellard #define TARGET_BUS_ADRALN (1) /* invalid address alignment */ 599ffa65c3bSbellard #define TARGET_BUS_ADRERR (2) /* non-existant physical address */ 600ffa65c3bSbellard #define TARGET_BUS_OBJERR (3) /* object specific hardware error */ 601ffa65c3bSbellard 602ffa65c3bSbellard /* 6032521d698Sbellard * SIGTRAP si_codes 6042521d698Sbellard */ 6052521d698Sbellard #define TARGET_TRAP_BRKPT (1) /* process breakpoint */ 6062521d698Sbellard #define TARGET_TRAP_TRACE (2) /* process trace trap */ 6072521d698Sbellard 6082521d698Sbellard #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */ 6092521d698Sbellard 6109de5e440Sbellard struct target_rlimit { 6119de5e440Sbellard target_ulong rlim_cur; 6129de5e440Sbellard target_ulong rlim_max; 6139de5e440Sbellard }; 6149de5e440Sbellard 6159de5e440Sbellard struct target_pollfd { 6169de5e440Sbellard int fd; /* file descriptor */ 6179de5e440Sbellard short events; /* requested events */ 6189de5e440Sbellard short revents; /* returned events */ 6199de5e440Sbellard }; 6209de5e440Sbellard 6218e5a0667Sbellard /* virtual terminal ioctls */ 6220221cfcdSbellard #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ 6230221cfcdSbellard #define TARGET_KDMKTONE 0x4B30 /* generate tone */ 6248e5a0667Sbellard #define TARGET_KDGKBTYPE 0x4b33 6250221cfcdSbellard #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ 6260221cfcdSbellard #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ 6278e5a0667Sbellard 6282521d698Sbellard #define TARGET_SIOCATMARK 0x8905 6292521d698Sbellard 63031e31b8aSbellard /* Networking ioctls */ 63131e31b8aSbellard #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ 63231e31b8aSbellard #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ 63331e31b8aSbellard #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ 63431e31b8aSbellard #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ 63531e31b8aSbellard #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ 63631e31b8aSbellard #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ 63731e31b8aSbellard #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ 63831e31b8aSbellard #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ 63931e31b8aSbellard #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ 64031e31b8aSbellard #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ 64131e31b8aSbellard #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ 64231e31b8aSbellard #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ 64331e31b8aSbellard #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ 64431e31b8aSbellard #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ 64531e31b8aSbellard #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ 64631e31b8aSbellard #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ 64731e31b8aSbellard #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ 64831e31b8aSbellard #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ 64931e31b8aSbellard #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ 65031e31b8aSbellard #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ 65131e31b8aSbellard #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ 65231e31b8aSbellard #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ 65331e31b8aSbellard #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ 65431e31b8aSbellard #define TARGET_SIOCSIFENCAP 0x8926 65531e31b8aSbellard #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ 65631e31b8aSbellard #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ 65731e31b8aSbellard #define TARGET_SIOCSIFSLAVE 0x8930 65831e31b8aSbellard #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ 65931e31b8aSbellard #define TARGET_SIOCDELMULTI 0x8932 66031e31b8aSbellard 66131e31b8aSbellard /* Bridging control calls */ 66231e31b8aSbellard #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ 66331e31b8aSbellard #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ 66431e31b8aSbellard 66531e31b8aSbellard #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ 66631e31b8aSbellard #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ 66731e31b8aSbellard 66831e31b8aSbellard /* ARP cache control calls. */ 66931e31b8aSbellard #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ 67031e31b8aSbellard #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ 67131e31b8aSbellard #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ 67231e31b8aSbellard #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ 67331e31b8aSbellard #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ 67431e31b8aSbellard #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ 67531e31b8aSbellard 67631e31b8aSbellard /* RARP cache control calls. */ 67731e31b8aSbellard #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ 67831e31b8aSbellard #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ 67931e31b8aSbellard #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ 68031e31b8aSbellard 68131e31b8aSbellard /* Driver configuration calls */ 68231e31b8aSbellard #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ 68331e31b8aSbellard #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ 68431e31b8aSbellard 68531e31b8aSbellard /* DLCI configuration calls */ 68631e31b8aSbellard #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ 68731e31b8aSbellard #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ 68831e31b8aSbellard 68931e31b8aSbellard 69031e31b8aSbellard /* From <linux/fs.h> */ 69131e31b8aSbellard 69231e31b8aSbellard #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ 69331e31b8aSbellard #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ 69431e31b8aSbellard #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ 69531e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ 69631e31b8aSbellard #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ 69731e31b8aSbellard #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ 69831e31b8aSbellard #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ 69931e31b8aSbellard #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ 70031e31b8aSbellard #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ 70131e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ 70231e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ 70331e31b8aSbellard #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ 70431e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */ 70531e31b8aSbellard #define TARGET_BLKBSZGET TARGET_IOR(0x12,112,sizeof(int)) 70631e31b8aSbellard #define TARGET_BLKBSZSET TARGET_IOW(0x12,113,sizeof(int)) 70731e31b8aSbellard #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,sizeof(uint64_t)) /* return device size in bytes (u64 *arg) */ 70831e31b8aSbellard #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ 70931e31b8aSbellard #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ 71031e31b8aSbellard 71131e31b8aSbellard /* cdrom commands */ 71231e31b8aSbellard #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ 71331e31b8aSbellard #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ 71431e31b8aSbellard #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ 71531e31b8aSbellard #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index 71631e31b8aSbellard (struct cdrom_ti) */ 71731e31b8aSbellard #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header 71831e31b8aSbellard (struct cdrom_tochdr) */ 71931e31b8aSbellard #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry 72031e31b8aSbellard (struct cdrom_tocentry) */ 72131e31b8aSbellard #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ 72231e31b8aSbellard #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ 72331e31b8aSbellard #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ 72431e31b8aSbellard #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume 72531e31b8aSbellard (struct cdrom_volctrl) */ 72631e31b8aSbellard #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data 72731e31b8aSbellard (struct cdrom_subchnl) */ 72831e31b8aSbellard #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) 72931e31b8aSbellard (struct cdrom_read) */ 73031e31b8aSbellard #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) 73131e31b8aSbellard (struct cdrom_read) */ 73231e31b8aSbellard #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ 73331e31b8aSbellard #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ 73431e31b8aSbellard #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session 73531e31b8aSbellard address of multi session disks 73631e31b8aSbellard (struct cdrom_multisession) */ 73731e31b8aSbellard #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" 73831e31b8aSbellard if available (struct cdrom_mcn) */ 73931e31b8aSbellard #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is depricated, 74031e31b8aSbellard but here anyway for compatability */ 74131e31b8aSbellard #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ 74231e31b8aSbellard #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting 74331e31b8aSbellard (struct cdrom_volctrl) */ 74431e31b8aSbellard #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) 74531e31b8aSbellard (struct cdrom_read) */ 74631e31b8aSbellard /* 74731e31b8aSbellard * These ioctls are used only used in aztcd.c and optcd.c 74831e31b8aSbellard */ 74931e31b8aSbellard #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ 75031e31b8aSbellard #define TARGET_CDROMSEEK 0x5316 /* seek msf address */ 75131e31b8aSbellard 75231e31b8aSbellard /* 75331e31b8aSbellard * This ioctl is only used by the scsi-cd driver. 75431e31b8aSbellard It is for playing audio in logical block addressing mode. 75531e31b8aSbellard */ 75631e31b8aSbellard #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ 75731e31b8aSbellard 75831e31b8aSbellard /* 75931e31b8aSbellard * These ioctls are only used in optcd.c 76031e31b8aSbellard */ 76131e31b8aSbellard #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ 76231e31b8aSbellard 76331e31b8aSbellard /* 76431e31b8aSbellard * These ioctls are (now) only in ide-cd.c for controlling 76531e31b8aSbellard * drive spindown time. They should be implemented in the 76631e31b8aSbellard * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, 76731e31b8aSbellard * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... 76831e31b8aSbellard * -Erik 76931e31b8aSbellard */ 77031e31b8aSbellard #define TARGET_CDROMGETSPINDOWN 0x531d 77131e31b8aSbellard #define TARGET_CDROMSETSPINDOWN 0x531e 77231e31b8aSbellard 77331e31b8aSbellard /* 77431e31b8aSbellard * These ioctls are implemented through the uniform CD-ROM driver 77531e31b8aSbellard * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM 77631e31b8aSbellard * drivers are eventually ported to the uniform CD-ROM driver interface. 77731e31b8aSbellard */ 77831e31b8aSbellard #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ 77931e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ 78031e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ 78131e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ 78231e31b8aSbellard #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ 78331e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ 78431e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ 78531e31b8aSbellard #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ 78631e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ 78731e31b8aSbellard #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ 78831e31b8aSbellard #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ 78931e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ 79031e31b8aSbellard 79131e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. 79231e31b8aSbellard * Future CDROM ioctls should be kept below 0x537F 79331e31b8aSbellard */ 79431e31b8aSbellard 79531e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */ 79631e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ 79731e31b8aSbellard /* conflict with SCSI_IOCTL_GET_IDLUN */ 79831e31b8aSbellard 79931e31b8aSbellard /* DVD-ROM Specific ioctls */ 80031e31b8aSbellard #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ 80131e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ 80231e31b8aSbellard #define TARGET_DVD_AUTH 0x5392 /* Authentication */ 80331e31b8aSbellard 80431e31b8aSbellard #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ 80531e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ 80631e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ 80731e31b8aSbellard 80831e31b8aSbellard /* HD commands */ 80931e31b8aSbellard 81031e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ 81131e31b8aSbellard #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ 81231e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ 81331e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ 81431e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ 81531e31b8aSbellard #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ 81631e31b8aSbellard #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ 81731e31b8aSbellard #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ 8182521d698Sbellard #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ 81931e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ 82031e31b8aSbellard 82131e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ 82231e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ 82331e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ 82431e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ 82531e31b8aSbellard #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ 82631e31b8aSbellard #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ 82731e31b8aSbellard #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ 82831e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ 8292521d698Sbellard 8302521d698Sbellard 8312521d698Sbellard /* from asm/termbits.h */ 8322521d698Sbellard 8333bfd9da1Sbellard #define TARGET_NCC 8 8343bfd9da1Sbellard struct target_termio { 8353bfd9da1Sbellard unsigned short c_iflag; /* input mode flags */ 8363bfd9da1Sbellard unsigned short c_oflag; /* output mode flags */ 8373bfd9da1Sbellard unsigned short c_cflag; /* control mode flags */ 8383bfd9da1Sbellard unsigned short c_lflag; /* local mode flags */ 8392521d698Sbellard unsigned char c_line; /* line discipline */ 8403bfd9da1Sbellard unsigned char c_cc[TARGET_NCC]; /* control characters */ 8412521d698Sbellard }; 8422521d698Sbellard 8433bfd9da1Sbellard struct target_winsize { 8443bfd9da1Sbellard unsigned short ws_row; 8453bfd9da1Sbellard unsigned short ws_col; 8463bfd9da1Sbellard unsigned short ws_xpixel; 8473bfd9da1Sbellard unsigned short ws_ypixel; 8483bfd9da1Sbellard }; 8492521d698Sbellard 8503bfd9da1Sbellard #include "termbits.h" 8512521d698Sbellard 8522521d698Sbellard #define TARGET_MAP_SHARED 0x01 /* Share changes */ 8532521d698Sbellard #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ 8542521d698Sbellard #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ 8552521d698Sbellard #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ 856048f6b4dSbellard #if defined(TARGET_MIPS) 857048f6b4dSbellard #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ 858048f6b4dSbellard #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ 859048f6b4dSbellard #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ 860048f6b4dSbellard #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ 861048f6b4dSbellard #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ 862048f6b4dSbellard #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ 863048f6b4dSbellard #else 8642521d698Sbellard #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ 8652521d698Sbellard #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ 8662521d698Sbellard #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ 8672521d698Sbellard #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 868*7ec93196Sj_mayer #if defined(TARGET_PPC) 869*7ec93196Sj_mayer #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ 870*7ec93196Sj_mayer #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ 871*7ec93196Sj_mayer #else 8722521d698Sbellard #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ 8732521d698Sbellard #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ 874048f6b4dSbellard #endif 875*7ec93196Sj_mayer #endif 8762521d698Sbellard 8776db45e65Sths #if defined(TARGET_I386) || defined(TARGET_ARM) 8782521d698Sbellard struct target_stat { 8792521d698Sbellard unsigned short st_dev; 8802521d698Sbellard unsigned short __pad1; 8812521d698Sbellard target_ulong st_ino; 8822521d698Sbellard unsigned short st_mode; 8832521d698Sbellard unsigned short st_nlink; 8842521d698Sbellard unsigned short st_uid; 8852521d698Sbellard unsigned short st_gid; 8862521d698Sbellard unsigned short st_rdev; 8872521d698Sbellard unsigned short __pad2; 8882521d698Sbellard target_ulong st_size; 8892521d698Sbellard target_ulong st_blksize; 8902521d698Sbellard target_ulong st_blocks; 8912521d698Sbellard target_ulong target_st_atime; 8922521d698Sbellard target_ulong __unused1; 8932521d698Sbellard target_ulong target_st_mtime; 8942521d698Sbellard target_ulong __unused2; 8952521d698Sbellard target_ulong target_st_ctime; 8962521d698Sbellard target_ulong __unused3; 8972521d698Sbellard target_ulong __unused4; 8982521d698Sbellard target_ulong __unused5; 8992521d698Sbellard }; 9002521d698Sbellard 9012521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely 9022521d698Sbellard * insane amounts of padding around dev_t's. 9032521d698Sbellard */ 9042521d698Sbellard struct target_stat64 { 9052521d698Sbellard unsigned short st_dev; 9062521d698Sbellard unsigned char __pad0[10]; 9072521d698Sbellard 9082521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 9092521d698Sbellard target_ulong __st_ino; 9102521d698Sbellard 9112521d698Sbellard unsigned int st_mode; 9122521d698Sbellard unsigned int st_nlink; 9132521d698Sbellard 9142521d698Sbellard target_ulong st_uid; 9152521d698Sbellard target_ulong st_gid; 9162521d698Sbellard 9172521d698Sbellard unsigned short st_rdev; 9182521d698Sbellard unsigned char __pad3[10]; 9192521d698Sbellard 9202521d698Sbellard long long st_size; 9212521d698Sbellard target_ulong st_blksize; 9222521d698Sbellard 9232521d698Sbellard target_ulong st_blocks; /* Number 512-byte blocks allocated. */ 9242521d698Sbellard target_ulong __pad4; /* future possible st_blocks high bits */ 9252521d698Sbellard 9262521d698Sbellard target_ulong target_st_atime; 9272521d698Sbellard target_ulong __pad5; 9282521d698Sbellard 9292521d698Sbellard target_ulong target_st_mtime; 9302521d698Sbellard target_ulong __pad6; 9312521d698Sbellard 9322521d698Sbellard target_ulong target_st_ctime; 9332521d698Sbellard target_ulong __pad7; /* will be high 32 bits of ctime someday */ 9342521d698Sbellard 9352521d698Sbellard unsigned long long st_ino; 9362521d698Sbellard } __attribute__((packed)); 9372521d698Sbellard 938ce4defa0Spbrook #ifdef TARGET_ARM 939ce4defa0Spbrook struct target_eabi_stat64 { 940ce4defa0Spbrook unsigned long long st_dev; 941ce4defa0Spbrook unsigned int __pad1; 942707b3ee0Spbrook target_ulong __st_ino; 943ce4defa0Spbrook unsigned int st_mode; 944ce4defa0Spbrook unsigned int st_nlink; 945ce4defa0Spbrook 946707b3ee0Spbrook target_ulong st_uid; 947707b3ee0Spbrook target_ulong st_gid; 948ce4defa0Spbrook 949ce4defa0Spbrook unsigned long long st_rdev; 950ce4defa0Spbrook unsigned int __pad2[2]; 951ce4defa0Spbrook 952ce4defa0Spbrook long long st_size; 953707b3ee0Spbrook target_ulong st_blksize; 954ce4defa0Spbrook unsigned int __pad3; 955ce4defa0Spbrook unsigned long long st_blocks; 956ce4defa0Spbrook 957707b3ee0Spbrook target_ulong target_st_atime; 958707b3ee0Spbrook target_ulong target_st_atime_nsec; 959ce4defa0Spbrook 960707b3ee0Spbrook target_ulong target_st_mtime; 961707b3ee0Spbrook target_ulong target_st_mtime_nsec; 962ce4defa0Spbrook 963707b3ee0Spbrook target_ulong target_st_ctime; 964707b3ee0Spbrook target_ulong target_st_ctime_nsec; 965ce4defa0Spbrook 966ce4defa0Spbrook unsigned long long st_ino; 967ce4defa0Spbrook } __attribute__ ((packed)); 968ce4defa0Spbrook #endif 969ce4defa0Spbrook 9701b8dd648Sblueswir1 #elif defined(TARGET_SPARC64) 9711b8dd648Sblueswir1 struct target_stat { 9721b8dd648Sblueswir1 unsigned int st_dev; 9731b8dd648Sblueswir1 target_ulong st_ino; 9741b8dd648Sblueswir1 unsigned int st_mode; 9751b8dd648Sblueswir1 unsigned int st_nlink; 9761b8dd648Sblueswir1 unsigned int st_uid; 9771b8dd648Sblueswir1 unsigned int st_gid; 9781b8dd648Sblueswir1 unsigned int st_rdev; 9791b8dd648Sblueswir1 target_long st_size; 9801b8dd648Sblueswir1 target_long target_st_atime; 9811b8dd648Sblueswir1 target_long target_st_mtime; 9821b8dd648Sblueswir1 target_long target_st_ctime; 9831b8dd648Sblueswir1 target_long st_blksize; 9841b8dd648Sblueswir1 target_long st_blocks; 9851b8dd648Sblueswir1 target_ulong __unused4[2]; 9861b8dd648Sblueswir1 }; 9871b8dd648Sblueswir1 9881b8dd648Sblueswir1 struct target_stat64 { 9891b8dd648Sblueswir1 unsigned char __pad0[6]; 9901b8dd648Sblueswir1 unsigned short st_dev; 9911b8dd648Sblueswir1 9921b8dd648Sblueswir1 uint64_t st_ino; 9931b8dd648Sblueswir1 uint64_t st_nlink; 9941b8dd648Sblueswir1 9951b8dd648Sblueswir1 unsigned int st_mode; 9961b8dd648Sblueswir1 9971b8dd648Sblueswir1 unsigned int st_uid; 9981b8dd648Sblueswir1 unsigned int st_gid; 9991b8dd648Sblueswir1 10001b8dd648Sblueswir1 unsigned char __pad2[6]; 10011b8dd648Sblueswir1 unsigned short st_rdev; 10021b8dd648Sblueswir1 10031b8dd648Sblueswir1 int64_t st_size; 10041b8dd648Sblueswir1 int64_t st_blksize; 10051b8dd648Sblueswir1 10061b8dd648Sblueswir1 unsigned char __pad4[4]; 10071b8dd648Sblueswir1 unsigned int st_blocks; 10081b8dd648Sblueswir1 10091b8dd648Sblueswir1 target_ulong target_st_atime; 10101b8dd648Sblueswir1 target_ulong __unused1; 10111b8dd648Sblueswir1 10121b8dd648Sblueswir1 target_ulong target_st_mtime; 10131b8dd648Sblueswir1 target_ulong __unused2; 10141b8dd648Sblueswir1 10151b8dd648Sblueswir1 target_ulong target_st_ctime; 10161b8dd648Sblueswir1 target_ulong __unused3; 10171b8dd648Sblueswir1 10181b8dd648Sblueswir1 target_ulong __unused4[3]; 10191b8dd648Sblueswir1 }; 10201b8dd648Sblueswir1 10213bfd9da1Sbellard #elif defined(TARGET_SPARC) 10223bfd9da1Sbellard 10233bfd9da1Sbellard struct target_stat { 10243bfd9da1Sbellard unsigned short st_dev; 10253bfd9da1Sbellard target_ulong st_ino; 10263bfd9da1Sbellard unsigned short st_mode; 10273bfd9da1Sbellard short st_nlink; 10283bfd9da1Sbellard unsigned short st_uid; 10293bfd9da1Sbellard unsigned short st_gid; 10303bfd9da1Sbellard unsigned short st_rdev; 10313bfd9da1Sbellard target_long st_size; 10323bfd9da1Sbellard target_long target_st_atime; 10333bfd9da1Sbellard target_ulong __unused1; 10343bfd9da1Sbellard target_long target_st_mtime; 10353bfd9da1Sbellard target_ulong __unused2; 10363bfd9da1Sbellard target_long target_st_ctime; 10373bfd9da1Sbellard target_ulong __unused3; 10383bfd9da1Sbellard target_long st_blksize; 10393bfd9da1Sbellard target_long st_blocks; 10403bfd9da1Sbellard target_ulong __unused4[2]; 10413bfd9da1Sbellard }; 10423bfd9da1Sbellard 10433bfd9da1Sbellard struct target_stat64 { 10443bfd9da1Sbellard unsigned char __pad0[6]; 10453bfd9da1Sbellard unsigned short st_dev; 10463bfd9da1Sbellard 10473bfd9da1Sbellard uint64_t st_ino; 10483bfd9da1Sbellard 10493bfd9da1Sbellard unsigned int st_mode; 10503bfd9da1Sbellard unsigned int st_nlink; 10513bfd9da1Sbellard 10523bfd9da1Sbellard unsigned int st_uid; 10533bfd9da1Sbellard unsigned int st_gid; 10543bfd9da1Sbellard 10553bfd9da1Sbellard unsigned char __pad2[6]; 10563bfd9da1Sbellard unsigned short st_rdev; 10573bfd9da1Sbellard 10583bfd9da1Sbellard unsigned char __pad3[8]; 10593bfd9da1Sbellard 10603bfd9da1Sbellard int64_t st_size; 10613bfd9da1Sbellard unsigned int st_blksize; 10623bfd9da1Sbellard 10633bfd9da1Sbellard unsigned char __pad4[8]; 10643bfd9da1Sbellard unsigned int st_blocks; 10653bfd9da1Sbellard 10663bfd9da1Sbellard unsigned int target_st_atime; 10673bfd9da1Sbellard unsigned int __unused1; 10683bfd9da1Sbellard 10693bfd9da1Sbellard unsigned int target_st_mtime; 10703bfd9da1Sbellard unsigned int __unused2; 10713bfd9da1Sbellard 10723bfd9da1Sbellard unsigned int target_st_ctime; 10733bfd9da1Sbellard unsigned int __unused3; 10743bfd9da1Sbellard 10753bfd9da1Sbellard unsigned int __unused4; 10763bfd9da1Sbellard unsigned int __unused5; 10773bfd9da1Sbellard }; 10783bfd9da1Sbellard 107967867308Sbellard #elif defined(TARGET_PPC) 108067867308Sbellard 108167867308Sbellard struct target_stat { 108267867308Sbellard unsigned short st_dev; 108367867308Sbellard target_ulong st_ino; 108467867308Sbellard unsigned int st_mode; 108567867308Sbellard unsigned short st_nlink; 108667867308Sbellard unsigned int st_uid; 108767867308Sbellard unsigned int st_gid; 108867867308Sbellard unsigned short st_rdev; 108967867308Sbellard target_ulong st_size; 109067867308Sbellard target_ulong st_blksize; 109167867308Sbellard target_ulong st_blocks; 109267867308Sbellard target_ulong target_st_atime; 109367867308Sbellard target_ulong __unused1; 109467867308Sbellard target_ulong target_st_mtime; 109567867308Sbellard target_ulong __unused2; 109667867308Sbellard target_ulong target_st_ctime; 109767867308Sbellard target_ulong __unused3; 109867867308Sbellard target_ulong __unused4; 109967867308Sbellard target_ulong __unused5; 110067867308Sbellard }; 110167867308Sbellard 110267867308Sbellard struct target_stat64 { 110367867308Sbellard unsigned long long st_dev; 110467867308Sbellard unsigned long long st_ino; 110567867308Sbellard unsigned int st_mode; 110667867308Sbellard unsigned int st_nlink; 110767867308Sbellard unsigned int st_uid; 110867867308Sbellard unsigned int st_gid; 110967867308Sbellard unsigned long long st_rdev; 11103bfd9da1Sbellard long long pad0; 111167867308Sbellard long long st_size; 111267867308Sbellard target_ulong st_blksize; 11133bfd9da1Sbellard target_ulong pad1; 111467867308Sbellard long long st_blocks; /* Number 512-byte blocks allocated. */ 111567867308Sbellard target_ulong target_st_atime; 111667867308Sbellard target_ulong target_st_atime_nsec; 111767867308Sbellard target_ulong target_st_mtime; 111867867308Sbellard target_ulong target_st_mtime_nsec; 111967867308Sbellard target_ulong target_st_ctime; 112067867308Sbellard target_ulong target_st_ctime_nsec; 112167867308Sbellard target_ulong __unused4; 112267867308Sbellard target_ulong __unused5; 112367867308Sbellard }; 112467867308Sbellard 1125e6e5906bSpbrook #elif defined(TARGET_M68K) 1126e6e5906bSpbrook 1127e6e5906bSpbrook struct target_stat { 1128e6e5906bSpbrook unsigned short st_dev; 1129e6e5906bSpbrook unsigned short __pad1; 1130e6e5906bSpbrook target_ulong st_ino; 1131e6e5906bSpbrook unsigned short st_mode; 1132e6e5906bSpbrook unsigned short st_nlink; 1133e6e5906bSpbrook unsigned short st_uid; 1134e6e5906bSpbrook unsigned short st_gid; 1135e6e5906bSpbrook unsigned short st_rdev; 1136e6e5906bSpbrook unsigned short __pad2; 1137e6e5906bSpbrook target_ulong st_size; 1138e6e5906bSpbrook target_ulong st_blksize; 1139e6e5906bSpbrook target_ulong st_blocks; 1140e6e5906bSpbrook target_ulong target_st_atime; 1141e6e5906bSpbrook target_ulong __unused1; 1142e6e5906bSpbrook target_ulong target_st_mtime; 1143e6e5906bSpbrook target_ulong __unused2; 1144e6e5906bSpbrook target_ulong target_st_ctime; 1145e6e5906bSpbrook target_ulong __unused3; 1146e6e5906bSpbrook target_ulong __unused4; 1147e6e5906bSpbrook target_ulong __unused5; 1148e6e5906bSpbrook }; 1149e6e5906bSpbrook 1150e6e5906bSpbrook /* This matches struct stat64 in glibc2.1, hence the absolutely 1151e6e5906bSpbrook * insane amounts of padding around dev_t's. 1152e6e5906bSpbrook */ 1153e6e5906bSpbrook struct target_stat64 { 1154e6e5906bSpbrook unsigned long long st_dev; 1155e6e5906bSpbrook unsigned char __pad1[2]; 1156e6e5906bSpbrook 1157e6e5906bSpbrook #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 1158e6e5906bSpbrook target_ulong __st_ino; 1159e6e5906bSpbrook 1160e6e5906bSpbrook unsigned int st_mode; 1161e6e5906bSpbrook unsigned int st_nlink; 1162e6e5906bSpbrook 1163e6e5906bSpbrook target_ulong st_uid; 1164e6e5906bSpbrook target_ulong st_gid; 1165e6e5906bSpbrook 1166e6e5906bSpbrook unsigned long long st_rdev; 1167e6e5906bSpbrook unsigned char __pad3[2]; 1168e6e5906bSpbrook 1169e6e5906bSpbrook long long st_size; 1170e6e5906bSpbrook target_ulong st_blksize; 1171e6e5906bSpbrook 1172e6e5906bSpbrook target_ulong __pad4; /* future possible st_blocks high bits */ 1173e6e5906bSpbrook target_ulong st_blocks; /* Number 512-byte blocks allocated. */ 1174e6e5906bSpbrook 1175e6e5906bSpbrook target_ulong target_st_atime; 1176e6e5906bSpbrook target_ulong target_st_atime_nsec; 1177e6e5906bSpbrook 1178e6e5906bSpbrook target_ulong target_st_mtime; 1179e6e5906bSpbrook target_ulong target_st_mtime_nsec; 1180e6e5906bSpbrook 1181e6e5906bSpbrook target_ulong target_st_ctime; 1182e6e5906bSpbrook target_ulong target_st_ctime_nsec; 1183e6e5906bSpbrook 1184e6e5906bSpbrook unsigned long long st_ino; 1185e6e5906bSpbrook } __attribute__((packed)); 1186e6e5906bSpbrook 1187048f6b4dSbellard #elif defined(TARGET_MIPS) 1188048f6b4dSbellard 1189048f6b4dSbellard struct target_stat { 1190048f6b4dSbellard unsigned st_dev; 1191048f6b4dSbellard target_long st_pad1[3]; /* Reserved for network id */ 1192048f6b4dSbellard target_ulong st_ino; 1193048f6b4dSbellard unsigned int st_mode; 1194048f6b4dSbellard unsigned int st_nlink; 1195048f6b4dSbellard int st_uid; 1196048f6b4dSbellard int st_gid; 1197048f6b4dSbellard unsigned st_rdev; 1198048f6b4dSbellard target_long st_pad2[2]; 1199048f6b4dSbellard target_long st_size; 1200048f6b4dSbellard target_long st_pad3; 1201048f6b4dSbellard /* 1202048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1203048f6b4dSbellard * but we don't have it under Linux. 1204048f6b4dSbellard */ 1205048f6b4dSbellard target_long target_st_atime; 1206048f6b4dSbellard target_long target_st_atime_nsec; 1207048f6b4dSbellard target_long target_st_mtime; 1208048f6b4dSbellard target_long target_st_mtime_nsec; 1209048f6b4dSbellard target_long target_st_ctime; 1210048f6b4dSbellard target_long target_st_ctime_nsec; 1211048f6b4dSbellard target_long st_blksize; 1212048f6b4dSbellard target_long st_blocks; 1213048f6b4dSbellard target_long st_pad4[14]; 1214048f6b4dSbellard }; 1215048f6b4dSbellard 1216048f6b4dSbellard /* 1217048f6b4dSbellard * This matches struct stat64 in glibc2.1, hence the absolutely insane 1218048f6b4dSbellard * amounts of padding around dev_t's. The memory layout is the same as of 1219048f6b4dSbellard * struct stat of the 64-bit kernel. 1220048f6b4dSbellard */ 1221048f6b4dSbellard 1222048f6b4dSbellard struct target_stat64 { 1223048f6b4dSbellard target_ulong st_dev; 1224048f6b4dSbellard target_ulong st_pad0[3]; /* Reserved for st_dev expansion */ 1225048f6b4dSbellard 1226048f6b4dSbellard uint64_t st_ino; 1227048f6b4dSbellard 1228048f6b4dSbellard unsigned int st_mode; 1229048f6b4dSbellard unsigned int st_nlink; 1230048f6b4dSbellard 1231048f6b4dSbellard int st_uid; 1232048f6b4dSbellard int st_gid; 1233048f6b4dSbellard 1234048f6b4dSbellard target_ulong st_rdev; 1235048f6b4dSbellard target_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ 1236048f6b4dSbellard 1237048f6b4dSbellard int64_t st_size; 1238048f6b4dSbellard 1239048f6b4dSbellard /* 1240048f6b4dSbellard * Actually this should be timestruc_t st_atime, st_mtime and st_ctime 1241048f6b4dSbellard * but we don't have it under Linux. 1242048f6b4dSbellard */ 1243048f6b4dSbellard target_long target_st_atime; 1244048f6b4dSbellard target_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ 1245048f6b4dSbellard 1246048f6b4dSbellard target_long target_st_mtime; 1247048f6b4dSbellard target_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ 1248048f6b4dSbellard 1249048f6b4dSbellard target_long target_st_ctime; 1250048f6b4dSbellard target_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ 1251048f6b4dSbellard 1252048f6b4dSbellard target_ulong st_blksize; 1253048f6b4dSbellard target_ulong st_pad2; 1254048f6b4dSbellard 1255048f6b4dSbellard int64_t st_blocks; 1256048f6b4dSbellard }; 12577a3148a9Sj_mayer 12587a3148a9Sj_mayer #elif defined(TARGET_ALPHA) 12597a3148a9Sj_mayer 12607a3148a9Sj_mayer struct target_stat { 12617a3148a9Sj_mayer unsigned int st_dev; 12627a3148a9Sj_mayer unsigned int st_ino; 12637a3148a9Sj_mayer unsigned int st_mode; 12647a3148a9Sj_mayer unsigned int st_nlink; 12657a3148a9Sj_mayer unsigned int st_uid; 12667a3148a9Sj_mayer unsigned int st_gid; 12677a3148a9Sj_mayer unsigned int st_rdev; 12687a3148a9Sj_mayer target_long st_size; 12697a3148a9Sj_mayer target_ulong target_st_atime; 12707a3148a9Sj_mayer target_ulong target_st_mtime; 12717a3148a9Sj_mayer target_ulong target_st_ctime; 12727a3148a9Sj_mayer unsigned int st_blksize; 12737a3148a9Sj_mayer unsigned int st_blocks; 12747a3148a9Sj_mayer unsigned int st_flags; 12757a3148a9Sj_mayer unsigned int st_gen; 12767a3148a9Sj_mayer }; 12777a3148a9Sj_mayer 12787a3148a9Sj_mayer struct target_stat64 { 12797a3148a9Sj_mayer target_ulong st_dev; 12807a3148a9Sj_mayer target_ulong st_ino; 12817a3148a9Sj_mayer target_ulong st_rdev; 12827a3148a9Sj_mayer target_long st_size; 12837a3148a9Sj_mayer target_ulong st_blocks; 12847a3148a9Sj_mayer 12857a3148a9Sj_mayer unsigned int st_mode; 12867a3148a9Sj_mayer unsigned int st_uid; 12877a3148a9Sj_mayer unsigned int st_gid; 12887a3148a9Sj_mayer unsigned int st_blksize; 12897a3148a9Sj_mayer unsigned int st_nlink; 12907a3148a9Sj_mayer unsigned int __pad0; 12917a3148a9Sj_mayer 12927a3148a9Sj_mayer target_ulong target_st_atime; 12937a3148a9Sj_mayer target_ulong target_st_atime_nsec; 12947a3148a9Sj_mayer target_ulong target_st_mtime; 12957a3148a9Sj_mayer target_ulong target_st_mtime_nsec; 12967a3148a9Sj_mayer target_ulong target_st_ctime; 12977a3148a9Sj_mayer target_ulong target_st_ctime_nsec; 12987a3148a9Sj_mayer target_long __unused[3]; 12997a3148a9Sj_mayer }; 13007a3148a9Sj_mayer 13016db45e65Sths #elif defined(TARGET_SH4) 13026db45e65Sths 13036db45e65Sths struct target_stat { 13046db45e65Sths target_ulong st_dev; 13056db45e65Sths target_ulong st_ino; 13066db45e65Sths unsigned short st_mode; 13076db45e65Sths unsigned short st_nlink; 13086db45e65Sths unsigned short st_uid; 13096db45e65Sths unsigned short st_gid; 13106db45e65Sths target_ulong st_rdev; 13116db45e65Sths target_ulong st_size; 13126db45e65Sths target_ulong st_blksize; 13136db45e65Sths target_ulong st_blocks; 13146db45e65Sths target_ulong target_st_atime; 13156db45e65Sths target_ulong target_st_atime_nsec; 13166db45e65Sths target_ulong target_st_mtime; 13176db45e65Sths target_ulong target_st_mtime_nsec; 13186db45e65Sths target_ulong target_st_ctime; 13196db45e65Sths target_ulong target_st_ctime_nsec; 13206db45e65Sths target_ulong __unused4; 13216db45e65Sths target_ulong __unused5; 13226db45e65Sths }; 13236db45e65Sths 13246db45e65Sths /* This matches struct stat64 in glibc2.1, hence the absolutely 13256db45e65Sths * insane amounts of padding around dev_t's. 13266db45e65Sths */ 13276db45e65Sths struct target_stat64 { 13286db45e65Sths unsigned long long st_dev; 13296db45e65Sths unsigned char __pad0[4]; 13306db45e65Sths 13316db45e65Sths #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 13326db45e65Sths target_ulong __st_ino; 13336db45e65Sths 13346db45e65Sths unsigned int st_mode; 13356db45e65Sths unsigned int st_nlink; 13366db45e65Sths 13376db45e65Sths target_ulong st_uid; 13386db45e65Sths target_ulong st_gid; 13396db45e65Sths 13406db45e65Sths unsigned long long st_rdev; 13416db45e65Sths unsigned char __pad3[4]; 13426db45e65Sths 13436db45e65Sths long long st_size; 13446db45e65Sths target_ulong st_blksize; 13456db45e65Sths 13466db45e65Sths unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ 13476db45e65Sths 13486db45e65Sths target_ulong target_st_atime; 13496db45e65Sths target_ulong target_st_atime_nsec; 13506db45e65Sths 13516db45e65Sths target_ulong target_st_mtime; 13526db45e65Sths target_ulong target_st_mtime_nsec; 13536db45e65Sths 13546db45e65Sths target_ulong target_st_ctime; 13556db45e65Sths target_ulong target_st_ctime_nsec; 13566db45e65Sths 13576db45e65Sths unsigned long long st_ino; 13586db45e65Sths }; 13596db45e65Sths 1360048f6b4dSbellard #else 1361048f6b4dSbellard #error unsupported CPU 1362048f6b4dSbellard #endif 13632521d698Sbellard 13644ce6f8deSths typedef struct { 13654ce6f8deSths int val[2]; 13664ce6f8deSths } target_fsid_t; 13674ce6f8deSths 136856c8f68fSbellard #ifdef TARGET_MIPS 136956c8f68fSbellard struct target_statfs { 137056c8f68fSbellard target_long f_type; 137156c8f68fSbellard target_long f_bsize; 137256c8f68fSbellard target_long f_frsize; /* Fragment size - unsupported */ 137356c8f68fSbellard target_long f_blocks; 137456c8f68fSbellard target_long f_bfree; 137556c8f68fSbellard target_long f_files; 137656c8f68fSbellard target_long f_ffree; 137756c8f68fSbellard target_long f_bavail; 137856c8f68fSbellard 137956c8f68fSbellard /* Linux specials */ 13804ce6f8deSths target_fsid_t f_fsid; 138156c8f68fSbellard target_long f_namelen; 138256c8f68fSbellard target_long f_spare[6]; 138356c8f68fSbellard }; 138456c8f68fSbellard 138556c8f68fSbellard struct target_statfs64 { 138656c8f68fSbellard uint32_t f_type; 138756c8f68fSbellard uint32_t f_bsize; 138856c8f68fSbellard uint32_t f_frsize; /* Fragment size - unsupported */ 138956c8f68fSbellard uint32_t __pad; 139056c8f68fSbellard uint64_t f_blocks; 139156c8f68fSbellard uint64_t f_bfree; 139256c8f68fSbellard uint64_t f_files; 139356c8f68fSbellard uint64_t f_ffree; 139456c8f68fSbellard uint64_t f_bavail; 13954ce6f8deSths target_fsid_t f_fsid; 139656c8f68fSbellard uint32_t f_namelen; 139756c8f68fSbellard uint32_t f_spare[6]; 139856c8f68fSbellard }; 139956c8f68fSbellard #else 140056c8f68fSbellard struct target_statfs { 140156c8f68fSbellard uint32_t f_type; 140256c8f68fSbellard uint32_t f_bsize; 140356c8f68fSbellard uint32_t f_blocks; 140456c8f68fSbellard uint32_t f_bfree; 140556c8f68fSbellard uint32_t f_bavail; 140656c8f68fSbellard uint32_t f_files; 140756c8f68fSbellard uint32_t f_ffree; 14084ce6f8deSths target_fsid_t f_fsid; 140956c8f68fSbellard uint32_t f_namelen; 141056c8f68fSbellard uint32_t f_frsize; 141156c8f68fSbellard uint32_t f_spare[5]; 141256c8f68fSbellard }; 141356c8f68fSbellard 141456c8f68fSbellard struct target_statfs64 { 141556c8f68fSbellard uint32_t f_type; 141656c8f68fSbellard uint32_t f_bsize; 141756c8f68fSbellard uint64_t f_blocks; 141856c8f68fSbellard uint64_t f_bfree; 141956c8f68fSbellard uint64_t f_bavail; 142056c8f68fSbellard uint64_t f_files; 142156c8f68fSbellard uint64_t f_ffree; 14224ce6f8deSths target_fsid_t f_fsid; 142356c8f68fSbellard uint32_t f_namelen; 142456c8f68fSbellard uint32_t f_frsize; 142556c8f68fSbellard uint32_t f_spare[5]; 142656c8f68fSbellard }; 142756c8f68fSbellard #endif 142856c8f68fSbellard 142956c8f68fSbellard 14302521d698Sbellard #define TARGET_F_DUPFD 0 /* dup */ 14312521d698Sbellard #define TARGET_F_GETFD 1 /* get close_on_exec */ 14322521d698Sbellard #define TARGET_F_SETFD 2 /* set/clear close_on_exec */ 14332521d698Sbellard #define TARGET_F_GETFL 3 /* get file->f_flags */ 14342521d698Sbellard #define TARGET_F_SETFL 4 /* set file->f_flags */ 14352521d698Sbellard 14362521d698Sbellard #if defined(TARGET_ALPHA) 14372521d698Sbellard #define TARGET_F_GETLK 7 14382521d698Sbellard #define TARGET_F_SETLK 8 14392521d698Sbellard #define TARGET_F_SETLKW 9 14402521d698Sbellard #define TARGET_F_SETOWN 5 /* for sockets. */ 14412521d698Sbellard #define TARGET_F_GETOWN 6 /* for sockets. */ 14422521d698Sbellard #else 14432521d698Sbellard #define TARGET_F_GETLK 5 14442521d698Sbellard #define TARGET_F_SETLK 6 14452521d698Sbellard #define TARGET_F_SETLKW 7 14462521d698Sbellard #define TARGET_F_SETOWN 8 /* for sockets. */ 14472521d698Sbellard #define TARGET_F_GETOWN 9 /* for sockets. */ 14482521d698Sbellard #endif 14492521d698Sbellard 14502521d698Sbellard #define TARGET_F_SETSIG 10 /* for sockets. */ 14512521d698Sbellard #define TARGET_F_GETSIG 11 /* for sockets. */ 14522521d698Sbellard 14532521d698Sbellard #define TARGET_F_GETLK64 12 /* using 'struct flock64' */ 14542521d698Sbellard #define TARGET_F_SETLK64 13 14552521d698Sbellard #define TARGET_F_SETLKW64 14 14562521d698Sbellard 1457f09936acSbellard #if defined (TARGET_ARM) 1458f09936acSbellard #define TARGET_O_ACCMODE 0003 1459f09936acSbellard #define TARGET_O_RDONLY 00 1460f09936acSbellard #define TARGET_O_WRONLY 01 1461f09936acSbellard #define TARGET_O_RDWR 02 1462f09936acSbellard #define TARGET_O_CREAT 0100 /* not fcntl */ 1463f09936acSbellard #define TARGET_O_EXCL 0200 /* not fcntl */ 1464f09936acSbellard #define TARGET_O_NOCTTY 0400 /* not fcntl */ 1465f09936acSbellard #define TARGET_O_TRUNC 01000 /* not fcntl */ 1466f09936acSbellard #define TARGET_O_APPEND 02000 1467f09936acSbellard #define TARGET_O_NONBLOCK 04000 1468048f6b4dSbellard #define TARGET_O_NDELAY TARGET_O_NONBLOCK 1469f09936acSbellard #define TARGET_O_SYNC 010000 1470f09936acSbellard #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ 1471f09936acSbellard #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 1472f09936acSbellard #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 1473f09936acSbellard #define TARGET_O_DIRECT 0200000 /* direct disk access hint */ 1474f09936acSbellard #define TARGET_O_LARGEFILE 0400000 1475f09936acSbellard #elif defined (TARGET_PPC) 1476ffa65c3bSbellard #define TARGET_O_ACCMODE 0003 1477ffa65c3bSbellard #define TARGET_O_RDONLY 00 1478ffa65c3bSbellard #define TARGET_O_WRONLY 01 1479ffa65c3bSbellard #define TARGET_O_RDWR 02 1480ffa65c3bSbellard #define TARGET_O_CREAT 0100 /* not fcntl */ 1481ffa65c3bSbellard #define TARGET_O_EXCL 0200 /* not fcntl */ 1482ffa65c3bSbellard #define TARGET_O_NOCTTY 0400 /* not fcntl */ 1483ffa65c3bSbellard #define TARGET_O_TRUNC 01000 /* not fcntl */ 1484ffa65c3bSbellard #define TARGET_O_APPEND 02000 1485ffa65c3bSbellard #define TARGET_O_NONBLOCK 04000 1486048f6b4dSbellard #define TARGET_O_NDELAY TARGET_O_NONBLOCK 1487ffa65c3bSbellard #define TARGET_O_SYNC 010000 1488ffa65c3bSbellard #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ 1489ffa65c3bSbellard #define TARGET_O_DIRECTORY 040000 /* must be a directory */ 1490ffa65c3bSbellard #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ 1491ffa65c3bSbellard #define TARGET_O_LARGEFILE 0200000 1492ffa65c3bSbellard #define TARGET_O_DIRECT 0400000 /* direct disk access hint */ 14936d5e216dSbellard #elif defined (TARGET_SPARC) 14946d5e216dSbellard #define TARGET_O_RDONLY 0x0000 14956d5e216dSbellard #define TARGET_O_WRONLY 0x0001 14966d5e216dSbellard #define TARGET_O_RDWR 0x0002 14976d5e216dSbellard #define TARGET_O_ACCMODE 0x0003 14986d5e216dSbellard #define TARGET_O_APPEND 0x0008 14996d5e216dSbellard #define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */ 15006d5e216dSbellard #define TARGET_O_CREAT 0x0200 /* not fcntl */ 15016d5e216dSbellard #define TARGET_O_TRUNC 0x0400 /* not fcntl */ 15026d5e216dSbellard #define TARGET_O_EXCL 0x0800 /* not fcntl */ 15036d5e216dSbellard #define TARGET_O_SYNC 0x2000 15046d5e216dSbellard #define TARGET_O_NONBLOCK 0x4000 1505048f6b4dSbellard #define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK) 15066d5e216dSbellard #define TARGET_O_NOCTTY 0x8000 /* not fcntl */ 15076d5e216dSbellard #define TARGET_O_DIRECTORY 0x10000 /* must be a directory */ 15086d5e216dSbellard #define TARGET_O_NOFOLLOW 0x20000 /* don't follow links */ 15096d5e216dSbellard #define TARGET_O_LARGEFILE 0x40000 15106d5e216dSbellard #define TARGET_O_DIRECT 0x100000 /* direct disk access hint */ 1511048f6b4dSbellard #elif defined(TARGET_MIPS) 1512048f6b4dSbellard #define TARGET_O_ACCMODE 0x0003 1513048f6b4dSbellard #define TARGET_O_RDONLY 0x0000 1514048f6b4dSbellard #define TARGET_O_WRONLY 0x0001 1515048f6b4dSbellard #define TARGET_O_RDWR 0x0002 1516048f6b4dSbellard #define TARGET_O_APPEND 0x0008 1517048f6b4dSbellard #define TARGET_O_SYNC 0x0010 1518048f6b4dSbellard #define TARGET_O_NONBLOCK 0x0080 1519048f6b4dSbellard #define TARGET_O_CREAT 0x0100 /* not fcntl */ 1520048f6b4dSbellard #define TARGET_O_TRUNC 0x0200 /* not fcntl */ 1521048f6b4dSbellard #define TARGET_O_EXCL 0x0400 /* not fcntl */ 1522048f6b4dSbellard #define TARGET_O_NOCTTY 0x0800 /* not fcntl */ 1523048f6b4dSbellard #define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */ 1524048f6b4dSbellard #define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */ 1525048f6b4dSbellard #define TARGET_O_DIRECT 0x8000 /* direct disk access hint */ 1526048f6b4dSbellard #define TARGET_O_DIRECTORY 0x10000 /* must be a directory */ 1527048f6b4dSbellard #define TARGET_O_NOFOLLOW 0x20000 /* don't follow links */ 1528048f6b4dSbellard #define TARGET_O_NOATIME 0x40000 1529048f6b4dSbellard #define TARGET_O_NDELAY TARGET_O_NONBLOCK 1530ffa65c3bSbellard #else 1531ffa65c3bSbellard #define TARGET_O_ACCMODE 0003 1532ffa65c3bSbellard #define TARGET_O_RDONLY 00 1533ffa65c3bSbellard #define TARGET_O_WRONLY 01 1534ffa65c3bSbellard #define TARGET_O_RDWR 02 1535ffa65c3bSbellard #define TARGET_O_CREAT 0100 /* not fcntl */ 1536ffa65c3bSbellard #define TARGET_O_EXCL 0200 /* not fcntl */ 1537ffa65c3bSbellard #define TARGET_O_NOCTTY 0400 /* not fcntl */ 1538ffa65c3bSbellard #define TARGET_O_TRUNC 01000 /* not fcntl */ 1539ffa65c3bSbellard #define TARGET_O_APPEND 02000 1540ffa65c3bSbellard #define TARGET_O_NONBLOCK 04000 1541048f6b4dSbellard #define TARGET_O_NDELAY TARGET_O_NONBLOCK 1542ffa65c3bSbellard #define TARGET_O_SYNC 010000 1543ffa65c3bSbellard #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ 1544ffa65c3bSbellard #define TARGET_O_DIRECT 040000 /* direct disk access hint */ 1545ffa65c3bSbellard #define TARGET_O_LARGEFILE 0100000 1546ffa65c3bSbellard #define TARGET_O_DIRECTORY 0200000 /* must be a directory */ 1547ffa65c3bSbellard #define TARGET_O_NOFOLLOW 0400000 /* don't follow links */ 1548ffa65c3bSbellard #endif 1549ffa65c3bSbellard 15502521d698Sbellard struct target_flock { 15512521d698Sbellard short l_type; 15522521d698Sbellard short l_whence; 15532521d698Sbellard target_ulong l_start; 15542521d698Sbellard target_ulong l_len; 15552521d698Sbellard int l_pid; 15562521d698Sbellard }; 15572521d698Sbellard 15582521d698Sbellard struct target_flock64 { 15592521d698Sbellard short l_type; 15602521d698Sbellard short l_whence; 15612521d698Sbellard unsigned long long l_start; 15622521d698Sbellard unsigned long long l_len; 15632521d698Sbellard int l_pid; 1564ce4defa0Spbrook }__attribute__((packed)); 15652521d698Sbellard 1566ce4defa0Spbrook #ifdef TARGET_ARM 1567ce4defa0Spbrook struct target_eabi_flock64 { 1568ce4defa0Spbrook short l_type; 1569ce4defa0Spbrook short l_whence; 1570ce4defa0Spbrook int __pad; 1571ce4defa0Spbrook unsigned long long l_start; 1572ce4defa0Spbrook unsigned long long l_len; 1573ce4defa0Spbrook int l_pid; 1574ce4defa0Spbrook }__attribute__((packed)); 1575ce4defa0Spbrook #endif 15762521d698Sbellard 15772521d698Sbellard /* soundcard defines */ 15782521d698Sbellard /* XXX: convert them all to arch indepedent entries */ 15792521d698Sbellard #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); 15802521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 15812521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 15822521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 15832521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA 0xc0144302 15842521d698Sbellard #define TARGET_SNDCTL_COPR_RESET 0x00004300 15852521d698Sbellard #define TARGET_SNDCTL_COPR_RUN 0xc0144306 15862521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 15872521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE 0x40144305 15882521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA 0x40144304 15892521d698Sbellard #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) 15902521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) 15912521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) 15922521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) 15932521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) 15942521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) 15952521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) 15962521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) 15972521d698Sbellard #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) 15982521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) 15992521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) 16002521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) 16012521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) 16022521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) 16032521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) 16042521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) 16052521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) 16062521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) 16072521d698Sbellard #define TARGET_SNDCTL_DSP_MAPINBUF 0x80085013 16082521d698Sbellard #define TARGET_SNDCTL_DSP_MAPOUTBUF 0x80085014 16092521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e 16102521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 16112521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 16122521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 16132521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 16142521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f 16152521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 16162521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO 0xc074510c 16172521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 16182521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 16192521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 16202521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 16212521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 16222521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 16232521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 16242521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 16252521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b 16262521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a 16272521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 16282521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC 0x00005111 16292521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 16302521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET 0x00005100 16312521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 16322521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC 0x00005101 16332521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 16342521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d 16352521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d 16362521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 16372521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e 16382521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 16392521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME 0x40045407 16402521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT 0x40045408 16412521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 16422521d698Sbellard #define TARGET_SNDCTL_TMR_START 0x00005402 16432521d698Sbellard #define TARGET_SNDCTL_TMR_STOP 0x00005403 16442521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 16452521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 16462521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE 0x80045002 16472521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 16482521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS 0x80045005 16492521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 16502521d698Sbellard #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) 16512521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 16522521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) 16532521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) 16542521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) 16552521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) 16562521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) 16572521d698Sbellard 16582521d698Sbellard #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) 16592521d698Sbellard 16602521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) 16612521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) 16622521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) 16632521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) 16642521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) 16652521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) 16662521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) 16672521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) 16682521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) 16692521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) 16702521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) 16712521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) 16722521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) 16732521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) 16742521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) 16752521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) 16762521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) 16772521d698Sbellard 16782521d698Sbellard /* Obsolete macros */ 16792521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) 16802521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) 16812521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) 16822521d698Sbellard 16832521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) 16842521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) 16852521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) 16862521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) 16872521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) 16882521d698Sbellard 16892521d698Sbellard #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) 16902521d698Sbellard 16912521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) 16922521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) 16932521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) 16942521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) 16952521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) 16962521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) 16972521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) 16982521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) 16992521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) 17002521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) 17012521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) 17022521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) 17032521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) 17042521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) 17052521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) 17062521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) 17072521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) 17082521d698Sbellard 17092521d698Sbellard /* Obsolete macros */ 17102521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) 17112521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) 17122521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) 17132521d698Sbellard 17142521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) 17152521d698Sbellard 17162521d698Sbellard /* vfat ioctls */ 17172521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) 17182521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) 1719a5448a7dSbellard 1720a5448a7dSbellard struct target_sysinfo { 1721a5448a7dSbellard target_long uptime; /* Seconds since boot */ 1722a5448a7dSbellard target_ulong loads[3]; /* 1, 5, and 15 minute load averages */ 1723a5448a7dSbellard target_ulong totalram; /* Total usable main memory size */ 1724a5448a7dSbellard target_ulong freeram; /* Available memory size */ 1725a5448a7dSbellard target_ulong sharedram; /* Amount of shared memory */ 1726a5448a7dSbellard target_ulong bufferram; /* Memory used by buffers */ 1727a5448a7dSbellard target_ulong totalswap; /* Total swap space size */ 1728a5448a7dSbellard target_ulong freeswap; /* swap space still available */ 1729a5448a7dSbellard unsigned short procs; /* Number of current processes */ 1730a5448a7dSbellard unsigned short pad; /* explicit padding for m68k */ 1731a5448a7dSbellard target_ulong totalhigh; /* Total high memory size */ 1732a5448a7dSbellard target_ulong freehigh; /* Available high memory size */ 1733a5448a7dSbellard unsigned int mem_unit; /* Memory unit size in bytes */ 1734a5448a7dSbellard char _f[20-2*sizeof(target_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 1735a5448a7dSbellard }; 17363532fa74Sbellard 17373532fa74Sbellard #include "socket.h" 1738637947f1Sths 1739637947f1Sths #include "errno_defs.h" 1740