logd: statistics per-pid filter
Primarily gives access to the Chattiest TIDs and TAGs
associated with a pid.
Has a secondary effect of allowing us to pull out the
command line, comm and in some cases the associated
PACKAGE for a specific pid while the logs are still
present even if the executable is gone.
Bug: 26029733
Bug: 21615139
Change-Id: I1ea63165a680a9318360579b70b1512078ed5682
diff --git a/liblog/log_read.c b/liblog/log_read.c
index eb44b29..1aff272 100644
--- a/liblog/log_read.c
+++ b/liblog/log_read.c
@@ -501,6 +501,14 @@
remaining -= n;
cp += n;
}
+
+ if (logger_list->pid) {
+ n = snprintf(cp, remaining, " pid=%u", logger_list->pid);
+ n = min(n, remaining);
+ remaining -= n;
+ cp += n;
+ }
+
return send_log_msg(NULL, NULL, buf, len);
}