summaryrefslogtreecommitdiffstats
path: root/libc/bionic
diff options
context:
space:
mode:
Diffstat (limited to 'libc/bionic')
-rw-r--r--libc/bionic/__fgets_chk.cpp2
-rw-r--r--libc/bionic/__memcpy_chk.cpp2
-rw-r--r--libc/bionic/__memmove_chk.cpp2
-rw-r--r--libc/bionic/__memset_chk.cpp2
-rw-r--r--libc/bionic/__stack_chk_fail.cpp3
-rw-r--r--libc/bionic/__strcat_chk.cpp2
-rw-r--r--libc/bionic/__strcpy_chk.cpp2
-rw-r--r--libc/bionic/__strlcat_chk.cpp2
-rw-r--r--libc/bionic/__strlcpy_chk.cpp2
-rw-r--r--libc/bionic/__strlen_chk.cpp2
-rw-r--r--libc/bionic/__strncat_chk.cpp2
-rw-r--r--libc/bionic/__strncpy_chk.cpp2
-rw-r--r--libc/bionic/__umask_chk.cpp2
-rw-r--r--libc/bionic/__vsnprintf_chk.cpp2
-rw-r--r--libc/bionic/__vsprintf_chk.cpp2
-rw-r--r--libc/bionic/assert.cpp3
-rw-r--r--libc/bionic/debug_stacktrace.cpp3
-rw-r--r--libc/bionic/dlmalloc.c3
-rw-r--r--libc/bionic/libc_logging.cpp (renamed from libc/bionic/debug_format.cpp)76
-rw-r--r--libc/bionic/logd_write.c255
-rw-r--r--libc/bionic/malloc_debug_check.cpp2
-rw-r--r--libc/bionic/malloc_debug_common.cpp2
-rw-r--r--libc/bionic/malloc_debug_common.h2
-rw-r--r--libc/bionic/malloc_debug_leak.cpp2
-rw-r--r--libc/bionic/malloc_debug_qemu.cpp2
-rw-r--r--libc/bionic/open.c3
-rw-r--r--libc/bionic/openat.c3
-rw-r--r--libc/bionic/pthread_create.cpp3
-rw-r--r--libc/bionic/pthread_debug.cpp4
-rw-r--r--libc/bionic/stubs.cpp3
30 files changed, 88 insertions, 309 deletions
diff --git a/libc/bionic/__fgets_chk.cpp b/libc/bionic/__fgets_chk.cpp
index 6ae97cc..429eda5 100644
--- a/libc/bionic/__fgets_chk.cpp
+++ b/libc/bionic/__fgets_chk.cpp
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <private/logd.h>
+#include "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 7a98cb7..b36cfdd 100644
--- a/libc/bionic/__memcpy_chk.cpp
+++ b/libc/bionic/__memcpy_chk.cpp
@@ -29,7 +29,7 @@
#undef _FORTIFY_SOURCE
#include <string.h>
#include <stdlib.h>
-#include <private/logd.h>
+#include "libc_logging.h"
/*
* Runtime implementation of __memcpy_chk.
diff --git a/libc/bionic/__memmove_chk.cpp b/libc/bionic/__memmove_chk.cpp
index 51f2e1c..ff770b5 100644
--- a/libc/bionic/__memmove_chk.cpp
+++ b/libc/bionic/__memmove_chk.cpp
@@ -28,7 +28,7 @@
#include <string.h>
#include <stdlib.h>
-#include <private/logd.h>
+#include "libc_logging.h"
/*
* Runtime implementation of __builtin____memmove_chk.
diff --git a/libc/bionic/__memset_chk.cpp b/libc/bionic/__memset_chk.cpp
index 99a12ad..b201ed2 100644
--- a/libc/bionic/__memset_chk.cpp
+++ b/libc/bionic/__memset_chk.cpp
@@ -28,7 +28,7 @@
#include <string.h>
#include <stdlib.h>
-#include <private/logd.h>
+#include "libc_logging.h"
/*
* Runtime implementation of __builtin____memset_chk.
diff --git a/libc/bionic/__stack_chk_fail.cpp b/libc/bionic/__stack_chk_fail.cpp
index cae66b1..d5031ac 100644
--- a/libc/bionic/__stack_chk_fail.cpp
+++ b/libc/bionic/__stack_chk_fail.cpp
@@ -29,8 +29,7 @@
#include <stdlib.h>
#include "bionic_ssp.h"
-#include "debug_format.h"
-#include "logd.h"
+#include "libc_logging.h"
void __stack_chk_fail() {
__libc_format_log(ANDROID_LOG_FATAL, "libc", "stack corruption detected");
diff --git a/libc/bionic/__strcat_chk.cpp b/libc/bionic/__strcat_chk.cpp
index 2450da6..fb46e0d 100644
--- a/libc/bionic/__strcat_chk.cpp
+++ b/libc/bionic/__strcat_chk.cpp
@@ -28,7 +28,7 @@
#include <string.h>
#include <stdlib.h>
-#include <private/logd.h>
+#include "libc_logging.h"
#include <safe_iop.h>
/*
diff --git a/libc/bionic/__strcpy_chk.cpp b/libc/bionic/__strcpy_chk.cpp
index 74ceda1..bfb6642 100644
--- a/libc/bionic/__strcpy_chk.cpp
+++ b/libc/bionic/__strcpy_chk.cpp
@@ -28,7 +28,7 @@
#include <string.h>
#include <stdlib.h>
-#include <private/logd.h>
+#include "libc_logging.h"
/*
* Runtime implementation of __builtin____strcpy_chk.
diff --git a/libc/bionic/__strlcat_chk.cpp b/libc/bionic/__strlcat_chk.cpp
index 12676f4..96f62f9 100644
--- a/libc/bionic/__strlcat_chk.cpp
+++ b/libc/bionic/__strlcat_chk.cpp
@@ -28,7 +28,7 @@
#include <string.h>
#include <stdlib.h>
-#include <private/logd.h>
+#include "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 62fa14b..636966b 100644
--- a/libc/bionic/__strlcpy_chk.cpp
+++ b/libc/bionic/__strlcpy_chk.cpp
@@ -28,7 +28,7 @@
#include <string.h>
#include <stdlib.h>
-#include <private/logd.h>
+#include "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 5cc052e..6ebf09c 100644
--- a/libc/bionic/__strlen_chk.cpp
+++ b/libc/bionic/__strlen_chk.cpp
@@ -28,7 +28,7 @@
#include <string.h>
#include <stdlib.h>
-#include <private/logd.h>
+#include "libc_logging.h"
/*
* Runtime implementation of __strlen_chk.
diff --git a/libc/bionic/__strncat_chk.cpp b/libc/bionic/__strncat_chk.cpp
index 32a3962..ab28541 100644
--- a/libc/bionic/__strncat_chk.cpp
+++ b/libc/bionic/__strncat_chk.cpp
@@ -28,7 +28,7 @@
#include <string.h>
#include <stdlib.h>
-#include <private/logd.h>
+#include "libc_logging.h"
#include <safe_iop.h>
/*
diff --git a/libc/bionic/__strncpy_chk.cpp b/libc/bionic/__strncpy_chk.cpp
index c9676ed..0f1797e 100644
--- a/libc/bionic/__strncpy_chk.cpp
+++ b/libc/bionic/__strncpy_chk.cpp
@@ -28,7 +28,7 @@
#include <string.h>
#include <stdlib.h>
-#include <private/logd.h>
+#include "libc_logging.h"
/*
* Runtime implementation of __builtin____strncpy_chk.
diff --git a/libc/bionic/__umask_chk.cpp b/libc/bionic/__umask_chk.cpp
index e1bc96d..ff67ed6 100644
--- a/libc/bionic/__umask_chk.cpp
+++ b/libc/bionic/__umask_chk.cpp
@@ -30,7 +30,7 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <private/logd.h>
+#include "libc_logging.h"
#include <stdlib.h>
/*
diff --git a/libc/bionic/__vsnprintf_chk.cpp b/libc/bionic/__vsnprintf_chk.cpp
index 95d4915..0fdda3e 100644
--- a/libc/bionic/__vsnprintf_chk.cpp
+++ b/libc/bionic/__vsnprintf_chk.cpp
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
-#include <private/logd.h>
+#include "libc_logging.h"
/*
* Runtime implementation of __builtin____vsnprintf_chk.
diff --git a/libc/bionic/__vsprintf_chk.cpp b/libc/bionic/__vsprintf_chk.cpp
index e1d10f5..12b0ca6 100644
--- a/libc/bionic/__vsprintf_chk.cpp
+++ b/libc/bionic/__vsprintf_chk.cpp
@@ -29,7 +29,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
-#include <private/logd.h>
+#include "libc_logging.h"
/*
* Runtime implementation of __builtin____vsprintf_chk.
diff --git a/libc/bionic/assert.cpp b/libc/bionic/assert.cpp
index e38c16d..6f221a5 100644
--- a/libc/bionic/assert.cpp
+++ b/libc/bionic/assert.cpp
@@ -32,8 +32,7 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
-#include <private/debug_format.h>
-#include <private/logd.h>
+#include "libc_logging.h"
// We log to stderr for the benefit of "adb shell" users, and the log for the benefit
// of regular app developers who want to see their asserts.
diff --git a/libc/bionic/debug_stacktrace.cpp b/libc/bionic/debug_stacktrace.cpp
index 9d53ad2..87dbba3 100644
--- a/libc/bionic/debug_stacktrace.cpp
+++ b/libc/bionic/debug_stacktrace.cpp
@@ -33,9 +33,8 @@
#include <unwind.h>
#include <sys/types.h>
-#include "debug_format.h"
#include "debug_mapinfo.h"
-#include "logd.h"
+#include "libc_logging.h"
/* depends how the system includes define this */
#ifdef HAVE_UNWIND_CONTEXT_STRUCT
diff --git a/libc/bionic/dlmalloc.c b/libc/bionic/dlmalloc.c
index 1ed3205..7d4ef0f 100644
--- a/libc/bionic/dlmalloc.c
+++ b/libc/bionic/dlmalloc.c
@@ -24,8 +24,7 @@
#include <linux/ashmem.h>
-#include <private/debug_format.h>
-#include <private/logd.h>
+#include <private/libc_logging.h>
// Send dlmalloc errors to the log.
static void __bionic_heap_corruption_error(const char* function);
diff --git a/libc/bionic/debug_format.cpp b/libc/bionic/libc_logging.cpp
index 793f8b1..755dc81 100644
--- a/libc/bionic/debug_format.cpp
+++ b/libc/bionic/libc_logging.cpp
@@ -26,13 +26,15 @@
* SUCH DAMAGE.
*/
-#include <../private/debug_format.h> // Relative path so we can #include this for testing.
+#include <../private/libc_logging.h> // Relative path so we can #include this .cpp file for testing.
+#include <../private/ScopedPthreadMutexLocker.h>
#include <assert.h>
#include <errno.h>
+#include <pthread.h>
#include <stdarg.h>
#include <stddef.h>
-#include <stdint.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -218,29 +220,30 @@ int __libc_format_fd(int fd, const char* format, ...) {
#include <fcntl.h>
#include <sys/uio.h>
+static pthread_mutex_t gLogInitializationLock = PTHREAD_MUTEX_INITIALIZER;
+
int __libc_format_log_va_list(int priority, const char* tag, const char* fmt, va_list args) {
char buf[1024];
- int result = vformat_buffer(buf, sizeof buf, fmt, args);
-
- static int log_fd = -1;
- if (log_fd == -1) {
- log_fd = open("/dev/log/main", O_WRONLY);
- if (log_fd == -1) {
- return result;
+ int buf_strlen = vformat_buffer(buf, sizeof(buf), fmt, args);
+
+ static int main_log_fd = -1;
+ if (main_log_fd == -1) {
+ ScopedPthreadMutexLocker locker(&gLogInitializationLock);
+ main_log_fd = TEMP_FAILURE_RETRY(open("/dev/log/main", O_CLOEXEC | O_WRONLY));
+ if (main_log_fd == -1) {
+ return -1;
}
}
struct iovec vec[3];
- vec[0].iov_base = (unsigned char *) &priority;
+ vec[0].iov_base = &priority;
vec[0].iov_len = 1;
- vec[1].iov_base = (void *) tag;
+ vec[1].iov_base = const_cast<char*>(tag);
vec[1].iov_len = strlen(tag) + 1;
- vec[2].iov_base = (void *) buf;
- vec[2].iov_len = strlen(buf) + 1;
-
- TEMP_FAILURE_RETRY(writev(log_fd, vec, 3));
+ vec[2].iov_base = const_cast<char*>(buf);
+ vec[2].iov_len = buf_strlen + 1;
- return result;
+ return TEMP_FAILURE_RETRY(writev(main_log_fd, vec, 3));
}
int __libc_format_log(int priority, const char* tag, const char* format, ...) {
@@ -516,3 +519,44 @@ out_vformat(Out *o, const char *format, va_list args)
}
}
}
+
+// must be kept in sync with frameworks/base/core/java/android/util/EventLog.java
+enum AndroidEventLogType {
+ EVENT_TYPE_INT = 0,
+ EVENT_TYPE_LONG = 1,
+ EVENT_TYPE_STRING = 2,
+ EVENT_TYPE_LIST = 3,
+};
+
+static int __libc_android_log_event(int32_t tag, char type, const void* payload, size_t len) {
+ struct iovec vec[3];
+ vec[0].iov_base = &tag;
+ vec[0].iov_len = sizeof(tag);
+ vec[1].iov_base = &type;
+ vec[1].iov_len = sizeof(type);
+ vec[2].iov_base = const_cast<void*>(payload);
+ vec[2].iov_len = len;
+
+ static int event_log_fd = -1;
+ if (event_log_fd == -1) {
+ ScopedPthreadMutexLocker locker(&gLogInitializationLock);
+ event_log_fd = TEMP_FAILURE_RETRY(open("/dev/log/events", O_CLOEXEC | O_WRONLY));
+ }
+ return TEMP_FAILURE_RETRY(writev(event_log_fd, vec, 3));
+}
+
+void __libc_android_log_event_int(int32_t tag, int value) {
+ __libc_android_log_event(tag, EVENT_TYPE_INT, &value, sizeof(value));
+}
+
+void __libc_android_log_event_uid(int32_t tag) {
+ __libc_android_log_event_int(tag, getuid());
+}
+
+void __fortify_chk_fail(const char *msg, uint32_t tag) {
+ __libc_format_log(ANDROID_LOG_FATAL, "libc", "FORTIFY_SOURCE: %s. Calling abort().\n", msg);
+ if (tag != 0) {
+ __libc_android_log_event_uid(tag);
+ }
+ abort();
+}
diff --git a/libc/bionic/logd_write.c b/libc/bionic/logd_write.c
deleted file mode 100644
index 03ac606..0000000
--- a/libc/bionic/logd_write.c
+++ /dev/null
@@ -1,255 +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.
- */
-#include <time.h>
-#include <stdio.h>
-#include <pthread.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <arpa/inet.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <fcntl.h>
-
-#include "logd.h"
-
-/* should match system/core/include/cutils/logger.h */
-#define LOGGER_LOG_MAIN "log/main"
-#define LOGGER_LOG_RADIO "log/radio"
-#define LOGGER_LOG_EVENTS "log/events"
-#define LOGGER_LOG_SYSTEM "log/system"
-
-#include <pthread.h>
-
-/* IMPORTANT IMPORTANT IMPORTANT: TECHNICAL NOTE
- *
- * Some of the functions below can be called when our malloc() implementation
- * has detected that the heap is corrupted, or even from a signal handler.
- *
- * These functions should *not* use a function that allocates heap memory
- * or is not signal-safe. Using direct system calls is acceptable, and we
- * also assume that pthread_mutex_lock/unlock can be used too.
- */
-
-#define LOG_BUF_SIZE 1024
-
-typedef enum {
- LOG_ID_NONE = 0,
- LOG_ID_MAIN,
- LOG_ID_RADIO,
- LOG_ID_EVENTS,
- LOG_ID_MAX
-} log_id_t;
-
-/* logger handles writing to object, pointed by log channel id */
-typedef int (*logger_function_t)(log_id_t log_id, struct iovec *vec);
-
-typedef struct {
- logger_function_t logger;
- int fd;
- const char *path;
-} log_channel_t;
-
-static int __write_to_log_init(log_id_t log_id, struct iovec *vec);
-static int __write_to_log_null(log_id_t log_id, struct iovec *vec);
-
-static pthread_mutex_t log_init_lock = PTHREAD_MUTEX_INITIALIZER;
-
-static log_channel_t log_channels[LOG_ID_MAX] = {
- { __write_to_log_null, -1, NULL },
- { __write_to_log_init, -1, "/dev/"LOGGER_LOG_MAIN },
- { __write_to_log_init, -1, "/dev/"LOGGER_LOG_RADIO },
- { __write_to_log_init, -1, "/dev/"LOGGER_LOG_EVENTS }
-};
-
-/* Important: see technical note at start of source file */
-static int __write_to_log_null(log_id_t log_id, struct iovec *vec)
-{
- /*
- * ALTERED behaviour from previous version
- * always returns successful result
- */
- int i = 0;
- size_t res = 0;
-
- for ( ; i < 3; ++i) {
- res += vec[i].iov_len;
- }
-
- return (int)res;
-}
-
-/*
- * it's supposed, that log_id contains valid id always.
- * this check must be performed in higher level functions
- */
-/* Important: see technical note at start of source file */
-static int __write_to_log_kernel(log_id_t log_id, struct iovec *vec)
-{
- return TEMP_FAILURE_RETRY( writev(log_channels[log_id].fd, vec, 3) );
-}
-
-/* Important: see technical note at start of source file */
-static int __write_to_log_init(log_id_t log_id, struct iovec *vec)
-{
- if ((LOG_ID_NONE < log_id) && (log_id < LOG_ID_MAX)) {
- int fd;
-
- pthread_mutex_lock(&log_init_lock);
-
- fd = TEMP_FAILURE_RETRY(open(log_channels[log_id].path, O_WRONLY));
-
- log_channels[log_id].logger =
- (fd < 0) ? __write_to_log_null : __write_to_log_kernel;
- log_channels[log_id].fd = fd;
-
- log_channels[log_id].fd = fd;
-
- pthread_mutex_unlock(&log_init_lock);
-
- return log_channels[log_id].logger(log_id, vec);
- }
-
- /* log_id is invalid */
- return -1;
-}
-
-/* Important: see technical note at start of source file */
-__LIBC_HIDDEN__
-int __libc_android_log_write(int prio, const char *tag, const char *msg)
-{
- struct iovec vec[3];
- log_id_t log_id = LOG_ID_MAIN;
-
- if (tag == NULL)
- tag = "";
-
- vec[0].iov_base = (unsigned char *) &prio;
- vec[0].iov_len = 1;
- vec[1].iov_base = (void *) tag;
- vec[1].iov_len = strlen(tag) + 1;
- vec[2].iov_base = (void *) msg;
- vec[2].iov_len = strlen(msg) + 1;
-
- return log_channels[log_id].logger(log_id, vec);
-}
-
-/* The functions below are not designed to be called from a heap panic
- * function or from a signal handler. As such, they are free to use complex
- * C library functions like vsnprintf()
- */
-__LIBC_HIDDEN__
-int __libc_android_log_vprint(int prio, const char *tag, const char *fmt,
- va_list ap)
-{
- char buf[LOG_BUF_SIZE];
-
- vsnprintf(buf, LOG_BUF_SIZE, fmt, ap);
-
- return __libc_android_log_write(prio, tag, buf);
-}
-
-__LIBC_HIDDEN__
-int __libc_android_log_print(int prio, const char *tag, const char *fmt, ...)
-{
- va_list ap;
- char buf[LOG_BUF_SIZE];
-
- va_start(ap, fmt);
- vsnprintf(buf, LOG_BUF_SIZE, fmt, ap);
- va_end(ap);
-
- return __libc_android_log_write(prio, tag, buf);
-}
-
-__LIBC_HIDDEN__
-int __libc_android_log_assert(const char *cond, const char *tag,
- const char *fmt, ...)
-{
- va_list ap;
- char buf[LOG_BUF_SIZE];
-
- va_start(ap, fmt);
- vsnprintf(buf, LOG_BUF_SIZE, fmt, ap);
- va_end(ap);
-
- __libc_android_log_write(ANDROID_LOG_FATAL, tag, buf);
-
- exit(1);
-
- return -1;
-}
-
-/*
- * Event logging.
- */
-
-// must be kept in sync with frameworks/base/core/java/android/util/EventLog.java
-typedef enum {
- EVENT_TYPE_INT = 0,
- EVENT_TYPE_LONG = 1,
- EVENT_TYPE_STRING = 2,
- EVENT_TYPE_LIST = 3,
-} AndroidEventLogType;
-
-static int __libc_android_log_btwrite(int32_t tag, char type, const void *payload, size_t len)
-{
- struct iovec vec[3];
-
- vec[0].iov_base = &tag;
- vec[0].iov_len = sizeof(tag);
- vec[1].iov_base = &type;
- vec[1].iov_len = sizeof(type);
- vec[2].iov_base = (void*)payload;
- vec[2].iov_len = len;
-
- return log_channels[LOG_ID_EVENTS].logger(LOG_ID_EVENTS, vec);
-}
-
-__LIBC_HIDDEN__
-void __libc_android_log_event_int(int32_t tag, int value)
-{
- __libc_android_log_btwrite(tag, EVENT_TYPE_INT, &value, sizeof(value));
-}
-
-__LIBC_HIDDEN__
-void __libc_android_log_event_uid(int32_t tag)
-{
- __libc_android_log_event_int(tag, getuid());
-}
-
-__LIBC_HIDDEN__
-void __fortify_chk_fail(const char *msg, uint32_t tag) {
- __libc_format_log(ANDROID_LOG_FATAL, "libc", "FORTIFY_SOURCE: %s. Calling abort().\n", msg);
- if (tag != 0) {
- __libc_android_log_event_uid(tag);
- }
- abort();
-}
diff --git a/libc/bionic/malloc_debug_check.cpp b/libc/bionic/malloc_debug_check.cpp
index 2ae98b6..91cf287 100644
--- a/libc/bionic/malloc_debug_check.cpp
+++ b/libc/bionic/malloc_debug_check.cpp
@@ -48,7 +48,7 @@
#include "debug_mapinfo.h"
#include "debug_stacktrace.h"
#include "dlmalloc.h"
-#include "logd.h"
+#include "libc_logging.h"
#include "malloc_debug_common.h"
#include "ScopedPthreadMutexLocker.h"
diff --git a/libc/bionic/malloc_debug_common.cpp b/libc/bionic/malloc_debug_common.cpp
index a05a5ef..2148d20 100644
--- a/libc/bionic/malloc_debug_common.cpp
+++ b/libc/bionic/malloc_debug_common.cpp
@@ -249,7 +249,7 @@ extern "C" void* memalign(size_t alignment, size_t bytes) {
#include <sys/system_properties.h>
#include <dlfcn.h>
#include <stdio.h>
-#include "logd.h"
+#include "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 e15ccd0..12d0e65 100644
--- a/libc/bionic/malloc_debug_common.h
+++ b/libc/bionic/malloc_debug_common.h
@@ -35,7 +35,7 @@
#include <stdlib.h>
-#include <private/debug_format.h>
+#include "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 9e63a86..2db8a1f 100644
--- a/libc/bionic/malloc_debug_leak.cpp
+++ b/libc/bionic/malloc_debug_leak.cpp
@@ -47,7 +47,7 @@
#include "debug_stacktrace.h"
#include "dlmalloc.h"
-#include "logd.h"
+#include "libc_logging.h"
#include "malloc_debug_common.h"
#include "ScopedPthreadMutexLocker.h"
diff --git a/libc/bionic/malloc_debug_qemu.cpp b/libc/bionic/malloc_debug_qemu.cpp
index 812a451..08225c1 100644
--- a/libc/bionic/malloc_debug_qemu.cpp
+++ b/libc/bionic/malloc_debug_qemu.cpp
@@ -51,7 +51,7 @@
#include <unistd.h>
#include <errno.h>
#include "dlmalloc.h"
-#include "logd.h"
+#include "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 be4f04b..e3573a3 100644
--- a/libc/bionic/open.c
+++ b/libc/bionic/open.c
@@ -29,7 +29,7 @@
#include <fcntl.h>
#include <stdarg.h>
#include <stdlib.h>
-#include <private/logd.h>
+#include "libc_logging.h"
extern int __open(const char*, int, int);
@@ -60,4 +60,3 @@ int __open_2(const char *pathname, int flags) {
return __open(pathname, flags, 0);
}
-
diff --git a/libc/bionic/openat.c b/libc/bionic/openat.c
index c1abbaa..2d09d17 100644
--- a/libc/bionic/openat.c
+++ b/libc/bionic/openat.c
@@ -29,7 +29,7 @@
#include <fcntl.h>
#include <stdarg.h>
#include <stdlib.h>
-#include <private/logd.h>
+#include "libc_logging.h"
extern int __openat(int, const char*, int, int);
@@ -61,4 +61,3 @@ int __openat_2(int fd, const char *pathname, int flags)
return __openat(fd, pathname, flags, 0);
}
-
diff --git a/libc/bionic/pthread_create.cpp b/libc/bionic/pthread_create.cpp
index 368c46d..15f18aa 100644
--- a/libc/bionic/pthread_create.cpp
+++ b/libc/bionic/pthread_create.cpp
@@ -35,8 +35,7 @@
#include "private/bionic_ssp.h"
#include "private/bionic_tls.h"
-#include "private/debug_format.h"
-#include "private/logd.h"
+#include "private/libc_logging.h"
#include "private/thread_private.h"
#include "private/ErrnoRestorer.h"
#include "private/ScopedPthreadMutexLocker.h"
diff --git a/libc/bionic/pthread_debug.cpp b/libc/bionic/pthread_debug.cpp
index f8f0c59..94c23de 100644
--- a/libc/bionic/pthread_debug.cpp
+++ b/libc/bionic/pthread_debug.cpp
@@ -43,9 +43,7 @@
#include "bionic_tls.h"
#include "debug_mapinfo.h"
#include "debug_stacktrace.h"
-#include "logd.h"
-
-#include <private/debug_format.h>
+#include "libc_logging.h"
/*
* ===========================================================================
diff --git a/libc/bionic/stubs.cpp b/libc/bionic/stubs.cpp
index 8ddc326..e8411b7 100644
--- a/libc/bionic/stubs.cpp
+++ b/libc/bionic/stubs.cpp
@@ -38,9 +38,8 @@
#include <unistd.h>
#include "private/android_filesystem_config.h"
-#include "private/debug_format.h"
#include "private/ErrnoRestorer.h"
-#include "private/logd.h"
+#include "private/libc_logging.h"
// Thread-specific state for the non-reentrant functions.
static pthread_once_t stubs_once = PTHREAD_ONCE_INIT;