am cce6c380: Merge "libc: Thread IDs missing from logcat -v thread"

* commit 'cce6c380d7c9574f823f5e038c28c793fdb55c58':
  libc: Thread IDs missing from logcat -v thread
This commit is contained in:
Mark Salyzyn 2014-03-21 20:16:58 +00:00 committed by Android Git Automerger
commit 508e255eff

View File

@ -494,24 +494,27 @@ static int __libc_write_log(int priority, const char* tag, const char* msg) {
return __libc_write_stderr(tag, msg);
}
iovec vec[5];
iovec vec[6];
char log_id = LOG_ID_MAIN;
vec[0].iov_base = &log_id;
vec[0].iov_len = sizeof(log_id);
uint16_t tid = gettid();
vec[1].iov_base = &tid;
vec[1].iov_len = sizeof(tid);
timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
log_time realtime_ts;
realtime_ts.tv_sec = ts.tv_sec;
realtime_ts.tv_nsec = ts.tv_nsec;
vec[1].iov_base = &realtime_ts;
vec[1].iov_len = sizeof(realtime_ts);
vec[2].iov_base = &realtime_ts;
vec[2].iov_len = sizeof(realtime_ts);
vec[2].iov_base = &priority;
vec[2].iov_len = 1;
vec[3].iov_base = const_cast<char*>(tag);
vec[3].iov_len = strlen(tag) + 1;
vec[4].iov_base = const_cast<char*>(msg);
vec[4].iov_len = strlen(msg) + 1;
vec[3].iov_base = &priority;
vec[3].iov_len = 1;
vec[4].iov_base = const_cast<char*>(tag);
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) {
@ -553,24 +556,27 @@ 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[5];
iovec vec[6];
char log_id = LOG_ID_EVENTS;
vec[0].iov_base = &log_id;
vec[0].iov_len = sizeof(log_id);
uint16_t tid = gettid();
vec[1].iov_base = &tid;
vec[1].iov_len = sizeof(tid);
timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
log_time realtime_ts;
realtime_ts.tv_sec = ts.tv_sec;
realtime_ts.tv_nsec = ts.tv_nsec;
vec[1].iov_base = &realtime_ts;
vec[1].iov_len = sizeof(realtime_ts);
vec[2].iov_base = &realtime_ts;
vec[2].iov_len = sizeof(realtime_ts);
vec[2].iov_base = &tag;
vec[2].iov_len = sizeof(tag);
vec[3].iov_base = &type;
vec[3].iov_len = sizeof(type);
vec[4].iov_base = const_cast<void*>(payload);
vec[4].iov_len = len;
vec[3].iov_base = &tag;
vec[3].iov_len = sizeof(tag);
vec[4].iov_base = &type;
vec[4].iov_len = sizeof(type);
vec[5].iov_base = const_cast<void*>(payload);
vec[5].iov_len = len;
int event_log_fd = __libc_open_log_socket();
#else