summaryrefslogtreecommitdiffstats
path: root/logd/LogStatistics.cpp
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2014-09-21 14:22:18 -0700
committerMark Salyzyn <salyzyn@google.com>2014-10-06 22:43:46 +0000
commitdf5aa61f05ccbef441cf8b024d4bbc1b717451f9 (patch)
treeb7d2fc8bb6b6fd861b936d4f3f066029ec30d6c8 /logd/LogStatistics.cpp
parent09dc063319d017625fbde0fd380ed677b680415e (diff)
downloadsystem_core-df5aa61f05ccbef441cf8b024d4bbc1b717451f9.tar.gz
system_core-df5aa61f05ccbef441cf8b024d4bbc1b717451f9.tar.bz2
system_core-df5aa61f05ccbef441cf8b024d4bbc1b717451f9.zip
logd: kill(0,0) issue
- Recognize pid=0 as special case (kernel or pre-init sourced) and refrain from treating it in the general case. Bug: 17526159 Change-Id: I74796043ac34753c6dd10018719ebc0bcd94e012
Diffstat (limited to 'logd/LogStatistics.cpp')
-rw-r--r--logd/LogStatistics.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/logd/LogStatistics.cpp b/logd/LogStatistics.cpp
index baf15fe25..1305b0ac9 100644
--- a/logd/LogStatistics.cpp
+++ b/logd/LogStatistics.cpp
@@ -54,6 +54,9 @@ bool PidStatistics::pidGone() {
if (mGone || (pid == gone)) {
return true;
}
+ if (pid == 0) {
+ return false;
+ }
if (kill(pid, 0) && (errno != EPERM)) {
mGone = true;
return true;
@@ -92,7 +95,9 @@ void PidStatistics::addTotal(size_t size, size_t element) {
// which debuggerd prints as a process is crashing.
char *PidStatistics::pidToName(pid_t pid) {
char *retval = NULL;
- if (pid != gone) {
+ if (pid == 0) { // special case from auditd for kernel
+ retval = strdup("logd.auditd");
+ } else if (pid != gone) {
char buffer[512];
snprintf(buffer, sizeof(buffer), "/proc/%u/cmdline", pid);
int fd = open(buffer, O_RDONLY);