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