1 //===-- sanitizer_platform_limits_posix.h ---------------------------------===//
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
6 //===----------------------------------------------------------------------===//
8 // This file is a part of Sanitizer common code.
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 #if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_MAC
18 #include "sanitizer_internal_defs.h"
19 #include "sanitizer_platform.h"
22 // FreeBSD's dlopen() returns a pointer to an Obj_Entry structure that
23 // incorporates the map structure.
24 # define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) \
25 ((link_map*)((handle) == nullptr ? nullptr : ((char*)(handle) + 544)))
26 // Get sys/_types.h, because that tells us whether 64-bit inodes are
27 // used in struct dirent below.
28 #include <sys/_types.h>
30 # define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) ((link_map*)(handle))
31 #endif // !SANITIZER_FREEBSD
33 #ifndef __GLIBC_PREREQ
34 #define __GLIBC_PREREQ(x, y) 0
37 namespace __sanitizer
{
38 extern unsigned struct_utsname_sz
;
39 extern unsigned struct_stat_sz
;
40 #if !SANITIZER_FREEBSD && !SANITIZER_IOS
41 extern unsigned struct_stat64_sz
;
43 extern unsigned struct_rusage_sz
;
44 extern unsigned siginfo_t_sz
;
45 extern unsigned struct_itimerval_sz
;
46 extern unsigned pthread_t_sz
;
47 extern unsigned pthread_cond_t_sz
;
48 extern unsigned pid_t_sz
;
49 extern unsigned timeval_sz
;
50 extern unsigned uid_t_sz
;
51 extern unsigned gid_t_sz
;
52 extern unsigned mbstate_t_sz
;
53 extern unsigned struct_timezone_sz
;
54 extern unsigned struct_tms_sz
;
55 extern unsigned struct_itimerspec_sz
;
56 extern unsigned struct_sigevent_sz
;
57 extern unsigned struct_sched_param_sz
;
58 extern unsigned struct_statfs64_sz
;
60 #if !SANITIZER_ANDROID
61 extern unsigned struct_statfs_sz
;
62 extern unsigned struct_sockaddr_sz
;
63 extern unsigned ucontext_t_sz
;
64 #endif // !SANITIZER_ANDROID
68 #if defined(__x86_64__)
69 const unsigned struct_kernel_stat_sz
= 144;
70 const unsigned struct_kernel_stat64_sz
= 0;
71 #elif defined(__i386__)
72 const unsigned struct_kernel_stat_sz
= 64;
73 const unsigned struct_kernel_stat64_sz
= 96;
74 #elif defined(__arm__)
75 const unsigned struct_kernel_stat_sz
= 64;
76 const unsigned struct_kernel_stat64_sz
= 104;
77 #elif defined(__aarch64__)
78 const unsigned struct_kernel_stat_sz
= 128;
79 const unsigned struct_kernel_stat64_sz
= 104;
80 #elif defined(__powerpc__) && !defined(__powerpc64__)
81 const unsigned struct_kernel_stat_sz
= 72;
82 const unsigned struct_kernel_stat64_sz
= 104;
83 #elif defined(__powerpc64__)
84 const unsigned struct_kernel_stat_sz
= 144;
85 const unsigned struct_kernel_stat64_sz
= 104;
86 #elif defined(__mips__)
87 const unsigned struct_kernel_stat_sz
=
88 SANITIZER_ANDROID
? FIRST_32_SECOND_64(104, 128) :
89 FIRST_32_SECOND_64(160, 216);
90 const unsigned struct_kernel_stat64_sz
= 104;
91 #elif defined(__s390__) && !defined(__s390x__)
92 const unsigned struct_kernel_stat_sz
= 64;
93 const unsigned struct_kernel_stat64_sz
= 104;
94 #elif defined(__s390x__)
95 const unsigned struct_kernel_stat_sz
= 144;
96 const unsigned struct_kernel_stat64_sz
= 0;
97 #elif defined(__sparc__) && defined(__arch64__)
98 const unsigned struct___old_kernel_stat_sz
= 0;
99 const unsigned struct_kernel_stat_sz
= 104;
100 const unsigned struct_kernel_stat64_sz
= 144;
101 #elif defined(__sparc__) && !defined(__arch64__)
102 const unsigned struct___old_kernel_stat_sz
= 0;
103 const unsigned struct_kernel_stat_sz
= 64;
104 const unsigned struct_kernel_stat64_sz
= 104;
106 struct __sanitizer_perf_event_attr
{
109 // More fields that vary with the kernel version.
112 extern unsigned struct_epoll_event_sz
;
113 extern unsigned struct_sysinfo_sz
;
114 extern unsigned __user_cap_header_struct_sz
;
115 extern unsigned __user_cap_data_struct_sz
;
116 extern unsigned struct_new_utsname_sz
;
117 extern unsigned struct_old_utsname_sz
;
118 extern unsigned struct_oldold_utsname_sz
;
120 const unsigned struct_kexec_segment_sz
= 4 * sizeof(unsigned long);
121 #endif // SANITIZER_LINUX
123 #if SANITIZER_LINUX || SANITIZER_FREEBSD
125 #if defined(__powerpc64__) || defined(__s390__)
126 const unsigned struct___old_kernel_stat_sz
= 0;
127 #elif !defined(__sparc__)
128 const unsigned struct___old_kernel_stat_sz
= 32;
131 extern unsigned struct_rlimit_sz
;
132 extern unsigned struct_utimbuf_sz
;
133 extern unsigned struct_timespec_sz
;
135 struct __sanitizer_iocb
{
137 u32 aio_key_or_aio_reserved1
; // Simply crazy.
138 u32 aio_reserved1_or_aio_key
; // Luckily, we don't need these.
149 struct __sanitizer_io_event
{
156 const unsigned iocb_cmd_pread
= 0;
157 const unsigned iocb_cmd_pwrite
= 1;
158 const unsigned iocb_cmd_preadv
= 7;
159 const unsigned iocb_cmd_pwritev
= 8;
161 struct __sanitizer___sysctl_args
{
168 unsigned long ___unused
[4];
171 const unsigned old_sigset_t_sz
= sizeof(unsigned long);
173 struct __sanitizer_sem_t
{
174 #if SANITIZER_ANDROID && defined(_LP64)
176 #elif SANITIZER_ANDROID && !defined(_LP64)
178 #elif SANITIZER_LINUX
180 #elif SANITIZER_FREEBSD
184 #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
186 #if SANITIZER_ANDROID
187 struct __sanitizer_mallinfo
{
192 #if SANITIZER_LINUX && !SANITIZER_ANDROID
193 struct __sanitizer_mallinfo
{
197 extern unsigned struct_ustat_sz
;
198 extern unsigned struct_rlimit64_sz
;
199 extern unsigned struct_statvfs64_sz
;
201 struct __sanitizer_ipc_perm
{
212 #elif defined(__sparc__)
213 #if defined(__arch64__)
215 unsigned short __pad1
;
217 unsigned short __pad1
;
219 unsigned short __pad2
;
221 unsigned short __seq
;
222 unsigned long long __unused1
;
223 unsigned long long __unused2
;
224 #elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__)
226 unsigned short __seq
;
227 unsigned short __pad1
;
228 unsigned long __unused1
;
229 unsigned long __unused2
;
232 unsigned short __pad1
;
233 unsigned short __seq
;
234 unsigned short __pad2
;
235 #if defined(__x86_64__) && !defined(_LP64)
239 unsigned long __unused1
;
240 unsigned long __unused2
;
245 struct __sanitizer_shmid_ds
{
246 __sanitizer_ipc_perm shm_perm
;
247 #if defined(__sparc__)
248 #if !defined(__arch64__)
252 #if !defined(__arch64__)
256 #if !defined(__arch64__)
263 unsigned long shm_nattch
;
264 unsigned long __glibc_reserved1
;
265 unsigned long __glibc_reserved2
;
269 #elif !defined(__powerpc64__)
272 #if defined(__x86_64__) && !defined(_LP64)
278 #if !defined(_LP64) && !defined(__mips__)
282 #if !defined(_LP64) && !defined(__mips__)
286 #if !defined(_LP64) && !defined(__mips__)
295 #if defined(__x86_64__) && !defined(_LP64)
306 #elif SANITIZER_FREEBSD
307 struct __sanitizer_ipc_perm
{
317 struct __sanitizer_shmid_ds
{
318 __sanitizer_ipc_perm shm_perm
;
319 unsigned long shm_segsz
;
320 unsigned int shm_lpid
;
321 unsigned int shm_cpid
;
323 unsigned long shm_atime
;
324 unsigned long shm_dtime
;
325 unsigned long shm_ctime
;
329 #if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
330 extern unsigned struct_msqid_ds_sz
;
331 extern unsigned struct_mq_attr_sz
;
332 extern unsigned struct_timex_sz
;
333 extern unsigned struct_statvfs_sz
;
334 #endif // (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
336 struct __sanitizer_iovec
{
341 #if !SANITIZER_ANDROID
342 struct __sanitizer_ifaddrs
{
343 struct __sanitizer_ifaddrs
*ifa_next
;
345 unsigned int ifa_flags
;
346 void *ifa_addr
; // (struct sockaddr *)
347 void *ifa_netmask
; // (struct sockaddr *)
348 // This is a union on Linux.
352 void *ifa_dstaddr
; // (struct sockaddr *)
355 #endif // !SANITIZER_ANDROID
358 typedef unsigned long __sanitizer_pthread_key_t
;
360 typedef unsigned __sanitizer_pthread_key_t
;
363 #if SANITIZER_LINUX && !SANITIZER_ANDROID
365 struct __sanitizer_XDR
{
374 const int __sanitizer_XDR_ENCODE
= 0;
375 const int __sanitizer_XDR_DECODE
= 1;
376 const int __sanitizer_XDR_FREE
= 2;
379 struct __sanitizer_passwd
{
384 #if SANITIZER_MAC || SANITIZER_FREEBSD
388 #if !(SANITIZER_ANDROID && (SANITIZER_WORDSIZE == 32))
393 #if SANITIZER_MAC || SANITIZER_FREEBSD
396 #if SANITIZER_FREEBSD
401 struct __sanitizer_group
{
408 #if defined(__x86_64__) && !defined(_LP64)
409 typedef long long __sanitizer_time_t
;
411 typedef long __sanitizer_time_t
;
414 struct __sanitizer_timeb
{
415 __sanitizer_time_t time
;
416 unsigned short millitm
;
421 struct __sanitizer_ether_addr
{
425 struct __sanitizer_tm
{
440 struct __sanitizer_mntent
{
450 #if SANITIZER_MAC || SANITIZER_FREEBSD
451 struct __sanitizer_msghdr
{
453 unsigned msg_namelen
;
454 struct __sanitizer_iovec
*msg_iov
;
457 unsigned msg_controllen
;
460 struct __sanitizer_cmsghdr
{
466 struct __sanitizer_msghdr
{
468 unsigned msg_namelen
;
469 struct __sanitizer_iovec
*msg_iov
;
475 struct __sanitizer_cmsghdr
{
483 struct __sanitizer_dirent
{
484 unsigned long long d_ino
;
485 unsigned long long d_seekoff
;
486 unsigned short d_reclen
;
487 // more fields that we don't care about
489 #elif SANITIZER_FREEBSD
490 struct __sanitizer_dirent
{
492 unsigned long long d_fileno
;
493 unsigned long long d_off
;
495 unsigned int d_fileno
;
497 unsigned short d_reclen
;
498 // more fields that we don't care about
500 #elif SANITIZER_ANDROID || defined(__x86_64__)
501 struct __sanitizer_dirent
{
502 unsigned long long d_ino
;
503 unsigned long long d_off
;
504 unsigned short d_reclen
;
505 // more fields that we don't care about
508 struct __sanitizer_dirent
{
511 unsigned short d_reclen
;
512 // more fields that we don't care about
516 #if SANITIZER_LINUX && !SANITIZER_ANDROID
517 struct __sanitizer_dirent64
{
518 unsigned long long d_ino
;
519 unsigned long long d_off
;
520 unsigned short d_reclen
;
521 // more fields that we don't care about
525 // 'clock_t' is 32 bits wide on x64 FreeBSD
526 #if SANITIZER_FREEBSD
527 typedef int __sanitizer_clock_t
;
528 #elif defined(__x86_64__) && !defined(_LP64)
529 typedef long long __sanitizer_clock_t
;
531 typedef long __sanitizer_clock_t
;
535 typedef int __sanitizer_clockid_t
;
538 #if SANITIZER_LINUX || SANITIZER_FREEBSD
539 #if defined(_LP64) || defined(__x86_64__) || defined(__powerpc__)\
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 .cc.
569 const int pthread_attr_t_max_sz
= 128;
570 union __sanitizer_pthread_attr_t
{
571 char size
[pthread_attr_t_max_sz
]; // NOLINT
575 #if SANITIZER_ANDROID
577 typedef unsigned long __sanitizer_sigset_t
[16/sizeof(unsigned long)];
579 typedef unsigned long __sanitizer_sigset_t
;
582 typedef unsigned __sanitizer_sigset_t
;
583 #elif SANITIZER_LINUX
584 struct __sanitizer_sigset_t
{
585 // The size is determined by looking at sizeof of real sigset_t on linux.
586 uptr val
[128 / sizeof(uptr
)];
588 #elif SANITIZER_FREEBSD
589 struct __sanitizer_sigset_t
{
591 unsigned int __bits
[4];
595 // Linux system headers define the 'sa_handler' and 'sa_sigaction' macros.
596 #if SANITIZER_ANDROID && (SANITIZER_WORDSIZE == 64)
597 struct __sanitizer_sigaction
{
600 void (*sigaction
)(int sig
, void *siginfo
, void *uctx
);
601 void (*handler
)(int sig
);
603 __sanitizer_sigset_t sa_mask
;
604 void (*sa_restorer
)();
606 #elif SANITIZER_ANDROID && SANITIZER_MIPS32 // check this before WORDSIZE == 32
607 struct __sanitizer_sigaction
{
610 void (*sigaction
)(int sig
, void *siginfo
, void *uctx
);
611 void (*handler
)(int sig
);
613 __sanitizer_sigset_t sa_mask
;
615 #elif SANITIZER_ANDROID && (SANITIZER_WORDSIZE == 32)
616 struct __sanitizer_sigaction
{
618 void (*sigaction
)(int sig
, void *siginfo
, void *uctx
);
619 void (*handler
)(int sig
);
621 __sanitizer_sigset_t sa_mask
;
623 void (*sa_restorer
)();
625 #else // !SANITIZER_ANDROID
626 struct __sanitizer_sigaction
{
627 #if defined(__mips__) && !SANITIZER_FREEBSD
628 unsigned int sa_flags
;
631 void (*sigaction
)(int sig
, void *siginfo
, void *uctx
);
632 void (*handler
)(int sig
);
634 #if SANITIZER_FREEBSD
636 __sanitizer_sigset_t sa_mask
;
638 #if defined(__s390x__)
641 __sanitizer_sigset_t sa_mask
;
644 #if defined(__sparc__)
645 #if __GLIBC_PREREQ (2, 20)
646 // On sparc glibc 2.19 and earlier sa_flags was unsigned long.
647 #if defined(__arch64__)
648 // To maintain ABI compatibility on sparc64 when switching to an int,
649 // __glibc_reserved0 was added.
650 int __glibc_reserved0
;
654 unsigned long sa_flags
;
662 void (*sa_restorer
)();
664 #if defined(__mips__) && (SANITIZER_WORDSIZE == 32)
667 #if defined(__s390x__)
668 __sanitizer_sigset_t sa_mask
;
671 #endif // !SANITIZER_ANDROID
673 #if SANITIZER_FREEBSD
674 typedef __sanitizer_sigset_t __sanitizer_kernel_sigset_t
;
675 #elif defined(__mips__)
676 struct __sanitizer_kernel_sigset_t
{
680 struct __sanitizer_kernel_sigset_t
{
685 // Linux system headers define the 'sa_handler' and 'sa_sigaction' macros.
687 struct __sanitizer_kernel_sigaction_t
{
688 unsigned int sa_flags
;
690 void (*handler
)(int signo
);
691 void (*sigaction
)(int signo
, void *info
, void *ctx
);
693 __sanitizer_kernel_sigset_t sa_mask
;
694 void (*sa_restorer
)(void);
697 struct __sanitizer_kernel_sigaction_t
{
699 void (*handler
)(int signo
);
700 void (*sigaction
)(int signo
, void *info
, void *ctx
);
702 unsigned long sa_flags
;
703 void (*sa_restorer
)(void);
704 __sanitizer_kernel_sigset_t sa_mask
;
710 extern uptr sa_siginfo
;
718 uptr
__sanitizer_in_addr_sz(int af
);
720 #if SANITIZER_LINUX || SANITIZER_FREEBSD
721 struct __sanitizer_dl_phdr_info
{
723 const char *dlpi_name
;
724 const void *dlpi_phdr
;
728 extern unsigned struct_ElfW_Phdr_sz
;
731 struct __sanitizer_addrinfo
{
736 #if SANITIZER_ANDROID || SANITIZER_MAC || SANITIZER_FREEBSD
745 struct __sanitizer_addrinfo
*ai_next
;
748 struct __sanitizer_hostent
{
756 struct __sanitizer_pollfd
{
762 #if SANITIZER_ANDROID || SANITIZER_MAC || SANITIZER_FREEBSD
763 typedef unsigned __sanitizer_nfds_t
;
765 typedef unsigned long __sanitizer_nfds_t
;
768 #if !SANITIZER_ANDROID
770 struct __sanitizer_glob_t
{
776 void (*gl_closedir
)(void *dirp
);
777 void *(*gl_readdir
)(void *dirp
);
778 void *(*gl_opendir
)(const char *);
779 int (*gl_lstat
)(const char *, void *);
780 int (*gl_stat
)(const char *, void *);
782 # elif SANITIZER_FREEBSD
783 struct __sanitizer_glob_t
{
789 int (*gl_errfunc
)(const char*, int);
790 void (*gl_closedir
)(void *dirp
);
791 struct dirent
*(*gl_readdir
)(void *dirp
);
792 void *(*gl_opendir
)(const char*);
793 int (*gl_lstat
)(const char*, void* /* struct stat* */);
794 int (*gl_stat
)(const char*, void* /* struct stat* */);
796 # endif // SANITIZER_FREEBSD
798 # if SANITIZER_LINUX || SANITIZER_FREEBSD
799 extern int glob_nomatch
;
800 extern int glob_altdirfunc
;
802 #endif // !SANITIZER_ANDROID
804 extern unsigned path_max
;
806 struct __sanitizer_wordexp_t
{
810 #if SANITIZER_FREEBSD
816 #if SANITIZER_LINUX && !SANITIZER_ANDROID
817 struct __sanitizer_FILE
{
822 char *_IO_write_base
;
828 char *_IO_backup_base
;
831 __sanitizer_FILE
*_chain
;
834 # define SANITIZER_HAS_STRUCT_FILE 1
836 typedef void __sanitizer_FILE
;
837 # define SANITIZER_HAS_STRUCT_FILE 0
840 #if SANITIZER_LINUX && !SANITIZER_ANDROID && \
841 (defined(__i386) || defined(__x86_64) || defined(__mips64) || \
842 defined(__powerpc64__) || defined(__aarch64__) || defined(__arm__) || \
844 extern unsigned struct_user_regs_struct_sz
;
845 extern unsigned struct_user_fpregs_struct_sz
;
846 extern unsigned struct_user_fpxregs_struct_sz
;
847 extern unsigned struct_user_vfpregs_struct_sz
;
849 extern int ptrace_peektext
;
850 extern int ptrace_peekdata
;
851 extern int ptrace_peekuser
;
852 extern int ptrace_getregs
;
853 extern int ptrace_setregs
;
854 extern int ptrace_getfpregs
;
855 extern int ptrace_setfpregs
;
856 extern int ptrace_getfpxregs
;
857 extern int ptrace_setfpxregs
;
858 extern int ptrace_getvfpregs
;
859 extern int ptrace_setvfpregs
;
860 extern int ptrace_getsiginfo
;
861 extern int ptrace_setsiginfo
;
862 extern int ptrace_getregset
;
863 extern int ptrace_setregset
;
864 extern int ptrace_geteventmsg
;
867 #if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
868 extern unsigned struct_shminfo_sz
;
869 extern unsigned struct_shm_info_sz
;
870 extern int shmctl_ipc_stat
;
871 extern int shmctl_ipc_info
;
872 extern int shmctl_shm_info
;
873 extern int shmctl_shm_stat
;
876 #if !SANITIZER_MAC && !SANITIZER_FREEBSD
877 extern unsigned struct_utmp_sz
;
879 #if !SANITIZER_ANDROID
880 extern unsigned struct_utmpx_sz
;
883 extern int map_fixed
;
886 struct __sanitizer_ifconf
{
892 } __attribute__((packed
));
897 #if SANITIZER_LINUX && !SANITIZER_ANDROID
898 struct __sanitizer__obstack_chunk
{
900 struct __sanitizer__obstack_chunk
*prev
;
903 struct __sanitizer_obstack
{
905 struct __sanitizer__obstack_chunk
*chunk
;
911 typedef uptr (*__sanitizer_cookie_io_read
)(void *cookie
, char *buf
, uptr size
);
912 typedef uptr (*__sanitizer_cookie_io_write
)(void *cookie
, const char *buf
,
914 typedef int (*__sanitizer_cookie_io_seek
)(void *cookie
, u64
*offset
,
916 typedef int (*__sanitizer_cookie_io_close
)(void *cookie
);
918 struct __sanitizer_cookie_io_functions_t
{
919 __sanitizer_cookie_io_read read
;
920 __sanitizer_cookie_io_write write
;
921 __sanitizer_cookie_io_seek seek
;
922 __sanitizer_cookie_io_close close
;
927 #define IOC_TYPEBITS 8
928 #if defined(__powerpc__) || defined(__powerpc64__) || defined(__mips__) || \
930 #define IOC_SIZEBITS 13
931 #define IOC_DIRBITS 3
936 #define IOC_SIZEBITS 14
937 #define IOC_DIRBITS 2
942 #define IOC_NRMASK ((1 << IOC_NRBITS) - 1)
943 #define IOC_TYPEMASK ((1 << IOC_TYPEBITS) - 1)
944 #define IOC_SIZEMASK ((1 << IOC_SIZEBITS) - 1)
945 #if defined(IOC_DIRMASK)
948 #define IOC_DIRMASK ((1 << IOC_DIRBITS) - 1)
949 #define IOC_NRSHIFT 0
950 #define IOC_TYPESHIFT (IOC_NRSHIFT + IOC_NRBITS)
951 #define IOC_SIZESHIFT (IOC_TYPESHIFT + IOC_TYPEBITS)
952 #define IOC_DIRSHIFT (IOC_SIZESHIFT + IOC_SIZEBITS)
953 #define EVIOC_EV_MAX 0x1f
954 #define EVIOC_ABS_MAX 0x3f
956 #define IOC_DIR(nr) (((nr) >> IOC_DIRSHIFT) & IOC_DIRMASK)
957 #define IOC_TYPE(nr) (((nr) >> IOC_TYPESHIFT) & IOC_TYPEMASK)
958 #define IOC_NR(nr) (((nr) >> IOC_NRSHIFT) & IOC_NRMASK)
960 #if defined(__sparc__)
961 // In sparc the 14 bits SIZE field overlaps with the
962 // least significant bit of DIR, so either IOC_READ or
963 // IOC_WRITE shall be 1 in order to get a non-zero SIZE.
964 #define IOC_SIZE(nr) \
965 ((((((nr) >> 29) & 0x7) & (4U | 2U)) == 0) ? 0 : (((nr) >> 16) & 0x3fff))
967 #define IOC_SIZE(nr) (((nr) >> IOC_SIZESHIFT) & IOC_SIZEMASK)
970 extern unsigned struct_ifreq_sz
;
971 extern unsigned struct_termios_sz
;
972 extern unsigned struct_winsize_sz
;
975 extern unsigned struct_arpreq_sz
;
976 extern unsigned struct_cdrom_msf_sz
;
977 extern unsigned struct_cdrom_multisession_sz
;
978 extern unsigned struct_cdrom_read_audio_sz
;
979 extern unsigned struct_cdrom_subchnl_sz
;
980 extern unsigned struct_cdrom_ti_sz
;
981 extern unsigned struct_cdrom_tocentry_sz
;
982 extern unsigned struct_cdrom_tochdr_sz
;
983 extern unsigned struct_cdrom_volctrl_sz
;
984 extern unsigned struct_ff_effect_sz
;
985 extern unsigned struct_floppy_drive_params_sz
;
986 extern unsigned struct_floppy_drive_struct_sz
;
987 extern unsigned struct_floppy_fdc_state_sz
;
988 extern unsigned struct_floppy_max_errors_sz
;
989 extern unsigned struct_floppy_raw_cmd_sz
;
990 extern unsigned struct_floppy_struct_sz
;
991 extern unsigned struct_floppy_write_errors_sz
;
992 extern unsigned struct_format_descr_sz
;
993 extern unsigned struct_hd_driveid_sz
;
994 extern unsigned struct_hd_geometry_sz
;
995 extern unsigned struct_input_absinfo_sz
;
996 extern unsigned struct_input_id_sz
;
997 extern unsigned struct_mtpos_sz
;
998 extern unsigned struct_termio_sz
;
999 extern unsigned struct_vt_consize_sz
;
1000 extern unsigned struct_vt_sizes_sz
;
1001 extern unsigned struct_vt_stat_sz
;
1002 #endif // SANITIZER_LINUX
1004 #if SANITIZER_LINUX || SANITIZER_FREEBSD
1005 extern unsigned struct_copr_buffer_sz
;
1006 extern unsigned struct_copr_debug_buf_sz
;
1007 extern unsigned struct_copr_msg_sz
;
1008 extern unsigned struct_midi_info_sz
;
1009 extern unsigned struct_mtget_sz
;
1010 extern unsigned struct_mtop_sz
;
1011 extern unsigned struct_rtentry_sz
;
1012 extern unsigned struct_sbi_instrument_sz
;
1013 extern unsigned struct_seq_event_rec_sz
;
1014 extern unsigned struct_synth_info_sz
;
1015 extern unsigned struct_vt_mode_sz
;
1016 #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
1018 #if SANITIZER_LINUX && !SANITIZER_ANDROID
1019 extern unsigned struct_ax25_parms_struct_sz
;
1020 extern unsigned struct_cyclades_monitor_sz
;
1021 extern unsigned struct_input_keymap_entry_sz
;
1022 extern unsigned struct_ipx_config_data_sz
;
1023 extern unsigned struct_kbdiacrs_sz
;
1024 extern unsigned struct_kbentry_sz
;
1025 extern unsigned struct_kbkeycode_sz
;
1026 extern unsigned struct_kbsentry_sz
;
1027 extern unsigned struct_mtconfiginfo_sz
;
1028 extern unsigned struct_nr_parms_struct_sz
;
1029 extern unsigned struct_scc_modem_sz
;
1030 extern unsigned struct_scc_stat_sz
;
1031 extern unsigned struct_serial_multiport_struct_sz
;
1032 extern unsigned struct_serial_struct_sz
;
1033 extern unsigned struct_sockaddr_ax25_sz
;
1034 extern unsigned struct_unimapdesc_sz
;
1035 extern unsigned struct_unimapinit_sz
;
1036 #endif // SANITIZER_LINUX && !SANITIZER_ANDROID
1038 #if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
1039 extern unsigned struct_audio_buf_info_sz
;
1040 extern unsigned struct_ppp_stats_sz
;
1041 #endif // (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
1043 #if !SANITIZER_ANDROID && !SANITIZER_MAC
1044 extern unsigned struct_sioc_sg_req_sz
;
1045 extern unsigned struct_sioc_vif_req_sz
;
1048 // ioctl request identifiers
1050 // A special value to mark ioctls that are not present on the target platform,
1051 // when it can not be determined without including any system headers.
1052 extern const unsigned IOCTL_NOT_PRESENT
;
1054 extern unsigned IOCTL_FIOASYNC
;
1055 extern unsigned IOCTL_FIOCLEX
;
1056 extern unsigned IOCTL_FIOGETOWN
;
1057 extern unsigned IOCTL_FIONBIO
;
1058 extern unsigned IOCTL_FIONCLEX
;
1059 extern unsigned IOCTL_FIOSETOWN
;
1060 extern unsigned IOCTL_SIOCADDMULTI
;
1061 extern unsigned IOCTL_SIOCATMARK
;
1062 extern unsigned IOCTL_SIOCDELMULTI
;
1063 extern unsigned IOCTL_SIOCGIFADDR
;
1064 extern unsigned IOCTL_SIOCGIFBRDADDR
;
1065 extern unsigned IOCTL_SIOCGIFCONF
;
1066 extern unsigned IOCTL_SIOCGIFDSTADDR
;
1067 extern unsigned IOCTL_SIOCGIFFLAGS
;
1068 extern unsigned IOCTL_SIOCGIFMETRIC
;
1069 extern unsigned IOCTL_SIOCGIFMTU
;
1070 extern unsigned IOCTL_SIOCGIFNETMASK
;
1071 extern unsigned IOCTL_SIOCGPGRP
;
1072 extern unsigned IOCTL_SIOCSIFADDR
;
1073 extern unsigned IOCTL_SIOCSIFBRDADDR
;
1074 extern unsigned IOCTL_SIOCSIFDSTADDR
;
1075 extern unsigned IOCTL_SIOCSIFFLAGS
;
1076 extern unsigned IOCTL_SIOCSIFMETRIC
;
1077 extern unsigned IOCTL_SIOCSIFMTU
;
1078 extern unsigned IOCTL_SIOCSIFNETMASK
;
1079 extern unsigned IOCTL_SIOCSPGRP
;
1080 extern unsigned IOCTL_TIOCCONS
;
1081 extern unsigned IOCTL_TIOCEXCL
;
1082 extern unsigned IOCTL_TIOCGETD
;
1083 extern unsigned IOCTL_TIOCGPGRP
;
1084 extern unsigned IOCTL_TIOCGWINSZ
;
1085 extern unsigned IOCTL_TIOCMBIC
;
1086 extern unsigned IOCTL_TIOCMBIS
;
1087 extern unsigned IOCTL_TIOCMGET
;
1088 extern unsigned IOCTL_TIOCMSET
;
1089 extern unsigned IOCTL_TIOCNOTTY
;
1090 extern unsigned IOCTL_TIOCNXCL
;
1091 extern unsigned IOCTL_TIOCOUTQ
;
1092 extern unsigned IOCTL_TIOCPKT
;
1093 extern unsigned IOCTL_TIOCSCTTY
;
1094 extern unsigned IOCTL_TIOCSETD
;
1095 extern unsigned IOCTL_TIOCSPGRP
;
1096 extern unsigned IOCTL_TIOCSTI
;
1097 extern unsigned IOCTL_TIOCSWINSZ
;
1098 #if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
1099 extern unsigned IOCTL_SIOCGETSGCNT
;
1100 extern unsigned IOCTL_SIOCGETVIFCNT
;
1103 extern unsigned IOCTL_EVIOCGABS
;
1104 extern unsigned IOCTL_EVIOCGBIT
;
1105 extern unsigned IOCTL_EVIOCGEFFECTS
;
1106 extern unsigned IOCTL_EVIOCGID
;
1107 extern unsigned IOCTL_EVIOCGKEY
;
1108 extern unsigned IOCTL_EVIOCGKEYCODE
;
1109 extern unsigned IOCTL_EVIOCGLED
;
1110 extern unsigned IOCTL_EVIOCGNAME
;
1111 extern unsigned IOCTL_EVIOCGPHYS
;
1112 extern unsigned IOCTL_EVIOCGRAB
;
1113 extern unsigned IOCTL_EVIOCGREP
;
1114 extern unsigned IOCTL_EVIOCGSND
;
1115 extern unsigned IOCTL_EVIOCGSW
;
1116 extern unsigned IOCTL_EVIOCGUNIQ
;
1117 extern unsigned IOCTL_EVIOCGVERSION
;
1118 extern unsigned IOCTL_EVIOCRMFF
;
1119 extern unsigned IOCTL_EVIOCSABS
;
1120 extern unsigned IOCTL_EVIOCSFF
;
1121 extern unsigned IOCTL_EVIOCSKEYCODE
;
1122 extern unsigned IOCTL_EVIOCSREP
;
1123 extern unsigned IOCTL_BLKFLSBUF
;
1124 extern unsigned IOCTL_BLKGETSIZE
;
1125 extern unsigned IOCTL_BLKRAGET
;
1126 extern unsigned IOCTL_BLKRASET
;
1127 extern unsigned IOCTL_BLKROGET
;
1128 extern unsigned IOCTL_BLKROSET
;
1129 extern unsigned IOCTL_BLKRRPART
;
1130 extern unsigned IOCTL_CDROMAUDIOBUFSIZ
;
1131 extern unsigned IOCTL_CDROMEJECT
;
1132 extern unsigned IOCTL_CDROMEJECT_SW
;
1133 extern unsigned IOCTL_CDROMMULTISESSION
;
1134 extern unsigned IOCTL_CDROMPAUSE
;
1135 extern unsigned IOCTL_CDROMPLAYMSF
;
1136 extern unsigned IOCTL_CDROMPLAYTRKIND
;
1137 extern unsigned IOCTL_CDROMREADAUDIO
;
1138 extern unsigned IOCTL_CDROMREADCOOKED
;
1139 extern unsigned IOCTL_CDROMREADMODE1
;
1140 extern unsigned IOCTL_CDROMREADMODE2
;
1141 extern unsigned IOCTL_CDROMREADRAW
;
1142 extern unsigned IOCTL_CDROMREADTOCENTRY
;
1143 extern unsigned IOCTL_CDROMREADTOCHDR
;
1144 extern unsigned IOCTL_CDROMRESET
;
1145 extern unsigned IOCTL_CDROMRESUME
;
1146 extern unsigned IOCTL_CDROMSEEK
;
1147 extern unsigned IOCTL_CDROMSTART
;
1148 extern unsigned IOCTL_CDROMSTOP
;
1149 extern unsigned IOCTL_CDROMSUBCHNL
;
1150 extern unsigned IOCTL_CDROMVOLCTRL
;
1151 extern unsigned IOCTL_CDROMVOLREAD
;
1152 extern unsigned IOCTL_CDROM_GET_UPC
;
1153 extern unsigned IOCTL_FDCLRPRM
;
1154 extern unsigned IOCTL_FDDEFPRM
;
1155 extern unsigned IOCTL_FDFLUSH
;
1156 extern unsigned IOCTL_FDFMTBEG
;
1157 extern unsigned IOCTL_FDFMTEND
;
1158 extern unsigned IOCTL_FDFMTTRK
;
1159 extern unsigned IOCTL_FDGETDRVPRM
;
1160 extern unsigned IOCTL_FDGETDRVSTAT
;
1161 extern unsigned IOCTL_FDGETDRVTYP
;
1162 extern unsigned IOCTL_FDGETFDCSTAT
;
1163 extern unsigned IOCTL_FDGETMAXERRS
;
1164 extern unsigned IOCTL_FDGETPRM
;
1165 extern unsigned IOCTL_FDMSGOFF
;
1166 extern unsigned IOCTL_FDMSGON
;
1167 extern unsigned IOCTL_FDPOLLDRVSTAT
;
1168 extern unsigned IOCTL_FDRAWCMD
;
1169 extern unsigned IOCTL_FDRESET
;
1170 extern unsigned IOCTL_FDSETDRVPRM
;
1171 extern unsigned IOCTL_FDSETEMSGTRESH
;
1172 extern unsigned IOCTL_FDSETMAXERRS
;
1173 extern unsigned IOCTL_FDSETPRM
;
1174 extern unsigned IOCTL_FDTWADDLE
;
1175 extern unsigned IOCTL_FDWERRORCLR
;
1176 extern unsigned IOCTL_FDWERRORGET
;
1177 extern unsigned IOCTL_HDIO_DRIVE_CMD
;
1178 extern unsigned IOCTL_HDIO_GETGEO
;
1179 extern unsigned IOCTL_HDIO_GET_32BIT
;
1180 extern unsigned IOCTL_HDIO_GET_DMA
;
1181 extern unsigned IOCTL_HDIO_GET_IDENTITY
;
1182 extern unsigned IOCTL_HDIO_GET_KEEPSETTINGS
;
1183 extern unsigned IOCTL_HDIO_GET_MULTCOUNT
;
1184 extern unsigned IOCTL_HDIO_GET_NOWERR
;
1185 extern unsigned IOCTL_HDIO_GET_UNMASKINTR
;
1186 extern unsigned IOCTL_HDIO_SET_32BIT
;
1187 extern unsigned IOCTL_HDIO_SET_DMA
;
1188 extern unsigned IOCTL_HDIO_SET_KEEPSETTINGS
;
1189 extern unsigned IOCTL_HDIO_SET_MULTCOUNT
;
1190 extern unsigned IOCTL_HDIO_SET_NOWERR
;
1191 extern unsigned IOCTL_HDIO_SET_UNMASKINTR
;
1192 extern unsigned IOCTL_MTIOCPOS
;
1193 extern unsigned IOCTL_PPPIOCGASYNCMAP
;
1194 extern unsigned IOCTL_PPPIOCGDEBUG
;
1195 extern unsigned IOCTL_PPPIOCGFLAGS
;
1196 extern unsigned IOCTL_PPPIOCGUNIT
;
1197 extern unsigned IOCTL_PPPIOCGXASYNCMAP
;
1198 extern unsigned IOCTL_PPPIOCSASYNCMAP
;
1199 extern unsigned IOCTL_PPPIOCSDEBUG
;
1200 extern unsigned IOCTL_PPPIOCSFLAGS
;
1201 extern unsigned IOCTL_PPPIOCSMAXCID
;
1202 extern unsigned IOCTL_PPPIOCSMRU
;
1203 extern unsigned IOCTL_PPPIOCSXASYNCMAP
;
1204 extern unsigned IOCTL_SIOCDARP
;
1205 extern unsigned IOCTL_SIOCDRARP
;
1206 extern unsigned IOCTL_SIOCGARP
;
1207 extern unsigned IOCTL_SIOCGIFENCAP
;
1208 extern unsigned IOCTL_SIOCGIFHWADDR
;
1209 extern unsigned IOCTL_SIOCGIFMAP
;
1210 extern unsigned IOCTL_SIOCGIFMEM
;
1211 extern unsigned IOCTL_SIOCGIFNAME
;
1212 extern unsigned IOCTL_SIOCGIFSLAVE
;
1213 extern unsigned IOCTL_SIOCGRARP
;
1214 extern unsigned IOCTL_SIOCGSTAMP
;
1215 extern unsigned IOCTL_SIOCSARP
;
1216 extern unsigned IOCTL_SIOCSIFENCAP
;
1217 extern unsigned IOCTL_SIOCSIFHWADDR
;
1218 extern unsigned IOCTL_SIOCSIFLINK
;
1219 extern unsigned IOCTL_SIOCSIFMAP
;
1220 extern unsigned IOCTL_SIOCSIFMEM
;
1221 extern unsigned IOCTL_SIOCSIFSLAVE
;
1222 extern unsigned IOCTL_SIOCSRARP
;
1223 extern unsigned IOCTL_SNDCTL_COPR_HALT
;
1224 extern unsigned IOCTL_SNDCTL_COPR_LOAD
;
1225 extern unsigned IOCTL_SNDCTL_COPR_RCODE
;
1226 extern unsigned IOCTL_SNDCTL_COPR_RCVMSG
;
1227 extern unsigned IOCTL_SNDCTL_COPR_RDATA
;
1228 extern unsigned IOCTL_SNDCTL_COPR_RESET
;
1229 extern unsigned IOCTL_SNDCTL_COPR_RUN
;
1230 extern unsigned IOCTL_SNDCTL_COPR_SENDMSG
;
1231 extern unsigned IOCTL_SNDCTL_COPR_WCODE
;
1232 extern unsigned IOCTL_SNDCTL_COPR_WDATA
;
1233 extern unsigned IOCTL_TCFLSH
;
1234 extern unsigned IOCTL_TCGETA
;
1235 extern unsigned IOCTL_TCGETS
;
1236 extern unsigned IOCTL_TCSBRK
;
1237 extern unsigned IOCTL_TCSBRKP
;
1238 extern unsigned IOCTL_TCSETA
;
1239 extern unsigned IOCTL_TCSETAF
;
1240 extern unsigned IOCTL_TCSETAW
;
1241 extern unsigned IOCTL_TCSETS
;
1242 extern unsigned IOCTL_TCSETSF
;
1243 extern unsigned IOCTL_TCSETSW
;
1244 extern unsigned IOCTL_TCXONC
;
1245 extern unsigned IOCTL_TIOCGLCKTRMIOS
;
1246 extern unsigned IOCTL_TIOCGSOFTCAR
;
1247 extern unsigned IOCTL_TIOCINQ
;
1248 extern unsigned IOCTL_TIOCLINUX
;
1249 extern unsigned IOCTL_TIOCSERCONFIG
;
1250 extern unsigned IOCTL_TIOCSERGETLSR
;
1251 extern unsigned IOCTL_TIOCSERGWILD
;
1252 extern unsigned IOCTL_TIOCSERSWILD
;
1253 extern unsigned IOCTL_TIOCSLCKTRMIOS
;
1254 extern unsigned IOCTL_TIOCSSOFTCAR
;
1255 extern unsigned IOCTL_VT_DISALLOCATE
;
1256 extern unsigned IOCTL_VT_GETSTATE
;
1257 extern unsigned IOCTL_VT_RESIZE
;
1258 extern unsigned IOCTL_VT_RESIZEX
;
1259 extern unsigned IOCTL_VT_SENDSIG
;
1260 #endif // SANITIZER_LINUX
1261 #if SANITIZER_LINUX || SANITIZER_FREEBSD
1262 extern unsigned IOCTL_MTIOCGET
;
1263 extern unsigned IOCTL_MTIOCTOP
;
1264 extern unsigned IOCTL_SIOCADDRT
;
1265 extern unsigned IOCTL_SIOCDELRT
;
1266 extern unsigned IOCTL_SNDCTL_DSP_GETBLKSIZE
;
1267 extern unsigned IOCTL_SNDCTL_DSP_GETFMTS
;
1268 extern unsigned IOCTL_SNDCTL_DSP_NONBLOCK
;
1269 extern unsigned IOCTL_SNDCTL_DSP_POST
;
1270 extern unsigned IOCTL_SNDCTL_DSP_RESET
;
1271 extern unsigned IOCTL_SNDCTL_DSP_SETFMT
;
1272 extern unsigned IOCTL_SNDCTL_DSP_SETFRAGMENT
;
1273 extern unsigned IOCTL_SNDCTL_DSP_SPEED
;
1274 extern unsigned IOCTL_SNDCTL_DSP_STEREO
;
1275 extern unsigned IOCTL_SNDCTL_DSP_SUBDIVIDE
;
1276 extern unsigned IOCTL_SNDCTL_DSP_SYNC
;
1277 extern unsigned IOCTL_SNDCTL_FM_4OP_ENABLE
;
1278 extern unsigned IOCTL_SNDCTL_FM_LOAD_INSTR
;
1279 extern unsigned IOCTL_SNDCTL_MIDI_INFO
;
1280 extern unsigned IOCTL_SNDCTL_MIDI_PRETIME
;
1281 extern unsigned IOCTL_SNDCTL_SEQ_CTRLRATE
;
1282 extern unsigned IOCTL_SNDCTL_SEQ_GETINCOUNT
;
1283 extern unsigned IOCTL_SNDCTL_SEQ_GETOUTCOUNT
;
1284 extern unsigned IOCTL_SNDCTL_SEQ_NRMIDIS
;
1285 extern unsigned IOCTL_SNDCTL_SEQ_NRSYNTHS
;
1286 extern unsigned IOCTL_SNDCTL_SEQ_OUTOFBAND
;
1287 extern unsigned IOCTL_SNDCTL_SEQ_PANIC
;
1288 extern unsigned IOCTL_SNDCTL_SEQ_PERCMODE
;
1289 extern unsigned IOCTL_SNDCTL_SEQ_RESET
;
1290 extern unsigned IOCTL_SNDCTL_SEQ_RESETSAMPLES
;
1291 extern unsigned IOCTL_SNDCTL_SEQ_SYNC
;
1292 extern unsigned IOCTL_SNDCTL_SEQ_TESTMIDI
;
1293 extern unsigned IOCTL_SNDCTL_SEQ_THRESHOLD
;
1294 extern unsigned IOCTL_SNDCTL_SYNTH_INFO
;
1295 extern unsigned IOCTL_SNDCTL_SYNTH_MEMAVL
;
1296 extern unsigned IOCTL_SNDCTL_TMR_CONTINUE
;
1297 extern unsigned IOCTL_SNDCTL_TMR_METRONOME
;
1298 extern unsigned IOCTL_SNDCTL_TMR_SELECT
;
1299 extern unsigned IOCTL_SNDCTL_TMR_SOURCE
;
1300 extern unsigned IOCTL_SNDCTL_TMR_START
;
1301 extern unsigned IOCTL_SNDCTL_TMR_STOP
;
1302 extern unsigned IOCTL_SNDCTL_TMR_TEMPO
;
1303 extern unsigned IOCTL_SNDCTL_TMR_TIMEBASE
;
1304 extern unsigned IOCTL_SOUND_MIXER_READ_ALTPCM
;
1305 extern unsigned IOCTL_SOUND_MIXER_READ_BASS
;
1306 extern unsigned IOCTL_SOUND_MIXER_READ_CAPS
;
1307 extern unsigned IOCTL_SOUND_MIXER_READ_CD
;
1308 extern unsigned IOCTL_SOUND_MIXER_READ_DEVMASK
;
1309 extern unsigned IOCTL_SOUND_MIXER_READ_ENHANCE
;
1310 extern unsigned IOCTL_SOUND_MIXER_READ_IGAIN
;
1311 extern unsigned IOCTL_SOUND_MIXER_READ_IMIX
;
1312 extern unsigned IOCTL_SOUND_MIXER_READ_LINE1
;
1313 extern unsigned IOCTL_SOUND_MIXER_READ_LINE2
;
1314 extern unsigned IOCTL_SOUND_MIXER_READ_LINE3
;
1315 extern unsigned IOCTL_SOUND_MIXER_READ_LINE
;
1316 extern unsigned IOCTL_SOUND_MIXER_READ_LOUD
;
1317 extern unsigned IOCTL_SOUND_MIXER_READ_MIC
;
1318 extern unsigned IOCTL_SOUND_MIXER_READ_MUTE
;
1319 extern unsigned IOCTL_SOUND_MIXER_READ_OGAIN
;
1320 extern unsigned IOCTL_SOUND_MIXER_READ_PCM
;
1321 extern unsigned IOCTL_SOUND_MIXER_READ_RECLEV
;
1322 extern unsigned IOCTL_SOUND_MIXER_READ_RECMASK
;
1323 extern unsigned IOCTL_SOUND_MIXER_READ_RECSRC
;
1324 extern unsigned IOCTL_SOUND_MIXER_READ_SPEAKER
;
1325 extern unsigned IOCTL_SOUND_MIXER_READ_STEREODEVS
;
1326 extern unsigned IOCTL_SOUND_MIXER_READ_SYNTH
;
1327 extern unsigned IOCTL_SOUND_MIXER_READ_TREBLE
;
1328 extern unsigned IOCTL_SOUND_MIXER_READ_VOLUME
;
1329 extern unsigned IOCTL_SOUND_MIXER_WRITE_ALTPCM
;
1330 extern unsigned IOCTL_SOUND_MIXER_WRITE_BASS
;
1331 extern unsigned IOCTL_SOUND_MIXER_WRITE_CD
;
1332 extern unsigned IOCTL_SOUND_MIXER_WRITE_ENHANCE
;
1333 extern unsigned IOCTL_SOUND_MIXER_WRITE_IGAIN
;
1334 extern unsigned IOCTL_SOUND_MIXER_WRITE_IMIX
;
1335 extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE1
;
1336 extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE2
;
1337 extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE3
;
1338 extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE
;
1339 extern unsigned IOCTL_SOUND_MIXER_WRITE_LOUD
;
1340 extern unsigned IOCTL_SOUND_MIXER_WRITE_MIC
;
1341 extern unsigned IOCTL_SOUND_MIXER_WRITE_MUTE
;
1342 extern unsigned IOCTL_SOUND_MIXER_WRITE_OGAIN
;
1343 extern unsigned IOCTL_SOUND_MIXER_WRITE_PCM
;
1344 extern unsigned IOCTL_SOUND_MIXER_WRITE_RECLEV
;
1345 extern unsigned IOCTL_SOUND_MIXER_WRITE_RECSRC
;
1346 extern unsigned IOCTL_SOUND_MIXER_WRITE_SPEAKER
;
1347 extern unsigned IOCTL_SOUND_MIXER_WRITE_SYNTH
;
1348 extern unsigned IOCTL_SOUND_MIXER_WRITE_TREBLE
;
1349 extern unsigned IOCTL_SOUND_MIXER_WRITE_VOLUME
;
1350 extern unsigned IOCTL_SOUND_PCM_READ_BITS
;
1351 extern unsigned IOCTL_SOUND_PCM_READ_CHANNELS
;
1352 extern unsigned IOCTL_SOUND_PCM_READ_FILTER
;
1353 extern unsigned IOCTL_SOUND_PCM_READ_RATE
;
1354 extern unsigned IOCTL_SOUND_PCM_WRITE_CHANNELS
;
1355 extern unsigned IOCTL_SOUND_PCM_WRITE_FILTER
;
1356 extern unsigned IOCTL_VT_ACTIVATE
;
1357 extern unsigned IOCTL_VT_GETMODE
;
1358 extern unsigned IOCTL_VT_OPENQRY
;
1359 extern unsigned IOCTL_VT_RELDISP
;
1360 extern unsigned IOCTL_VT_SETMODE
;
1361 extern unsigned IOCTL_VT_WAITACTIVE
;
1362 #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
1364 #if SANITIZER_LINUX && !SANITIZER_ANDROID
1365 extern unsigned IOCTL_CYGETDEFTHRESH
;
1366 extern unsigned IOCTL_CYGETDEFTIMEOUT
;
1367 extern unsigned IOCTL_CYGETMON
;
1368 extern unsigned IOCTL_CYGETTHRESH
;
1369 extern unsigned IOCTL_CYGETTIMEOUT
;
1370 extern unsigned IOCTL_CYSETDEFTHRESH
;
1371 extern unsigned IOCTL_CYSETDEFTIMEOUT
;
1372 extern unsigned IOCTL_CYSETTHRESH
;
1373 extern unsigned IOCTL_CYSETTIMEOUT
;
1374 extern unsigned IOCTL_EQL_EMANCIPATE
;
1375 extern unsigned IOCTL_EQL_ENSLAVE
;
1376 extern unsigned IOCTL_EQL_GETMASTRCFG
;
1377 extern unsigned IOCTL_EQL_GETSLAVECFG
;
1378 extern unsigned IOCTL_EQL_SETMASTRCFG
;
1379 extern unsigned IOCTL_EQL_SETSLAVECFG
;
1380 extern unsigned IOCTL_EVIOCGKEYCODE_V2
;
1381 extern unsigned IOCTL_EVIOCGPROP
;
1382 extern unsigned IOCTL_EVIOCSKEYCODE_V2
;
1383 extern unsigned IOCTL_FS_IOC_GETFLAGS
;
1384 extern unsigned IOCTL_FS_IOC_GETVERSION
;
1385 extern unsigned IOCTL_FS_IOC_SETFLAGS
;
1386 extern unsigned IOCTL_FS_IOC_SETVERSION
;
1387 extern unsigned IOCTL_GIO_CMAP
;
1388 extern unsigned IOCTL_GIO_FONT
;
1389 extern unsigned IOCTL_GIO_UNIMAP
;
1390 extern unsigned IOCTL_GIO_UNISCRNMAP
;
1391 extern unsigned IOCTL_KDADDIO
;
1392 extern unsigned IOCTL_KDDELIO
;
1393 extern unsigned IOCTL_KDGETKEYCODE
;
1394 extern unsigned IOCTL_KDGKBDIACR
;
1395 extern unsigned IOCTL_KDGKBENT
;
1396 extern unsigned IOCTL_KDGKBLED
;
1397 extern unsigned IOCTL_KDGKBMETA
;
1398 extern unsigned IOCTL_KDGKBSENT
;
1399 extern unsigned IOCTL_KDMAPDISP
;
1400 extern unsigned IOCTL_KDSETKEYCODE
;
1401 extern unsigned IOCTL_KDSIGACCEPT
;
1402 extern unsigned IOCTL_KDSKBDIACR
;
1403 extern unsigned IOCTL_KDSKBENT
;
1404 extern unsigned IOCTL_KDSKBLED
;
1405 extern unsigned IOCTL_KDSKBMETA
;
1406 extern unsigned IOCTL_KDSKBSENT
;
1407 extern unsigned IOCTL_KDUNMAPDISP
;
1408 extern unsigned IOCTL_LPABORT
;
1409 extern unsigned IOCTL_LPABORTOPEN
;
1410 extern unsigned IOCTL_LPCAREFUL
;
1411 extern unsigned IOCTL_LPCHAR
;
1412 extern unsigned IOCTL_LPGETIRQ
;
1413 extern unsigned IOCTL_LPGETSTATUS
;
1414 extern unsigned IOCTL_LPRESET
;
1415 extern unsigned IOCTL_LPSETIRQ
;
1416 extern unsigned IOCTL_LPTIME
;
1417 extern unsigned IOCTL_LPWAIT
;
1418 extern unsigned IOCTL_MTIOCGETCONFIG
;
1419 extern unsigned IOCTL_MTIOCSETCONFIG
;
1420 extern unsigned IOCTL_PIO_CMAP
;
1421 extern unsigned IOCTL_PIO_FONT
;
1422 extern unsigned IOCTL_PIO_UNIMAP
;
1423 extern unsigned IOCTL_PIO_UNIMAPCLR
;
1424 extern unsigned IOCTL_PIO_UNISCRNMAP
;
1425 extern unsigned IOCTL_SCSI_IOCTL_GET_IDLUN
;
1426 extern unsigned IOCTL_SCSI_IOCTL_PROBE_HOST
;
1427 extern unsigned IOCTL_SCSI_IOCTL_TAGGED_DISABLE
;
1428 extern unsigned IOCTL_SCSI_IOCTL_TAGGED_ENABLE
;
1429 extern unsigned IOCTL_SIOCAIPXITFCRT
;
1430 extern unsigned IOCTL_SIOCAIPXPRISLT
;
1431 extern unsigned IOCTL_SIOCAX25ADDUID
;
1432 extern unsigned IOCTL_SIOCAX25DELUID
;
1433 extern unsigned IOCTL_SIOCAX25GETPARMS
;
1434 extern unsigned IOCTL_SIOCAX25GETUID
;
1435 extern unsigned IOCTL_SIOCAX25NOUID
;
1436 extern unsigned IOCTL_SIOCAX25SETPARMS
;
1437 extern unsigned IOCTL_SIOCDEVPLIP
;
1438 extern unsigned IOCTL_SIOCIPXCFGDATA
;
1439 extern unsigned IOCTL_SIOCNRDECOBS
;
1440 extern unsigned IOCTL_SIOCNRGETPARMS
;
1441 extern unsigned IOCTL_SIOCNRRTCTL
;
1442 extern unsigned IOCTL_SIOCNRSETPARMS
;
1443 extern unsigned IOCTL_SNDCTL_DSP_GETISPACE
;
1444 extern unsigned IOCTL_SNDCTL_DSP_GETOSPACE
;
1445 extern unsigned IOCTL_TIOCGSERIAL
;
1446 extern unsigned IOCTL_TIOCSERGETMULTI
;
1447 extern unsigned IOCTL_TIOCSERSETMULTI
;
1448 extern unsigned IOCTL_TIOCSSERIAL
;
1449 #endif // SANITIZER_LINUX && !SANITIZER_ANDROID
1451 #if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
1452 extern unsigned IOCTL_GIO_SCRNMAP
;
1453 extern unsigned IOCTL_KDDISABIO
;
1454 extern unsigned IOCTL_KDENABIO
;
1455 extern unsigned IOCTL_KDGETLED
;
1456 extern unsigned IOCTL_KDGETMODE
;
1457 extern unsigned IOCTL_KDGKBMODE
;
1458 extern unsigned IOCTL_KDGKBTYPE
;
1459 extern unsigned IOCTL_KDMKTONE
;
1460 extern unsigned IOCTL_KDSETLED
;
1461 extern unsigned IOCTL_KDSETMODE
;
1462 extern unsigned IOCTL_KDSKBMODE
;
1463 extern unsigned IOCTL_KIOCSOUND
;
1464 extern unsigned IOCTL_PIO_SCRNMAP
;
1467 extern const int si_SEGV_MAPERR
;
1468 extern const int si_SEGV_ACCERR
;
1469 } // namespace __sanitizer
1471 #define CHECK_TYPE_SIZE(TYPE) \
1472 COMPILER_CHECK(sizeof(__sanitizer_##TYPE) == sizeof(TYPE))
1474 #define CHECK_SIZE_AND_OFFSET(CLASS, MEMBER) \
1475 COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *) NULL)->MEMBER) == \
1476 sizeof(((CLASS *) NULL)->MEMBER)); \
1477 COMPILER_CHECK(offsetof(__sanitizer_##CLASS, MEMBER) == \
1478 offsetof(CLASS, MEMBER))
1480 // For sigaction, which is a function and struct at the same time,
1481 // and thus requires explicit "struct" in sizeof() expression.
1482 #define CHECK_STRUCT_SIZE_AND_OFFSET(CLASS, MEMBER) \
1483 COMPILER_CHECK(sizeof(((struct __sanitizer_##CLASS *) NULL)->MEMBER) == \
1484 sizeof(((struct CLASS *) NULL)->MEMBER)); \
1485 COMPILER_CHECK(offsetof(struct __sanitizer_##CLASS, MEMBER) == \
1486 offsetof(struct CLASS, MEMBER))
1488 #endif // SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_MAC