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