Show names of processes killed by KillProcessesWithOpenFiles()

Otherwise only the pids are shown, and it's hard to tell which
processes actually got killed.

Bug: 187231646
Change-Id: Icccf60d0ad4439d702f36ace31abe092df1c69c2
(cherry picked from commit c78ae6008713ab2a1d64d0831ac9e139ed49ae10)
Bug: 189250652
Merged-In: Icccf60d0ad4439d702f36ace31abe092df1c69c2
gugelfrei
Eric Biggers 3 years ago committed by derfelot
parent 748ecf7d7a
commit 6d5b7f7303
No known key found for this signature in database
GPG Key ID: C4280F8158ACB026

@ -169,7 +169,15 @@ int KillProcessesWithOpenFiles(const std::string& prefix, int signal) {
}
if (signal != 0) {
for (const auto& pid : pids) {
LOG(WARNING) << "Sending " << strsignal(signal) << " to " << pid;
std::string comm;
android::base::ReadFileToString(StringPrintf("/proc/%d/comm", pid), &comm);
comm = android::base::Trim(comm);
std::string exe;
android::base::Readlink(StringPrintf("/proc/%d/exe", pid), &exe);
LOG(WARNING) << "Sending " << strsignal(signal) << " to pid " << pid << " (" << comm
<< ", " << exe << ")";
kill(pid, signal);
}
}

Loading…
Cancel
Save