logd: mLastWorstPidOFSystem crash
am: ab8ad62939
Change-Id: Ie19d2dabee0766cb8ae76cc27fe6e8dd5d325207
This commit is contained in:
commit
045bd50ca4
1 changed files with 12 additions and 2 deletions
|
|
@ -313,6 +313,9 @@ LogBufferElementCollection::iterator LogBuffer::erase(
|
||||||
LogBufferElement *element = *it;
|
LogBufferElement *element = *it;
|
||||||
log_id_t id = element->getLogId();
|
log_id_t id = element->getLogId();
|
||||||
|
|
||||||
|
// Remove iterator references in the various lists that will become stale
|
||||||
|
// after the element is erased from the main logging list.
|
||||||
|
|
||||||
{ // start of scope for uid found iterator
|
{ // start of scope for uid found iterator
|
||||||
LogBufferIteratorMap::iterator found =
|
LogBufferIteratorMap::iterator found =
|
||||||
mLastWorstUid[id].find(element->getUid());
|
mLastWorstUid[id].find(element->getUid());
|
||||||
|
|
@ -322,8 +325,8 @@ LogBufferElementCollection::iterator LogBuffer::erase(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element->getUid() == AID_SYSTEM) {
|
{ // start of scope for pid found iterator
|
||||||
// start of scope for pid found iterator
|
// element->getUid() may not be AID_SYSTEM for next-best-watermark.
|
||||||
LogBufferPidIteratorMap::iterator found =
|
LogBufferPidIteratorMap::iterator found =
|
||||||
mLastWorstPidOfSystem[id].find(element->getPid());
|
mLastWorstPidOfSystem[id].find(element->getPid());
|
||||||
if ((found != mLastWorstPidOfSystem[id].end())
|
if ((found != mLastWorstPidOfSystem[id].end())
|
||||||
|
|
@ -639,6 +642,7 @@ bool LogBuffer::prune(log_id_t id, unsigned long pruneRows, uid_t caller_uid) {
|
||||||
++it;
|
++it;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// below this point element->getLogId() == id
|
||||||
|
|
||||||
if (leading && (!mLastSet[id] || ((*mLast[id])->getLogId() != id))) {
|
if (leading && (!mLastSet[id] || ((*mLast[id])->getLogId() != id))) {
|
||||||
mLast[id] = it;
|
mLast[id] = it;
|
||||||
|
|
@ -691,6 +695,8 @@ bool LogBuffer::prune(log_id_t id, unsigned long pruneRows, uid_t caller_uid) {
|
||||||
&& ((!gc && (element->getPid() == worstPid))
|
&& ((!gc && (element->getPid() == worstPid))
|
||||||
|| (mLastWorstPidOfSystem[id].find(element->getPid())
|
|| (mLastWorstPidOfSystem[id].find(element->getPid())
|
||||||
== mLastWorstPidOfSystem[id].end()))) {
|
== mLastWorstPidOfSystem[id].end()))) {
|
||||||
|
// element->getUid() may not be AID_SYSTEM, next best
|
||||||
|
// watermark if current one empty.
|
||||||
mLastWorstPidOfSystem[id][element->getPid()] = it;
|
mLastWorstPidOfSystem[id][element->getPid()] = it;
|
||||||
}
|
}
|
||||||
if ((!gc && !worstPid && (element->getUid() == worst))
|
if ((!gc && !worstPid && (element->getUid() == worst))
|
||||||
|
|
@ -709,6 +715,8 @@ bool LogBuffer::prune(log_id_t id, unsigned long pruneRows, uid_t caller_uid) {
|
||||||
++it;
|
++it;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// key == worst below here
|
||||||
|
// If worstPid set, then element->getPid() == worstPid below here
|
||||||
|
|
||||||
pruneRows--;
|
pruneRows--;
|
||||||
if (pruneRows == 0) {
|
if (pruneRows == 0) {
|
||||||
|
|
@ -732,6 +740,8 @@ bool LogBuffer::prune(log_id_t id, unsigned long pruneRows, uid_t caller_uid) {
|
||||||
if (worstPid && (!gc
|
if (worstPid && (!gc
|
||||||
|| (mLastWorstPidOfSystem[id].find(worstPid)
|
|| (mLastWorstPidOfSystem[id].find(worstPid)
|
||||||
== mLastWorstPidOfSystem[id].end()))) {
|
== mLastWorstPidOfSystem[id].end()))) {
|
||||||
|
// element->getUid() may not be AID_SYSTEM, next best
|
||||||
|
// watermark if current one empty.
|
||||||
mLastWorstPidOfSystem[id][worstPid] = it;
|
mLastWorstPidOfSystem[id][worstPid] = it;
|
||||||
}
|
}
|
||||||
if ((!gc && !worstPid) || (mLastWorstUid[id].find(worst)
|
if ((!gc && !worstPid) || (mLastWorstUid[id].find(worst)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue