Merge "Show names of processes killed by KillProcessesWithOpenFiles()" am: 93dd933d85 am: 274804863c am: c591e3d68f
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/1697789
Change-Id: I80cf3cf6b9d4e5e7f0ac32b0230cd9b6418cd047
diff --git a/Process.cpp b/Process.cpp
index 79fe15d..c1d55ee 100644
--- a/Process.cpp
+++ b/Process.cpp
@@ -175,7 +175,15 @@
}
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);
}
}