Alexey Samsonov | 74737d5 | 2012-12-13 08:50:16 +0000 | [diff] [blame] | 1 | //===-- sanitizer_platform_interceptors.h -----------------------*- C++ -*-===// |
| 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 defines macro telling whether sanitizer tools can/should intercept |
| 11 | // given library functions on a given platform. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
Dmitry Vyukov | edd2821 | 2013-04-24 11:06:05 +0000 | [diff] [blame] | 14 | #ifndef SANITIZER_PLATFORM_INTERCEPTORS_H |
| 15 | #define SANITIZER_PLATFORM_INTERCEPTORS_H |
Alexey Samsonov | 74737d5 | 2012-12-13 08:50:16 +0000 | [diff] [blame] | 16 | |
| 17 | #include "sanitizer_internal_defs.h" |
| 18 | |
Evgeniy Stepanov | 24e1372 | 2013-03-19 14:33:38 +0000 | [diff] [blame] | 19 | #if !SANITIZER_WINDOWS |
Kostya Serebryany | c20b321 | 2013-01-18 06:43:13 +0000 | [diff] [blame] | 20 | # define SI_NOT_WINDOWS 1 |
Evgeniy Stepanov | 9358c58 | 2013-02-19 09:19:16 +0000 | [diff] [blame] | 21 | # include "sanitizer_platform_limits_posix.h" |
Alexey Samsonov | 74737d5 | 2012-12-13 08:50:16 +0000 | [diff] [blame] | 22 | #else |
Kostya Serebryany | c20b321 | 2013-01-18 06:43:13 +0000 | [diff] [blame] | 23 | # define SI_NOT_WINDOWS 0 |
Alexey Samsonov | 74737d5 | 2012-12-13 08:50:16 +0000 | [diff] [blame] | 24 | #endif |
| 25 | |
Evgeniy Stepanov | 24e1372 | 2013-03-19 14:33:38 +0000 | [diff] [blame] | 26 | #if SANITIZER_LINUX && !SANITIZER_ANDROID |
Kostya Serebryany | c20b321 | 2013-01-18 06:43:13 +0000 | [diff] [blame] | 27 | # define SI_LINUX_NOT_ANDROID 1 |
Alexey Samsonov | 74737d5 | 2012-12-13 08:50:16 +0000 | [diff] [blame] | 28 | #else |
Kostya Serebryany | c20b321 | 2013-01-18 06:43:13 +0000 | [diff] [blame] | 29 | # define SI_LINUX_NOT_ANDROID 0 |
Alexey Samsonov | 74737d5 | 2012-12-13 08:50:16 +0000 | [diff] [blame] | 30 | #endif |
| 31 | |
Evgeniy Stepanov | 24e1372 | 2013-03-19 14:33:38 +0000 | [diff] [blame] | 32 | #if SANITIZER_LINUX |
Alexander Potapenko | 9eab858 | 2013-02-20 15:27:58 +0000 | [diff] [blame] | 33 | # define SI_LINUX 1 |
| 34 | #else |
| 35 | # define SI_LINUX 0 |
| 36 | #endif |
| 37 | |
Evgeniy Stepanov | e4bdda5 | 2013-04-01 14:47:21 +0000 | [diff] [blame] | 38 | #if SANITIZER_MAC |
| 39 | # define SI_MAC 1 |
| 40 | #else |
| 41 | # define SI_MAC 0 |
| 42 | #endif |
| 43 | |
Evgeniy Stepanov | f495479 | 2013-05-21 09:01:23 +0000 | [diff] [blame] | 44 | # define SANITIZER_INTERCEPT_STRCASECMP SI_NOT_WINDOWS |
| 45 | |
Kostya Serebryany | c20b321 | 2013-01-18 06:43:13 +0000 | [diff] [blame] | 46 | # define SANITIZER_INTERCEPT_READ SI_NOT_WINDOWS |
| 47 | # define SANITIZER_INTERCEPT_PREAD SI_NOT_WINDOWS |
| 48 | # define SANITIZER_INTERCEPT_WRITE SI_NOT_WINDOWS |
| 49 | # define SANITIZER_INTERCEPT_PWRITE SI_NOT_WINDOWS |
| 50 | |
Evgeniy Stepanov | b916e6a | 2013-06-24 10:43:23 +0000 | [diff] [blame] | 51 | #define SANITIZER_INTERCEPT_PREAD64 SI_LINUX_NOT_ANDROID |
| 52 | #define SANITIZER_INTERCEPT_PWRITE64 SI_LINUX_NOT_ANDROID |
| 53 | |
| 54 | #define SANITIZER_INTERCEPT_READV SI_NOT_WINDOWS |
| 55 | #define SANITIZER_INTERCEPT_WRITEV SI_NOT_WINDOWS |
| 56 | |
| 57 | #define SANITIZER_INTERCEPT_PREADV SI_LINUX_NOT_ANDROID |
| 58 | #define SANITIZER_INTERCEPT_PWRITEV SI_LINUX_NOT_ANDROID |
| 59 | #define SANITIZER_INTERCEPT_PREADV64 SI_LINUX_NOT_ANDROID |
| 60 | #define SANITIZER_INTERCEPT_PWRITEV64 SI_LINUX_NOT_ANDROID |
| 61 | |
Evgeniy Stepanov | a548059 | 2013-03-20 07:35:52 +0000 | [diff] [blame] | 62 | # define SANITIZER_INTERCEPT_PRCTL SI_LINUX |
Kostya Serebryany | c20b321 | 2013-01-18 06:43:13 +0000 | [diff] [blame] | 63 | |
Evgeniy Stepanov | 9358c58 | 2013-02-19 09:19:16 +0000 | [diff] [blame] | 64 | # define SANITIZER_INTERCEPT_LOCALTIME_AND_FRIENDS SI_NOT_WINDOWS |
| 65 | |
Evgeniy Stepanov | 5fffb9f | 2013-01-21 13:30:08 +0000 | [diff] [blame] | 66 | # define SANITIZER_INTERCEPT_SCANF SI_NOT_WINDOWS |
Alexander Potapenko | 9eab858 | 2013-02-20 15:27:58 +0000 | [diff] [blame] | 67 | # define SANITIZER_INTERCEPT_ISOC99_SCANF SI_LINUX |
Evgeniy Stepanov | 7cbbb29 | 2013-03-14 11:34:39 +0000 | [diff] [blame] | 68 | |
| 69 | # define SANITIZER_INTERCEPT_FREXP 1 |
Alexey Samsonov | ff5d1fc | 2013-03-15 14:02:21 +0000 | [diff] [blame] | 70 | # define SANITIZER_INTERCEPT_FREXPF_FREXPL SI_NOT_WINDOWS |
Evgeniy Stepanov | e4bdda5 | 2013-04-01 14:47:21 +0000 | [diff] [blame] | 71 | |
Evgeniy Stepanov | 103a63e | 2013-04-23 12:01:20 +0000 | [diff] [blame] | 72 | # define SANITIZER_INTERCEPT_GETPWNAM_AND_FRIENDS SI_NOT_WINDOWS |
| 73 | # define SANITIZER_INTERCEPT_GETPWNAM_R_AND_FRIENDS \ |
Alexey Samsonov | 8218584 | 2013-04-03 08:26:03 +0000 | [diff] [blame] | 74 | SI_MAC || SI_LINUX_NOT_ANDROID |
Evgeniy Stepanov | e4bdda5 | 2013-04-01 14:47:21 +0000 | [diff] [blame] | 75 | # define SANITIZER_INTERCEPT_CLOCK_GETTIME SI_LINUX |
| 76 | # define SANITIZER_INTERCEPT_GETITIMER SI_NOT_WINDOWS |
Evgeniy Stepanov | fef6605 | 2013-04-08 08:25:22 +0000 | [diff] [blame] | 77 | # define SANITIZER_INTERCEPT_TIME SI_NOT_WINDOWS |
Evgeniy Stepanov | a1c2a55 | 2013-04-09 11:35:13 +0000 | [diff] [blame] | 78 | # define SANITIZER_INTERCEPT_GLOB SI_LINUX_NOT_ANDROID |
Evgeniy Stepanov | 897a4ae | 2013-04-09 14:34:59 +0000 | [diff] [blame] | 79 | # define SANITIZER_INTERCEPT_WAIT SI_NOT_WINDOWS |
Evgeniy Stepanov | 9530eb7 | 2013-04-23 14:05:15 +0000 | [diff] [blame] | 80 | # define SANITIZER_INTERCEPT_INET SI_NOT_WINDOWS |
Evgeniy Stepanov | f495479 | 2013-05-21 09:01:23 +0000 | [diff] [blame] | 81 | # define SANITIZER_INTERCEPT_PTHREAD_GETSCHEDPARAM SI_NOT_WINDOWS |
Evgeniy Stepanov | 447ef19 | 2013-05-22 12:50:26 +0000 | [diff] [blame] | 82 | # define SANITIZER_INTERCEPT_GETADDRINFO SI_NOT_WINDOWS |
Evgeniy Stepanov | 9f58c5c | 2013-05-22 13:46:22 +0000 | [diff] [blame] | 83 | # define SANITIZER_INTERCEPT_GETSOCKNAME SI_NOT_WINDOWS |
Evgeniy Stepanov | 0a2cc37 | 2013-05-23 11:10:23 +0000 | [diff] [blame] | 84 | # define SANITIZER_INTERCEPT_GETHOSTBYNAME SI_NOT_WINDOWS |
| 85 | # define SANITIZER_INTERCEPT_GETHOSTBYNAME_R SI_LINUX |
Evgeniy Stepanov | f32be42 | 2013-05-23 11:38:08 +0000 | [diff] [blame] | 86 | # define SANITIZER_INTERCEPT_GETSOCKOPT SI_NOT_WINDOWS |
Evgeniy Stepanov | 9d1525e | 2013-05-29 09:09:58 +0000 | [diff] [blame] | 87 | # define SANITIZER_INTERCEPT_ACCEPT SI_NOT_WINDOWS |
| 88 | # define SANITIZER_INTERCEPT_ACCEPT4 SI_LINUX |
Evgeniy Stepanov | c87088b | 2013-05-29 10:03:11 +0000 | [diff] [blame] | 89 | # define SANITIZER_INTERCEPT_MODF SI_NOT_WINDOWS |
Evgeniy Stepanov | 9666d89 | 2013-05-29 11:30:00 +0000 | [diff] [blame] | 90 | # define SANITIZER_INTERCEPT_RECVMSG SI_NOT_WINDOWS |
Evgeniy Stepanov | bc33e13 | 2013-05-29 11:49:25 +0000 | [diff] [blame] | 91 | # define SANITIZER_INTERCEPT_GETPEERNAME SI_NOT_WINDOWS |
Evgeniy Stepanov | 745dd0d | 2013-06-07 13:00:47 +0000 | [diff] [blame] | 92 | # define SANITIZER_INTERCEPT_IOCTL SI_NOT_WINDOWS |
Evgeniy Stepanov | 9d60087 | 2013-06-24 13:56:14 +0000 | [diff] [blame] | 93 | # define SANITIZER_INTERCEPT_INET_ATON SI_NOT_WINDOWS |
Evgeniy Stepanov | 359d7fc | 2013-06-24 14:25:33 +0000 | [diff] [blame] | 94 | # define SANITIZER_INTERCEPT_SYSINFO SI_LINUX |
Evgeniy Stepanov | b5cf98f | 2013-06-26 15:00:53 +0000 | [diff] [blame] | 95 | # define SANITIZER_INTERCEPT_READDIR SI_NOT_WINDOWS |
| 96 | # define SANITIZER_INTERCEPT_READDIR64 SI_LINUX_NOT_ANDROID |
Evgeniy Stepanov | 3678cf9 | 2013-06-28 12:16:03 +0000 | [diff] [blame] | 97 | # define SANITIZER_INTERCEPT_PTRACE SI_LINUX_NOT_ANDROID |
Dmitry Vyukov | edd2821 | 2013-04-24 11:06:05 +0000 | [diff] [blame] | 98 | |
| 99 | #endif // #ifndef SANITIZER_PLATFORM_INTERCEPTORS_H |