From 545afa16bb6e44227f531a3508e21f3184b2fd5d Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 15 Mar 2016 17:11:56 -0700 Subject: [PATCH] Fix PTHREAD_THREADS_MAX. We don't have a compile-time limit on the number of threads, and we don't have a definite run-time limit either. Bug: http://b/27617302 Change-Id: I6a6fe083e7b655d24eb9e7ef7f3e0280d483080b --- libc/bionic/sysconf.cpp | 4 ++-- libc/include/sys/limits.h | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libc/bionic/sysconf.cpp b/libc/bionic/sysconf.cpp index 125b3c92f..cff62885c 100644 --- a/libc/bionic/sysconf.cpp +++ b/libc/bionic/sysconf.cpp @@ -124,8 +124,8 @@ long sysconf(int name) { case _SC_THREAD_DESTRUCTOR_ITERATIONS: return PTHREAD_DESTRUCTOR_ITERATIONS; case _SC_THREAD_KEYS_MAX: return PTHREAD_KEYS_MAX; case _SC_THREAD_STACK_MIN: return PTHREAD_STACK_MIN; - case _SC_THREAD_THREADS_MAX: return PTHREAD_THREADS_MAX; - case _SC_TTY_NAME_MAX: return 32; // Seems default on linux. + case _SC_THREAD_THREADS_MAX: return -1; // No specific limit. + case _SC_TTY_NAME_MAX: return 32; // Seems default on linux. case _SC_THREADS: return _POSIX_THREADS; case _SC_THREAD_ATTR_STACKADDR: return _POSIX_THREAD_ATTR_STACKADDR; case _SC_THREAD_ATTR_STACKSIZE: return _POSIX_THREAD_ATTR_STACKSIZE; diff --git a/libc/include/sys/limits.h b/libc/include/sys/limits.h index be79cf3f3..f84253e6b 100644 --- a/libc/include/sys/limits.h +++ b/libc/include/sys/limits.h @@ -120,8 +120,11 @@ #define _XOPEN_VERSION 700 /* by Posix definition */ -#define PTHREAD_DESTRUCTOR_ITERATIONS 4 // >= _POSIX_THREAD_DESTRUCTOR_ITERATIONS -#define PTHREAD_KEYS_MAX 128 // >= _POSIX_THREAD_KEYS_MAX -#define PTHREAD_THREADS_MAX 2048 // bionic has no specific limit +/* >= _POSIX_THREAD_DESTRUCTOR_ITERATIONS */ +#define PTHREAD_DESTRUCTOR_ITERATIONS 4 +/* >= _POSIX_THREAD_KEYS_MAX */ +#define PTHREAD_KEYS_MAX 128 +/* bionic has no specific limit */ +#undef PTHREAD_THREADS_MAX #endif