From c88110e284d6fcb5922c72f524dc3b4f24139580 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Tue, 8 Sep 2009 10:54:45 +0200 Subject: Define 64 bit types if compiling with -std=c99 Compiling with -std=c99 defines __STRICT_ANSI__, but the 64 bit types and type macros should still be defined in this case. This helps compiling third party code that needs -std=c99 with the NDK. --- libc/include/stdint.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'libc') diff --git a/libc/include/stdint.h b/libc/include/stdint.h index 39a8ab8..237baa2 100644 --- a/libc/include/stdint.h +++ b/libc/include/stdint.h @@ -46,13 +46,17 @@ # define __STDINT_MACROS #endif +#if !defined __STRICT_ANSI__ || __STDC_VERSION__ >= 199901L +# define __STDC_INT64__ +#endif + typedef __int8_t int8_t; typedef __uint8_t uint8_t; typedef __int16_t int16_t; typedef __uint16_t uint16_t; typedef __int32_t int32_t; typedef __uint32_t uint32_t; -#if !defined(__STRICT_ANSI__) +#if defined(__STDC_INT64__) typedef __int64_t int64_t; typedef __uint64_t uint64_t; #endif @@ -157,7 +161,7 @@ typedef uint32_t uint_fast32_t; # define UINT_FAST32_C(c) UINT32_C(c) #endif -#if !defined(__STRICT_ANSI__) +#if defined(__STDC_INT64__) /* * int64_t */ @@ -198,7 +202,7 @@ typedef uint64_t uint_fast64_t; # define __PRIFAST_RANK "" # define __PRIPTR_RANK "" -#endif /* !__STRICT_ANSI__ */ +#endif /* __STDC_INT64__ */ /* * intptr_t & uintptr_t @@ -221,7 +225,7 @@ typedef unsigned int uintptr_t; * intmax_t & uintmax_t */ -#if !defined(__STRICT_ANSI__) +#if defined(__STDC_INT64__) typedef uint64_t uintmax_t; typedef int64_t intmax_t; @@ -233,7 +237,7 @@ typedef int64_t intmax_t; #define INTMAX_C(c) INT64_C(c) #define UINTMAX_C(c) UINT64_C(c) -#else /* __STRICT_ANSI__ */ +#else /* !__STDC_INT64__ */ typedef uint32_t uintmax_t; typedef int32_t intmax_t; @@ -245,7 +249,7 @@ typedef int32_t intmax_t; #define INTMAX_C(c) INT32_C(c) #define UINTMAX_C(c) UINT32_C(c) -#endif /* __STRICT_ANSI__ */ +#endif /* !__STDC_INT64__ */ /* size_t is defined by the GCC-specific */ -- cgit v1.1 From a4e67f4512e2609c13a67d569bff14001413a042 Mon Sep 17 00:00:00 2001 From: Matthieu CASTET Date: Sat, 27 Dec 2008 00:04:10 +0100 Subject: Remove code duplication for pthread_cond_timeout_np : use __pthread_cond_timedwait_relative helper --- libc/bionic/pthread.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'libc') diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c index ec3c459..d2c81a3 100644 --- a/libc/bionic/pthread.c +++ b/libc/bionic/pthread.c @@ -1215,22 +1215,12 @@ int pthread_cond_timeout_np(pthread_cond_t *cond, pthread_mutex_t * mutex, unsigned msecs) { - int oldvalue; struct timespec ts; - int status; ts.tv_sec = msecs / 1000; ts.tv_nsec = (msecs % 1000) * 1000000; - oldvalue = cond->value; - - pthread_mutex_unlock(mutex); - status = __futex_wait(&cond->value, oldvalue, &ts); - pthread_mutex_lock(mutex); - - if(status == (-ETIMEDOUT)) return ETIMEDOUT; - - return 0; + return __pthread_cond_timedwait_relative(cond, mutex, &ts); } -- cgit v1.1 From a246a71975c1b4a939421ed20fdd8557f93de46f Mon Sep 17 00:00:00 2001 From: vinay harugop Date: Wed, 5 Aug 2009 02:09:29 +0530 Subject: Linux kernel helpers support is provided to android for its TLS implementation. This fix addresses this by modifying the TLS access functions to use the kernel helper. This Fix is verified on ST Ericsson's U8500 platform and Submitted on behalf of a third-party: Surinder-pal SINGH from STMicroelectronics. --- libc/private/bionic_tls.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/private/bionic_tls.h b/libc/private/bionic_tls.h index 82c8cd9..742ef8c 100644 --- a/libc/private/bionic_tls.h +++ b/libc/private/bionic_tls.h @@ -87,8 +87,10 @@ extern void __init_tls(void** tls, void* thread_info); extern int __set_tls(void *ptr); /* get the TLS */ +/* Linux kernel helpers for its TLS implementation */ #ifdef __arm__ -# define __get_tls() ( *((volatile void **) 0xffff0ff0) ) +typedef void* (__kernel_get_tls_t)(void); +#define __get_tls (*(__kernel_get_tls_t *)0xffff0fe0) #else extern void* __get_tls( void ); #endif -- cgit v1.1