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