summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn2014-03-20 18:09:38 -0500
committerMark Salyzyn2014-03-21 12:37:44 -0500
commitb992d0d7d34bed62fd16151a68d60d58cc8003ef (patch)
tree732d35cc0dd4eff9f99f61261e760595cbb75794 /logd/LogListener.cpp
parent5ad986ab5690291422f86c03c3fe71a1c50faf40 (diff)
downloadplatform-system-core-b992d0d7d34bed62fd16151a68d60d58cc8003ef.tar.gz
platform-system-core-b992d0d7d34bed62fd16151a68d60d58cc8003ef.tar.xz
platform-system-core-b992d0d7d34bed62fd16151a68d60d58cc8003ef.zip
logd: liblog: Thread IDs missing from logcat -v thread
- stuff caller's thread id into the packet. Bug: 13568206 Change-Id: I02d0cdf9b1d9e839ff8969f591db42dfe6e4cc95
Diffstat (limited to 'logd/LogListener.cpp')
-rw-r--r--logd/LogListener.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/logd/LogListener.cpp b/logd/LogListener.cpp
index 2aa2ebb00..bef2097da 100644
--- a/logd/LogListener.cpp
+++ b/logd/LogListener.cpp
@@ -50,7 +50,7 @@ bool LogListener::onDataAvailable(SocketClient *cli) {
50 int socket = cli->getSocket(); 50 int socket = cli->getSocket();
51 51
52 ssize_t n = recvmsg(socket, &hdr, 0); 52 ssize_t n = recvmsg(socket, &hdr, 0);
53 if (n <= (ssize_t) sizeof_log_id_t) { 53 if (n <= (sizeof_log_id_t + sizeof(uint16_t) + sizeof(log_time))) {
54 return false; 54 return false;
55 } 55 }
56 56
@@ -82,17 +82,22 @@ bool LogListener::onDataAvailable(SocketClient *cli) {
82 if (log_id < 0 || log_id >= LOG_ID_MAX) { 82 if (log_id < 0 || log_id >= LOG_ID_MAX) {
83 return false; 83 return false;
84 } 84 }
85
86 char *msg = ((char *)buffer) + sizeof_log_id_t; 85 char *msg = ((char *)buffer) + sizeof_log_id_t;
87 n -= sizeof_log_id_t; 86 n -= sizeof_log_id_t;
88 87
88 // second element is the thread id of the caller
89 pid_t tid = (pid_t) *((uint16_t *) msg);
90 msg += sizeof(uint16_t);
91 n -= sizeof(uint16_t);
92
93 // third element is the realtime at point of caller
89 log_time realtime(msg); 94 log_time realtime(msg);
90 msg += sizeof(log_time); 95 msg += sizeof(log_time);
91 n -= sizeof(log_time); 96 n -= sizeof(log_time);
92 97
93 unsigned short len = n; 98 unsigned short len = n;
94 if (len == n) { 99 if (len == n) {
95 logbuf->log(log_id, realtime, cred->uid, cred->pid, msg, len); 100 logbuf->log(log_id, realtime, cred->uid, cred->pid, tid, msg, len);
96 reader->notifyNewLog(); 101 reader->notifyNewLog();
97 } 102 }
98 103