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

Aaron LI aly at crater.dragonflybsd.org
Sat Feb 11 00:05:26 PST 2023


commit 0c06faee8af4f4273e13d7a2630e104cc2ff5faa
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/0c06faee8af4f4273e13d7a2630e104cc2ff5faa


-- 
DragonFly BSD source repository


More information about the Commits mailing list