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