From 744d33af780d233e2cd95c20d4ec0a8c11968460 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sun, 11 Aug 2024 17:07:58 -0700 Subject: libvmon: remove pointless test on proc->stores proc->stores is always allocated as part of vmon_proc_t, so this can't possibly be NULL. IIRC an earlier form of libvmon allocated the stores array lazily once needed. --- src/libvmon/vmon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/libvmon/vmon.c b/src/libvmon/vmon.c index 05c2b3a..bb2cf3e 100644 --- a/src/libvmon/vmon.c +++ b/src/libvmon/vmon.c @@ -491,7 +491,8 @@ static int proc_follow_threads(vmon_t *vmon, vmon_proc_t *proc, vmon_proc_follow if (proc->is_thread) /* bypass following the threads of threads */ return SAMPLE_UNCHANGED; - if (!proc->stores || !proc->stores[VMON_STORE_PROC_STAT] || (((vmon_proc_stat_t *)proc->stores[VMON_STORE_PROC_STAT])->num_threads <= 1 && list_empty(&proc->threads))) + if (!proc->stores[VMON_STORE_PROC_STAT] || + (((vmon_proc_stat_t *)proc->stores[VMON_STORE_PROC_STAT])->num_threads <= 1 && list_empty(&proc->threads))) /* bypass following of threads if we either can't determine the number from the proc stat sample or if the sample says there's 1 or less (and an empty threads list, handling stale exited threads) */ /* XXX I'm not sure if this is always the right thing to do, there may be some situations where one could play games with clone() directly * and escape the monitoring library with a lone thread having had the main thread exit, leaving the count at 1 while having a process -- cgit v1.2.3