Define PTHREAD_KEYS_MAX and _POSIX_THREAD_KEYS_MAX in a POSIX-compliant way.

Also make sysconf use PTHREAD_STACK_MIN rather than redefining its
own, different, constant.

Bug: 9997352
Change-Id: I9a8e7d2b18e691439abfb45533e82c36eee9e81d
fix broken pointer overflow check ns_name_unpack()

Many compilers optimize away the overflow check `msg + l < msg',
where `msg' is a pointer and `l' is an integer, because pointer
overflow is undefined behavior in C.

Use a safe precondition test `l >= eol - msg' instead.

Change-Id: I3fca2125834073cc36d7e9c4e586e97842265a59
Signed-off-by: Xi Wang <xi.wang@gmail.com>