summaryrefslogtreecommitdiffstats
path: root/libc/private
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-07-29 17:35:49 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-07-29 17:35:49 -0700
commitabf3638317b4568c7e0c4d6d8c4b70a8e4af6449 (patch)
treee63014fca9d24e3ea5a202c7c5330230d2dc2cd0 /libc/private
parent326b52760d819e37c302a33d374ca80459dfec30 (diff)
parent101b5e1f6cc4e24635760928b3d2c1e51c1e5774 (diff)
downloadbionic-abf3638317b4568c7e0c4d6d8c4b70a8e4af6449.zip
bionic-abf3638317b4568c7e0c4d6d8c4b70a8e4af6449.tar.gz
bionic-abf3638317b4568c7e0c4d6d8c4b70a8e4af6449.tar.bz2
am 101b5e1f: Merge "Define PTHREAD_KEYS_MAX and _POSIX_THREAD_KEYS_MAX in a POSIX-compliant way."
* commit '101b5e1f6cc4e24635760928b3d2c1e51c1e5774': Define PTHREAD_KEYS_MAX and _POSIX_THREAD_KEYS_MAX in a POSIX-compliant way.
Diffstat (limited to 'libc/private')
-rw-r--r--libc/private/bionic_tls.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/libc/private/bionic_tls.h b/libc/private/bionic_tls.h
index 22b7806..d15b1ca 100644
--- a/libc/private/bionic_tls.h
+++ b/libc/private/bionic_tls.h
@@ -76,7 +76,12 @@ enum {
* maintain that second number, but pthread_test will fail if we forget.
*/
#define GLOBAL_INIT_THREAD_LOCAL_BUFFER_COUNT 4
-#define BIONIC_TLS_SLOTS 128
+/*
+ * This is PTHREAD_KEYS_MAX + TLS_SLOT_FIRST_USER_SLOT + GLOBAL_INIT_THREAD_LOCAL_BUFFER_COUNT
+ * rounded up to maintain stack alignment.
+ */
+#define BIONIC_ALIGN(x, a) (((x) + (a - 1)) & ~(a - 1))
+#define BIONIC_TLS_SLOTS BIONIC_ALIGN(128 + TLS_SLOT_FIRST_USER_SLOT + GLOBAL_INIT_THREAD_LOCAL_BUFFER_COUNT, 4)
/* syscall only, do not call directly */
extern int __set_tls(void* ptr);