From e5cc1f386b167b9f7bfdebc7219e89aa9b71e4b2 Mon Sep 17 00:00:00 2001 From: The Android Open Source Project Date: Thu, 15 Jan 2009 16:12:07 -0800 Subject: auto import from //branches/cupcake/...@126645 --- libc/bionic/__errno.c | 2 +- libc/bionic/libc_init_common.c | 2 +- libc/bionic/libc_init_static.c | 2 +- libc/bionic/pthread.c | 2 +- libc/include/stdio.h | 10 ++++ libc/include/stdlib.h | 7 +++ libc/include/sys/android/atomics.h | 1 - libc/include/sys/android/tls.h | 1 - libc/include/sys/stat.h | 4 ++ libc/include/sys/tls.h | 94 -------------------------------------- libc/include/wchar.h | 11 +++-- libc/private/bionic_tls.h | 94 ++++++++++++++++++++++++++++++++++++++ libc/unistd/sysconf.c | 2 +- 13 files changed, 126 insertions(+), 106 deletions(-) delete mode 100644 libc/include/sys/android/atomics.h delete mode 100644 libc/include/sys/android/tls.h delete mode 100644 libc/include/sys/tls.h create mode 100644 libc/private/bionic_tls.h (limited to 'libc') diff --git a/libc/bionic/__errno.c b/libc/bionic/__errno.c index ffc6e61..8f33cce 100644 --- a/libc/bionic/__errno.c +++ b/libc/bionic/__errno.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. */ #include -#include +#include volatile int* __errno( void ) { diff --git a/libc/bionic/libc_init_common.c b/libc/bionic/libc_init_common.c index 0944cb0..de4919d 100644 --- a/libc/bionic/libc_init_common.c +++ b/libc/bionic/libc_init_common.c @@ -36,7 +36,7 @@ #include "atexit.h" #include "libc_init_common.h" -#include +#include #include extern void _init(void); diff --git a/libc/bionic/libc_init_static.c b/libc/bionic/libc_init_static.c index f5a1d80..ec463f7 100644 --- a/libc/bionic/libc_init_static.c +++ b/libc/bionic/libc_init_static.c @@ -55,7 +55,7 @@ #include "atexit.h" #include "libc_init_common.h" -#include +#include #include __noreturn void __libc_init(uintptr_t *elfdata, diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c index 2fd740e..6114f40 100644 --- a/libc/bionic/pthread.c +++ b/libc/bionic/pthread.c @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/libc/include/stdio.h b/libc/include/stdio.h index b3b0adf..79e526b 100644 --- a/libc/include/stdio.h +++ b/libc/include/stdio.h @@ -41,6 +41,16 @@ #include #include +/* va_list and size_t must be defined by stdio.h according to Posix */ +#define __need___va_list +#include + +/* note that this forces stddef.h to *only* define size_t */ +#define __need_size_t +#include + +#include + #if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE #include /* XXX should be removed */ #endif diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h index a821e03..acfe694 100644 --- a/libc/include/stdlib.h +++ b/libc/include/stdlib.h @@ -29,6 +29,13 @@ #define _STDLIB_H_ #include + +/* wchar_t is required in stdlib.h according to POSIX. + * note that defining __need_wchar_t prevents stddef.h + * to define all other symbols it does normally */ +#define __need_wchar_t +#include + #include #include #include diff --git a/libc/include/sys/android/atomics.h b/libc/include/sys/android/atomics.h deleted file mode 100644 index 75017b9..0000000 --- a/libc/include/sys/android/atomics.h +++ /dev/null @@ -1 +0,0 @@ -#include \ No newline at end of file diff --git a/libc/include/sys/android/tls.h b/libc/include/sys/android/tls.h deleted file mode 100644 index 274ac35..0000000 --- a/libc/include/sys/android/tls.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h index 7ab0f82..5e6363f 100644 --- a/libc/include/sys/stat.h +++ b/libc/include/sys/stat.h @@ -77,6 +77,10 @@ extern int lstat(const char *, struct stat *); extern int mknod(const char *, mode_t, dev_t); extern mode_t umask(mode_t); +#define stat64 stat +#define fstat64 fstat +#define lstat64 lstat + static __inline__ int mkfifo(const char *__p, mode_t __m) { return mknod(__p, (__m & ~S_IFMT) | S_IFIFO, (dev_t)0); diff --git a/libc/include/sys/tls.h b/libc/include/sys/tls.h deleted file mode 100644 index da34344..0000000 --- a/libc/include/sys/tls.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2008 The Android Open Source Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -#ifndef _SYS_TLS_H -#define _SYS_TLS_H - -#include - -__BEGIN_DECLS - -/** WARNING WARNING WARNING - ** - ** This header file is *NOT* part of the public Bionic ABI/API - ** and should not be used/included by user-serviceable parts of - ** the system (e.g. applications). - ** - ** It is only provided here for the benefit of the system dynamic - ** linker and the OpenGL sub-system (which needs to access the - ** pre-allocated slot directly for performance reason). - **/ - -/* maximum number of elements in the TLS array */ -#define BIONIC_TLS_SLOTS 64 - -/* note that slot 0, called TLS_SLOT_SELF must point to itself. - * this is required to implement thread-local storage with the x86 - * Linux kernel, that reads the TLS from fs:[0], where 'fs' is a - * thread-specific segment descriptor... - */ - -/* Well known TLS slots */ -#define TLS_SLOT_SELF 0 -#define TLS_SLOT_THREAD_ID 1 -#define TLS_SLOT_ERRNO 2 - -#define TLS_SLOT_OPENGL_API 3 -#define TLS_SLOT_OPENGL 4 - -/* small technical note: it is not possible to call pthread_setspecific - * on keys that are <= TLS_SLOT_MAX_WELL_KNOWN, which is why it is set to - * TLS_SLOT_ERRNO. - * - * later slots like TLS_SLOT_OPENGL are pre-allocated through the use of - * TLS_DEFAULT_ALLOC_MAP. this means that there is no need to use - * pthread_key_create() to initialize them. on the other hand, there is - * no destructor associated to them (we might need to implement this later) - */ -#define TLS_SLOT_MAX_WELL_KNOWN TLS_SLOT_ERRNO - -#define TLS_DEFAULT_ALLOC_MAP 0x0000001F - -/* set the Thread Local Storage, must contain at least BIONIC_TLS_SLOTS pointers */ -extern void __init_tls(void** tls, void* thread_info); - -/* syscall only, do not call directly */ -extern int __set_tls(void *ptr); - -/* get the TLS */ -#ifdef __arm__ -# define __get_tls() ( *((volatile void **) 0xffff0ff0) ) -#else -extern void* __get_tls( void ); -#endif - -/* return the stack base and size, used by our malloc debugger */ -extern void* __get_stack_base(int *p_stack_size); - -__END_DECLS - -#endif /* _SYS_TLS_H */ diff --git a/libc/include/wchar.h b/libc/include/wchar.h index 3dadc98..e2feb60 100644 --- a/libc/include/wchar.h +++ b/libc/include/wchar.h @@ -30,11 +30,17 @@ #include #include + +/* wchar_t is required in stdlib.h according to POSIX */ +#define __need___wchar_t #include + #include #include #include +#include + /* IMPORTANT: Any code that relies on wide character support is essentially * non-portable and/or broken. the only reason this header exist * is because I'm really a nice guy. However, I'm not nice enough @@ -44,11 +50,6 @@ __BEGIN_DECLS -#ifndef __cplusplus -/* wchar_t is a builtin keyword of g++ */ -typedef unsigned char wchar_t; -#endif - typedef int wint_t; typedef struct { int dummy; } mbstate_t; diff --git a/libc/private/bionic_tls.h b/libc/private/bionic_tls.h new file mode 100644 index 0000000..da34344 --- /dev/null +++ b/libc/private/bionic_tls.h @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#ifndef _SYS_TLS_H +#define _SYS_TLS_H + +#include + +__BEGIN_DECLS + +/** WARNING WARNING WARNING + ** + ** This header file is *NOT* part of the public Bionic ABI/API + ** and should not be used/included by user-serviceable parts of + ** the system (e.g. applications). + ** + ** It is only provided here for the benefit of the system dynamic + ** linker and the OpenGL sub-system (which needs to access the + ** pre-allocated slot directly for performance reason). + **/ + +/* maximum number of elements in the TLS array */ +#define BIONIC_TLS_SLOTS 64 + +/* note that slot 0, called TLS_SLOT_SELF must point to itself. + * this is required to implement thread-local storage with the x86 + * Linux kernel, that reads the TLS from fs:[0], where 'fs' is a + * thread-specific segment descriptor... + */ + +/* Well known TLS slots */ +#define TLS_SLOT_SELF 0 +#define TLS_SLOT_THREAD_ID 1 +#define TLS_SLOT_ERRNO 2 + +#define TLS_SLOT_OPENGL_API 3 +#define TLS_SLOT_OPENGL 4 + +/* small technical note: it is not possible to call pthread_setspecific + * on keys that are <= TLS_SLOT_MAX_WELL_KNOWN, which is why it is set to + * TLS_SLOT_ERRNO. + * + * later slots like TLS_SLOT_OPENGL are pre-allocated through the use of + * TLS_DEFAULT_ALLOC_MAP. this means that there is no need to use + * pthread_key_create() to initialize them. on the other hand, there is + * no destructor associated to them (we might need to implement this later) + */ +#define TLS_SLOT_MAX_WELL_KNOWN TLS_SLOT_ERRNO + +#define TLS_DEFAULT_ALLOC_MAP 0x0000001F + +/* set the Thread Local Storage, must contain at least BIONIC_TLS_SLOTS pointers */ +extern void __init_tls(void** tls, void* thread_info); + +/* syscall only, do not call directly */ +extern int __set_tls(void *ptr); + +/* get the TLS */ +#ifdef __arm__ +# define __get_tls() ( *((volatile void **) 0xffff0ff0) ) +#else +extern void* __get_tls( void ); +#endif + +/* return the stack base and size, used by our malloc debugger */ +extern void* __get_stack_base(int *p_stack_size); + +__END_DECLS + +#endif /* _SYS_TLS_H */ diff --git a/libc/unistd/sysconf.c b/libc/unistd/sysconf.c index a19edbb..d3089a4 100644 --- a/libc/unistd/sysconf.c +++ b/libc/unistd/sysconf.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include /* for FOPEN_MAX */ #include -- cgit v1.1