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