bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1 | /* common syscall defines for all architectures */ |
| 2 | |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 3 | /* Note: although the syscall numbers change between architectures, |
Dong Xu Wang | b4916d7 | 2011-11-22 18:06:17 +0800 | [diff] [blame] | 4 | most of them stay the same, so we handle it by putting ifdefs if |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 5 | necessary */ |
| 6 | |
bellard | 6180a18 | 2003-09-30 21:04:53 +0000 | [diff] [blame] | 7 | #include "syscall_nr.h" |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 8 | |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 9 | #define SOCKOP_socket 1 |
| 10 | #define SOCKOP_bind 2 |
| 11 | #define SOCKOP_connect 3 |
| 12 | #define SOCKOP_listen 4 |
| 13 | #define SOCKOP_accept 5 |
| 14 | #define SOCKOP_getsockname 6 |
| 15 | #define SOCKOP_getpeername 7 |
| 16 | #define SOCKOP_socketpair 8 |
| 17 | #define SOCKOP_send 9 |
| 18 | #define SOCKOP_recv 10 |
| 19 | #define SOCKOP_sendto 11 |
| 20 | #define SOCKOP_recvfrom 12 |
| 21 | #define SOCKOP_shutdown 13 |
| 22 | #define SOCKOP_setsockopt 14 |
| 23 | #define SOCKOP_getsockopt 15 |
| 24 | #define SOCKOP_sendmsg 16 |
| 25 | #define SOCKOP_recvmsg 17 |
| 26 | |
bellard | 8853f86 | 2004-02-22 14:57:26 +0000 | [diff] [blame] | 27 | #define IPCOP_semop 1 |
| 28 | #define IPCOP_semget 2 |
| 29 | #define IPCOP_semctl 3 |
| 30 | #define IPCOP_semtimedop 4 |
| 31 | #define IPCOP_msgsnd 11 |
| 32 | #define IPCOP_msgrcv 12 |
| 33 | #define IPCOP_msgget 13 |
| 34 | #define IPCOP_msgctl 14 |
| 35 | #define IPCOP_shmat 21 |
| 36 | #define IPCOP_shmdt 22 |
| 37 | #define IPCOP_shmget 23 |
| 38 | #define IPCOP_shmctl 24 |
| 39 | |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 40 | /* |
| 41 | * The following is for compatibility across the various Linux |
| 42 | * platforms. The i386 ioctl numbering scheme doesn't really enforce |
| 43 | * a type field. De facto, however, the top 8 bits of the lower 16 |
| 44 | * bits are indeed used as a type field, so we might just as well make |
| 45 | * this explicit here. Please be sure to use the decoding macros |
| 46 | * below from now on. |
| 47 | */ |
| 48 | #define TARGET_IOC_NRBITS 8 |
| 49 | #define TARGET_IOC_TYPEBITS 8 |
| 50 | |
Mika Westerberg | 74d753a | 2009-04-07 16:57:29 +0300 | [diff] [blame] | 51 | #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \ |
Riku Voipio | 0c866a7 | 2011-04-18 15:23:06 +0300 | [diff] [blame] | 52 | || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) |
Mika Westerberg | 74d753a | 2009-04-07 16:57:29 +0300 | [diff] [blame] | 53 | /* 16 bit uid wrappers emulation */ |
| 54 | #define USE_UID16 |
Riku Voipio | 0c866a7 | 2011-04-18 15:23:06 +0300 | [diff] [blame] | 55 | #define target_id uint16_t |
| 56 | #else |
| 57 | #define target_id uint32_t |
Mika Westerberg | 74d753a | 2009-04-07 16:57:29 +0300 | [diff] [blame] | 58 | #endif |
| 59 | |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 60 | #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ |
Ulrich Hecht | a4c075f | 2009-07-24 16:57:31 +0200 | [diff] [blame] | 61 | || defined(TARGET_M68K) || defined(TARGET_CRIS) || defined(TARGET_UNICORE32) \ |
Jia Liu | d962783 | 2012-07-20 15:50:52 +0800 | [diff] [blame] | 62 | || defined(TARGET_S390X) || defined(TARGET_OPENRISC) |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 63 | |
| 64 | #define TARGET_IOC_SIZEBITS 14 |
| 65 | #define TARGET_IOC_DIRBITS 2 |
| 66 | |
| 67 | #define TARGET_IOC_NONE 0U |
| 68 | #define TARGET_IOC_WRITE 1U |
| 69 | #define TARGET_IOC_READ 2U |
| 70 | |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 71 | #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ |
Edgar E. Iglesias | b779e29 | 2009-05-20 21:31:33 +0200 | [diff] [blame] | 72 | defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \ |
| 73 | defined(TARGET_MIPS) |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 74 | |
| 75 | #define TARGET_IOC_SIZEBITS 13 |
| 76 | #define TARGET_IOC_DIRBITS 3 |
| 77 | |
| 78 | #define TARGET_IOC_NONE 1U |
| 79 | #define TARGET_IOC_READ 2U |
| 80 | #define TARGET_IOC_WRITE 4U |
| 81 | |
| 82 | #else |
| 83 | #error unsupported CPU |
| 84 | #endif |
| 85 | |
| 86 | #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) |
| 87 | #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) |
| 88 | #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) |
| 89 | #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) |
| 90 | |
| 91 | #define TARGET_IOC_NRSHIFT 0 |
| 92 | #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) |
| 93 | #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) |
| 94 | #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) |
| 95 | |
| 96 | #define TARGET_IOC(dir,type,nr,size) \ |
| 97 | (((dir) << TARGET_IOC_DIRSHIFT) | \ |
| 98 | ((type) << TARGET_IOC_TYPESHIFT) | \ |
| 99 | ((nr) << TARGET_IOC_NRSHIFT) | \ |
| 100 | ((size) << TARGET_IOC_SIZESHIFT)) |
| 101 | |
| 102 | /* used to create numbers */ |
| 103 | #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) |
| 104 | #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) |
| 105 | #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) |
| 106 | #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) |
| 107 | |
| 108 | /* the size is automatically computed for these defines */ |
| 109 | #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK) |
| 110 | #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) |
| 111 | #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK) |
| 112 | |
bellard | 7854b05 | 2003-03-29 17:22:23 +0000 | [diff] [blame] | 113 | struct target_sockaddr { |
| 114 | uint16_t sa_family; |
| 115 | uint8_t sa_data[14]; |
| 116 | }; |
| 117 | |
Lionel Landwerlin | b975b83 | 2009-04-25 23:30:19 +0200 | [diff] [blame] | 118 | struct target_in_addr { |
| 119 | uint32_t s_addr; /* big endian */ |
| 120 | }; |
| 121 | |
| 122 | struct target_ip_mreq { |
| 123 | struct target_in_addr imr_multiaddr; |
| 124 | struct target_in_addr imr_address; |
| 125 | }; |
| 126 | |
| 127 | struct target_ip_mreqn { |
| 128 | struct target_in_addr imr_multiaddr; |
| 129 | struct target_in_addr imr_address; |
| 130 | abi_long imr_ifindex; |
| 131 | }; |
| 132 | |
Lionel Landwerlin | 6e3cb58 | 2009-04-25 23:31:18 +0200 | [diff] [blame] | 133 | struct target_ip_mreq_source { |
| 134 | /* big endian */ |
| 135 | uint32_t imr_multiaddr; |
| 136 | uint32_t imr_interface; |
| 137 | uint32_t imr_sourceaddr; |
| 138 | }; |
| 139 | |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 140 | struct target_timeval { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 141 | abi_long tv_sec; |
| 142 | abi_long tv_usec; |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 143 | }; |
| 144 | |
bellard | 1b6b029 | 2003-03-22 17:31:38 +0000 | [diff] [blame] | 145 | struct target_timespec { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 146 | abi_long tv_sec; |
| 147 | abi_long tv_nsec; |
bellard | 1b6b029 | 2003-03-22 17:31:38 +0000 | [diff] [blame] | 148 | }; |
| 149 | |
bellard | 66fb976 | 2003-03-23 01:06:05 +0000 | [diff] [blame] | 150 | struct target_itimerval { |
| 151 | struct target_timeval it_interval; |
| 152 | struct target_timeval it_value; |
| 153 | }; |
| 154 | |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 155 | typedef abi_long target_clock_t; |
bellard | 32f36bc | 2003-03-30 21:29:48 +0000 | [diff] [blame] | 156 | |
bellard | c596ed1 | 2003-07-13 17:32:31 +0000 | [diff] [blame] | 157 | #define TARGET_HZ 100 |
| 158 | |
bellard | 32f36bc | 2003-03-30 21:29:48 +0000 | [diff] [blame] | 159 | struct target_tms { |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 160 | target_clock_t tms_utime; |
| 161 | target_clock_t tms_stime; |
| 162 | target_clock_t tms_cutime; |
| 163 | target_clock_t tms_cstime; |
bellard | 32f36bc | 2003-03-30 21:29:48 +0000 | [diff] [blame] | 164 | }; |
| 165 | |
bellard | 6180a18 | 2003-09-30 21:04:53 +0000 | [diff] [blame] | 166 | struct target_utimbuf { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 167 | abi_long actime; |
| 168 | abi_long modtime; |
bellard | 6180a18 | 2003-09-30 21:04:53 +0000 | [diff] [blame] | 169 | }; |
| 170 | |
bellard | f2674e3 | 2003-07-09 12:26:09 +0000 | [diff] [blame] | 171 | struct target_sel_arg_struct { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 172 | abi_long n; |
| 173 | abi_long inp, outp, exp; |
| 174 | abi_long tvp; |
bellard | f2674e3 | 2003-07-09 12:26:09 +0000 | [diff] [blame] | 175 | }; |
| 176 | |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 177 | struct target_iovec { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 178 | abi_long iov_base; /* Starting address */ |
| 179 | abi_long iov_len; /* Number of bytes */ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 180 | }; |
| 181 | |
bellard | 1a9353d | 2003-03-16 20:28:50 +0000 | [diff] [blame] | 182 | struct target_msghdr { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 183 | abi_long msg_name; /* Socket name */ |
| 184 | int msg_namelen; /* Length of name */ |
| 185 | abi_long msg_iov; /* Data blocks */ |
| 186 | abi_long msg_iovlen; /* Number of blocks */ |
| 187 | abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ |
| 188 | abi_long msg_controllen; /* Length of cmsg list */ |
bellard | 1a9353d | 2003-03-16 20:28:50 +0000 | [diff] [blame] | 189 | unsigned int msg_flags; |
| 190 | }; |
| 191 | |
bellard | 7854b05 | 2003-03-29 17:22:23 +0000 | [diff] [blame] | 192 | struct target_cmsghdr { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 193 | abi_long cmsg_len; |
bellard | 7854b05 | 2003-03-29 17:22:23 +0000 | [diff] [blame] | 194 | int cmsg_level; |
| 195 | int cmsg_type; |
| 196 | }; |
| 197 | |
| 198 | #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) |
| 199 | #define TARGET_CMSG_NXTHDR(mhdr, cmsg) __target_cmsg_nxthdr (mhdr, cmsg) |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 200 | #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ |
| 201 | & (size_t) ~(sizeof (abi_long) - 1)) |
bellard | 7854b05 | 2003-03-29 17:22:23 +0000 | [diff] [blame] | 202 | #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \ |
| 203 | + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr))) |
| 204 | #define TARGET_CMSG_LEN(len) (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len)) |
| 205 | |
| 206 | static __inline__ struct target_cmsghdr * |
| 207 | __target_cmsg_nxthdr (struct target_msghdr *__mhdr, struct target_cmsghdr *__cmsg) |
| 208 | { |
ths | 2b8bdef | 2007-05-28 21:35:23 +0000 | [diff] [blame] | 209 | struct target_cmsghdr *__ptr; |
bellard | 7854b05 | 2003-03-29 17:22:23 +0000 | [diff] [blame] | 210 | |
ths | 2b8bdef | 2007-05-28 21:35:23 +0000 | [diff] [blame] | 211 | __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg |
Matthias Braun | cbb21ee | 2011-08-12 19:57:41 +0200 | [diff] [blame] | 212 | + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len))); |
| 213 | if ((unsigned long)((char *)(__ptr+1) - (char *)(size_t)tswapal(__mhdr->msg_control)) |
| 214 | > tswapal(__mhdr->msg_controllen)) |
bellard | 7854b05 | 2003-03-29 17:22:23 +0000 | [diff] [blame] | 215 | /* No more entries. */ |
ths | 2b8bdef | 2007-05-28 21:35:23 +0000 | [diff] [blame] | 216 | return (struct target_cmsghdr *)0; |
bellard | 7854b05 | 2003-03-29 17:22:23 +0000 | [diff] [blame] | 217 | return __cmsg; |
| 218 | } |
| 219 | |
| 220 | |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 221 | struct target_rusage { |
| 222 | struct target_timeval ru_utime; /* user time used */ |
| 223 | struct target_timeval ru_stime; /* system time used */ |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 224 | abi_long ru_maxrss; /* maximum resident set size */ |
| 225 | abi_long ru_ixrss; /* integral shared memory size */ |
| 226 | abi_long ru_idrss; /* integral unshared data size */ |
| 227 | abi_long ru_isrss; /* integral unshared stack size */ |
| 228 | abi_long ru_minflt; /* page reclaims */ |
| 229 | abi_long ru_majflt; /* page faults */ |
| 230 | abi_long ru_nswap; /* swaps */ |
| 231 | abi_long ru_inblock; /* block input operations */ |
| 232 | abi_long ru_oublock; /* block output operations */ |
| 233 | abi_long ru_msgsnd; /* messages sent */ |
| 234 | abi_long ru_msgrcv; /* messages received */ |
| 235 | abi_long ru_nsignals; /* signals received */ |
| 236 | abi_long ru_nvcsw; /* voluntary context switches */ |
| 237 | abi_long ru_nivcsw; /* involuntary " */ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 238 | }; |
| 239 | |
| 240 | typedef struct { |
| 241 | int val[2]; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 242 | } kernel_fsid_t; |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 243 | |
bellard | 72f0390 | 2003-02-18 23:33:18 +0000 | [diff] [blame] | 244 | struct kernel_statfs { |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 245 | int f_type; |
| 246 | int f_bsize; |
| 247 | int f_blocks; |
| 248 | int f_bfree; |
| 249 | int f_bavail; |
| 250 | int f_files; |
| 251 | int f_ffree; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 252 | kernel_fsid_t f_fsid; |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 253 | int f_namelen; |
| 254 | int f_spare[6]; |
| 255 | }; |
| 256 | |
bellard | dab2ed9 | 2003-03-22 15:23:14 +0000 | [diff] [blame] | 257 | struct target_dirent { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 258 | abi_long d_ino; |
| 259 | abi_long d_off; |
bellard | dab2ed9 | 2003-03-22 15:23:14 +0000 | [diff] [blame] | 260 | unsigned short d_reclen; |
| 261 | char d_name[256]; /* We must not include limits.h! */ |
| 262 | }; |
| 263 | |
| 264 | struct target_dirent64 { |
| 265 | uint64_t d_ino; |
| 266 | int64_t d_off; |
| 267 | unsigned short d_reclen; |
| 268 | unsigned char d_type; |
| 269 | char d_name[256]; |
| 270 | }; |
| 271 | |
| 272 | |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 273 | /* mostly generic signal stuff */ |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 274 | #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ |
| 275 | #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ |
| 276 | #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 277 | |
| 278 | #ifdef TARGET_MIPS |
| 279 | #define TARGET_NSIG 128 |
| 280 | #else |
| 281 | #define TARGET_NSIG 64 |
| 282 | #endif |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 283 | #define TARGET_NSIG_BPW TARGET_ABI_BITS |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 284 | #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) |
| 285 | |
| 286 | typedef struct { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 287 | abi_ulong sig[TARGET_NSIG_WORDS]; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 288 | } target_sigset_t; |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 289 | |
bellard | 66fb976 | 2003-03-23 01:06:05 +0000 | [diff] [blame] | 290 | #ifdef BSWAP_NEEDED |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 291 | static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) |
bellard | 66fb976 | 2003-03-23 01:06:05 +0000 | [diff] [blame] | 292 | { |
| 293 | int i; |
| 294 | for(i = 0;i < TARGET_NSIG_WORDS; i++) |
Matthias Braun | cbb21ee | 2011-08-12 19:57:41 +0200 | [diff] [blame] | 295 | d->sig[i] = tswapal(s->sig[i]); |
bellard | 66fb976 | 2003-03-23 01:06:05 +0000 | [diff] [blame] | 296 | } |
| 297 | #else |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 298 | static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) |
bellard | 66fb976 | 2003-03-23 01:06:05 +0000 | [diff] [blame] | 299 | { |
| 300 | *d = *s; |
| 301 | } |
| 302 | #endif |
| 303 | |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 304 | static inline void target_siginitset(target_sigset_t *d, abi_ulong set) |
bellard | 66fb976 | 2003-03-23 01:06:05 +0000 | [diff] [blame] | 305 | { |
| 306 | int i; |
| 307 | d->sig[0] = set; |
| 308 | for(i = 1;i < TARGET_NSIG_WORDS; i++) |
| 309 | d->sig[i] = 0; |
| 310 | } |
| 311 | |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 312 | void host_to_target_sigset(target_sigset_t *d, const sigset_t *s); |
| 313 | void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 314 | void host_to_target_old_sigset(abi_ulong *old_sigset, |
bellard | 66fb976 | 2003-03-23 01:06:05 +0000 | [diff] [blame] | 315 | const sigset_t *sigset); |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 316 | void target_to_host_old_sigset(sigset_t *sigset, |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 317 | const abi_ulong *old_sigset); |
bellard | 66fb976 | 2003-03-23 01:06:05 +0000 | [diff] [blame] | 318 | struct target_sigaction; |
| 319 | int do_sigaction(int sig, const struct target_sigaction *act, |
| 320 | struct target_sigaction *oact); |
| 321 | |
Guan Xuetao | d2fbca9 | 2011-04-12 16:27:03 +0800 | [diff] [blame] | 322 | #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \ |
| 323 | || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined(TARGET_SH4) \ |
| 324 | || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) \ |
Ulrich Hecht | a4c075f | 2009-07-24 16:57:31 +0200 | [diff] [blame] | 325 | || defined(TARGET_MICROBLAZE) || defined(TARGET_UNICORE32) \ |
Jia Liu | d962783 | 2012-07-20 15:50:52 +0800 | [diff] [blame] | 326 | || defined(TARGET_S390X) || defined(TARGET_OPENRISC) |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 327 | |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 328 | #if defined(TARGET_SPARC) |
| 329 | #define TARGET_SA_NOCLDSTOP 8u |
| 330 | #define TARGET_SA_NOCLDWAIT 0x100u |
| 331 | #define TARGET_SA_SIGINFO 0x200u |
| 332 | #define TARGET_SA_ONSTACK 1u |
| 333 | #define TARGET_SA_RESTART 2u |
| 334 | #define TARGET_SA_NODEFER 0x20u |
| 335 | #define TARGET_SA_RESETHAND 4u |
| 336 | #elif defined(TARGET_MIPS) |
| 337 | #define TARGET_SA_NOCLDSTOP 0x00000001 |
| 338 | #define TARGET_SA_NOCLDWAIT 0x00010000 |
| 339 | #define TARGET_SA_SIGINFO 0x00000008 |
| 340 | #define TARGET_SA_ONSTACK 0x08000000 |
| 341 | #define TARGET_SA_NODEFER 0x40000000 |
| 342 | #define TARGET_SA_RESTART 0x10000000 |
| 343 | #define TARGET_SA_RESETHAND 0x80000000 |
ths | d26bc21 | 2007-11-08 18:05:37 +0000 | [diff] [blame] | 344 | #if !defined(TARGET_ABI_MIPSN32) && !defined(TARGET_ABI_MIPSN64) |
| 345 | #define TARGET_SA_RESTORER 0x04000000 /* Only for O32 */ |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 346 | #endif |
Jia Liu | d962783 | 2012-07-20 15:50:52 +0800 | [diff] [blame] | 347 | #elif defined(TARGET_OPENRISC) |
| 348 | #define TARGET_SA_NOCLDSTOP 0x00000001 |
| 349 | #define TARGET_SA_NOCLDWAIT 0x00000002 |
| 350 | #define TARGET_SA_SIGINFO 0x00000004 |
| 351 | #define TARGET_SA_ONSTACK 0x08000000 |
| 352 | #define TARGET_SA_RESTART 0x10000000 |
| 353 | #define TARGET_SA_NODEFER 0x40000000 |
| 354 | #define TARGET_SA_RESETHAND 0x80000000 |
Richard Henderson | 57f18a9 | 2010-05-03 10:07:51 -0700 | [diff] [blame] | 355 | #elif defined(TARGET_ALPHA) |
| 356 | #define TARGET_SA_ONSTACK 0x00000001 |
| 357 | #define TARGET_SA_RESTART 0x00000002 |
| 358 | #define TARGET_SA_NOCLDSTOP 0x00000004 |
| 359 | #define TARGET_SA_NODEFER 0x00000008 |
| 360 | #define TARGET_SA_RESETHAND 0x00000010 |
| 361 | #define TARGET_SA_NOCLDWAIT 0x00000020 /* not supported yet */ |
| 362 | #define TARGET_SA_SIGINFO 0x00000040 |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 363 | #else |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 364 | #define TARGET_SA_NOCLDSTOP 0x00000001 |
| 365 | #define TARGET_SA_NOCLDWAIT 0x00000002 /* not supported yet */ |
| 366 | #define TARGET_SA_SIGINFO 0x00000004 |
| 367 | #define TARGET_SA_ONSTACK 0x08000000 |
| 368 | #define TARGET_SA_RESTART 0x10000000 |
| 369 | #define TARGET_SA_NODEFER 0x40000000 |
| 370 | #define TARGET_SA_RESETHAND 0x80000000 |
| 371 | #define TARGET_SA_RESTORER 0x04000000 |
bellard | 6d5e216 | 2004-09-30 22:04:13 +0000 | [diff] [blame] | 372 | #endif |
| 373 | |
Richard Henderson | d0f2049 | 2012-05-31 12:05:23 -0700 | [diff] [blame] | 374 | #if defined(TARGET_ALPHA) |
| 375 | |
| 376 | #define TARGET_SIGHUP 1 |
| 377 | #define TARGET_SIGINT 2 |
| 378 | #define TARGET_SIGQUIT 3 |
| 379 | #define TARGET_SIGILL 4 |
| 380 | #define TARGET_SIGTRAP 5 |
| 381 | #define TARGET_SIGABRT 6 |
| 382 | #define TARGET_SIGSTKFLT 7 /* actually SIGEMT */ |
| 383 | #define TARGET_SIGFPE 8 |
| 384 | #define TARGET_SIGKILL 9 |
| 385 | #define TARGET_SIGBUS 10 |
| 386 | #define TARGET_SIGSEGV 11 |
| 387 | #define TARGET_SIGSYS 12 |
| 388 | #define TARGET_SIGPIPE 13 |
| 389 | #define TARGET_SIGALRM 14 |
| 390 | #define TARGET_SIGTERM 15 |
| 391 | #define TARGET_SIGURG 16 |
| 392 | #define TARGET_SIGSTOP 17 |
| 393 | #define TARGET_SIGTSTP 18 |
| 394 | #define TARGET_SIGCONT 19 |
| 395 | #define TARGET_SIGCHLD 20 |
| 396 | #define TARGET_SIGTTIN 21 |
| 397 | #define TARGET_SIGTTOU 22 |
| 398 | #define TARGET_SIGIO 23 |
| 399 | #define TARGET_SIGXCPU 24 |
| 400 | #define TARGET_SIGXFSZ 25 |
| 401 | #define TARGET_SIGVTALRM 26 |
| 402 | #define TARGET_SIGPROF 27 |
| 403 | #define TARGET_SIGWINCH 28 |
| 404 | #define TARGET_SIGPWR 29 /* actually SIGINFO */ |
| 405 | #define TARGET_SIGUSR1 30 |
| 406 | #define TARGET_SIGUSR2 31 |
| 407 | #define TARGET_SIGRTMIN 32 |
| 408 | |
| 409 | #define TARGET_SIG_BLOCK 1 |
| 410 | #define TARGET_SIG_UNBLOCK 2 |
| 411 | #define TARGET_SIG_SETMASK 3 |
| 412 | |
| 413 | #elif defined(TARGET_SPARC) |
bellard | 6d5e216 | 2004-09-30 22:04:13 +0000 | [diff] [blame] | 414 | |
| 415 | #define TARGET_SIGHUP 1 |
| 416 | #define TARGET_SIGINT 2 |
| 417 | #define TARGET_SIGQUIT 3 |
| 418 | #define TARGET_SIGILL 4 |
| 419 | #define TARGET_SIGTRAP 5 |
| 420 | #define TARGET_SIGABRT 6 |
| 421 | #define TARGET_SIGIOT 6 |
| 422 | #define TARGET_SIGSTKFLT 7 /* actually EMT */ |
| 423 | #define TARGET_SIGFPE 8 |
| 424 | #define TARGET_SIGKILL 9 |
| 425 | #define TARGET_SIGBUS 10 |
| 426 | #define TARGET_SIGSEGV 11 |
| 427 | #define TARGET_SIGSYS 12 |
| 428 | #define TARGET_SIGPIPE 13 |
| 429 | #define TARGET_SIGALRM 14 |
| 430 | #define TARGET_SIGTERM 15 |
| 431 | #define TARGET_SIGURG 16 |
| 432 | #define TARGET_SIGSTOP 17 |
| 433 | #define TARGET_SIGTSTP 18 |
| 434 | #define TARGET_SIGCONT 19 |
| 435 | #define TARGET_SIGCHLD 20 |
| 436 | #define TARGET_SIGTTIN 21 |
| 437 | #define TARGET_SIGTTOU 22 |
| 438 | #define TARGET_SIGIO 23 |
| 439 | #define TARGET_SIGXCPU 24 |
| 440 | #define TARGET_SIGXFSZ 25 |
| 441 | #define TARGET_SIGVTALRM 26 |
| 442 | #define TARGET_SIGPROF 27 |
| 443 | #define TARGET_SIGWINCH 28 |
| 444 | #define TARGET_SIGPWR 29 |
| 445 | #define TARGET_SIGUSR1 30 |
| 446 | #define TARGET_SIGUSR2 31 |
| 447 | #define TARGET_SIGRTMIN 32 |
| 448 | |
| 449 | #define TARGET_SIG_BLOCK 0x01 /* for blocking signals */ |
| 450 | #define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */ |
| 451 | #define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */ |
| 452 | |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 453 | #elif defined(TARGET_MIPS) |
| 454 | |
| 455 | #define TARGET_SIGHUP 1 /* Hangup (POSIX). */ |
| 456 | #define TARGET_SIGINT 2 /* Interrupt (ANSI). */ |
| 457 | #define TARGET_SIGQUIT 3 /* Quit (POSIX). */ |
| 458 | #define TARGET_SIGILL 4 /* Illegal instruction (ANSI). */ |
| 459 | #define TARGET_SIGTRAP 5 /* Trace trap (POSIX). */ |
| 460 | #define TARGET_SIGIOT 6 /* IOT trap (4.2 BSD). */ |
| 461 | #define TARGET_SIGABRT TARGET_SIGIOT /* Abort (ANSI). */ |
| 462 | #define TARGET_SIGEMT 7 |
| 463 | #define TARGET_SIGSTKFLT 7 /* XXX: incorrect */ |
| 464 | #define TARGET_SIGFPE 8 /* Floating-point exception (ANSI). */ |
| 465 | #define TARGET_SIGKILL 9 /* Kill, unblockable (POSIX). */ |
| 466 | #define TARGET_SIGBUS 10 /* BUS error (4.2 BSD). */ |
| 467 | #define TARGET_SIGSEGV 11 /* Segmentation violation (ANSI). */ |
| 468 | #define TARGET_SIGSYS 12 |
| 469 | #define TARGET_SIGPIPE 13 /* Broken pipe (POSIX). */ |
| 470 | #define TARGET_SIGALRM 14 /* Alarm clock (POSIX). */ |
| 471 | #define TARGET_SIGTERM 15 /* Termination (ANSI). */ |
| 472 | #define TARGET_SIGUSR1 16 /* User-defined signal 1 (POSIX). */ |
| 473 | #define TARGET_SIGUSR2 17 /* User-defined signal 2 (POSIX). */ |
| 474 | #define TARGET_SIGCHLD 18 /* Child status has changed (POSIX). */ |
| 475 | #define TARGET_SIGCLD TARGET_SIGCHLD /* Same as TARGET_SIGCHLD (System V). */ |
| 476 | #define TARGET_SIGPWR 19 /* Power failure restart (System V). */ |
| 477 | #define TARGET_SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */ |
| 478 | #define TARGET_SIGURG 21 /* Urgent condition on socket (4.2 BSD). */ |
| 479 | #define TARGET_SIGIO 22 /* I/O now possible (4.2 BSD). */ |
| 480 | #define TARGET_SIGPOLL TARGET_SIGIO /* Pollable event occurred (System V). */ |
| 481 | #define TARGET_SIGSTOP 23 /* Stop, unblockable (POSIX). */ |
| 482 | #define TARGET_SIGTSTP 24 /* Keyboard stop (POSIX). */ |
| 483 | #define TARGET_SIGCONT 25 /* Continue (POSIX). */ |
| 484 | #define TARGET_SIGTTIN 26 /* Background read from tty (POSIX). */ |
| 485 | #define TARGET_SIGTTOU 27 /* Background write to tty (POSIX). */ |
| 486 | #define TARGET_SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */ |
| 487 | #define TARGET_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */ |
| 488 | #define TARGET_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ |
| 489 | #define TARGET_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ |
| 490 | #define TARGET_SIGRTMIN 32 |
| 491 | |
| 492 | #define TARGET_SIG_BLOCK 1 /* for blocking signals */ |
| 493 | #define TARGET_SIG_UNBLOCK 2 /* for unblocking signals */ |
| 494 | #define TARGET_SIG_SETMASK 3 /* for setting the signal mask */ |
| 495 | |
bellard | 6d5e216 | 2004-09-30 22:04:13 +0000 | [diff] [blame] | 496 | #else |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 497 | |
Jia Liu | d962783 | 2012-07-20 15:50:52 +0800 | [diff] [blame] | 498 | /* OpenRISC Using the general signals */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 499 | #define TARGET_SIGHUP 1 |
| 500 | #define TARGET_SIGINT 2 |
| 501 | #define TARGET_SIGQUIT 3 |
| 502 | #define TARGET_SIGILL 4 |
| 503 | #define TARGET_SIGTRAP 5 |
| 504 | #define TARGET_SIGABRT 6 |
| 505 | #define TARGET_SIGIOT 6 |
| 506 | #define TARGET_SIGBUS 7 |
| 507 | #define TARGET_SIGFPE 8 |
| 508 | #define TARGET_SIGKILL 9 |
| 509 | #define TARGET_SIGUSR1 10 |
| 510 | #define TARGET_SIGSEGV 11 |
| 511 | #define TARGET_SIGUSR2 12 |
| 512 | #define TARGET_SIGPIPE 13 |
| 513 | #define TARGET_SIGALRM 14 |
| 514 | #define TARGET_SIGTERM 15 |
| 515 | #define TARGET_SIGSTKFLT 16 |
| 516 | #define TARGET_SIGCHLD 17 |
| 517 | #define TARGET_SIGCONT 18 |
| 518 | #define TARGET_SIGSTOP 19 |
| 519 | #define TARGET_SIGTSTP 20 |
| 520 | #define TARGET_SIGTTIN 21 |
| 521 | #define TARGET_SIGTTOU 22 |
| 522 | #define TARGET_SIGURG 23 |
| 523 | #define TARGET_SIGXCPU 24 |
| 524 | #define TARGET_SIGXFSZ 25 |
| 525 | #define TARGET_SIGVTALRM 26 |
| 526 | #define TARGET_SIGPROF 27 |
| 527 | #define TARGET_SIGWINCH 28 |
| 528 | #define TARGET_SIGIO 29 |
bellard | c596ed1 | 2003-07-13 17:32:31 +0000 | [diff] [blame] | 529 | #define TARGET_SIGPWR 30 |
| 530 | #define TARGET_SIGSYS 31 |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 531 | #define TARGET_SIGRTMIN 32 |
| 532 | |
| 533 | #define TARGET_SIG_BLOCK 0 /* for blocking signals */ |
| 534 | #define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */ |
| 535 | #define TARGET_SIG_SETMASK 2 /* for setting the signal mask */ |
| 536 | |
bellard | 6d5e216 | 2004-09-30 22:04:13 +0000 | [diff] [blame] | 537 | #endif |
| 538 | |
Richard Henderson | 6049f4f | 2009-12-27 18:30:03 -0800 | [diff] [blame] | 539 | #if defined(TARGET_ALPHA) |
| 540 | struct target_old_sigaction { |
| 541 | abi_ulong _sa_handler; |
| 542 | abi_ulong sa_mask; |
| 543 | abi_ulong sa_flags; |
| 544 | }; |
bellard | 106ec87 | 2006-06-27 21:08:10 +0000 | [diff] [blame] | 545 | |
Richard Henderson | 6049f4f | 2009-12-27 18:30:03 -0800 | [diff] [blame] | 546 | struct target_rt_sigaction { |
| 547 | abi_ulong _sa_handler; |
| 548 | abi_ulong sa_flags; |
| 549 | target_sigset_t sa_mask; |
| 550 | }; |
| 551 | |
| 552 | /* This is the struct used inside the kernel. The ka_restorer |
| 553 | field comes from the 5th argument to sys_rt_sigaction. */ |
| 554 | struct target_sigaction { |
| 555 | abi_ulong _sa_handler; |
| 556 | abi_ulong sa_flags; |
| 557 | target_sigset_t sa_mask; |
| 558 | abi_ulong sa_restorer; |
| 559 | }; |
| 560 | #elif defined(TARGET_MIPS) |
bellard | 106ec87 | 2006-06-27 21:08:10 +0000 | [diff] [blame] | 561 | struct target_sigaction { |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 562 | uint32_t sa_flags; |
ths | d26bc21 | 2007-11-08 18:05:37 +0000 | [diff] [blame] | 563 | #if defined(TARGET_ABI_MIPSN32) |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 564 | uint32_t _sa_handler; |
| 565 | #else |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 566 | abi_ulong _sa_handler; |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 567 | #endif |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 568 | target_sigset_t sa_mask; |
bellard | 106ec87 | 2006-06-27 21:08:10 +0000 | [diff] [blame] | 569 | }; |
bellard | 106ec87 | 2006-06-27 21:08:10 +0000 | [diff] [blame] | 570 | #else |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 571 | struct target_old_sigaction { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 572 | abi_ulong _sa_handler; |
| 573 | abi_ulong sa_mask; |
| 574 | abi_ulong sa_flags; |
| 575 | abi_ulong sa_restorer; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 576 | }; |
| 577 | |
| 578 | struct target_sigaction { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 579 | abi_ulong _sa_handler; |
| 580 | abi_ulong sa_flags; |
| 581 | abi_ulong sa_restorer; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 582 | target_sigset_t sa_mask; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 583 | }; |
bellard | 106ec87 | 2006-06-27 21:08:10 +0000 | [diff] [blame] | 584 | #endif |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 585 | |
| 586 | typedef union target_sigval { |
| 587 | int sival_int; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 588 | abi_ulong sival_ptr; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 589 | } target_sigval_t; |
bellard | 6d5e216 | 2004-09-30 22:04:13 +0000 | [diff] [blame] | 590 | #if 0 |
| 591 | #if defined (TARGET_SPARC) |
| 592 | typedef struct { |
| 593 | struct { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 594 | abi_ulong psr; |
| 595 | abi_ulong pc; |
| 596 | abi_ulong npc; |
| 597 | abi_ulong y; |
| 598 | abi_ulong u_regs[16]; /* globals and ins */ |
bellard | 6d5e216 | 2004-09-30 22:04:13 +0000 | [diff] [blame] | 599 | } si_regs; |
| 600 | int si_mask; |
| 601 | } __siginfo_t; |
| 602 | |
| 603 | typedef struct { |
| 604 | unsigned long si_float_regs [32]; |
| 605 | unsigned long si_fsr; |
| 606 | unsigned long si_fpqdepth; |
| 607 | struct { |
| 608 | unsigned long *insn_addr; |
| 609 | unsigned long insn; |
| 610 | } si_fpqueue [16]; |
| 611 | } __siginfo_fpu_t; |
| 612 | #endif |
| 613 | #endif |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 614 | |
| 615 | #define TARGET_SI_MAX_SIZE 128 |
| 616 | #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE/sizeof(int)) - 3) |
| 617 | |
| 618 | typedef struct target_siginfo { |
pbrook | 3f53d54 | 2009-04-21 00:59:40 +0000 | [diff] [blame] | 619 | #ifdef TARGET_MIPS |
| 620 | int si_signo; |
| 621 | int si_code; |
| 622 | int si_errno; |
| 623 | #else |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 624 | int si_signo; |
| 625 | int si_errno; |
| 626 | int si_code; |
pbrook | 3f53d54 | 2009-04-21 00:59:40 +0000 | [diff] [blame] | 627 | #endif |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 628 | |
| 629 | union { |
| 630 | int _pad[TARGET_SI_PAD_SIZE]; |
| 631 | |
| 632 | /* kill() */ |
| 633 | struct { |
| 634 | pid_t _pid; /* sender's pid */ |
| 635 | uid_t _uid; /* sender's uid */ |
| 636 | } _kill; |
| 637 | |
| 638 | /* POSIX.1b timers */ |
| 639 | struct { |
| 640 | unsigned int _timer1; |
| 641 | unsigned int _timer2; |
| 642 | } _timer; |
| 643 | |
| 644 | /* POSIX.1b signals */ |
| 645 | struct { |
| 646 | pid_t _pid; /* sender's pid */ |
| 647 | uid_t _uid; /* sender's uid */ |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 648 | target_sigval_t _sigval; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 649 | } _rt; |
| 650 | |
| 651 | /* SIGCHLD */ |
| 652 | struct { |
| 653 | pid_t _pid; /* which child */ |
| 654 | uid_t _uid; /* sender's uid */ |
| 655 | int _status; /* exit code */ |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 656 | target_clock_t _utime; |
| 657 | target_clock_t _stime; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 658 | } _sigchld; |
| 659 | |
| 660 | /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ |
| 661 | struct { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 662 | abi_ulong _addr; /* faulting insn/memory ref. */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 663 | } _sigfault; |
| 664 | |
| 665 | /* SIGPOLL */ |
| 666 | struct { |
| 667 | int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ |
| 668 | int _fd; |
| 669 | } _sigpoll; |
| 670 | } _sifields; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 671 | } target_siginfo_t; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 672 | |
| 673 | /* |
| 674 | * si_code values |
| 675 | * Digital reserves positive values for kernel-generated signals. |
| 676 | */ |
| 677 | #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ |
| 678 | #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ |
| 679 | #define TARGET_SI_QUEUE -1 /* sent by sigqueue */ |
| 680 | #define TARGET_SI_TIMER -2 /* sent by timer expiration */ |
| 681 | #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ |
| 682 | #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ |
| 683 | #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ |
| 684 | |
| 685 | /* |
| 686 | * SIGILL si_codes |
| 687 | */ |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 688 | #define TARGET_ILL_ILLOPC (1) /* illegal opcode */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 689 | #define TARGET_ILL_ILLOPN (2) /* illegal operand */ |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 690 | #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ |
| 691 | #define TARGET_ILL_ILLTRP (4) /* illegal trap */ |
| 692 | #define TARGET_ILL_PRVOPC (5) /* privileged opcode */ |
| 693 | #define TARGET_ILL_PRVREG (6) /* privileged register */ |
| 694 | #define TARGET_ILL_COPROC (7) /* coprocessor error */ |
| 695 | #define TARGET_ILL_BADSTK (8) /* internal stack error */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 696 | |
| 697 | /* |
| 698 | * SIGFPE si_codes |
| 699 | */ |
| 700 | #define TARGET_FPE_INTDIV (1) /* integer divide by zero */ |
| 701 | #define TARGET_FPE_INTOVF (2) /* integer overflow */ |
| 702 | #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ |
| 703 | #define TARGET_FPE_FLTOVF (4) /* floating point overflow */ |
| 704 | #define TARGET_FPE_FLTUND (5) /* floating point underflow */ |
| 705 | #define TARGET_FPE_FLTRES (6) /* floating point inexact result */ |
| 706 | #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ |
| 707 | #define TARGET_FPE_FLTSUB (8) /* subscript out of range */ |
| 708 | #define TARGET_NSIGFPE 8 |
| 709 | |
| 710 | /* |
| 711 | * SIGSEGV si_codes |
| 712 | */ |
| 713 | #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ |
| 714 | #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ |
| 715 | |
| 716 | /* |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 717 | * SIGBUS si_codes |
| 718 | */ |
| 719 | #define TARGET_BUS_ADRALN (1) /* invalid address alignment */ |
Dong Xu Wang | b4916d7 | 2011-11-22 18:06:17 +0800 | [diff] [blame] | 720 | #define TARGET_BUS_ADRERR (2) /* non-existent physical address */ |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 721 | #define TARGET_BUS_OBJERR (3) /* object specific hardware error */ |
| 722 | |
| 723 | /* |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 724 | * SIGTRAP si_codes |
| 725 | */ |
| 726 | #define TARGET_TRAP_BRKPT (1) /* process breakpoint */ |
| 727 | #define TARGET_TRAP_TRACE (2) /* process trace trap */ |
| 728 | |
| 729 | #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */ |
| 730 | |
bellard | 9de5e44 | 2003-03-23 16:49:39 +0000 | [diff] [blame] | 731 | struct target_rlimit { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 732 | abi_ulong rlim_cur; |
| 733 | abi_ulong rlim_max; |
bellard | 9de5e44 | 2003-03-23 16:49:39 +0000 | [diff] [blame] | 734 | }; |
| 735 | |
takasi-y@ops.dti.ne.jp | 81bbe90 | 2010-04-12 04:07:35 +0900 | [diff] [blame] | 736 | #if defined(TARGET_ALPHA) |
Aurelien Jarno | e476492 | 2010-05-19 18:30:53 +0200 | [diff] [blame] | 737 | #define TARGET_RLIM_INFINITY 0x7fffffffffffffffull |
Matthias Braun | 6cafd02 | 2011-09-09 19:30:25 +0200 | [diff] [blame] | 738 | #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32) |
takasi-y@ops.dti.ne.jp | 81bbe90 | 2010-04-12 04:07:35 +0900 | [diff] [blame] | 739 | #define TARGET_RLIM_INFINITY 0x7fffffffUL |
| 740 | #else |
Matthias Braun | 26b746d | 2011-09-09 19:31:17 +0200 | [diff] [blame] | 741 | #define TARGET_RLIM_INFINITY ((abi_ulong)-1) |
takasi-y@ops.dti.ne.jp | 81bbe90 | 2010-04-12 04:07:35 +0900 | [diff] [blame] | 742 | #endif |
| 743 | |
Wesley W. Terpstra | e22b701 | 2011-07-12 14:42:00 +0300 | [diff] [blame] | 744 | #if defined(TARGET_MIPS) |
| 745 | #define TARGET_RLIMIT_CPU 0 |
| 746 | #define TARGET_RLIMIT_FSIZE 1 |
| 747 | #define TARGET_RLIMIT_DATA 2 |
| 748 | #define TARGET_RLIMIT_STACK 3 |
| 749 | #define TARGET_RLIMIT_CORE 4 |
| 750 | #define TARGET_RLIMIT_RSS 7 |
| 751 | #define TARGET_RLIMIT_NPROC 8 |
| 752 | #define TARGET_RLIMIT_NOFILE 5 |
| 753 | #define TARGET_RLIMIT_MEMLOCK 9 |
| 754 | #define TARGET_RLIMIT_AS 6 |
| 755 | #define TARGET_RLIMIT_LOCKS 10 |
| 756 | #define TARGET_RLIMIT_SIGPENDING 11 |
| 757 | #define TARGET_RLIMIT_MSGQUEUE 12 |
| 758 | #define TARGET_RLIMIT_NICE 13 |
| 759 | #define TARGET_RLIMIT_RTPRIO 14 |
| 760 | #else |
| 761 | #define TARGET_RLIMIT_CPU 0 |
| 762 | #define TARGET_RLIMIT_FSIZE 1 |
| 763 | #define TARGET_RLIMIT_DATA 2 |
| 764 | #define TARGET_RLIMIT_STACK 3 |
| 765 | #define TARGET_RLIMIT_CORE 4 |
| 766 | #define TARGET_RLIMIT_RSS 5 |
Matthias Braun | 6cafd02 | 2011-09-09 19:30:25 +0200 | [diff] [blame] | 767 | #if defined(TARGET_SPARC) |
| 768 | #define TARGET_RLIMIT_NOFILE 6 |
| 769 | #define TARGET_RLIMIT_NPROC 7 |
| 770 | #else |
Wesley W. Terpstra | e22b701 | 2011-07-12 14:42:00 +0300 | [diff] [blame] | 771 | #define TARGET_RLIMIT_NPROC 6 |
| 772 | #define TARGET_RLIMIT_NOFILE 7 |
Matthias Braun | 6cafd02 | 2011-09-09 19:30:25 +0200 | [diff] [blame] | 773 | #endif |
Wesley W. Terpstra | e22b701 | 2011-07-12 14:42:00 +0300 | [diff] [blame] | 774 | #define TARGET_RLIMIT_MEMLOCK 8 |
| 775 | #define TARGET_RLIMIT_AS 9 |
| 776 | #define TARGET_RLIMIT_LOCKS 10 |
| 777 | #define TARGET_RLIMIT_SIGPENDING 11 |
| 778 | #define TARGET_RLIMIT_MSGQUEUE 12 |
| 779 | #define TARGET_RLIMIT_NICE 13 |
| 780 | #define TARGET_RLIMIT_RTPRIO 14 |
| 781 | #endif |
| 782 | |
bellard | 9de5e44 | 2003-03-23 16:49:39 +0000 | [diff] [blame] | 783 | struct target_pollfd { |
| 784 | int fd; /* file descriptor */ |
| 785 | short events; /* requested events */ |
| 786 | short revents; /* returned events */ |
| 787 | }; |
| 788 | |
bellard | 8e5a066 | 2003-05-08 15:42:10 +0000 | [diff] [blame] | 789 | /* virtual terminal ioctls */ |
bellard | 0221cfc | 2003-05-10 12:38:16 +0000 | [diff] [blame] | 790 | #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ |
| 791 | #define TARGET_KDMKTONE 0x4B30 /* generate tone */ |
bellard | 8e5a066 | 2003-05-08 15:42:10 +0000 | [diff] [blame] | 792 | #define TARGET_KDGKBTYPE 0x4b33 |
Ulrich Hecht | f7680a5 | 2009-10-16 17:00:44 +0200 | [diff] [blame] | 793 | #define TARGET_KDSETMODE 0x4b3a |
| 794 | #define TARGET_KDGKBMODE 0x4b44 |
| 795 | #define TARGET_KDSKBMODE 0x4b45 |
bellard | 0221cfc | 2003-05-10 12:38:16 +0000 | [diff] [blame] | 796 | #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ |
| 797 | #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ |
Cédric VINCENT | e6fe18f | 2011-06-29 15:09:09 +0200 | [diff] [blame] | 798 | #define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ |
| 799 | #define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ |
| 800 | #define TARGET_KDGETLED 0x4B31 /* return current led state */ |
| 801 | #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */ |
bellard | 8e5a066 | 2003-05-08 15:42:10 +0000 | [diff] [blame] | 802 | |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 803 | #define TARGET_SIOCATMARK 0x8905 |
| 804 | |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 805 | /* Networking ioctls */ |
| 806 | #define TARGET_SIOCADDRT 0x890B /* add routing table entry */ |
| 807 | #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ |
| 808 | #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ |
| 809 | #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ |
| 810 | #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ |
| 811 | #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ |
| 812 | #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ |
| 813 | #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ |
| 814 | #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ |
| 815 | #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ |
| 816 | #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ |
| 817 | #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ |
| 818 | #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ |
| 819 | #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ |
| 820 | #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ |
| 821 | #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ |
| 822 | #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ |
| 823 | #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ |
| 824 | #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ |
| 825 | #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ |
| 826 | #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ |
| 827 | #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ |
| 828 | #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ |
| 829 | #define TARGET_SIOCSIFENCAP 0x8926 |
| 830 | #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ |
| 831 | #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ |
| 832 | #define TARGET_SIOCSIFSLAVE 0x8930 |
| 833 | #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ |
| 834 | #define TARGET_SIOCDELMULTI 0x8932 |
| 835 | |
| 836 | /* Bridging control calls */ |
| 837 | #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ |
| 838 | #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ |
| 839 | |
| 840 | #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ |
| 841 | #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ |
| 842 | |
| 843 | /* ARP cache control calls. */ |
| 844 | #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ |
| 845 | #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ |
| 846 | #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ |
| 847 | #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ |
| 848 | #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ |
| 849 | #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ |
| 850 | |
| 851 | /* RARP cache control calls. */ |
| 852 | #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ |
| 853 | #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ |
| 854 | #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ |
| 855 | |
| 856 | /* Driver configuration calls */ |
| 857 | #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ |
| 858 | #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ |
| 859 | |
| 860 | /* DLCI configuration calls */ |
| 861 | #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ |
| 862 | #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ |
| 863 | |
Laurent Vivier | 86fcd94 | 2011-03-30 01:35:23 +0200 | [diff] [blame] | 864 | /* From <linux/wireless.h> */ |
| 865 | |
| 866 | #define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 867 | |
| 868 | /* From <linux/fs.h> */ |
| 869 | |
| 870 | #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ |
| 871 | #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ |
| 872 | #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ |
| 873 | #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ |
| 874 | #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ |
| 875 | #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ |
| 876 | #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ |
| 877 | #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ |
| 878 | #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ |
| 879 | #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ |
| 880 | #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ |
| 881 | #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ |
| 882 | /* A jump here: 108-111 have been used for various private purposes. */ |
Peter Maydell | c8b0bf5 | 2012-07-23 08:05:20 +0000 | [diff] [blame] | 883 | #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong) |
| 884 | #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong) |
Alexander Graf | edafea1 | 2012-01-31 20:10:20 +0100 | [diff] [blame] | 885 | #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) |
| 886 | /* return device size in bytes |
| 887 | (u64 *arg) */ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 888 | #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ |
| 889 | #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ |
Peter Maydell | 285da2b | 2011-01-06 15:04:18 +0000 | [diff] [blame] | 890 | #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 891 | |
| 892 | /* cdrom commands */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 893 | #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 894 | #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ |
| 895 | #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 896 | #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 897 | (struct cdrom_ti) */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 898 | #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 899 | (struct cdrom_tochdr) */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 900 | #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 901 | (struct cdrom_tocentry) */ |
| 902 | #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ |
| 903 | #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ |
| 904 | #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 905 | #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 906 | (struct cdrom_volctrl) */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 907 | #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 908 | (struct cdrom_subchnl) */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 909 | #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 910 | (struct cdrom_read) */ |
| 911 | #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) |
| 912 | (struct cdrom_read) */ |
| 913 | #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ |
| 914 | #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 915 | #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session |
| 916 | address of multi session disks |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 917 | (struct cdrom_multisession) */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 918 | #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 919 | if available (struct cdrom_mcn) */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 920 | #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is depricated, |
Dong Xu Wang | b4916d7 | 2011-11-22 18:06:17 +0800 | [diff] [blame] | 921 | but here anyway for compatibility */ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 922 | #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 923 | #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 924 | (struct cdrom_volctrl) */ |
| 925 | #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) |
| 926 | (struct cdrom_read) */ |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 927 | /* |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 928 | * These ioctls are used only used in aztcd.c and optcd.c |
| 929 | */ |
| 930 | #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ |
| 931 | #define TARGET_CDROMSEEK 0x5316 /* seek msf address */ |
ths | 3b46e62 | 2007-09-17 08:09:54 +0000 | [diff] [blame] | 932 | |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 933 | /* |
ths | 3b46e62 | 2007-09-17 08:09:54 +0000 | [diff] [blame] | 934 | * This ioctl is only used by the scsi-cd driver. |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 935 | It is for playing audio in logical block addressing mode. |
| 936 | */ |
| 937 | #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ |
| 938 | |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 939 | /* |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 940 | * These ioctls are only used in optcd.c |
| 941 | */ |
| 942 | #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ |
| 943 | |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 944 | /* |
| 945 | * These ioctls are (now) only in ide-cd.c for controlling |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 946 | * drive spindown time. They should be implemented in the |
| 947 | * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, |
| 948 | * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... |
| 949 | * -Erik |
| 950 | */ |
| 951 | #define TARGET_CDROMGETSPINDOWN 0x531d |
| 952 | #define TARGET_CDROMSETSPINDOWN 0x531e |
| 953 | |
ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 954 | /* |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 955 | * These ioctls are implemented through the uniform CD-ROM driver |
| 956 | * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM |
| 957 | * drivers are eventually ported to the uniform CD-ROM driver interface. |
| 958 | */ |
| 959 | #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ |
| 960 | #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ |
| 961 | #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ |
| 962 | #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ |
| 963 | #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ |
| 964 | #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ |
| 965 | #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ |
| 966 | #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ |
| 967 | #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ |
| 968 | #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ |
| 969 | #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ |
| 970 | #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ |
| 971 | |
| 972 | /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. |
| 973 | * Future CDROM ioctls should be kept below 0x537F |
| 974 | */ |
| 975 | |
| 976 | /* This ioctl is only used by sbpcd at the moment */ |
| 977 | #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ |
| 978 | /* conflict with SCSI_IOCTL_GET_IDLUN */ |
| 979 | |
| 980 | /* DVD-ROM Specific ioctls */ |
| 981 | #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ |
| 982 | #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ |
| 983 | #define TARGET_DVD_AUTH 0x5392 /* Authentication */ |
| 984 | |
| 985 | #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ |
| 986 | #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ |
| 987 | #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ |
| 988 | |
| 989 | /* HD commands */ |
| 990 | |
| 991 | /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ |
| 992 | #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ |
| 993 | #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ |
| 994 | #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 995 | #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ |
| 996 | #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ |
| 997 | #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ |
| 998 | #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 999 | #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 1000 | #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ |
| 1001 | |
| 1002 | /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ |
| 1003 | #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ |
| 1004 | #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ |
| 1005 | #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ |
| 1006 | #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ |
| 1007 | #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ |
| 1008 | #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ |
| 1009 | #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1010 | |
balrog | b800591 | 2008-04-26 14:44:49 +0000 | [diff] [blame] | 1011 | /* loop ioctls */ |
| 1012 | #define TARGET_LOOP_SET_FD 0x4C00 |
| 1013 | #define TARGET_LOOP_CLR_FD 0x4C01 |
| 1014 | #define TARGET_LOOP_SET_STATUS 0x4C02 |
| 1015 | #define TARGET_LOOP_GET_STATUS 0x4C03 |
| 1016 | #define TARGET_LOOP_SET_STATUS64 0x4C04 |
| 1017 | #define TARGET_LOOP_GET_STATUS64 0x4C05 |
| 1018 | #define TARGET_LOOP_CHANGE_FD 0x4C06 |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1019 | |
Ulrich Hecht | f7680a5 | 2009-10-16 17:00:44 +0200 | [diff] [blame] | 1020 | /* fb ioctls */ |
| 1021 | #define TARGET_FBIOGET_VSCREENINFO 0x4600 |
| 1022 | #define TARGET_FBIOPUT_VSCREENINFO 0x4601 |
| 1023 | #define TARGET_FBIOGET_FSCREENINFO 0x4602 |
Cédric VINCENT | 12b81b7 | 2011-06-29 15:09:11 +0200 | [diff] [blame] | 1024 | #define TARGET_FBIOGETCMAP 0x4604 |
| 1025 | #define TARGET_FBIOPUTCMAP 0x4605 |
| 1026 | #define TARGET_FBIOPAN_DISPLAY 0x4606 |
| 1027 | #define TARGET_FBIOGET_CON2FBMAP 0x460F |
| 1028 | #define TARGET_FBIOPUT_CON2FBMAP 0x4610 |
Ulrich Hecht | f7680a5 | 2009-10-16 17:00:44 +0200 | [diff] [blame] | 1029 | |
| 1030 | /* vt ioctls */ |
| 1031 | #define TARGET_VT_OPENQRY 0x5600 |
| 1032 | #define TARGET_VT_GETSTATE 0x5603 |
| 1033 | #define TARGET_VT_ACTIVATE 0x5606 |
| 1034 | #define TARGET_VT_WAITACTIVE 0x5607 |
| 1035 | #define TARGET_VT_LOCKSWITCH 0x560b |
| 1036 | #define TARGET_VT_UNLOCKSWITCH 0x560c |
Cédric VINCENT | 774750c | 2011-06-29 15:09:10 +0200 | [diff] [blame] | 1037 | #define TARGET_VT_GETMODE 0x5601 |
| 1038 | #define TARGET_VT_SETMODE 0x5602 |
| 1039 | #define TARGET_VT_RELDISP 0x5605 |
| 1040 | #define TARGET_VT_DISALLOCATE 0x5608 |
Ulrich Hecht | f7680a5 | 2009-10-16 17:00:44 +0200 | [diff] [blame] | 1041 | |
Alexander Graf | 56e904e | 2012-01-31 18:42:06 +0100 | [diff] [blame] | 1042 | /* device mapper */ |
| 1043 | #define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00) |
| 1044 | #define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01) |
| 1045 | #define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02) |
| 1046 | #define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03) |
| 1047 | #define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04) |
| 1048 | #define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05) |
| 1049 | #define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06) |
| 1050 | #define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07) |
| 1051 | #define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08) |
| 1052 | #define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09) |
| 1053 | #define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a) |
| 1054 | #define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b) |
| 1055 | #define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c) |
| 1056 | #define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d) |
| 1057 | #define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e) |
| 1058 | #define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f) |
| 1059 | |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1060 | /* from asm/termbits.h */ |
| 1061 | |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1062 | #define TARGET_NCC 8 |
| 1063 | struct target_termio { |
| 1064 | unsigned short c_iflag; /* input mode flags */ |
| 1065 | unsigned short c_oflag; /* output mode flags */ |
| 1066 | unsigned short c_cflag; /* control mode flags */ |
| 1067 | unsigned short c_lflag; /* local mode flags */ |
| 1068 | unsigned char c_line; /* line discipline */ |
| 1069 | unsigned char c_cc[TARGET_NCC]; /* control characters */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1070 | }; |
| 1071 | |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1072 | struct target_winsize { |
| 1073 | unsigned short ws_row; |
| 1074 | unsigned short ws_col; |
| 1075 | unsigned short ws_xpixel; |
| 1076 | unsigned short ws_ypixel; |
| 1077 | }; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1078 | |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1079 | #include "termbits.h" |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1080 | |
Paul Brook | 9e0b74a | 2010-06-16 13:03:51 +0100 | [diff] [blame] | 1081 | #if defined(TARGET_MIPS) |
| 1082 | #define TARGET_PROT_SEM 0x10 |
| 1083 | #else |
| 1084 | #define TARGET_PROT_SEM 0x08 |
| 1085 | #endif |
| 1086 | |
aurel32 | e44a3e7 | 2008-09-29 17:23:09 +0000 | [diff] [blame] | 1087 | /* Common */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1088 | #define TARGET_MAP_SHARED 0x01 /* Share changes */ |
| 1089 | #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ |
aurel32 | e44a3e7 | 2008-09-29 17:23:09 +0000 | [diff] [blame] | 1090 | #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ |
| 1091 | |
| 1092 | /* Target specific */ |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1093 | #if defined(TARGET_MIPS) |
aurel32 | e44a3e7 | 2008-09-29 17:23:09 +0000 | [diff] [blame] | 1094 | #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1095 | #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ |
| 1096 | #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ |
| 1097 | #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ |
| 1098 | #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ |
| 1099 | #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ |
| 1100 | #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 1101 | #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ |
| 1102 | #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ |
aurel32 | e44a3e7 | 2008-09-29 17:23:09 +0000 | [diff] [blame] | 1103 | #elif defined(TARGET_PPC) |
| 1104 | #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1105 | #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1106 | #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ |
| 1107 | #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ |
| 1108 | #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ |
j_mayer | 7ec93196 | 2007-09-18 21:54:57 +0000 | [diff] [blame] | 1109 | #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ |
| 1110 | #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ |
aurel32 | e44a3e7 | 2008-09-29 17:23:09 +0000 | [diff] [blame] | 1111 | #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
| 1112 | #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ |
| 1113 | #elif defined(TARGET_ALPHA) |
| 1114 | #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ |
| 1115 | #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ |
| 1116 | #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ |
| 1117 | #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ |
| 1118 | #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ |
| 1119 | #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ |
| 1120 | #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ |
| 1121 | #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ |
| 1122 | #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ |
j_mayer | 7ec93196 | 2007-09-18 21:54:57 +0000 | [diff] [blame] | 1123 | #else |
aurel32 | e44a3e7 | 2008-09-29 17:23:09 +0000 | [diff] [blame] | 1124 | #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ |
| 1125 | #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ |
| 1126 | #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ |
| 1127 | #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ |
| 1128 | #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1129 | #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ |
| 1130 | #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 1131 | #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ |
| 1132 | #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ |
Mike Frysinger | 906c1b8 | 2011-02-07 01:05:52 -0500 | [diff] [blame] | 1133 | #define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ |
j_mayer | 7ec93196 | 2007-09-18 21:54:57 +0000 | [diff] [blame] | 1134 | #endif |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1135 | |
Guan Xuetao | d2fbca9 | 2011-04-12 16:27:03 +0800 | [diff] [blame] | 1136 | #if (defined(TARGET_I386) && defined(TARGET_ABI32)) || defined(TARGET_ARM) \ |
Jia Liu | d962783 | 2012-07-20 15:50:52 +0800 | [diff] [blame] | 1137 | || defined(TARGET_CRIS) || defined(TARGET_UNICORE32) \ |
| 1138 | || defined(TARGET_OPENRISC) |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1139 | struct target_stat { |
| 1140 | unsigned short st_dev; |
| 1141 | unsigned short __pad1; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1142 | abi_ulong st_ino; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1143 | unsigned short st_mode; |
| 1144 | unsigned short st_nlink; |
| 1145 | unsigned short st_uid; |
| 1146 | unsigned short st_gid; |
| 1147 | unsigned short st_rdev; |
| 1148 | unsigned short __pad2; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1149 | abi_ulong st_size; |
| 1150 | abi_ulong st_blksize; |
| 1151 | abi_ulong st_blocks; |
| 1152 | abi_ulong target_st_atime; |
| 1153 | abi_ulong __unused1; |
| 1154 | abi_ulong target_st_mtime; |
| 1155 | abi_ulong __unused2; |
| 1156 | abi_ulong target_st_ctime; |
| 1157 | abi_ulong __unused3; |
| 1158 | abi_ulong __unused4; |
| 1159 | abi_ulong __unused5; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1160 | }; |
| 1161 | |
| 1162 | /* This matches struct stat64 in glibc2.1, hence the absolutely |
| 1163 | * insane amounts of padding around dev_t's. |
| 1164 | */ |
| 1165 | struct target_stat64 { |
| 1166 | unsigned short st_dev; |
| 1167 | unsigned char __pad0[10]; |
| 1168 | |
| 1169 | #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1170 | abi_ulong __st_ino; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1171 | |
| 1172 | unsigned int st_mode; |
| 1173 | unsigned int st_nlink; |
| 1174 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1175 | abi_ulong st_uid; |
| 1176 | abi_ulong st_gid; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1177 | |
| 1178 | unsigned short st_rdev; |
| 1179 | unsigned char __pad3[10]; |
| 1180 | |
| 1181 | long long st_size; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1182 | abi_ulong st_blksize; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1183 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1184 | abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ |
| 1185 | abi_ulong __pad4; /* future possible st_blocks high bits */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1186 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1187 | abi_ulong target_st_atime; |
| 1188 | abi_ulong __pad5; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1189 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1190 | abi_ulong target_st_mtime; |
| 1191 | abi_ulong __pad6; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1192 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1193 | abi_ulong target_st_ctime; |
| 1194 | abi_ulong __pad7; /* will be high 32 bits of ctime someday */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1195 | |
| 1196 | unsigned long long st_ino; |
Stefan Weil | 541dc0d | 2011-08-31 12:38:01 +0200 | [diff] [blame] | 1197 | } QEMU_PACKED; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1198 | |
pbrook | ce4defa | 2006-02-09 16:49:55 +0000 | [diff] [blame] | 1199 | #ifdef TARGET_ARM |
| 1200 | struct target_eabi_stat64 { |
| 1201 | unsigned long long st_dev; |
| 1202 | unsigned int __pad1; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1203 | abi_ulong __st_ino; |
pbrook | ce4defa | 2006-02-09 16:49:55 +0000 | [diff] [blame] | 1204 | unsigned int st_mode; |
| 1205 | unsigned int st_nlink; |
| 1206 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1207 | abi_ulong st_uid; |
| 1208 | abi_ulong st_gid; |
pbrook | ce4defa | 2006-02-09 16:49:55 +0000 | [diff] [blame] | 1209 | |
| 1210 | unsigned long long st_rdev; |
| 1211 | unsigned int __pad2[2]; |
| 1212 | |
| 1213 | long long st_size; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1214 | abi_ulong st_blksize; |
pbrook | ce4defa | 2006-02-09 16:49:55 +0000 | [diff] [blame] | 1215 | unsigned int __pad3; |
| 1216 | unsigned long long st_blocks; |
| 1217 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1218 | abi_ulong target_st_atime; |
| 1219 | abi_ulong target_st_atime_nsec; |
pbrook | ce4defa | 2006-02-09 16:49:55 +0000 | [diff] [blame] | 1220 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1221 | abi_ulong target_st_mtime; |
| 1222 | abi_ulong target_st_mtime_nsec; |
pbrook | ce4defa | 2006-02-09 16:49:55 +0000 | [diff] [blame] | 1223 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1224 | abi_ulong target_st_ctime; |
| 1225 | abi_ulong target_st_ctime_nsec; |
pbrook | ce4defa | 2006-02-09 16:49:55 +0000 | [diff] [blame] | 1226 | |
| 1227 | unsigned long long st_ino; |
Stefan Weil | 541dc0d | 2011-08-31 12:38:01 +0200 | [diff] [blame] | 1228 | } QEMU_PACKED; |
pbrook | ce4defa | 2006-02-09 16:49:55 +0000 | [diff] [blame] | 1229 | #endif |
| 1230 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1231 | #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) |
blueswir1 | 1b8dd64 | 2007-07-08 10:08:24 +0000 | [diff] [blame] | 1232 | struct target_stat { |
| 1233 | unsigned int st_dev; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1234 | abi_ulong st_ino; |
blueswir1 | 1b8dd64 | 2007-07-08 10:08:24 +0000 | [diff] [blame] | 1235 | unsigned int st_mode; |
| 1236 | unsigned int st_nlink; |
| 1237 | unsigned int st_uid; |
| 1238 | unsigned int st_gid; |
| 1239 | unsigned int st_rdev; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1240 | abi_long st_size; |
| 1241 | abi_long target_st_atime; |
| 1242 | abi_long target_st_mtime; |
| 1243 | abi_long target_st_ctime; |
| 1244 | abi_long st_blksize; |
| 1245 | abi_long st_blocks; |
| 1246 | abi_ulong __unused4[2]; |
blueswir1 | 1b8dd64 | 2007-07-08 10:08:24 +0000 | [diff] [blame] | 1247 | }; |
| 1248 | |
| 1249 | struct target_stat64 { |
| 1250 | unsigned char __pad0[6]; |
| 1251 | unsigned short st_dev; |
| 1252 | |
| 1253 | uint64_t st_ino; |
| 1254 | uint64_t st_nlink; |
| 1255 | |
| 1256 | unsigned int st_mode; |
| 1257 | |
| 1258 | unsigned int st_uid; |
| 1259 | unsigned int st_gid; |
| 1260 | |
| 1261 | unsigned char __pad2[6]; |
| 1262 | unsigned short st_rdev; |
| 1263 | |
| 1264 | int64_t st_size; |
| 1265 | int64_t st_blksize; |
| 1266 | |
| 1267 | unsigned char __pad4[4]; |
| 1268 | unsigned int st_blocks; |
| 1269 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1270 | abi_ulong target_st_atime; |
| 1271 | abi_ulong __unused1; |
blueswir1 | 1b8dd64 | 2007-07-08 10:08:24 +0000 | [diff] [blame] | 1272 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1273 | abi_ulong target_st_mtime; |
| 1274 | abi_ulong __unused2; |
blueswir1 | 1b8dd64 | 2007-07-08 10:08:24 +0000 | [diff] [blame] | 1275 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1276 | abi_ulong target_st_ctime; |
| 1277 | abi_ulong __unused3; |
blueswir1 | 1b8dd64 | 2007-07-08 10:08:24 +0000 | [diff] [blame] | 1278 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1279 | abi_ulong __unused4[3]; |
blueswir1 | 1b8dd64 | 2007-07-08 10:08:24 +0000 | [diff] [blame] | 1280 | }; |
| 1281 | |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1282 | #elif defined(TARGET_SPARC) |
| 1283 | |
| 1284 | struct target_stat { |
| 1285 | unsigned short st_dev; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1286 | abi_ulong st_ino; |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1287 | unsigned short st_mode; |
| 1288 | short st_nlink; |
| 1289 | unsigned short st_uid; |
| 1290 | unsigned short st_gid; |
| 1291 | unsigned short st_rdev; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1292 | abi_long st_size; |
| 1293 | abi_long target_st_atime; |
| 1294 | abi_ulong __unused1; |
| 1295 | abi_long target_st_mtime; |
| 1296 | abi_ulong __unused2; |
| 1297 | abi_long target_st_ctime; |
| 1298 | abi_ulong __unused3; |
| 1299 | abi_long st_blksize; |
| 1300 | abi_long st_blocks; |
| 1301 | abi_ulong __unused4[2]; |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1302 | }; |
| 1303 | |
| 1304 | struct target_stat64 { |
| 1305 | unsigned char __pad0[6]; |
| 1306 | unsigned short st_dev; |
| 1307 | |
| 1308 | uint64_t st_ino; |
| 1309 | |
| 1310 | unsigned int st_mode; |
| 1311 | unsigned int st_nlink; |
| 1312 | |
| 1313 | unsigned int st_uid; |
| 1314 | unsigned int st_gid; |
| 1315 | |
| 1316 | unsigned char __pad2[6]; |
| 1317 | unsigned short st_rdev; |
| 1318 | |
| 1319 | unsigned char __pad3[8]; |
| 1320 | |
| 1321 | int64_t st_size; |
| 1322 | unsigned int st_blksize; |
| 1323 | |
| 1324 | unsigned char __pad4[8]; |
| 1325 | unsigned int st_blocks; |
| 1326 | |
| 1327 | unsigned int target_st_atime; |
| 1328 | unsigned int __unused1; |
| 1329 | |
| 1330 | unsigned int target_st_mtime; |
| 1331 | unsigned int __unused2; |
| 1332 | |
| 1333 | unsigned int target_st_ctime; |
| 1334 | unsigned int __unused3; |
| 1335 | |
| 1336 | unsigned int __unused4; |
| 1337 | unsigned int __unused5; |
| 1338 | }; |
| 1339 | |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 1340 | #elif defined(TARGET_PPC) |
| 1341 | |
| 1342 | struct target_stat { |
j_mayer | e32448e | 2007-12-10 08:24:59 +0000 | [diff] [blame] | 1343 | abi_ulong st_dev; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1344 | abi_ulong st_ino; |
j_mayer | 325e651 | 2007-11-21 13:06:54 +0000 | [diff] [blame] | 1345 | #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) |
j_mayer | e32448e | 2007-12-10 08:24:59 +0000 | [diff] [blame] | 1346 | abi_ulong st_nlink; |
j_mayer | 325e651 | 2007-11-21 13:06:54 +0000 | [diff] [blame] | 1347 | unsigned int st_mode; |
| 1348 | #else |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 1349 | unsigned int st_mode; |
| 1350 | unsigned short st_nlink; |
j_mayer | 325e651 | 2007-11-21 13:06:54 +0000 | [diff] [blame] | 1351 | #endif |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 1352 | unsigned int st_uid; |
| 1353 | unsigned int st_gid; |
j_mayer | e32448e | 2007-12-10 08:24:59 +0000 | [diff] [blame] | 1354 | abi_ulong st_rdev; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1355 | abi_ulong st_size; |
| 1356 | abi_ulong st_blksize; |
| 1357 | abi_ulong st_blocks; |
| 1358 | abi_ulong target_st_atime; |
j_mayer | e32448e | 2007-12-10 08:24:59 +0000 | [diff] [blame] | 1359 | abi_ulong target_st_atime_nsec; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1360 | abi_ulong target_st_mtime; |
j_mayer | e32448e | 2007-12-10 08:24:59 +0000 | [diff] [blame] | 1361 | abi_ulong target_st_mtime_nsec; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1362 | abi_ulong target_st_ctime; |
j_mayer | e32448e | 2007-12-10 08:24:59 +0000 | [diff] [blame] | 1363 | abi_ulong target_st_ctime_nsec; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1364 | abi_ulong __unused4; |
| 1365 | abi_ulong __unused5; |
j_mayer | 325e651 | 2007-11-21 13:06:54 +0000 | [diff] [blame] | 1366 | #if defined(TARGET_PPC64) && !defined(TARGET_ABI32) |
| 1367 | abi_ulong __unused6; |
| 1368 | #endif |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 1369 | }; |
| 1370 | |
Stefan Weil | 541dc0d | 2011-08-31 12:38:01 +0200 | [diff] [blame] | 1371 | struct QEMU_PACKED target_stat64 { |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 1372 | unsigned long long st_dev; |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 1373 | unsigned long long st_ino; |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1374 | unsigned int st_mode; |
| 1375 | unsigned int st_nlink; |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 1376 | unsigned int st_uid; |
| 1377 | unsigned int st_gid; |
bellard | 3bfd9da | 2004-01-04 15:52:31 +0000 | [diff] [blame] | 1378 | unsigned long long st_rdev; |
aurel32 | e1ce5e4 | 2009-01-30 19:48:32 +0000 | [diff] [blame] | 1379 | unsigned long long __pad0; |
j_mayer | e32448e | 2007-12-10 08:24:59 +0000 | [diff] [blame] | 1380 | long long st_size; |
| 1381 | int st_blksize; |
aurel32 | e1ce5e4 | 2009-01-30 19:48:32 +0000 | [diff] [blame] | 1382 | unsigned int __pad1; |
Max Filippov | 61322e9 | 2009-09-01 23:27:47 +0400 | [diff] [blame] | 1383 | long long st_blocks; /* Number 512-byte blocks allocated. */ |
j_mayer | e32448e | 2007-12-10 08:24:59 +0000 | [diff] [blame] | 1384 | int target_st_atime; |
| 1385 | unsigned int target_st_atime_nsec; |
| 1386 | int target_st_mtime; |
| 1387 | unsigned int target_st_mtime_nsec; |
| 1388 | int target_st_ctime; |
| 1389 | unsigned int target_st_ctime_nsec; |
| 1390 | unsigned int __unused4; |
| 1391 | unsigned int __unused5; |
bellard | 6786730 | 2003-11-23 17:05:30 +0000 | [diff] [blame] | 1392 | }; |
| 1393 | |
Edgar E. Iglesias | b779e29 | 2009-05-20 21:31:33 +0200 | [diff] [blame] | 1394 | #elif defined(TARGET_MICROBLAZE) |
| 1395 | |
| 1396 | struct target_stat { |
| 1397 | abi_ulong st_dev; |
| 1398 | abi_ulong st_ino; |
| 1399 | unsigned int st_mode; |
| 1400 | unsigned short st_nlink; |
| 1401 | unsigned int st_uid; |
| 1402 | unsigned int st_gid; |
| 1403 | abi_ulong st_rdev; |
| 1404 | abi_ulong st_size; |
| 1405 | abi_ulong st_blksize; |
| 1406 | abi_ulong st_blocks; |
| 1407 | abi_ulong target_st_atime; |
| 1408 | abi_ulong target_st_atime_nsec; |
| 1409 | abi_ulong target_st_mtime; |
| 1410 | abi_ulong target_st_mtime_nsec; |
| 1411 | abi_ulong target_st_ctime; |
| 1412 | abi_ulong target_st_ctime_nsec; |
| 1413 | abi_ulong __unused4; |
| 1414 | abi_ulong __unused5; |
| 1415 | }; |
| 1416 | |
| 1417 | /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */ |
Stefan Weil | 541dc0d | 2011-08-31 12:38:01 +0200 | [diff] [blame] | 1418 | struct QEMU_PACKED target_stat64 { |
Edgar E. Iglesias | b779e29 | 2009-05-20 21:31:33 +0200 | [diff] [blame] | 1419 | uint64_t st_dev; |
Edgar E. Iglesias | a523eb0 | 2010-08-09 10:13:33 +0200 | [diff] [blame] | 1420 | #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 |
| 1421 | uint32_t pad0; |
| 1422 | uint32_t __st_ino; |
| 1423 | |
Edgar E. Iglesias | b779e29 | 2009-05-20 21:31:33 +0200 | [diff] [blame] | 1424 | uint32_t st_mode; |
| 1425 | uint32_t st_nlink; |
| 1426 | uint32_t st_uid; |
| 1427 | uint32_t st_gid; |
| 1428 | uint64_t st_rdev; |
Edgar E. Iglesias | 21ebeb2 | 2009-06-23 19:19:33 +0200 | [diff] [blame] | 1429 | uint64_t __pad1; |
Edgar E. Iglesias | b779e29 | 2009-05-20 21:31:33 +0200 | [diff] [blame] | 1430 | |
| 1431 | int64_t st_size; |
Edgar E. Iglesias | 21ebeb2 | 2009-06-23 19:19:33 +0200 | [diff] [blame] | 1432 | int32_t st_blksize; |
| 1433 | uint32_t __pad2; |
Edgar E. Iglesias | b779e29 | 2009-05-20 21:31:33 +0200 | [diff] [blame] | 1434 | int64_t st_blocks; /* Number 512-byte blocks allocated. */ |
| 1435 | |
| 1436 | int target_st_atime; |
Edgar E. Iglesias | a523eb0 | 2010-08-09 10:13:33 +0200 | [diff] [blame] | 1437 | unsigned int target_st_atime_nsec; |
Edgar E. Iglesias | b779e29 | 2009-05-20 21:31:33 +0200 | [diff] [blame] | 1438 | int target_st_mtime; |
Edgar E. Iglesias | a523eb0 | 2010-08-09 10:13:33 +0200 | [diff] [blame] | 1439 | unsigned int target_st_mtime_nsec; |
Edgar E. Iglesias | b779e29 | 2009-05-20 21:31:33 +0200 | [diff] [blame] | 1440 | int target_st_ctime; |
Edgar E. Iglesias | a523eb0 | 2010-08-09 10:13:33 +0200 | [diff] [blame] | 1441 | unsigned int target_st_ctime_nsec; |
| 1442 | uint64_t st_ino; |
Edgar E. Iglesias | b779e29 | 2009-05-20 21:31:33 +0200 | [diff] [blame] | 1443 | }; |
| 1444 | |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1445 | #elif defined(TARGET_M68K) |
| 1446 | |
| 1447 | struct target_stat { |
| 1448 | unsigned short st_dev; |
| 1449 | unsigned short __pad1; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1450 | abi_ulong st_ino; |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1451 | unsigned short st_mode; |
| 1452 | unsigned short st_nlink; |
| 1453 | unsigned short st_uid; |
| 1454 | unsigned short st_gid; |
| 1455 | unsigned short st_rdev; |
| 1456 | unsigned short __pad2; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1457 | abi_ulong st_size; |
| 1458 | abi_ulong st_blksize; |
| 1459 | abi_ulong st_blocks; |
| 1460 | abi_ulong target_st_atime; |
| 1461 | abi_ulong __unused1; |
| 1462 | abi_ulong target_st_mtime; |
| 1463 | abi_ulong __unused2; |
| 1464 | abi_ulong target_st_ctime; |
| 1465 | abi_ulong __unused3; |
| 1466 | abi_ulong __unused4; |
| 1467 | abi_ulong __unused5; |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1468 | }; |
| 1469 | |
| 1470 | /* This matches struct stat64 in glibc2.1, hence the absolutely |
| 1471 | * insane amounts of padding around dev_t's. |
| 1472 | */ |
| 1473 | struct target_stat64 { |
| 1474 | unsigned long long st_dev; |
| 1475 | unsigned char __pad1[2]; |
| 1476 | |
| 1477 | #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1478 | abi_ulong __st_ino; |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1479 | |
| 1480 | unsigned int st_mode; |
| 1481 | unsigned int st_nlink; |
| 1482 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1483 | abi_ulong st_uid; |
| 1484 | abi_ulong st_gid; |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1485 | |
| 1486 | unsigned long long st_rdev; |
| 1487 | unsigned char __pad3[2]; |
| 1488 | |
| 1489 | long long st_size; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1490 | abi_ulong st_blksize; |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1491 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1492 | abi_ulong __pad4; /* future possible st_blocks high bits */ |
| 1493 | abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1494 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1495 | abi_ulong target_st_atime; |
| 1496 | abi_ulong target_st_atime_nsec; |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1497 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1498 | abi_ulong target_st_mtime; |
| 1499 | abi_ulong target_st_mtime_nsec; |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1500 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1501 | abi_ulong target_st_ctime; |
| 1502 | abi_ulong target_st_ctime_nsec; |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1503 | |
| 1504 | unsigned long long st_ino; |
Stefan Weil | 541dc0d | 2011-08-31 12:38:01 +0200 | [diff] [blame] | 1505 | } QEMU_PACKED; |
pbrook | e6e5906 | 2006-10-22 00:18:54 +0000 | [diff] [blame] | 1506 | |
ths | d26bc21 | 2007-11-08 18:05:37 +0000 | [diff] [blame] | 1507 | #elif defined(TARGET_ABI_MIPSN64) |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 1508 | |
| 1509 | /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */ |
| 1510 | struct target_stat { |
| 1511 | unsigned int st_dev; |
| 1512 | unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ |
| 1513 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1514 | abi_ulong st_ino; |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 1515 | |
| 1516 | unsigned int st_mode; |
| 1517 | unsigned int st_nlink; |
| 1518 | |
| 1519 | int st_uid; |
| 1520 | int st_gid; |
| 1521 | |
| 1522 | unsigned int st_rdev; |
| 1523 | unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ |
| 1524 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1525 | abi_ulong st_size; |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 1526 | |
| 1527 | /* |
| 1528 | * Actually this should be timestruc_t st_atime, st_mtime and st_ctime |
| 1529 | * but we don't have it under Linux. |
| 1530 | */ |
| 1531 | unsigned int target_st_atime; |
| 1532 | unsigned int target_st_atime_nsec; |
| 1533 | |
| 1534 | unsigned int target_st_mtime; |
| 1535 | unsigned int target_st_mtime_nsec; |
| 1536 | |
| 1537 | unsigned int target_st_ctime; |
| 1538 | unsigned int target_st_ctime_nsec; |
| 1539 | |
| 1540 | unsigned int st_blksize; |
| 1541 | unsigned int st_pad2; |
| 1542 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1543 | abi_ulong st_blocks; |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 1544 | }; |
| 1545 | |
ths | d26bc21 | 2007-11-08 18:05:37 +0000 | [diff] [blame] | 1546 | #elif defined(TARGET_ABI_MIPSN32) |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 1547 | |
| 1548 | struct target_stat { |
| 1549 | unsigned st_dev; |
| 1550 | int st_pad1[3]; /* Reserved for network id */ |
| 1551 | unsigned int st_ino; |
| 1552 | unsigned int st_mode; |
| 1553 | unsigned int st_nlink; |
| 1554 | int st_uid; |
| 1555 | int st_gid; |
| 1556 | unsigned st_rdev; |
| 1557 | unsigned int st_pad2[2]; |
| 1558 | unsigned int st_size; |
| 1559 | unsigned int st_pad3; |
| 1560 | /* |
| 1561 | * Actually this should be timestruc_t st_atime, st_mtime and st_ctime |
| 1562 | * but we don't have it under Linux. |
| 1563 | */ |
| 1564 | unsigned int target_st_atime; |
| 1565 | unsigned int target_st_atime_nsec; |
| 1566 | unsigned int target_st_mtime; |
| 1567 | unsigned int target_st_mtime_nsec; |
| 1568 | unsigned int target_st_ctime; |
| 1569 | unsigned int target_st_ctime_nsec; |
| 1570 | unsigned int st_blksize; |
| 1571 | unsigned int st_blocks; |
| 1572 | unsigned int st_pad4[14]; |
| 1573 | }; |
| 1574 | |
| 1575 | /* |
| 1576 | * This matches struct stat64 in glibc2.1, hence the absolutely insane |
| 1577 | * amounts of padding around dev_t's. The memory layout is the same as of |
| 1578 | * struct stat of the 64-bit kernel. |
| 1579 | */ |
| 1580 | |
| 1581 | struct target_stat64 { |
| 1582 | unsigned int st_dev; |
| 1583 | unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ |
| 1584 | |
| 1585 | target_ulong st_ino; |
| 1586 | |
| 1587 | unsigned int st_mode; |
| 1588 | unsigned int st_nlink; |
| 1589 | |
| 1590 | int st_uid; |
| 1591 | int st_gid; |
| 1592 | |
| 1593 | unsigned int st_rdev; |
| 1594 | unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ |
| 1595 | |
| 1596 | int st_size; |
| 1597 | |
| 1598 | /* |
| 1599 | * Actually this should be timestruc_t st_atime, st_mtime and st_ctime |
| 1600 | * but we don't have it under Linux. |
| 1601 | */ |
| 1602 | int target_st_atime; |
| 1603 | unsigned int target_st_atime_nsec; /* Reserved for st_atime expansion */ |
| 1604 | |
| 1605 | int target_st_mtime; |
| 1606 | unsigned int target_st_mtime_nsec; /* Reserved for st_mtime expansion */ |
| 1607 | |
| 1608 | int target_st_ctime; |
| 1609 | unsigned int target_st_ctime_nsec; /* Reserved for st_ctime expansion */ |
| 1610 | |
| 1611 | unsigned int st_blksize; |
| 1612 | unsigned int st_pad2; |
| 1613 | |
| 1614 | int st_blocks; |
| 1615 | }; |
| 1616 | |
ths | d26bc21 | 2007-11-08 18:05:37 +0000 | [diff] [blame] | 1617 | #elif defined(TARGET_ABI_MIPSO32) |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1618 | |
| 1619 | struct target_stat { |
| 1620 | unsigned st_dev; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1621 | abi_long st_pad1[3]; /* Reserved for network id */ |
| 1622 | abi_ulong st_ino; |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1623 | unsigned int st_mode; |
| 1624 | unsigned int st_nlink; |
| 1625 | int st_uid; |
| 1626 | int st_gid; |
| 1627 | unsigned st_rdev; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1628 | abi_long st_pad2[2]; |
| 1629 | abi_long st_size; |
| 1630 | abi_long st_pad3; |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1631 | /* |
| 1632 | * Actually this should be timestruc_t st_atime, st_mtime and st_ctime |
| 1633 | * but we don't have it under Linux. |
| 1634 | */ |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1635 | abi_long target_st_atime; |
| 1636 | abi_long target_st_atime_nsec; |
| 1637 | abi_long target_st_mtime; |
| 1638 | abi_long target_st_mtime_nsec; |
| 1639 | abi_long target_st_ctime; |
| 1640 | abi_long target_st_ctime_nsec; |
| 1641 | abi_long st_blksize; |
| 1642 | abi_long st_blocks; |
| 1643 | abi_long st_pad4[14]; |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1644 | }; |
| 1645 | |
| 1646 | /* |
| 1647 | * This matches struct stat64 in glibc2.1, hence the absolutely insane |
| 1648 | * amounts of padding around dev_t's. The memory layout is the same as of |
| 1649 | * struct stat of the 64-bit kernel. |
| 1650 | */ |
| 1651 | |
| 1652 | struct target_stat64 { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1653 | abi_ulong st_dev; |
| 1654 | abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1655 | |
| 1656 | uint64_t st_ino; |
| 1657 | |
| 1658 | unsigned int st_mode; |
| 1659 | unsigned int st_nlink; |
| 1660 | |
| 1661 | int st_uid; |
| 1662 | int st_gid; |
| 1663 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1664 | abi_ulong st_rdev; |
| 1665 | abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1666 | |
| 1667 | int64_t st_size; |
| 1668 | |
| 1669 | /* |
| 1670 | * Actually this should be timestruc_t st_atime, st_mtime and st_ctime |
| 1671 | * but we don't have it under Linux. |
| 1672 | */ |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1673 | abi_long target_st_atime; |
| 1674 | abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1675 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1676 | abi_long target_st_mtime; |
| 1677 | abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1678 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1679 | abi_long target_st_ctime; |
| 1680 | abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1681 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1682 | abi_ulong st_blksize; |
| 1683 | abi_ulong st_pad2; |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1684 | |
| 1685 | int64_t st_blocks; |
| 1686 | }; |
j_mayer | 7a3148a | 2007-04-05 07:13:51 +0000 | [diff] [blame] | 1687 | |
| 1688 | #elif defined(TARGET_ALPHA) |
| 1689 | |
| 1690 | struct target_stat { |
| 1691 | unsigned int st_dev; |
| 1692 | unsigned int st_ino; |
| 1693 | unsigned int st_mode; |
| 1694 | unsigned int st_nlink; |
| 1695 | unsigned int st_uid; |
| 1696 | unsigned int st_gid; |
| 1697 | unsigned int st_rdev; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1698 | abi_long st_size; |
| 1699 | abi_ulong target_st_atime; |
| 1700 | abi_ulong target_st_mtime; |
| 1701 | abi_ulong target_st_ctime; |
j_mayer | 7a3148a | 2007-04-05 07:13:51 +0000 | [diff] [blame] | 1702 | unsigned int st_blksize; |
| 1703 | unsigned int st_blocks; |
| 1704 | unsigned int st_flags; |
| 1705 | unsigned int st_gen; |
| 1706 | }; |
| 1707 | |
| 1708 | struct target_stat64 { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1709 | abi_ulong st_dev; |
| 1710 | abi_ulong st_ino; |
| 1711 | abi_ulong st_rdev; |
| 1712 | abi_long st_size; |
| 1713 | abi_ulong st_blocks; |
j_mayer | 7a3148a | 2007-04-05 07:13:51 +0000 | [diff] [blame] | 1714 | |
| 1715 | unsigned int st_mode; |
| 1716 | unsigned int st_uid; |
| 1717 | unsigned int st_gid; |
| 1718 | unsigned int st_blksize; |
| 1719 | unsigned int st_nlink; |
| 1720 | unsigned int __pad0; |
| 1721 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1722 | abi_ulong target_st_atime; |
| 1723 | abi_ulong target_st_atime_nsec; |
| 1724 | abi_ulong target_st_mtime; |
| 1725 | abi_ulong target_st_mtime_nsec; |
| 1726 | abi_ulong target_st_ctime; |
| 1727 | abi_ulong target_st_ctime_nsec; |
| 1728 | abi_long __unused[3]; |
j_mayer | 7a3148a | 2007-04-05 07:13:51 +0000 | [diff] [blame] | 1729 | }; |
| 1730 | |
ths | 6db45e6 | 2007-06-22 10:15:10 +0000 | [diff] [blame] | 1731 | #elif defined(TARGET_SH4) |
| 1732 | |
| 1733 | struct target_stat { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1734 | abi_ulong st_dev; |
| 1735 | abi_ulong st_ino; |
ths | 6db45e6 | 2007-06-22 10:15:10 +0000 | [diff] [blame] | 1736 | unsigned short st_mode; |
| 1737 | unsigned short st_nlink; |
| 1738 | unsigned short st_uid; |
| 1739 | unsigned short st_gid; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1740 | abi_ulong st_rdev; |
| 1741 | abi_ulong st_size; |
| 1742 | abi_ulong st_blksize; |
| 1743 | abi_ulong st_blocks; |
| 1744 | abi_ulong target_st_atime; |
| 1745 | abi_ulong target_st_atime_nsec; |
| 1746 | abi_ulong target_st_mtime; |
| 1747 | abi_ulong target_st_mtime_nsec; |
| 1748 | abi_ulong target_st_ctime; |
| 1749 | abi_ulong target_st_ctime_nsec; |
| 1750 | abi_ulong __unused4; |
| 1751 | abi_ulong __unused5; |
ths | 6db45e6 | 2007-06-22 10:15:10 +0000 | [diff] [blame] | 1752 | }; |
| 1753 | |
| 1754 | /* This matches struct stat64 in glibc2.1, hence the absolutely |
| 1755 | * insane amounts of padding around dev_t's. |
| 1756 | */ |
Stefan Weil | 541dc0d | 2011-08-31 12:38:01 +0200 | [diff] [blame] | 1757 | struct QEMU_PACKED target_stat64 { |
ths | 6db45e6 | 2007-06-22 10:15:10 +0000 | [diff] [blame] | 1758 | unsigned long long st_dev; |
| 1759 | unsigned char __pad0[4]; |
| 1760 | |
| 1761 | #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1762 | abi_ulong __st_ino; |
ths | 6db45e6 | 2007-06-22 10:15:10 +0000 | [diff] [blame] | 1763 | |
| 1764 | unsigned int st_mode; |
| 1765 | unsigned int st_nlink; |
| 1766 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1767 | abi_ulong st_uid; |
| 1768 | abi_ulong st_gid; |
ths | 6db45e6 | 2007-06-22 10:15:10 +0000 | [diff] [blame] | 1769 | |
| 1770 | unsigned long long st_rdev; |
| 1771 | unsigned char __pad3[4]; |
| 1772 | |
| 1773 | long long st_size; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1774 | abi_ulong st_blksize; |
ths | 6db45e6 | 2007-06-22 10:15:10 +0000 | [diff] [blame] | 1775 | |
| 1776 | unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ |
| 1777 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1778 | abi_ulong target_st_atime; |
| 1779 | abi_ulong target_st_atime_nsec; |
ths | 6db45e6 | 2007-06-22 10:15:10 +0000 | [diff] [blame] | 1780 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1781 | abi_ulong target_st_mtime; |
| 1782 | abi_ulong target_st_mtime_nsec; |
ths | 6db45e6 | 2007-06-22 10:15:10 +0000 | [diff] [blame] | 1783 | |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1784 | abi_ulong target_st_ctime; |
| 1785 | abi_ulong target_st_ctime_nsec; |
ths | 6db45e6 | 2007-06-22 10:15:10 +0000 | [diff] [blame] | 1786 | |
| 1787 | unsigned long long st_ino; |
| 1788 | }; |
| 1789 | |
bellard | d2fd1af | 2007-11-14 18:08:56 +0000 | [diff] [blame] | 1790 | #elif defined(TARGET_I386) && !defined(TARGET_ABI32) |
| 1791 | struct target_stat { |
| 1792 | abi_ulong st_dev; |
| 1793 | abi_ulong st_ino; |
| 1794 | abi_ulong st_nlink; |
| 1795 | |
| 1796 | unsigned int st_mode; |
| 1797 | unsigned int st_uid; |
| 1798 | unsigned int st_gid; |
| 1799 | unsigned int __pad0; |
| 1800 | abi_ulong st_rdev; |
| 1801 | abi_long st_size; |
| 1802 | abi_long st_blksize; |
| 1803 | abi_long st_blocks; /* Number 512-byte blocks allocated. */ |
| 1804 | |
| 1805 | abi_ulong target_st_atime; |
| 1806 | abi_ulong target_st_atime_nsec; |
| 1807 | abi_ulong target_st_mtime; |
| 1808 | abi_ulong target_st_mtime_nsec; |
| 1809 | abi_ulong target_st_ctime; |
| 1810 | abi_ulong target_st_ctime_nsec; |
| 1811 | |
| 1812 | abi_long __unused[3]; |
| 1813 | }; |
Ulrich Hecht | a4c075f | 2009-07-24 16:57:31 +0200 | [diff] [blame] | 1814 | #elif defined(TARGET_S390X) |
| 1815 | struct target_stat { |
| 1816 | abi_ulong st_dev; |
| 1817 | abi_ulong st_ino; |
| 1818 | abi_ulong st_nlink; |
| 1819 | unsigned int st_mode; |
| 1820 | unsigned int st_uid; |
| 1821 | unsigned int st_gid; |
| 1822 | unsigned int __pad1; |
| 1823 | abi_ulong st_rdev; |
| 1824 | abi_ulong st_size; |
| 1825 | abi_ulong target_st_atime; |
| 1826 | abi_ulong target_st_atime_nsec; |
| 1827 | abi_ulong target_st_mtime; |
| 1828 | abi_ulong target_st_mtime_nsec; |
| 1829 | abi_ulong target_st_ctime; |
| 1830 | abi_ulong target_st_ctime_nsec; |
| 1831 | abi_ulong st_blksize; |
| 1832 | abi_long st_blocks; |
| 1833 | abi_ulong __unused[3]; |
| 1834 | }; |
Jia Liu | d962783 | 2012-07-20 15:50:52 +0800 | [diff] [blame] | 1835 | #elif defined(TARGET_OPENRISC) |
| 1836 | struct target_stat { |
| 1837 | abi_ulong st_dev; |
| 1838 | abi_ulong st_ino; |
| 1839 | abi_ulong st_nlink; |
| 1840 | |
| 1841 | unsigned int st_mode; |
| 1842 | unsigned int st_uid; |
| 1843 | unsigned int st_gid; |
| 1844 | unsigned int __pad0; |
| 1845 | abi_ulong st_rdev; |
| 1846 | abi_long st_size; |
| 1847 | abi_long st_blksize; |
| 1848 | abi_long st_blocks; /* Number 512-byte blocks allocated. */ |
| 1849 | |
| 1850 | abi_ulong target_st_atime; |
| 1851 | abi_ulong target_st_atime_nsec; |
| 1852 | abi_ulong target_st_mtime; |
| 1853 | abi_ulong target_st_mtime_nsec; |
| 1854 | abi_ulong target_st_ctime; |
| 1855 | abi_ulong target_st_ctime_nsec; |
| 1856 | |
| 1857 | abi_long __unused[3]; |
| 1858 | }; |
bellard | 048f6b4 | 2005-11-26 18:47:20 +0000 | [diff] [blame] | 1859 | #else |
| 1860 | #error unsupported CPU |
| 1861 | #endif |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 1862 | |
ths | 4ce6f8d | 2007-07-20 15:54:27 +0000 | [diff] [blame] | 1863 | typedef struct { |
| 1864 | int val[2]; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 1865 | } target_fsid_t; |
ths | 4ce6f8d | 2007-07-20 15:54:27 +0000 | [diff] [blame] | 1866 | |
bellard | 56c8f68 | 2005-11-28 22:28:41 +0000 | [diff] [blame] | 1867 | #ifdef TARGET_MIPS |
ths | d26bc21 | 2007-11-08 18:05:37 +0000 | [diff] [blame] | 1868 | #ifdef TARGET_ABI_MIPSN32 |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 1869 | struct target_statfs { |
| 1870 | int32_t f_type; |
| 1871 | int32_t f_bsize; |
| 1872 | int32_t f_frsize; /* Fragment size - unsupported */ |
| 1873 | int32_t f_blocks; |
| 1874 | int32_t f_bfree; |
| 1875 | int32_t f_files; |
| 1876 | int32_t f_ffree; |
| 1877 | int32_t f_bavail; |
| 1878 | |
| 1879 | /* Linux specials */ |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 1880 | target_fsid_t f_fsid; |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 1881 | int32_t f_namelen; |
| 1882 | int32_t f_spare[6]; |
| 1883 | }; |
| 1884 | #else |
bellard | 56c8f68 | 2005-11-28 22:28:41 +0000 | [diff] [blame] | 1885 | struct target_statfs { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1886 | abi_long f_type; |
| 1887 | abi_long f_bsize; |
| 1888 | abi_long f_frsize; /* Fragment size - unsupported */ |
| 1889 | abi_long f_blocks; |
| 1890 | abi_long f_bfree; |
| 1891 | abi_long f_files; |
| 1892 | abi_long f_ffree; |
| 1893 | abi_long f_bavail; |
bellard | 56c8f68 | 2005-11-28 22:28:41 +0000 | [diff] [blame] | 1894 | |
| 1895 | /* Linux specials */ |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 1896 | target_fsid_t f_fsid; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 1897 | abi_long f_namelen; |
| 1898 | abi_long f_spare[6]; |
bellard | 56c8f68 | 2005-11-28 22:28:41 +0000 | [diff] [blame] | 1899 | }; |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 1900 | #endif |
bellard | 56c8f68 | 2005-11-28 22:28:41 +0000 | [diff] [blame] | 1901 | |
| 1902 | struct target_statfs64 { |
| 1903 | uint32_t f_type; |
| 1904 | uint32_t f_bsize; |
| 1905 | uint32_t f_frsize; /* Fragment size - unsupported */ |
| 1906 | uint32_t __pad; |
| 1907 | uint64_t f_blocks; |
| 1908 | uint64_t f_bfree; |
| 1909 | uint64_t f_files; |
| 1910 | uint64_t f_ffree; |
| 1911 | uint64_t f_bavail; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 1912 | target_fsid_t f_fsid; |
bellard | 56c8f68 | 2005-11-28 22:28:41 +0000 | [diff] [blame] | 1913 | uint32_t f_namelen; |
| 1914 | uint32_t f_spare[6]; |
| 1915 | }; |
balrog | c4d1062 | 2008-07-19 09:38:52 +0000 | [diff] [blame] | 1916 | #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ |
| 1917 | defined(TARGET_SPARC64)) && !defined(TARGET_ABI32) |
j_mayer | 325e651 | 2007-11-21 13:06:54 +0000 | [diff] [blame] | 1918 | struct target_statfs { |
| 1919 | abi_long f_type; |
| 1920 | abi_long f_bsize; |
| 1921 | abi_long f_blocks; |
| 1922 | abi_long f_bfree; |
| 1923 | abi_long f_bavail; |
| 1924 | abi_long f_files; |
| 1925 | abi_long f_ffree; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 1926 | target_fsid_t f_fsid; |
j_mayer | 325e651 | 2007-11-21 13:06:54 +0000 | [diff] [blame] | 1927 | abi_long f_namelen; |
| 1928 | abi_long f_frsize; |
| 1929 | abi_long f_spare[5]; |
| 1930 | }; |
| 1931 | |
| 1932 | struct target_statfs64 { |
| 1933 | abi_long f_type; |
| 1934 | abi_long f_bsize; |
| 1935 | abi_long f_blocks; |
| 1936 | abi_long f_bfree; |
| 1937 | abi_long f_bavail; |
| 1938 | abi_long f_files; |
| 1939 | abi_long f_ffree; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 1940 | target_fsid_t f_fsid; |
j_mayer | 325e651 | 2007-11-21 13:06:54 +0000 | [diff] [blame] | 1941 | abi_long f_namelen; |
| 1942 | abi_long f_frsize; |
| 1943 | abi_long f_spare[5]; |
| 1944 | }; |
Ulrich Hecht | a4c075f | 2009-07-24 16:57:31 +0200 | [diff] [blame] | 1945 | #elif defined(TARGET_S390X) |
| 1946 | struct target_statfs { |
| 1947 | int32_t f_type; |
| 1948 | int32_t f_bsize; |
| 1949 | abi_long f_blocks; |
| 1950 | abi_long f_bfree; |
| 1951 | abi_long f_bavail; |
| 1952 | abi_long f_files; |
| 1953 | abi_long f_ffree; |
| 1954 | kernel_fsid_t f_fsid; |
| 1955 | int32_t f_namelen; |
| 1956 | int32_t f_frsize; |
| 1957 | int32_t f_spare[5]; |
| 1958 | }; |
| 1959 | |
| 1960 | struct target_statfs64 { |
| 1961 | int32_t f_type; |
| 1962 | int32_t f_bsize; |
| 1963 | abi_long f_blocks; |
| 1964 | abi_long f_bfree; |
| 1965 | abi_long f_bavail; |
| 1966 | abi_long f_files; |
| 1967 | abi_long f_ffree; |
| 1968 | kernel_fsid_t f_fsid; |
| 1969 | int32_t f_namelen; |
| 1970 | int32_t f_frsize; |
| 1971 | int32_t f_spare[5]; |
| 1972 | }; |
bellard | 56c8f68 | 2005-11-28 22:28:41 +0000 | [diff] [blame] | 1973 | #else |
| 1974 | struct target_statfs { |
| 1975 | uint32_t f_type; |
| 1976 | uint32_t f_bsize; |
| 1977 | uint32_t f_blocks; |
| 1978 | uint32_t f_bfree; |
| 1979 | uint32_t f_bavail; |
| 1980 | uint32_t f_files; |
| 1981 | uint32_t f_ffree; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 1982 | target_fsid_t f_fsid; |
bellard | 56c8f68 | 2005-11-28 22:28:41 +0000 | [diff] [blame] | 1983 | uint32_t f_namelen; |
| 1984 | uint32_t f_frsize; |
| 1985 | uint32_t f_spare[5]; |
| 1986 | }; |
| 1987 | |
| 1988 | struct target_statfs64 { |
| 1989 | uint32_t f_type; |
| 1990 | uint32_t f_bsize; |
| 1991 | uint64_t f_blocks; |
| 1992 | uint64_t f_bfree; |
| 1993 | uint64_t f_bavail; |
| 1994 | uint64_t f_files; |
| 1995 | uint64_t f_ffree; |
Anthony Liguori | c227f09 | 2009-10-01 16:12:16 -0500 | [diff] [blame] | 1996 | target_fsid_t f_fsid; |
bellard | 56c8f68 | 2005-11-28 22:28:41 +0000 | [diff] [blame] | 1997 | uint32_t f_namelen; |
| 1998 | uint32_t f_frsize; |
| 1999 | uint32_t f_spare[5]; |
| 2000 | }; |
| 2001 | #endif |
| 2002 | |
| 2003 | |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 2004 | #define TARGET_F_DUPFD 0 /* dup */ |
| 2005 | #define TARGET_F_GETFD 1 /* get close_on_exec */ |
| 2006 | #define TARGET_F_SETFD 2 /* set/clear close_on_exec */ |
| 2007 | #define TARGET_F_GETFL 3 /* get file->f_flags */ |
| 2008 | #define TARGET_F_SETFL 4 /* set file->f_flags */ |
| 2009 | |
| 2010 | #if defined(TARGET_ALPHA) |
| 2011 | #define TARGET_F_GETLK 7 |
| 2012 | #define TARGET_F_SETLK 8 |
| 2013 | #define TARGET_F_SETLKW 9 |
| 2014 | #define TARGET_F_SETOWN 5 /* for sockets. */ |
| 2015 | #define TARGET_F_GETOWN 6 /* for sockets. */ |
Arnaud Patard (Rtp) | 5f10681 | 2009-06-03 14:35:04 +0200 | [diff] [blame] | 2016 | #elif defined(TARGET_MIPS) |
| 2017 | #define TARGET_F_GETLK 14 |
| 2018 | #define TARGET_F_SETLK 6 |
| 2019 | #define TARGET_F_SETLKW 7 |
| 2020 | #define TARGET_F_SETOWN 24 /* for sockets. */ |
| 2021 | #define TARGET_F_GETOWN 25 /* for sockets. */ |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 2022 | #else |
| 2023 | #define TARGET_F_GETLK 5 |
| 2024 | #define TARGET_F_SETLK 6 |
| 2025 | #define TARGET_F_SETLKW 7 |
| 2026 | #define TARGET_F_SETOWN 8 /* for sockets. */ |
| 2027 | #define TARGET_F_GETOWN 9 /* for sockets. */ |
| 2028 | #endif |
| 2029 | |
| 2030 | #define TARGET_F_SETSIG 10 /* for sockets. */ |
| 2031 | #define TARGET_F_GETSIG 11 /* for sockets. */ |
| 2032 | |
Arnaud Patard (Rtp) | 5f10681 | 2009-06-03 14:35:04 +0200 | [diff] [blame] | 2033 | #if defined(TARGET_MIPS) |
| 2034 | #define TARGET_F_GETLK64 33 /* using 'struct flock64' */ |
| 2035 | #define TARGET_F_SETLK64 34 |
| 2036 | #define TARGET_F_SETLKW64 35 |
| 2037 | #else |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 2038 | #define TARGET_F_GETLK64 12 /* using 'struct flock64' */ |
| 2039 | #define TARGET_F_SETLK64 13 |
| 2040 | #define TARGET_F_SETLKW64 14 |
Arnaud Patard (Rtp) | 5f10681 | 2009-06-03 14:35:04 +0200 | [diff] [blame] | 2041 | #endif |
Ulrich Hecht | 7e22e54 | 2009-07-24 19:10:27 +0200 | [diff] [blame] | 2042 | |
| 2043 | #define TARGET_F_LINUX_SPECIFIC_BASE 1024 |
| 2044 | #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0) |
| 2045 | #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1) |
| 2046 | #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) |
| 2047 | #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2) |
| 2048 | |
Richard Henderson | 4eeea4f | 2012-07-25 14:29:31 -0700 | [diff] [blame] | 2049 | #if defined(TARGET_ALPHA) |
| 2050 | #define TARGET_O_NONBLOCK 04 |
| 2051 | #define TARGET_O_APPEND 010 |
| 2052 | #define TARGET_O_CREAT 01000 /* not fcntl */ |
| 2053 | #define TARGET_O_TRUNC 02000 /* not fcntl */ |
| 2054 | #define TARGET_O_EXCL 04000 /* not fcntl */ |
| 2055 | #define TARGET_O_NOCTTY 010000 /* not fcntl */ |
| 2056 | #define TARGET_O_DSYNC 040000 |
| 2057 | #define TARGET_O_LARGEFILE 0 /* not necessary, always 64-bit */ |
| 2058 | #define TARGET_O_DIRECTORY 0100000 /* must be a directory */ |
| 2059 | #define TARGET_O_NOFOLLOW 0200000 /* don't follow links */ |
| 2060 | #define TARGET_O_DIRECT 02000000 /* direct disk access hint */ |
| 2061 | #define TARGET_O_NOATIME 04000000 |
| 2062 | #define TARGET_O_CLOEXEC 010000000 |
| 2063 | #define TARGET___O_SYNC 020000000 |
| 2064 | #define TARGET_O_PATH 040000000 |
| 2065 | #elif defined(TARGET_ARM) || defined(TARGET_M68K) |
bellard | f09936a | 2004-01-18 22:39:25 +0000 | [diff] [blame] | 2066 | #define TARGET_O_DIRECTORY 040000 /* must be a directory */ |
| 2067 | #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ |
| 2068 | #define TARGET_O_DIRECT 0200000 /* direct disk access hint */ |
| 2069 | #define TARGET_O_LARGEFILE 0400000 |
Richard Henderson | 4eeea4f | 2012-07-25 14:29:31 -0700 | [diff] [blame] | 2070 | #elif defined(TARGET_MIPS) |
| 2071 | #define TARGET_O_APPEND 0x0008 |
| 2072 | #define TARGET_O_DSYNC 0x0010 |
| 2073 | #define TARGET_O_NONBLOCK 0x0080 |
| 2074 | #define TARGET_O_CREAT 0x0100 /* not fcntl */ |
| 2075 | #define TARGET_O_TRUNC 0x0200 /* not fcntl */ |
| 2076 | #define TARGET_O_EXCL 0x0400 /* not fcntl */ |
| 2077 | #define TARGET_O_NOCTTY 0x0800 /* not fcntl */ |
| 2078 | #define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */ |
| 2079 | #define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */ |
| 2080 | #define TARGET___O_SYNC 0x4000 |
| 2081 | #define TARGET_O_DIRECT 0x8000 /* direct disk access hint */ |
bellard | f09936a | 2004-01-18 22:39:25 +0000 | [diff] [blame] | 2082 | #elif defined (TARGET_PPC) |
Edgar E. Iglesias | b779e29 | 2009-05-20 21:31:33 +0200 | [diff] [blame] | 2083 | #define TARGET_O_DIRECTORY 040000 /* must be a directory */ |
| 2084 | #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ |
| 2085 | #define TARGET_O_LARGEFILE 0200000 |
| 2086 | #define TARGET_O_DIRECT 0400000 /* direct disk access hint */ |
bellard | 6d5e216 | 2004-09-30 22:04:13 +0000 | [diff] [blame] | 2087 | #elif defined (TARGET_SPARC) |
Richard Henderson | 4eeea4f | 2012-07-25 14:29:31 -0700 | [diff] [blame] | 2088 | #define TARGET_O_APPEND 0x0008 |
| 2089 | #define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */ |
| 2090 | #define TARGET_O_CREAT 0x0200 /* not fcntl */ |
| 2091 | #define TARGET_O_TRUNC 0x0400 /* not fcntl */ |
| 2092 | #define TARGET_O_EXCL 0x0800 /* not fcntl */ |
| 2093 | #define TARGET_O_DSYNC 0x2000 |
| 2094 | #define TARGET_O_NONBLOCK 0x4000 |
| 2095 | # ifdef TARGET_SPARC64 |
| 2096 | # define TARGET_O_NDELAY 0x0004 |
| 2097 | # else |
| 2098 | # define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK) |
| 2099 | # endif |
| 2100 | #define TARGET_O_NOCTTY 0x8000 /* not fcntl */ |
bellard | 6d5e216 | 2004-09-30 22:04:13 +0000 | [diff] [blame] | 2101 | #define TARGET_O_LARGEFILE 0x40000 |
Richard Henderson | 4eeea4f | 2012-07-25 14:29:31 -0700 | [diff] [blame] | 2102 | #define TARGET_O_DIRECT 0x100000 /* direct disk access hint */ |
| 2103 | #define TARGET_O_NOATIME 0x200000 |
| 2104 | #define TARGET_O_CLOEXEC 0x400000 |
| 2105 | #define TARGET___O_SYNC 0x800000 |
| 2106 | #define TARGET_O_PATH 0x1000000 |
| 2107 | #endif |
| 2108 | |
| 2109 | /* <asm-generic/fcntl.h> values follow. */ |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 2110 | #define TARGET_O_ACCMODE 0003 |
| 2111 | #define TARGET_O_RDONLY 00 |
| 2112 | #define TARGET_O_WRONLY 01 |
| 2113 | #define TARGET_O_RDWR 02 |
Richard Henderson | 4eeea4f | 2012-07-25 14:29:31 -0700 | [diff] [blame] | 2114 | #ifndef TARGET_O_CREAT |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 2115 | #define TARGET_O_CREAT 0100 /* not fcntl */ |
Richard Henderson | 4eeea4f | 2012-07-25 14:29:31 -0700 | [diff] [blame] | 2116 | #endif |
| 2117 | #ifndef TARGET_O_EXCL |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 2118 | #define TARGET_O_EXCL 0200 /* not fcntl */ |
Richard Henderson | 4eeea4f | 2012-07-25 14:29:31 -0700 | [diff] [blame] | 2119 | #endif |
| 2120 | #ifndef TARGET_O_NOCTTY |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 2121 | #define TARGET_O_NOCTTY 0400 /* not fcntl */ |
Richard Henderson | 4eeea4f | 2012-07-25 14:29:31 -0700 | [diff] [blame] | 2122 | #endif |
| 2123 | #ifndef TARGET_O_TRUNC |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 2124 | #define TARGET_O_TRUNC 01000 /* not fcntl */ |
Richard Henderson | 4eeea4f | 2012-07-25 14:29:31 -0700 | [diff] [blame] | 2125 | #endif |
| 2126 | #ifndef TARGET_O_APPEND |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 2127 | #define TARGET_O_APPEND 02000 |
Richard Henderson | 4eeea4f | 2012-07-25 14:29:31 -0700 | [diff] [blame] | 2128 | #endif |
| 2129 | #ifndef TARGET_O_NONBLOCK |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 2130 | #define TARGET_O_NONBLOCK 04000 |
Richard Henderson | 4eeea4f | 2012-07-25 14:29:31 -0700 | [diff] [blame] | 2131 | #endif |
| 2132 | #ifndef TARGET_O_DSYNC |
| 2133 | #define TARGET_O_DSYNC 010000 |
| 2134 | #endif |
| 2135 | #ifndef TARGET_FASYNC |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 2136 | #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ |
Richard Henderson | 4eeea4f | 2012-07-25 14:29:31 -0700 | [diff] [blame] | 2137 | #endif |
| 2138 | #ifndef TARGET_O_DIRECT |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 2139 | #define TARGET_O_DIRECT 040000 /* direct disk access hint */ |
Richard Henderson | 4eeea4f | 2012-07-25 14:29:31 -0700 | [diff] [blame] | 2140 | #endif |
| 2141 | #ifndef TARGET_O_LARGEFILE |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 2142 | #define TARGET_O_LARGEFILE 0100000 |
Richard Henderson | 4eeea4f | 2012-07-25 14:29:31 -0700 | [diff] [blame] | 2143 | #endif |
| 2144 | #ifndef TARGET_O_DIRECTORY |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 2145 | #define TARGET_O_DIRECTORY 0200000 /* must be a directory */ |
Richard Henderson | 4eeea4f | 2012-07-25 14:29:31 -0700 | [diff] [blame] | 2146 | #endif |
| 2147 | #ifndef TARGET_O_NOFOLLOW |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 2148 | #define TARGET_O_NOFOLLOW 0400000 /* don't follow links */ |
| 2149 | #endif |
Richard Henderson | 4eeea4f | 2012-07-25 14:29:31 -0700 | [diff] [blame] | 2150 | #ifndef TARGET_O_NOATIME |
| 2151 | #define TARGET_O_NOATIME 01000000 |
| 2152 | #endif |
| 2153 | #ifndef TARGET_O_CLOEXEC |
| 2154 | #define TARGET_O_CLOEXEC 02000000 |
| 2155 | #endif |
| 2156 | #ifndef TARGET___O_SYNC |
| 2157 | #define TARGET___O_SYNC 04000000 |
| 2158 | #endif |
| 2159 | #ifndef TARGET_O_PATH |
| 2160 | #define TARGET_O_PATH 010000000 |
| 2161 | #endif |
| 2162 | #ifndef TARGET_O_NDELAY |
| 2163 | #define TARGET_O_NDELAY TARGET_O_NONBLOCK |
| 2164 | #endif |
| 2165 | #ifndef TARGET_O_SYNC |
| 2166 | #define TARGET_O_SYNC (TARGET___O_SYNC | TARGET_O_DSYNC) |
| 2167 | #endif |
bellard | ffa65c3 | 2004-01-04 23:57:22 +0000 | [diff] [blame] | 2168 | |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 2169 | struct target_flock { |
| 2170 | short l_type; |
| 2171 | short l_whence; |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 2172 | abi_ulong l_start; |
| 2173 | abi_ulong l_len; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 2174 | int l_pid; |
| 2175 | }; |
| 2176 | |
| 2177 | struct target_flock64 { |
| 2178 | short l_type; |
| 2179 | short l_whence; |
Edgar E. Iglesias | b779e29 | 2009-05-20 21:31:33 +0200 | [diff] [blame] | 2180 | #if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) || defined(TARGET_SPARC) || defined(TARGET_HPPA) || defined (TARGET_MICROBLAZE) |
aurel32 | ce3f0e2 | 2008-03-28 22:31:51 +0000 | [diff] [blame] | 2181 | int __pad; |
| 2182 | #endif |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 2183 | unsigned long long l_start; |
| 2184 | unsigned long long l_len; |
| 2185 | int l_pid; |
Stefan Weil | 541dc0d | 2011-08-31 12:38:01 +0200 | [diff] [blame] | 2186 | } QEMU_PACKED; |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 2187 | |
pbrook | ce4defa | 2006-02-09 16:49:55 +0000 | [diff] [blame] | 2188 | #ifdef TARGET_ARM |
| 2189 | struct target_eabi_flock64 { |
| 2190 | short l_type; |
| 2191 | short l_whence; |
| 2192 | int __pad; |
| 2193 | unsigned long long l_start; |
| 2194 | unsigned long long l_len; |
| 2195 | int l_pid; |
Stefan Weil | 541dc0d | 2011-08-31 12:38:01 +0200 | [diff] [blame] | 2196 | } QEMU_PACKED; |
pbrook | ce4defa | 2006-02-09 16:49:55 +0000 | [diff] [blame] | 2197 | #endif |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 2198 | |
| 2199 | /* soundcard defines */ |
| 2200 | /* XXX: convert them all to arch indepedent entries */ |
| 2201 | #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); |
| 2202 | #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 |
| 2203 | #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 |
| 2204 | #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 |
| 2205 | #define TARGET_SNDCTL_COPR_RDATA 0xc0144302 |
| 2206 | #define TARGET_SNDCTL_COPR_RESET 0x00004300 |
| 2207 | #define TARGET_SNDCTL_COPR_RUN 0xc0144306 |
| 2208 | #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 |
| 2209 | #define TARGET_SNDCTL_COPR_WCODE 0x40144305 |
| 2210 | #define TARGET_SNDCTL_COPR_WDATA 0x40144304 |
| 2211 | #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) |
| 2212 | #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) |
| 2213 | #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) |
| 2214 | #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) |
| 2215 | #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) |
| 2216 | #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) |
| 2217 | #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) |
| 2218 | #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) |
| 2219 | #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) |
| 2220 | #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) |
| 2221 | #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) |
| 2222 | #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) |
| 2223 | #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) |
| 2224 | #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) |
| 2225 | #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) |
| 2226 | #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) |
| 2227 | #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) |
| 2228 | #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) |
Peter Maydell | 5f72307 | 2012-07-23 08:06:15 +0000 | [diff] [blame^] | 2229 | #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19) |
| 2230 | #define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20) |
bellard | 2521d69 | 2003-06-15 19:58:13 +0000 | [diff] [blame] | 2231 | #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e |
| 2232 | #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 |
| 2233 | #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 |
| 2234 | #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 |
| 2235 | #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 |
| 2236 | #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f |
| 2237 | #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 |
| 2238 | #define TARGET_SNDCTL_MIDI_INFO 0xc074510c |
| 2239 | #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 |
| 2240 | #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 |
| 2241 | #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 |
| 2242 | #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 |
| 2243 | #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 |
| 2244 | #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 |
| 2245 | #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 |
| 2246 | #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 |
| 2247 | #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b |
| 2248 | #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a |
| 2249 | #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 |
| 2250 | #define TARGET_SNDCTL_SEQ_PANIC 0x00005111 |
| 2251 | #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 |
| 2252 | #define TARGET_SNDCTL_SEQ_RESET 0x00005100 |
| 2253 | #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 |
| 2254 | #define TARGET_SNDCTL_SEQ_SYNC 0x00005101 |
| 2255 | #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 |
| 2256 | #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d |
| 2257 | #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d |
| 2258 | #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 |
| 2259 | #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e |
| 2260 | #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 |
| 2261 | #define TARGET_SNDCTL_TMR_METRONOME 0x40045407 |
| 2262 | #define TARGET_SNDCTL_TMR_SELECT 0x40045408 |
| 2263 | #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 |
| 2264 | #define TARGET_SNDCTL_TMR_START 0x00005402 |
| 2265 | #define TARGET_SNDCTL_TMR_STOP 0x00005403 |
| 2266 | #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 |
| 2267 | #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 |
| 2268 | #define TARGET_SOUND_PCM_READ_RATE 0x80045002 |
| 2269 | #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 |
| 2270 | #define TARGET_SOUND_PCM_READ_BITS 0x80045005 |
| 2271 | #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 |
| 2272 | #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) |
| 2273 | #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 |
| 2274 | #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) |
| 2275 | #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) |
| 2276 | #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) |
| 2277 | #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) |
| 2278 | #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) |
| 2279 | |
| 2280 | #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) |
| 2281 | |
| 2282 | #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME) |
| 2283 | #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) |
| 2284 | #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE) |
| 2285 | #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) |
| 2286 | #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) |
| 2287 | #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER) |
| 2288 | #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) |
| 2289 | #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) |
| 2290 | #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) |
| 2291 | #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) |
| 2292 | #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM) |
| 2293 | #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV) |
| 2294 | #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) |
| 2295 | #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) |
| 2296 | #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) |
| 2297 | #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) |
| 2298 | #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) |
| 2299 | |
| 2300 | /* Obsolete macros */ |
| 2301 | #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) |
| 2302 | #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE) |
| 2303 | #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) |
| 2304 | |
| 2305 | #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC) |
| 2306 | #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK) |
| 2307 | #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK) |
| 2308 | #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS) |
| 2309 | #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) |
| 2310 | |
| 2311 | #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) |
| 2312 | |
| 2313 | #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME) |
| 2314 | #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) |
| 2315 | #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE) |
| 2316 | #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH) |
| 2317 | #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) |
| 2318 | #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER) |
| 2319 | #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) |
| 2320 | #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) |
| 2321 | #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) |
| 2322 | #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) |
| 2323 | #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM) |
| 2324 | #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV) |
| 2325 | #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN) |
| 2326 | #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN) |
| 2327 | #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1) |
| 2328 | #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2) |
| 2329 | #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3) |
| 2330 | |
| 2331 | /* Obsolete macros */ |
| 2332 | #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) |
| 2333 | #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE) |
| 2334 | #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) |
| 2335 | |
| 2336 | #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC) |
| 2337 | |
| 2338 | /* vfat ioctls */ |
| 2339 | #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) |
| 2340 | #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) |
bellard | a5448a7 | 2004-06-19 16:59:03 +0000 | [diff] [blame] | 2341 | |
balrog | 8fbd6b5 | 2008-09-20 03:03:09 +0000 | [diff] [blame] | 2342 | #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct mtop) |
| 2343 | #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct mtget) |
| 2344 | #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct mtpos) |
| 2345 | |
bellard | a5448a7 | 2004-06-19 16:59:03 +0000 | [diff] [blame] | 2346 | struct target_sysinfo { |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 2347 | abi_long uptime; /* Seconds since boot */ |
| 2348 | abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */ |
| 2349 | abi_ulong totalram; /* Total usable main memory size */ |
| 2350 | abi_ulong freeram; /* Available memory size */ |
| 2351 | abi_ulong sharedram; /* Amount of shared memory */ |
| 2352 | abi_ulong bufferram; /* Memory used by buffers */ |
| 2353 | abi_ulong totalswap; /* Total swap space size */ |
| 2354 | abi_ulong freeswap; /* swap space still available */ |
bellard | a5448a7 | 2004-06-19 16:59:03 +0000 | [diff] [blame] | 2355 | unsigned short procs; /* Number of current processes */ |
| 2356 | unsigned short pad; /* explicit padding for m68k */ |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 2357 | abi_ulong totalhigh; /* Total high memory size */ |
| 2358 | abi_ulong freehigh; /* Available high memory size */ |
bellard | a5448a7 | 2004-06-19 16:59:03 +0000 | [diff] [blame] | 2359 | unsigned int mem_unit; /* Memory unit size in bytes */ |
blueswir1 | 992f48a | 2007-10-14 16:27:31 +0000 | [diff] [blame] | 2360 | char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ |
bellard | a5448a7 | 2004-06-19 16:59:03 +0000 | [diff] [blame] | 2361 | }; |
bellard | 3532fa7 | 2006-06-24 15:06:03 +0000 | [diff] [blame] | 2362 | |
aurel32 | 6556a83 | 2008-10-13 21:08:17 +0000 | [diff] [blame] | 2363 | struct linux_dirent { |
| 2364 | long d_ino; |
| 2365 | unsigned long d_off; |
| 2366 | unsigned short d_reclen; |
| 2367 | char d_name[256]; /* We must not include limits.h! */ |
| 2368 | }; |
| 2369 | |
| 2370 | struct linux_dirent64 { |
| 2371 | uint64_t d_ino; |
| 2372 | int64_t d_off; |
| 2373 | unsigned short d_reclen; |
| 2374 | unsigned char d_type; |
| 2375 | char d_name[256]; |
| 2376 | }; |
| 2377 | |
aurel32 | 24e1003 | 2009-04-15 16:11:43 +0000 | [diff] [blame] | 2378 | struct target_mq_attr { |
| 2379 | abi_long mq_flags; |
| 2380 | abi_long mq_maxmsg; |
| 2381 | abi_long mq_msgsize; |
| 2382 | abi_long mq_curmsgs; |
| 2383 | }; |
| 2384 | |
bellard | 3532fa7 | 2006-06-24 15:06:03 +0000 | [diff] [blame] | 2385 | #include "socket.h" |
ths | 637947f | 2007-06-01 12:09:19 +0000 | [diff] [blame] | 2386 | |
| 2387 | #include "errno_defs.h" |
Riku Voipio | 03dfe9f | 2009-06-18 22:51:31 +0300 | [diff] [blame] | 2388 | |
| 2389 | #define FUTEX_WAIT 0 |
| 2390 | #define FUTEX_WAKE 1 |
| 2391 | #define FUTEX_FD 2 |
| 2392 | #define FUTEX_REQUEUE 3 |
| 2393 | #define FUTEX_CMP_REQUEUE 4 |
| 2394 | #define FUTEX_WAKE_OP 5 |
| 2395 | #define FUTEX_LOCK_PI 6 |
| 2396 | #define FUTEX_UNLOCK_PI 7 |
| 2397 | #define FUTEX_TRYLOCK_PI 8 |
| 2398 | #define FUTEX_WAIT_BITSET 9 |
| 2399 | #define FUTEX_WAKE_BITSET 10 |
| 2400 | |
| 2401 | #define FUTEX_PRIVATE_FLAG 128 |
| 2402 | #define FUTEX_CLOCK_REALTIME 256 |
| 2403 | #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME) |
| 2404 | |
Peter Maydell | 3b6edd1 | 2011-02-15 18:35:05 +0000 | [diff] [blame] | 2405 | #ifdef CONFIG_EPOLL |
| 2406 | typedef union target_epoll_data { |
| 2407 | abi_ulong ptr; |
| 2408 | abi_ulong fd; |
| 2409 | uint32_t u32; |
| 2410 | uint64_t u64; |
| 2411 | } target_epoll_data_t; |
| 2412 | |
| 2413 | struct target_epoll_event { |
| 2414 | uint32_t events; |
| 2415 | target_epoll_data_t data; |
| 2416 | }; |
| 2417 | #endif |
Peter Maydell | 163a05a | 2011-06-27 17:44:52 +0100 | [diff] [blame] | 2418 | struct target_rlimit64 { |
| 2419 | uint64_t rlim_cur; |
| 2420 | uint64_t rlim_max; |
| 2421 | }; |
Akos PASZTORY | 583359a | 2011-11-14 15:09:49 +0200 | [diff] [blame] | 2422 | |
| 2423 | struct target_ucred { |
| 2424 | uint32_t pid; |
| 2425 | uint32_t uid; |
| 2426 | uint32_t gid; |
| 2427 | }; |