Store client pid within LogEvent
LogEvent now stores the client's pid (the pid defaults to -1 if it is
not known). This pid will be used internally for permission checks.
This CL also fixes a bug where uids of -1 were being treated incorrectly
as unsigned ints.
Test: bit statsd_test:* (passes when the new socket schema flag is
flipped on).
Change-Id: I8b6b202bb719b79646282764f82466c8065031b3
diff --git a/cmds/statsd/src/external/StatsCallbackPuller.cpp b/cmds/statsd/src/external/StatsCallbackPuller.cpp
index 6257771..1a11f0e 100644
--- a/cmds/statsd/src/external/StatsCallbackPuller.cpp
+++ b/cmds/statsd/src/external/StatsCallbackPuller.cpp
@@ -68,7 +68,7 @@
for (const StatsEventParcel& parcel: output) {
shared_ptr<LogEvent> event = make_shared<LogEvent>(
const_cast<uint8_t*>(parcel.buffer.data()), parcel.buffer.size(),
- /*uid=*/-1, /*useNewSchema=*/true);
+ /*uid=*/-1, /*pid=*/-1, /*useNewSchema=*/true);
sharedData->push_back(event);
}
*pullSuccess = success;