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