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