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