1 //===-- sanitizer_platform_limits_posix.cpp -------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file is a part of Sanitizer common code.
11 // Sizes and layouts of platform-specific POSIX data structures.
12 //===----------------------------------------------------------------------===//
14 #include "sanitizer_platform.h"
16 #if SANITIZER_LINUX || SANITIZER_MAC
17 // Tests in this file assume that off_t-dependent data structures match the
18 // libc ABI. For example, struct dirent here is what readdir() function (as
19 // exported from libc) returns, and not the user-facing "dirent", which
20 // depends on _FILE_OFFSET_BITS setting.
21 // To get this "true" dirent definition, we undefine _FILE_OFFSET_BITS below.
22 #ifdef _FILE_OFFSET_BITS
23 #undef _FILE_OFFSET_BITS
26 // Must go after undef _FILE_OFFSET_BITS.
27 #include "sanitizer_glibc_version.h"
29 #include <arpa/inet.h>
41 #include <sys/resource.h>
42 #include <sys/socket.h>
45 #include <sys/times.h>
46 #include <sys/types.h>
47 #include <sys/utsname.h>
57 #include <net/route.h>
60 #if !SANITIZER_ANDROID
62 #include <sys/mount.h>
63 #include <sys/timeb.h>
70 #include <netinet/ether.h>
71 #include <sys/sysinfo.h>
73 #include <linux/cdrom.h>
76 #include <linux/hdreg.h>
77 #include <linux/input.h>
78 #include <linux/ioctl.h>
79 #include <linux/soundcard.h>
80 #include <linux/sysctl.h>
81 #include <linux/utsname.h>
82 #include <linux/posix_types.h>
83 #include <net/if_arp.h>
92 # include <sys/ptrace.h>
93 # if defined(__mips64) || defined(__aarch64__) || defined(__arm__)
94 # include <asm/ptrace.h>
96 typedef struct user_fpregs elf_fpregset_t
;
97 # define ARM_VFPREGS_SIZE_ASAN (32 * 8 /*fpregs*/ + 4 /*fpscr*/)
98 # if !defined(ARM_VFPREGS_SIZE)
99 # define ARM_VFPREGS_SIZE ARM_VFPREGS_SIZE_ASAN
103 # include <semaphore.h>
106 #if !SANITIZER_ANDROID
108 #include <sys/ucontext.h>
112 #if SANITIZER_LINUX && !SANITIZER_ANDROID
116 #include <net/if_ppp.h>
117 #include <netax25/ax25.h>
118 #include <netipx/ipx.h>
119 #include <netrom/netrom.h>
121 # include <rpc/xdr.h>
123 #include <scsi/scsi.h>
124 #include <sys/mtio.h>
127 #include <sys/statvfs.h>
128 #include <sys/timex.h>
129 #if defined(__mips64)
130 # include <sys/procfs.h>
132 #include <sys/user.h>
133 #include <linux/cyclades.h>
134 #include <linux/if_eql.h>
135 #include <linux/if_plip.h>
136 #include <linux/lp.h>
137 #include <linux/mroute.h>
138 #include <linux/mroute6.h>
139 #include <linux/scc.h>
140 #include <linux/serial.h>
144 #endif // SANITIZER_LINUX && !SANITIZER_ANDROID
146 #if SANITIZER_ANDROID
147 #include <linux/kd.h>
148 #include <linux/mtio.h>
149 #include <linux/ppp_defs.h>
150 #include <linux/if_ppp.h>
156 #include <sys/epoll.h>
157 #include <linux/capability.h>
158 #endif // SANITIZER_LINUX
161 #include <net/ethernet.h>
162 #include <sys/filio.h>
163 #include <sys/sockio.h>
166 // Include these after system headers to avoid name clashes and ambiguities.
167 #include "sanitizer_internal_defs.h"
168 #include "sanitizer_platform_limits_posix.h"
170 namespace __sanitizer
{
171 unsigned struct_utsname_sz
= sizeof(struct utsname
);
172 unsigned struct_stat_sz
= sizeof(struct stat
);
174 unsigned struct_stat64_sz
= sizeof(struct stat64
);
175 #endif // !SANITIZER_IOS
176 unsigned struct_rusage_sz
= sizeof(struct rusage
);
177 unsigned struct_tm_sz
= sizeof(struct tm
);
178 unsigned struct_passwd_sz
= sizeof(struct passwd
);
179 unsigned struct_group_sz
= sizeof(struct group
);
180 unsigned siginfo_t_sz
= sizeof(siginfo_t
);
181 unsigned struct_sigaction_sz
= sizeof(struct sigaction
);
182 unsigned struct_stack_t_sz
= sizeof(stack_t
);
183 unsigned struct_itimerval_sz
= sizeof(struct itimerval
);
184 unsigned pthread_t_sz
= sizeof(pthread_t
);
185 unsigned pthread_mutex_t_sz
= sizeof(pthread_mutex_t
);
186 unsigned pthread_cond_t_sz
= sizeof(pthread_cond_t
);
187 unsigned pid_t_sz
= sizeof(pid_t
);
188 unsigned timeval_sz
= sizeof(timeval
);
189 unsigned uid_t_sz
= sizeof(uid_t
);
190 unsigned gid_t_sz
= sizeof(gid_t
);
191 unsigned mbstate_t_sz
= sizeof(mbstate_t);
192 unsigned sigset_t_sz
= sizeof(sigset_t
);
193 unsigned struct_timezone_sz
= sizeof(struct timezone
);
194 unsigned struct_tms_sz
= sizeof(struct tms
);
195 unsigned struct_sigevent_sz
= sizeof(struct sigevent
);
196 unsigned struct_sched_param_sz
= sizeof(struct sched_param
);
197 unsigned struct_regex_sz
= sizeof(regex_t
);
198 unsigned struct_regmatch_sz
= sizeof(regmatch_t
);
200 #if SANITIZER_MAC && !SANITIZER_IOS
201 unsigned struct_statfs64_sz
= sizeof(struct statfs64
);
202 #endif // SANITIZER_MAC && !SANITIZER_IOS
204 #if !SANITIZER_ANDROID
205 unsigned struct_fstab_sz
= sizeof(struct fstab
);
206 unsigned struct_statfs_sz
= sizeof(struct statfs
);
207 unsigned struct_sockaddr_sz
= sizeof(struct sockaddr
);
208 unsigned ucontext_t_sz
= sizeof(ucontext_t
);
209 #endif // !SANITIZER_ANDROID
212 unsigned struct_epoll_event_sz
= sizeof(struct epoll_event
);
213 unsigned struct_sysinfo_sz
= sizeof(struct sysinfo
);
214 unsigned __user_cap_header_struct_sz
=
215 sizeof(struct __user_cap_header_struct
);
216 unsigned __user_cap_data_struct_sz
= sizeof(struct __user_cap_data_struct
);
217 unsigned struct_new_utsname_sz
= sizeof(struct new_utsname
);
218 unsigned struct_old_utsname_sz
= sizeof(struct old_utsname
);
219 unsigned struct_oldold_utsname_sz
= sizeof(struct oldold_utsname
);
220 #endif // SANITIZER_LINUX
223 unsigned struct_rlimit_sz
= sizeof(struct rlimit
);
224 unsigned struct_timespec_sz
= sizeof(struct timespec
);
225 unsigned struct_utimbuf_sz
= sizeof(struct utimbuf
);
226 unsigned struct_itimerspec_sz
= sizeof(struct itimerspec
);
227 #endif // SANITIZER_LINUX
229 #if SANITIZER_LINUX && !SANITIZER_ANDROID
230 // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
231 // has been removed from glibc 2.28.
232 #if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
233 || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
234 || defined(__x86_64__) || (defined(__riscv) && __riscv_xlen == 64)
235 #define SIZEOF_STRUCT_USTAT 32
236 #elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
237 || defined(__powerpc__) || defined(__s390__) || defined(__sparc__)
238 #define SIZEOF_STRUCT_USTAT 20
240 #error Unknown size of struct ustat
242 unsigned struct_ustat_sz
= SIZEOF_STRUCT_USTAT
;
243 unsigned struct_rlimit64_sz
= sizeof(struct rlimit64
);
244 unsigned struct_statvfs64_sz
= sizeof(struct statvfs64
);
245 unsigned struct_crypt_data_sz
= sizeof(struct crypt_data
);
246 #endif // SANITIZER_LINUX && !SANITIZER_ANDROID
248 #if SANITIZER_LINUX && !SANITIZER_ANDROID
249 unsigned struct_timex_sz
= sizeof(struct timex
);
250 unsigned struct_msqid_ds_sz
= sizeof(struct msqid_ds
);
251 unsigned struct_mq_attr_sz
= sizeof(struct mq_attr
);
252 unsigned struct_statvfs_sz
= sizeof(struct statvfs
);
253 #endif // SANITIZER_LINUX && !SANITIZER_ANDROID
255 const uptr sig_ign
= (uptr
)SIG_IGN
;
256 const uptr sig_dfl
= (uptr
)SIG_DFL
;
257 const uptr sig_err
= (uptr
)SIG_ERR
;
258 const uptr sa_siginfo
= (uptr
)SA_SIGINFO
;
261 int e_tabsz
= (int)E_TABSZ
;
265 #if SANITIZER_LINUX && !SANITIZER_ANDROID
266 unsigned struct_shminfo_sz
= sizeof(struct shminfo
);
267 unsigned struct_shm_info_sz
= sizeof(struct shm_info
);
268 int shmctl_ipc_stat
= (int)IPC_STAT
;
269 int shmctl_ipc_info
= (int)IPC_INFO
;
270 int shmctl_shm_info
= (int)SHM_INFO
;
271 int shmctl_shm_stat
= (int)SHM_STAT
;
274 #if !SANITIZER_MAC && !SANITIZER_FREEBSD
275 unsigned struct_utmp_sz
= sizeof(struct utmp
);
277 #if !SANITIZER_ANDROID
278 unsigned struct_utmpx_sz
= sizeof(struct utmpx
);
281 int map_fixed
= MAP_FIXED
;
283 int af_inet
= (int)AF_INET
;
284 int af_inet6
= (int)AF_INET6
;
286 uptr
__sanitizer_in_addr_sz(int af
) {
288 return sizeof(struct in_addr
);
289 else if (af
== AF_INET6
)
290 return sizeof(struct in6_addr
);
296 unsigned struct_ElfW_Phdr_sz
= sizeof(ElfW(Phdr
));
297 #elif SANITIZER_FREEBSD
298 unsigned struct_ElfW_Phdr_sz
= sizeof(Elf_Phdr
);
301 #if SANITIZER_LINUX && !SANITIZER_ANDROID
302 int glob_nomatch
= GLOB_NOMATCH
;
303 int glob_altdirfunc
= GLOB_ALTDIRFUNC
;
306 #if SANITIZER_LINUX && !SANITIZER_ANDROID && \
307 (defined(__i386) || defined(__x86_64) || defined(__mips64) || \
308 defined(__powerpc64__) || defined(__aarch64__) || defined(__arm__) || \
310 #if defined(__mips64) || defined(__powerpc64__) || defined(__arm__)
311 unsigned struct_user_regs_struct_sz
= sizeof(struct pt_regs
);
312 unsigned struct_user_fpregs_struct_sz
= sizeof(elf_fpregset_t
);
313 #elif defined(__aarch64__)
314 unsigned struct_user_regs_struct_sz
= sizeof(struct user_pt_regs
);
315 unsigned struct_user_fpregs_struct_sz
= sizeof(struct user_fpsimd_state
);
316 #elif defined(__s390__)
317 unsigned struct_user_regs_struct_sz
= sizeof(struct _user_regs_struct
);
318 unsigned struct_user_fpregs_struct_sz
= sizeof(struct _user_fpregs_struct
);
320 unsigned struct_user_regs_struct_sz
= sizeof(struct user_regs_struct
);
321 unsigned struct_user_fpregs_struct_sz
= sizeof(struct user_fpregs_struct
);
322 #endif // __mips64 || __powerpc64__ || __aarch64__
323 #if defined(__x86_64) || defined(__mips64) || defined(__powerpc64__) || \
324 defined(__aarch64__) || defined(__arm__) || defined(__s390__)
325 unsigned struct_user_fpxregs_struct_sz
= 0;
327 unsigned struct_user_fpxregs_struct_sz
= sizeof(struct user_fpxregs_struct
);
328 #endif // __x86_64 || __mips64 || __powerpc64__ || __aarch64__ || __arm__
331 unsigned struct_user_vfpregs_struct_sz
= ARM_VFPREGS_SIZE
;
333 unsigned struct_user_vfpregs_struct_sz
= 0;
336 int ptrace_peektext
= PTRACE_PEEKTEXT
;
337 int ptrace_peekdata
= PTRACE_PEEKDATA
;
338 int ptrace_peekuser
= PTRACE_PEEKUSER
;
339 #if (defined(PTRACE_GETREGS) && defined(PTRACE_SETREGS)) || \
340 (defined(PT_GETREGS) && defined(PT_SETREGS))
341 int ptrace_getregs
= PTRACE_GETREGS
;
342 int ptrace_setregs
= PTRACE_SETREGS
;
344 int ptrace_getregs
= -1;
345 int ptrace_setregs
= -1;
347 #if (defined(PTRACE_GETFPREGS) && defined(PTRACE_SETFPREGS)) || \
348 (defined(PT_GETFPREGS) && defined(PT_SETFPREGS))
349 int ptrace_getfpregs
= PTRACE_GETFPREGS
;
350 int ptrace_setfpregs
= PTRACE_SETFPREGS
;
352 int ptrace_getfpregs
= -1;
353 int ptrace_setfpregs
= -1;
355 #if (defined(PTRACE_GETFPXREGS) && defined(PTRACE_SETFPXREGS)) || \
356 (defined(PT_GETFPXREGS) && defined(PT_SETFPXREGS))
357 int ptrace_getfpxregs
= PTRACE_GETFPXREGS
;
358 int ptrace_setfpxregs
= PTRACE_SETFPXREGS
;
360 int ptrace_getfpxregs
= -1;
361 int ptrace_setfpxregs
= -1;
362 #endif // PTRACE_GETFPXREGS/PTRACE_SETFPXREGS
363 #if defined(PTRACE_GETVFPREGS) && defined(PTRACE_SETVFPREGS)
364 int ptrace_getvfpregs
= PTRACE_GETVFPREGS
;
365 int ptrace_setvfpregs
= PTRACE_SETVFPREGS
;
367 int ptrace_getvfpregs
= -1;
368 int ptrace_setvfpregs
= -1;
370 int ptrace_geteventmsg
= PTRACE_GETEVENTMSG
;
371 #if (defined(PTRACE_GETSIGINFO) && defined(PTRACE_SETSIGINFO)) || \
372 (defined(PT_GETSIGINFO) && defined(PT_SETSIGINFO))
373 int ptrace_getsiginfo
= PTRACE_GETSIGINFO
;
374 int ptrace_setsiginfo
= PTRACE_SETSIGINFO
;
376 int ptrace_getsiginfo
= -1;
377 int ptrace_setsiginfo
= -1;
378 #endif // PTRACE_GETSIGINFO/PTRACE_SETSIGINFO
379 #if defined(PTRACE_GETREGSET) && defined(PTRACE_SETREGSET)
380 int ptrace_getregset
= PTRACE_GETREGSET
;
381 int ptrace_setregset
= PTRACE_SETREGSET
;
383 int ptrace_getregset
= -1;
384 int ptrace_setregset
= -1;
385 #endif // PTRACE_GETREGSET/PTRACE_SETREGSET
388 unsigned path_max
= PATH_MAX
;
391 unsigned struct_ifreq_sz
= sizeof(struct ifreq
);
392 unsigned struct_termios_sz
= sizeof(struct termios
);
393 unsigned struct_winsize_sz
= sizeof(struct winsize
);
396 unsigned struct_arpreq_sz
= sizeof(struct arpreq
);
397 unsigned struct_cdrom_msf_sz
= sizeof(struct cdrom_msf
);
398 unsigned struct_cdrom_multisession_sz
= sizeof(struct cdrom_multisession
);
399 unsigned struct_cdrom_read_audio_sz
= sizeof(struct cdrom_read_audio
);
400 unsigned struct_cdrom_subchnl_sz
= sizeof(struct cdrom_subchnl
);
401 unsigned struct_cdrom_ti_sz
= sizeof(struct cdrom_ti
);
402 unsigned struct_cdrom_tocentry_sz
= sizeof(struct cdrom_tocentry
);
403 unsigned struct_cdrom_tochdr_sz
= sizeof(struct cdrom_tochdr
);
404 unsigned struct_cdrom_volctrl_sz
= sizeof(struct cdrom_volctrl
);
405 unsigned struct_ff_effect_sz
= sizeof(struct ff_effect
);
406 unsigned struct_floppy_drive_params_sz
= sizeof(struct floppy_drive_params
);
407 unsigned struct_floppy_drive_struct_sz
= sizeof(struct floppy_drive_struct
);
408 unsigned struct_floppy_fdc_state_sz
= sizeof(struct floppy_fdc_state
);
409 unsigned struct_floppy_max_errors_sz
= sizeof(struct floppy_max_errors
);
410 unsigned struct_floppy_raw_cmd_sz
= sizeof(struct floppy_raw_cmd
);
411 unsigned struct_floppy_struct_sz
= sizeof(struct floppy_struct
);
412 unsigned struct_floppy_write_errors_sz
= sizeof(struct floppy_write_errors
);
413 unsigned struct_format_descr_sz
= sizeof(struct format_descr
);
414 unsigned struct_hd_driveid_sz
= sizeof(struct hd_driveid
);
415 unsigned struct_hd_geometry_sz
= sizeof(struct hd_geometry
);
416 unsigned struct_input_absinfo_sz
= sizeof(struct input_absinfo
);
417 unsigned struct_input_id_sz
= sizeof(struct input_id
);
418 unsigned struct_mtpos_sz
= sizeof(struct mtpos
);
419 unsigned struct_rtentry_sz
= sizeof(struct rtentry
);
420 unsigned struct_termio_sz
= sizeof(struct termio
);
421 unsigned struct_vt_consize_sz
= sizeof(struct vt_consize
);
422 unsigned struct_vt_sizes_sz
= sizeof(struct vt_sizes
);
423 unsigned struct_vt_stat_sz
= sizeof(struct vt_stat
);
424 #endif // SANITIZER_LINUX
427 #if SOUND_VERSION >= 0x040000
428 unsigned struct_copr_buffer_sz
= 0;
429 unsigned struct_copr_debug_buf_sz
= 0;
430 unsigned struct_copr_msg_sz
= 0;
432 unsigned struct_copr_buffer_sz
= sizeof(struct copr_buffer
);
433 unsigned struct_copr_debug_buf_sz
= sizeof(struct copr_debug_buf
);
434 unsigned struct_copr_msg_sz
= sizeof(struct copr_msg
);
436 unsigned struct_midi_info_sz
= sizeof(struct midi_info
);
437 unsigned struct_mtget_sz
= sizeof(struct mtget
);
438 unsigned struct_mtop_sz
= sizeof(struct mtop
);
439 unsigned struct_sbi_instrument_sz
= sizeof(struct sbi_instrument
);
440 unsigned struct_seq_event_rec_sz
= sizeof(struct seq_event_rec
);
441 unsigned struct_synth_info_sz
= sizeof(struct synth_info
);
442 unsigned struct_vt_mode_sz
= sizeof(struct vt_mode
);
443 #endif // SANITIZER_LINUX
445 #if SANITIZER_LINUX && !SANITIZER_ANDROID
446 unsigned struct_ax25_parms_struct_sz
= sizeof(struct ax25_parms_struct
);
447 unsigned struct_cyclades_monitor_sz
= sizeof(struct cyclades_monitor
);
448 #if EV_VERSION > (0x010000)
449 unsigned struct_input_keymap_entry_sz
= sizeof(struct input_keymap_entry
);
451 unsigned struct_input_keymap_entry_sz
= 0;
453 unsigned struct_ipx_config_data_sz
= sizeof(struct ipx_config_data
);
454 unsigned struct_kbdiacrs_sz
= sizeof(struct kbdiacrs
);
455 unsigned struct_kbentry_sz
= sizeof(struct kbentry
);
456 unsigned struct_kbkeycode_sz
= sizeof(struct kbkeycode
);
457 unsigned struct_kbsentry_sz
= sizeof(struct kbsentry
);
458 unsigned struct_mtconfiginfo_sz
= sizeof(struct mtconfiginfo
);
459 unsigned struct_nr_parms_struct_sz
= sizeof(struct nr_parms_struct
);
460 unsigned struct_scc_modem_sz
= sizeof(struct scc_modem
);
461 unsigned struct_scc_stat_sz
= sizeof(struct scc_stat
);
462 unsigned struct_serial_multiport_struct_sz
463 = sizeof(struct serial_multiport_struct
);
464 unsigned struct_serial_struct_sz
= sizeof(struct serial_struct
);
465 unsigned struct_sockaddr_ax25_sz
= sizeof(struct sockaddr_ax25
);
466 unsigned struct_unimapdesc_sz
= sizeof(struct unimapdesc
);
467 unsigned struct_unimapinit_sz
= sizeof(struct unimapinit
);
468 #endif // SANITIZER_LINUX && !SANITIZER_ANDROID
470 #if SANITIZER_LINUX && !SANITIZER_ANDROID
471 unsigned struct_audio_buf_info_sz
= sizeof(struct audio_buf_info
);
472 unsigned struct_ppp_stats_sz
= sizeof(struct ppp_stats
);
473 #endif // (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
475 #if !SANITIZER_ANDROID && !SANITIZER_MAC
476 unsigned struct_sioc_sg_req_sz
= sizeof(struct sioc_sg_req
);
477 unsigned struct_sioc_vif_req_sz
= sizeof(struct sioc_vif_req
);
480 const unsigned long __sanitizer_bufsiz
= BUFSIZ
;
482 const unsigned IOCTL_NOT_PRESENT
= 0;
484 unsigned IOCTL_FIOASYNC
= FIOASYNC
;
485 unsigned IOCTL_FIOCLEX
= FIOCLEX
;
486 unsigned IOCTL_FIOGETOWN
= FIOGETOWN
;
487 unsigned IOCTL_FIONBIO
= FIONBIO
;
488 unsigned IOCTL_FIONCLEX
= FIONCLEX
;
489 unsigned IOCTL_FIOSETOWN
= FIOSETOWN
;
490 unsigned IOCTL_SIOCADDMULTI
= SIOCADDMULTI
;
491 unsigned IOCTL_SIOCATMARK
= SIOCATMARK
;
492 unsigned IOCTL_SIOCDELMULTI
= SIOCDELMULTI
;
493 unsigned IOCTL_SIOCGIFADDR
= SIOCGIFADDR
;
494 unsigned IOCTL_SIOCGIFBRDADDR
= SIOCGIFBRDADDR
;
495 unsigned IOCTL_SIOCGIFCONF
= SIOCGIFCONF
;
496 unsigned IOCTL_SIOCGIFDSTADDR
= SIOCGIFDSTADDR
;
497 unsigned IOCTL_SIOCGIFFLAGS
= SIOCGIFFLAGS
;
498 unsigned IOCTL_SIOCGIFMETRIC
= SIOCGIFMETRIC
;
499 unsigned IOCTL_SIOCGIFMTU
= SIOCGIFMTU
;
500 unsigned IOCTL_SIOCGIFNETMASK
= SIOCGIFNETMASK
;
501 unsigned IOCTL_SIOCGPGRP
= SIOCGPGRP
;
502 unsigned IOCTL_SIOCSIFADDR
= SIOCSIFADDR
;
503 unsigned IOCTL_SIOCSIFBRDADDR
= SIOCSIFBRDADDR
;
504 unsigned IOCTL_SIOCSIFDSTADDR
= SIOCSIFDSTADDR
;
505 unsigned IOCTL_SIOCSIFFLAGS
= SIOCSIFFLAGS
;
506 unsigned IOCTL_SIOCSIFMETRIC
= SIOCSIFMETRIC
;
507 unsigned IOCTL_SIOCSIFMTU
= SIOCSIFMTU
;
508 unsigned IOCTL_SIOCSIFNETMASK
= SIOCSIFNETMASK
;
509 unsigned IOCTL_SIOCSPGRP
= SIOCSPGRP
;
510 unsigned IOCTL_TIOCCONS
= TIOCCONS
;
511 unsigned IOCTL_TIOCEXCL
= TIOCEXCL
;
512 unsigned IOCTL_TIOCGETD
= TIOCGETD
;
513 unsigned IOCTL_TIOCGPGRP
= TIOCGPGRP
;
514 unsigned IOCTL_TIOCGWINSZ
= TIOCGWINSZ
;
515 unsigned IOCTL_TIOCMBIC
= TIOCMBIC
;
516 unsigned IOCTL_TIOCMBIS
= TIOCMBIS
;
517 unsigned IOCTL_TIOCMGET
= TIOCMGET
;
518 unsigned IOCTL_TIOCMSET
= TIOCMSET
;
519 unsigned IOCTL_TIOCNOTTY
= TIOCNOTTY
;
520 unsigned IOCTL_TIOCNXCL
= TIOCNXCL
;
521 unsigned IOCTL_TIOCOUTQ
= TIOCOUTQ
;
522 unsigned IOCTL_TIOCPKT
= TIOCPKT
;
523 unsigned IOCTL_TIOCSCTTY
= TIOCSCTTY
;
524 unsigned IOCTL_TIOCSETD
= TIOCSETD
;
525 unsigned IOCTL_TIOCSPGRP
= TIOCSPGRP
;
526 unsigned IOCTL_TIOCSTI
= TIOCSTI
;
527 unsigned IOCTL_TIOCSWINSZ
= TIOCSWINSZ
;
528 #if SANITIZER_LINUX && !SANITIZER_ANDROID
529 unsigned IOCTL_SIOCGETSGCNT
= SIOCGETSGCNT
;
530 unsigned IOCTL_SIOCGETVIFCNT
= SIOCGETVIFCNT
;
534 unsigned IOCTL_EVIOCGABS
= EVIOCGABS(0);
535 unsigned IOCTL_EVIOCGBIT
= EVIOCGBIT(0, 0);
536 unsigned IOCTL_EVIOCGEFFECTS
= EVIOCGEFFECTS
;
537 unsigned IOCTL_EVIOCGID
= EVIOCGID
;
538 unsigned IOCTL_EVIOCGKEY
= EVIOCGKEY(0);
539 unsigned IOCTL_EVIOCGKEYCODE
= EVIOCGKEYCODE
;
540 unsigned IOCTL_EVIOCGLED
= EVIOCGLED(0);
541 unsigned IOCTL_EVIOCGNAME
= EVIOCGNAME(0);
542 unsigned IOCTL_EVIOCGPHYS
= EVIOCGPHYS(0);
543 unsigned IOCTL_EVIOCGRAB
= EVIOCGRAB
;
544 unsigned IOCTL_EVIOCGREP
= EVIOCGREP
;
545 unsigned IOCTL_EVIOCGSND
= EVIOCGSND(0);
546 unsigned IOCTL_EVIOCGSW
= EVIOCGSW(0);
547 unsigned IOCTL_EVIOCGUNIQ
= EVIOCGUNIQ(0);
548 unsigned IOCTL_EVIOCGVERSION
= EVIOCGVERSION
;
549 unsigned IOCTL_EVIOCRMFF
= EVIOCRMFF
;
550 unsigned IOCTL_EVIOCSABS
= EVIOCSABS(0);
551 unsigned IOCTL_EVIOCSFF
= EVIOCSFF
;
552 unsigned IOCTL_EVIOCSKEYCODE
= EVIOCSKEYCODE
;
553 unsigned IOCTL_EVIOCSREP
= EVIOCSREP
;
554 unsigned IOCTL_BLKFLSBUF
= BLKFLSBUF
;
555 unsigned IOCTL_BLKGETSIZE
= BLKGETSIZE
;
556 unsigned IOCTL_BLKRAGET
= BLKRAGET
;
557 unsigned IOCTL_BLKRASET
= BLKRASET
;
558 unsigned IOCTL_BLKROGET
= BLKROGET
;
559 unsigned IOCTL_BLKROSET
= BLKROSET
;
560 unsigned IOCTL_BLKRRPART
= BLKRRPART
;
561 unsigned IOCTL_CDROMAUDIOBUFSIZ
= CDROMAUDIOBUFSIZ
;
562 unsigned IOCTL_CDROMEJECT
= CDROMEJECT
;
563 unsigned IOCTL_CDROMEJECT_SW
= CDROMEJECT_SW
;
564 unsigned IOCTL_CDROMMULTISESSION
= CDROMMULTISESSION
;
565 unsigned IOCTL_CDROMPAUSE
= CDROMPAUSE
;
566 unsigned IOCTL_CDROMPLAYMSF
= CDROMPLAYMSF
;
567 unsigned IOCTL_CDROMPLAYTRKIND
= CDROMPLAYTRKIND
;
568 unsigned IOCTL_CDROMREADAUDIO
= CDROMREADAUDIO
;
569 unsigned IOCTL_CDROMREADCOOKED
= CDROMREADCOOKED
;
570 unsigned IOCTL_CDROMREADMODE1
= CDROMREADMODE1
;
571 unsigned IOCTL_CDROMREADMODE2
= CDROMREADMODE2
;
572 unsigned IOCTL_CDROMREADRAW
= CDROMREADRAW
;
573 unsigned IOCTL_CDROMREADTOCENTRY
= CDROMREADTOCENTRY
;
574 unsigned IOCTL_CDROMREADTOCHDR
= CDROMREADTOCHDR
;
575 unsigned IOCTL_CDROMRESET
= CDROMRESET
;
576 unsigned IOCTL_CDROMRESUME
= CDROMRESUME
;
577 unsigned IOCTL_CDROMSEEK
= CDROMSEEK
;
578 unsigned IOCTL_CDROMSTART
= CDROMSTART
;
579 unsigned IOCTL_CDROMSTOP
= CDROMSTOP
;
580 unsigned IOCTL_CDROMSUBCHNL
= CDROMSUBCHNL
;
581 unsigned IOCTL_CDROMVOLCTRL
= CDROMVOLCTRL
;
582 unsigned IOCTL_CDROMVOLREAD
= CDROMVOLREAD
;
583 unsigned IOCTL_CDROM_GET_UPC
= CDROM_GET_UPC
;
584 unsigned IOCTL_FDCLRPRM
= FDCLRPRM
;
585 unsigned IOCTL_FDDEFPRM
= FDDEFPRM
;
586 unsigned IOCTL_FDFLUSH
= FDFLUSH
;
587 unsigned IOCTL_FDFMTBEG
= FDFMTBEG
;
588 unsigned IOCTL_FDFMTEND
= FDFMTEND
;
589 unsigned IOCTL_FDFMTTRK
= FDFMTTRK
;
590 unsigned IOCTL_FDGETDRVPRM
= FDGETDRVPRM
;
591 unsigned IOCTL_FDGETDRVSTAT
= FDGETDRVSTAT
;
592 unsigned IOCTL_FDGETDRVTYP
= FDGETDRVTYP
;
593 unsigned IOCTL_FDGETFDCSTAT
= FDGETFDCSTAT
;
594 unsigned IOCTL_FDGETMAXERRS
= FDGETMAXERRS
;
595 unsigned IOCTL_FDGETPRM
= FDGETPRM
;
596 unsigned IOCTL_FDMSGOFF
= FDMSGOFF
;
597 unsigned IOCTL_FDMSGON
= FDMSGON
;
598 unsigned IOCTL_FDPOLLDRVSTAT
= FDPOLLDRVSTAT
;
599 unsigned IOCTL_FDRAWCMD
= FDRAWCMD
;
600 unsigned IOCTL_FDRESET
= FDRESET
;
601 unsigned IOCTL_FDSETDRVPRM
= FDSETDRVPRM
;
602 unsigned IOCTL_FDSETEMSGTRESH
= FDSETEMSGTRESH
;
603 unsigned IOCTL_FDSETMAXERRS
= FDSETMAXERRS
;
604 unsigned IOCTL_FDSETPRM
= FDSETPRM
;
605 unsigned IOCTL_FDTWADDLE
= FDTWADDLE
;
606 unsigned IOCTL_FDWERRORCLR
= FDWERRORCLR
;
607 unsigned IOCTL_FDWERRORGET
= FDWERRORGET
;
608 unsigned IOCTL_HDIO_DRIVE_CMD
= HDIO_DRIVE_CMD
;
609 unsigned IOCTL_HDIO_GETGEO
= HDIO_GETGEO
;
610 unsigned IOCTL_HDIO_GET_32BIT
= HDIO_GET_32BIT
;
611 unsigned IOCTL_HDIO_GET_DMA
= HDIO_GET_DMA
;
612 unsigned IOCTL_HDIO_GET_IDENTITY
= HDIO_GET_IDENTITY
;
613 unsigned IOCTL_HDIO_GET_KEEPSETTINGS
= HDIO_GET_KEEPSETTINGS
;
614 unsigned IOCTL_HDIO_GET_MULTCOUNT
= HDIO_GET_MULTCOUNT
;
615 unsigned IOCTL_HDIO_GET_NOWERR
= HDIO_GET_NOWERR
;
616 unsigned IOCTL_HDIO_GET_UNMASKINTR
= HDIO_GET_UNMASKINTR
;
617 unsigned IOCTL_HDIO_SET_32BIT
= HDIO_SET_32BIT
;
618 unsigned IOCTL_HDIO_SET_DMA
= HDIO_SET_DMA
;
619 unsigned IOCTL_HDIO_SET_KEEPSETTINGS
= HDIO_SET_KEEPSETTINGS
;
620 unsigned IOCTL_HDIO_SET_MULTCOUNT
= HDIO_SET_MULTCOUNT
;
621 unsigned IOCTL_HDIO_SET_NOWERR
= HDIO_SET_NOWERR
;
622 unsigned IOCTL_HDIO_SET_UNMASKINTR
= HDIO_SET_UNMASKINTR
;
623 unsigned IOCTL_MTIOCPOS
= MTIOCPOS
;
624 unsigned IOCTL_PPPIOCGASYNCMAP
= PPPIOCGASYNCMAP
;
625 unsigned IOCTL_PPPIOCGDEBUG
= PPPIOCGDEBUG
;
626 unsigned IOCTL_PPPIOCGFLAGS
= PPPIOCGFLAGS
;
627 unsigned IOCTL_PPPIOCGUNIT
= PPPIOCGUNIT
;
628 unsigned IOCTL_PPPIOCGXASYNCMAP
= PPPIOCGXASYNCMAP
;
629 unsigned IOCTL_PPPIOCSASYNCMAP
= PPPIOCSASYNCMAP
;
630 unsigned IOCTL_PPPIOCSDEBUG
= PPPIOCSDEBUG
;
631 unsigned IOCTL_PPPIOCSFLAGS
= PPPIOCSFLAGS
;
632 unsigned IOCTL_PPPIOCSMAXCID
= PPPIOCSMAXCID
;
633 unsigned IOCTL_PPPIOCSMRU
= PPPIOCSMRU
;
634 unsigned IOCTL_PPPIOCSXASYNCMAP
= PPPIOCSXASYNCMAP
;
635 unsigned IOCTL_SIOCADDRT
= SIOCADDRT
;
636 unsigned IOCTL_SIOCDARP
= SIOCDARP
;
637 unsigned IOCTL_SIOCDELRT
= SIOCDELRT
;
638 unsigned IOCTL_SIOCDRARP
= SIOCDRARP
;
639 unsigned IOCTL_SIOCGARP
= SIOCGARP
;
640 unsigned IOCTL_SIOCGIFENCAP
= SIOCGIFENCAP
;
641 unsigned IOCTL_SIOCGIFHWADDR
= SIOCGIFHWADDR
;
642 unsigned IOCTL_SIOCGIFMAP
= SIOCGIFMAP
;
643 unsigned IOCTL_SIOCGIFMEM
= SIOCGIFMEM
;
644 unsigned IOCTL_SIOCGIFNAME
= SIOCGIFNAME
;
645 unsigned IOCTL_SIOCGIFSLAVE
= SIOCGIFSLAVE
;
646 unsigned IOCTL_SIOCGRARP
= SIOCGRARP
;
647 unsigned IOCTL_SIOCGSTAMP
= SIOCGSTAMP
;
648 unsigned IOCTL_SIOCSARP
= SIOCSARP
;
649 unsigned IOCTL_SIOCSIFENCAP
= SIOCSIFENCAP
;
650 unsigned IOCTL_SIOCSIFHWADDR
= SIOCSIFHWADDR
;
651 unsigned IOCTL_SIOCSIFLINK
= SIOCSIFLINK
;
652 unsigned IOCTL_SIOCSIFMAP
= SIOCSIFMAP
;
653 unsigned IOCTL_SIOCSIFMEM
= SIOCSIFMEM
;
654 unsigned IOCTL_SIOCSIFSLAVE
= SIOCSIFSLAVE
;
655 unsigned IOCTL_SIOCSRARP
= SIOCSRARP
;
656 # if SOUND_VERSION >= 0x040000
657 unsigned IOCTL_SNDCTL_COPR_HALT
= IOCTL_NOT_PRESENT
;
658 unsigned IOCTL_SNDCTL_COPR_LOAD
= IOCTL_NOT_PRESENT
;
659 unsigned IOCTL_SNDCTL_COPR_RCODE
= IOCTL_NOT_PRESENT
;
660 unsigned IOCTL_SNDCTL_COPR_RCVMSG
= IOCTL_NOT_PRESENT
;
661 unsigned IOCTL_SNDCTL_COPR_RDATA
= IOCTL_NOT_PRESENT
;
662 unsigned IOCTL_SNDCTL_COPR_RESET
= IOCTL_NOT_PRESENT
;
663 unsigned IOCTL_SNDCTL_COPR_RUN
= IOCTL_NOT_PRESENT
;
664 unsigned IOCTL_SNDCTL_COPR_SENDMSG
= IOCTL_NOT_PRESENT
;
665 unsigned IOCTL_SNDCTL_COPR_WCODE
= IOCTL_NOT_PRESENT
;
666 unsigned IOCTL_SNDCTL_COPR_WDATA
= IOCTL_NOT_PRESENT
;
667 unsigned IOCTL_SOUND_PCM_READ_BITS
= IOCTL_NOT_PRESENT
;
668 unsigned IOCTL_SOUND_PCM_READ_CHANNELS
= IOCTL_NOT_PRESENT
;
669 unsigned IOCTL_SOUND_PCM_READ_FILTER
= IOCTL_NOT_PRESENT
;
670 unsigned IOCTL_SOUND_PCM_READ_RATE
= IOCTL_NOT_PRESENT
;
671 unsigned IOCTL_SOUND_PCM_WRITE_CHANNELS
= IOCTL_NOT_PRESENT
;
672 unsigned IOCTL_SOUND_PCM_WRITE_FILTER
= IOCTL_NOT_PRESENT
;
673 # else // SOUND_VERSION
674 unsigned IOCTL_SNDCTL_COPR_HALT
= SNDCTL_COPR_HALT
;
675 unsigned IOCTL_SNDCTL_COPR_LOAD
= SNDCTL_COPR_LOAD
;
676 unsigned IOCTL_SNDCTL_COPR_RCODE
= SNDCTL_COPR_RCODE
;
677 unsigned IOCTL_SNDCTL_COPR_RCVMSG
= SNDCTL_COPR_RCVMSG
;
678 unsigned IOCTL_SNDCTL_COPR_RDATA
= SNDCTL_COPR_RDATA
;
679 unsigned IOCTL_SNDCTL_COPR_RESET
= SNDCTL_COPR_RESET
;
680 unsigned IOCTL_SNDCTL_COPR_RUN
= SNDCTL_COPR_RUN
;
681 unsigned IOCTL_SNDCTL_COPR_SENDMSG
= SNDCTL_COPR_SENDMSG
;
682 unsigned IOCTL_SNDCTL_COPR_WCODE
= SNDCTL_COPR_WCODE
;
683 unsigned IOCTL_SNDCTL_COPR_WDATA
= SNDCTL_COPR_WDATA
;
684 unsigned IOCTL_SOUND_PCM_READ_BITS
= SOUND_PCM_READ_BITS
;
685 unsigned IOCTL_SOUND_PCM_READ_CHANNELS
= SOUND_PCM_READ_CHANNELS
;
686 unsigned IOCTL_SOUND_PCM_READ_FILTER
= SOUND_PCM_READ_FILTER
;
687 unsigned IOCTL_SOUND_PCM_READ_RATE
= SOUND_PCM_READ_RATE
;
688 unsigned IOCTL_SOUND_PCM_WRITE_CHANNELS
= SOUND_PCM_WRITE_CHANNELS
;
689 unsigned IOCTL_SOUND_PCM_WRITE_FILTER
= SOUND_PCM_WRITE_FILTER
;
690 #endif // SOUND_VERSION
691 unsigned IOCTL_TCFLSH
= TCFLSH
;
692 unsigned IOCTL_TCGETA
= TCGETA
;
693 unsigned IOCTL_TCGETS
= TCGETS
;
694 unsigned IOCTL_TCSBRK
= TCSBRK
;
695 unsigned IOCTL_TCSBRKP
= TCSBRKP
;
696 unsigned IOCTL_TCSETA
= TCSETA
;
697 unsigned IOCTL_TCSETAF
= TCSETAF
;
698 unsigned IOCTL_TCSETAW
= TCSETAW
;
699 unsigned IOCTL_TCSETS
= TCSETS
;
700 unsigned IOCTL_TCSETSF
= TCSETSF
;
701 unsigned IOCTL_TCSETSW
= TCSETSW
;
702 unsigned IOCTL_TCXONC
= TCXONC
;
703 unsigned IOCTL_TIOCGLCKTRMIOS
= TIOCGLCKTRMIOS
;
704 unsigned IOCTL_TIOCGSOFTCAR
= TIOCGSOFTCAR
;
705 unsigned IOCTL_TIOCINQ
= TIOCINQ
;
706 unsigned IOCTL_TIOCLINUX
= TIOCLINUX
;
707 unsigned IOCTL_TIOCSERCONFIG
= TIOCSERCONFIG
;
708 unsigned IOCTL_TIOCSERGETLSR
= TIOCSERGETLSR
;
709 unsigned IOCTL_TIOCSERGWILD
= TIOCSERGWILD
;
710 unsigned IOCTL_TIOCSERSWILD
= TIOCSERSWILD
;
711 unsigned IOCTL_TIOCSLCKTRMIOS
= TIOCSLCKTRMIOS
;
712 unsigned IOCTL_TIOCSSOFTCAR
= TIOCSSOFTCAR
;
713 unsigned IOCTL_VT_DISALLOCATE
= VT_DISALLOCATE
;
714 unsigned IOCTL_VT_GETSTATE
= VT_GETSTATE
;
715 unsigned IOCTL_VT_RESIZE
= VT_RESIZE
;
716 unsigned IOCTL_VT_RESIZEX
= VT_RESIZEX
;
717 unsigned IOCTL_VT_SENDSIG
= VT_SENDSIG
;
718 unsigned IOCTL_MTIOCGET
= MTIOCGET
;
719 unsigned IOCTL_MTIOCTOP
= MTIOCTOP
;
720 unsigned IOCTL_SNDCTL_DSP_GETBLKSIZE
= SNDCTL_DSP_GETBLKSIZE
;
721 unsigned IOCTL_SNDCTL_DSP_GETFMTS
= SNDCTL_DSP_GETFMTS
;
722 unsigned IOCTL_SNDCTL_DSP_NONBLOCK
= SNDCTL_DSP_NONBLOCK
;
723 unsigned IOCTL_SNDCTL_DSP_POST
= SNDCTL_DSP_POST
;
724 unsigned IOCTL_SNDCTL_DSP_RESET
= SNDCTL_DSP_RESET
;
725 unsigned IOCTL_SNDCTL_DSP_SETFMT
= SNDCTL_DSP_SETFMT
;
726 unsigned IOCTL_SNDCTL_DSP_SETFRAGMENT
= SNDCTL_DSP_SETFRAGMENT
;
727 unsigned IOCTL_SNDCTL_DSP_SPEED
= SNDCTL_DSP_SPEED
;
728 unsigned IOCTL_SNDCTL_DSP_STEREO
= SNDCTL_DSP_STEREO
;
729 unsigned IOCTL_SNDCTL_DSP_SUBDIVIDE
= SNDCTL_DSP_SUBDIVIDE
;
730 unsigned IOCTL_SNDCTL_DSP_SYNC
= SNDCTL_DSP_SYNC
;
731 unsigned IOCTL_SNDCTL_FM_4OP_ENABLE
= SNDCTL_FM_4OP_ENABLE
;
732 unsigned IOCTL_SNDCTL_FM_LOAD_INSTR
= SNDCTL_FM_LOAD_INSTR
;
733 unsigned IOCTL_SNDCTL_MIDI_INFO
= SNDCTL_MIDI_INFO
;
734 unsigned IOCTL_SNDCTL_MIDI_PRETIME
= SNDCTL_MIDI_PRETIME
;
735 unsigned IOCTL_SNDCTL_SEQ_CTRLRATE
= SNDCTL_SEQ_CTRLRATE
;
736 unsigned IOCTL_SNDCTL_SEQ_GETINCOUNT
= SNDCTL_SEQ_GETINCOUNT
;
737 unsigned IOCTL_SNDCTL_SEQ_GETOUTCOUNT
= SNDCTL_SEQ_GETOUTCOUNT
;
738 unsigned IOCTL_SNDCTL_SEQ_NRMIDIS
= SNDCTL_SEQ_NRMIDIS
;
739 unsigned IOCTL_SNDCTL_SEQ_NRSYNTHS
= SNDCTL_SEQ_NRSYNTHS
;
740 unsigned IOCTL_SNDCTL_SEQ_OUTOFBAND
= SNDCTL_SEQ_OUTOFBAND
;
741 unsigned IOCTL_SNDCTL_SEQ_PANIC
= SNDCTL_SEQ_PANIC
;
742 unsigned IOCTL_SNDCTL_SEQ_PERCMODE
= SNDCTL_SEQ_PERCMODE
;
743 unsigned IOCTL_SNDCTL_SEQ_RESET
= SNDCTL_SEQ_RESET
;
744 unsigned IOCTL_SNDCTL_SEQ_RESETSAMPLES
= SNDCTL_SEQ_RESETSAMPLES
;
745 unsigned IOCTL_SNDCTL_SEQ_SYNC
= SNDCTL_SEQ_SYNC
;
746 unsigned IOCTL_SNDCTL_SEQ_TESTMIDI
= SNDCTL_SEQ_TESTMIDI
;
747 unsigned IOCTL_SNDCTL_SEQ_THRESHOLD
= SNDCTL_SEQ_THRESHOLD
;
748 unsigned IOCTL_SNDCTL_SYNTH_INFO
= SNDCTL_SYNTH_INFO
;
749 unsigned IOCTL_SNDCTL_SYNTH_MEMAVL
= SNDCTL_SYNTH_MEMAVL
;
750 unsigned IOCTL_SNDCTL_TMR_CONTINUE
= SNDCTL_TMR_CONTINUE
;
751 unsigned IOCTL_SNDCTL_TMR_METRONOME
= SNDCTL_TMR_METRONOME
;
752 unsigned IOCTL_SNDCTL_TMR_SELECT
= SNDCTL_TMR_SELECT
;
753 unsigned IOCTL_SNDCTL_TMR_SOURCE
= SNDCTL_TMR_SOURCE
;
754 unsigned IOCTL_SNDCTL_TMR_START
= SNDCTL_TMR_START
;
755 unsigned IOCTL_SNDCTL_TMR_STOP
= SNDCTL_TMR_STOP
;
756 unsigned IOCTL_SNDCTL_TMR_TEMPO
= SNDCTL_TMR_TEMPO
;
757 unsigned IOCTL_SNDCTL_TMR_TIMEBASE
= SNDCTL_TMR_TIMEBASE
;
758 unsigned IOCTL_SOUND_MIXER_READ_ALTPCM
= SOUND_MIXER_READ_ALTPCM
;
759 unsigned IOCTL_SOUND_MIXER_READ_BASS
= SOUND_MIXER_READ_BASS
;
760 unsigned IOCTL_SOUND_MIXER_READ_CAPS
= SOUND_MIXER_READ_CAPS
;
761 unsigned IOCTL_SOUND_MIXER_READ_CD
= SOUND_MIXER_READ_CD
;
762 unsigned IOCTL_SOUND_MIXER_READ_DEVMASK
= SOUND_MIXER_READ_DEVMASK
;
763 unsigned IOCTL_SOUND_MIXER_READ_ENHANCE
= SOUND_MIXER_READ_ENHANCE
;
764 unsigned IOCTL_SOUND_MIXER_READ_IGAIN
= SOUND_MIXER_READ_IGAIN
;
765 unsigned IOCTL_SOUND_MIXER_READ_IMIX
= SOUND_MIXER_READ_IMIX
;
766 unsigned IOCTL_SOUND_MIXER_READ_LINE
= SOUND_MIXER_READ_LINE
;
767 unsigned IOCTL_SOUND_MIXER_READ_LINE1
= SOUND_MIXER_READ_LINE1
;
768 unsigned IOCTL_SOUND_MIXER_READ_LINE2
= SOUND_MIXER_READ_LINE2
;
769 unsigned IOCTL_SOUND_MIXER_READ_LINE3
= SOUND_MIXER_READ_LINE3
;
770 unsigned IOCTL_SOUND_MIXER_READ_LOUD
= SOUND_MIXER_READ_LOUD
;
771 unsigned IOCTL_SOUND_MIXER_READ_MIC
= SOUND_MIXER_READ_MIC
;
772 unsigned IOCTL_SOUND_MIXER_READ_MUTE
= SOUND_MIXER_READ_MUTE
;
773 unsigned IOCTL_SOUND_MIXER_READ_OGAIN
= SOUND_MIXER_READ_OGAIN
;
774 unsigned IOCTL_SOUND_MIXER_READ_PCM
= SOUND_MIXER_READ_PCM
;
775 unsigned IOCTL_SOUND_MIXER_READ_RECLEV
= SOUND_MIXER_READ_RECLEV
;
776 unsigned IOCTL_SOUND_MIXER_READ_RECMASK
= SOUND_MIXER_READ_RECMASK
;
777 unsigned IOCTL_SOUND_MIXER_READ_RECSRC
= SOUND_MIXER_READ_RECSRC
;
778 unsigned IOCTL_SOUND_MIXER_READ_SPEAKER
= SOUND_MIXER_READ_SPEAKER
;
779 unsigned IOCTL_SOUND_MIXER_READ_STEREODEVS
= SOUND_MIXER_READ_STEREODEVS
;
780 unsigned IOCTL_SOUND_MIXER_READ_SYNTH
= SOUND_MIXER_READ_SYNTH
;
781 unsigned IOCTL_SOUND_MIXER_READ_TREBLE
= SOUND_MIXER_READ_TREBLE
;
782 unsigned IOCTL_SOUND_MIXER_READ_VOLUME
= SOUND_MIXER_READ_VOLUME
;
783 unsigned IOCTL_SOUND_MIXER_WRITE_ALTPCM
= SOUND_MIXER_WRITE_ALTPCM
;
784 unsigned IOCTL_SOUND_MIXER_WRITE_BASS
= SOUND_MIXER_WRITE_BASS
;
785 unsigned IOCTL_SOUND_MIXER_WRITE_CD
= SOUND_MIXER_WRITE_CD
;
786 unsigned IOCTL_SOUND_MIXER_WRITE_ENHANCE
= SOUND_MIXER_WRITE_ENHANCE
;
787 unsigned IOCTL_SOUND_MIXER_WRITE_IGAIN
= SOUND_MIXER_WRITE_IGAIN
;
788 unsigned IOCTL_SOUND_MIXER_WRITE_IMIX
= SOUND_MIXER_WRITE_IMIX
;
789 unsigned IOCTL_SOUND_MIXER_WRITE_LINE
= SOUND_MIXER_WRITE_LINE
;
790 unsigned IOCTL_SOUND_MIXER_WRITE_LINE1
= SOUND_MIXER_WRITE_LINE1
;
791 unsigned IOCTL_SOUND_MIXER_WRITE_LINE2
= SOUND_MIXER_WRITE_LINE2
;
792 unsigned IOCTL_SOUND_MIXER_WRITE_LINE3
= SOUND_MIXER_WRITE_LINE3
;
793 unsigned IOCTL_SOUND_MIXER_WRITE_LOUD
= SOUND_MIXER_WRITE_LOUD
;
794 unsigned IOCTL_SOUND_MIXER_WRITE_MIC
= SOUND_MIXER_WRITE_MIC
;
795 unsigned IOCTL_SOUND_MIXER_WRITE_MUTE
= SOUND_MIXER_WRITE_MUTE
;
796 unsigned IOCTL_SOUND_MIXER_WRITE_OGAIN
= SOUND_MIXER_WRITE_OGAIN
;
797 unsigned IOCTL_SOUND_MIXER_WRITE_PCM
= SOUND_MIXER_WRITE_PCM
;
798 unsigned IOCTL_SOUND_MIXER_WRITE_RECLEV
= SOUND_MIXER_WRITE_RECLEV
;
799 unsigned IOCTL_SOUND_MIXER_WRITE_RECSRC
= SOUND_MIXER_WRITE_RECSRC
;
800 unsigned IOCTL_SOUND_MIXER_WRITE_SPEAKER
= SOUND_MIXER_WRITE_SPEAKER
;
801 unsigned IOCTL_SOUND_MIXER_WRITE_SYNTH
= SOUND_MIXER_WRITE_SYNTH
;
802 unsigned IOCTL_SOUND_MIXER_WRITE_TREBLE
= SOUND_MIXER_WRITE_TREBLE
;
803 unsigned IOCTL_SOUND_MIXER_WRITE_VOLUME
= SOUND_MIXER_WRITE_VOLUME
;
804 unsigned IOCTL_VT_ACTIVATE
= VT_ACTIVATE
;
805 unsigned IOCTL_VT_GETMODE
= VT_GETMODE
;
806 unsigned IOCTL_VT_OPENQRY
= VT_OPENQRY
;
807 unsigned IOCTL_VT_RELDISP
= VT_RELDISP
;
808 unsigned IOCTL_VT_SETMODE
= VT_SETMODE
;
809 unsigned IOCTL_VT_WAITACTIVE
= VT_WAITACTIVE
;
810 #endif // SANITIZER_LINUX
812 #if SANITIZER_LINUX && !SANITIZER_ANDROID
813 unsigned IOCTL_CYGETDEFTHRESH
= CYGETDEFTHRESH
;
814 unsigned IOCTL_CYGETDEFTIMEOUT
= CYGETDEFTIMEOUT
;
815 unsigned IOCTL_CYGETMON
= CYGETMON
;
816 unsigned IOCTL_CYGETTHRESH
= CYGETTHRESH
;
817 unsigned IOCTL_CYGETTIMEOUT
= CYGETTIMEOUT
;
818 unsigned IOCTL_CYSETDEFTHRESH
= CYSETDEFTHRESH
;
819 unsigned IOCTL_CYSETDEFTIMEOUT
= CYSETDEFTIMEOUT
;
820 unsigned IOCTL_CYSETTHRESH
= CYSETTHRESH
;
821 unsigned IOCTL_CYSETTIMEOUT
= CYSETTIMEOUT
;
822 unsigned IOCTL_EQL_EMANCIPATE
= EQL_EMANCIPATE
;
823 unsigned IOCTL_EQL_ENSLAVE
= EQL_ENSLAVE
;
824 unsigned IOCTL_EQL_GETMASTRCFG
= EQL_GETMASTRCFG
;
825 unsigned IOCTL_EQL_GETSLAVECFG
= EQL_GETSLAVECFG
;
826 unsigned IOCTL_EQL_SETMASTRCFG
= EQL_SETMASTRCFG
;
827 unsigned IOCTL_EQL_SETSLAVECFG
= EQL_SETSLAVECFG
;
828 #if EV_VERSION > (0x010000)
829 unsigned IOCTL_EVIOCGKEYCODE_V2
= EVIOCGKEYCODE_V2
;
830 unsigned IOCTL_EVIOCGPROP
= EVIOCGPROP(0);
831 unsigned IOCTL_EVIOCSKEYCODE_V2
= EVIOCSKEYCODE_V2
;
833 unsigned IOCTL_EVIOCGKEYCODE_V2
= IOCTL_NOT_PRESENT
;
834 unsigned IOCTL_EVIOCGPROP
= IOCTL_NOT_PRESENT
;
835 unsigned IOCTL_EVIOCSKEYCODE_V2
= IOCTL_NOT_PRESENT
;
837 unsigned IOCTL_FS_IOC_GETFLAGS
= FS_IOC_GETFLAGS
;
838 unsigned IOCTL_FS_IOC_GETVERSION
= FS_IOC_GETVERSION
;
839 unsigned IOCTL_FS_IOC_SETFLAGS
= FS_IOC_SETFLAGS
;
840 unsigned IOCTL_FS_IOC_SETVERSION
= FS_IOC_SETVERSION
;
841 unsigned IOCTL_GIO_CMAP
= GIO_CMAP
;
842 unsigned IOCTL_GIO_FONT
= GIO_FONT
;
843 unsigned IOCTL_GIO_UNIMAP
= GIO_UNIMAP
;
844 unsigned IOCTL_GIO_UNISCRNMAP
= GIO_UNISCRNMAP
;
845 unsigned IOCTL_KDADDIO
= KDADDIO
;
846 unsigned IOCTL_KDDELIO
= KDDELIO
;
847 unsigned IOCTL_KDGETKEYCODE
= KDGETKEYCODE
;
848 unsigned IOCTL_KDGKBDIACR
= KDGKBDIACR
;
849 unsigned IOCTL_KDGKBENT
= KDGKBENT
;
850 unsigned IOCTL_KDGKBLED
= KDGKBLED
;
851 unsigned IOCTL_KDGKBMETA
= KDGKBMETA
;
852 unsigned IOCTL_KDGKBSENT
= KDGKBSENT
;
853 unsigned IOCTL_KDMAPDISP
= KDMAPDISP
;
854 unsigned IOCTL_KDSETKEYCODE
= KDSETKEYCODE
;
855 unsigned IOCTL_KDSIGACCEPT
= KDSIGACCEPT
;
856 unsigned IOCTL_KDSKBDIACR
= KDSKBDIACR
;
857 unsigned IOCTL_KDSKBENT
= KDSKBENT
;
858 unsigned IOCTL_KDSKBLED
= KDSKBLED
;
859 unsigned IOCTL_KDSKBMETA
= KDSKBMETA
;
860 unsigned IOCTL_KDSKBSENT
= KDSKBSENT
;
861 unsigned IOCTL_KDUNMAPDISP
= KDUNMAPDISP
;
862 unsigned IOCTL_LPABORT
= LPABORT
;
863 unsigned IOCTL_LPABORTOPEN
= LPABORTOPEN
;
864 unsigned IOCTL_LPCAREFUL
= LPCAREFUL
;
865 unsigned IOCTL_LPCHAR
= LPCHAR
;
866 unsigned IOCTL_LPGETIRQ
= LPGETIRQ
;
867 unsigned IOCTL_LPGETSTATUS
= LPGETSTATUS
;
868 unsigned IOCTL_LPRESET
= LPRESET
;
869 unsigned IOCTL_LPSETIRQ
= LPSETIRQ
;
870 unsigned IOCTL_LPTIME
= LPTIME
;
871 unsigned IOCTL_LPWAIT
= LPWAIT
;
872 unsigned IOCTL_MTIOCGETCONFIG
= MTIOCGETCONFIG
;
873 unsigned IOCTL_MTIOCSETCONFIG
= MTIOCSETCONFIG
;
874 unsigned IOCTL_PIO_CMAP
= PIO_CMAP
;
875 unsigned IOCTL_PIO_FONT
= PIO_FONT
;
876 unsigned IOCTL_PIO_UNIMAP
= PIO_UNIMAP
;
877 unsigned IOCTL_PIO_UNIMAPCLR
= PIO_UNIMAPCLR
;
878 unsigned IOCTL_PIO_UNISCRNMAP
= PIO_UNISCRNMAP
;
879 unsigned IOCTL_SCSI_IOCTL_GET_IDLUN
= SCSI_IOCTL_GET_IDLUN
;
880 unsigned IOCTL_SCSI_IOCTL_PROBE_HOST
= SCSI_IOCTL_PROBE_HOST
;
881 unsigned IOCTL_SCSI_IOCTL_TAGGED_DISABLE
= SCSI_IOCTL_TAGGED_DISABLE
;
882 unsigned IOCTL_SCSI_IOCTL_TAGGED_ENABLE
= SCSI_IOCTL_TAGGED_ENABLE
;
883 unsigned IOCTL_SIOCAIPXITFCRT
= SIOCAIPXITFCRT
;
884 unsigned IOCTL_SIOCAIPXPRISLT
= SIOCAIPXPRISLT
;
885 unsigned IOCTL_SIOCAX25ADDUID
= SIOCAX25ADDUID
;
886 unsigned IOCTL_SIOCAX25DELUID
= SIOCAX25DELUID
;
887 unsigned IOCTL_SIOCAX25GETPARMS
= SIOCAX25GETPARMS
;
888 unsigned IOCTL_SIOCAX25GETUID
= SIOCAX25GETUID
;
889 unsigned IOCTL_SIOCAX25NOUID
= SIOCAX25NOUID
;
890 unsigned IOCTL_SIOCAX25SETPARMS
= SIOCAX25SETPARMS
;
891 unsigned IOCTL_SIOCDEVPLIP
= SIOCDEVPLIP
;
892 unsigned IOCTL_SIOCIPXCFGDATA
= SIOCIPXCFGDATA
;
893 unsigned IOCTL_SIOCNRDECOBS
= SIOCNRDECOBS
;
894 unsigned IOCTL_SIOCNRGETPARMS
= SIOCNRGETPARMS
;
895 unsigned IOCTL_SIOCNRRTCTL
= SIOCNRRTCTL
;
896 unsigned IOCTL_SIOCNRSETPARMS
= SIOCNRSETPARMS
;
897 unsigned IOCTL_TIOCGSERIAL
= TIOCGSERIAL
;
898 unsigned IOCTL_TIOCSERGETMULTI
= TIOCSERGETMULTI
;
899 unsigned IOCTL_TIOCSERSETMULTI
= TIOCSERSETMULTI
;
900 unsigned IOCTL_TIOCSSERIAL
= TIOCSSERIAL
;
901 #endif // SANITIZER_LINUX && !SANITIZER_ANDROID
903 #if SANITIZER_LINUX && !SANITIZER_ANDROID
904 unsigned IOCTL_GIO_SCRNMAP
= GIO_SCRNMAP
;
905 unsigned IOCTL_KDDISABIO
= KDDISABIO
;
906 unsigned IOCTL_KDENABIO
= KDENABIO
;
907 unsigned IOCTL_KDGETLED
= KDGETLED
;
908 unsigned IOCTL_KDGETMODE
= KDGETMODE
;
909 unsigned IOCTL_KDGKBMODE
= KDGKBMODE
;
910 unsigned IOCTL_KDGKBTYPE
= KDGKBTYPE
;
911 unsigned IOCTL_KDMKTONE
= KDMKTONE
;
912 unsigned IOCTL_KDSETLED
= KDSETLED
;
913 unsigned IOCTL_KDSETMODE
= KDSETMODE
;
914 unsigned IOCTL_KDSKBMODE
= KDSKBMODE
;
915 unsigned IOCTL_KIOCSOUND
= KIOCSOUND
;
916 unsigned IOCTL_PIO_SCRNMAP
= PIO_SCRNMAP
;
917 unsigned IOCTL_SNDCTL_DSP_GETISPACE
= SNDCTL_DSP_GETISPACE
;
918 unsigned IOCTL_SNDCTL_DSP_GETOSPACE
= SNDCTL_DSP_GETOSPACE
;
919 #endif // (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
921 const int si_SEGV_MAPERR
= SEGV_MAPERR
;
922 const int si_SEGV_ACCERR
= SEGV_ACCERR
;
923 } // namespace __sanitizer
925 using namespace __sanitizer
;
927 COMPILER_CHECK(sizeof(__sanitizer_pthread_attr_t
) >= sizeof(pthread_attr_t
));
929 COMPILER_CHECK(sizeof(socklen_t
) == sizeof(unsigned));
930 CHECK_TYPE_SIZE(pthread_key_t
);
933 // FIXME: We define those on Linux and Mac, but only check on Linux.
934 COMPILER_CHECK(IOC_NRBITS
== _IOC_NRBITS
);
935 COMPILER_CHECK(IOC_TYPEBITS
== _IOC_TYPEBITS
);
936 COMPILER_CHECK(IOC_SIZEBITS
== _IOC_SIZEBITS
);
937 COMPILER_CHECK(IOC_DIRBITS
== _IOC_DIRBITS
);
938 COMPILER_CHECK(IOC_NRMASK
== _IOC_NRMASK
);
939 COMPILER_CHECK(IOC_TYPEMASK
== _IOC_TYPEMASK
);
940 COMPILER_CHECK(IOC_SIZEMASK
== _IOC_SIZEMASK
);
941 COMPILER_CHECK(IOC_DIRMASK
== _IOC_DIRMASK
);
942 COMPILER_CHECK(IOC_NRSHIFT
== _IOC_NRSHIFT
);
943 COMPILER_CHECK(IOC_TYPESHIFT
== _IOC_TYPESHIFT
);
944 COMPILER_CHECK(IOC_SIZESHIFT
== _IOC_SIZESHIFT
);
945 COMPILER_CHECK(IOC_DIRSHIFT
== _IOC_DIRSHIFT
);
946 COMPILER_CHECK(IOC_NONE
== _IOC_NONE
);
947 COMPILER_CHECK(IOC_WRITE
== _IOC_WRITE
);
948 COMPILER_CHECK(IOC_READ
== _IOC_READ
);
949 COMPILER_CHECK(EVIOC_ABS_MAX
== ABS_MAX
);
950 COMPILER_CHECK(EVIOC_EV_MAX
== EV_MAX
);
951 COMPILER_CHECK(IOC_SIZE(0x12345678) == _IOC_SIZE(0x12345678));
952 COMPILER_CHECK(IOC_DIR(0x12345678) == _IOC_DIR(0x12345678));
953 COMPILER_CHECK(IOC_NR(0x12345678) == _IOC_NR(0x12345678));
954 COMPILER_CHECK(IOC_TYPE(0x12345678) == _IOC_TYPE(0x12345678));
955 #endif // SANITIZER_LINUX
957 #if SANITIZER_LINUX || SANITIZER_FREEBSD
958 // There are more undocumented fields in dl_phdr_info that we are not interested
960 COMPILER_CHECK(sizeof(__sanitizer_dl_phdr_info
) <= sizeof(dl_phdr_info
));
961 CHECK_SIZE_AND_OFFSET(dl_phdr_info
, dlpi_addr
);
962 CHECK_SIZE_AND_OFFSET(dl_phdr_info
, dlpi_name
);
963 CHECK_SIZE_AND_OFFSET(dl_phdr_info
, dlpi_phdr
);
964 CHECK_SIZE_AND_OFFSET(dl_phdr_info
, dlpi_phnum
);
965 #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
967 #if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
968 CHECK_TYPE_SIZE(glob_t
);
969 CHECK_SIZE_AND_OFFSET(glob_t
, gl_pathc
);
970 CHECK_SIZE_AND_OFFSET(glob_t
, gl_pathv
);
971 CHECK_SIZE_AND_OFFSET(glob_t
, gl_offs
);
972 CHECK_SIZE_AND_OFFSET(glob_t
, gl_flags
);
973 CHECK_SIZE_AND_OFFSET(glob_t
, gl_closedir
);
974 CHECK_SIZE_AND_OFFSET(glob_t
, gl_readdir
);
975 CHECK_SIZE_AND_OFFSET(glob_t
, gl_opendir
);
976 CHECK_SIZE_AND_OFFSET(glob_t
, gl_lstat
);
977 CHECK_SIZE_AND_OFFSET(glob_t
, gl_stat
);
980 CHECK_TYPE_SIZE(addrinfo
);
981 CHECK_SIZE_AND_OFFSET(addrinfo
, ai_flags
);
982 CHECK_SIZE_AND_OFFSET(addrinfo
, ai_family
);
983 CHECK_SIZE_AND_OFFSET(addrinfo
, ai_socktype
);
984 CHECK_SIZE_AND_OFFSET(addrinfo
, ai_protocol
);
985 CHECK_SIZE_AND_OFFSET(addrinfo
, ai_protocol
);
986 CHECK_SIZE_AND_OFFSET(addrinfo
, ai_addrlen
);
987 CHECK_SIZE_AND_OFFSET(addrinfo
, ai_canonname
);
988 CHECK_SIZE_AND_OFFSET(addrinfo
, ai_addr
);
990 CHECK_TYPE_SIZE(hostent
);
991 CHECK_SIZE_AND_OFFSET(hostent
, h_name
);
992 CHECK_SIZE_AND_OFFSET(hostent
, h_aliases
);
993 CHECK_SIZE_AND_OFFSET(hostent
, h_addrtype
);
994 CHECK_SIZE_AND_OFFSET(hostent
, h_length
);
995 CHECK_SIZE_AND_OFFSET(hostent
, h_addr_list
);
997 CHECK_TYPE_SIZE(iovec
);
998 CHECK_SIZE_AND_OFFSET(iovec
, iov_base
);
999 CHECK_SIZE_AND_OFFSET(iovec
, iov_len
);
1001 CHECK_TYPE_SIZE(msghdr
);
1002 CHECK_SIZE_AND_OFFSET(msghdr
, msg_name
);
1003 CHECK_SIZE_AND_OFFSET(msghdr
, msg_namelen
);
1004 CHECK_SIZE_AND_OFFSET(msghdr
, msg_iov
);
1005 CHECK_SIZE_AND_OFFSET(msghdr
, msg_iovlen
);
1006 CHECK_SIZE_AND_OFFSET(msghdr
, msg_control
);
1007 CHECK_SIZE_AND_OFFSET(msghdr
, msg_controllen
);
1008 CHECK_SIZE_AND_OFFSET(msghdr
, msg_flags
);
1010 CHECK_TYPE_SIZE(cmsghdr
);
1011 CHECK_SIZE_AND_OFFSET(cmsghdr
, cmsg_len
);
1012 CHECK_SIZE_AND_OFFSET(cmsghdr
, cmsg_level
);
1013 CHECK_SIZE_AND_OFFSET(cmsghdr
, cmsg_type
);
1015 #if SANITIZER_LINUX && (__ANDROID_API__ >= 21 || __GLIBC_PREREQ (2, 14))
1016 CHECK_TYPE_SIZE(mmsghdr
);
1017 CHECK_SIZE_AND_OFFSET(mmsghdr
, msg_hdr
);
1018 CHECK_SIZE_AND_OFFSET(mmsghdr
, msg_len
);
1021 COMPILER_CHECK(sizeof(__sanitizer_dirent
) <= sizeof(dirent
));
1022 CHECK_SIZE_AND_OFFSET(dirent
, d_ino
);
1024 CHECK_SIZE_AND_OFFSET(dirent
, d_seekoff
);
1025 #elif SANITIZER_FREEBSD
1026 // There is no 'd_off' field on FreeBSD.
1028 CHECK_SIZE_AND_OFFSET(dirent
, d_off
);
1030 CHECK_SIZE_AND_OFFSET(dirent
, d_reclen
);
1032 #if SANITIZER_LINUX && !SANITIZER_ANDROID
1033 COMPILER_CHECK(sizeof(__sanitizer_dirent64
) <= sizeof(dirent64
));
1034 CHECK_SIZE_AND_OFFSET(dirent64
, d_ino
);
1035 CHECK_SIZE_AND_OFFSET(dirent64
, d_off
);
1036 CHECK_SIZE_AND_OFFSET(dirent64
, d_reclen
);
1039 CHECK_TYPE_SIZE(ifconf
);
1040 CHECK_SIZE_AND_OFFSET(ifconf
, ifc_len
);
1041 CHECK_SIZE_AND_OFFSET(ifconf
, ifc_ifcu
);
1043 CHECK_TYPE_SIZE(pollfd
);
1044 CHECK_SIZE_AND_OFFSET(pollfd
, fd
);
1045 CHECK_SIZE_AND_OFFSET(pollfd
, events
);
1046 CHECK_SIZE_AND_OFFSET(pollfd
, revents
);
1048 CHECK_TYPE_SIZE(nfds_t
);
1050 CHECK_TYPE_SIZE(sigset_t
);
1052 COMPILER_CHECK(sizeof(__sanitizer_sigaction
) == sizeof(struct sigaction
));
1053 // Can't write checks for sa_handler and sa_sigaction due to them being
1054 // preprocessor macros.
1055 CHECK_STRUCT_SIZE_AND_OFFSET(sigaction
, sa_mask
);
1056 #if !defined(__s390x__) || __GLIBC_PREREQ (2, 20)
1057 // On s390x glibc 2.19 and earlier sa_flags was unsigned long, and sa_resv
1059 CHECK_STRUCT_SIZE_AND_OFFSET(sigaction
, sa_flags
);
1061 #if SANITIZER_LINUX && (!SANITIZER_ANDROID || !SANITIZER_MIPS32)
1062 CHECK_STRUCT_SIZE_AND_OFFSET(sigaction
, sa_restorer
);
1066 CHECK_TYPE_SIZE(__sysctl_args
);
1067 CHECK_SIZE_AND_OFFSET(__sysctl_args
, name
);
1068 CHECK_SIZE_AND_OFFSET(__sysctl_args
, nlen
);
1069 CHECK_SIZE_AND_OFFSET(__sysctl_args
, oldval
);
1070 CHECK_SIZE_AND_OFFSET(__sysctl_args
, oldlenp
);
1071 CHECK_SIZE_AND_OFFSET(__sysctl_args
, newval
);
1072 CHECK_SIZE_AND_OFFSET(__sysctl_args
, newlen
);
1074 CHECK_TYPE_SIZE(__kernel_uid_t
);
1075 CHECK_TYPE_SIZE(__kernel_gid_t
);
1077 #if SANITIZER_USES_UID16_SYSCALLS
1078 CHECK_TYPE_SIZE(__kernel_old_uid_t
);
1079 CHECK_TYPE_SIZE(__kernel_old_gid_t
);
1082 CHECK_TYPE_SIZE(__kernel_off_t
);
1083 CHECK_TYPE_SIZE(__kernel_loff_t
);
1084 CHECK_TYPE_SIZE(__kernel_fd_set
);
1087 #if !SANITIZER_ANDROID
1088 CHECK_TYPE_SIZE(wordexp_t
);
1089 CHECK_SIZE_AND_OFFSET(wordexp_t
, we_wordc
);
1090 CHECK_SIZE_AND_OFFSET(wordexp_t
, we_wordv
);
1091 CHECK_SIZE_AND_OFFSET(wordexp_t
, we_offs
);
1094 CHECK_TYPE_SIZE(tm
);
1095 CHECK_SIZE_AND_OFFSET(tm
, tm_sec
);
1096 CHECK_SIZE_AND_OFFSET(tm
, tm_min
);
1097 CHECK_SIZE_AND_OFFSET(tm
, tm_hour
);
1098 CHECK_SIZE_AND_OFFSET(tm
, tm_mday
);
1099 CHECK_SIZE_AND_OFFSET(tm
, tm_mon
);
1100 CHECK_SIZE_AND_OFFSET(tm
, tm_year
);
1101 CHECK_SIZE_AND_OFFSET(tm
, tm_wday
);
1102 CHECK_SIZE_AND_OFFSET(tm
, tm_yday
);
1103 CHECK_SIZE_AND_OFFSET(tm
, tm_isdst
);
1104 CHECK_SIZE_AND_OFFSET(tm
, tm_gmtoff
);
1105 CHECK_SIZE_AND_OFFSET(tm
, tm_zone
);
1108 CHECK_TYPE_SIZE(mntent
);
1109 CHECK_SIZE_AND_OFFSET(mntent
, mnt_fsname
);
1110 CHECK_SIZE_AND_OFFSET(mntent
, mnt_dir
);
1111 CHECK_SIZE_AND_OFFSET(mntent
, mnt_type
);
1112 CHECK_SIZE_AND_OFFSET(mntent
, mnt_opts
);
1113 CHECK_SIZE_AND_OFFSET(mntent
, mnt_freq
);
1114 CHECK_SIZE_AND_OFFSET(mntent
, mnt_passno
);
1117 CHECK_TYPE_SIZE(ether_addr
);
1119 #if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
1120 CHECK_TYPE_SIZE(ipc_perm
);
1121 # if SANITIZER_FREEBSD
1122 CHECK_SIZE_AND_OFFSET(ipc_perm
, key
);
1123 CHECK_SIZE_AND_OFFSET(ipc_perm
, seq
);
1125 CHECK_SIZE_AND_OFFSET(ipc_perm
, __key
);
1126 CHECK_SIZE_AND_OFFSET(ipc_perm
, __seq
);
1128 CHECK_SIZE_AND_OFFSET(ipc_perm
, uid
);
1129 CHECK_SIZE_AND_OFFSET(ipc_perm
, gid
);
1130 CHECK_SIZE_AND_OFFSET(ipc_perm
, cuid
);
1131 CHECK_SIZE_AND_OFFSET(ipc_perm
, cgid
);
1132 #if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
1133 /* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
1134 on many architectures. */
1135 CHECK_SIZE_AND_OFFSET(ipc_perm
, mode
);
1138 CHECK_TYPE_SIZE(shmid_ds
);
1139 CHECK_SIZE_AND_OFFSET(shmid_ds
, shm_perm
);
1140 CHECK_SIZE_AND_OFFSET(shmid_ds
, shm_segsz
);
1141 CHECK_SIZE_AND_OFFSET(shmid_ds
, shm_atime
);
1142 CHECK_SIZE_AND_OFFSET(shmid_ds
, shm_dtime
);
1143 CHECK_SIZE_AND_OFFSET(shmid_ds
, shm_ctime
);
1144 CHECK_SIZE_AND_OFFSET(shmid_ds
, shm_cpid
);
1145 CHECK_SIZE_AND_OFFSET(shmid_ds
, shm_lpid
);
1146 CHECK_SIZE_AND_OFFSET(shmid_ds
, shm_nattch
);
1149 CHECK_TYPE_SIZE(clock_t);
1152 CHECK_TYPE_SIZE(clockid_t
);
1155 #if !SANITIZER_ANDROID
1156 CHECK_TYPE_SIZE(ifaddrs
);
1157 CHECK_SIZE_AND_OFFSET(ifaddrs
, ifa_next
);
1158 CHECK_SIZE_AND_OFFSET(ifaddrs
, ifa_name
);
1159 CHECK_SIZE_AND_OFFSET(ifaddrs
, ifa_addr
);
1160 CHECK_SIZE_AND_OFFSET(ifaddrs
, ifa_netmask
);
1161 #if SANITIZER_LINUX || SANITIZER_FREEBSD
1162 // Compare against the union, because we can't reach into the union in a
1167 # if SANITIZER_FREEBSD
1168 CHECK_SIZE_AND_OFFSET(ifaddrs
, ifa_dstaddr
);
1170 COMPILER_CHECK(sizeof(((__sanitizer_ifaddrs
*)nullptr)->ifa_dstaddr
) ==
1171 sizeof(((ifaddrs
*)nullptr)->ifa_ifu
));
1172 COMPILER_CHECK(offsetof(__sanitizer_ifaddrs
, ifa_dstaddr
) ==
1173 offsetof(ifaddrs
, ifa_ifu
));
1174 # endif // SANITIZER_FREEBSD
1176 CHECK_SIZE_AND_OFFSET(ifaddrs
, ifa_dstaddr
);
1177 #endif // SANITIZER_LINUX
1178 CHECK_SIZE_AND_OFFSET(ifaddrs
, ifa_data
);
1182 COMPILER_CHECK(sizeof(__sanitizer_struct_mallinfo
) == sizeof(struct mallinfo
));
1185 #if !SANITIZER_ANDROID
1186 CHECK_TYPE_SIZE(timeb
);
1187 CHECK_SIZE_AND_OFFSET(timeb
, time
);
1188 CHECK_SIZE_AND_OFFSET(timeb
, millitm
);
1189 CHECK_SIZE_AND_OFFSET(timeb
, timezone
);
1190 CHECK_SIZE_AND_OFFSET(timeb
, dstflag
);
1193 CHECK_TYPE_SIZE(passwd
);
1194 CHECK_SIZE_AND_OFFSET(passwd
, pw_name
);
1195 CHECK_SIZE_AND_OFFSET(passwd
, pw_passwd
);
1196 CHECK_SIZE_AND_OFFSET(passwd
, pw_uid
);
1197 CHECK_SIZE_AND_OFFSET(passwd
, pw_gid
);
1198 CHECK_SIZE_AND_OFFSET(passwd
, pw_dir
);
1199 CHECK_SIZE_AND_OFFSET(passwd
, pw_shell
);
1201 #if !SANITIZER_ANDROID
1202 CHECK_SIZE_AND_OFFSET(passwd
, pw_gecos
);
1206 CHECK_SIZE_AND_OFFSET(passwd
, pw_change
);
1207 CHECK_SIZE_AND_OFFSET(passwd
, pw_expire
);
1208 CHECK_SIZE_AND_OFFSET(passwd
, pw_class
);
1212 CHECK_TYPE_SIZE(group
);
1213 CHECK_SIZE_AND_OFFSET(group
, gr_name
);
1214 CHECK_SIZE_AND_OFFSET(group
, gr_passwd
);
1215 CHECK_SIZE_AND_OFFSET(group
, gr_gid
);
1216 CHECK_SIZE_AND_OFFSET(group
, gr_mem
);
1219 CHECK_TYPE_SIZE(XDR
);
1220 CHECK_SIZE_AND_OFFSET(XDR
, x_op
);
1221 CHECK_SIZE_AND_OFFSET(XDR
, x_ops
);
1222 CHECK_SIZE_AND_OFFSET(XDR
, x_public
);
1223 CHECK_SIZE_AND_OFFSET(XDR
, x_private
);
1224 CHECK_SIZE_AND_OFFSET(XDR
, x_base
);
1225 CHECK_SIZE_AND_OFFSET(XDR
, x_handy
);
1226 COMPILER_CHECK(__sanitizer_XDR_ENCODE
== XDR_ENCODE
);
1227 COMPILER_CHECK(__sanitizer_XDR_DECODE
== XDR_DECODE
);
1228 COMPILER_CHECK(__sanitizer_XDR_FREE
== XDR_FREE
);
1231 #if SANITIZER_LINUX && !SANITIZER_ANDROID
1232 COMPILER_CHECK(sizeof(__sanitizer_FILE
) <= sizeof(FILE));
1233 CHECK_SIZE_AND_OFFSET(FILE, _flags
);
1234 CHECK_SIZE_AND_OFFSET(FILE, _IO_read_ptr
);
1235 CHECK_SIZE_AND_OFFSET(FILE, _IO_read_end
);
1236 CHECK_SIZE_AND_OFFSET(FILE, _IO_read_base
);
1237 CHECK_SIZE_AND_OFFSET(FILE, _IO_write_ptr
);
1238 CHECK_SIZE_AND_OFFSET(FILE, _IO_write_end
);
1239 CHECK_SIZE_AND_OFFSET(FILE, _IO_write_base
);
1240 CHECK_SIZE_AND_OFFSET(FILE, _IO_buf_base
);
1241 CHECK_SIZE_AND_OFFSET(FILE, _IO_buf_end
);
1242 CHECK_SIZE_AND_OFFSET(FILE, _IO_save_base
);
1243 CHECK_SIZE_AND_OFFSET(FILE, _IO_backup_base
);
1244 CHECK_SIZE_AND_OFFSET(FILE, _IO_save_end
);
1245 CHECK_SIZE_AND_OFFSET(FILE, _markers
);
1246 CHECK_SIZE_AND_OFFSET(FILE, _chain
);
1247 CHECK_SIZE_AND_OFFSET(FILE, _fileno
);
1250 #if SANITIZER_LINUX && !SANITIZER_ANDROID
1251 COMPILER_CHECK(sizeof(__sanitizer__obstack_chunk
) <= sizeof(_obstack_chunk
));
1252 CHECK_SIZE_AND_OFFSET(_obstack_chunk
, limit
);
1253 CHECK_SIZE_AND_OFFSET(_obstack_chunk
, prev
);
1254 CHECK_TYPE_SIZE(obstack
);
1255 CHECK_SIZE_AND_OFFSET(obstack
, chunk_size
);
1256 CHECK_SIZE_AND_OFFSET(obstack
, chunk
);
1257 CHECK_SIZE_AND_OFFSET(obstack
, object_base
);
1258 CHECK_SIZE_AND_OFFSET(obstack
, next_free
);
1260 CHECK_TYPE_SIZE(cookie_io_functions_t
);
1261 CHECK_SIZE_AND_OFFSET(cookie_io_functions_t
, read
);
1262 CHECK_SIZE_AND_OFFSET(cookie_io_functions_t
, write
);
1263 CHECK_SIZE_AND_OFFSET(cookie_io_functions_t
, seek
);
1264 CHECK_SIZE_AND_OFFSET(cookie_io_functions_t
, close
);
1267 #if SANITIZER_LINUX || SANITIZER_FREEBSD
1268 CHECK_TYPE_SIZE(sem_t
);
1271 #if SANITIZER_LINUX && defined(__arm__)
1272 COMPILER_CHECK(ARM_VFPREGS_SIZE
== ARM_VFPREGS_SIZE_ASAN
);
1275 #endif // SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_MAC