summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
diff options
context:
space:
mode:
authorSergey Matveev <earthdok@google.com>2014-02-06 18:48:23 +0000
committerSergey Matveev <earthdok@google.com>2014-02-06 18:48:23 +0000
commite81fba64c58c4ad699e935a2a380203f1a87c34d (patch)
tree16716f440ec88875e35fe601c8f1b0d679ac9fe1 /lib/sanitizer_common/sanitizer_platform_limits_posix.cc
parent2958e4c99bff4533a21fd6b9c11ba23c1a95de2e (diff)
downloadcompiler-rt-e81fba64c58c4ad699e935a2a380203f1a87c34d.tar.gz
[sanitizer] One does not simply intercept getifaddrs().
Upgrade the interceptor, and attempt to fix the Android build. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@200936 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_platform_limits_posix.cc')
-rw-r--r--lib/sanitizer_common/sanitizer_platform_limits_posix.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
index c6306aa88..1e882e324 100644
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -23,7 +23,6 @@
#include <dirent.h>
#include <errno.h>
#include <grp.h>
-#include <ifaddrs.h>
#include <limits.h>
#include <net/if.h>
#include <net/if_arp.h>
@@ -67,6 +66,7 @@
#endif
#if !SANITIZER_ANDROID
+#include <ifaddrs.h>
#include <sys/ucontext.h>
#include <wordexp.h>
#endif
@@ -146,13 +146,13 @@ namespace __sanitizer {
unsigned struct_sigevent_sz = sizeof(struct sigevent);
unsigned struct_sched_param_sz = sizeof(struct sched_param);
unsigned struct_statfs_sz = sizeof(struct statfs);
- unsigned struct_ifaddrs_sz = sizeof(struct ifaddrs);
#if SANITIZER_MAC && !SANITIZER_IOS
unsigned struct_statfs64_sz = sizeof(struct statfs64);
#endif // SANITIZER_MAC && !SANITIZER_IOS
#if !SANITIZER_ANDROID
+ unsigned struct_sockaddr_sz = sizeof(struct sockaddr);
unsigned ucontext_t_sz = sizeof(ucontext_t);
#endif // !SANITIZER_ANDROID
@@ -973,6 +973,15 @@ CHECK_SIZE_AND_OFFSET(shmid_ds, shm_nattch);
CHECK_TYPE_SIZE(clock_t);
-COMPILER_CHECK(0 == offsetof(ifaddrs, ifa_next));
+#if !SANITIZER_ANDROID
+CHECK_TYPE_SIZE(ifaddrs);
+CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_next);
+CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_name);
+CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_addr);
+CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_netmask);
+CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_broadaddr);
+CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_dstaddr);
+CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_data);
+#endif
#endif // SANITIZER_LINUX || SANITIZER_MAC