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