[DragonFlyBSD - Bug #585] (Closed) top: output correct process states after lwp changes

bugtracker-admin at leaf.dragonflybsd.org bugtracker-admin at leaf.dragonflybsd.org
Wed Jan 14 16:56:32 PST 2015


Issue #585 has been updated by tuxillo.

Description updated
Category set to Userland
Status changed from New to Closed
Assignee changed from corecode to tuxillo
Target version set to 4.2.x

Hi,

Fixed in the related revision.

Cheers,
Antonio Huete

----------------------------------------
Bug #585: top: output correct process states after lwp changes
http://bugs.dragonflybsd.org/issues/585#change-12444

* Author: sq
* Status: Closed
* Priority: Normal
* Assignee: tuxillo
* Category: Userland
* Target version: 4.2.x
----------------------------------------
Good time of day.

As defined in sys/proc.h process may have one of this states:

enum procstat {
        SIDL = 1,
        SACTIVE = 2,
        SSTOP = 3,
        SZOMB = 4,
};

For display summary process info 'top' use procstatenames array with values:
"", " starting, ", " running, ", " sleeping, ", " stopped, ", " zombie, "
which are not mapped to process's states.

There is a patch fo fix this promblem. It also display processes with
sleeping lwp as sleeping, for example:

37 processes:  1 running, 36 sleeping

But is more better mark process as sleeping only if _all_ of this lwps
are in sleeping state.

--- /usr/src/usr.bin/top/machine.c.orig 2007-03-22 17:03:23.000000000 +0300
+++ /usr/src/usr.bin/top/machine.c      2007-03-22 18:16:48.000000000 +0300
@@ -138,8 +138,8 @@

 int process_states[6];
 char *procstatenames[] = {
-    "", " starting, ", " running, ", " sleeping, ", " stopped, ",
-    " zombie, ",
+    "", " starting, ", " running, ", " stopped, ", " zombie, ",
+    " sleeping, ",
     NULL
 };

@@ -501,6 +501,8 @@
            (show_system || ((PP(pp, flags) & P_SYSTEM) == 0)))))
        {
            total_procs++;
+           if (LP(pp, stat) == LSSLEEP)
+               PP(pp, stat) = SZOMB + 1;
            process_states[(unsigned char) PP(pp, stat)]++;
            if ((show_threads && (LP(pp, pid) == 0)) ||
                (!show_only_threads && PP(pp, stat) != SZOMB &&



-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account



More information about the Bugs mailing list