git: top(1): Fix count of process states

Aaron LI aly at crater.dragonflybsd.org
Sat Feb 11 00:04:46 PST 2023


commit 23c5b3d5e9a62c615eaf7332a43322cc56443052
Author: Aaron LI <aly at aaronly.me>
Date:   Thu Feb 9 18:29:28 2023 +0800

    top(1): Fix count of process states
    
    Previously, the 'active' (SACTIVE) process state includes the 'running'
    (LSRUN) state.  This caused the total process count was less than the
    sum of all process states.
    
    A process consists of one or more LWPs.  The process state (kp_stat)
    is more of a meta-state for the process, which can be:
    - SIDL: starting
    - SACTIVE: active
    - SSTOP: stopped
    - SZOMB: zombie
    - SCORE: about to die (performing a core dump)
    
    For an active process (SACTIVE), the LWP state (kp_lwp.kl_stat)
    represents the actual state, which can be:
    - LSRUN: running
    - LSSTOP: stopped
    - LSSLEEP: sleeping
    
    Explicitly check for all the above states and count them, and thus
    obtain the correct count of each process state.

Summary of changes:
 usr.bin/top/m_dragonfly.c | 63 ++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 54 insertions(+), 9 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/23c5b3d5e9a62c615eaf7332a43322cc56443052


-- 
DragonFly BSD source repository


More information about the Commits mailing list