LONG_LONG_MIN/MAX: Move declarations to <limits.h>

LONG_LONG_MIN, LONG_LONG_MAX and ULONG_LONG_MAX are
GLibc-specific macros that are better defined in <limits.h>
instead of the current exotic location (<pthread.h>).

Note that GCC's <limits.h> only defines these macros
when __GNU_LIBRARY__ is also defined. This is only the
case when building against GLibc, so manually redefine
the macros here.

Note that using LLONG_MIN/LLONG_MAX/ULLONG_MAX is the
C99-compliant way to get these values, but it's easier
to define these compatibility macros for the sake of
porting existing code.

Change-Id: I8023918d73b4685238054932f94a4006c1ca7d03
diff --git a/libc/include/limits.h b/libc/include/limits.h
index d691a8f..b9d4354 100644
--- a/libc/include/limits.h
+++ b/libc/include/limits.h
@@ -89,6 +89,22 @@
 #include <sys/syslimits.h>
 #endif
 
+/* GLibc compatibility definitions.
+   Note that these are defined by GCC's <limits.h>
+   only when __GNU_LIBRARY__ is defined, i.e. when
+   targetting GLibc. */
+#ifndef LONG_LONG_MIN
+#define LONG_LONG_MIN  LLONG_MIN
+#endif
+
+#ifndef LONG_LONG_MAX
+#define LONG_LONG_MAX  LLONG_MAX
+#endif
+
+#ifndef ULONG_LONG_MAX
+#define ULONG_LONG_MAX  ULLONG_MAX
+#endif
+
 #ifndef PAGESIZE
 #include <asm/page.h>
 #define  PAGESIZE  PAGE_SIZE
diff --git a/libc/include/pthread.h b/libc/include/pthread.h
index 2015ac0..ef6b80e 100644
--- a/libc/include/pthread.h
+++ b/libc/include/pthread.h
@@ -310,9 +310,4 @@
 } /* extern "C" */
 #endif
 
-/************ TO FIX ************/
-
-#define LONG_LONG_MAX __LONG_LONG_MAX__
-#define LONG_LONG_MIN (-__LONG_LONG_MAX__ - 1)
-
 #endif /* _PTHREAD_H_ */