[sanitizer] Fix struct ifconf definition on Mac and restore the size checks.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@184296 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
index 96e5c57..9264e61 100644
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -157,7 +157,6 @@
 
   // ioctl arguments
   unsigned struct_arpreq_sz = sizeof(struct arpreq);
-  unsigned struct_ifconf_sz = sizeof(struct ifconf);
   unsigned struct_ifreq_sz = sizeof(struct ifreq);
   unsigned struct_termios_sz = sizeof(struct termios);
   unsigned struct_winsize_sz = sizeof(struct winsize);
@@ -673,4 +672,9 @@
 CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_level);
 CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type);
 
+CHECK_TYPE_SIZE(ifconf);
+CHECK_SIZE_AND_OFFSET(ifconf, ifc_len);
+CHECK_SIZE_AND_OFFSET(ifconf, ifc_ifcu);
+
 #endif  // SANITIZER_LINUX || SANITIZER_MAC
+
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
index 294a17e..077badf 100644
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -154,7 +154,11 @@
     union {
       void *ifcu_req;
     } ifc_ifcu;
+#if SANITIZER_MAC
+  } __attribute__((packed));
+#else
   };
+#endif
 
   extern unsigned struct_arpreq_sz;
   extern unsigned struct_ifreq_sz;