diff --git a/libc/Android.mk b/libc/Android.mk index e28538bee..985c97718 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -152,34 +152,38 @@ libc_common_src_files := \ bionic/usleep.c \ bionic/utmp.c \ bionic/wcscoll.c \ - netbsd/gethnamaddr.c \ - netbsd/inet/nsap_addr.c \ - netbsd/resolv/__dn_comp.c \ - netbsd/resolv/__res_close.c \ - netbsd/resolv/__res_send.c \ - netbsd/resolv/herror.c \ - netbsd/resolv/res_comp.c \ - netbsd/resolv/res_data.c \ - netbsd/resolv/res_debug.c \ - netbsd/resolv/res_init.c \ - netbsd/resolv/res_mkquery.c \ - netbsd/resolv/res_query.c \ - netbsd/resolv/res_send.c \ - netbsd/resolv/res_state.c \ - netbsd/resolv/res_cache.c \ - netbsd/net/nsdispatch.c \ - netbsd/net/getaddrinfo.c \ - netbsd/net/getnameinfo.c \ - netbsd/net/getservbyname.c \ - netbsd/net/getservent.c \ - netbsd/net/base64.c \ - netbsd/net/getservbyport.c \ - netbsd/nameser/ns_name.c \ - netbsd/nameser/ns_parse.c \ - netbsd/nameser/ns_ttl.c \ - netbsd/nameser/ns_netint.c \ - netbsd/nameser/ns_print.c \ - netbsd/nameser/ns_samedomain.c \ + + +libc_dns_src_files += \ + netbsd/gethnamaddr.c \ + netbsd/inet/nsap_addr.c \ + netbsd/nameser/ns_name.c \ + netbsd/nameser/ns_netint.c \ + netbsd/nameser/ns_parse.c \ + netbsd/nameser/ns_print.c \ + netbsd/nameser/ns_samedomain.c \ + netbsd/nameser/ns_ttl.c \ + netbsd/net/base64.c \ + netbsd/net/getaddrinfo.c \ + netbsd/net/getnameinfo.c \ + netbsd/net/getservbyname.c \ + netbsd/net/getservbyport.c \ + netbsd/net/getservent.c \ + netbsd/net/nsdispatch.c \ + netbsd/resolv/__dn_comp.c \ + netbsd/resolv/herror.c \ + netbsd/resolv/res_cache.c \ + netbsd/resolv/__res_close.c \ + netbsd/resolv/res_comp.c \ + netbsd/resolv/res_data.c \ + netbsd/resolv/res_debug.c \ + netbsd/resolv/res_init.c \ + netbsd/resolv/res_mkquery.c \ + netbsd/resolv/res_query.c \ + netbsd/resolv/__res_send.c \ + netbsd/resolv/res_send.c \ + netbsd/resolv/res_state.c \ + # These are shared by all the 32-bit targets, but not the 64-bit ones. ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm mips x86)) @@ -256,6 +260,7 @@ libc_bionic_src_files := \ bionic/stubs.cpp \ bionic/sysconf.cpp \ bionic/tdestroy.cpp \ + bionic/__thread_entry.cpp \ bionic/tmpfile.cpp \ bionic/wait.cpp \ bionic/wchar.cpp \ @@ -506,10 +511,10 @@ libc_common_src_files += \ upstream-freebsd/lib/libc/string/wmemcmp.c \ libc_common_src_files += \ - bionic/pthread-atfork.c \ - bionic/pthread-rwlocks.c \ - bionic/pthread-timers.c \ - bionic/ptrace.c + bionic/pthread-atfork.c \ + bionic/pthread-rwlocks.c \ + bionic/pthread-timers.c \ + bionic/ptrace.c \ libc_static_common_src_files += \ bionic/pthread.c \ @@ -551,8 +556,8 @@ libc_common_additional_dependencies += \ $(LOCAL_PATH)/arch-$(TARGET_ARCH)/$(TARGET_ARCH).mk include $(LOCAL_PATH)/arch-$(TARGET_ARCH)/$(TARGET_ARCH).mk -libc_common_src_files += $(_LIBC_ARCH_COMMON_SRC_FILES) -libc_common_src_files += $(_LIBC_ARCH_CPU_VARIANT_SRC_FILES) +libc_bionic_src_files += $(_LIBC_ARCH_COMMON_SRC_FILES) +libc_bionic_src_files += $(_LIBC_ARCH_CPU_VARIANT_SRC_FILES) libc_arch_static_src_files := $(_LIBC_ARCH_STATIC_SRC_FILES) libc_arch_dynamic_src_files := $(_LIBC_ARCH_DYNAMIC_SRC_FILES) libc_common_additional_dependencies += $(_LIBC_ARCH_ADDITIONAL_DEPENDENCIES) @@ -562,9 +567,6 @@ libc_common_additional_dependencies += $(_LIBC_ARCH_ADDITIONAL_DEPENDENCIES) libc_common_cflags := \ -DANDROID_CHANGES \ -D_LIBC=1 \ - -DINET6 \ - -I$(LOCAL_PATH)/private \ - -DPOSIX_MISTAKE \ -Wall -Wextra \ # Try to catch typical 32-bit assumptions that break with 64-bit pointers. @@ -618,7 +620,8 @@ endif # crtbrand.c needs and a #define for the platform SDK version. libc_crt_target_cflags += \ -I$(LOCAL_PATH)/include \ - -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) + -I$(LOCAL_PATH)/arch-$(TARGET_ARCH)/include \ + -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) \ # Define some common conlyflags libc_common_conlyflags := \ @@ -636,12 +639,6 @@ libc_common_c_includes := \ $(LOCAL_PATH)/stdio \ external/safe-iop/include -# Needed to access private/__dso_handle.h from -# crtbegin_xxx.S and crtend_xxx.S -libc_crt_target_cflags += \ - -I$(LOCAL_PATH)/private \ - -I$(LOCAL_PATH)/arch-$(TARGET_ARCH)/include - # Define the libc run-time (crt) support object files that must be built, # which are needed to build all other objects (shared/static libs and # executables) @@ -810,6 +807,29 @@ LOCAL_SYSTEM_SHARED_LIBRARIES := include $(BUILD_STATIC_LIBRARY) +# ======================================================== +# libc_dns.a - modified NetBSD DNS code +# ======================================================== + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := $(libc_dns_src_files) +LOCAL_CFLAGS := \ + $(libc_common_cflags) \ + -DINET6 \ + -I$(LOCAL_PATH)/private \ + -I$(LOCAL_PATH)/upstream-netbsd/libc/include # for NetBSD private headers + +LOCAL_CONLYFLAGS := $(libc_common_conlyflags) +LOCAL_CPPFLAGS := $(libc_common_cppflags) +LOCAL_C_INCLUDES := $(libc_common_c_includes) +LOCAL_MODULE := libc_dns +LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) +LOCAL_SYSTEM_SHARED_LIBRARIES := + +include $(BUILD_STATIC_LIBRARY) + + # ======================================================== # libc_freebsd.a - upstream FreeBSD C library code # ======================================================== @@ -847,6 +867,7 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files) LOCAL_CFLAGS := \ $(libc_common_cflags) \ + -DPOSIX_MISTAKE \ -I$(LOCAL_PATH)/upstream-netbsd \ -I$(LOCAL_PATH)/upstream-netbsd/libc/include \ -include upstream-netbsd/netbsd-compat.h @@ -885,8 +906,7 @@ include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(libc_common_src_files) -LOCAL_CFLAGS := $(libc_common_cflags) \ - -I$(LOCAL_PATH)/upstream-netbsd/libc/include # for netbsd private headers +LOCAL_CFLAGS := $(libc_common_cflags) LOCAL_CONLYFLAGS := $(libc_common_conlyflags) LOCAL_CPPFLAGS := $(libc_common_cppflags) LOCAL_C_INCLUDES := $(libc_common_c_includes) @@ -895,9 +915,11 @@ LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) LOCAL_WHOLE_STATIC_LIBRARIES := \ libbionic_ssp \ libc_bionic \ + libc_dns \ libc_freebsd \ libc_netbsd \ - libc_tzcode + libc_tzcode \ + LOCAL_SYSTEM_SHARED_LIBRARIES := # TODO: split out the asflags. diff --git a/libc/arch-arm/bionic/atexit_legacy.c b/libc/arch-arm/bionic/atexit_legacy.c index f35c68d11..2162c37db 100644 --- a/libc/arch-arm/bionic/atexit_legacy.c +++ b/libc/arch-arm/bionic/atexit_legacy.c @@ -27,9 +27,10 @@ */ #include -#include #include +#include "private/libc_logging.h" + /* * This source file should only be included by libc.so, its purpose is * to support legacy ARM binaries by exporting a publicly visible diff --git a/libc/arch-arm/cortex-a15/bionic/__strcat_chk.S b/libc/arch-arm/cortex-a15/bionic/__strcat_chk.S index efa959560..51f858e65 100644 --- a/libc/arch-arm/cortex-a15/bionic/__strcat_chk.S +++ b/libc/arch-arm/cortex-a15/bionic/__strcat_chk.S @@ -27,7 +27,7 @@ */ #include -#include "libc_events.h" +#include "private/libc_events.h" .syntax unified diff --git a/libc/arch-arm/cortex-a15/bionic/__strcpy_chk.S b/libc/arch-arm/cortex-a15/bionic/__strcpy_chk.S index cd91dfc9f..782792ff9 100644 --- a/libc/arch-arm/cortex-a15/bionic/__strcpy_chk.S +++ b/libc/arch-arm/cortex-a15/bionic/__strcpy_chk.S @@ -27,7 +27,7 @@ */ #include -#include "libc_events.h" +#include "private/libc_events.h" .syntax unified diff --git a/libc/arch-arm/cortex-a15/bionic/memcpy.S b/libc/arch-arm/cortex-a15/bionic/memcpy.S index a1ef6f5b5..dae39c378 100644 --- a/libc/arch-arm/cortex-a15/bionic/memcpy.S +++ b/libc/arch-arm/cortex-a15/bionic/memcpy.S @@ -56,7 +56,7 @@ // Prototype: void *memcpy (void *dst, const void *src, size_t count). #include -#include "libc_events.h" +#include "private/libc_events.h" .text .syntax unified diff --git a/libc/arch-arm/cortex-a15/bionic/memset.S b/libc/arch-arm/cortex-a15/bionic/memset.S index 72e83cc76..8775ee8f8 100644 --- a/libc/arch-arm/cortex-a15/bionic/memset.S +++ b/libc/arch-arm/cortex-a15/bionic/memset.S @@ -28,7 +28,7 @@ #include #include -#include "libc_events.h" +#include "private/libc_events.h" /* * Optimized memset() for ARM. diff --git a/libc/arch-arm/cortex-a9/bionic/__strcat_chk.S b/libc/arch-arm/cortex-a9/bionic/__strcat_chk.S index daea34cf1..d6ae0f369 100644 --- a/libc/arch-arm/cortex-a9/bionic/__strcat_chk.S +++ b/libc/arch-arm/cortex-a9/bionic/__strcat_chk.S @@ -27,7 +27,7 @@ */ #include -#include "libc_events.h" +#include "private/libc_events.h" .syntax unified .fpu neon diff --git a/libc/arch-arm/cortex-a9/bionic/__strcpy_chk.S b/libc/arch-arm/cortex-a9/bionic/__strcpy_chk.S index d4e0c0aef..55926c1d8 100644 --- a/libc/arch-arm/cortex-a9/bionic/__strcpy_chk.S +++ b/libc/arch-arm/cortex-a9/bionic/__strcpy_chk.S @@ -27,7 +27,7 @@ */ #include -#include "libc_events.h" +#include "private/libc_events.h" .syntax unified .fpu neon diff --git a/libc/arch-arm/cortex-a9/bionic/memcpy.S b/libc/arch-arm/cortex-a9/bionic/memcpy.S index 9faea96fd..8904534ea 100644 --- a/libc/arch-arm/cortex-a9/bionic/memcpy.S +++ b/libc/arch-arm/cortex-a9/bionic/memcpy.S @@ -27,7 +27,7 @@ */ #include -#include "libc_events.h" +#include "private/libc_events.h" /* * This code assumes it is running on a processor that supports all arm v7 diff --git a/libc/arch-arm/cortex-a9/bionic/memset.S b/libc/arch-arm/cortex-a9/bionic/memset.S index 9609db93c..6eb2b4a3e 100644 --- a/libc/arch-arm/cortex-a9/bionic/memset.S +++ b/libc/arch-arm/cortex-a9/bionic/memset.S @@ -28,7 +28,7 @@ #include #include -#include "libc_events.h" +#include "private/libc_events.h" /* * This code assumes it is running on a processor that supports all arm v7 diff --git a/libc/arch-arm/generic/bionic/memcpy.S b/libc/arch-arm/generic/bionic/memcpy.S index c5168d6e2..5d55aae7c 100644 --- a/libc/arch-arm/generic/bionic/memcpy.S +++ b/libc/arch-arm/generic/bionic/memcpy.S @@ -28,7 +28,7 @@ #include #include -#include "libc_events.h" +#include "private/libc_events.h" /* * Optimized memcpy() for ARM. diff --git a/libc/arch-arm/generic/bionic/memset.S b/libc/arch-arm/generic/bionic/memset.S index 47dcedd70..435d83ced 100644 --- a/libc/arch-arm/generic/bionic/memset.S +++ b/libc/arch-arm/generic/bionic/memset.S @@ -27,7 +27,7 @@ */ #include -#include "libc_events.h" +#include "private/libc_events.h" /* * Optimized memset() for ARM. diff --git a/libc/arch-arm/krait/bionic/__strcat_chk.S b/libc/arch-arm/krait/bionic/__strcat_chk.S index 00fd01ea5..71115403d 100644 --- a/libc/arch-arm/krait/bionic/__strcat_chk.S +++ b/libc/arch-arm/krait/bionic/__strcat_chk.S @@ -27,7 +27,7 @@ */ #include -#include "libc_events.h" +#include "private/libc_events.h" .syntax unified diff --git a/libc/arch-arm/krait/bionic/__strcpy_chk.S b/libc/arch-arm/krait/bionic/__strcpy_chk.S index 3c802b513..f02a32d81 100644 --- a/libc/arch-arm/krait/bionic/__strcpy_chk.S +++ b/libc/arch-arm/krait/bionic/__strcpy_chk.S @@ -27,7 +27,7 @@ */ #include -#include "libc_events.h" +#include "private/libc_events.h" .syntax unified diff --git a/libc/arch-arm/krait/bionic/memcpy.S b/libc/arch-arm/krait/bionic/memcpy.S index 01eb58307..8204cbfef 100644 --- a/libc/arch-arm/krait/bionic/memcpy.S +++ b/libc/arch-arm/krait/bionic/memcpy.S @@ -29,7 +29,7 @@ /* Assumes neon instructions and a cache line size of 32 bytes. */ #include -#include "libc_events.h" +#include "private/libc_events.h" /* * This code assumes it is running on a processor that supports all arm v7 diff --git a/libc/arch-arm/krait/bionic/memset.S b/libc/arch-arm/krait/bionic/memset.S index 6595e1fc6..b5a9d78c4 100644 --- a/libc/arch-arm/krait/bionic/memset.S +++ b/libc/arch-arm/krait/bionic/memset.S @@ -28,7 +28,7 @@ #include #include -#include "libc_events.h" +#include "private/libc_events.h" /* * This code assumes it is running on a processor that supports all arm v7 diff --git a/libc/private/__dso_handle.h b/libc/arch-common/bionic/__dso_handle.h similarity index 100% rename from libc/private/__dso_handle.h rename to libc/arch-common/bionic/__dso_handle.h diff --git a/libc/private/__dso_handle_so.h b/libc/arch-common/bionic/__dso_handle_so.h similarity index 100% rename from libc/private/__dso_handle_so.h rename to libc/arch-common/bionic/__dso_handle_so.h diff --git a/libc/arch-common/bionic/crtbegin_so.c b/libc/arch-common/bionic/crtbegin_so.c index bd70edf38..641e45a4e 100644 --- a/libc/arch-common/bionic/crtbegin_so.c +++ b/libc/arch-common/bionic/crtbegin_so.c @@ -59,4 +59,3 @@ void __on_dlclose() { #ifdef __i386__ # include "../../arch-x86/bionic/__stack_chk_fail_local.h" #endif - diff --git a/libc/arch-mips/bionic/cacheflush.c b/libc/arch-mips/bionic/cacheflush.c index 97e67d4d2..2b03eee83 100644 --- a/libc/arch-mips/bionic/cacheflush.c +++ b/libc/arch-mips/bionic/cacheflush.c @@ -29,7 +29,7 @@ #include #ifdef DEBUG -#include +#include "private/libc_logging.h" #define XLOG(...) __libc_format_log(ANDROID_LOG_DEBUG,"libc-cacheflush",__VA_ARGS__) #endif diff --git a/libc/arch-mips/bionic/crtbegin.c b/libc/arch-mips/bionic/crtbegin.c index d3a3401be..28e8817f9 100644 --- a/libc/arch-mips/bionic/crtbegin.c +++ b/libc/arch-mips/bionic/crtbegin.c @@ -90,5 +90,5 @@ __asm__ ( " .set pop \n" ); -#include "__dso_handle.h" +#include "../../arch-common/bionic/__dso_handle.h" #include "atexit.h" diff --git a/libc/arch-mips/bionic/crtbegin_so.c b/libc/arch-mips/bionic/crtbegin_so.c index 925dc8c1a..d664ce64d 100644 --- a/libc/arch-mips/bionic/crtbegin_so.c +++ b/libc/arch-mips/bionic/crtbegin_so.c @@ -34,5 +34,5 @@ void __on_dlclose() { __cxa_finalize(&__dso_handle); } -#include "__dso_handle_so.h" +#include "../../arch-common/bionic/__dso_handle_so.h" #include "atexit.h" diff --git a/libc/bionic/__FD_chk.cpp b/libc/bionic/__FD_chk.cpp index 23d308475..5c2338d5f 100644 --- a/libc/bionic/__FD_chk.cpp +++ b/libc/bionic/__FD_chk.cpp @@ -28,7 +28,7 @@ #undef _FORTIFY_SOURCE #include -#include "libc_logging.h" +#include "private/libc_logging.h" extern "C" int __FD_ISSET_chk(int fd, fd_set* set, size_t set_size) { if (__predict_false(fd < 0)) { diff --git a/libc/bionic/__errno.cpp b/libc/bionic/__errno.cpp index 9caa61812..c9c1605f7 100644 --- a/libc/bionic/__errno.cpp +++ b/libc/bionic/__errno.cpp @@ -27,9 +27,10 @@ */ #include -#include #include +#include "private/bionic_tls.h" + volatile int* __errno() { return reinterpret_cast(&(__get_tls()[TLS_SLOT_ERRNO])); } diff --git a/libc/bionic/__fgets_chk.cpp b/libc/bionic/__fgets_chk.cpp index 7f6b0678a..fc903e474 100644 --- a/libc/bionic/__fgets_chk.cpp +++ b/libc/bionic/__fgets_chk.cpp @@ -28,7 +28,7 @@ #include #include -#include "libc_logging.h" +#include "private/libc_logging.h" /* * __fgets_chk. Called in place of fgets() when we know the diff --git a/libc/bionic/__memcpy_chk.cpp b/libc/bionic/__memcpy_chk.cpp index 2839795af..9416e49d9 100644 --- a/libc/bionic/__memcpy_chk.cpp +++ b/libc/bionic/__memcpy_chk.cpp @@ -29,7 +29,7 @@ #undef _FORTIFY_SOURCE #include #include -#include "libc_logging.h" +#include "private/libc_logging.h" /* * Runtime implementation of __memcpy_chk. diff --git a/libc/bionic/__memmove_chk.cpp b/libc/bionic/__memmove_chk.cpp index b653968f6..b52f7c882 100644 --- a/libc/bionic/__memmove_chk.cpp +++ b/libc/bionic/__memmove_chk.cpp @@ -28,7 +28,7 @@ #include #include -#include "libc_logging.h" +#include "private/libc_logging.h" /* * Runtime implementation of __builtin____memmove_chk. diff --git a/libc/bionic/__memset_chk.cpp b/libc/bionic/__memset_chk.cpp index 49a15484e..72551f0a1 100644 --- a/libc/bionic/__memset_chk.cpp +++ b/libc/bionic/__memset_chk.cpp @@ -28,7 +28,7 @@ #include #include -#include "libc_logging.h" +#include "private/libc_logging.h" /* * Runtime implementation of __builtin____memset_chk. diff --git a/libc/bionic/__recvfrom_chk.cpp b/libc/bionic/__recvfrom_chk.cpp index 0c042cc22..00de1d9bf 100644 --- a/libc/bionic/__recvfrom_chk.cpp +++ b/libc/bionic/__recvfrom_chk.cpp @@ -30,7 +30,7 @@ #include #include -#include "libc_logging.h" +#include "private/libc_logging.h" extern "C" ssize_t __recvfrom_chk(int socket, void* buf, size_t len, size_t buflen, unsigned int flags, diff --git a/libc/bionic/__stack_chk_fail.cpp b/libc/bionic/__stack_chk_fail.cpp index 8b9ed5e6c..6e052e3fa 100644 --- a/libc/bionic/__stack_chk_fail.cpp +++ b/libc/bionic/__stack_chk_fail.cpp @@ -28,8 +28,8 @@ #include -#include "bionic_ssp.h" -#include "libc_logging.h" +#include "private/bionic_ssp.h" +#include "private/libc_logging.h" void __stack_chk_fail() { __libc_fatal("stack corruption detected"); diff --git a/libc/bionic/__strcat_chk.cpp b/libc/bionic/__strcat_chk.cpp index 3dda43a5b..f15cb5cae 100644 --- a/libc/bionic/__strcat_chk.cpp +++ b/libc/bionic/__strcat_chk.cpp @@ -28,7 +28,7 @@ #include #include -#include "libc_logging.h" +#include "private/libc_logging.h" /* * Runtime implementation of __builtin____strcat_chk. diff --git a/libc/bionic/__strchr_chk.cpp b/libc/bionic/__strchr_chk.cpp index 3982d6018..51d35d0f8 100644 --- a/libc/bionic/__strchr_chk.cpp +++ b/libc/bionic/__strchr_chk.cpp @@ -28,7 +28,7 @@ */ #include -#include "libc_logging.h" +#include "private/libc_logging.h" extern "C" char* __strchr_chk(const char* p, int ch, size_t s_len) { for (;; ++p, s_len--) { diff --git a/libc/bionic/__strcpy_chk.cpp b/libc/bionic/__strcpy_chk.cpp index 41990f990..9b39627e9 100644 --- a/libc/bionic/__strcpy_chk.cpp +++ b/libc/bionic/__strcpy_chk.cpp @@ -28,7 +28,7 @@ #include #include -#include "libc_logging.h" +#include "private/libc_logging.h" /* * Runtime implementation of __builtin____strcpy_chk. diff --git a/libc/bionic/__strlcat_chk.cpp b/libc/bionic/__strlcat_chk.cpp index 32573c2e7..783dd8494 100644 --- a/libc/bionic/__strlcat_chk.cpp +++ b/libc/bionic/__strlcat_chk.cpp @@ -28,7 +28,7 @@ #include #include -#include "libc_logging.h" +#include "private/libc_logging.h" /* * __strlcat_chk. Called in place of strlcat() when we know the diff --git a/libc/bionic/__strlcpy_chk.cpp b/libc/bionic/__strlcpy_chk.cpp index 1e482e1b0..359e91832 100644 --- a/libc/bionic/__strlcpy_chk.cpp +++ b/libc/bionic/__strlcpy_chk.cpp @@ -28,7 +28,7 @@ #include #include -#include "libc_logging.h" +#include "private/libc_logging.h" /* * __strlcpy_chk. Called in place of strlcpy() when we know the diff --git a/libc/bionic/__strlen_chk.cpp b/libc/bionic/__strlen_chk.cpp index 494f7bf04..d4c5e43af 100644 --- a/libc/bionic/__strlen_chk.cpp +++ b/libc/bionic/__strlen_chk.cpp @@ -28,7 +28,7 @@ #include #include -#include "libc_logging.h" +#include "private/libc_logging.h" /* * Runtime implementation of __strlen_chk. diff --git a/libc/bionic/__strncat_chk.cpp b/libc/bionic/__strncat_chk.cpp index 296217e9e..cdb3c80f1 100644 --- a/libc/bionic/__strncat_chk.cpp +++ b/libc/bionic/__strncat_chk.cpp @@ -28,7 +28,7 @@ #include #include -#include "libc_logging.h" +#include "private/libc_logging.h" /* * Runtime implementation of __builtin____strncat_chk. diff --git a/libc/bionic/__strncpy_chk.cpp b/libc/bionic/__strncpy_chk.cpp index 5e72c2ccd..d0e90136a 100644 --- a/libc/bionic/__strncpy_chk.cpp +++ b/libc/bionic/__strncpy_chk.cpp @@ -28,7 +28,7 @@ #include #include -#include "libc_logging.h" +#include "private/libc_logging.h" /* * Runtime implementation of __builtin____strncpy_chk. diff --git a/libc/bionic/__strrchr_chk.cpp b/libc/bionic/__strrchr_chk.cpp index e6daf8ff7..fe56c9ad2 100644 --- a/libc/bionic/__strrchr_chk.cpp +++ b/libc/bionic/__strrchr_chk.cpp @@ -29,7 +29,7 @@ */ #include -#include "libc_logging.h" +#include "private/libc_logging.h" extern "C" char* __strrchr_chk(const char *p, int ch, size_t s_len) { diff --git a/libc/bionic/__thread_entry.cpp b/libc/bionic/__thread_entry.cpp new file mode 100644 index 000000000..8300a647d --- /dev/null +++ b/libc/bionic/__thread_entry.cpp @@ -0,0 +1,57 @@ +/* + * 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. + */ + +#include + +#include "pthread_internal.h" + +#include "private/bionic_tls.h" + +// This trampoline is called from the assembly _pthread_clone function. +// Our 'tls' and __pthread_clone's 'child_stack' are one and the same, just growing in +// opposite directions. +extern "C" void __thread_entry(void* (*func)(void*), void* arg, void** tls) { + // Wait for our creating thread to release us. This lets it have time to + // notify gdb about this thread before we start doing anything. + // This also provides the memory barrier needed to ensure that all memory + // accesses previously made by the creating thread are visible to us. + pthread_mutex_t* start_mutex = (pthread_mutex_t*) &tls[TLS_SLOT_SELF]; + pthread_mutex_lock(start_mutex); + pthread_mutex_destroy(start_mutex); + + pthread_internal_t* thread = (pthread_internal_t*) tls[TLS_SLOT_THREAD_ID]; + thread->tls = tls; + __init_tls(thread); + + if ((thread->internal_flags & PTHREAD_INTERNAL_FLAG_THREAD_INIT_FAILED) != 0) { + pthread_exit(NULL); + } + + void* result = func(arg); + pthread_exit(result); +} diff --git a/libc/bionic/__umask_chk.cpp b/libc/bionic/__umask_chk.cpp index 8fe95a28a..7d2a99a23 100644 --- a/libc/bionic/__umask_chk.cpp +++ b/libc/bionic/__umask_chk.cpp @@ -30,9 +30,10 @@ #include #include -#include "libc_logging.h" #include +#include "private/libc_logging.h" + /* * Runtime implementation of __umask_chk. * diff --git a/libc/bionic/__vsnprintf_chk.cpp b/libc/bionic/__vsnprintf_chk.cpp index 257cf5e72..a03d12fb6 100644 --- a/libc/bionic/__vsnprintf_chk.cpp +++ b/libc/bionic/__vsnprintf_chk.cpp @@ -29,7 +29,7 @@ #include #include #include -#include "libc_logging.h" +#include "private/libc_logging.h" /* * Runtime implementation of __builtin____vsnprintf_chk. diff --git a/libc/bionic/__vsprintf_chk.cpp b/libc/bionic/__vsprintf_chk.cpp index 290de9b8f..3810694f0 100644 --- a/libc/bionic/__vsprintf_chk.cpp +++ b/libc/bionic/__vsprintf_chk.cpp @@ -29,7 +29,7 @@ #include #include #include -#include "libc_logging.h" +#include "private/libc_logging.h" /* * Runtime implementation of __builtin____vsprintf_chk. diff --git a/libc/bionic/arc4random.c b/libc/bionic/arc4random.c index d70580aff..eac4b0c6d 100644 --- a/libc/bionic/arc4random.c +++ b/libc/bionic/arc4random.c @@ -41,7 +41,7 @@ #include #include #include -#include "thread_private.h" +#include "private/thread_private.h" /* BIONIC-BEGIN */ /* this lock should protect the global variables in this file */ diff --git a/libc/bionic/assert.cpp b/libc/bionic/assert.cpp index 84024c7c2..ba6714323 100644 --- a/libc/bionic/assert.cpp +++ b/libc/bionic/assert.cpp @@ -30,7 +30,7 @@ #include -#include "libc_logging.h" +#include "private/libc_logging.h" void __assert(const char* file, int line, const char* failed_expression) { __libc_fatal("%s:%d: assertion \"%s\" failed", file, line, failed_expression); diff --git a/libc/private/cpuacct.h b/libc/bionic/cpuacct.h similarity index 100% rename from libc/private/cpuacct.h rename to libc/bionic/cpuacct.h diff --git a/libc/bionic/debug_stacktrace.cpp b/libc/bionic/debug_stacktrace.cpp index 26d5c6a15..5ddc00c69 100644 --- a/libc/bionic/debug_stacktrace.cpp +++ b/libc/bionic/debug_stacktrace.cpp @@ -35,7 +35,7 @@ #include #include "debug_mapinfo.h" -#include "libc_logging.h" +#include "private/libc_logging.h" /* depends how the system includes define this */ #ifdef HAVE_UNWIND_CONTEXT_STRUCT diff --git a/libc/bionic/fork.c b/libc/bionic/fork.c index d83c535ad..d30b41b1d 100644 --- a/libc/bionic/fork.c +++ b/libc/bionic/fork.c @@ -27,9 +27,10 @@ */ #include #include "pthread_internal.h" -#include "bionic_pthread.h" #include "cpuacct.h" +#include "private/bionic_pthread.h" + extern int __fork(void); int fork(void) diff --git a/libc/bionic/libc_init_common.cpp b/libc/bionic/libc_init_common.cpp index 714d0bc64..479cadf34 100644 --- a/libc/bionic/libc_init_common.cpp +++ b/libc/bionic/libc_init_common.cpp @@ -28,8 +28,6 @@ #include "libc_init_common.h" -#include -#include #include #include #include @@ -44,6 +42,7 @@ #include "atexit.h" #include "private/bionic_auxv.h" #include "private/bionic_ssp.h" +#include "private/bionic_tls.h" #include "private/KernelArgumentBlock.h" #include "pthread_internal.h" @@ -57,7 +56,7 @@ const char* __progname; // Declared in . char** environ; -// Declared in . +// Declared in "private/bionic_ssp.h". uintptr_t __stack_chk_guard = 0; static size_t get_main_thread_stack_size() { diff --git a/libc/bionic/libc_init_dynamic.cpp b/libc/bionic/libc_init_dynamic.cpp index 4e1374e3c..61fb887d6 100644 --- a/libc/bionic/libc_init_dynamic.cpp +++ b/libc/bionic/libc_init_dynamic.cpp @@ -49,9 +49,10 @@ #include #include #include "atexit.h" -#include "KernelArgumentBlock.h" #include "libc_init_common.h" -#include + +#include "private/bionic_tls.h" +#include "private/KernelArgumentBlock.h" extern "C" { extern void pthread_debug_init(void); diff --git a/libc/bionic/libc_init_static.cpp b/libc/bionic/libc_init_static.cpp index a60e41480..1825167bd 100644 --- a/libc/bionic/libc_init_static.cpp +++ b/libc/bionic/libc_init_static.cpp @@ -47,11 +47,12 @@ #include #include "atexit.h" -#include "bionic_tls.h" -#include "KernelArgumentBlock.h" #include "libc_init_common.h" #include "pthread_internal.h" +#include "private/bionic_tls.h" +#include "private/KernelArgumentBlock.h" + // Returns the address of the page containing address 'x'. #define PAGE_START(x) ((x) & PAGE_MASK) diff --git a/libc/bionic/libc_logging.cpp b/libc/bionic/libc_logging.cpp index 635f8d11a..c7eca8aa3 100644 --- a/libc/bionic/libc_logging.cpp +++ b/libc/bionic/libc_logging.cpp @@ -26,8 +26,8 @@ * SUCH DAMAGE. */ -#include <../private/libc_logging.h> // Relative path so we can #include this .cpp file for testing. -#include <../private/ScopedPthreadMutexLocker.h> +#include "../private/libc_logging.h" // Relative path so we can #include this .cpp file for testing. +#include "../private/ScopedPthreadMutexLocker.h" #include #include diff --git a/libc/bionic/libgen.cpp b/libc/bionic/libgen.cpp index f7181e7e1..d8df494dc 100644 --- a/libc/bionic/libgen.cpp +++ b/libc/bionic/libgen.cpp @@ -34,7 +34,7 @@ #include #include -#include "ThreadLocalBuffer.h" +#include "private/ThreadLocalBuffer.h" GLOBAL_INIT_THREAD_LOCAL_BUFFER(basename); GLOBAL_INIT_THREAD_LOCAL_BUFFER(dirname); diff --git a/libc/bionic/malloc_debug_check.cpp b/libc/bionic/malloc_debug_check.cpp index a5d49cb27..7dd8e3c96 100644 --- a/libc/bionic/malloc_debug_check.cpp +++ b/libc/bionic/malloc_debug_check.cpp @@ -48,9 +48,9 @@ #include "debug_mapinfo.h" #include "debug_stacktrace.h" #include "dlmalloc.h" -#include "libc_logging.h" +#include "private/libc_logging.h" #include "malloc_debug_common.h" -#include "ScopedPthreadMutexLocker.h" +#include "private/ScopedPthreadMutexLocker.h" /* libc.debug.malloc.backlog */ extern unsigned int gMallocDebugBacklog; diff --git a/libc/bionic/malloc_debug_common.cpp b/libc/bionic/malloc_debug_common.cpp index e33405e7b..85f779194 100644 --- a/libc/bionic/malloc_debug_common.cpp +++ b/libc/bionic/malloc_debug_common.cpp @@ -47,7 +47,7 @@ #include #include "dlmalloc.h" -#include "ScopedPthreadMutexLocker.h" +#include "private/ScopedPthreadMutexLocker.h" /* * In a VM process, this is set to 1 after fork()ing out of zygote. @@ -250,7 +250,7 @@ extern "C" size_t malloc_usable_size(const void* mem) { #include #include #include -#include "libc_logging.h" +#include "private/libc_logging.h" /* Table for dispatching malloc calls, depending on environment. */ static MallocDebug gMallocUse __attribute__((aligned(32))) = { diff --git a/libc/bionic/malloc_debug_common.h b/libc/bionic/malloc_debug_common.h index a3f9909de..28be0427e 100644 --- a/libc/bionic/malloc_debug_common.h +++ b/libc/bionic/malloc_debug_common.h @@ -35,7 +35,7 @@ #include -#include "libc_logging.h" +#include "private/libc_logging.h" #define HASHTABLE_SIZE 1543 #define BACKTRACE_SIZE 32 diff --git a/libc/bionic/malloc_debug_leak.cpp b/libc/bionic/malloc_debug_leak.cpp index 45b45c256..3397def5f 100644 --- a/libc/bionic/malloc_debug_leak.cpp +++ b/libc/bionic/malloc_debug_leak.cpp @@ -47,9 +47,10 @@ #include "debug_stacktrace.h" #include "dlmalloc.h" -#include "libc_logging.h" #include "malloc_debug_common.h" -#include "ScopedPthreadMutexLocker.h" + +#include "private/libc_logging.h" +#include "private/ScopedPthreadMutexLocker.h" // This file should be included into the build only when // MALLOC_LEAK_CHECK, or MALLOC_QEMU_INSTRUMENT, or both diff --git a/libc/bionic/malloc_debug_qemu.cpp b/libc/bionic/malloc_debug_qemu.cpp index 4d000664f..5a91daa0d 100644 --- a/libc/bionic/malloc_debug_qemu.cpp +++ b/libc/bionic/malloc_debug_qemu.cpp @@ -51,7 +51,7 @@ #include #include #include "dlmalloc.h" -#include "libc_logging.h" +#include "private/libc_logging.h" #include "malloc_debug_common.h" /* This file should be included into the build only when diff --git a/libc/bionic/open.c b/libc/bionic/open.c index 424573f94..cde3029c1 100644 --- a/libc/bionic/open.c +++ b/libc/bionic/open.c @@ -29,7 +29,7 @@ #include #include #include -#include "libc_logging.h" +#include "private/libc_logging.h" extern int __open(const char*, int, int); diff --git a/libc/bionic/openat.c b/libc/bionic/openat.c index 2d09d17fc..b8c887eb9 100644 --- a/libc/bionic/openat.c +++ b/libc/bionic/openat.c @@ -29,7 +29,7 @@ #include #include #include -#include "libc_logging.h" +#include "private/libc_logging.h" extern int __openat(int, const char*, int, int); diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c index ab806c0dc..32812b4c9 100644 --- a/libc/bionic/pthread.c +++ b/libc/bionic/pthread.c @@ -34,12 +34,13 @@ #include #include -#include "bionic_atomic_inline.h" -#include "bionic_futex.h" -#include "bionic_pthread.h" -#include "bionic_tls.h" #include "pthread_internal.h" -#include "thread_private.h" + +#include "private/bionic_atomic_inline.h" +#include "private/bionic_futex.h" +#include "private/bionic_pthread.h" +#include "private/bionic_tls.h" +#include "private/thread_private.h" extern void pthread_debug_mutex_lock_check(pthread_mutex_t *mutex); extern void pthread_debug_mutex_unlock_check(pthread_mutex_t *mutex); diff --git a/libc/bionic/pthread_create.cpp b/libc/bionic/pthread_create.cpp index 9e06afc9e..8338ad577 100644 --- a/libc/bionic/pthread_create.cpp +++ b/libc/bionic/pthread_create.cpp @@ -52,8 +52,6 @@ extern "C" void ATTRIBUTES _thread_created_hook(pid_t thread_id); extern "C" int __set_tls(void* ptr); -static const int kPthreadInitFailed = 1; - static pthread_mutex_t gPthreadStackCreationLock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t gDebuggerNotificationLock = PTHREAD_MUTEX_INITIALIZER; @@ -84,30 +82,6 @@ void __init_tls(pthread_internal_t* thread) { } } -// This trampoline is called from the assembly _pthread_clone function. -// Our 'tls' and __pthread_clone's 'child_stack' are one and the same, just growing in -// opposite directions. -extern "C" void __thread_entry(void* (*func)(void*), void* arg, void** tls) { - // Wait for our creating thread to release us. This lets it have time to - // notify gdb about this thread before we start doing anything. - // This also provides the memory barrier needed to ensure that all memory - // accesses previously made by the creating thread are visible to us. - pthread_mutex_t* start_mutex = (pthread_mutex_t*) &tls[TLS_SLOT_SELF]; - pthread_mutex_lock(start_mutex); - pthread_mutex_destroy(start_mutex); - - pthread_internal_t* thread = (pthread_internal_t*) tls[TLS_SLOT_THREAD_ID]; - thread->tls = tls; - __init_tls(thread); - - if ((thread->internal_flags & kPthreadInitFailed) != 0) { - pthread_exit(NULL); - } - - void* result = func(arg); - pthread_exit(result); -} - __LIBC_ABI_PRIVATE__ int _init_thread(pthread_internal_t* thread, bool add_to_thread_list) { int error = 0; @@ -240,7 +214,7 @@ int pthread_create(pthread_t* thread_out, pthread_attr_t const* attr, if (init_errno != 0) { // Mark the thread detached and let its __thread_entry run to // completion. (It'll just exit immediately, cleaning up its resources.) - thread->internal_flags |= kPthreadInitFailed; + thread->internal_flags |= PTHREAD_INTERNAL_FLAG_THREAD_INIT_FAILED; thread->attr.flags |= PTHREAD_ATTR_FLAG_DETACHED; return init_errno; } diff --git a/libc/bionic/pthread_debug.cpp b/libc/bionic/pthread_debug.cpp index 94c23de35..79a193d6c 100644 --- a/libc/bionic/pthread_debug.cpp +++ b/libc/bionic/pthread_debug.cpp @@ -31,7 +31,6 @@ #include #include -//#include #include #include #include @@ -40,10 +39,10 @@ #include #include -#include "bionic_tls.h" +#include "private/bionic_tls.h" #include "debug_mapinfo.h" #include "debug_stacktrace.h" -#include "libc_logging.h" +#include "private/libc_logging.h" /* * =========================================================================== diff --git a/libc/bionic/pthread_getschedparam.cpp b/libc/bionic/pthread_getschedparam.cpp index 03fa5f2d4..2cdc11a4c 100644 --- a/libc/bionic/pthread_getschedparam.cpp +++ b/libc/bionic/pthread_getschedparam.cpp @@ -28,7 +28,7 @@ #include -#include "ErrnoRestorer.h" +#include "private/ErrnoRestorer.h" #include "pthread_accessor.h" int pthread_getschedparam(pthread_t t, int* policy, sched_param* param) { diff --git a/libc/bionic/pthread_internal.h b/libc/bionic/pthread_internal.h index 6fe2a9839..6b009d449 100644 --- a/libc/bionic/pthread_internal.h +++ b/libc/bionic/pthread_internal.h @@ -77,6 +77,8 @@ __LIBC_HIDDEN__ void _pthread_internal_remove_locked(pthread_internal_t* thread) /* Has the thread already exited but not been joined? */ #define PTHREAD_ATTR_FLAG_ZOMBIE 0x00000008 +#define PTHREAD_INTERNAL_FLAG_THREAD_INIT_FAILED 1 + /* * Traditionally we give threads a 1MiB stack. When we started * allocating per-thread alternate signal stacks to ease debugging of diff --git a/libc/bionic/pthread_internals.cpp b/libc/bionic/pthread_internals.cpp index 59c6e4819..01ecd5f6b 100644 --- a/libc/bionic/pthread_internals.cpp +++ b/libc/bionic/pthread_internals.cpp @@ -28,8 +28,8 @@ #include "pthread_internal.h" -#include "bionic_tls.h" -#include "ScopedPthreadMutexLocker.h" +#include "private/bionic_tls.h" +#include "private/ScopedPthreadMutexLocker.h" __LIBC_HIDDEN__ pthread_internal_t* gThreadList = NULL; __LIBC_HIDDEN__ pthread_mutex_t gThreadListLock = PTHREAD_MUTEX_INITIALIZER; diff --git a/libc/bionic/pthread_key.cpp b/libc/bionic/pthread_key.cpp index 706758b58..440a715e5 100644 --- a/libc/bionic/pthread_key.cpp +++ b/libc/bionic/pthread_key.cpp @@ -28,7 +28,7 @@ #include -#include "bionic_tls.h" +#include "private/bionic_tls.h" #include "pthread_internal.h" /* A technical note regarding our thread-local-storage (TLS) implementation: diff --git a/libc/bionic/pthread_kill.cpp b/libc/bionic/pthread_kill.cpp index 54f71ee52..163317efc 100644 --- a/libc/bionic/pthread_kill.cpp +++ b/libc/bionic/pthread_kill.cpp @@ -29,7 +29,7 @@ #include #include -#include "ErrnoRestorer.h" +#include "private/ErrnoRestorer.h" #include "pthread_accessor.h" extern "C" int tgkill(int tgid, int tid, int sig); diff --git a/libc/bionic/pthread_setschedparam.cpp b/libc/bionic/pthread_setschedparam.cpp index c383cca18..55ec79180 100644 --- a/libc/bionic/pthread_setschedparam.cpp +++ b/libc/bionic/pthread_setschedparam.cpp @@ -28,7 +28,7 @@ #include -#include "ErrnoRestorer.h" +#include "private/ErrnoRestorer.h" #include "pthread_accessor.h" int pthread_setschedparam(pthread_t t, int policy, struct sched_param const* param) { diff --git a/libc/bionic/semaphore.c b/libc/bionic/semaphore.c index 9bc8412fc..28fcb1b35 100644 --- a/libc/bionic/semaphore.c +++ b/libc/bionic/semaphore.c @@ -30,10 +30,11 @@ #include #include #include -#include -#include #include +#include "private/bionic_atomic_inline.h" +#include "private/bionic_futex.h" + /* In this implementation, a semaphore contains a * 31-bit signed value and a 1-bit 'shared' flag * (for process-sharing purpose). diff --git a/libc/bionic/strerror.cpp b/libc/bionic/strerror.cpp index a50c99fe8..d1518ffc4 100644 --- a/libc/bionic/strerror.cpp +++ b/libc/bionic/strerror.cpp @@ -27,7 +27,7 @@ */ #include -#include "ThreadLocalBuffer.h" +#include "private/ThreadLocalBuffer.h" extern "C" const char* __strerror_lookup(int); diff --git a/libc/bionic/strsignal.cpp b/libc/bionic/strsignal.cpp index c549e74ce..9f0193acf 100644 --- a/libc/bionic/strsignal.cpp +++ b/libc/bionic/strsignal.cpp @@ -27,7 +27,7 @@ */ #include -#include "ThreadLocalBuffer.h" +#include "private/ThreadLocalBuffer.h" extern "C" const char* __strsignal_lookup(int); extern "C" const char* __strsignal(int, char*, size_t); diff --git a/libc/bionic/sysconf.cpp b/libc/bionic/sysconf.cpp index e945fbf27..db808c21f 100644 --- a/libc/bionic/sysconf.cpp +++ b/libc/bionic/sysconf.cpp @@ -26,8 +26,6 @@ * SUCH DAMAGE. */ -#include -#include #include #include #include @@ -40,6 +38,7 @@ #include #include +#include "private/bionic_tls.h" #include "private/ScopedReaddir.h" /* seems to be the default on Linux, per the GLibc sources and my own digging */ diff --git a/libc/bionic/system_properties.c b/libc/bionic/system_properties.c index fd5643145..9fdb6f5e2 100644 --- a/libc/bionic/system_properties.c +++ b/libc/bionic/system_properties.c @@ -50,7 +50,8 @@ #include #include -#include + +#include "private/bionic_atomic_inline.h" #define ALIGN(x, a) (((x) + (a - 1)) & ~(a - 1)) diff --git a/libc/netbsd/resolv/res_cache.c b/libc/netbsd/resolv/res_cache.c index 8a6dc83ac..1b32c597c 100644 --- a/libc/netbsd/resolv/res_cache.c +++ b/libc/netbsd/resolv/res_cache.c @@ -171,7 +171,7 @@ #undef XLOG #if DEBUG -# include "libc_logging.h" +# include "private/libc_logging.h" # define XLOG(...) __libc_format_log(ANDROID_LOG_DEBUG,"libc",__VA_ARGS__) #include diff --git a/libc/netbsd/resolv/res_send.c b/libc/netbsd/resolv/res_send.c index f65b01584..e587bdc81 100644 --- a/libc/netbsd/resolv/res_send.c +++ b/libc/netbsd/resolv/res_send.c @@ -119,7 +119,7 @@ __RCSID("$NetBSD: res_send.c,v 1.9 2006/01/24 17:41:25 christos Exp $"); # include #endif -#include "libc_logging.h" +#include "private/libc_logging.h" #ifndef DE_CONST #define DE_CONST(c,v) v = ((c) ? \ diff --git a/libc/netbsd/resolv/res_state.c b/libc/netbsd/resolv/res_state.c index de82e1a54..f5d01a1f4 100644 --- a/libc/netbsd/resolv/res_state.c +++ b/libc/netbsd/resolv/res_state.c @@ -42,7 +42,7 @@ #define DEBUG 0 #if DEBUG -# include "libc_logging.h" +# include "private/libc_logging.h" # include /* for gettid() */ # define D(...) __libc_format_log(ANDROID_LOG_DEBUG,"libc", __VA_ARGS__) #else diff --git a/libc/private/arpa_nameser.h b/libc/private/arpa_nameser.h index 81195b526..421c3eea8 100644 --- a/libc/private/arpa_nameser.h +++ b/libc/private/arpa_nameser.h @@ -567,7 +567,7 @@ __END_DECLS #endif #if 0 -# include "libc_logging.h" +# include "private/libc_logging.h" # define XLOG(...) __libc_format_log(ANDROID_LOG_DEBUG,"libc",__VA_ARGS__) #else #define XLOG(...) do {} while (0) diff --git a/libc/private/syscommon.h b/libc/private/syscommon.h deleted file mode 100644 index 429025279..000000000 --- a/libc/private/syscommon.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * syscommon.h - * - * Common header file for system call stubs - */ - -#define __IN_SYS_COMMON -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __i386__ -# include -#endif diff --git a/libc/stdio/findfp.c b/libc/stdio/findfp.c index 863235bf2..943c90a5f 100644 --- a/libc/stdio/findfp.c +++ b/libc/stdio/findfp.c @@ -39,7 +39,7 @@ #include #include "local.h" #include "glue.h" -#include "thread_private.h" +#include "private/thread_private.h" int __sdidinit; diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c index 8f5bd2dd3..4e14434d6 100644 --- a/libc/stdlib/atexit.c +++ b/libc/stdlib/atexit.c @@ -35,7 +35,7 @@ #include #include #include "atexit.h" -#include "thread_private.h" +#include "private/thread_private.h" int __atexit_invalid = 1; struct atexit *__atexit; diff --git a/libc/private/ctype_private.h b/libc/stdlib/ctype_private.h similarity index 100% rename from libc/private/ctype_private.h rename to libc/stdlib/ctype_private.h diff --git a/libc/stdlib/exit.c b/libc/stdlib/exit.c index 83fe3d2de..923e42ec1 100644 --- a/libc/stdlib/exit.c +++ b/libc/stdlib/exit.c @@ -33,7 +33,7 @@ #include #include #include "atexit.h" -#include "thread_private.h" +#include "private/thread_private.h" /* * This variable is zero until a process has created a thread. diff --git a/libc/tzcode/strftime.c b/libc/tzcode/strftime.c index 1b223e5fb..1164a13be 100644 --- a/libc/tzcode/strftime.c +++ b/libc/tzcode/strftime.c @@ -38,7 +38,7 @@ static const char sccsid[] = "@(#)strftime.c 5.4 (Berkeley) 3/14/89"; #include "locale.h" #include #include -#include /* for strftime_tz */ +#include "private/bionic_time.h" /* for strftime_tz */ /* struct lc_time_T is now defined as strftime_locale * in diff --git a/libc/upstream-netbsd/port_before.h b/libc/upstream-netbsd/port_before.h index 9f77f79ea..5e06e52d0 100644 --- a/libc/upstream-netbsd/port_before.h +++ b/libc/upstream-netbsd/port_before.h @@ -19,7 +19,7 @@ #include "namespace.h" #include -#include +#include "private/arpa_nameser.h" #define ISC_FORMAT_PRINTF(a,b) __printflike(a,b) #define ISC_SOCKLEN_T socklen_t diff --git a/libc/private/rand48.h b/libc/upstream-netbsd/rand48.h similarity index 100% rename from libc/private/rand48.h rename to libc/upstream-netbsd/rand48.h diff --git a/libstdc++/src/one_time_construction.cpp b/libstdc++/src/one_time_construction.cpp index 8ba18df2b..55743111b 100644 --- a/libstdc++/src/one_time_construction.cpp +++ b/libstdc++/src/one_time_construction.cpp @@ -5,8 +5,9 @@ #include #include #include -#include -#include + +#include "private/bionic_atomic_inline.h" +#include "private/bionic_futex.h" // This file contains C++ ABI support functions for one time // constructors as defined in the "Run-time ABI for the ARM Architecture" diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp index 3553af7d8..d234787be 100644 --- a/linker/dlfcn.cpp +++ b/linker/dlfcn.cpp @@ -22,9 +22,9 @@ #include #include -#include -#include -#include +#include "private/bionic_tls.h" +#include "private/ScopedPthreadMutexLocker.h" +#include "private/ThreadLocalBuffer.h" /* This file hijacks the symbols stubbed out in libdl.so. */ diff --git a/linker/linker.cpp b/linker/linker.cpp index 8f613b1ae..cabbb99f1 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -40,9 +40,9 @@ #include // Private C library headers. -#include -#include -#include +#include "private/bionic_tls.h" +#include "private/KernelArgumentBlock.h" +#include "private/ScopedPthreadMutexLocker.h" #include "linker.h" #include "linker_debug.h" diff --git a/linker/linker_environ.cpp b/linker/linker_environ.cpp index edc659a03..846624b9a 100644 --- a/linker/linker_environ.cpp +++ b/linker/linker_environ.cpp @@ -33,7 +33,7 @@ #include #include -#include +#include "private/KernelArgumentBlock.h" static char** _envp; static bool _AT_SECURE_value = true;