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