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
This commit is contained in:
Elliott Hughes
2013-07-29 16:51:45 -07:00
parent 9a73d08f4c
commit c03e1e7439
3 changed files with 10 additions and 5 deletions

View File

@@ -33,6 +33,7 @@
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <pthread.h>
#include <stdio.h> // For FOPEN_MAX.
#include <string.h>
#include <sys/sysconf.h>
@@ -57,7 +58,6 @@
/* the following depends on our implementation */
#define SYSTEM_ATEXIT_MAX 65536 /* our implementation is unlimited */
#define SYSTEM_THREAD_STACK_MIN 32768 /* lower values may be possible, but be conservative */
#define SYSTEM_THREAD_THREADS_MAX 2048 /* really unlimited */
#define SYSTEM_2_C_BIND _POSIX_VERSION /* Posix C binding version */
@@ -309,7 +309,7 @@ int sysconf(int name) {
case _SC_THREAD_KEYS_MAX:
return (BIONIC_TLS_SLOTS - TLS_SLOT_FIRST_USER_SLOT - GLOBAL_INIT_THREAD_LOCAL_BUFFER_COUNT);
case _SC_THREAD_STACK_MIN: return SYSTEM_THREAD_STACK_MIN;
case _SC_THREAD_STACK_MIN: return PTHREAD_STACK_MIN;
case _SC_THREAD_THREADS_MAX: return SYSTEM_THREAD_THREADS_MAX;
case _SC_TTY_NAME_MAX: return SYSTEM_TTY_NAME_MAX;
#ifdef _POSIX_THREADS