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