Merge "deprecate TARGET_USES_LOGD"

This commit is contained in:
Mark Salyzyn 2015-07-28 17:48:08 +00:00 committed by Gerrit Code Review
commit 1923d4c03a
2 changed files with 0 additions and 37 deletions

View File

@ -577,10 +577,6 @@ libc_common_cflags := \
-D_LIBC=1 \
-Wall -Wextra -Wunused \
ifneq ($(TARGET_USES_LOGD),false)
libc_common_cflags += -DTARGET_USES_LOGD
endif
use_clang := $(USE_CLANG_PLATFORM_BUILD)
# Clang/llvm has incompatible long double (fp128) for x86_64.

View File

@ -448,7 +448,6 @@ static int __libc_write_stderr(const char* tag, const char* msg) {
return result;
}
#ifdef TARGET_USES_LOGD
static int __libc_open_log_socket() {
// ToDo: Ideally we want this to fail if the gid of the current
// process is AID_LOGD, but will have to wait until we have
@ -486,10 +485,8 @@ struct log_time { // Wire format
uint32_t tv_sec;
uint32_t tv_nsec;
};
#endif
static int __libc_write_log(int priority, const char* tag, const char* msg) {
#ifdef TARGET_USES_LOGD
int main_log_fd = __libc_open_log_socket();
if (main_log_fd == -1) {
// Try stderr instead.
@ -517,24 +514,6 @@ static int __libc_write_log(int priority, const char* tag, const char* msg) {
vec[4].iov_len = strlen(tag) + 1;
vec[5].iov_base = const_cast<char*>(msg);
vec[5].iov_len = strlen(msg) + 1;
#else
int main_log_fd = TEMP_FAILURE_RETRY(open("/dev/log/main", O_CLOEXEC | O_WRONLY));
if (main_log_fd == -1) {
if (errno == ENOTDIR) {
// /dev/log isn't a directory? Maybe we're running on the host? Try stderr instead.
return __libc_write_stderr(tag, msg);
}
return -1;
}
iovec vec[3];
vec[0].iov_base = &priority;
vec[0].iov_len = 1;
vec[1].iov_base = const_cast<char*>(tag);
vec[1].iov_len = strlen(tag) + 1;
vec[2].iov_base = const_cast<char*>(msg);
vec[2].iov_len = strlen(msg) + 1;
#endif
int result = TEMP_FAILURE_RETRY(writev(main_log_fd, vec, sizeof(vec) / sizeof(vec[0])));
close(main_log_fd);
@ -557,7 +536,6 @@ int __libc_format_log(int priority, const char* tag, const char* format, ...) {
}
static int __libc_android_log_event(int32_t tag, char type, const void* payload, size_t len) {
#ifdef TARGET_USES_LOGD
iovec vec[6];
char log_id = LOG_ID_EVENTS;
vec[0].iov_base = &log_id;
@ -581,17 +559,6 @@ static int __libc_android_log_event(int32_t tag, char type, const void* payload,
vec[5].iov_len = len;
int event_log_fd = __libc_open_log_socket();
#else
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;
int event_log_fd = TEMP_FAILURE_RETRY(open("/dev/log/events", O_CLOEXEC | O_WRONLY));
#endif
if (event_log_fd == -1) {
return -1;