1 //===-- sanitizer_platform_limits_posix.h ---------------------------------===//
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
7 //===----------------------------------------------------------------------===//
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_APPLE
19 #include "sanitizer_internal_defs.h"
20 #include "sanitizer_platform.h"
23 #include <sys/cdefs.h>
24 #if !__DARWIN_ONLY_64_BIT_INO_T
25 #define SANITIZER_HAS_STAT64 1
26 #define SANITIZER_HAS_STATFS64 1
28 #define SANITIZER_HAS_STAT64 0
29 #define SANITIZER_HAS_STATFS64 0
31 #elif SANITIZER_GLIBC || SANITIZER_ANDROID
32 #define SANITIZER_HAS_STAT64 1
33 #define SANITIZER_HAS_STATFS64 1
36 #if defined(__sparc__)
37 // FIXME: This can't be included from tsan which does not support sparc yet.
38 #include "sanitizer_glibc_version.h"
41 # define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) ((link_map*)(handle))
43 namespace __sanitizer
{
44 extern unsigned struct_utsname_sz
;
45 extern unsigned struct_stat_sz
;
46 #if SANITIZER_HAS_STAT64
47 extern unsigned struct_stat64_sz
;
49 extern unsigned struct_rusage_sz
;
50 extern unsigned siginfo_t_sz
;
51 extern unsigned struct_itimerval_sz
;
52 extern unsigned pthread_t_sz
;
53 extern unsigned pthread_mutex_t_sz
;
54 extern unsigned pthread_cond_t_sz
;
55 extern unsigned pid_t_sz
;
56 extern unsigned timeval_sz
;
57 extern unsigned uid_t_sz
;
58 extern unsigned gid_t_sz
;
59 extern unsigned mbstate_t_sz
;
60 extern unsigned struct_timezone_sz
;
61 extern unsigned struct_tms_sz
;
62 extern unsigned struct_itimerspec_sz
;
63 extern unsigned struct_sigevent_sz
;
64 extern unsigned struct_stack_t_sz
;
65 extern unsigned struct_sched_param_sz
;
66 #if SANITIZER_HAS_STATFS64
67 extern unsigned struct_statfs64_sz
;
69 extern unsigned struct_regex_sz
;
70 extern unsigned struct_regmatch_sz
;
72 #if !SANITIZER_ANDROID
73 extern unsigned struct_fstab_sz
;
74 extern unsigned struct_statfs_sz
;
75 extern unsigned struct_sockaddr_sz
;
76 unsigned ucontext_t_sz(void *uctx
);
77 # endif // !SANITIZER_ANDROID
81 # if defined(__x86_64__)
82 const unsigned struct_kernel_stat_sz
= 144;
83 const unsigned struct_kernel_stat64_sz
= 0;
84 #elif defined(__i386__)
85 const unsigned struct_kernel_stat_sz
= 64;
86 const unsigned struct_kernel_stat64_sz
= 96;
87 #elif defined(__arm__)
88 const unsigned struct_kernel_stat_sz
= 64;
89 const unsigned struct_kernel_stat64_sz
= 104;
90 #elif defined(__aarch64__)
91 const unsigned struct_kernel_stat_sz
= 128;
92 const unsigned struct_kernel_stat64_sz
= 104;
93 #elif defined(__powerpc__) && !defined(__powerpc64__)
94 const unsigned struct_kernel_stat_sz
= 72;
95 const unsigned struct_kernel_stat64_sz
= 104;
96 #elif defined(__powerpc64__)
97 const unsigned struct_kernel_stat_sz
= 144;
98 const unsigned struct_kernel_stat64_sz
= 104;
99 #elif defined(__mips__)
100 const unsigned struct_kernel_stat_sz
=
102 ? FIRST_32_SECOND_64(104, 128)
103 : FIRST_32_SECOND_64((_MIPS_SIM
== _ABIN32
) ? 176 : 160, 216);
104 const unsigned struct_kernel_stat64_sz
= 104;
105 #elif defined(__s390__) && !defined(__s390x__)
106 const unsigned struct_kernel_stat_sz
= 64;
107 const unsigned struct_kernel_stat64_sz
= 104;
108 #elif defined(__s390x__)
109 const unsigned struct_kernel_stat_sz
= 144;
110 const unsigned struct_kernel_stat64_sz
= 0;
111 #elif defined(__sparc__) && defined(__arch64__)
112 const unsigned struct___old_kernel_stat_sz
= 0;
113 const unsigned struct_kernel_stat_sz
= 104;
114 const unsigned struct_kernel_stat64_sz
= 144;
115 #elif defined(__sparc__) && !defined(__arch64__)
116 const unsigned struct___old_kernel_stat_sz
= 0;
117 const unsigned struct_kernel_stat_sz
= 64;
118 const unsigned struct_kernel_stat64_sz
= 104;
119 #elif SANITIZER_RISCV64
120 const unsigned struct_kernel_stat_sz
= 128;
121 const unsigned struct_kernel_stat64_sz
= 0; // RISCV64 does not use stat64
122 # elif defined(__hexagon__)
123 const unsigned struct_kernel_stat_sz
= 128;
124 const unsigned struct_kernel_stat64_sz
= 0;
125 # elif defined(__loongarch__)
126 const unsigned struct_kernel_stat_sz
= 128;
127 const unsigned struct_kernel_stat64_sz
= 0;
129 struct __sanitizer_perf_event_attr
{
132 // More fields that vary with the kernel version.
135 extern unsigned struct_epoll_event_sz
;
136 extern unsigned struct_sysinfo_sz
;
137 extern unsigned __user_cap_header_struct_sz
;
138 extern unsigned __user_cap_data_struct_sz
;
139 extern unsigned struct_new_utsname_sz
;
140 extern unsigned struct_old_utsname_sz
;
141 extern unsigned struct_oldold_utsname_sz
;
143 const unsigned struct_kexec_segment_sz
= 4 * sizeof(unsigned long);
144 #endif // SANITIZER_LINUX
148 #if defined(__powerpc64__) || defined(__s390__) || defined(__loongarch__)
149 const unsigned struct___old_kernel_stat_sz
= 0;
150 #elif !defined(__sparc__)
151 const unsigned struct___old_kernel_stat_sz
= 32;
154 extern unsigned struct_rlimit_sz
;
155 extern unsigned struct_utimbuf_sz
;
156 extern unsigned struct_timespec_sz
;
158 struct __sanitizer_iocb
{
160 u32 aio_key_or_aio_reserved1
; // Simply crazy.
161 u32 aio_reserved1_or_aio_key
; // Luckily, we don't need these.
172 struct __sanitizer_io_event
{
179 const unsigned iocb_cmd_pread
= 0;
180 const unsigned iocb_cmd_pwrite
= 1;
181 const unsigned iocb_cmd_preadv
= 7;
182 const unsigned iocb_cmd_pwritev
= 8;
184 struct __sanitizer___sysctl_args
{
191 unsigned long ___unused
[4];
194 const unsigned old_sigset_t_sz
= sizeof(unsigned long);
196 struct __sanitizer_sem_t
{
197 #if SANITIZER_ANDROID && defined(_LP64)
199 #elif SANITIZER_ANDROID && !defined(_LP64)
201 #elif SANITIZER_LINUX
205 #endif // SANITIZER_LINUX
207 #if SANITIZER_ANDROID
208 struct __sanitizer_struct_mallinfo
{
213 #if SANITIZER_LINUX && !SANITIZER_ANDROID
214 struct __sanitizer_struct_mallinfo
{
218 extern unsigned struct_ustat_sz
;
219 extern unsigned struct_rlimit64_sz
;
220 extern unsigned struct_statvfs64_sz
;
222 struct __sanitizer_ipc_perm
{
233 #elif defined(__sparc__)
235 unsigned short __pad2
;
236 unsigned short __seq
;
237 unsigned long long __unused1
;
238 unsigned long long __unused2
;
241 unsigned short __seq
;
242 unsigned short __pad2
;
243 #if defined(__x86_64__) && !defined(_LP64)
247 unsigned long __unused1
;
248 unsigned long __unused2
;
253 struct __sanitizer_shmid_ds
{
254 __sanitizer_ipc_perm shm_perm
;
255 #if defined(__sparc__)
256 #if !defined(__arch64__)
260 #if !defined(__arch64__)
264 #if !defined(__arch64__)
271 unsigned long shm_nattch
;
272 unsigned long __glibc_reserved1
;
273 unsigned long __glibc_reserved2
;
277 #elif !defined(__powerpc64__)
280 #if defined(__x86_64__) && !defined(_LP64)
286 #if !defined(_LP64) && !defined(__mips__)
290 #if !defined(_LP64) && !defined(__mips__)
294 #if !defined(_LP64) && !defined(__mips__)
303 #if defined(__x86_64__) && !defined(_LP64)
316 #if SANITIZER_LINUX && !SANITIZER_ANDROID
317 extern unsigned struct_msqid_ds_sz
;
318 extern unsigned struct_mq_attr_sz
;
319 extern unsigned struct_timex_sz
;
320 extern unsigned struct_statvfs_sz
;
321 extern unsigned struct_crypt_data_sz
;
322 #endif // SANITIZER_LINUX && !SANITIZER_ANDROID
324 struct __sanitizer_iovec
{
329 #if !SANITIZER_ANDROID
330 struct __sanitizer_ifaddrs
{
331 struct __sanitizer_ifaddrs
*ifa_next
;
333 unsigned int ifa_flags
;
334 void *ifa_addr
; // (struct sockaddr *)
335 void *ifa_netmask
; // (struct sockaddr *)
336 // This is a union on Linux.
340 void *ifa_dstaddr
; // (struct sockaddr *)
343 #endif // !SANITIZER_ANDROID
346 typedef unsigned long __sanitizer_pthread_key_t
;
348 typedef unsigned __sanitizer_pthread_key_t
;
351 #if SANITIZER_LINUX && !SANITIZER_ANDROID
353 struct __sanitizer_XDR
{
362 const int __sanitizer_XDR_ENCODE
= 0;
363 const int __sanitizer_XDR_DECODE
= 1;
364 const int __sanitizer_XDR_FREE
= 2;
367 struct __sanitizer_passwd
{
376 #if !(SANITIZER_ANDROID && (SANITIZER_WORDSIZE == 32))
386 struct __sanitizer_group
{
393 # if (SANITIZER_LINUX && !SANITIZER_GLIBC && !SANITIZER_ANDROID) || \
394 (defined(__x86_64__) && !defined(_LP64)) || defined(__hexagon__)
395 typedef long long __sanitizer_time_t
;
397 typedef long __sanitizer_time_t
;
400 typedef long __sanitizer_suseconds_t
;
402 struct __sanitizer_timeval
{
403 __sanitizer_time_t tv_sec
;
404 __sanitizer_suseconds_t tv_usec
;
407 struct __sanitizer_itimerval
{
408 struct __sanitizer_timeval it_interval
;
409 struct __sanitizer_timeval it_value
;
412 struct __sanitizer_timeb
{
413 __sanitizer_time_t time
;
414 unsigned short millitm
;
419 struct __sanitizer_ether_addr
{
423 struct __sanitizer_tm
{
438 struct __sanitizer_mntent
{
447 struct __sanitizer_file_handle
{
448 unsigned int handle_bytes
;
450 unsigned char f_handle
[1]; // variable sized
455 struct __sanitizer_msghdr
{
457 unsigned msg_namelen
;
458 struct __sanitizer_iovec
*msg_iov
;
461 unsigned msg_controllen
;
464 struct __sanitizer_cmsghdr
{
470 // In POSIX, int msg_iovlen; socklen_t msg_controllen; socklen_t cmsg_len; but
471 // many implementations don't conform to the standard.
472 struct __sanitizer_msghdr
{
474 unsigned msg_namelen
;
475 struct __sanitizer_iovec
*msg_iov
;
481 struct __sanitizer_cmsghdr
{
489 struct __sanitizer_mmsghdr
{
490 __sanitizer_msghdr msg_hdr
;
491 unsigned int msg_len
;
496 struct __sanitizer_dirent
{
497 unsigned long long d_ino
;
498 unsigned long long d_seekoff
;
499 unsigned short d_reclen
;
500 // more fields that we don't care about
502 # elif (SANITIZER_LINUX && !SANITIZER_GLIBC) || defined(__x86_64__) || \
504 struct __sanitizer_dirent
{
505 unsigned long long d_ino
;
506 unsigned long long d_off
;
507 unsigned short d_reclen
;
508 // more fields that we don't care about
511 struct __sanitizer_dirent
{
514 unsigned short d_reclen
;
515 // more fields that we don't care about
520 struct __sanitizer_dirent64
{
521 unsigned long long d_ino
;
522 unsigned long long d_off
;
523 unsigned short d_reclen
;
524 // more fields that we don't care about
528 #if defined(__x86_64__) && !defined(_LP64)
529 typedef long long __sanitizer_clock_t
;
531 typedef long __sanitizer_clock_t
;
535 typedef int __sanitizer_clockid_t
;
539 # if defined(_LP64) || defined(__x86_64__) || defined(__powerpc__) || \
540 defined(__mips__) || defined(__hexagon__)
541 typedef unsigned __sanitizer___kernel_uid_t
;
542 typedef unsigned __sanitizer___kernel_gid_t
;
544 typedef unsigned short __sanitizer___kernel_uid_t
;
545 typedef unsigned short __sanitizer___kernel_gid_t
;
547 #if defined(__x86_64__) && !defined(_LP64)
548 typedef long long __sanitizer___kernel_off_t
;
550 typedef long __sanitizer___kernel_off_t
;
553 #if defined(__powerpc__) || defined(__mips__)
554 typedef unsigned int __sanitizer___kernel_old_uid_t
;
555 typedef unsigned int __sanitizer___kernel_old_gid_t
;
557 typedef unsigned short __sanitizer___kernel_old_uid_t
;
558 typedef unsigned short __sanitizer___kernel_old_gid_t
;
561 typedef long long __sanitizer___kernel_loff_t
;
563 unsigned long fds_bits
[1024 / (8 * sizeof(long))];
564 } __sanitizer___kernel_fd_set
;
567 // This thing depends on the platform. We are only interested in the upper
568 // limit. Verified with a compiler assert in .cpp.
569 union __sanitizer_pthread_attr_t
{
574 #if SANITIZER_ANDROID
576 typedef unsigned long __sanitizer_sigset_t
[16 / sizeof(unsigned long)];
578 typedef unsigned long __sanitizer_sigset_t
;
580 #elif SANITIZER_APPLE
581 typedef unsigned __sanitizer_sigset_t
;
582 #elif SANITIZER_LINUX
583 struct __sanitizer_sigset_t
{
584 // The size is determined by looking at sizeof of real sigset_t on linux.
585 uptr val
[128 / sizeof(uptr
)];
589 struct __sanitizer_siginfo_pad
{
590 // Require uptr, because siginfo_t is always pointer-size aligned on Linux.
591 uptr pad
[128 / sizeof(uptr
)];
595 # define SANITIZER_HAS_SIGINFO 1
596 union __sanitizer_siginfo
{
607 __sanitizer_siginfo_pad pad
;
610 # define SANITIZER_HAS_SIGINFO 0
611 typedef __sanitizer_siginfo_pad __sanitizer_siginfo
;
614 using __sanitizer_sighandler_ptr
= void (*)(int sig
);
615 using __sanitizer_sigactionhandler_ptr
= void (*)(int sig
,
616 __sanitizer_siginfo
*siginfo
,
619 // Linux system headers define the 'sa_handler' and 'sa_sigaction' macros.
620 #if SANITIZER_ANDROID && (SANITIZER_WORDSIZE == 64)
621 struct __sanitizer_sigaction
{
624 __sanitizer_sigactionhandler_ptr sigaction
;
625 __sanitizer_sighandler_ptr handler
;
627 __sanitizer_sigset_t sa_mask
;
628 void (*sa_restorer
)();
630 #elif SANITIZER_ANDROID && SANITIZER_MIPS32 // check this before WORDSIZE == 32
631 struct __sanitizer_sigaction
{
634 __sanitizer_sigactionhandler_ptr sigaction
;
635 __sanitizer_sighandler_ptr handler
;
637 __sanitizer_sigset_t sa_mask
;
639 #elif SANITIZER_ANDROID && (SANITIZER_WORDSIZE == 32)
640 struct __sanitizer_sigaction
{
642 __sanitizer_sigactionhandler_ptr sigaction
;
643 __sanitizer_sighandler_ptr handler
;
645 __sanitizer_sigset_t sa_mask
;
647 void (*sa_restorer
)();
649 #else // !SANITIZER_ANDROID
650 struct __sanitizer_sigaction
{
651 #if defined(__mips__) && !SANITIZER_FREEBSD
652 unsigned int sa_flags
;
655 __sanitizer_sigactionhandler_ptr sigaction
;
656 __sanitizer_sighandler_ptr handler
;
658 #if SANITIZER_FREEBSD
660 __sanitizer_sigset_t sa_mask
;
662 #if defined(__s390x__)
665 __sanitizer_sigset_t sa_mask
;
668 #if defined(__sparc__)
669 #if __GLIBC_PREREQ (2, 20)
670 // On sparc glibc 2.19 and earlier sa_flags was unsigned long.
671 #if defined(__arch64__)
672 // To maintain ABI compatibility on sparc64 when switching to an int,
673 // __glibc_reserved0 was added.
674 int __glibc_reserved0
;
678 unsigned long sa_flags
;
686 void (*sa_restorer
)();
688 #if defined(__mips__) && (SANITIZER_WORDSIZE == 32)
691 #if defined(__s390x__)
692 __sanitizer_sigset_t sa_mask
;
695 #endif // !SANITIZER_ANDROID
697 #if defined(__mips__)
698 #define __SANITIZER_KERNEL_NSIG 128
700 #define __SANITIZER_KERNEL_NSIG 64
703 struct __sanitizer_kernel_sigset_t
{
704 uptr sig
[__SANITIZER_KERNEL_NSIG
/ (sizeof(uptr
) * 8)];
707 // Linux system headers define the 'sa_handler' and 'sa_sigaction' macros.
709 struct __sanitizer_kernel_sigaction_t
{
710 unsigned int sa_flags
;
712 void (*handler
)(int signo
);
713 void (*sigaction
)(int signo
, __sanitizer_siginfo
*info
, void *ctx
);
715 __sanitizer_kernel_sigset_t sa_mask
;
716 void (*sa_restorer
)(void);
719 struct __sanitizer_kernel_sigaction_t
{
721 void (*handler
)(int signo
);
722 void (*sigaction
)(int signo
, __sanitizer_siginfo
*info
, void *ctx
);
724 unsigned long sa_flags
;
725 void (*sa_restorer
)(void);
726 __sanitizer_kernel_sigset_t sa_mask
;
730 extern const uptr sig_ign
;
731 extern const uptr sig_dfl
;
732 extern const uptr sig_err
;
733 extern const uptr sa_siginfo
;
741 uptr
__sanitizer_in_addr_sz(int af
);
744 struct __sanitizer_dl_phdr_info
{
746 const char *dlpi_name
;
747 const void *dlpi_phdr
;
751 extern unsigned struct_ElfW_Phdr_sz
;
754 struct __sanitizer_protoent
{
760 struct __sanitizer_netent
{
767 struct __sanitizer_addrinfo
{
772 #if SANITIZER_ANDROID || SANITIZER_APPLE
781 struct __sanitizer_addrinfo
*ai_next
;
784 struct __sanitizer_hostent
{
792 struct __sanitizer_pollfd
{
798 #if SANITIZER_ANDROID || SANITIZER_APPLE
799 typedef unsigned __sanitizer_nfds_t
;
801 typedef unsigned long __sanitizer_nfds_t
;
804 #if !SANITIZER_ANDROID
806 struct __sanitizer_glob_t
{
812 void (*gl_closedir
)(void *dirp
);
813 void *(*gl_readdir
)(void *dirp
);
814 void *(*gl_opendir
)(const char *);
815 int (*gl_lstat
)(const char *, void *);
816 int (*gl_stat
)(const char *, void *);
818 # endif // SANITIZER_LINUX
821 extern int glob_nomatch
;
822 extern int glob_altdirfunc
;
824 #endif // !SANITIZER_ANDROID
826 extern unsigned path_max
;
828 # if !SANITIZER_ANDROID
829 extern const int wordexp_wrde_dooffs
;
830 # endif // !SANITIZER_ANDROID
832 struct __sanitizer_wordexp_t
{
838 #if SANITIZER_LINUX && !SANITIZER_ANDROID
839 struct __sanitizer_FILE
{
844 char *_IO_write_base
;
850 char *_IO_backup_base
;
853 __sanitizer_FILE
*_chain
;
856 # define SANITIZER_HAS_STRUCT_FILE 1
858 typedef void __sanitizer_FILE
;
859 # define SANITIZER_HAS_STRUCT_FILE 0
862 #if SANITIZER_LINUX && !SANITIZER_ANDROID && \
863 (defined(__i386) || defined(__x86_64) || defined(__mips64) || \
864 defined(__powerpc64__) || defined(__aarch64__) || defined(__arm__) || \
865 defined(__s390__) || defined(__loongarch__) || SANITIZER_RISCV64)
866 extern unsigned struct_user_regs_struct_sz
;
867 extern unsigned struct_user_fpregs_struct_sz
;
868 extern unsigned struct_user_fpxregs_struct_sz
;
869 extern unsigned struct_user_vfpregs_struct_sz
;
871 extern int ptrace_peektext
;
872 extern int ptrace_peekdata
;
873 extern int ptrace_peekuser
;
874 extern int ptrace_getregs
;
875 extern int ptrace_setregs
;
876 extern int ptrace_getfpregs
;
877 extern int ptrace_setfpregs
;
878 extern int ptrace_getfpxregs
;
879 extern int ptrace_setfpxregs
;
880 extern int ptrace_getvfpregs
;
881 extern int ptrace_setvfpregs
;
882 extern int ptrace_getsiginfo
;
883 extern int ptrace_setsiginfo
;
884 extern int ptrace_getregset
;
885 extern int ptrace_setregset
;
886 extern int ptrace_geteventmsg
;
889 #if SANITIZER_LINUX && !SANITIZER_ANDROID
890 extern unsigned struct_shminfo_sz
;
891 extern unsigned struct_shm_info_sz
;
892 extern int shmctl_ipc_stat
;
893 extern int shmctl_ipc_info
;
894 extern int shmctl_shm_info
;
895 extern int shmctl_shm_stat
;
898 #if !SANITIZER_APPLE && !SANITIZER_FREEBSD
899 extern unsigned struct_utmp_sz
;
901 #if !SANITIZER_ANDROID
902 extern unsigned struct_utmpx_sz
;
905 extern int map_fixed
;
908 struct __sanitizer_ifconf
{
914 } __attribute__((packed
));
919 #if SANITIZER_LINUX && !SANITIZER_ANDROID
920 struct __sanitizer__obstack_chunk
{
922 struct __sanitizer__obstack_chunk
*prev
;
925 struct __sanitizer_obstack
{
927 struct __sanitizer__obstack_chunk
*chunk
;
933 typedef uptr (*__sanitizer_cookie_io_read
)(void *cookie
, char *buf
, uptr size
);
934 typedef uptr (*__sanitizer_cookie_io_write
)(void *cookie
, const char *buf
,
936 typedef int (*__sanitizer_cookie_io_seek
)(void *cookie
, u64
*offset
,
938 typedef int (*__sanitizer_cookie_io_close
)(void *cookie
);
940 struct __sanitizer_cookie_io_functions_t
{
941 __sanitizer_cookie_io_read read
;
942 __sanitizer_cookie_io_write write
;
943 __sanitizer_cookie_io_seek seek
;
944 __sanitizer_cookie_io_close close
;
949 #define IOC_TYPEBITS 8
950 #if defined(__powerpc__) || defined(__powerpc64__) || defined(__mips__) || \
952 #define IOC_SIZEBITS 13
953 #define IOC_DIRBITS 3
958 #define IOC_SIZEBITS 14
959 #define IOC_DIRBITS 2
964 #define IOC_NRMASK ((1 << IOC_NRBITS) - 1)
965 #define IOC_TYPEMASK ((1 << IOC_TYPEBITS) - 1)
966 #define IOC_SIZEMASK ((1 << IOC_SIZEBITS) - 1)
967 #if defined(IOC_DIRMASK)
970 #define IOC_DIRMASK ((1 << IOC_DIRBITS) - 1)
971 #define IOC_NRSHIFT 0
972 #define IOC_TYPESHIFT (IOC_NRSHIFT + IOC_NRBITS)
973 #define IOC_SIZESHIFT (IOC_TYPESHIFT + IOC_TYPEBITS)
974 #define IOC_DIRSHIFT (IOC_SIZESHIFT + IOC_SIZEBITS)
975 #define EVIOC_EV_MAX 0x1f
976 #define EVIOC_ABS_MAX 0x3f
978 #define IOC_DIR(nr) (((nr) >> IOC_DIRSHIFT) & IOC_DIRMASK)
979 #define IOC_TYPE(nr) (((nr) >> IOC_TYPESHIFT) & IOC_TYPEMASK)
980 #define IOC_NR(nr) (((nr) >> IOC_NRSHIFT) & IOC_NRMASK)
982 #if defined(__sparc__)
983 // In sparc the 14 bits SIZE field overlaps with the
984 // least significant bit of DIR, so either IOC_READ or
985 // IOC_WRITE shall be 1 in order to get a non-zero SIZE.
986 #define IOC_SIZE(nr) \
987 ((((((nr) >> 29) & 0x7) & (4U | 2U)) == 0) ? 0 : (((nr) >> 16) & 0x3fff))
989 #define IOC_SIZE(nr) (((nr) >> IOC_SIZESHIFT) & IOC_SIZEMASK)
992 extern unsigned struct_ifreq_sz
;
993 extern unsigned struct_termios_sz
;
994 extern unsigned struct_winsize_sz
;
997 extern unsigned struct_arpreq_sz
;
998 extern unsigned struct_cdrom_msf_sz
;
999 extern unsigned struct_cdrom_multisession_sz
;
1000 extern unsigned struct_cdrom_read_audio_sz
;
1001 extern unsigned struct_cdrom_subchnl_sz
;
1002 extern unsigned struct_cdrom_ti_sz
;
1003 extern unsigned struct_cdrom_tocentry_sz
;
1004 extern unsigned struct_cdrom_tochdr_sz
;
1005 extern unsigned struct_cdrom_volctrl_sz
;
1006 extern unsigned struct_ff_effect_sz
;
1007 extern unsigned struct_floppy_drive_params_sz
;
1008 extern unsigned struct_floppy_drive_struct_sz
;
1009 extern unsigned struct_floppy_fdc_state_sz
;
1010 extern unsigned struct_floppy_max_errors_sz
;
1011 extern unsigned struct_floppy_raw_cmd_sz
;
1012 extern unsigned struct_floppy_struct_sz
;
1013 extern unsigned struct_floppy_write_errors_sz
;
1014 extern unsigned struct_format_descr_sz
;
1015 extern unsigned struct_hd_driveid_sz
;
1016 extern unsigned struct_hd_geometry_sz
;
1017 extern unsigned struct_input_absinfo_sz
;
1018 extern unsigned struct_input_id_sz
;
1019 extern unsigned struct_mtpos_sz
;
1020 extern unsigned struct_termio_sz
;
1021 extern unsigned struct_vt_consize_sz
;
1022 extern unsigned struct_vt_sizes_sz
;
1023 extern unsigned struct_vt_stat_sz
;
1024 #endif // SANITIZER_LINUX
1027 extern unsigned struct_copr_buffer_sz
;
1028 extern unsigned struct_copr_debug_buf_sz
;
1029 extern unsigned struct_copr_msg_sz
;
1030 extern unsigned struct_midi_info_sz
;
1031 extern unsigned struct_mtget_sz
;
1032 extern unsigned struct_mtop_sz
;
1033 extern unsigned struct_rtentry_sz
;
1034 extern unsigned struct_sbi_instrument_sz
;
1035 extern unsigned struct_seq_event_rec_sz
;
1036 extern unsigned struct_synth_info_sz
;
1037 extern unsigned struct_vt_mode_sz
;
1038 #endif // SANITIZER_LINUX
1040 #if SANITIZER_LINUX && !SANITIZER_ANDROID
1041 extern unsigned struct_ax25_parms_struct_sz
;
1042 extern unsigned struct_input_keymap_entry_sz
;
1043 extern unsigned struct_ipx_config_data_sz
;
1044 extern unsigned struct_kbdiacrs_sz
;
1045 extern unsigned struct_kbentry_sz
;
1046 extern unsigned struct_kbkeycode_sz
;
1047 extern unsigned struct_kbsentry_sz
;
1048 extern unsigned struct_mtconfiginfo_sz
;
1049 extern unsigned struct_nr_parms_struct_sz
;
1050 extern unsigned struct_scc_modem_sz
;
1051 extern unsigned struct_scc_stat_sz
;
1052 extern unsigned struct_serial_multiport_struct_sz
;
1053 extern unsigned struct_serial_struct_sz
;
1054 extern unsigned struct_sockaddr_ax25_sz
;
1055 extern unsigned struct_unimapdesc_sz
;
1056 extern unsigned struct_unimapinit_sz
;
1057 #endif // SANITIZER_LINUX && !SANITIZER_ANDROID
1059 extern const unsigned long __sanitizer_bufsiz
;
1061 #if SANITIZER_LINUX && !SANITIZER_ANDROID
1062 extern unsigned struct_audio_buf_info_sz
;
1063 extern unsigned struct_ppp_stats_sz
;
1064 #endif // (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
1066 #if !SANITIZER_ANDROID && !SANITIZER_APPLE
1067 extern unsigned struct_sioc_sg_req_sz
;
1068 extern unsigned struct_sioc_vif_req_sz
;
1071 // ioctl request identifiers
1073 // A special value to mark ioctls that are not present on the target platform,
1074 // when it can not be determined without including any system headers.
1075 extern const unsigned IOCTL_NOT_PRESENT
;
1077 extern unsigned IOCTL_FIOASYNC
;
1078 extern unsigned IOCTL_FIOCLEX
;
1079 extern unsigned IOCTL_FIOGETOWN
;
1080 extern unsigned IOCTL_FIONBIO
;
1081 extern unsigned IOCTL_FIONCLEX
;
1082 extern unsigned IOCTL_FIOSETOWN
;
1083 extern unsigned IOCTL_SIOCADDMULTI
;
1084 extern unsigned IOCTL_SIOCATMARK
;
1085 extern unsigned IOCTL_SIOCDELMULTI
;
1086 extern unsigned IOCTL_SIOCGIFADDR
;
1087 extern unsigned IOCTL_SIOCGIFBRDADDR
;
1088 extern unsigned IOCTL_SIOCGIFCONF
;
1089 extern unsigned IOCTL_SIOCGIFDSTADDR
;
1090 extern unsigned IOCTL_SIOCGIFFLAGS
;
1091 extern unsigned IOCTL_SIOCGIFMETRIC
;
1092 extern unsigned IOCTL_SIOCGIFMTU
;
1093 extern unsigned IOCTL_SIOCGIFNETMASK
;
1094 extern unsigned IOCTL_SIOCGPGRP
;
1095 extern unsigned IOCTL_SIOCSIFADDR
;
1096 extern unsigned IOCTL_SIOCSIFBRDADDR
;
1097 extern unsigned IOCTL_SIOCSIFDSTADDR
;
1098 extern unsigned IOCTL_SIOCSIFFLAGS
;
1099 extern unsigned IOCTL_SIOCSIFMETRIC
;
1100 extern unsigned IOCTL_SIOCSIFMTU
;
1101 extern unsigned IOCTL_SIOCSIFNETMASK
;
1102 extern unsigned IOCTL_SIOCSPGRP
;
1103 extern unsigned IOCTL_TIOCCONS
;
1104 extern unsigned IOCTL_TIOCEXCL
;
1105 extern unsigned IOCTL_TIOCGETD
;
1106 extern unsigned IOCTL_TIOCGPGRP
;
1107 extern unsigned IOCTL_TIOCGWINSZ
;
1108 extern unsigned IOCTL_TIOCMBIC
;
1109 extern unsigned IOCTL_TIOCMBIS
;
1110 extern unsigned IOCTL_TIOCMGET
;
1111 extern unsigned IOCTL_TIOCMSET
;
1112 extern unsigned IOCTL_TIOCNOTTY
;
1113 extern unsigned IOCTL_TIOCNXCL
;
1114 extern unsigned IOCTL_TIOCOUTQ
;
1115 extern unsigned IOCTL_TIOCPKT
;
1116 extern unsigned IOCTL_TIOCSCTTY
;
1117 extern unsigned IOCTL_TIOCSETD
;
1118 extern unsigned IOCTL_TIOCSPGRP
;
1119 extern unsigned IOCTL_TIOCSTI
;
1120 extern unsigned IOCTL_TIOCSWINSZ
;
1121 #if SANITIZER_LINUX && !SANITIZER_ANDROID
1122 extern unsigned IOCTL_SIOCGETSGCNT
;
1123 extern unsigned IOCTL_SIOCGETVIFCNT
;
1126 extern unsigned IOCTL_EVIOCGABS
;
1127 extern unsigned IOCTL_EVIOCGBIT
;
1128 extern unsigned IOCTL_EVIOCGEFFECTS
;
1129 extern unsigned IOCTL_EVIOCGID
;
1130 extern unsigned IOCTL_EVIOCGKEY
;
1131 extern unsigned IOCTL_EVIOCGKEYCODE
;
1132 extern unsigned IOCTL_EVIOCGLED
;
1133 extern unsigned IOCTL_EVIOCGNAME
;
1134 extern unsigned IOCTL_EVIOCGPHYS
;
1135 extern unsigned IOCTL_EVIOCGRAB
;
1136 extern unsigned IOCTL_EVIOCGREP
;
1137 extern unsigned IOCTL_EVIOCGSND
;
1138 extern unsigned IOCTL_EVIOCGSW
;
1139 extern unsigned IOCTL_EVIOCGUNIQ
;
1140 extern unsigned IOCTL_EVIOCGVERSION
;
1141 extern unsigned IOCTL_EVIOCRMFF
;
1142 extern unsigned IOCTL_EVIOCSABS
;
1143 extern unsigned IOCTL_EVIOCSFF
;
1144 extern unsigned IOCTL_EVIOCSKEYCODE
;
1145 extern unsigned IOCTL_EVIOCSREP
;
1146 extern unsigned IOCTL_BLKFLSBUF
;
1147 extern unsigned IOCTL_BLKGETSIZE
;
1148 extern unsigned IOCTL_BLKRAGET
;
1149 extern unsigned IOCTL_BLKRASET
;
1150 extern unsigned IOCTL_BLKROGET
;
1151 extern unsigned IOCTL_BLKROSET
;
1152 extern unsigned IOCTL_BLKRRPART
;
1153 extern unsigned IOCTL_BLKFRASET
;
1154 extern unsigned IOCTL_BLKFRAGET
;
1155 extern unsigned IOCTL_BLKSECTSET
;
1156 extern unsigned IOCTL_BLKSECTGET
;
1157 extern unsigned IOCTL_BLKSSZGET
;
1158 extern unsigned IOCTL_BLKBSZGET
;
1159 extern unsigned IOCTL_BLKBSZSET
;
1160 extern unsigned IOCTL_BLKGETSIZE64
;
1161 extern unsigned IOCTL_CDROMAUDIOBUFSIZ
;
1162 extern unsigned IOCTL_CDROMEJECT
;
1163 extern unsigned IOCTL_CDROMEJECT_SW
;
1164 extern unsigned IOCTL_CDROMMULTISESSION
;
1165 extern unsigned IOCTL_CDROMPAUSE
;
1166 extern unsigned IOCTL_CDROMPLAYMSF
;
1167 extern unsigned IOCTL_CDROMPLAYTRKIND
;
1168 extern unsigned IOCTL_CDROMREADAUDIO
;
1169 extern unsigned IOCTL_CDROMREADCOOKED
;
1170 extern unsigned IOCTL_CDROMREADMODE1
;
1171 extern unsigned IOCTL_CDROMREADMODE2
;
1172 extern unsigned IOCTL_CDROMREADRAW
;
1173 extern unsigned IOCTL_CDROMREADTOCENTRY
;
1174 extern unsigned IOCTL_CDROMREADTOCHDR
;
1175 extern unsigned IOCTL_CDROMRESET
;
1176 extern unsigned IOCTL_CDROMRESUME
;
1177 extern unsigned IOCTL_CDROMSEEK
;
1178 extern unsigned IOCTL_CDROMSTART
;
1179 extern unsigned IOCTL_CDROMSTOP
;
1180 extern unsigned IOCTL_CDROMSUBCHNL
;
1181 extern unsigned IOCTL_CDROMVOLCTRL
;
1182 extern unsigned IOCTL_CDROMVOLREAD
;
1183 extern unsigned IOCTL_CDROM_GET_UPC
;
1184 extern unsigned IOCTL_FDCLRPRM
;
1185 extern unsigned IOCTL_FDDEFPRM
;
1186 extern unsigned IOCTL_FDFLUSH
;
1187 extern unsigned IOCTL_FDFMTBEG
;
1188 extern unsigned IOCTL_FDFMTEND
;
1189 extern unsigned IOCTL_FDFMTTRK
;
1190 extern unsigned IOCTL_FDGETDRVPRM
;
1191 extern unsigned IOCTL_FDGETDRVSTAT
;
1192 extern unsigned IOCTL_FDGETDRVTYP
;
1193 extern unsigned IOCTL_FDGETFDCSTAT
;
1194 extern unsigned IOCTL_FDGETMAXERRS
;
1195 extern unsigned IOCTL_FDGETPRM
;
1196 extern unsigned IOCTL_FDMSGOFF
;
1197 extern unsigned IOCTL_FDMSGON
;
1198 extern unsigned IOCTL_FDPOLLDRVSTAT
;
1199 extern unsigned IOCTL_FDRAWCMD
;
1200 extern unsigned IOCTL_FDRESET
;
1201 extern unsigned IOCTL_FDSETDRVPRM
;
1202 extern unsigned IOCTL_FDSETEMSGTRESH
;
1203 extern unsigned IOCTL_FDSETMAXERRS
;
1204 extern unsigned IOCTL_FDSETPRM
;
1205 extern unsigned IOCTL_FDTWADDLE
;
1206 extern unsigned IOCTL_FDWERRORCLR
;
1207 extern unsigned IOCTL_FDWERRORGET
;
1208 extern unsigned IOCTL_HDIO_DRIVE_CMD
;
1209 extern unsigned IOCTL_HDIO_GETGEO
;
1210 extern unsigned IOCTL_HDIO_GET_32BIT
;
1211 extern unsigned IOCTL_HDIO_GET_DMA
;
1212 extern unsigned IOCTL_HDIO_GET_IDENTITY
;
1213 extern unsigned IOCTL_HDIO_GET_KEEPSETTINGS
;
1214 extern unsigned IOCTL_HDIO_GET_MULTCOUNT
;
1215 extern unsigned IOCTL_HDIO_GET_NOWERR
;
1216 extern unsigned IOCTL_HDIO_GET_UNMASKINTR
;
1217 extern unsigned IOCTL_HDIO_SET_32BIT
;
1218 extern unsigned IOCTL_HDIO_SET_DMA
;
1219 extern unsigned IOCTL_HDIO_SET_KEEPSETTINGS
;
1220 extern unsigned IOCTL_HDIO_SET_MULTCOUNT
;
1221 extern unsigned IOCTL_HDIO_SET_NOWERR
;
1222 extern unsigned IOCTL_HDIO_SET_UNMASKINTR
;
1223 extern unsigned IOCTL_MTIOCPOS
;
1224 extern unsigned IOCTL_PPPIOCGASYNCMAP
;
1225 extern unsigned IOCTL_PPPIOCGDEBUG
;
1226 extern unsigned IOCTL_PPPIOCGFLAGS
;
1227 extern unsigned IOCTL_PPPIOCGUNIT
;
1228 extern unsigned IOCTL_PPPIOCGXASYNCMAP
;
1229 extern unsigned IOCTL_PPPIOCSASYNCMAP
;
1230 extern unsigned IOCTL_PPPIOCSDEBUG
;
1231 extern unsigned IOCTL_PPPIOCSFLAGS
;
1232 extern unsigned IOCTL_PPPIOCSMAXCID
;
1233 extern unsigned IOCTL_PPPIOCSMRU
;
1234 extern unsigned IOCTL_PPPIOCSXASYNCMAP
;
1235 extern unsigned IOCTL_SIOCDARP
;
1236 extern unsigned IOCTL_SIOCDRARP
;
1237 extern unsigned IOCTL_SIOCGARP
;
1238 extern unsigned IOCTL_SIOCGIFENCAP
;
1239 extern unsigned IOCTL_SIOCGIFHWADDR
;
1240 extern unsigned IOCTL_SIOCGIFMAP
;
1241 extern unsigned IOCTL_SIOCGIFMEM
;
1242 extern unsigned IOCTL_SIOCGIFNAME
;
1243 extern unsigned IOCTL_SIOCGIFSLAVE
;
1244 extern unsigned IOCTL_SIOCGRARP
;
1245 extern unsigned IOCTL_SIOCGSTAMP
;
1246 extern unsigned IOCTL_SIOCSARP
;
1247 extern unsigned IOCTL_SIOCSIFENCAP
;
1248 extern unsigned IOCTL_SIOCSIFHWADDR
;
1249 extern unsigned IOCTL_SIOCSIFLINK
;
1250 extern unsigned IOCTL_SIOCSIFMAP
;
1251 extern unsigned IOCTL_SIOCSIFMEM
;
1252 extern unsigned IOCTL_SIOCSIFSLAVE
;
1253 extern unsigned IOCTL_SIOCSRARP
;
1254 extern unsigned IOCTL_SNDCTL_COPR_HALT
;
1255 extern unsigned IOCTL_SNDCTL_COPR_LOAD
;
1256 extern unsigned IOCTL_SNDCTL_COPR_RCODE
;
1257 extern unsigned IOCTL_SNDCTL_COPR_RCVMSG
;
1258 extern unsigned IOCTL_SNDCTL_COPR_RDATA
;
1259 extern unsigned IOCTL_SNDCTL_COPR_RESET
;
1260 extern unsigned IOCTL_SNDCTL_COPR_RUN
;
1261 extern unsigned IOCTL_SNDCTL_COPR_SENDMSG
;
1262 extern unsigned IOCTL_SNDCTL_COPR_WCODE
;
1263 extern unsigned IOCTL_SNDCTL_COPR_WDATA
;
1264 extern unsigned IOCTL_TCFLSH
;
1265 extern unsigned IOCTL_TCGETA
;
1266 extern unsigned IOCTL_TCGETS
;
1267 extern unsigned IOCTL_TCSBRK
;
1268 extern unsigned IOCTL_TCSBRKP
;
1269 extern unsigned IOCTL_TCSETA
;
1270 extern unsigned IOCTL_TCSETAF
;
1271 extern unsigned IOCTL_TCSETAW
;
1272 extern unsigned IOCTL_TCSETS
;
1273 extern unsigned IOCTL_TCSETSF
;
1274 extern unsigned IOCTL_TCSETSW
;
1275 extern unsigned IOCTL_TCXONC
;
1276 extern unsigned IOCTL_TIOCGLCKTRMIOS
;
1277 extern unsigned IOCTL_TIOCGSOFTCAR
;
1278 extern unsigned IOCTL_TIOCINQ
;
1279 extern unsigned IOCTL_TIOCLINUX
;
1280 extern unsigned IOCTL_TIOCSERCONFIG
;
1281 extern unsigned IOCTL_TIOCSERGETLSR
;
1282 extern unsigned IOCTL_TIOCSERGWILD
;
1283 extern unsigned IOCTL_TIOCSERSWILD
;
1284 extern unsigned IOCTL_TIOCSLCKTRMIOS
;
1285 extern unsigned IOCTL_TIOCSSOFTCAR
;
1286 extern unsigned IOCTL_VT_DISALLOCATE
;
1287 extern unsigned IOCTL_VT_GETSTATE
;
1288 extern unsigned IOCTL_VT_RESIZE
;
1289 extern unsigned IOCTL_VT_RESIZEX
;
1290 extern unsigned IOCTL_VT_SENDSIG
;
1291 extern unsigned IOCTL_MTIOCGET
;
1292 extern unsigned IOCTL_MTIOCTOP
;
1293 extern unsigned IOCTL_SIOCADDRT
;
1294 extern unsigned IOCTL_SIOCDELRT
;
1295 extern unsigned IOCTL_SNDCTL_DSP_GETBLKSIZE
;
1296 extern unsigned IOCTL_SNDCTL_DSP_GETFMTS
;
1297 extern unsigned IOCTL_SNDCTL_DSP_NONBLOCK
;
1298 extern unsigned IOCTL_SNDCTL_DSP_POST
;
1299 extern unsigned IOCTL_SNDCTL_DSP_RESET
;
1300 extern unsigned IOCTL_SNDCTL_DSP_SETFMT
;
1301 extern unsigned IOCTL_SNDCTL_DSP_SETFRAGMENT
;
1302 extern unsigned IOCTL_SNDCTL_DSP_SPEED
;
1303 extern unsigned IOCTL_SNDCTL_DSP_STEREO
;
1304 extern unsigned IOCTL_SNDCTL_DSP_SUBDIVIDE
;
1305 extern unsigned IOCTL_SNDCTL_DSP_SYNC
;
1306 extern unsigned IOCTL_SNDCTL_FM_4OP_ENABLE
;
1307 extern unsigned IOCTL_SNDCTL_FM_LOAD_INSTR
;
1308 extern unsigned IOCTL_SNDCTL_MIDI_INFO
;
1309 extern unsigned IOCTL_SNDCTL_MIDI_PRETIME
;
1310 extern unsigned IOCTL_SNDCTL_SEQ_CTRLRATE
;
1311 extern unsigned IOCTL_SNDCTL_SEQ_GETINCOUNT
;
1312 extern unsigned IOCTL_SNDCTL_SEQ_GETOUTCOUNT
;
1313 extern unsigned IOCTL_SNDCTL_SEQ_NRMIDIS
;
1314 extern unsigned IOCTL_SNDCTL_SEQ_NRSYNTHS
;
1315 extern unsigned IOCTL_SNDCTL_SEQ_OUTOFBAND
;
1316 extern unsigned IOCTL_SNDCTL_SEQ_PANIC
;
1317 extern unsigned IOCTL_SNDCTL_SEQ_PERCMODE
;
1318 extern unsigned IOCTL_SNDCTL_SEQ_RESET
;
1319 extern unsigned IOCTL_SNDCTL_SEQ_RESETSAMPLES
;
1320 extern unsigned IOCTL_SNDCTL_SEQ_SYNC
;
1321 extern unsigned IOCTL_SNDCTL_SEQ_TESTMIDI
;
1322 extern unsigned IOCTL_SNDCTL_SEQ_THRESHOLD
;
1323 extern unsigned IOCTL_SNDCTL_SYNTH_INFO
;
1324 extern unsigned IOCTL_SNDCTL_SYNTH_MEMAVL
;
1325 extern unsigned IOCTL_SNDCTL_TMR_CONTINUE
;
1326 extern unsigned IOCTL_SNDCTL_TMR_METRONOME
;
1327 extern unsigned IOCTL_SNDCTL_TMR_SELECT
;
1328 extern unsigned IOCTL_SNDCTL_TMR_SOURCE
;
1329 extern unsigned IOCTL_SNDCTL_TMR_START
;
1330 extern unsigned IOCTL_SNDCTL_TMR_STOP
;
1331 extern unsigned IOCTL_SNDCTL_TMR_TEMPO
;
1332 extern unsigned IOCTL_SNDCTL_TMR_TIMEBASE
;
1333 extern unsigned IOCTL_SOUND_MIXER_READ_ALTPCM
;
1334 extern unsigned IOCTL_SOUND_MIXER_READ_BASS
;
1335 extern unsigned IOCTL_SOUND_MIXER_READ_CAPS
;
1336 extern unsigned IOCTL_SOUND_MIXER_READ_CD
;
1337 extern unsigned IOCTL_SOUND_MIXER_READ_DEVMASK
;
1338 extern unsigned IOCTL_SOUND_MIXER_READ_ENHANCE
;
1339 extern unsigned IOCTL_SOUND_MIXER_READ_IGAIN
;
1340 extern unsigned IOCTL_SOUND_MIXER_READ_IMIX
;
1341 extern unsigned IOCTL_SOUND_MIXER_READ_LINE1
;
1342 extern unsigned IOCTL_SOUND_MIXER_READ_LINE2
;
1343 extern unsigned IOCTL_SOUND_MIXER_READ_LINE3
;
1344 extern unsigned IOCTL_SOUND_MIXER_READ_LINE
;
1345 extern unsigned IOCTL_SOUND_MIXER_READ_LOUD
;
1346 extern unsigned IOCTL_SOUND_MIXER_READ_MIC
;
1347 extern unsigned IOCTL_SOUND_MIXER_READ_MUTE
;
1348 extern unsigned IOCTL_SOUND_MIXER_READ_OGAIN
;
1349 extern unsigned IOCTL_SOUND_MIXER_READ_PCM
;
1350 extern unsigned IOCTL_SOUND_MIXER_READ_RECLEV
;
1351 extern unsigned IOCTL_SOUND_MIXER_READ_RECMASK
;
1352 extern unsigned IOCTL_SOUND_MIXER_READ_RECSRC
;
1353 extern unsigned IOCTL_SOUND_MIXER_READ_SPEAKER
;
1354 extern unsigned IOCTL_SOUND_MIXER_READ_STEREODEVS
;
1355 extern unsigned IOCTL_SOUND_MIXER_READ_SYNTH
;
1356 extern unsigned IOCTL_SOUND_MIXER_READ_TREBLE
;
1357 extern unsigned IOCTL_SOUND_MIXER_READ_VOLUME
;
1358 extern unsigned IOCTL_SOUND_MIXER_WRITE_ALTPCM
;
1359 extern unsigned IOCTL_SOUND_MIXER_WRITE_BASS
;
1360 extern unsigned IOCTL_SOUND_MIXER_WRITE_CD
;
1361 extern unsigned IOCTL_SOUND_MIXER_WRITE_ENHANCE
;
1362 extern unsigned IOCTL_SOUND_MIXER_WRITE_IGAIN
;
1363 extern unsigned IOCTL_SOUND_MIXER_WRITE_IMIX
;
1364 extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE1
;
1365 extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE2
;
1366 extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE3
;
1367 extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE
;
1368 extern unsigned IOCTL_SOUND_MIXER_WRITE_LOUD
;
1369 extern unsigned IOCTL_SOUND_MIXER_WRITE_MIC
;
1370 extern unsigned IOCTL_SOUND_MIXER_WRITE_MUTE
;
1371 extern unsigned IOCTL_SOUND_MIXER_WRITE_OGAIN
;
1372 extern unsigned IOCTL_SOUND_MIXER_WRITE_PCM
;
1373 extern unsigned IOCTL_SOUND_MIXER_WRITE_RECLEV
;
1374 extern unsigned IOCTL_SOUND_MIXER_WRITE_RECSRC
;
1375 extern unsigned IOCTL_SOUND_MIXER_WRITE_SPEAKER
;
1376 extern unsigned IOCTL_SOUND_MIXER_WRITE_SYNTH
;
1377 extern unsigned IOCTL_SOUND_MIXER_WRITE_TREBLE
;
1378 extern unsigned IOCTL_SOUND_MIXER_WRITE_VOLUME
;
1379 extern unsigned IOCTL_SOUND_PCM_READ_BITS
;
1380 extern unsigned IOCTL_SOUND_PCM_READ_CHANNELS
;
1381 extern unsigned IOCTL_SOUND_PCM_READ_FILTER
;
1382 extern unsigned IOCTL_SOUND_PCM_READ_RATE
;
1383 extern unsigned IOCTL_SOUND_PCM_WRITE_CHANNELS
;
1384 extern unsigned IOCTL_SOUND_PCM_WRITE_FILTER
;
1385 extern unsigned IOCTL_VT_ACTIVATE
;
1386 extern unsigned IOCTL_VT_GETMODE
;
1387 extern unsigned IOCTL_VT_OPENQRY
;
1388 extern unsigned IOCTL_VT_RELDISP
;
1389 extern unsigned IOCTL_VT_SETMODE
;
1390 extern unsigned IOCTL_VT_WAITACTIVE
;
1391 #endif // SANITIZER_LINUX
1393 #if SANITIZER_LINUX && !SANITIZER_ANDROID
1394 extern unsigned IOCTL_EQL_EMANCIPATE
;
1395 extern unsigned IOCTL_EQL_ENSLAVE
;
1396 extern unsigned IOCTL_EQL_GETMASTRCFG
;
1397 extern unsigned IOCTL_EQL_GETSLAVECFG
;
1398 extern unsigned IOCTL_EQL_SETMASTRCFG
;
1399 extern unsigned IOCTL_EQL_SETSLAVECFG
;
1400 extern unsigned IOCTL_EVIOCGKEYCODE_V2
;
1401 extern unsigned IOCTL_EVIOCGPROP
;
1402 extern unsigned IOCTL_EVIOCSKEYCODE_V2
;
1403 extern unsigned IOCTL_FS_IOC_GETFLAGS
;
1404 extern unsigned IOCTL_FS_IOC_GETVERSION
;
1405 extern unsigned IOCTL_FS_IOC_SETFLAGS
;
1406 extern unsigned IOCTL_FS_IOC_SETVERSION
;
1407 extern unsigned IOCTL_GIO_CMAP
;
1408 extern unsigned IOCTL_GIO_FONT
;
1409 extern unsigned IOCTL_GIO_UNIMAP
;
1410 extern unsigned IOCTL_GIO_UNISCRNMAP
;
1411 extern unsigned IOCTL_KDADDIO
;
1412 extern unsigned IOCTL_KDDELIO
;
1413 extern unsigned IOCTL_KDGETKEYCODE
;
1414 extern unsigned IOCTL_KDGKBDIACR
;
1415 extern unsigned IOCTL_KDGKBENT
;
1416 extern unsigned IOCTL_KDGKBLED
;
1417 extern unsigned IOCTL_KDGKBMETA
;
1418 extern unsigned IOCTL_KDGKBSENT
;
1419 extern unsigned IOCTL_KDMAPDISP
;
1420 extern unsigned IOCTL_KDSETKEYCODE
;
1421 extern unsigned IOCTL_KDSIGACCEPT
;
1422 extern unsigned IOCTL_KDSKBDIACR
;
1423 extern unsigned IOCTL_KDSKBENT
;
1424 extern unsigned IOCTL_KDSKBLED
;
1425 extern unsigned IOCTL_KDSKBMETA
;
1426 extern unsigned IOCTL_KDSKBSENT
;
1427 extern unsigned IOCTL_KDUNMAPDISP
;
1428 extern unsigned IOCTL_LPABORT
;
1429 extern unsigned IOCTL_LPABORTOPEN
;
1430 extern unsigned IOCTL_LPCAREFUL
;
1431 extern unsigned IOCTL_LPCHAR
;
1432 extern unsigned IOCTL_LPGETIRQ
;
1433 extern unsigned IOCTL_LPGETSTATUS
;
1434 extern unsigned IOCTL_LPRESET
;
1435 extern unsigned IOCTL_LPSETIRQ
;
1436 extern unsigned IOCTL_LPTIME
;
1437 extern unsigned IOCTL_LPWAIT
;
1438 extern unsigned IOCTL_MTIOCGETCONFIG
;
1439 extern unsigned IOCTL_MTIOCSETCONFIG
;
1440 extern unsigned IOCTL_PIO_CMAP
;
1441 extern unsigned IOCTL_PIO_FONT
;
1442 extern unsigned IOCTL_PIO_UNIMAP
;
1443 extern unsigned IOCTL_PIO_UNIMAPCLR
;
1444 extern unsigned IOCTL_PIO_UNISCRNMAP
;
1445 extern unsigned IOCTL_SCSI_IOCTL_GET_IDLUN
;
1446 extern unsigned IOCTL_SCSI_IOCTL_PROBE_HOST
;
1447 extern unsigned IOCTL_SCSI_IOCTL_TAGGED_DISABLE
;
1448 extern unsigned IOCTL_SCSI_IOCTL_TAGGED_ENABLE
;
1449 extern unsigned IOCTL_SIOCAIPXITFCRT
;
1450 extern unsigned IOCTL_SIOCAIPXPRISLT
;
1451 extern unsigned IOCTL_SIOCAX25ADDUID
;
1452 extern unsigned IOCTL_SIOCAX25DELUID
;
1453 extern unsigned IOCTL_SIOCAX25GETPARMS
;
1454 extern unsigned IOCTL_SIOCAX25GETUID
;
1455 extern unsigned IOCTL_SIOCAX25NOUID
;
1456 extern unsigned IOCTL_SIOCAX25SETPARMS
;
1457 extern unsigned IOCTL_SIOCDEVPLIP
;
1458 extern unsigned IOCTL_SIOCIPXCFGDATA
;
1459 extern unsigned IOCTL_SIOCNRDECOBS
;
1460 extern unsigned IOCTL_SIOCNRGETPARMS
;
1461 extern unsigned IOCTL_SIOCNRRTCTL
;
1462 extern unsigned IOCTL_SIOCNRSETPARMS
;
1463 extern unsigned IOCTL_SNDCTL_DSP_GETISPACE
;
1464 extern unsigned IOCTL_SNDCTL_DSP_GETOSPACE
;
1465 extern unsigned IOCTL_TIOCGSERIAL
;
1466 extern unsigned IOCTL_TIOCSERGETMULTI
;
1467 extern unsigned IOCTL_TIOCSERSETMULTI
;
1468 extern unsigned IOCTL_TIOCSSERIAL
;
1469 extern unsigned IOCTL_GIO_SCRNMAP
;
1470 extern unsigned IOCTL_KDDISABIO
;
1471 extern unsigned IOCTL_KDENABIO
;
1472 extern unsigned IOCTL_KDGETLED
;
1473 extern unsigned IOCTL_KDGETMODE
;
1474 extern unsigned IOCTL_KDGKBMODE
;
1475 extern unsigned IOCTL_KDGKBTYPE
;
1476 extern unsigned IOCTL_KDMKTONE
;
1477 extern unsigned IOCTL_KDSETLED
;
1478 extern unsigned IOCTL_KDSETMODE
;
1479 extern unsigned IOCTL_KDSKBMODE
;
1480 extern unsigned IOCTL_KIOCSOUND
;
1481 extern unsigned IOCTL_PIO_SCRNMAP
;
1484 extern const int si_SEGV_MAPERR
;
1485 extern const int si_SEGV_ACCERR
;
1486 } // namespace __sanitizer
1488 #define CHECK_TYPE_SIZE(TYPE) \
1489 COMPILER_CHECK(sizeof(__sanitizer_##TYPE) == sizeof(TYPE))
1491 #define CHECK_SIZE_AND_OFFSET(CLASS, MEMBER) \
1492 COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *)NULL)->MEMBER) == \
1493 sizeof(((CLASS *)NULL)->MEMBER)); \
1494 COMPILER_CHECK(offsetof(__sanitizer_##CLASS, MEMBER) == \
1495 offsetof(CLASS, MEMBER))
1497 // For sigaction, which is a function and struct at the same time,
1498 // and thus requires explicit "struct" in sizeof() expression.
1499 #define CHECK_STRUCT_SIZE_AND_OFFSET(CLASS, MEMBER) \
1500 COMPILER_CHECK(sizeof(((struct __sanitizer_##CLASS *)NULL)->MEMBER) == \
1501 sizeof(((struct CLASS *)NULL)->MEMBER)); \
1502 COMPILER_CHECK(offsetof(struct __sanitizer_##CLASS, MEMBER) == \
1503 offsetof(struct CLASS, MEMBER))
1505 #define SIGACTION_SYMNAME sigaction
1507 #endif // SANITIZER_LINUX || SANITIZER_APPLE