Don't expose all BSD extensions.
Just expose the ones that bionic historically leaked.
Also, many of the M_* constants in <math.h> are actually POSIX.
Change-Id: I6275df84c5866b872b71f1c8ed14e2aada12b793
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 5369e30..8cde1c7 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -233,11 +233,6 @@
# define __USE_BSD 1
#endif
-/* Historically there was no way to turn off the BSD stuff, so we're probably stuck with that. */
-#if !defined(__USE_BSD)
-# define __USE_BSD 1
-#endif
-
/* _FILE_OFFSET_BITS 64 support. */
#if !defined(__LP64__) && defined(_FILE_OFFSET_BITS)
#if _FILE_OFFSET_BITS == 64
diff --git a/libc/include/sys/endian.h b/libc/include/sys/endian.h
index 99d5ff1..b9e4758 100644
--- a/libc/include/sys/endian.h
+++ b/libc/include/sys/endian.h
@@ -64,7 +64,7 @@
#define htonq(x) __swap64(x)
#define ntohq(x) __swap64(x)
-#if defined(__USE_BSD)
+#if defined(__USE_BSD) || defined(__BIONIC__) /* Historically bionic exposed these. */
#define LITTLE_ENDIAN _LITTLE_ENDIAN
#define BIG_ENDIAN _BIG_ENDIAN
#define PDP_ENDIAN _PDP_ENDIAN
diff --git a/libc/include/sys/limits.h b/libc/include/sys/limits.h
index b7d899b..5aa3d80 100644
--- a/libc/include/sys/limits.h
+++ b/libc/include/sys/limits.h
@@ -73,7 +73,7 @@
# define LLONG_MIN (-0x7fffffffffffffffLL-1)
/* min value for a signed long long */
-#if defined(__USE_BSD)
+#if defined(__USE_BSD) || defined(__BIONIC__) /* Historically bionic exposed these. */
# define UID_MAX UINT_MAX /* max value for a uid_t */
# define GID_MAX UINT_MAX /* max value for a gid_t */
#endif
diff --git a/libc/include/sys/types.h b/libc/include/sys/types.h
index 469842d..2895057 100644
--- a/libc/include/sys/types.h
+++ b/libc/include/sys/types.h
@@ -141,7 +141,7 @@
typedef unsigned int uint_t;
typedef unsigned int uint;
-#if defined(__USE_BSD)
+#if defined(__USE_BSD) || defined(__BIONIC__) /* Historically bionic exposed these. */
#include <sys/sysmacros.h>
typedef unsigned char u_char;