1 //===-- sanitizer_platform_limits_posix.h ---------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file is a part of Sanitizer common code. 11 // 12 // Sizes and layouts of platform-specific POSIX data structures. 13 //===----------------------------------------------------------------------===// 14 15 #ifndef SANITIZER_PLATFORM_LIMITS_POSIX_H 16 #define SANITIZER_PLATFORM_LIMITS_POSIX_H 17 18 #include "sanitizer_internal_defs.h" 19 #include "sanitizer_platform.h" 20 21 #if SANITIZER_FREEBSD 22 // FreeBSD's dlopen() returns a pointer to an Obj_Entry structure that 23 // incroporates the map structure. 24 # define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) \ 25 ((link_map*)((handle) == nullptr ? nullptr : ((char*)(handle) + 544))) 26 #else 27 # define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) ((link_map*)(handle)) 28 #endif // !SANITIZER_FREEBSD 29 30 namespace __sanitizer { 31 extern unsigned struct_utsname_sz; 32 extern unsigned struct_stat_sz; 33 #if !SANITIZER_FREEBSD && !SANITIZER_IOS 34 extern unsigned struct_stat64_sz; 35 #endif 36 extern unsigned struct_rusage_sz; 37 extern unsigned siginfo_t_sz; 38 extern unsigned struct_itimerval_sz; 39 extern unsigned pthread_t_sz; 40 extern unsigned pthread_cond_t_sz; 41 extern unsigned pid_t_sz; 42 extern unsigned timeval_sz; 43 extern unsigned uid_t_sz; 44 extern unsigned gid_t_sz; 45 extern unsigned mbstate_t_sz; 46 extern unsigned struct_timezone_sz; 47 extern unsigned struct_tms_sz; 48 extern unsigned struct_itimerspec_sz; 49 extern unsigned struct_sigevent_sz; 50 extern unsigned struct_sched_param_sz; 51 extern unsigned struct_statfs64_sz; 52 53 #if !SANITIZER_ANDROID 54 extern unsigned struct_statfs_sz; 55 extern unsigned struct_sockaddr_sz; 56 extern unsigned ucontext_t_sz; 57 #endif // !SANITIZER_ANDROID 58 59 #if SANITIZER_LINUX 60 61 #if defined(__x86_64__) 62 const unsigned struct_kernel_stat_sz = 144; 63 const unsigned struct_kernel_stat64_sz = 0; 64 #elif defined(__i386__) 65 const unsigned struct_kernel_stat_sz = 64; 66 const unsigned struct_kernel_stat64_sz = 96; 67 #elif defined(__arm__) 68 const unsigned struct_kernel_stat_sz = 64; 69 const unsigned struct_kernel_stat64_sz = 104; 70 #elif defined(__aarch64__) 71 const unsigned struct_kernel_stat_sz = 128; 72 const unsigned struct_kernel_stat64_sz = 104; 73 #elif defined(__powerpc__) && !defined(__powerpc64__) 74 const unsigned struct_kernel_stat_sz = 72; 75 const unsigned struct_kernel_stat64_sz = 104; 76 #elif defined(__powerpc64__) 77 const unsigned struct_kernel_stat_sz = 144; 78 const unsigned struct_kernel_stat64_sz = 104; 79 #elif defined(__mips__) 80 #if SANITIZER_WORDSIZE == 64 81 const unsigned struct_kernel_stat_sz = 216; 82 #else 83 const unsigned struct_kernel_stat_sz = 144; 84 #endif 85 const unsigned struct_kernel_stat64_sz = 104; 86 #endif 87 struct __sanitizer_perf_event_attr { 88 unsigned type; 89 unsigned size; 90 // More fields that vary with the kernel version. 91 }; 92 93 extern unsigned struct_epoll_event_sz; 94 extern unsigned struct_sysinfo_sz; 95 extern unsigned __user_cap_header_struct_sz; 96 extern unsigned __user_cap_data_struct_sz; 97 extern unsigned struct_new_utsname_sz; 98 extern unsigned struct_old_utsname_sz; 99 extern unsigned struct_oldold_utsname_sz; 100 101 const unsigned struct_kexec_segment_sz = 4 * sizeof(unsigned long); 102 #endif // SANITIZER_LINUX 103 104 #if SANITIZER_LINUX || SANITIZER_FREEBSD 105 106 #if defined(__powerpc64__) 107 const unsigned struct___old_kernel_stat_sz = 0; 108 #else 109 const unsigned struct___old_kernel_stat_sz = 32; 110 #endif 111 112 extern unsigned struct_rlimit_sz; 113 extern unsigned struct_utimbuf_sz; 114 extern unsigned struct_timespec_sz; 115 116 struct __sanitizer_iocb { 117 u64 aio_data; 118 u32 aio_key_or_aio_reserved1; // Simply crazy. 119 u32 aio_reserved1_or_aio_key; // Luckily, we don't need these. 120 u16 aio_lio_opcode; 121 s16 aio_reqprio; 122 u32 aio_fildes; 123 u64 aio_buf; 124 u64 aio_nbytes; 125 s64 aio_offset; 126 u64 aio_reserved2; 127 u64 aio_reserved3; 128 }; 129 130 struct __sanitizer_io_event { 131 u64 data; 132 u64 obj; 133 u64 res; 134 u64 res2; 135 }; 136 137 const unsigned iocb_cmd_pread = 0; 138 const unsigned iocb_cmd_pwrite = 1; 139 const unsigned iocb_cmd_preadv = 7; 140 const unsigned iocb_cmd_pwritev = 8; 141 142 struct __sanitizer___sysctl_args { 143 int *name; 144 int nlen; 145 void *oldval; 146 uptr *oldlenp; 147 void *newval; 148 uptr newlen; 149 unsigned long ___unused[4]; 150 }; 151 152 const unsigned old_sigset_t_sz = sizeof(unsigned long); 153 154 struct __sanitizer_sem_t { 155 #if SANITIZER_ANDROID && defined(_LP64) 156 int data[4]; 157 #elif SANITIZER_ANDROID && !defined(_LP64) 158 int data; 159 #elif SANITIZER_LINUX 160 uptr data[4]; 161 #elif SANITIZER_FREEBSD 162 u32 data[4]; 163 #endif 164 }; 165 #endif // SANITIZER_LINUX || SANITIZER_FREEBSD 166 167 #if SANITIZER_ANDROID 168 struct __sanitizer_mallinfo { 169 uptr v[10]; 170 }; 171 #endif 172 173 #if SANITIZER_LINUX && !SANITIZER_ANDROID 174 struct __sanitizer_mallinfo { 175 int v[10]; 176 }; 177 178 extern unsigned struct_ustat_sz; 179 extern unsigned struct_rlimit64_sz; 180 extern unsigned struct_statvfs64_sz; 181 182 struct __sanitizer_ipc_perm { 183 int __key; 184 int uid; 185 int gid; 186 int cuid; 187 int cgid; 188 #ifdef __powerpc__ 189 unsigned mode; 190 unsigned __seq; 191 u64 __unused1; 192 u64 __unused2; 193 #elif defined(__mips__) || defined(__aarch64__) 194 unsigned int mode; 195 unsigned short __seq; 196 unsigned short __pad1; 197 unsigned long __unused1; 198 unsigned long __unused2; 199 #else 200 unsigned short mode; 201 unsigned short __pad1; 202 unsigned short __seq; 203 unsigned short __pad2; 204 #if defined(__x86_64__) && !defined(_LP64) 205 u64 __unused1; 206 u64 __unused2; 207 #else 208 unsigned long __unused1; 209 unsigned long __unused2; 210 #endif 211 #endif 212 }; 213 214 struct __sanitizer_shmid_ds { 215 __sanitizer_ipc_perm shm_perm; 216 #ifndef __powerpc__ 217 uptr shm_segsz; 218 #elif !defined(__powerpc64__) 219 uptr __unused0; 220 #endif 221 #if defined(__x86_64__) && !defined(_LP64) 222 u64 shm_atime; 223 u64 shm_dtime; 224 u64 shm_ctime; 225 #else 226 uptr shm_atime; 227 #if !defined(_LP64) && !defined(__mips__) 228 uptr __unused1; 229 #endif 230 uptr shm_dtime; 231 #if !defined(_LP64) && !defined(__mips__) 232 uptr __unused2; 233 #endif 234 uptr shm_ctime; 235 #if !defined(_LP64) && !defined(__mips__) 236 uptr __unused3; 237 #endif 238 #endif 239 #ifdef __powerpc__ 240 uptr shm_segsz; 241 #endif 242 int shm_cpid; 243 int shm_lpid; 244 #if defined(__x86_64__) && !defined(_LP64) 245 u64 shm_nattch; 246 u64 __unused4; 247 u64 __unused5; 248 #else 249 uptr shm_nattch; 250 uptr __unused4; 251 uptr __unused5; 252 #endif 253 }; 254 #elif SANITIZER_FREEBSD 255 struct __sanitizer_ipc_perm { 256 unsigned int cuid; 257 unsigned int cgid; 258 unsigned int uid; 259 unsigned int gid; 260 unsigned short mode; 261 unsigned short seq; 262 long key; 263 }; 264 265 struct __sanitizer_shmid_ds { 266 __sanitizer_ipc_perm shm_perm; 267 unsigned long shm_segsz; 268 unsigned int shm_lpid; 269 unsigned int shm_cpid; 270 int shm_nattch; 271 unsigned long shm_atime; 272 unsigned long shm_dtime; 273 unsigned long shm_ctime; 274 }; 275 #endif 276 277 #if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID 278 extern unsigned struct_msqid_ds_sz; 279 extern unsigned struct_mq_attr_sz; 280 extern unsigned struct_timex_sz; 281 extern unsigned struct_statvfs_sz; 282 #endif // (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID 283 284 struct __sanitizer_iovec { 285 void *iov_base; 286 uptr iov_len; 287 }; 288 289 #if !SANITIZER_ANDROID 290 struct __sanitizer_ifaddrs { 291 struct __sanitizer_ifaddrs *ifa_next; 292 char *ifa_name; 293 unsigned int ifa_flags; 294 void *ifa_addr; // (struct sockaddr *) 295 void *ifa_netmask; // (struct sockaddr *) 296 // This is a union on Linux. 297 # ifdef ifa_dstaddr 298 # undef ifa_dstaddr 299 # endif 300 void *ifa_dstaddr; // (struct sockaddr *) 301 void *ifa_data; 302 }; 303 #endif // !SANITIZER_ANDROID 304 305 #if SANITIZER_MAC 306 typedef unsigned long __sanitizer_pthread_key_t; 307 #else 308 typedef unsigned __sanitizer_pthread_key_t; 309 #endif 310 311 #if SANITIZER_LINUX && !SANITIZER_ANDROID 312 313 struct __sanitizer_XDR { 314 int x_op; 315 void *x_ops; 316 uptr x_public; 317 uptr x_private; 318 uptr x_base; 319 unsigned x_handy; 320 }; 321 322 const int __sanitizer_XDR_ENCODE = 0; 323 const int __sanitizer_XDR_DECODE = 1; 324 const int __sanitizer_XDR_FREE = 2; 325 #endif 326 327 struct __sanitizer_passwd { 328 char *pw_name; 329 char *pw_passwd; 330 int pw_uid; 331 int pw_gid; 332 #if SANITIZER_MAC || SANITIZER_FREEBSD 333 long pw_change; 334 char *pw_class; 335 #endif 336 #if !(SANITIZER_ANDROID && (SANITIZER_WORDSIZE == 32)) 337 char *pw_gecos; 338 #endif 339 char *pw_dir; 340 char *pw_shell; 341 #if SANITIZER_MAC || SANITIZER_FREEBSD 342 long pw_expire; 343 #endif 344 #if SANITIZER_FREEBSD 345 int pw_fields; 346 #endif 347 }; 348 349 struct __sanitizer_group { 350 char *gr_name; 351 char *gr_passwd; 352 int gr_gid; 353 char **gr_mem; 354 }; 355 356 #if defined(__x86_64__) && !defined(_LP64) 357 typedef long long __sanitizer_time_t; 358 #else 359 typedef long __sanitizer_time_t; 360 #endif 361 362 struct __sanitizer_timeb { 363 __sanitizer_time_t time; 364 unsigned short millitm; 365 short timezone; 366 short dstflag; 367 }; 368 369 struct __sanitizer_ether_addr { 370 u8 octet[6]; 371 }; 372 373 struct __sanitizer_tm { 374 int tm_sec; 375 int tm_min; 376 int tm_hour; 377 int tm_mday; 378 int tm_mon; 379 int tm_year; 380 int tm_wday; 381 int tm_yday; 382 int tm_isdst; 383 long int tm_gmtoff; 384 const char *tm_zone; 385 }; 386 387 #if SANITIZER_LINUX 388 struct __sanitizer_mntent { 389 char *mnt_fsname; 390 char *mnt_dir; 391 char *mnt_type; 392 char *mnt_opts; 393 int mnt_freq; 394 int mnt_passno; 395 }; 396 #endif 397 398 #if SANITIZER_MAC || SANITIZER_FREEBSD 399 struct __sanitizer_msghdr { 400 void *msg_name; 401 unsigned msg_namelen; 402 struct __sanitizer_iovec *msg_iov; 403 unsigned msg_iovlen; 404 void *msg_control; 405 unsigned msg_controllen; 406 int msg_flags; 407 }; 408 struct __sanitizer_cmsghdr { 409 unsigned cmsg_len; 410 int cmsg_level; 411 int cmsg_type; 412 }; 413 #else 414 struct __sanitizer_msghdr { 415 void *msg_name; 416 unsigned msg_namelen; 417 struct __sanitizer_iovec *msg_iov; 418 uptr msg_iovlen; 419 void *msg_control; 420 uptr msg_controllen; 421 int msg_flags; 422 }; 423 struct __sanitizer_cmsghdr { 424 uptr cmsg_len; 425 int cmsg_level; 426 int cmsg_type; 427 }; 428 #endif 429 430 #if SANITIZER_MAC 431 struct __sanitizer_dirent { 432 unsigned long long d_ino; 433 unsigned long long d_seekoff; 434 unsigned short d_reclen; 435 // more fields that we don't care about 436 }; 437 #elif SANITIZER_FREEBSD 438 struct __sanitizer_dirent { 439 unsigned int d_fileno; 440 unsigned short d_reclen; 441 // more fields that we don't care about 442 }; 443 #elif SANITIZER_ANDROID || defined(__x86_64__) 444 struct __sanitizer_dirent { 445 unsigned long long d_ino; 446 unsigned long long d_off; 447 unsigned short d_reclen; 448 // more fields that we don't care about 449 }; 450 #else 451 struct __sanitizer_dirent { 452 uptr d_ino; 453 uptr d_off; 454 unsigned short d_reclen; 455 // more fields that we don't care about 456 }; 457 #endif 458 459 #if SANITIZER_LINUX && !SANITIZER_ANDROID 460 struct __sanitizer_dirent64 { 461 unsigned long long d_ino; 462 unsigned long long d_off; 463 unsigned short d_reclen; 464 // more fields that we don't care about 465 }; 466 #endif 467 468 // 'clock_t' is 32 bits wide on x64 FreeBSD 469 #if SANITIZER_FREEBSD 470 typedef int __sanitizer_clock_t; 471 #elif defined(__x86_64__) && !defined(_LP64) 472 typedef long long __sanitizer_clock_t; 473 #else 474 typedef long __sanitizer_clock_t; 475 #endif 476 477 #if SANITIZER_LINUX 478 typedef int __sanitizer_clockid_t; 479 #endif 480 481 #if SANITIZER_LINUX || SANITIZER_FREEBSD 482 #if defined(_LP64) || defined(__x86_64__) || defined(__powerpc__)\ 483 || defined(__mips__) 484 typedef unsigned __sanitizer___kernel_uid_t; 485 typedef unsigned __sanitizer___kernel_gid_t; 486 #else 487 typedef unsigned short __sanitizer___kernel_uid_t; 488 typedef unsigned short __sanitizer___kernel_gid_t; 489 #endif 490 #if defined(__x86_64__) && !defined(_LP64) 491 typedef long long __sanitizer___kernel_off_t; 492 #else 493 typedef long __sanitizer___kernel_off_t; 494 #endif 495 496 #if defined(__powerpc__) || defined(__mips__) 497 typedef unsigned int __sanitizer___kernel_old_uid_t; 498 typedef unsigned int __sanitizer___kernel_old_gid_t; 499 #else 500 typedef unsigned short __sanitizer___kernel_old_uid_t; 501 typedef unsigned short __sanitizer___kernel_old_gid_t; 502 #endif 503 504 typedef long long __sanitizer___kernel_loff_t; 505 typedef struct { 506 unsigned long fds_bits[1024 / (8 * sizeof(long))]; 507 } __sanitizer___kernel_fd_set; 508 #endif 509 510 // This thing depends on the platform. We are only interested in the upper 511 // limit. Verified with a compiler assert in .cc. 512 const int pthread_attr_t_max_sz = 128; 513 union __sanitizer_pthread_attr_t { 514 char size[pthread_attr_t_max_sz]; // NOLINT 515 void *align; 516 }; 517 518 #if SANITIZER_ANDROID 519 typedef unsigned long __sanitizer_sigset_t; 520 #elif SANITIZER_MAC 521 typedef unsigned __sanitizer_sigset_t; 522 #elif SANITIZER_LINUX 523 struct __sanitizer_sigset_t { 524 // The size is determined by looking at sizeof of real sigset_t on linux. 525 uptr val[128 / sizeof(uptr)]; 526 }; 527 #elif SANITIZER_FREEBSD 528 struct __sanitizer_sigset_t { 529 // uint32_t * 4 530 unsigned int __bits[4]; 531 }; 532 #endif 533 534 // Linux system headers define the 'sa_handler' and 'sa_sigaction' macros. 535 #if SANITIZER_ANDROID && (SANITIZER_WORDSIZE == 64) 536 struct __sanitizer_sigaction { 537 unsigned sa_flags; 538 union { 539 void (*sigaction)(int sig, void *siginfo, void *uctx); 540 void (*handler)(int sig); 541 }; 542 __sanitizer_sigset_t sa_mask; 543 void (*sa_restorer)(); 544 }; 545 #elif SANITIZER_ANDROID && (SANITIZER_WORDSIZE == 32) 546 struct __sanitizer_sigaction { 547 union { 548 void (*sigaction)(int sig, void *siginfo, void *uctx); 549 void (*handler)(int sig); 550 }; 551 __sanitizer_sigset_t sa_mask; 552 uptr sa_flags; 553 void (*sa_restorer)(); 554 }; 555 #else // !SANITIZER_ANDROID 556 struct __sanitizer_sigaction { 557 #if defined(__mips__) && !SANITIZER_FREEBSD 558 unsigned int sa_flags; 559 #endif 560 union { 561 void (*sigaction)(int sig, void *siginfo, void *uctx); 562 void (*handler)(int sig); 563 }; 564 #if SANITIZER_FREEBSD 565 int sa_flags; 566 __sanitizer_sigset_t sa_mask; 567 #else 568 __sanitizer_sigset_t sa_mask; 569 #ifndef __mips__ 570 int sa_flags; 571 #endif 572 #endif 573 #if SANITIZER_LINUX 574 void (*sa_restorer)(); 575 #endif 576 #if defined(__mips__) && (SANITIZER_WORDSIZE == 32) 577 int sa_resv[1]; 578 #endif 579 }; 580 #endif // !SANITIZER_ANDROID 581 582 #if SANITIZER_FREEBSD 583 typedef __sanitizer_sigset_t __sanitizer_kernel_sigset_t; 584 #elif defined(__mips__) 585 struct __sanitizer_kernel_sigset_t { 586 u8 sig[16]; 587 }; 588 #else 589 struct __sanitizer_kernel_sigset_t { 590 u8 sig[8]; 591 }; 592 #endif 593 594 // Linux system headers define the 'sa_handler' and 'sa_sigaction' macros. 595 struct __sanitizer_kernel_sigaction_t { 596 union { 597 void (*handler)(int signo); 598 void (*sigaction)(int signo, void *info, void *ctx); 599 }; 600 unsigned long sa_flags; 601 void (*sa_restorer)(void); 602 __sanitizer_kernel_sigset_t sa_mask; 603 }; 604 605 extern uptr sig_ign; 606 extern uptr sig_dfl; 607 extern uptr sa_siginfo; 608 609 #if SANITIZER_LINUX 610 extern int e_tabsz; 611 #endif 612 613 extern int af_inet; 614 extern int af_inet6; 615 uptr __sanitizer_in_addr_sz(int af); 616 617 #if SANITIZER_LINUX || SANITIZER_FREEBSD 618 struct __sanitizer_dl_phdr_info { 619 uptr dlpi_addr; 620 const char *dlpi_name; 621 const void *dlpi_phdr; 622 short dlpi_phnum; 623 }; 624 625 extern unsigned struct_ElfW_Phdr_sz; 626 #endif 627 628 struct __sanitizer_addrinfo { 629 int ai_flags; 630 int ai_family; 631 int ai_socktype; 632 int ai_protocol; 633 #if SANITIZER_ANDROID || SANITIZER_MAC || SANITIZER_FREEBSD 634 unsigned ai_addrlen; 635 char *ai_canonname; 636 void *ai_addr; 637 #else // LINUX 638 unsigned ai_addrlen; 639 void *ai_addr; 640 char *ai_canonname; 641 #endif 642 struct __sanitizer_addrinfo *ai_next; 643 }; 644 645 struct __sanitizer_hostent { 646 char *h_name; 647 char **h_aliases; 648 int h_addrtype; 649 int h_length; 650 char **h_addr_list; 651 }; 652 653 struct __sanitizer_pollfd { 654 int fd; 655 short events; 656 short revents; 657 }; 658 659 #if SANITIZER_ANDROID || SANITIZER_MAC || SANITIZER_FREEBSD 660 typedef unsigned __sanitizer_nfds_t; 661 #else 662 typedef unsigned long __sanitizer_nfds_t; 663 #endif 664 665 #if !SANITIZER_ANDROID 666 # if SANITIZER_LINUX 667 struct __sanitizer_glob_t { 668 uptr gl_pathc; 669 char **gl_pathv; 670 uptr gl_offs; 671 int gl_flags; 672 673 void (*gl_closedir)(void *dirp); 674 void *(*gl_readdir)(void *dirp); 675 void *(*gl_opendir)(const char *); 676 int (*gl_lstat)(const char *, void *); 677 int (*gl_stat)(const char *, void *); 678 }; 679 # elif SANITIZER_FREEBSD 680 struct __sanitizer_glob_t { 681 uptr gl_pathc; 682 uptr gl_matchc; 683 uptr gl_offs; 684 int gl_flags; 685 char **gl_pathv; 686 int (*gl_errfunc)(const char*, int); 687 void (*gl_closedir)(void *dirp); 688 struct dirent *(*gl_readdir)(void *dirp); 689 void *(*gl_opendir)(const char*); 690 int (*gl_lstat)(const char*, void* /* struct stat* */); 691 int (*gl_stat)(const char*, void* /* struct stat* */); 692 }; 693 # endif // SANITIZER_FREEBSD 694 695 # if SANITIZER_LINUX || SANITIZER_FREEBSD 696 extern int glob_nomatch; 697 extern int glob_altdirfunc; 698 # endif 699 #endif // !SANITIZER_ANDROID 700 701 extern unsigned path_max; 702 703 struct __sanitizer_wordexp_t { 704 uptr we_wordc; 705 char **we_wordv; 706 uptr we_offs; 707 #if SANITIZER_FREEBSD 708 char *we_strings; 709 uptr we_nbytes; 710 #endif 711 }; 712 713 #if SANITIZER_LINUX && !SANITIZER_ANDROID 714 struct __sanitizer_FILE { 715 int _flags; 716 char *_IO_read_ptr; 717 char *_IO_read_end; 718 char *_IO_read_base; 719 char *_IO_write_base; 720 char *_IO_write_ptr; 721 char *_IO_write_end; 722 char *_IO_buf_base; 723 char *_IO_buf_end; 724 char *_IO_save_base; 725 char *_IO_backup_base; 726 char *_IO_save_end; 727 void *_markers; 728 __sanitizer_FILE *_chain; 729 int _fileno; 730 }; 731 # define SANITIZER_HAS_STRUCT_FILE 1 732 #else 733 typedef void __sanitizer_FILE; 734 # define SANITIZER_HAS_STRUCT_FILE 0 735 #endif 736 737 #if SANITIZER_LINUX && !SANITIZER_ANDROID && \ 738 (defined(__i386) || defined(__x86_64) || defined(__mips64) || \ 739 defined(__powerpc64__) || defined(__aarch64__) || defined(__arm__)) 740 extern unsigned struct_user_regs_struct_sz; 741 extern unsigned struct_user_fpregs_struct_sz; 742 extern unsigned struct_user_fpxregs_struct_sz; 743 extern unsigned struct_user_vfpregs_struct_sz; 744 745 extern int ptrace_peektext; 746 extern int ptrace_peekdata; 747 extern int ptrace_peekuser; 748 extern int ptrace_getregs; 749 extern int ptrace_setregs; 750 extern int ptrace_getfpregs; 751 extern int ptrace_setfpregs; 752 extern int ptrace_getfpxregs; 753 extern int ptrace_setfpxregs; 754 extern int ptrace_getvfpregs; 755 extern int ptrace_setvfpregs; 756 extern int ptrace_getsiginfo; 757 extern int ptrace_setsiginfo; 758 extern int ptrace_getregset; 759 extern int ptrace_setregset; 760 extern int ptrace_geteventmsg; 761 #endif 762 763 #if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID 764 extern unsigned struct_shminfo_sz; 765 extern unsigned struct_shm_info_sz; 766 extern int shmctl_ipc_stat; 767 extern int shmctl_ipc_info; 768 extern int shmctl_shm_info; 769 extern int shmctl_shm_stat; 770 #endif 771 772 extern int map_fixed; 773 774 // ioctl arguments 775 struct __sanitizer_ifconf { 776 int ifc_len; 777 union { 778 void *ifcu_req; 779 } ifc_ifcu; 780 #if SANITIZER_MAC 781 } __attribute__((packed)); 782 #else 783 }; 784 #endif 785 786 #if SANITIZER_LINUX && !SANITIZER_ANDROID 787 struct __sanitizer__obstack_chunk { 788 char *limit; 789 struct __sanitizer__obstack_chunk *prev; 790 }; 791 792 struct __sanitizer_obstack { 793 long chunk_size; 794 struct __sanitizer__obstack_chunk *chunk; 795 char *object_base; 796 char *next_free; 797 uptr more_fields[7]; 798 }; 799 800 typedef uptr (*__sanitizer_cookie_io_read)(void *cookie, char *buf, uptr size); 801 typedef uptr (*__sanitizer_cookie_io_write)(void *cookie, const char *buf, 802 uptr size); 803 typedef int (*__sanitizer_cookie_io_seek)(void *cookie, u64 *offset, 804 int whence); 805 typedef int (*__sanitizer_cookie_io_close)(void *cookie); 806 807 struct __sanitizer_cookie_io_functions_t { 808 __sanitizer_cookie_io_read read; 809 __sanitizer_cookie_io_write write; 810 __sanitizer_cookie_io_seek seek; 811 __sanitizer_cookie_io_close close; 812 }; 813 #endif 814 815 #define IOC_NRBITS 8 816 #define IOC_TYPEBITS 8 817 #if defined(__powerpc__) || defined(__powerpc64__) || defined(__mips__) 818 #define IOC_SIZEBITS 13 819 #define IOC_DIRBITS 3 820 #define IOC_NONE 1U 821 #define IOC_WRITE 4U 822 #define IOC_READ 2U 823 #else 824 #define IOC_SIZEBITS 14 825 #define IOC_DIRBITS 2 826 #define IOC_NONE 0U 827 #define IOC_WRITE 1U 828 #define IOC_READ 2U 829 #endif 830 #define IOC_NRMASK ((1 << IOC_NRBITS) - 1) 831 #define IOC_TYPEMASK ((1 << IOC_TYPEBITS) - 1) 832 #define IOC_SIZEMASK ((1 << IOC_SIZEBITS) - 1) 833 #if defined(IOC_DIRMASK) 834 #undef IOC_DIRMASK 835 #endif 836 #define IOC_DIRMASK ((1 << IOC_DIRBITS) - 1) 837 #define IOC_NRSHIFT 0 838 #define IOC_TYPESHIFT (IOC_NRSHIFT + IOC_NRBITS) 839 #define IOC_SIZESHIFT (IOC_TYPESHIFT + IOC_TYPEBITS) 840 #define IOC_DIRSHIFT (IOC_SIZESHIFT + IOC_SIZEBITS) 841 #define EVIOC_EV_MAX 0x1f 842 #define EVIOC_ABS_MAX 0x3f 843 844 #define IOC_DIR(nr) (((nr) >> IOC_DIRSHIFT) & IOC_DIRMASK) 845 #define IOC_TYPE(nr) (((nr) >> IOC_TYPESHIFT) & IOC_TYPEMASK) 846 #define IOC_NR(nr) (((nr) >> IOC_NRSHIFT) & IOC_NRMASK) 847 #define IOC_SIZE(nr) (((nr) >> IOC_SIZESHIFT) & IOC_SIZEMASK) 848 849 extern unsigned struct_ifreq_sz; 850 extern unsigned struct_termios_sz; 851 extern unsigned struct_winsize_sz; 852 853 #if SANITIZER_LINUX 854 extern unsigned struct_arpreq_sz; 855 extern unsigned struct_cdrom_msf_sz; 856 extern unsigned struct_cdrom_multisession_sz; 857 extern unsigned struct_cdrom_read_audio_sz; 858 extern unsigned struct_cdrom_subchnl_sz; 859 extern unsigned struct_cdrom_ti_sz; 860 extern unsigned struct_cdrom_tocentry_sz; 861 extern unsigned struct_cdrom_tochdr_sz; 862 extern unsigned struct_cdrom_volctrl_sz; 863 extern unsigned struct_ff_effect_sz; 864 extern unsigned struct_floppy_drive_params_sz; 865 extern unsigned struct_floppy_drive_struct_sz; 866 extern unsigned struct_floppy_fdc_state_sz; 867 extern unsigned struct_floppy_max_errors_sz; 868 extern unsigned struct_floppy_raw_cmd_sz; 869 extern unsigned struct_floppy_struct_sz; 870 extern unsigned struct_floppy_write_errors_sz; 871 extern unsigned struct_format_descr_sz; 872 extern unsigned struct_hd_driveid_sz; 873 extern unsigned struct_hd_geometry_sz; 874 extern unsigned struct_input_absinfo_sz; 875 extern unsigned struct_input_id_sz; 876 extern unsigned struct_mtpos_sz; 877 extern unsigned struct_termio_sz; 878 extern unsigned struct_vt_consize_sz; 879 extern unsigned struct_vt_sizes_sz; 880 extern unsigned struct_vt_stat_sz; 881 #endif // SANITIZER_LINUX 882 883 #if SANITIZER_LINUX || SANITIZER_FREEBSD 884 extern unsigned struct_copr_buffer_sz; 885 extern unsigned struct_copr_debug_buf_sz; 886 extern unsigned struct_copr_msg_sz; 887 extern unsigned struct_midi_info_sz; 888 extern unsigned struct_mtget_sz; 889 extern unsigned struct_mtop_sz; 890 extern unsigned struct_rtentry_sz; 891 extern unsigned struct_sbi_instrument_sz; 892 extern unsigned struct_seq_event_rec_sz; 893 extern unsigned struct_synth_info_sz; 894 extern unsigned struct_vt_mode_sz; 895 #endif // SANITIZER_LINUX || SANITIZER_FREEBSD 896 897 #if SANITIZER_LINUX && !SANITIZER_ANDROID 898 extern unsigned struct_ax25_parms_struct_sz; 899 extern unsigned struct_cyclades_monitor_sz; 900 extern unsigned struct_input_keymap_entry_sz; 901 extern unsigned struct_ipx_config_data_sz; 902 extern unsigned struct_kbdiacrs_sz; 903 extern unsigned struct_kbentry_sz; 904 extern unsigned struct_kbkeycode_sz; 905 extern unsigned struct_kbsentry_sz; 906 extern unsigned struct_mtconfiginfo_sz; 907 extern unsigned struct_nr_parms_struct_sz; 908 extern unsigned struct_scc_modem_sz; 909 extern unsigned struct_scc_stat_sz; 910 extern unsigned struct_serial_multiport_struct_sz; 911 extern unsigned struct_serial_struct_sz; 912 extern unsigned struct_sockaddr_ax25_sz; 913 extern unsigned struct_unimapdesc_sz; 914 extern unsigned struct_unimapinit_sz; 915 #endif // SANITIZER_LINUX && !SANITIZER_ANDROID 916 917 #if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID 918 extern unsigned struct_audio_buf_info_sz; 919 extern unsigned struct_ppp_stats_sz; 920 #endif // (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID 921 922 #if !SANITIZER_ANDROID && !SANITIZER_MAC 923 extern unsigned struct_sioc_sg_req_sz; 924 extern unsigned struct_sioc_vif_req_sz; 925 #endif 926 927 // ioctl request identifiers 928 929 // A special value to mark ioctls that are not present on the target platform, 930 // when it can not be determined without including any system headers. 931 extern const unsigned IOCTL_NOT_PRESENT; 932 933 extern unsigned IOCTL_FIOASYNC; 934 extern unsigned IOCTL_FIOCLEX; 935 extern unsigned IOCTL_FIOGETOWN; 936 extern unsigned IOCTL_FIONBIO; 937 extern unsigned IOCTL_FIONCLEX; 938 extern unsigned IOCTL_FIOSETOWN; 939 extern unsigned IOCTL_SIOCADDMULTI; 940 extern unsigned IOCTL_SIOCATMARK; 941 extern unsigned IOCTL_SIOCDELMULTI; 942 extern unsigned IOCTL_SIOCGIFADDR; 943 extern unsigned IOCTL_SIOCGIFBRDADDR; 944 extern unsigned IOCTL_SIOCGIFCONF; 945 extern unsigned IOCTL_SIOCGIFDSTADDR; 946 extern unsigned IOCTL_SIOCGIFFLAGS; 947 extern unsigned IOCTL_SIOCGIFMETRIC; 948 extern unsigned IOCTL_SIOCGIFMTU; 949 extern unsigned IOCTL_SIOCGIFNETMASK; 950 extern unsigned IOCTL_SIOCGPGRP; 951 extern unsigned IOCTL_SIOCSIFADDR; 952 extern unsigned IOCTL_SIOCSIFBRDADDR; 953 extern unsigned IOCTL_SIOCSIFDSTADDR; 954 extern unsigned IOCTL_SIOCSIFFLAGS; 955 extern unsigned IOCTL_SIOCSIFMETRIC; 956 extern unsigned IOCTL_SIOCSIFMTU; 957 extern unsigned IOCTL_SIOCSIFNETMASK; 958 extern unsigned IOCTL_SIOCSPGRP; 959 extern unsigned IOCTL_TIOCCONS; 960 extern unsigned IOCTL_TIOCEXCL; 961 extern unsigned IOCTL_TIOCGETD; 962 extern unsigned IOCTL_TIOCGPGRP; 963 extern unsigned IOCTL_TIOCGWINSZ; 964 extern unsigned IOCTL_TIOCMBIC; 965 extern unsigned IOCTL_TIOCMBIS; 966 extern unsigned IOCTL_TIOCMGET; 967 extern unsigned IOCTL_TIOCMSET; 968 extern unsigned IOCTL_TIOCNOTTY; 969 extern unsigned IOCTL_TIOCNXCL; 970 extern unsigned IOCTL_TIOCOUTQ; 971 extern unsigned IOCTL_TIOCPKT; 972 extern unsigned IOCTL_TIOCSCTTY; 973 extern unsigned IOCTL_TIOCSETD; 974 extern unsigned IOCTL_TIOCSPGRP; 975 extern unsigned IOCTL_TIOCSTI; 976 extern unsigned IOCTL_TIOCSWINSZ; 977 #if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID 978 extern unsigned IOCTL_SIOCGETSGCNT; 979 extern unsigned IOCTL_SIOCGETVIFCNT; 980 #endif 981 #if SANITIZER_LINUX 982 extern unsigned IOCTL_EVIOCGABS; 983 extern unsigned IOCTL_EVIOCGBIT; 984 extern unsigned IOCTL_EVIOCGEFFECTS; 985 extern unsigned IOCTL_EVIOCGID; 986 extern unsigned IOCTL_EVIOCGKEY; 987 extern unsigned IOCTL_EVIOCGKEYCODE; 988 extern unsigned IOCTL_EVIOCGLED; 989 extern unsigned IOCTL_EVIOCGNAME; 990 extern unsigned IOCTL_EVIOCGPHYS; 991 extern unsigned IOCTL_EVIOCGRAB; 992 extern unsigned IOCTL_EVIOCGREP; 993 extern unsigned IOCTL_EVIOCGSND; 994 extern unsigned IOCTL_EVIOCGSW; 995 extern unsigned IOCTL_EVIOCGUNIQ; 996 extern unsigned IOCTL_EVIOCGVERSION; 997 extern unsigned IOCTL_EVIOCRMFF; 998 extern unsigned IOCTL_EVIOCSABS; 999 extern unsigned IOCTL_EVIOCSFF; 1000 extern unsigned IOCTL_EVIOCSKEYCODE; 1001 extern unsigned IOCTL_EVIOCSREP; 1002 extern unsigned IOCTL_BLKFLSBUF; 1003 extern unsigned IOCTL_BLKGETSIZE; 1004 extern unsigned IOCTL_BLKRAGET; 1005 extern unsigned IOCTL_BLKRASET; 1006 extern unsigned IOCTL_BLKROGET; 1007 extern unsigned IOCTL_BLKROSET; 1008 extern unsigned IOCTL_BLKRRPART; 1009 extern unsigned IOCTL_CDROMAUDIOBUFSIZ; 1010 extern unsigned IOCTL_CDROMEJECT; 1011 extern unsigned IOCTL_CDROMEJECT_SW; 1012 extern unsigned IOCTL_CDROMMULTISESSION; 1013 extern unsigned IOCTL_CDROMPAUSE; 1014 extern unsigned IOCTL_CDROMPLAYMSF; 1015 extern unsigned IOCTL_CDROMPLAYTRKIND; 1016 extern unsigned IOCTL_CDROMREADAUDIO; 1017 extern unsigned IOCTL_CDROMREADCOOKED; 1018 extern unsigned IOCTL_CDROMREADMODE1; 1019 extern unsigned IOCTL_CDROMREADMODE2; 1020 extern unsigned IOCTL_CDROMREADRAW; 1021 extern unsigned IOCTL_CDROMREADTOCENTRY; 1022 extern unsigned IOCTL_CDROMREADTOCHDR; 1023 extern unsigned IOCTL_CDROMRESET; 1024 extern unsigned IOCTL_CDROMRESUME; 1025 extern unsigned IOCTL_CDROMSEEK; 1026 extern unsigned IOCTL_CDROMSTART; 1027 extern unsigned IOCTL_CDROMSTOP; 1028 extern unsigned IOCTL_CDROMSUBCHNL; 1029 extern unsigned IOCTL_CDROMVOLCTRL; 1030 extern unsigned IOCTL_CDROMVOLREAD; 1031 extern unsigned IOCTL_CDROM_GET_UPC; 1032 extern unsigned IOCTL_FDCLRPRM; 1033 extern unsigned IOCTL_FDDEFPRM; 1034 extern unsigned IOCTL_FDFLUSH; 1035 extern unsigned IOCTL_FDFMTBEG; 1036 extern unsigned IOCTL_FDFMTEND; 1037 extern unsigned IOCTL_FDFMTTRK; 1038 extern unsigned IOCTL_FDGETDRVPRM; 1039 extern unsigned IOCTL_FDGETDRVSTAT; 1040 extern unsigned IOCTL_FDGETDRVTYP; 1041 extern unsigned IOCTL_FDGETFDCSTAT; 1042 extern unsigned IOCTL_FDGETMAXERRS; 1043 extern unsigned IOCTL_FDGETPRM; 1044 extern unsigned IOCTL_FDMSGOFF; 1045 extern unsigned IOCTL_FDMSGON; 1046 extern unsigned IOCTL_FDPOLLDRVSTAT; 1047 extern unsigned IOCTL_FDRAWCMD; 1048 extern unsigned IOCTL_FDRESET; 1049 extern unsigned IOCTL_FDSETDRVPRM; 1050 extern unsigned IOCTL_FDSETEMSGTRESH; 1051 extern unsigned IOCTL_FDSETMAXERRS; 1052 extern unsigned IOCTL_FDSETPRM; 1053 extern unsigned IOCTL_FDTWADDLE; 1054 extern unsigned IOCTL_FDWERRORCLR; 1055 extern unsigned IOCTL_FDWERRORGET; 1056 extern unsigned IOCTL_HDIO_DRIVE_CMD; 1057 extern unsigned IOCTL_HDIO_GETGEO; 1058 extern unsigned IOCTL_HDIO_GET_32BIT; 1059 extern unsigned IOCTL_HDIO_GET_DMA; 1060 extern unsigned IOCTL_HDIO_GET_IDENTITY; 1061 extern unsigned IOCTL_HDIO_GET_KEEPSETTINGS; 1062 extern unsigned IOCTL_HDIO_GET_MULTCOUNT; 1063 extern unsigned IOCTL_HDIO_GET_NOWERR; 1064 extern unsigned IOCTL_HDIO_GET_UNMASKINTR; 1065 extern unsigned IOCTL_HDIO_SET_32BIT; 1066 extern unsigned IOCTL_HDIO_SET_DMA; 1067 extern unsigned IOCTL_HDIO_SET_KEEPSETTINGS; 1068 extern unsigned IOCTL_HDIO_SET_MULTCOUNT; 1069 extern unsigned IOCTL_HDIO_SET_NOWERR; 1070 extern unsigned IOCTL_HDIO_SET_UNMASKINTR; 1071 extern unsigned IOCTL_MTIOCPOS; 1072 extern unsigned IOCTL_PPPIOCGASYNCMAP; 1073 extern unsigned IOCTL_PPPIOCGDEBUG; 1074 extern unsigned IOCTL_PPPIOCGFLAGS; 1075 extern unsigned IOCTL_PPPIOCGUNIT; 1076 extern unsigned IOCTL_PPPIOCGXASYNCMAP; 1077 extern unsigned IOCTL_PPPIOCSASYNCMAP; 1078 extern unsigned IOCTL_PPPIOCSDEBUG; 1079 extern unsigned IOCTL_PPPIOCSFLAGS; 1080 extern unsigned IOCTL_PPPIOCSMAXCID; 1081 extern unsigned IOCTL_PPPIOCSMRU; 1082 extern unsigned IOCTL_PPPIOCSXASYNCMAP; 1083 extern unsigned IOCTL_SIOCDARP; 1084 extern unsigned IOCTL_SIOCDRARP; 1085 extern unsigned IOCTL_SIOCGARP; 1086 extern unsigned IOCTL_SIOCGIFENCAP; 1087 extern unsigned IOCTL_SIOCGIFHWADDR; 1088 extern unsigned IOCTL_SIOCGIFMAP; 1089 extern unsigned IOCTL_SIOCGIFMEM; 1090 extern unsigned IOCTL_SIOCGIFNAME; 1091 extern unsigned IOCTL_SIOCGIFSLAVE; 1092 extern unsigned IOCTL_SIOCGRARP; 1093 extern unsigned IOCTL_SIOCGSTAMP; 1094 extern unsigned IOCTL_SIOCSARP; 1095 extern unsigned IOCTL_SIOCSIFENCAP; 1096 extern unsigned IOCTL_SIOCSIFHWADDR; 1097 extern unsigned IOCTL_SIOCSIFLINK; 1098 extern unsigned IOCTL_SIOCSIFMAP; 1099 extern unsigned IOCTL_SIOCSIFMEM; 1100 extern unsigned IOCTL_SIOCSIFSLAVE; 1101 extern unsigned IOCTL_SIOCSRARP; 1102 extern unsigned IOCTL_SNDCTL_COPR_HALT; 1103 extern unsigned IOCTL_SNDCTL_COPR_LOAD; 1104 extern unsigned IOCTL_SNDCTL_COPR_RCODE; 1105 extern unsigned IOCTL_SNDCTL_COPR_RCVMSG; 1106 extern unsigned IOCTL_SNDCTL_COPR_RDATA; 1107 extern unsigned IOCTL_SNDCTL_COPR_RESET; 1108 extern unsigned IOCTL_SNDCTL_COPR_RUN; 1109 extern unsigned IOCTL_SNDCTL_COPR_SENDMSG; 1110 extern unsigned IOCTL_SNDCTL_COPR_WCODE; 1111 extern unsigned IOCTL_SNDCTL_COPR_WDATA; 1112 extern unsigned IOCTL_TCFLSH; 1113 extern unsigned IOCTL_TCGETA; 1114 extern unsigned IOCTL_TCGETS; 1115 extern unsigned IOCTL_TCSBRK; 1116 extern unsigned IOCTL_TCSBRKP; 1117 extern unsigned IOCTL_TCSETA; 1118 extern unsigned IOCTL_TCSETAF; 1119 extern unsigned IOCTL_TCSETAW; 1120 extern unsigned IOCTL_TCSETS; 1121 extern unsigned IOCTL_TCSETSF; 1122 extern unsigned IOCTL_TCSETSW; 1123 extern unsigned IOCTL_TCXONC; 1124 extern unsigned IOCTL_TIOCGLCKTRMIOS; 1125 extern unsigned IOCTL_TIOCGSOFTCAR; 1126 extern unsigned IOCTL_TIOCINQ; 1127 extern unsigned IOCTL_TIOCLINUX; 1128 extern unsigned IOCTL_TIOCSERCONFIG; 1129 extern unsigned IOCTL_TIOCSERGETLSR; 1130 extern unsigned IOCTL_TIOCSERGWILD; 1131 extern unsigned IOCTL_TIOCSERSWILD; 1132 extern unsigned IOCTL_TIOCSLCKTRMIOS; 1133 extern unsigned IOCTL_TIOCSSOFTCAR; 1134 extern unsigned IOCTL_VT_DISALLOCATE; 1135 extern unsigned IOCTL_VT_GETSTATE; 1136 extern unsigned IOCTL_VT_RESIZE; 1137 extern unsigned IOCTL_VT_RESIZEX; 1138 extern unsigned IOCTL_VT_SENDSIG; 1139 #endif // SANITIZER_LINUX 1140 #if SANITIZER_LINUX || SANITIZER_FREEBSD 1141 extern unsigned IOCTL_MTIOCGET; 1142 extern unsigned IOCTL_MTIOCTOP; 1143 extern unsigned IOCTL_SIOCADDRT; 1144 extern unsigned IOCTL_SIOCDELRT; 1145 extern unsigned IOCTL_SNDCTL_DSP_GETBLKSIZE; 1146 extern unsigned IOCTL_SNDCTL_DSP_GETFMTS; 1147 extern unsigned IOCTL_SNDCTL_DSP_NONBLOCK; 1148 extern unsigned IOCTL_SNDCTL_DSP_POST; 1149 extern unsigned IOCTL_SNDCTL_DSP_RESET; 1150 extern unsigned IOCTL_SNDCTL_DSP_SETFMT; 1151 extern unsigned IOCTL_SNDCTL_DSP_SETFRAGMENT; 1152 extern unsigned IOCTL_SNDCTL_DSP_SPEED; 1153 extern unsigned IOCTL_SNDCTL_DSP_STEREO; 1154 extern unsigned IOCTL_SNDCTL_DSP_SUBDIVIDE; 1155 extern unsigned IOCTL_SNDCTL_DSP_SYNC; 1156 extern unsigned IOCTL_SNDCTL_FM_4OP_ENABLE; 1157 extern unsigned IOCTL_SNDCTL_FM_LOAD_INSTR; 1158 extern unsigned IOCTL_SNDCTL_MIDI_INFO; 1159 extern unsigned IOCTL_SNDCTL_MIDI_PRETIME; 1160 extern unsigned IOCTL_SNDCTL_SEQ_CTRLRATE; 1161 extern unsigned IOCTL_SNDCTL_SEQ_GETINCOUNT; 1162 extern unsigned IOCTL_SNDCTL_SEQ_GETOUTCOUNT; 1163 extern unsigned IOCTL_SNDCTL_SEQ_NRMIDIS; 1164 extern unsigned IOCTL_SNDCTL_SEQ_NRSYNTHS; 1165 extern unsigned IOCTL_SNDCTL_SEQ_OUTOFBAND; 1166 extern unsigned IOCTL_SNDCTL_SEQ_PANIC; 1167 extern unsigned IOCTL_SNDCTL_SEQ_PERCMODE; 1168 extern unsigned IOCTL_SNDCTL_SEQ_RESET; 1169 extern unsigned IOCTL_SNDCTL_SEQ_RESETSAMPLES; 1170 extern unsigned IOCTL_SNDCTL_SEQ_SYNC; 1171 extern unsigned IOCTL_SNDCTL_SEQ_TESTMIDI; 1172 extern unsigned IOCTL_SNDCTL_SEQ_THRESHOLD; 1173 extern unsigned IOCTL_SNDCTL_SYNTH_INFO; 1174 extern unsigned IOCTL_SNDCTL_SYNTH_MEMAVL; 1175 extern unsigned IOCTL_SNDCTL_TMR_CONTINUE; 1176 extern unsigned IOCTL_SNDCTL_TMR_METRONOME; 1177 extern unsigned IOCTL_SNDCTL_TMR_SELECT; 1178 extern unsigned IOCTL_SNDCTL_TMR_SOURCE; 1179 extern unsigned IOCTL_SNDCTL_TMR_START; 1180 extern unsigned IOCTL_SNDCTL_TMR_STOP; 1181 extern unsigned IOCTL_SNDCTL_TMR_TEMPO; 1182 extern unsigned IOCTL_SNDCTL_TMR_TIMEBASE; 1183 extern unsigned IOCTL_SOUND_MIXER_READ_ALTPCM; 1184 extern unsigned IOCTL_SOUND_MIXER_READ_BASS; 1185 extern unsigned IOCTL_SOUND_MIXER_READ_CAPS; 1186 extern unsigned IOCTL_SOUND_MIXER_READ_CD; 1187 extern unsigned IOCTL_SOUND_MIXER_READ_DEVMASK; 1188 extern unsigned IOCTL_SOUND_MIXER_READ_ENHANCE; 1189 extern unsigned IOCTL_SOUND_MIXER_READ_IGAIN; 1190 extern unsigned IOCTL_SOUND_MIXER_READ_IMIX; 1191 extern unsigned IOCTL_SOUND_MIXER_READ_LINE1; 1192 extern unsigned IOCTL_SOUND_MIXER_READ_LINE2; 1193 extern unsigned IOCTL_SOUND_MIXER_READ_LINE3; 1194 extern unsigned IOCTL_SOUND_MIXER_READ_LINE; 1195 extern unsigned IOCTL_SOUND_MIXER_READ_LOUD; 1196 extern unsigned IOCTL_SOUND_MIXER_READ_MIC; 1197 extern unsigned IOCTL_SOUND_MIXER_READ_MUTE; 1198 extern unsigned IOCTL_SOUND_MIXER_READ_OGAIN; 1199 extern unsigned IOCTL_SOUND_MIXER_READ_PCM; 1200 extern unsigned IOCTL_SOUND_MIXER_READ_RECLEV; 1201 extern unsigned IOCTL_SOUND_MIXER_READ_RECMASK; 1202 extern unsigned IOCTL_SOUND_MIXER_READ_RECSRC; 1203 extern unsigned IOCTL_SOUND_MIXER_READ_SPEAKER; 1204 extern unsigned IOCTL_SOUND_MIXER_READ_STEREODEVS; 1205 extern unsigned IOCTL_SOUND_MIXER_READ_SYNTH; 1206 extern unsigned IOCTL_SOUND_MIXER_READ_TREBLE; 1207 extern unsigned IOCTL_SOUND_MIXER_READ_VOLUME; 1208 extern unsigned IOCTL_SOUND_MIXER_WRITE_ALTPCM; 1209 extern unsigned IOCTL_SOUND_MIXER_WRITE_BASS; 1210 extern unsigned IOCTL_SOUND_MIXER_WRITE_CD; 1211 extern unsigned IOCTL_SOUND_MIXER_WRITE_ENHANCE; 1212 extern unsigned IOCTL_SOUND_MIXER_WRITE_IGAIN; 1213 extern unsigned IOCTL_SOUND_MIXER_WRITE_IMIX; 1214 extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE1; 1215 extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE2; 1216 extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE3; 1217 extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE; 1218 extern unsigned IOCTL_SOUND_MIXER_WRITE_LOUD; 1219 extern unsigned IOCTL_SOUND_MIXER_WRITE_MIC; 1220 extern unsigned IOCTL_SOUND_MIXER_WRITE_MUTE; 1221 extern unsigned IOCTL_SOUND_MIXER_WRITE_OGAIN; 1222 extern unsigned IOCTL_SOUND_MIXER_WRITE_PCM; 1223 extern unsigned IOCTL_SOUND_MIXER_WRITE_RECLEV; 1224 extern unsigned IOCTL_SOUND_MIXER_WRITE_RECSRC; 1225 extern unsigned IOCTL_SOUND_MIXER_WRITE_SPEAKER; 1226 extern unsigned IOCTL_SOUND_MIXER_WRITE_SYNTH; 1227 extern unsigned IOCTL_SOUND_MIXER_WRITE_TREBLE; 1228 extern unsigned IOCTL_SOUND_MIXER_WRITE_VOLUME; 1229 extern unsigned IOCTL_SOUND_PCM_READ_BITS; 1230 extern unsigned IOCTL_SOUND_PCM_READ_CHANNELS; 1231 extern unsigned IOCTL_SOUND_PCM_READ_FILTER; 1232 extern unsigned IOCTL_SOUND_PCM_READ_RATE; 1233 extern unsigned IOCTL_SOUND_PCM_WRITE_CHANNELS; 1234 extern unsigned IOCTL_SOUND_PCM_WRITE_FILTER; 1235 extern unsigned IOCTL_VT_ACTIVATE; 1236 extern unsigned IOCTL_VT_GETMODE; 1237 extern unsigned IOCTL_VT_OPENQRY; 1238 extern unsigned IOCTL_VT_RELDISP; 1239 extern unsigned IOCTL_VT_SETMODE; 1240 extern unsigned IOCTL_VT_WAITACTIVE; 1241 #endif // SANITIZER_LINUX || SANITIZER_FREEBSD 1242 1243 #if SANITIZER_LINUX && !SANITIZER_ANDROID 1244 extern unsigned IOCTL_CYGETDEFTHRESH; 1245 extern unsigned IOCTL_CYGETDEFTIMEOUT; 1246 extern unsigned IOCTL_CYGETMON; 1247 extern unsigned IOCTL_CYGETTHRESH; 1248 extern unsigned IOCTL_CYGETTIMEOUT; 1249 extern unsigned IOCTL_CYSETDEFTHRESH; 1250 extern unsigned IOCTL_CYSETDEFTIMEOUT; 1251 extern unsigned IOCTL_CYSETTHRESH; 1252 extern unsigned IOCTL_CYSETTIMEOUT; 1253 extern unsigned IOCTL_EQL_EMANCIPATE; 1254 extern unsigned IOCTL_EQL_ENSLAVE; 1255 extern unsigned IOCTL_EQL_GETMASTRCFG; 1256 extern unsigned IOCTL_EQL_GETSLAVECFG; 1257 extern unsigned IOCTL_EQL_SETMASTRCFG; 1258 extern unsigned IOCTL_EQL_SETSLAVECFG; 1259 extern unsigned IOCTL_EVIOCGKEYCODE_V2; 1260 extern unsigned IOCTL_EVIOCGPROP; 1261 extern unsigned IOCTL_EVIOCSKEYCODE_V2; 1262 extern unsigned IOCTL_FS_IOC_GETFLAGS; 1263 extern unsigned IOCTL_FS_IOC_GETVERSION; 1264 extern unsigned IOCTL_FS_IOC_SETFLAGS; 1265 extern unsigned IOCTL_FS_IOC_SETVERSION; 1266 extern unsigned IOCTL_GIO_CMAP; 1267 extern unsigned IOCTL_GIO_FONT; 1268 extern unsigned IOCTL_GIO_UNIMAP; 1269 extern unsigned IOCTL_GIO_UNISCRNMAP; 1270 extern unsigned IOCTL_KDADDIO; 1271 extern unsigned IOCTL_KDDELIO; 1272 extern unsigned IOCTL_KDGETKEYCODE; 1273 extern unsigned IOCTL_KDGKBDIACR; 1274 extern unsigned IOCTL_KDGKBENT; 1275 extern unsigned IOCTL_KDGKBLED; 1276 extern unsigned IOCTL_KDGKBMETA; 1277 extern unsigned IOCTL_KDGKBSENT; 1278 extern unsigned IOCTL_KDMAPDISP; 1279 extern unsigned IOCTL_KDSETKEYCODE; 1280 extern unsigned IOCTL_KDSIGACCEPT; 1281 extern unsigned IOCTL_KDSKBDIACR; 1282 extern unsigned IOCTL_KDSKBENT; 1283 extern unsigned IOCTL_KDSKBLED; 1284 extern unsigned IOCTL_KDSKBMETA; 1285 extern unsigned IOCTL_KDSKBSENT; 1286 extern unsigned IOCTL_KDUNMAPDISP; 1287 extern unsigned IOCTL_LPABORT; 1288 extern unsigned IOCTL_LPABORTOPEN; 1289 extern unsigned IOCTL_LPCAREFUL; 1290 extern unsigned IOCTL_LPCHAR; 1291 extern unsigned IOCTL_LPGETIRQ; 1292 extern unsigned IOCTL_LPGETSTATUS; 1293 extern unsigned IOCTL_LPRESET; 1294 extern unsigned IOCTL_LPSETIRQ; 1295 extern unsigned IOCTL_LPTIME; 1296 extern unsigned IOCTL_LPWAIT; 1297 extern unsigned IOCTL_MTIOCGETCONFIG; 1298 extern unsigned IOCTL_MTIOCSETCONFIG; 1299 extern unsigned IOCTL_PIO_CMAP; 1300 extern unsigned IOCTL_PIO_FONT; 1301 extern unsigned IOCTL_PIO_UNIMAP; 1302 extern unsigned IOCTL_PIO_UNIMAPCLR; 1303 extern unsigned IOCTL_PIO_UNISCRNMAP; 1304 extern unsigned IOCTL_SCSI_IOCTL_GET_IDLUN; 1305 extern unsigned IOCTL_SCSI_IOCTL_PROBE_HOST; 1306 extern unsigned IOCTL_SCSI_IOCTL_TAGGED_DISABLE; 1307 extern unsigned IOCTL_SCSI_IOCTL_TAGGED_ENABLE; 1308 extern unsigned IOCTL_SIOCAIPXITFCRT; 1309 extern unsigned IOCTL_SIOCAIPXPRISLT; 1310 extern unsigned IOCTL_SIOCAX25ADDUID; 1311 extern unsigned IOCTL_SIOCAX25DELUID; 1312 extern unsigned IOCTL_SIOCAX25GETPARMS; 1313 extern unsigned IOCTL_SIOCAX25GETUID; 1314 extern unsigned IOCTL_SIOCAX25NOUID; 1315 extern unsigned IOCTL_SIOCAX25SETPARMS; 1316 extern unsigned IOCTL_SIOCDEVPLIP; 1317 extern unsigned IOCTL_SIOCIPXCFGDATA; 1318 extern unsigned IOCTL_SIOCNRDECOBS; 1319 extern unsigned IOCTL_SIOCNRGETPARMS; 1320 extern unsigned IOCTL_SIOCNRRTCTL; 1321 extern unsigned IOCTL_SIOCNRSETPARMS; 1322 extern unsigned IOCTL_SNDCTL_DSP_GETISPACE; 1323 extern unsigned IOCTL_SNDCTL_DSP_GETOSPACE; 1324 extern unsigned IOCTL_TIOCGSERIAL; 1325 extern unsigned IOCTL_TIOCSERGETMULTI; 1326 extern unsigned IOCTL_TIOCSERSETMULTI; 1327 extern unsigned IOCTL_TIOCSSERIAL; 1328 #endif // SANITIZER_LINUX && !SANITIZER_ANDROID 1329 1330 #if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID 1331 extern unsigned IOCTL_GIO_SCRNMAP; 1332 extern unsigned IOCTL_KDDISABIO; 1333 extern unsigned IOCTL_KDENABIO; 1334 extern unsigned IOCTL_KDGETLED; 1335 extern unsigned IOCTL_KDGETMODE; 1336 extern unsigned IOCTL_KDGKBMODE; 1337 extern unsigned IOCTL_KDGKBTYPE; 1338 extern unsigned IOCTL_KDMKTONE; 1339 extern unsigned IOCTL_KDSETLED; 1340 extern unsigned IOCTL_KDSETMODE; 1341 extern unsigned IOCTL_KDSKBMODE; 1342 extern unsigned IOCTL_KIOCSOUND; 1343 extern unsigned IOCTL_PIO_SCRNMAP; 1344 #endif 1345 1346 extern const int errno_EINVAL; 1347 extern const int errno_EOWNERDEAD; 1348 1349 extern const int si_SEGV_MAPERR; 1350 extern const int si_SEGV_ACCERR; 1351 } // namespace __sanitizer 1352 1353 #define CHECK_TYPE_SIZE(TYPE) \ 1354 COMPILER_CHECK(sizeof(__sanitizer_##TYPE) == sizeof(TYPE)) 1355 1356 #define CHECK_SIZE_AND_OFFSET(CLASS, MEMBER) \ 1357 COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *) NULL)->MEMBER) == \ 1358 sizeof(((CLASS *) NULL)->MEMBER)); \ 1359 COMPILER_CHECK(offsetof(__sanitizer_##CLASS, MEMBER) == \ 1360 offsetof(CLASS, MEMBER)) 1361 1362 // For sigaction, which is a function and struct at the same time, 1363 // and thus requires explicit "struct" in sizeof() expression. 1364 #define CHECK_STRUCT_SIZE_AND_OFFSET(CLASS, MEMBER) \ 1365 COMPILER_CHECK(sizeof(((struct __sanitizer_##CLASS *) NULL)->MEMBER) == \ 1366 sizeof(((struct CLASS *) NULL)->MEMBER)); \ 1367 COMPILER_CHECK(offsetof(struct __sanitizer_##CLASS, MEMBER) == \ 1368 offsetof(struct CLASS, MEMBER)) 1369 1370 #endif 1371