Don't keep record of dead processes in top.*
We got too clever in the review of
https://software.frc971.org/gerrit/c/971-Robot-Code/+/5892 and thought
we could escape a certain check. Instead, we ended up forgetting to drop
dead processes...
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
Change-Id: Ia4a993c840500623592b336d049526aaeb14d290
diff --git a/aos/util/top.cc b/aos/util/top.cc
index 8a0019d..22d67c8 100644
--- a/aos/util/top.cc
+++ b/aos/util/top.cc
@@ -151,6 +151,11 @@
aos::monotonic_clock::time_point now = event_loop_->monotonic_now();
// Get all the processes that we *might* care about.
std::set<pid_t> pids = pids_to_track_;
+ // Ensure that we check on the status of every process that we are already
+ // tracking.
+ for (const auto & reading : readings_) {
+ pids.insert(reading.first);
+ }
if (track_all_) {
DIR *const dir = opendir("/proc");
if (dir == nullptr) {