am 1923d4c0: Merge "deprecate TARGET_USES_LOGD"
* commit '1923d4c03a68c89f304b601545f5e8db026b9be0': deprecate TARGET_USES_LOGD
This commit is contained in:
commit
835a23cc9c
@ -577,10 +577,6 @@ libc_common_cflags := \
|
|||||||
-D_LIBC=1 \
|
-D_LIBC=1 \
|
||||||
-Wall -Wextra -Wunused \
|
-Wall -Wextra -Wunused \
|
||||||
|
|
||||||
ifneq ($(TARGET_USES_LOGD),false)
|
|
||||||
libc_common_cflags += -DTARGET_USES_LOGD
|
|
||||||
endif
|
|
||||||
|
|
||||||
use_clang := $(USE_CLANG_PLATFORM_BUILD)
|
use_clang := $(USE_CLANG_PLATFORM_BUILD)
|
||||||
|
|
||||||
# Clang/llvm has incompatible long double (fp128) for x86_64.
|
# Clang/llvm has incompatible long double (fp128) for x86_64.
|
||||||
|
@ -448,7 +448,6 @@ static int __libc_write_stderr(const char* tag, const char* msg) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TARGET_USES_LOGD
|
|
||||||
static int __libc_open_log_socket() {
|
static int __libc_open_log_socket() {
|
||||||
// ToDo: Ideally we want this to fail if the gid of the current
|
// 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
|
// 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_sec;
|
||||||
uint32_t tv_nsec;
|
uint32_t tv_nsec;
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
static int __libc_write_log(int priority, const char* tag, const char* msg) {
|
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();
|
int main_log_fd = __libc_open_log_socket();
|
||||||
if (main_log_fd == -1) {
|
if (main_log_fd == -1) {
|
||||||
// Try stderr instead.
|
// 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[4].iov_len = strlen(tag) + 1;
|
||||||
vec[5].iov_base = const_cast<char*>(msg);
|
vec[5].iov_base = const_cast<char*>(msg);
|
||||||
vec[5].iov_len = strlen(msg) + 1;
|
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])));
|
int result = TEMP_FAILURE_RETRY(writev(main_log_fd, vec, sizeof(vec) / sizeof(vec[0])));
|
||||||
close(main_log_fd);
|
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) {
|
static int __libc_android_log_event(int32_t tag, char type, const void* payload, size_t len) {
|
||||||
#ifdef TARGET_USES_LOGD
|
|
||||||
iovec vec[6];
|
iovec vec[6];
|
||||||
char log_id = LOG_ID_EVENTS;
|
char log_id = LOG_ID_EVENTS;
|
||||||
vec[0].iov_base = &log_id;
|
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;
|
vec[5].iov_len = len;
|
||||||
|
|
||||||
int event_log_fd = __libc_open_log_socket();
|
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) {
|
if (event_log_fd == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user