androidifying: fixup includes and extraneous typedefs for __ANDROID__
The current could would take steps to define missing types, and include
extra stuff based on GLIBC defines/versions.
Make those places be ANDROID aware.
Change-Id: I2d1f03e3c0f7f53250288a84db4c9ccf0431d482
Signed-off-by: JP Abgrall <jpa@google.com>
diff --git a/include/libiptc/ipt_kernel_headers.h b/include/libiptc/ipt_kernel_headers.h
index 18861fe..60c7998 100644
--- a/include/libiptc/ipt_kernel_headers.h
+++ b/include/libiptc/ipt_kernel_headers.h
@@ -5,7 +5,7 @@
#include <limits.h>
-#if defined(__GLIBC__) && __GLIBC__ == 2
+#if defined(__ANDROID__) || (defined(__GLIBC__) && __GLIBC__ == 2)
#include <netinet/ip.h>
#include <netinet/in.h>
#include <netinet/ip_icmp.h>
diff --git a/libiptc/libip4tc.c b/libiptc/libip4tc.c
index e2d2a5e..221f276 100644
--- a/libiptc/libip4tc.c
+++ b/libiptc/libip4tc.c
@@ -22,7 +22,7 @@
#define inline
#endif
-#if !defined(__GLIBC__) || (__GLIBC__ < 2)
+#if !defined(__ANDROID__) && (!defined(__GLIBC__) || (__GLIBC__ < 2))
typedef unsigned int socklen_t;
#endif
diff --git a/libiptc/libip6tc.c b/libiptc/libip6tc.c
index c1508cd..e557227 100644
--- a/libiptc/libip6tc.c
+++ b/libiptc/libip6tc.c
@@ -23,7 +23,7 @@
#define inline
#endif
-#if !defined(__GLIBC__) || (__GLIBC__ < 2)
+#if !defined(__ANDROID__) && (!defined(__GLIBC__) || (__GLIBC__ < 2))
typedef unsigned int socklen_t;
#endif
diff --git a/xtables.c b/xtables.c
index 69e79b1..30977d5 100644
--- a/xtables.c
+++ b/xtables.c
@@ -31,7 +31,9 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <arpa/inet.h>
+#if !defined(__ANDROID__)
#include <linux/magic.h> /* for PROC_SUPER_MAGIC */
+#endif
#include <xtables.h>
#include <limits.h> /* INT_MAX in ip_tables.h/ip6_tables.h */