Merge "Show names of processes killed by KillProcessesWithOpenFiles()" am: 93dd933d85

Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1697789

Change-Id: Ifc538a3c7cee0df30b727b08333f2e037011656d
This commit is contained in:
Treehugger Robot 2021-05-11 20:39:27 +00:00 committed by Automerger Merge Worker
commit 274804863c

View file

@ -175,7 +175,15 @@ int KillProcessesWithOpenFiles(const std::string& prefix, int signal, bool killF
}
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);
}
}