Merge "Kill its process group even if the given process is already dead" am: 763593e395 am: 2038ed868b
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2459289 Change-Id: I50fa7e0c4ee243a4e3a049be23781ecdc77f76ba Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
f38b8818e9
1 changed files with 9 additions and 12 deletions
|
|
@ -406,18 +406,15 @@ static int DoKillProcessGroupOnce(const char* cgroup, uid_t uid, int initialPid,
|
||||||
pids.emplace(pid);
|
pids.emplace(pid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (file_is_empty) {
|
if (!file_is_empty) {
|
||||||
// This happens when process is already dead
|
// Erase all pids that will be killed when we kill the process groups.
|
||||||
return 0;
|
for (auto it = pids.begin(); it != pids.end();) {
|
||||||
}
|
pid_t pgid = getpgid(*it);
|
||||||
|
if (pgids.count(pgid) == 1) {
|
||||||
// Erase all pids that will be killed when we kill the process groups.
|
it = pids.erase(it);
|
||||||
for (auto it = pids.begin(); it != pids.end();) {
|
} else {
|
||||||
pid_t pgid = getpgid(*it);
|
++it;
|
||||||
if (pgids.count(pgid) == 1) {
|
}
|
||||||
it = pids.erase(it);
|
|
||||||
} else {
|
|
||||||
++it;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue