Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Snippets Groups Projects
Commit 1e3dea00 authored by Christopher Ferris's avatar Christopher Ferris Committed by android-build-merger
Browse files

Merge "Move libc_logging to libasync_safe."

am: deb19a63

Change-Id: Ia1ebf75cd3c0a9640fa5f2367fb40d00ffeca2ad
parents a255ab0c deb19a63
Branches
Tags
No related merge requests found
...@@ -9,10 +9,6 @@ cc_defaults { ...@@ -9,10 +9,6 @@ cc_defaults {
"-Os", "-Os",
], ],
// util.cpp gets async signal safe logging via libc_logging,
// which defines its interface in bionic private headers.
include_dirs: ["bionic/libc"],
local_include_dirs: ["include"], local_include_dirs: ["include"],
} }
...@@ -26,7 +22,7 @@ cc_library_static { ...@@ -26,7 +22,7 @@ cc_library_static {
], ],
whole_static_libs: [ whole_static_libs: [
"libc_logging", "libasync_safe",
"libcutils", "libcutils",
"libbase", "libbase",
], ],
...@@ -39,7 +35,7 @@ cc_library_static { ...@@ -39,7 +35,7 @@ cc_library_static {
srcs: ["handler/debuggerd_handler.cpp"], srcs: ["handler/debuggerd_handler.cpp"],
whole_static_libs: [ whole_static_libs: [
"libc_logging", "libasync_safe",
"libdebuggerd", "libdebuggerd",
], ],
...@@ -70,6 +66,7 @@ cc_library_static { ...@@ -70,6 +66,7 @@ cc_library_static {
whole_static_libs: [ whole_static_libs: [
"libdebuggerd_handler_core", "libdebuggerd_handler_core",
"libtombstoned_client", "libtombstoned_client",
"libasync_safe",
"libbase", "libbase",
"libdebuggerd", "libdebuggerd",
"libbacktrace", "libbacktrace",
...@@ -166,6 +163,7 @@ cc_test { ...@@ -166,6 +163,7 @@ cc_test {
"tombstoned_client.cpp", "tombstoned_client.cpp",
"util.cpp" "util.cpp"
], ],
static_libs: ["libasync_safe"],
}, },
}, },
...@@ -178,7 +176,6 @@ cc_test { ...@@ -178,7 +176,6 @@ cc_test {
static_libs: [ static_libs: [
"libdebuggerd", "libdebuggerd",
"libc_logging",
], ],
local_include_dirs: [ local_include_dirs: [
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <android-base/file.h> #include <android-base/file.h>
#include <android-base/unique_fd.h> #include <android-base/unique_fd.h>
#include <async_safe/log.h>
#include "debuggerd/handler.h" #include "debuggerd/handler.h"
#include "debuggerd/tombstoned.h" #include "debuggerd/tombstoned.h"
...@@ -47,8 +48,6 @@ ...@@ -47,8 +48,6 @@
#include "backtrace.h" #include "backtrace.h"
#include "tombstone.h" #include "tombstone.h"
#include "private/libc_logging.h"
using android::base::unique_fd; using android::base::unique_fd;
extern "C" void __linker_enable_fallback_allocator(); extern "C" void __linker_enable_fallback_allocator();
...@@ -81,7 +80,7 @@ static void iterate_siblings(bool (*callback)(pid_t, int), int output_fd) { ...@@ -81,7 +80,7 @@ static void iterate_siblings(bool (*callback)(pid_t, int), int output_fd) {
DIR* dir = opendir(buf); DIR* dir = opendir(buf);
if (!dir) { if (!dir) {
__libc_format_log(ANDROID_LOG_ERROR, "libc", "failed to open %s: %s", buf, strerror(errno)); async_safe_format_log(ANDROID_LOG_ERROR, "libc", "failed to open %s: %s", buf, strerror(errno));
return; return;
} }
...@@ -145,7 +144,8 @@ static void trace_handler(siginfo_t* info, ucontext_t* ucontext) { ...@@ -145,7 +144,8 @@ static void trace_handler(siginfo_t* info, ucontext_t* ucontext) {
static pthread_mutex_t trace_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t trace_mutex = PTHREAD_MUTEX_INITIALIZER;
int ret = pthread_mutex_trylock(&trace_mutex); int ret = pthread_mutex_trylock(&trace_mutex);
if (ret != 0) { if (ret != 0) {
__libc_format_log(ANDROID_LOG_INFO, "libc", "pthread_mutex_try_lock failed: %s", strerror(ret)); async_safe_format_log(ANDROID_LOG_INFO, "libc", "pthread_mutex_try_lock failed: %s",
strerror(ret));
return; return;
} }
...@@ -167,7 +167,8 @@ static void trace_handler(siginfo_t* info, ucontext_t* ucontext) { ...@@ -167,7 +167,8 @@ static void trace_handler(siginfo_t* info, ucontext_t* ucontext) {
// receiving our signal. // receiving our signal.
unique_fd pipe_read, pipe_write; unique_fd pipe_read, pipe_write;
if (!Pipe(&pipe_read, &pipe_write)) { if (!Pipe(&pipe_read, &pipe_write)) {
__libc_format_log(ANDROID_LOG_ERROR, "libc", "failed to create pipe: %s", strerror(errno)); async_safe_format_log(ANDROID_LOG_ERROR, "libc", "failed to create pipe: %s",
strerror(errno));
return false; return false;
} }
...@@ -180,8 +181,8 @@ static void trace_handler(siginfo_t* info, ucontext_t* ucontext) { ...@@ -180,8 +181,8 @@ static void trace_handler(siginfo_t* info, ucontext_t* ucontext) {
siginfo.si_uid = getuid(); siginfo.si_uid = getuid();
if (syscall(__NR_rt_tgsigqueueinfo, getpid(), tid, DEBUGGER_SIGNAL, &siginfo) != 0) { if (syscall(__NR_rt_tgsigqueueinfo, getpid(), tid, DEBUGGER_SIGNAL, &siginfo) != 0) {
__libc_format_log(ANDROID_LOG_ERROR, "libc", "failed to send trace signal to %d: %s", tid, async_safe_format_log(ANDROID_LOG_ERROR, "libc", "failed to send trace signal to %d: %s",
strerror(errno)); tid, strerror(errno));
return false; return false;
} }
...@@ -209,7 +210,7 @@ static void crash_handler(siginfo_t* info, ucontext_t* ucontext, void* abort_mes ...@@ -209,7 +210,7 @@ static void crash_handler(siginfo_t* info, ucontext_t* ucontext, void* abort_mes
static pthread_mutex_t crash_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t crash_mutex = PTHREAD_MUTEX_INITIALIZER;
int ret = pthread_mutex_lock(&crash_mutex); int ret = pthread_mutex_lock(&crash_mutex);
if (ret != 0) { if (ret != 0) {
__libc_format_log(ANDROID_LOG_INFO, "libc", "pthread_mutex_lock failed: %s", strerror(ret)); async_safe_format_log(ANDROID_LOG_INFO, "libc", "pthread_mutex_lock failed: %s", strerror(ret));
return; return;
} }
......
...@@ -48,8 +48,7 @@ ...@@ -48,8 +48,7 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
#include "private/bionic_futex.h" #include <async_safe/log.h>
#include "private/libc_logging.h"
// see man(2) prctl, specifically the section about PR_GET_NAME // see man(2) prctl, specifically the section about PR_GET_NAME
#define MAX_TASK_NAME_LEN (16) #define MAX_TASK_NAME_LEN (16)
...@@ -62,6 +61,10 @@ ...@@ -62,6 +61,10 @@
#define CRASH_DUMP_PATH "/system/bin/" CRASH_DUMP_NAME #define CRASH_DUMP_PATH "/system/bin/" CRASH_DUMP_NAME
static inline void futex_wait(volatile void* ftx, int value) {
syscall(__NR_futex, ftx, FUTEX_WAIT, value, nullptr, nullptr, 0);
}
class ErrnoRestorer { class ErrnoRestorer {
public: public:
ErrnoRestorer() : saved_errno_(errno) { ErrnoRestorer() : saved_errno_(errno) {
...@@ -82,11 +85,12 @@ static debuggerd_callbacks_t g_callbacks; ...@@ -82,11 +85,12 @@ static debuggerd_callbacks_t g_callbacks;
// Mutex to ensure only one crashing thread dumps itself. // Mutex to ensure only one crashing thread dumps itself.
static pthread_mutex_t crash_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t crash_mutex = PTHREAD_MUTEX_INITIALIZER;
// Don't use __libc_fatal because it exits via abort, which might put us back into a signal handler. // Don't use async_safe_fatal because it exits via abort, which might put us back into
// a signal handler.
static void __noreturn __printflike(1, 2) fatal(const char* fmt, ...) { static void __noreturn __printflike(1, 2) fatal(const char* fmt, ...) {
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
__libc_format_log_va_list(ANDROID_LOG_FATAL, "libc", fmt, args); async_safe_format_log_va_list(ANDROID_LOG_FATAL, "libc", fmt, args);
_exit(1); _exit(1);
} }
...@@ -96,7 +100,7 @@ static void __noreturn __printflike(1, 2) fatal_errno(const char* fmt, ...) { ...@@ -96,7 +100,7 @@ static void __noreturn __printflike(1, 2) fatal_errno(const char* fmt, ...) {
va_start(args, fmt); va_start(args, fmt);
char buf[4096]; char buf[4096];
__libc_format_buffer_va_list(buf, sizeof(buf), fmt, args); async_safe_format_buffer_va_list(buf, sizeof(buf), fmt, args);
fatal("%s: %s", buf, strerror(err)); fatal("%s: %s", buf, strerror(err));
} }
...@@ -120,8 +124,8 @@ static void log_signal_summary(int signum, const siginfo_t* info) { ...@@ -120,8 +124,8 @@ static void log_signal_summary(int signum, const siginfo_t* info) {
} }
if (signum == DEBUGGER_SIGNAL) { if (signum == DEBUGGER_SIGNAL) {
__libc_format_log(ANDROID_LOG_INFO, "libc", "Requested dump for tid %d (%s)", gettid(), async_safe_format_log(ANDROID_LOG_INFO, "libc", "Requested dump for tid %d (%s)", gettid(),
thread_name); thread_name);
return; return;
} }
...@@ -166,14 +170,14 @@ static void log_signal_summary(int signum, const siginfo_t* info) { ...@@ -166,14 +170,14 @@ static void log_signal_summary(int signum, const siginfo_t* info) {
char addr_desc[32]; // ", fault addr 0x1234" char addr_desc[32]; // ", fault addr 0x1234"
addr_desc[0] = code_desc[0] = 0; addr_desc[0] = code_desc[0] = 0;
if (info != nullptr) { if (info != nullptr) {
__libc_format_buffer(code_desc, sizeof(code_desc), ", code %d", info->si_code); async_safe_format_buffer(code_desc, sizeof(code_desc), ", code %d", info->si_code);
if (has_address) { if (has_address) {
__libc_format_buffer(addr_desc, sizeof(addr_desc), ", fault addr %p", info->si_addr); async_safe_format_buffer(addr_desc, sizeof(addr_desc), ", fault addr %p", info->si_addr);
} }
} }
__libc_format_log(ANDROID_LOG_FATAL, "libc", "Fatal signal %d (%s)%s%s in tid %d (%s)", signum, async_safe_format_log(ANDROID_LOG_FATAL, "libc", "Fatal signal %d (%s)%s%s in tid %d (%s)",
signal_name, code_desc, addr_desc, gettid(), thread_name); signum, signal_name, code_desc, addr_desc, gettid(), thread_name);
} }
/* /*
...@@ -182,8 +186,8 @@ static void log_signal_summary(int signum, const siginfo_t* info) { ...@@ -182,8 +186,8 @@ static void log_signal_summary(int signum, const siginfo_t* info) {
static bool have_siginfo(int signum) { static bool have_siginfo(int signum) {
struct sigaction old_action; struct sigaction old_action;
if (sigaction(signum, nullptr, &old_action) < 0) { if (sigaction(signum, nullptr, &old_action) < 0) {
__libc_format_log(ANDROID_LOG_WARN, "libc", "Failed testing for SA_SIGINFO: %s", async_safe_format_log(ANDROID_LOG_WARN, "libc", "Failed testing for SA_SIGINFO: %s",
strerror(errno)); strerror(errno));
return false; return false;
} }
return (old_action.sa_flags & SA_SIGINFO) != 0; return (old_action.sa_flags & SA_SIGINFO) != 0;
...@@ -207,7 +211,7 @@ static void raise_caps() { ...@@ -207,7 +211,7 @@ static void raise_caps() {
capdata[1].inheritable = capdata[1].permitted; capdata[1].inheritable = capdata[1].permitted;
if (capset(&capheader, &capdata[0]) == -1) { if (capset(&capheader, &capdata[0]) == -1) {
__libc_format_log(ANDROID_LOG_ERROR, "libc", "capset failed: %s", strerror(errno)); async_safe_format_log(ANDROID_LOG_ERROR, "libc", "capset failed: %s", strerror(errno));
} }
} }
...@@ -217,8 +221,8 @@ static void raise_caps() { ...@@ -217,8 +221,8 @@ static void raise_caps() {
for (unsigned long i = 0; i < 64; ++i) { for (unsigned long i = 0; i < 64; ++i) {
if (capmask & (1ULL << i)) { if (capmask & (1ULL << i)) {
if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, i, 0, 0) != 0) { if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, i, 0, 0) != 0) {
__libc_format_log(ANDROID_LOG_ERROR, "libc", "failed to raise ambient capability %lu: %s", async_safe_format_log(ANDROID_LOG_ERROR, "libc",
i, strerror(errno)); "failed to raise ambient capability %lu: %s", i, strerror(errno));
} }
} }
} }
...@@ -260,8 +264,8 @@ static int debuggerd_dispatch_pseudothread(void* arg) { ...@@ -260,8 +264,8 @@ static int debuggerd_dispatch_pseudothread(void* arg) {
// Don't use fork(2) to avoid calling pthread_atfork handlers. // Don't use fork(2) to avoid calling pthread_atfork handlers.
int forkpid = clone(nullptr, nullptr, 0, nullptr); int forkpid = clone(nullptr, nullptr, 0, nullptr);
if (forkpid == -1) { if (forkpid == -1) {
__libc_format_log(ANDROID_LOG_FATAL, "libc", "failed to fork in debuggerd signal handler: %s", async_safe_format_log(ANDROID_LOG_FATAL, "libc",
strerror(errno)); "failed to fork in debuggerd signal handler: %s", strerror(errno));
} else if (forkpid == 0) { } else if (forkpid == 0) {
TEMP_FAILURE_RETRY(dup2(pipefds[1], STDOUT_FILENO)); TEMP_FAILURE_RETRY(dup2(pipefds[1], STDOUT_FILENO));
close(pipefds[0]); close(pipefds[0]);
...@@ -271,8 +275,9 @@ static int debuggerd_dispatch_pseudothread(void* arg) { ...@@ -271,8 +275,9 @@ static int debuggerd_dispatch_pseudothread(void* arg) {
char main_tid[10]; char main_tid[10];
char pseudothread_tid[10]; char pseudothread_tid[10];
__libc_format_buffer(main_tid, sizeof(main_tid), "%d", thread_info->crashing_tid); async_safe_format_buffer(main_tid, sizeof(main_tid), "%d", thread_info->crashing_tid);
__libc_format_buffer(pseudothread_tid, sizeof(pseudothread_tid), "%d", thread_info->pseudothread_tid); async_safe_format_buffer(pseudothread_tid, sizeof(pseudothread_tid), "%d",
thread_info->pseudothread_tid);
execl(CRASH_DUMP_PATH, CRASH_DUMP_NAME, main_tid, pseudothread_tid, nullptr); execl(CRASH_DUMP_PATH, CRASH_DUMP_NAME, main_tid, pseudothread_tid, nullptr);
...@@ -282,15 +287,16 @@ static int debuggerd_dispatch_pseudothread(void* arg) { ...@@ -282,15 +287,16 @@ static int debuggerd_dispatch_pseudothread(void* arg) {
char buf[4]; char buf[4];
ssize_t rc = TEMP_FAILURE_RETRY(read(pipefds[0], &buf, sizeof(buf))); ssize_t rc = TEMP_FAILURE_RETRY(read(pipefds[0], &buf, sizeof(buf)));
if (rc == -1) { if (rc == -1) {
__libc_format_log(ANDROID_LOG_FATAL, "libc", "read of IPC pipe failed: %s", strerror(errno)); async_safe_format_log(ANDROID_LOG_FATAL, "libc", "read of IPC pipe failed: %s",
strerror(errno));
} else if (rc == 0) { } else if (rc == 0) {
__libc_format_log(ANDROID_LOG_FATAL, "libc", "crash_dump helper failed to exec"); async_safe_format_log(ANDROID_LOG_FATAL, "libc", "crash_dump helper failed to exec");
} else if (rc != 1) { } else if (rc != 1) {
__libc_format_log(ANDROID_LOG_FATAL, "libc", async_safe_format_log(ANDROID_LOG_FATAL, "libc",
"read of IPC pipe returned unexpected value: %zd", rc); "read of IPC pipe returned unexpected value: %zd", rc);
} else { } else {
if (buf[0] != '\1') { if (buf[0] != '\1') {
__libc_format_log(ANDROID_LOG_FATAL, "libc", "crash_dump helper reported failure"); async_safe_format_log(ANDROID_LOG_FATAL, "libc", "crash_dump helper reported failure");
} else { } else {
thread_info->crash_dump_started = true; thread_info->crash_dump_started = true;
} }
...@@ -300,10 +306,10 @@ static int debuggerd_dispatch_pseudothread(void* arg) { ...@@ -300,10 +306,10 @@ static int debuggerd_dispatch_pseudothread(void* arg) {
// Don't leave a zombie child. // Don't leave a zombie child.
int status; int status;
if (TEMP_FAILURE_RETRY(waitpid(forkpid, &status, 0)) == -1) { if (TEMP_FAILURE_RETRY(waitpid(forkpid, &status, 0)) == -1) {
__libc_format_log(ANDROID_LOG_FATAL, "libc", "failed to wait for crash_dump helper: %s", async_safe_format_log(ANDROID_LOG_FATAL, "libc", "failed to wait for crash_dump helper: %s",
strerror(errno)); strerror(errno));
} else if (WIFSTOPPED(status) || WIFSIGNALED(status)) { } else if (WIFSTOPPED(status) || WIFSIGNALED(status)) {
__libc_format_log(ANDROID_LOG_FATAL, "libc", "crash_dump helper crashed or stopped"); async_safe_format_log(ANDROID_LOG_FATAL, "libc", "crash_dump helper crashed or stopped");
thread_info->crash_dump_started = false; thread_info->crash_dump_started = false;
} }
} }
...@@ -383,7 +389,7 @@ static void debuggerd_signal_handler(int signal_number, siginfo_t* info, void* c ...@@ -383,7 +389,7 @@ static void debuggerd_signal_handler(int signal_number, siginfo_t* info, void* c
// Only allow one thread to handle a signal at a time. // Only allow one thread to handle a signal at a time.
int ret = pthread_mutex_lock(&crash_mutex); int ret = pthread_mutex_lock(&crash_mutex);
if (ret != 0) { if (ret != 0) {
__libc_format_log(ANDROID_LOG_INFO, "libc", "pthread_mutex_lock failed: %s", strerror(ret)); async_safe_format_log(ANDROID_LOG_INFO, "libc", "pthread_mutex_lock failed: %s", strerror(ret));
return; return;
} }
...@@ -419,10 +425,10 @@ static void debuggerd_signal_handler(int signal_number, siginfo_t* info, void* c ...@@ -419,10 +425,10 @@ static void debuggerd_signal_handler(int signal_number, siginfo_t* info, void* c
} }
// Wait for the child to start... // Wait for the child to start...
__futex_wait(&thread_info.pseudothread_tid, -1, nullptr); futex_wait(&thread_info.pseudothread_tid, -1);
// and then wait for it to finish. // and then wait for it to finish.
__futex_wait(&thread_info.pseudothread_tid, child_pid, nullptr); futex_wait(&thread_info.pseudothread_tid, child_pid);
// Restore PR_SET_DUMPABLE to its original value. // Restore PR_SET_DUMPABLE to its original value.
if (prctl(PR_SET_DUMPABLE, orig_dumpable) != 0) { if (prctl(PR_SET_DUMPABLE, orig_dumpable) != 0) {
......
...@@ -22,11 +22,11 @@ ...@@ -22,11 +22,11 @@
#include <utility> #include <utility>
#include <android-base/unique_fd.h> #include <android-base/unique_fd.h>
#include <async_safe/log.h>
#include <cutils/sockets.h> #include <cutils/sockets.h>
#include "debuggerd/protocol.h" #include "debuggerd/protocol.h"
#include "debuggerd/util.h" #include "debuggerd/util.h"
#include "private/libc_logging.h"
using android::base::unique_fd; using android::base::unique_fd;
...@@ -34,8 +34,8 @@ bool tombstoned_connect(pid_t pid, unique_fd* tombstoned_socket, unique_fd* outp ...@@ -34,8 +34,8 @@ bool tombstoned_connect(pid_t pid, unique_fd* tombstoned_socket, unique_fd* outp
unique_fd sockfd(socket_local_client(kTombstonedCrashSocketName, unique_fd sockfd(socket_local_client(kTombstonedCrashSocketName,
ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_SEQPACKET)); ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_SEQPACKET));
if (sockfd == -1) { if (sockfd == -1) {
__libc_format_log(ANDROID_LOG_ERROR, "libc", "failed to connect to tombstoned: %s", async_safe_format_log(ANDROID_LOG_ERROR, "libc", "failed to connect to tombstoned: %s",
strerror(errno)); strerror(errno));
return false; return false;
} }
...@@ -43,22 +43,22 @@ bool tombstoned_connect(pid_t pid, unique_fd* tombstoned_socket, unique_fd* outp ...@@ -43,22 +43,22 @@ bool tombstoned_connect(pid_t pid, unique_fd* tombstoned_socket, unique_fd* outp
packet.packet_type = CrashPacketType::kDumpRequest; packet.packet_type = CrashPacketType::kDumpRequest;
packet.packet.dump_request.pid = pid; packet.packet.dump_request.pid = pid;
if (TEMP_FAILURE_RETRY(write(sockfd, &packet, sizeof(packet))) != sizeof(packet)) { if (TEMP_FAILURE_RETRY(write(sockfd, &packet, sizeof(packet))) != sizeof(packet)) {
__libc_format_log(ANDROID_LOG_ERROR, "libc", "failed to write DumpRequest packet: %s", async_safe_format_log(ANDROID_LOG_ERROR, "libc", "failed to write DumpRequest packet: %s",
strerror(errno)); strerror(errno));
return false; return false;
} }
unique_fd tmp_output_fd; unique_fd tmp_output_fd;
ssize_t rc = recv_fd(sockfd, &packet, sizeof(packet), &tmp_output_fd); ssize_t rc = recv_fd(sockfd, &packet, sizeof(packet), &tmp_output_fd);
if (rc == -1) { if (rc == -1) {
__libc_format_log(ANDROID_LOG_ERROR, "libc", async_safe_format_log(ANDROID_LOG_ERROR, "libc",
"failed to read response to DumpRequest packet: %s", strerror(errno)); "failed to read response to DumpRequest packet: %s", strerror(errno));
return false; return false;
} else if (rc != sizeof(packet)) { } else if (rc != sizeof(packet)) {
__libc_format_log( async_safe_format_log(
ANDROID_LOG_ERROR, "libc", ANDROID_LOG_ERROR, "libc",
"received DumpRequest response packet of incorrect length (expected %zu, got %zd)", "received DumpRequest response packet of incorrect length (expected %zu, got %zd)",
sizeof(packet), rc); sizeof(packet), rc);
return false; return false;
} }
...@@ -67,8 +67,8 @@ bool tombstoned_connect(pid_t pid, unique_fd* tombstoned_socket, unique_fd* outp ...@@ -67,8 +67,8 @@ bool tombstoned_connect(pid_t pid, unique_fd* tombstoned_socket, unique_fd* outp
// a regular fd, and writing to an fd with O_APPEND). // a regular fd, and writing to an fd with O_APPEND).
int flags = fcntl(tmp_output_fd.get(), F_GETFL); int flags = fcntl(tmp_output_fd.get(), F_GETFL);
if (fcntl(tmp_output_fd.get(), F_SETFL, flags | O_APPEND) != 0) { if (fcntl(tmp_output_fd.get(), F_SETFL, flags | O_APPEND) != 0) {
__libc_format_log(ANDROID_LOG_WARN, "libc", "failed to set output fd flags: %s", async_safe_format_log(ANDROID_LOG_WARN, "libc", "failed to set output fd flags: %s",
strerror(errno)); strerror(errno));
} }
*tombstoned_socket = std::move(sockfd); *tombstoned_socket = std::move(sockfd);
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
#include <cutils/sockets.h> #include <cutils/sockets.h>
#include <debuggerd/protocol.h> #include <debuggerd/protocol.h>
#include "private/libc_logging.h"
using android::base::unique_fd; using android::base::unique_fd;
ssize_t send_fd(int sockfd, const void* data, size_t len, unique_fd fd) { ssize_t send_fd(int sockfd, const void* data, size_t len, unique_fd fd) {
......
...@@ -55,6 +55,7 @@ test_c_flags := \ ...@@ -55,6 +55,7 @@ test_c_flags := \
-fno-builtin \ -fno-builtin \
test_src_files := \ test_src_files := \
libc_test.cpp \
liblog_test_default.cpp \ liblog_test_default.cpp \
liblog_test_local.cpp \ liblog_test_local.cpp \
liblog_test_stderr.cpp \ liblog_test_stderr.cpp \
...@@ -65,14 +66,6 @@ test_src_files := \ ...@@ -65,14 +66,6 @@ test_src_files := \
log_system_test.cpp \ log_system_test.cpp \
log_time_test.cpp log_time_test.cpp
# to prevent breaking the build if bionic not relatively visible to us
ifneq ($(wildcard $(LOCAL_PATH)/../../../../bionic/libc/bionic/libc_logging.cpp),)
test_src_files += \
libc_test.cpp
endif
# Build tests for the device (with .so). Run with: # Build tests for the device (with .so). Run with:
# adb shell /data/nativetest/liblog-unit-tests/liblog-unit-tests # adb shell /data/nativetest/liblog-unit-tests/liblog-unit-tests
include $(CLEAR_VARS) include $(CLEAR_VARS)
......
...@@ -30,7 +30,6 @@ cc_library_shared { ...@@ -30,7 +30,6 @@ cc_library_shared {
static_libs: [ static_libs: [
"libc_malloc_debug_backtrace", "libc_malloc_debug_backtrace",
"libc_logging",
], ],
// Only need this for arm since libc++ uses its own unwind code that // Only need this for arm since libc++ uses its own unwind code that
// doesn't mix with the other default unwind code. // doesn't mix with the other default unwind code.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment