diff options
author | Mark Salyzyn <salyzyn@google.com> | 2014-04-07 07:15:33 -0700 |
---|---|---|
committer | Mark Salyzyn <salyzyn@google.com> | 2014-04-07 10:51:00 -0700 |
commit | 4ba0387af5acc52e43e4004ccb4c46b8bc700349 (patch) | |
tree | c11aec8cddbe605b0b7ae8da404a570faeede694 /logd/LogStatistics.cpp | |
parent | 9a03863e88da99ba010342c874252089dd771f7f (diff) | |
download | core-4ba0387af5acc52e43e4004ccb4c46b8bc700349.tar.gz core-4ba0387af5acc52e43e4004ccb4c46b8bc700349.tar.bz2 core-4ba0387af5acc52e43e4004ccb4c46b8bc700349.zip |
logd: Add pidToUid helper
Change-Id: I23ebae1957c027bff6cbc2573a227bf0c44c08a2
Diffstat (limited to 'logd/LogStatistics.cpp')
-rw-r--r-- | logd/LogStatistics.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/logd/LogStatistics.cpp b/logd/LogStatistics.cpp index 99c376acd..82a3a904b 100644 --- a/logd/LogStatistics.cpp +++ b/logd/LogStatistics.cpp @@ -728,3 +728,20 @@ void LogStatistics::format(char **buf, *buf = strdup(string.string()); } + +uid_t LogStatistics::pidToUid(pid_t pid) { + log_id_for_each(i) { + LidStatistics &l = id(i); + UidStatisticsCollection::iterator iu; + for (iu = l.begin(); iu != l.end(); ++iu) { + UidStatistics &u = *(*iu); + PidStatisticsCollection::iterator ip; + for (ip = u.begin(); ip != u.end(); ++ip) { + if ((*ip)->getPid() == pid) { + return u.getUid(); + } + } + } + } + return getuid(); // associate this with the logger +} |