More <limits.h> fixes.
Went through the POSIX spec for the _POSIX* and _XOPEN* constants.
Bug: http://b/32776472
Test: ran tests
Change-Id: I389100dbc7de354eae9056e44b0a7fa8c37374e3
diff --git a/libc/include/bits/posix_limits.h b/libc/include/bits/posix_limits.h
index e5846d6..2688cc5 100644
--- a/libc/include/bits/posix_limits.h
+++ b/libc/include/bits/posix_limits.h
@@ -70,7 +70,7 @@
#define _POSIX_SHELL 1 /* system. */
#define _POSIX_SPAWN __BIONIC_POSIX_FEATURE_SINCE(28) /* <spawn.h> */
#define _POSIX_SPIN_LOCKS __BIONIC_POSIX_FEATURE_SINCE(24) /* pthread_spin_*. */
-#define _POSIX_SPORADIC_SERVER _POSIX_VERSION /* sched_setparam/sched_setscheduler. */
+#define _POSIX_SPORADIC_SERVER __BIONIC_POSIX_FEATURE_MISSING /* No SCHED_SPORADIC. */
#define _POSIX_SYNCHRONIZED_IO _POSIX_VERSION
#define _POSIX_THREAD_ATTR_STACKADDR _POSIX_VERSION /* Strictly, we're missing the deprecated pthread_attr_getstackaddr/pthread_attr_setstackaddr, but we do have pthread_attr_getstack/pthread_attr_setstack. */
#define _POSIX_THREAD_ATTR_STACKSIZE _POSIX_VERSION /* pthread_attr_getstack/pthread_attr_getstacksize/pthread_attr_setstack/pthread_attr_setstacksize. */
@@ -82,7 +82,7 @@
#define _POSIX_THREAD_ROBUST_PRIO_INHERIT __BIONIC_POSIX_FEATURE_MISSING
#define _POSIX_THREAD_ROBUST_PRIO_PROTECT __BIONIC_POSIX_FEATURE_MISSING
#define _POSIX_THREAD_SAFE_FUNCTIONS _POSIX_VERSION
-#define _POSIX_THREAD_SPORADIC_SERVER _POSIX_VERSION /* sched_setparam/sched_setscheduler. */
+#define _POSIX_THREAD_SPORADIC_SERVER __BIONIC_POSIX_FEATURE_MISSING /* No SCHED_SPORADIC. */
#define _POSIX_THREADS _POSIX_VERSION /* Strictly, pthread_cancel/pthread_testcancel are missing. */
#define _POSIX_TIMEOUTS __BIONIC_POSIX_FEATURE_SINCE(21) /* pthread_mutex_timedlock arrived late. */
#define _POSIX_TIMERS _POSIX_VERSION /* clock_getres/clock_gettime/clock_settime/nanosleep/timer_create/timer_delete/timer_gettime/timer_getoverrun/timer_settime. */
@@ -94,6 +94,15 @@
#define _POSIX_VDISABLE '\0'
+#define _POSIX2_C_BIND _POSIX_VERSION
+#define _POSIX2_C_DEV __BIONIC_POSIX_FEATURE_MISSING
+#define _POSIX2_CHAR_TERM _POSIX_VERSION
+#define _POSIX2_FORT_DEV __BIONIC_POSIX_FEATURE_MISSING
+#define _POSIX2_FORT_RUN __BIONIC_POSIX_FEATURE_MISSING
+#define _POSIX2_LOCALEDEF __BIONIC_POSIX_FEATURE_MISSING
+#define _POSIX2_SW_DEV __BIONIC_POSIX_FEATURE_MISSING
+#define _POSIX2_UPE __BIONIC_POSIX_FEATURE_MISSING
+
#if defined(__LP64__)
#define _POSIX_V7_ILP32_OFF32 -1
#define _POSIX_V7_ILP32_OFFBIG -1
@@ -106,16 +115,26 @@
#define _POSIX_V7_LPBIG_OFFBIG -1
#endif
+#define _XOPEN_CRYPT __BIONIC_POSIX_FEATURE_MISSING
+#define _XOPEN_ENH_I18N 1
+#define _XOPEN_LEGACY __BIONIC_POSIX_FEATURE_MISSING
+#define _XOPEN_REALTIME 1
+#define _XOPEN_REALTIME_THREADS 1
+#define _XOPEN_SHM 1
+#define _XOPEN_STREAMS __BIONIC_POSIX_FEATURE_MISSING
+#define _XOPEN_UNIX 1
+
/* Minimum values for other maxima. These numbers are simply lower bounds mandated by POSIX. */
-/* Any constant values here other than -1 or 200809L are explicitly specified by POSIX.1-2008. */
+/* The constant values here are explicitly specified by POSIX, not implementation dependent. */
#define _POSIX_AIO_LISTIO_MAX 2
#define _POSIX_AIO_MAX 1
#define _POSIX_ARG_MAX 4096
#define _POSIX_CHILD_MAX 25
+#define _POSIX_CLOCKRES_MIN 20000000
#define _POSIX_DELAYTIMER_MAX 32
#define _POSIX_HOST_NAME_MAX 255
#define _POSIX_LINK_MAX 8
-#define _POSIX_LOGIN_NAME_MAX 9 /* includes trailing NUL */
+#define _POSIX_LOGIN_NAME_MAX 9
#define _POSIX_MAX_CANON 255
#define _POSIX_MAX_INPUT 255
#define _POSIX_MQ_OPEN_MAX 8
@@ -126,45 +145,36 @@
#define _POSIX_PATH_MAX 256
#define _POSIX_PIPE_BUF 512
#define _POSIX_RE_DUP_MAX 255
+#define _POSIX_RTSIG_MAX 8
#define _POSIX_SEM_NSEMS_MAX 256
#define _POSIX_SEM_VALUE_MAX 32767
#define _POSIX_SIGQUEUE_MAX 32
#define _POSIX_SSIZE_MAX 32767
#define _POSIX_STREAM_MAX 8
+#define _POSIX_SS_REPL_MAX 4
#define _POSIX_SYMLINK_MAX 255
#define _POSIX_SYMLOOP_MAX 8
#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
#define _POSIX_THREAD_KEYS_MAX 128
#define _POSIX_THREAD_THREADS_MAX 64
#define _POSIX_TIMER_MAX 32
+#define _POSIX_TRACE_EVENT_NAME_MAX 30
#define _POSIX_TRACE_NAME_MAX 8
#define _POSIX_TRACE_SYS_MAX 8
#define _POSIX_TRACE_USER_EVENT_MAX 32
-#define _POSIX_TTY_NAME_MAX 9 /* includes trailing NUL */
+#define _POSIX_TTY_NAME_MAX 9
#define _POSIX_TZNAME_MAX 6
#define _POSIX2_BC_BASE_MAX 99
#define _POSIX2_BC_DIM_MAX 2048
#define _POSIX2_BC_SCALE_MAX 99
#define _POSIX2_BC_STRING_MAX 1000
#define _POSIX2_CHARCLASS_NAME_MAX 14
-#define _POSIX2_CHAR_TERM -1 /* not implemented */
#define _POSIX2_COLL_WEIGHTS_MAX 2
-#define _POSIX2_C_BIND _POSIX_VERSION
-#define _POSIX2_C_DEV -1 /* c dev utilities not implemented */
#define _POSIX2_EXPR_NEST_MAX 32
#define _POSIX2_LINE_MAX 2048
-#define _POSIX2_LOCALEDEF -1 /* localedef utilitiy not implemented */
-#define _POSIX2_RE_DUP_MAX _POSIX_RE_DUP_MAX
-#define _POSIX2_SW_DEV -1 /* software dev utilities not implemented */
-#define _POSIX2_UPE -1 /* user portability utilities not implemented */
-
-#define _XOPEN_ENH_I18N -1 /* we don't support internationalization in the C library */
-#define _XOPEN_CRYPT -1 /* don't support X/Open Encryption */
+#define _POSIX2_RE_DUP_MAX 255
#define _XOPEN_IOV_MAX 16
-#define _XOPEN_LEGACY -1 /* not support all */
-#define _XOPEN_REALTIME -1 /* we don't support all these functions */
-#define _XOPEN_REALTIME_THREADS -1 /* same here */
-#define _XOPEN_SHM -1
-#define _XOPEN_UNIX 1
+#define _XOPEN_NAME_MAX 255
+#define _XOPEN_PATH_MAX 1024
#endif