diff options
Diffstat (limited to 'logd')
| -rw-r--r-- | logd/LogKlog.cpp | 29 | ||||
| -rw-r--r-- | logd/LogKlog.h | 2 |
2 files changed, 28 insertions, 3 deletions
diff --git a/logd/LogKlog.cpp b/logd/LogKlog.cpp index fe0884600..707353562 100644 --- a/logd/LogKlog.cpp +++ b/logd/LogKlog.cpp @@ -402,7 +402,32 @@ void LogKlog::sniffTime(log_time &now, } } -pid_t LogKlog::sniffPid(const char *cp, size_t len) { +pid_t LogKlog::sniffPid(const char **buf, size_t len) { + const char *cp = *buf; + // HTC kernels with modified printk "c0 1648 " + if ((len > 9) && + (cp[0] == 'c') && + isdigit(cp[1]) && + (isdigit(cp[2]) || (cp[2] == ' ')) && + (cp[3] == ' ')) { + bool gotDigit = false; + int i; + for (i = 4; i < 9; ++i) { + if (isdigit(cp[i])) { + gotDigit = true; + } else if (gotDigit || (cp[i] != ' ')) { + break; + } + } + if ((i == 9) && (cp[i] == ' ')) { + int pid = 0; + char dummy; + if (sscanf(cp + 4, "%d%c", &pid, &dummy) == 2) { + *buf = cp + 10; // skip-it-all + return pid; + } + } + } while (len) { // Mediatek kernels with modified printk if (*cp == '[') { @@ -588,7 +613,7 @@ int LogKlog::log(const char *buf, size_t len) { } // Parse pid, tid and uid - const pid_t pid = sniffPid(p, len - (p - buf)); + const pid_t pid = sniffPid(&p, len - (p - buf)); const pid_t tid = pid; uid_t uid = AID_ROOT; if (pid) { diff --git a/logd/LogKlog.h b/logd/LogKlog.h index d81243688..11d88af18 100644 --- a/logd/LogKlog.h +++ b/logd/LogKlog.h @@ -51,7 +51,7 @@ public: protected: void sniffTime(log_time &now, const char **buf, size_t len, bool reverse); - pid_t sniffPid(const char *buf, size_t len); + pid_t sniffPid(const char **buf, size_t len); void calculateCorrection(const log_time &monotonic, const char *real_string, size_t len); virtual bool onDataAvailable(SocketClient *cli); |
