2014-01-30 Alangi Derick <alangiderick@gmail.com>
[official-gcc.git] / libsanitizer / sanitizer_common / sanitizer_platform_limits_posix.h
blobbe6e6cf1c3f698a0507343e2c1855d3a5f1b4741
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_IOS
23 extern unsigned struct_stat64_sz;
24 #endif
25 extern unsigned struct_rusage_sz;
26 extern unsigned struct_passwd_sz;
27 extern unsigned struct_group_sz;
28 extern unsigned siginfo_t_sz;
29 extern unsigned struct_itimerval_sz;
30 extern unsigned pthread_t_sz;
31 extern unsigned pthread_cond_t_sz;
32 extern unsigned pid_t_sz;
33 extern unsigned timeval_sz;
34 extern unsigned uid_t_sz;
35 extern unsigned mbstate_t_sz;
36 extern unsigned struct_timezone_sz;
37 extern unsigned struct_tms_sz;
38 extern unsigned struct_itimerspec_sz;
39 extern unsigned struct_sigevent_sz;
40 extern unsigned struct_sched_param_sz;
41 extern unsigned struct_statfs_sz;
42 extern unsigned struct_statfs64_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___old_kernel_stat_sz = 32;
52 const unsigned struct_kernel_stat_sz = 144;
53 const unsigned struct_kernel_stat64_sz = 0;
54 #elif defined(__i386__)
55 const unsigned struct___old_kernel_stat_sz = 32;
56 const unsigned struct_kernel_stat_sz = 64;
57 const unsigned struct_kernel_stat64_sz = 96;
58 #elif defined(__arm__)
59 const unsigned struct___old_kernel_stat_sz = 32;
60 const unsigned struct_kernel_stat_sz = 64;
61 const unsigned struct_kernel_stat64_sz = 104;
62 #elif defined(__powerpc__) && !defined(__powerpc64__)
63 const unsigned struct___old_kernel_stat_sz = 32;
64 const unsigned struct_kernel_stat_sz = 72;
65 const unsigned struct_kernel_stat64_sz = 104;
66 #elif defined(__powerpc64__)
67 const unsigned struct___old_kernel_stat_sz = 0;
68 const unsigned struct_kernel_stat_sz = 144;
69 const unsigned struct_kernel_stat64_sz = 104;
70 #endif
71 struct __sanitizer_perf_event_attr {
72 unsigned type;
73 unsigned size;
74 // More fields that vary with the kernel version.
77 extern unsigned struct_utimbuf_sz;
78 extern unsigned struct_new_utsname_sz;
79 extern unsigned struct_old_utsname_sz;
80 extern unsigned struct_oldold_utsname_sz;
81 extern unsigned struct_msqid_ds_sz;
82 extern unsigned struct_mq_attr_sz;
83 extern unsigned struct_timex_sz;
84 extern unsigned struct_ustat_sz;
86 extern unsigned struct_rlimit_sz;
87 extern unsigned struct_epoll_event_sz;
88 extern unsigned struct_sysinfo_sz;
89 extern unsigned struct_timespec_sz;
90 extern unsigned __user_cap_header_struct_sz;
91 extern unsigned __user_cap_data_struct_sz;
92 const unsigned old_sigset_t_sz = sizeof(unsigned long);
93 const unsigned struct_kexec_segment_sz = 4 * sizeof(unsigned long);
95 struct __sanitizer_iocb {
96 u64 aio_data;
97 u32 aio_key_or_aio_reserved1; // Simply crazy.
98 u32 aio_reserved1_or_aio_key; // Luckily, we don't need these.
99 u16 aio_lio_opcode;
100 s16 aio_reqprio;
101 u32 aio_fildes;
102 u64 aio_buf;
103 u64 aio_nbytes;
104 s64 aio_offset;
105 u64 aio_reserved2;
106 u64 aio_reserved3;
109 struct __sanitizer_io_event {
110 u64 data;
111 u64 obj;
112 u64 res;
113 u64 res2;
116 const unsigned iocb_cmd_pread = 0;
117 const unsigned iocb_cmd_pwrite = 1;
118 const unsigned iocb_cmd_preadv = 7;
119 const unsigned iocb_cmd_pwritev = 8;
121 struct __sanitizer___sysctl_args {
122 int *name;
123 int nlen;
124 void *oldval;
125 uptr *oldlenp;
126 void *newval;
127 uptr newlen;
128 unsigned long ___unused[4];
130 #endif // SANITIZER_LINUX
132 #if SANITIZER_LINUX && !SANITIZER_ANDROID
133 extern unsigned struct_rlimit64_sz;
134 extern unsigned struct_statvfs_sz;
135 extern unsigned struct_statvfs64_sz;
137 struct __sanitizer_ipc_perm {
138 int __key;
139 int uid;
140 int gid;
141 int cuid;
142 int cgid;
143 #ifdef __powerpc__
144 unsigned mode;
145 unsigned __seq;
146 u64 __unused1;
147 u64 __unused2;
148 #else
149 unsigned short mode;
150 unsigned short __pad1;
151 unsigned short __seq;
152 unsigned short __pad2;
153 #if defined(__x86_64__) && !defined(_LP64)
154 u64 __unused1;
155 u64 __unused2;
156 #else
157 unsigned long __unused1;
158 unsigned long __unused2;
159 #endif
160 #endif
163 struct __sanitizer_shmid_ds {
164 __sanitizer_ipc_perm shm_perm;
165 #ifndef __powerpc__
166 uptr shm_segsz;
167 #elif !defined(__powerpc64__)
168 uptr __unused0;
169 #endif
170 #if defined(__x86_64__) && !defined(_LP64)
171 u64 shm_atime;
172 u64 shm_dtime;
173 u64 shm_ctime;
174 #else
175 uptr shm_atime;
176 #ifndef _LP64
177 uptr __unused1;
178 #endif
179 uptr shm_dtime;
180 #ifndef _LP64
181 uptr __unused2;
182 #endif
183 uptr shm_ctime;
184 #ifndef _LP64
185 uptr __unused3;
186 #endif
187 #endif
188 #ifdef __powerpc__
189 uptr shm_segsz;
190 #endif
191 int shm_cpid;
192 int shm_lpid;
193 #if defined(__x86_64__) && !defined(_LP64)
194 u64 shm_nattch;
195 u64 __unused4;
196 u64 __unused5;
197 #else
198 uptr shm_nattch;
199 uptr __unused4;
200 uptr __unused5;
201 #endif
203 #endif // SANITIZER_LINUX && !SANITIZER_ANDROID
205 struct __sanitizer_iovec {
206 void *iov_base;
207 uptr iov_len;
210 #if SANITIZER_MAC
211 typedef unsigned long __sanitizer_pthread_key_t;
212 #else
213 typedef unsigned __sanitizer_pthread_key_t;
214 #endif
216 struct __sanitizer_ether_addr {
217 u8 octet[6];
220 struct __sanitizer_tm {
221 int tm_sec;
222 int tm_min;
223 int tm_hour;
224 int tm_mday;
225 int tm_mon;
226 int tm_year;
227 int tm_wday;
228 int tm_yday;
229 int tm_isdst;
230 long int tm_gmtoff;
231 const char *tm_zone;
234 #if SANITIZER_LINUX
235 struct __sanitizer_mntent {
236 char *mnt_fsname;
237 char *mnt_dir;
238 char *mnt_type;
239 char *mnt_opts;
240 int mnt_freq;
241 int mnt_passno;
243 #endif
245 #if SANITIZER_ANDROID || SANITIZER_MAC
246 struct __sanitizer_msghdr {
247 void *msg_name;
248 unsigned msg_namelen;
249 struct __sanitizer_iovec *msg_iov;
250 unsigned msg_iovlen;
251 void *msg_control;
252 unsigned msg_controllen;
253 int msg_flags;
255 struct __sanitizer_cmsghdr {
256 unsigned cmsg_len;
257 int cmsg_level;
258 int cmsg_type;
260 #else
261 struct __sanitizer_msghdr {
262 void *msg_name;
263 unsigned msg_namelen;
264 struct __sanitizer_iovec *msg_iov;
265 uptr msg_iovlen;
266 void *msg_control;
267 uptr msg_controllen;
268 int msg_flags;
270 struct __sanitizer_cmsghdr {
271 uptr cmsg_len;
272 int cmsg_level;
273 int cmsg_type;
275 #endif
277 #if SANITIZER_MAC
278 struct __sanitizer_dirent {
279 unsigned long long d_ino;
280 unsigned long long d_seekoff;
281 unsigned short d_reclen;
282 // more fields that we don't care about
284 #elif SANITIZER_ANDROID || defined(__x86_64__)
285 struct __sanitizer_dirent {
286 unsigned long long d_ino;
287 unsigned long long d_off;
288 unsigned short d_reclen;
289 // more fields that we don't care about
291 #else
292 struct __sanitizer_dirent {
293 uptr d_ino;
294 uptr d_off;
295 unsigned short d_reclen;
296 // more fields that we don't care about
298 #endif
300 #if SANITIZER_LINUX && !SANITIZER_ANDROID
301 struct __sanitizer_dirent64 {
302 unsigned long long d_ino;
303 unsigned long long d_off;
304 unsigned short d_reclen;
305 // more fields that we don't care about
307 #endif
309 #if defined(__x86_64__) && !defined(_LP64)
310 typedef long long __sanitizer_clock_t;
311 #else
312 typedef long __sanitizer_clock_t;
313 #endif
315 #if SANITIZER_LINUX
316 #if defined(_LP64) || defined(__x86_64__) || defined(__powerpc__)
317 typedef unsigned __sanitizer___kernel_uid_t;
318 typedef unsigned __sanitizer___kernel_gid_t;
319 #else
320 typedef unsigned short __sanitizer___kernel_uid_t;
321 typedef unsigned short __sanitizer___kernel_gid_t;
322 #endif
323 #if defined(__x86_64__) && !defined(_LP64)
324 typedef long long __sanitizer___kernel_off_t;
325 #else
326 typedef long __sanitizer___kernel_off_t;
327 #endif
329 #if defined(__powerpc__)
330 typedef unsigned int __sanitizer___kernel_old_uid_t;
331 typedef unsigned int __sanitizer___kernel_old_gid_t;
332 #else
333 typedef unsigned short __sanitizer___kernel_old_uid_t;
334 typedef unsigned short __sanitizer___kernel_old_gid_t;
335 #endif
337 typedef long long __sanitizer___kernel_loff_t;
338 typedef struct {
339 unsigned long fds_bits[1024 / (8 * sizeof(long))];
340 } __sanitizer___kernel_fd_set;
341 #endif
343 // This thing depends on the platform. We are only interested in the upper
344 // limit. Verified with a compiler assert in .cc.
345 const int pthread_attr_t_max_sz = 128;
346 union __sanitizer_pthread_attr_t {
347 char size[pthread_attr_t_max_sz]; // NOLINT
348 void *align;
351 #if SANITIZER_ANDROID
352 typedef unsigned long __sanitizer_sigset_t;
353 #elif SANITIZER_MAC
354 typedef unsigned __sanitizer_sigset_t;
355 #elif SANITIZER_LINUX
356 struct __sanitizer_sigset_t {
357 // The size is determined by looking at sizeof of real sigset_t on linux.
358 uptr val[128 / sizeof(uptr)];
360 #endif
362 struct __sanitizer_sigaction {
363 union {
364 void (*sa_handler)(int sig);
365 void (*sa_sigaction)(int sig, void *siginfo, void *uctx);
367 __sanitizer_sigset_t sa_mask;
368 int sa_flags;
369 #if SANITIZER_LINUX
370 void (*sa_restorer)();
371 #endif
374 struct __sanitizer_kernel_sigset_t {
375 u8 sig[8];
378 struct __sanitizer_kernel_sigaction_t {
379 union {
380 void (*sigaction)(int signo, void *info, void *ctx);
381 void (*handler)(int signo);
383 unsigned long sa_flags;
384 void (*sa_restorer)(void);
385 __sanitizer_kernel_sigset_t sa_mask;
388 extern uptr sig_ign;
389 extern uptr sig_dfl;
390 extern uptr sa_siginfo;
392 #if SANITIZER_LINUX
393 extern int e_tabsz;
394 #endif
396 extern int af_inet;
397 extern int af_inet6;
398 uptr __sanitizer_in_addr_sz(int af);
400 #if SANITIZER_LINUX
401 struct __sanitizer_dl_phdr_info {
402 uptr dlpi_addr;
403 const char *dlpi_name;
404 const void *dlpi_phdr;
405 short dlpi_phnum;
407 #endif
409 struct __sanitizer_addrinfo {
410 int ai_flags;
411 int ai_family;
412 int ai_socktype;
413 int ai_protocol;
414 #if SANITIZER_ANDROID || SANITIZER_MAC
415 unsigned ai_addrlen;
416 char *ai_canonname;
417 void *ai_addr;
418 #else // LINUX
419 unsigned ai_addrlen;
420 void *ai_addr;
421 char *ai_canonname;
422 #endif
423 struct __sanitizer_addrinfo *ai_next;
426 struct __sanitizer_hostent {
427 char *h_name;
428 char **h_aliases;
429 int h_addrtype;
430 int h_length;
431 char **h_addr_list;
434 struct __sanitizer_pollfd {
435 int fd;
436 short events;
437 short revents;
440 #if SANITIZER_ANDROID || SANITIZER_MAC
441 typedef unsigned __sanitizer_nfds_t;
442 #else
443 typedef unsigned long __sanitizer_nfds_t;
444 #endif
446 #if SANITIZER_LINUX && !SANITIZER_ANDROID
447 struct __sanitizer_glob_t {
448 uptr gl_pathc;
449 char **gl_pathv;
450 uptr gl_offs;
451 int gl_flags;
453 void (*gl_closedir)(void *dirp);
454 void *(*gl_readdir)(void *dirp);
455 void *(*gl_opendir)(const char *);
456 int (*gl_lstat)(const char *, void *);
457 int (*gl_stat)(const char *, void *);
460 extern int glob_nomatch;
461 extern int glob_altdirfunc;
462 #endif
464 extern unsigned path_max;
466 struct __sanitizer_wordexp_t {
467 uptr we_wordc;
468 char **we_wordv;
469 uptr we_offs;
472 #if SANITIZER_LINUX && !SANITIZER_ANDROID && \
473 (defined(__i386) || defined (__x86_64)) // NOLINT
474 extern unsigned struct_user_regs_struct_sz;
475 extern unsigned struct_user_fpregs_struct_sz;
476 extern unsigned struct_user_fpxregs_struct_sz;
478 extern int ptrace_peektext;
479 extern int ptrace_peekdata;
480 extern int ptrace_peekuser;
481 extern int ptrace_getregs;
482 extern int ptrace_setregs;
483 extern int ptrace_getfpregs;
484 extern int ptrace_setfpregs;
485 extern int ptrace_getfpxregs;
486 extern int ptrace_setfpxregs;
487 extern int ptrace_getsiginfo;
488 extern int ptrace_setsiginfo;
489 extern int ptrace_getregset;
490 extern int ptrace_setregset;
491 #endif
493 #if SANITIZER_LINUX && !SANITIZER_ANDROID
494 extern unsigned struct_shminfo_sz;
495 extern unsigned struct_shm_info_sz;
496 extern int shmctl_ipc_stat;
497 extern int shmctl_ipc_info;
498 extern int shmctl_shm_info;
499 extern int shmctl_shm_stat;
500 #endif
502 // ioctl arguments
503 struct __sanitizer_ifconf {
504 int ifc_len;
505 union {
506 void *ifcu_req;
507 } ifc_ifcu;
508 #if SANITIZER_MAC
509 } __attribute__((packed));
510 #else
512 #endif
514 #define IOC_SIZE(nr) (((nr) >> 16) & 0x3fff)
516 extern unsigned struct_arpreq_sz;
517 extern unsigned struct_ifreq_sz;
518 extern unsigned struct_termios_sz;
519 extern unsigned struct_winsize_sz;
521 #if SANITIZER_LINUX
522 extern unsigned struct_cdrom_msf_sz;
523 extern unsigned struct_cdrom_multisession_sz;
524 extern unsigned struct_cdrom_read_audio_sz;
525 extern unsigned struct_cdrom_subchnl_sz;
526 extern unsigned struct_cdrom_ti_sz;
527 extern unsigned struct_cdrom_tocentry_sz;
528 extern unsigned struct_cdrom_tochdr_sz;
529 extern unsigned struct_cdrom_volctrl_sz;
530 extern unsigned struct_copr_buffer_sz;
531 extern unsigned struct_copr_debug_buf_sz;
532 extern unsigned struct_copr_msg_sz;
533 extern unsigned struct_ff_effect_sz;
534 extern unsigned struct_floppy_drive_params_sz;
535 extern unsigned struct_floppy_drive_struct_sz;
536 extern unsigned struct_floppy_fdc_state_sz;
537 extern unsigned struct_floppy_max_errors_sz;
538 extern unsigned struct_floppy_raw_cmd_sz;
539 extern unsigned struct_floppy_struct_sz;
540 extern unsigned struct_floppy_write_errors_sz;
541 extern unsigned struct_format_descr_sz;
542 extern unsigned struct_hd_driveid_sz;
543 extern unsigned struct_hd_geometry_sz;
544 extern unsigned struct_input_absinfo_sz;
545 extern unsigned struct_input_id_sz;
546 extern unsigned struct_midi_info_sz;
547 extern unsigned struct_mtget_sz;
548 extern unsigned struct_mtop_sz;
549 extern unsigned struct_mtpos_sz;
550 extern unsigned struct_rtentry_sz;
551 extern unsigned struct_sbi_instrument_sz;
552 extern unsigned struct_seq_event_rec_sz;
553 extern unsigned struct_synth_info_sz;
554 extern unsigned struct_termio_sz;
555 extern unsigned struct_vt_consize_sz;
556 extern unsigned struct_vt_mode_sz;
557 extern unsigned struct_vt_sizes_sz;
558 extern unsigned struct_vt_stat_sz;
559 #endif
561 #if SANITIZER_LINUX && !SANITIZER_ANDROID
562 extern unsigned struct_audio_buf_info_sz;
563 extern unsigned struct_ax25_parms_struct_sz;
564 extern unsigned struct_cyclades_monitor_sz;
565 extern unsigned struct_input_keymap_entry_sz;
566 extern unsigned struct_ipx_config_data_sz;
567 extern unsigned struct_kbdiacrs_sz;
568 extern unsigned struct_kbentry_sz;
569 extern unsigned struct_kbkeycode_sz;
570 extern unsigned struct_kbsentry_sz;
571 extern unsigned struct_mtconfiginfo_sz;
572 extern unsigned struct_nr_parms_struct_sz;
573 extern unsigned struct_ppp_stats_sz;
574 extern unsigned struct_scc_modem_sz;
575 extern unsigned struct_scc_stat_sz;
576 extern unsigned struct_serial_multiport_struct_sz;
577 extern unsigned struct_serial_struct_sz;
578 extern unsigned struct_sockaddr_ax25_sz;
579 extern unsigned struct_unimapdesc_sz;
580 extern unsigned struct_unimapinit_sz;
581 #endif
583 #if !SANITIZER_ANDROID && !SANITIZER_MAC
584 extern unsigned struct_sioc_sg_req_sz;
585 extern unsigned struct_sioc_vif_req_sz;
586 #endif
588 // ioctl request identifiers
590 // A special value to mark ioctls that are not present on the target platform,
591 // when it can not be determined without including any system headers.
592 extern unsigned IOCTL_NOT_PRESENT;
594 extern unsigned IOCTL_FIOASYNC;
595 extern unsigned IOCTL_FIOCLEX;
596 extern unsigned IOCTL_FIOGETOWN;
597 extern unsigned IOCTL_FIONBIO;
598 extern unsigned IOCTL_FIONCLEX;
599 extern unsigned IOCTL_FIOSETOWN;
600 extern unsigned IOCTL_SIOCADDMULTI;
601 extern unsigned IOCTL_SIOCATMARK;
602 extern unsigned IOCTL_SIOCDELMULTI;
603 extern unsigned IOCTL_SIOCGIFADDR;
604 extern unsigned IOCTL_SIOCGIFBRDADDR;
605 extern unsigned IOCTL_SIOCGIFCONF;
606 extern unsigned IOCTL_SIOCGIFDSTADDR;
607 extern unsigned IOCTL_SIOCGIFFLAGS;
608 extern unsigned IOCTL_SIOCGIFMETRIC;
609 extern unsigned IOCTL_SIOCGIFMTU;
610 extern unsigned IOCTL_SIOCGIFNETMASK;
611 extern unsigned IOCTL_SIOCGPGRP;
612 extern unsigned IOCTL_SIOCSIFADDR;
613 extern unsigned IOCTL_SIOCSIFBRDADDR;
614 extern unsigned IOCTL_SIOCSIFDSTADDR;
615 extern unsigned IOCTL_SIOCSIFFLAGS;
616 extern unsigned IOCTL_SIOCSIFMETRIC;
617 extern unsigned IOCTL_SIOCSIFMTU;
618 extern unsigned IOCTL_SIOCSIFNETMASK;
619 extern unsigned IOCTL_SIOCSPGRP;
620 extern unsigned IOCTL_TIOCCONS;
621 extern unsigned IOCTL_TIOCEXCL;
622 extern unsigned IOCTL_TIOCGETD;
623 extern unsigned IOCTL_TIOCGPGRP;
624 extern unsigned IOCTL_TIOCGWINSZ;
625 extern unsigned IOCTL_TIOCMBIC;
626 extern unsigned IOCTL_TIOCMBIS;
627 extern unsigned IOCTL_TIOCMGET;
628 extern unsigned IOCTL_TIOCMSET;
629 extern unsigned IOCTL_TIOCNOTTY;
630 extern unsigned IOCTL_TIOCNXCL;
631 extern unsigned IOCTL_TIOCOUTQ;
632 extern unsigned IOCTL_TIOCPKT;
633 extern unsigned IOCTL_TIOCSCTTY;
634 extern unsigned IOCTL_TIOCSETD;
635 extern unsigned IOCTL_TIOCSPGRP;
636 extern unsigned IOCTL_TIOCSTI;
637 extern unsigned IOCTL_TIOCSWINSZ;
638 #if (SANITIZER_LINUX && !SANITIZER_ANDROID)
639 extern unsigned IOCTL_SIOCGETSGCNT;
640 extern unsigned IOCTL_SIOCGETVIFCNT;
641 #endif
642 #if SANITIZER_LINUX
643 extern unsigned IOCTL_EVIOCGABS;
644 extern unsigned IOCTL_EVIOCGBIT;
645 extern unsigned IOCTL_EVIOCGEFFECTS;
646 extern unsigned IOCTL_EVIOCGID;
647 extern unsigned IOCTL_EVIOCGKEY;
648 extern unsigned IOCTL_EVIOCGKEYCODE;
649 extern unsigned IOCTL_EVIOCGLED;
650 extern unsigned IOCTL_EVIOCGNAME;
651 extern unsigned IOCTL_EVIOCGPHYS;
652 extern unsigned IOCTL_EVIOCGRAB;
653 extern unsigned IOCTL_EVIOCGREP;
654 extern unsigned IOCTL_EVIOCGSND;
655 extern unsigned IOCTL_EVIOCGSW;
656 extern unsigned IOCTL_EVIOCGUNIQ;
657 extern unsigned IOCTL_EVIOCGVERSION;
658 extern unsigned IOCTL_EVIOCRMFF;
659 extern unsigned IOCTL_EVIOCSABS;
660 extern unsigned IOCTL_EVIOCSFF;
661 extern unsigned IOCTL_EVIOCSKEYCODE;
662 extern unsigned IOCTL_EVIOCSREP;
663 extern unsigned IOCTL_BLKFLSBUF;
664 extern unsigned IOCTL_BLKGETSIZE;
665 extern unsigned IOCTL_BLKRAGET;
666 extern unsigned IOCTL_BLKRASET;
667 extern unsigned IOCTL_BLKROGET;
668 extern unsigned IOCTL_BLKROSET;
669 extern unsigned IOCTL_BLKRRPART;
670 extern unsigned IOCTL_CDROMAUDIOBUFSIZ;
671 extern unsigned IOCTL_CDROMEJECT;
672 extern unsigned IOCTL_CDROMEJECT_SW;
673 extern unsigned IOCTL_CDROMMULTISESSION;
674 extern unsigned IOCTL_CDROMPAUSE;
675 extern unsigned IOCTL_CDROMPLAYMSF;
676 extern unsigned IOCTL_CDROMPLAYTRKIND;
677 extern unsigned IOCTL_CDROMREADAUDIO;
678 extern unsigned IOCTL_CDROMREADCOOKED;
679 extern unsigned IOCTL_CDROMREADMODE1;
680 extern unsigned IOCTL_CDROMREADMODE2;
681 extern unsigned IOCTL_CDROMREADRAW;
682 extern unsigned IOCTL_CDROMREADTOCENTRY;
683 extern unsigned IOCTL_CDROMREADTOCHDR;
684 extern unsigned IOCTL_CDROMRESET;
685 extern unsigned IOCTL_CDROMRESUME;
686 extern unsigned IOCTL_CDROMSEEK;
687 extern unsigned IOCTL_CDROMSTART;
688 extern unsigned IOCTL_CDROMSTOP;
689 extern unsigned IOCTL_CDROMSUBCHNL;
690 extern unsigned IOCTL_CDROMVOLCTRL;
691 extern unsigned IOCTL_CDROMVOLREAD;
692 extern unsigned IOCTL_CDROM_GET_UPC;
693 extern unsigned IOCTL_FDCLRPRM;
694 extern unsigned IOCTL_FDDEFPRM;
695 extern unsigned IOCTL_FDFLUSH;
696 extern unsigned IOCTL_FDFMTBEG;
697 extern unsigned IOCTL_FDFMTEND;
698 extern unsigned IOCTL_FDFMTTRK;
699 extern unsigned IOCTL_FDGETDRVPRM;
700 extern unsigned IOCTL_FDGETDRVSTAT;
701 extern unsigned IOCTL_FDGETDRVTYP;
702 extern unsigned IOCTL_FDGETFDCSTAT;
703 extern unsigned IOCTL_FDGETMAXERRS;
704 extern unsigned IOCTL_FDGETPRM;
705 extern unsigned IOCTL_FDMSGOFF;
706 extern unsigned IOCTL_FDMSGON;
707 extern unsigned IOCTL_FDPOLLDRVSTAT;
708 extern unsigned IOCTL_FDRAWCMD;
709 extern unsigned IOCTL_FDRESET;
710 extern unsigned IOCTL_FDSETDRVPRM;
711 extern unsigned IOCTL_FDSETEMSGTRESH;
712 extern unsigned IOCTL_FDSETMAXERRS;
713 extern unsigned IOCTL_FDSETPRM;
714 extern unsigned IOCTL_FDTWADDLE;
715 extern unsigned IOCTL_FDWERRORCLR;
716 extern unsigned IOCTL_FDWERRORGET;
717 extern unsigned IOCTL_HDIO_DRIVE_CMD;
718 extern unsigned IOCTL_HDIO_GETGEO;
719 extern unsigned IOCTL_HDIO_GET_32BIT;
720 extern unsigned IOCTL_HDIO_GET_DMA;
721 extern unsigned IOCTL_HDIO_GET_IDENTITY;
722 extern unsigned IOCTL_HDIO_GET_KEEPSETTINGS;
723 extern unsigned IOCTL_HDIO_GET_MULTCOUNT;
724 extern unsigned IOCTL_HDIO_GET_NOWERR;
725 extern unsigned IOCTL_HDIO_GET_UNMASKINTR;
726 extern unsigned IOCTL_HDIO_SET_32BIT;
727 extern unsigned IOCTL_HDIO_SET_DMA;
728 extern unsigned IOCTL_HDIO_SET_KEEPSETTINGS;
729 extern unsigned IOCTL_HDIO_SET_MULTCOUNT;
730 extern unsigned IOCTL_HDIO_SET_NOWERR;
731 extern unsigned IOCTL_HDIO_SET_UNMASKINTR;
732 extern unsigned IOCTL_MTIOCGET;
733 extern unsigned IOCTL_MTIOCPOS;
734 extern unsigned IOCTL_MTIOCTOP;
735 extern unsigned IOCTL_PPPIOCGASYNCMAP;
736 extern unsigned IOCTL_PPPIOCGDEBUG;
737 extern unsigned IOCTL_PPPIOCGFLAGS;
738 extern unsigned IOCTL_PPPIOCGUNIT;
739 extern unsigned IOCTL_PPPIOCGXASYNCMAP;
740 extern unsigned IOCTL_PPPIOCSASYNCMAP;
741 extern unsigned IOCTL_PPPIOCSDEBUG;
742 extern unsigned IOCTL_PPPIOCSFLAGS;
743 extern unsigned IOCTL_PPPIOCSMAXCID;
744 extern unsigned IOCTL_PPPIOCSMRU;
745 extern unsigned IOCTL_PPPIOCSXASYNCMAP;
746 extern unsigned IOCTL_SIOCADDRT;
747 extern unsigned IOCTL_SIOCDARP;
748 extern unsigned IOCTL_SIOCDELRT;
749 extern unsigned IOCTL_SIOCDRARP;
750 extern unsigned IOCTL_SIOCGARP;
751 extern unsigned IOCTL_SIOCGIFENCAP;
752 extern unsigned IOCTL_SIOCGIFHWADDR;
753 extern unsigned IOCTL_SIOCGIFMAP;
754 extern unsigned IOCTL_SIOCGIFMEM;
755 extern unsigned IOCTL_SIOCGIFNAME;
756 extern unsigned IOCTL_SIOCGIFSLAVE;
757 extern unsigned IOCTL_SIOCGRARP;
758 extern unsigned IOCTL_SIOCGSTAMP;
759 extern unsigned IOCTL_SIOCSARP;
760 extern unsigned IOCTL_SIOCSIFENCAP;
761 extern unsigned IOCTL_SIOCSIFHWADDR;
762 extern unsigned IOCTL_SIOCSIFLINK;
763 extern unsigned IOCTL_SIOCSIFMAP;
764 extern unsigned IOCTL_SIOCSIFMEM;
765 extern unsigned IOCTL_SIOCSIFSLAVE;
766 extern unsigned IOCTL_SIOCSRARP;
767 extern unsigned IOCTL_SNDCTL_COPR_HALT;
768 extern unsigned IOCTL_SNDCTL_COPR_LOAD;
769 extern unsigned IOCTL_SNDCTL_COPR_RCODE;
770 extern unsigned IOCTL_SNDCTL_COPR_RCVMSG;
771 extern unsigned IOCTL_SNDCTL_COPR_RDATA;
772 extern unsigned IOCTL_SNDCTL_COPR_RESET;
773 extern unsigned IOCTL_SNDCTL_COPR_RUN;
774 extern unsigned IOCTL_SNDCTL_COPR_SENDMSG;
775 extern unsigned IOCTL_SNDCTL_COPR_WCODE;
776 extern unsigned IOCTL_SNDCTL_COPR_WDATA;
777 extern unsigned IOCTL_SNDCTL_DSP_GETBLKSIZE;
778 extern unsigned IOCTL_SNDCTL_DSP_GETFMTS;
779 extern unsigned IOCTL_SNDCTL_DSP_NONBLOCK;
780 extern unsigned IOCTL_SNDCTL_DSP_POST;
781 extern unsigned IOCTL_SNDCTL_DSP_RESET;
782 extern unsigned IOCTL_SNDCTL_DSP_SETFMT;
783 extern unsigned IOCTL_SNDCTL_DSP_SETFRAGMENT;
784 extern unsigned IOCTL_SNDCTL_DSP_SPEED;
785 extern unsigned IOCTL_SNDCTL_DSP_STEREO;
786 extern unsigned IOCTL_SNDCTL_DSP_SUBDIVIDE;
787 extern unsigned IOCTL_SNDCTL_DSP_SYNC;
788 extern unsigned IOCTL_SNDCTL_FM_4OP_ENABLE;
789 extern unsigned IOCTL_SNDCTL_FM_LOAD_INSTR;
790 extern unsigned IOCTL_SNDCTL_MIDI_INFO;
791 extern unsigned IOCTL_SNDCTL_MIDI_PRETIME;
792 extern unsigned IOCTL_SNDCTL_SEQ_CTRLRATE;
793 extern unsigned IOCTL_SNDCTL_SEQ_GETINCOUNT;
794 extern unsigned IOCTL_SNDCTL_SEQ_GETOUTCOUNT;
795 extern unsigned IOCTL_SNDCTL_SEQ_NRMIDIS;
796 extern unsigned IOCTL_SNDCTL_SEQ_NRSYNTHS;
797 extern unsigned IOCTL_SNDCTL_SEQ_OUTOFBAND;
798 extern unsigned IOCTL_SNDCTL_SEQ_PANIC;
799 extern unsigned IOCTL_SNDCTL_SEQ_PERCMODE;
800 extern unsigned IOCTL_SNDCTL_SEQ_RESET;
801 extern unsigned IOCTL_SNDCTL_SEQ_RESETSAMPLES;
802 extern unsigned IOCTL_SNDCTL_SEQ_SYNC;
803 extern unsigned IOCTL_SNDCTL_SEQ_TESTMIDI;
804 extern unsigned IOCTL_SNDCTL_SEQ_THRESHOLD;
805 extern unsigned IOCTL_SNDCTL_SYNTH_INFO;
806 extern unsigned IOCTL_SNDCTL_SYNTH_MEMAVL;
807 extern unsigned IOCTL_SNDCTL_TMR_CONTINUE;
808 extern unsigned IOCTL_SNDCTL_TMR_METRONOME;
809 extern unsigned IOCTL_SNDCTL_TMR_SELECT;
810 extern unsigned IOCTL_SNDCTL_TMR_SOURCE;
811 extern unsigned IOCTL_SNDCTL_TMR_START;
812 extern unsigned IOCTL_SNDCTL_TMR_STOP;
813 extern unsigned IOCTL_SNDCTL_TMR_TEMPO;
814 extern unsigned IOCTL_SNDCTL_TMR_TIMEBASE;
815 extern unsigned IOCTL_SOUND_MIXER_READ_ALTPCM;
816 extern unsigned IOCTL_SOUND_MIXER_READ_BASS;
817 extern unsigned IOCTL_SOUND_MIXER_READ_CAPS;
818 extern unsigned IOCTL_SOUND_MIXER_READ_CD;
819 extern unsigned IOCTL_SOUND_MIXER_READ_DEVMASK;
820 extern unsigned IOCTL_SOUND_MIXER_READ_ENHANCE;
821 extern unsigned IOCTL_SOUND_MIXER_READ_IGAIN;
822 extern unsigned IOCTL_SOUND_MIXER_READ_IMIX;
823 extern unsigned IOCTL_SOUND_MIXER_READ_LINE1;
824 extern unsigned IOCTL_SOUND_MIXER_READ_LINE2;
825 extern unsigned IOCTL_SOUND_MIXER_READ_LINE3;
826 extern unsigned IOCTL_SOUND_MIXER_READ_LINE;
827 extern unsigned IOCTL_SOUND_MIXER_READ_LOUD;
828 extern unsigned IOCTL_SOUND_MIXER_READ_MIC;
829 extern unsigned IOCTL_SOUND_MIXER_READ_MUTE;
830 extern unsigned IOCTL_SOUND_MIXER_READ_OGAIN;
831 extern unsigned IOCTL_SOUND_MIXER_READ_PCM;
832 extern unsigned IOCTL_SOUND_MIXER_READ_RECLEV;
833 extern unsigned IOCTL_SOUND_MIXER_READ_RECMASK;
834 extern unsigned IOCTL_SOUND_MIXER_READ_RECSRC;
835 extern unsigned IOCTL_SOUND_MIXER_READ_SPEAKER;
836 extern unsigned IOCTL_SOUND_MIXER_READ_STEREODEVS;
837 extern unsigned IOCTL_SOUND_MIXER_READ_SYNTH;
838 extern unsigned IOCTL_SOUND_MIXER_READ_TREBLE;
839 extern unsigned IOCTL_SOUND_MIXER_READ_VOLUME;
840 extern unsigned IOCTL_SOUND_MIXER_WRITE_ALTPCM;
841 extern unsigned IOCTL_SOUND_MIXER_WRITE_BASS;
842 extern unsigned IOCTL_SOUND_MIXER_WRITE_CD;
843 extern unsigned IOCTL_SOUND_MIXER_WRITE_ENHANCE;
844 extern unsigned IOCTL_SOUND_MIXER_WRITE_IGAIN;
845 extern unsigned IOCTL_SOUND_MIXER_WRITE_IMIX;
846 extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE1;
847 extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE2;
848 extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE3;
849 extern unsigned IOCTL_SOUND_MIXER_WRITE_LINE;
850 extern unsigned IOCTL_SOUND_MIXER_WRITE_LOUD;
851 extern unsigned IOCTL_SOUND_MIXER_WRITE_MIC;
852 extern unsigned IOCTL_SOUND_MIXER_WRITE_MUTE;
853 extern unsigned IOCTL_SOUND_MIXER_WRITE_OGAIN;
854 extern unsigned IOCTL_SOUND_MIXER_WRITE_PCM;
855 extern unsigned IOCTL_SOUND_MIXER_WRITE_RECLEV;
856 extern unsigned IOCTL_SOUND_MIXER_WRITE_RECSRC;
857 extern unsigned IOCTL_SOUND_MIXER_WRITE_SPEAKER;
858 extern unsigned IOCTL_SOUND_MIXER_WRITE_SYNTH;
859 extern unsigned IOCTL_SOUND_MIXER_WRITE_TREBLE;
860 extern unsigned IOCTL_SOUND_MIXER_WRITE_VOLUME;
861 extern unsigned IOCTL_SOUND_PCM_READ_BITS;
862 extern unsigned IOCTL_SOUND_PCM_READ_CHANNELS;
863 extern unsigned IOCTL_SOUND_PCM_READ_FILTER;
864 extern unsigned IOCTL_SOUND_PCM_READ_RATE;
865 extern unsigned IOCTL_SOUND_PCM_WRITE_CHANNELS;
866 extern unsigned IOCTL_SOUND_PCM_WRITE_FILTER;
867 extern unsigned IOCTL_TCFLSH;
868 extern unsigned IOCTL_TCGETA;
869 extern unsigned IOCTL_TCGETS;
870 extern unsigned IOCTL_TCSBRK;
871 extern unsigned IOCTL_TCSBRKP;
872 extern unsigned IOCTL_TCSETA;
873 extern unsigned IOCTL_TCSETAF;
874 extern unsigned IOCTL_TCSETAW;
875 extern unsigned IOCTL_TCSETS;
876 extern unsigned IOCTL_TCSETSF;
877 extern unsigned IOCTL_TCSETSW;
878 extern unsigned IOCTL_TCXONC;
879 extern unsigned IOCTL_TIOCGLCKTRMIOS;
880 extern unsigned IOCTL_TIOCGSOFTCAR;
881 extern unsigned IOCTL_TIOCINQ;
882 extern unsigned IOCTL_TIOCLINUX;
883 extern unsigned IOCTL_TIOCSERCONFIG;
884 extern unsigned IOCTL_TIOCSERGETLSR;
885 extern unsigned IOCTL_TIOCSERGWILD;
886 extern unsigned IOCTL_TIOCSERSWILD;
887 extern unsigned IOCTL_TIOCSLCKTRMIOS;
888 extern unsigned IOCTL_TIOCSSOFTCAR;
889 extern unsigned IOCTL_VT_ACTIVATE;
890 extern unsigned IOCTL_VT_DISALLOCATE;
891 extern unsigned IOCTL_VT_GETMODE;
892 extern unsigned IOCTL_VT_GETSTATE;
893 extern unsigned IOCTL_VT_OPENQRY;
894 extern unsigned IOCTL_VT_RELDISP;
895 extern unsigned IOCTL_VT_RESIZE;
896 extern unsigned IOCTL_VT_RESIZEX;
897 extern unsigned IOCTL_VT_SENDSIG;
898 extern unsigned IOCTL_VT_SETMODE;
899 extern unsigned IOCTL_VT_WAITACTIVE;
900 #endif
901 #if SANITIZER_LINUX && !SANITIZER_ANDROID
902 extern unsigned IOCTL_CYGETDEFTHRESH;
903 extern unsigned IOCTL_CYGETDEFTIMEOUT;
904 extern unsigned IOCTL_CYGETMON;
905 extern unsigned IOCTL_CYGETTHRESH;
906 extern unsigned IOCTL_CYGETTIMEOUT;
907 extern unsigned IOCTL_CYSETDEFTHRESH;
908 extern unsigned IOCTL_CYSETDEFTIMEOUT;
909 extern unsigned IOCTL_CYSETTHRESH;
910 extern unsigned IOCTL_CYSETTIMEOUT;
911 extern unsigned IOCTL_EQL_EMANCIPATE;
912 extern unsigned IOCTL_EQL_ENSLAVE;
913 extern unsigned IOCTL_EQL_GETMASTRCFG;
914 extern unsigned IOCTL_EQL_GETSLAVECFG;
915 extern unsigned IOCTL_EQL_SETMASTRCFG;
916 extern unsigned IOCTL_EQL_SETSLAVECFG;
917 extern unsigned IOCTL_EVIOCGKEYCODE_V2;
918 extern unsigned IOCTL_EVIOCGPROP;
919 extern unsigned IOCTL_EVIOCSKEYCODE_V2;
920 extern unsigned IOCTL_FS_IOC_GETFLAGS;
921 extern unsigned IOCTL_FS_IOC_GETVERSION;
922 extern unsigned IOCTL_FS_IOC_SETFLAGS;
923 extern unsigned IOCTL_FS_IOC_SETVERSION;
924 extern unsigned IOCTL_GIO_CMAP;
925 extern unsigned IOCTL_GIO_FONT;
926 extern unsigned IOCTL_GIO_SCRNMAP;
927 extern unsigned IOCTL_GIO_UNIMAP;
928 extern unsigned IOCTL_GIO_UNISCRNMAP;
929 extern unsigned IOCTL_KDADDIO;
930 extern unsigned IOCTL_KDDELIO;
931 extern unsigned IOCTL_KDDISABIO;
932 extern unsigned IOCTL_KDENABIO;
933 extern unsigned IOCTL_KDGETKEYCODE;
934 extern unsigned IOCTL_KDGETLED;
935 extern unsigned IOCTL_KDGETMODE;
936 extern unsigned IOCTL_KDGKBDIACR;
937 extern unsigned IOCTL_KDGKBENT;
938 extern unsigned IOCTL_KDGKBLED;
939 extern unsigned IOCTL_KDGKBMETA;
940 extern unsigned IOCTL_KDGKBMODE;
941 extern unsigned IOCTL_KDGKBSENT;
942 extern unsigned IOCTL_KDGKBTYPE;
943 extern unsigned IOCTL_KDMAPDISP;
944 extern unsigned IOCTL_KDMKTONE;
945 extern unsigned IOCTL_KDSETKEYCODE;
946 extern unsigned IOCTL_KDSETLED;
947 extern unsigned IOCTL_KDSETMODE;
948 extern unsigned IOCTL_KDSIGACCEPT;
949 extern unsigned IOCTL_KDSKBDIACR;
950 extern unsigned IOCTL_KDSKBENT;
951 extern unsigned IOCTL_KDSKBLED;
952 extern unsigned IOCTL_KDSKBMETA;
953 extern unsigned IOCTL_KDSKBMODE;
954 extern unsigned IOCTL_KDSKBSENT;
955 extern unsigned IOCTL_KDUNMAPDISP;
956 extern unsigned IOCTL_KIOCSOUND;
957 extern unsigned IOCTL_LPABORT;
958 extern unsigned IOCTL_LPABORTOPEN;
959 extern unsigned IOCTL_LPCAREFUL;
960 extern unsigned IOCTL_LPCHAR;
961 extern unsigned IOCTL_LPGETIRQ;
962 extern unsigned IOCTL_LPGETSTATUS;
963 extern unsigned IOCTL_LPRESET;
964 extern unsigned IOCTL_LPSETIRQ;
965 extern unsigned IOCTL_LPTIME;
966 extern unsigned IOCTL_LPWAIT;
967 extern unsigned IOCTL_MTIOCGETCONFIG;
968 extern unsigned IOCTL_MTIOCSETCONFIG;
969 extern unsigned IOCTL_PIO_CMAP;
970 extern unsigned IOCTL_PIO_FONT;
971 extern unsigned IOCTL_PIO_SCRNMAP;
972 extern unsigned IOCTL_PIO_UNIMAP;
973 extern unsigned IOCTL_PIO_UNIMAPCLR;
974 extern unsigned IOCTL_PIO_UNISCRNMAP;
975 extern unsigned IOCTL_SCSI_IOCTL_GET_IDLUN;
976 extern unsigned IOCTL_SCSI_IOCTL_PROBE_HOST;
977 extern unsigned IOCTL_SCSI_IOCTL_TAGGED_DISABLE;
978 extern unsigned IOCTL_SCSI_IOCTL_TAGGED_ENABLE;
979 extern unsigned IOCTL_SIOCAIPXITFCRT;
980 extern unsigned IOCTL_SIOCAIPXPRISLT;
981 extern unsigned IOCTL_SIOCAX25ADDUID;
982 extern unsigned IOCTL_SIOCAX25DELUID;
983 extern unsigned IOCTL_SIOCAX25GETPARMS;
984 extern unsigned IOCTL_SIOCAX25GETUID;
985 extern unsigned IOCTL_SIOCAX25NOUID;
986 extern unsigned IOCTL_SIOCAX25SETPARMS;
987 extern unsigned IOCTL_SIOCDEVPLIP;
988 extern unsigned IOCTL_SIOCIPXCFGDATA;
989 extern unsigned IOCTL_SIOCNRDECOBS;
990 extern unsigned IOCTL_SIOCNRGETPARMS;
991 extern unsigned IOCTL_SIOCNRRTCTL;
992 extern unsigned IOCTL_SIOCNRSETPARMS;
993 extern unsigned IOCTL_SNDCTL_DSP_GETISPACE;
994 extern unsigned IOCTL_SNDCTL_DSP_GETOSPACE;
995 extern unsigned IOCTL_TIOCGSERIAL;
996 extern unsigned IOCTL_TIOCSERGETMULTI;
997 extern unsigned IOCTL_TIOCSERSETMULTI;
998 extern unsigned IOCTL_TIOCSSERIAL;
999 #endif
1001 extern const int errno_EOWNERDEAD;
1002 } // namespace __sanitizer
1004 #define CHECK_TYPE_SIZE(TYPE) \
1005 COMPILER_CHECK(sizeof(__sanitizer_##TYPE) == sizeof(TYPE))
1007 #define CHECK_SIZE_AND_OFFSET(CLASS, MEMBER) \
1008 COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *) NULL)->MEMBER) == \
1009 sizeof(((CLASS *) NULL)->MEMBER)); \
1010 COMPILER_CHECK(offsetof(__sanitizer_##CLASS, MEMBER) == \
1011 offsetof(CLASS, MEMBER))
1013 // For sigaction, which is a function and struct at the same time,
1014 // and thus requires explicit "struct" in sizeof() expression.
1015 #define CHECK_STRUCT_SIZE_AND_OFFSET(CLASS, MEMBER) \
1016 COMPILER_CHECK(sizeof(((struct __sanitizer_##CLASS *) NULL)->MEMBER) == \
1017 sizeof(((struct CLASS *) NULL)->MEMBER)); \
1018 COMPILER_CHECK(offsetof(struct __sanitizer_##CLASS, MEMBER) == \
1019 offsetof(struct CLASS, MEMBER))
1021 #endif