Loading liblog/Android.bp +5 −5 Original line number Diff line number Diff line Loading @@ -15,13 +15,14 @@ // liblog_sources = [ "config_write.c", "log_event_list.c", "log_event_write.c", "logger_write.c", "config_write.c", "logger_name.c", "logger_lock.c", "log_ratelimit.cpp", "logger_lock.c", "logger_name.c", "logger_write.c", "logprint.c", ] liblog_host_sources = [ "fake_log_device.c", Loading @@ -32,7 +33,6 @@ liblog_target_sources = [ "config_read.c", "log_time.cpp", "properties.c", "logprint.c", "pmsg_reader.c", "pmsg_writer.c", "logd_reader.c", Loading liblog/fake_log_device.c +6 −1 Original line number Diff line number Diff line Loading @@ -612,7 +612,12 @@ static ssize_t logWritev(int fd, const struct iovec* vector, int count) bail: unlock(); return vector[0].iov_len + vector[1].iov_len + vector[2].iov_len; int len = 0; for (i = 0; i < count; ++i) { len += vector[i].iov_len; } return len; error: unlock(); return -1; Loading liblog/fake_writer.c +25 −3 Original line number Diff line number Diff line Loading @@ -46,9 +46,19 @@ static int fakeOpen() { int i; for (i = 0; i < LOG_ID_MAX; i++) { char buf[sizeof("/dev/log_security")]; /* * Known maximum size string, plus an 8 character margin to deal with * possible independent changes to android_log_id_to_name(). */ char buf[sizeof("/dev/log_security") + 8]; if (logFds[i] >= 0) { continue; } snprintf(buf, sizeof(buf), "/dev/log_%s", android_log_id_to_name(i)); logFds[i] = fakeLogOpen(buf, O_WRONLY); if (logFds[i] < 0) { fprintf(stderr, "fakeLogOpen(%s, O_WRONLY) failed\n", buf); } } return 0; } Loading @@ -66,16 +76,28 @@ static int fakeWrite(log_id_t log_id, struct timespec *ts __unused, struct iovec *vec, size_t nr) { ssize_t ret; int logFd; size_t i; int logFd, len; if (/*(int)log_id >= 0 &&*/ (int)log_id >= (int)LOG_ID_MAX) { return -EBADF; return -EINVAL; } len = 0; for (i = 0; i < nr; ++i) { len += vec[i].iov_len; } if (len > LOGGER_ENTRY_MAX_PAYLOAD) { len = LOGGER_ENTRY_MAX_PAYLOAD; } logFd = logFds[(int)log_id]; ret = TEMP_FAILURE_RETRY(fakeLogWritev(logFd, vec, nr)); if (ret < 0) { ret = -errno; } else if (ret > len) { ret = len; } return ret; Loading liblog/include/log/log_radio.h +4 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,10 @@ /* --------------------------------------------------------------------- */ #ifndef __predict_false #define __predict_false(exp) __builtin_expect((exp) != 0, 0) #endif /* * Simplified macro to send a verbose radio log message using current LOG_TAG. */ Loading liblog/include/log/log_read.h +4 −0 Original line number Diff line number Diff line Loading @@ -251,7 +251,11 @@ int android_logger_set_prune_list(struct logger_list* logger_list, #define ANDROID_LOG_WRONLY O_WRONLY #define ANDROID_LOG_RDWR O_RDWR #define ANDROID_LOG_ACCMODE O_ACCMODE #ifndef O_NONBLOCK #define ANDROID_LOG_NONBLOCK 0x00000800 #else #define ANDROID_LOG_NONBLOCK O_NONBLOCK #endif #if __ANDROID_USE_LIBLOG_READER_INTERFACE > 2 #define ANDROID_LOG_WRAP 0x40000000 /* Block until buffer about to wrap */ #define ANDROID_LOG_WRAP_DEFAULT_TIMEOUT 7200 /* 2 hour default */ Loading Loading
liblog/Android.bp +5 −5 Original line number Diff line number Diff line Loading @@ -15,13 +15,14 @@ // liblog_sources = [ "config_write.c", "log_event_list.c", "log_event_write.c", "logger_write.c", "config_write.c", "logger_name.c", "logger_lock.c", "log_ratelimit.cpp", "logger_lock.c", "logger_name.c", "logger_write.c", "logprint.c", ] liblog_host_sources = [ "fake_log_device.c", Loading @@ -32,7 +33,6 @@ liblog_target_sources = [ "config_read.c", "log_time.cpp", "properties.c", "logprint.c", "pmsg_reader.c", "pmsg_writer.c", "logd_reader.c", Loading
liblog/fake_log_device.c +6 −1 Original line number Diff line number Diff line Loading @@ -612,7 +612,12 @@ static ssize_t logWritev(int fd, const struct iovec* vector, int count) bail: unlock(); return vector[0].iov_len + vector[1].iov_len + vector[2].iov_len; int len = 0; for (i = 0; i < count; ++i) { len += vector[i].iov_len; } return len; error: unlock(); return -1; Loading
liblog/fake_writer.c +25 −3 Original line number Diff line number Diff line Loading @@ -46,9 +46,19 @@ static int fakeOpen() { int i; for (i = 0; i < LOG_ID_MAX; i++) { char buf[sizeof("/dev/log_security")]; /* * Known maximum size string, plus an 8 character margin to deal with * possible independent changes to android_log_id_to_name(). */ char buf[sizeof("/dev/log_security") + 8]; if (logFds[i] >= 0) { continue; } snprintf(buf, sizeof(buf), "/dev/log_%s", android_log_id_to_name(i)); logFds[i] = fakeLogOpen(buf, O_WRONLY); if (logFds[i] < 0) { fprintf(stderr, "fakeLogOpen(%s, O_WRONLY) failed\n", buf); } } return 0; } Loading @@ -66,16 +76,28 @@ static int fakeWrite(log_id_t log_id, struct timespec *ts __unused, struct iovec *vec, size_t nr) { ssize_t ret; int logFd; size_t i; int logFd, len; if (/*(int)log_id >= 0 &&*/ (int)log_id >= (int)LOG_ID_MAX) { return -EBADF; return -EINVAL; } len = 0; for (i = 0; i < nr; ++i) { len += vec[i].iov_len; } if (len > LOGGER_ENTRY_MAX_PAYLOAD) { len = LOGGER_ENTRY_MAX_PAYLOAD; } logFd = logFds[(int)log_id]; ret = TEMP_FAILURE_RETRY(fakeLogWritev(logFd, vec, nr)); if (ret < 0) { ret = -errno; } else if (ret > len) { ret = len; } return ret; Loading
liblog/include/log/log_radio.h +4 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,10 @@ /* --------------------------------------------------------------------- */ #ifndef __predict_false #define __predict_false(exp) __builtin_expect((exp) != 0, 0) #endif /* * Simplified macro to send a verbose radio log message using current LOG_TAG. */ Loading
liblog/include/log/log_read.h +4 −0 Original line number Diff line number Diff line Loading @@ -251,7 +251,11 @@ int android_logger_set_prune_list(struct logger_list* logger_list, #define ANDROID_LOG_WRONLY O_WRONLY #define ANDROID_LOG_RDWR O_RDWR #define ANDROID_LOG_ACCMODE O_ACCMODE #ifndef O_NONBLOCK #define ANDROID_LOG_NONBLOCK 0x00000800 #else #define ANDROID_LOG_NONBLOCK O_NONBLOCK #endif #if __ANDROID_USE_LIBLOG_READER_INTERFACE > 2 #define ANDROID_LOG_WRAP 0x40000000 /* Block until buffer about to wrap */ #define ANDROID_LOG_WRAP_DEFAULT_TIMEOUT 7200 /* 2 hour default */ Loading