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
This commit is contained in:
parent
ef439c5367
commit
c78ae60087
1 changed files with 9 additions and 1 deletions
10
Process.cpp
10
Process.cpp
|
@ -175,7 +175,15 @@ int KillProcessesWithOpenFiles(const std::string& prefix, int signal, bool killF
|
||||||
}
|
}
|
||||||
if (signal != 0) {
|
if (signal != 0) {
|
||||||
for (const auto& pid : pids) {
|
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);
|
kill(pid, signal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue