Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/nathanw_sa]: src/bin/ps Consider LWPs in LSSUSPENDED as a worst-case for...



details:   https://anonhg.NetBSD.org/src/rev/1330c9cc1a5e
branches:  nathanw_sa
changeset: 506060:1330c9cc1a5e
user:      nathanw <nathanw%NetBSD.org@localhost>
date:      Fri Jul 26 00:01:48 2002 +0000

description:
Consider LWPs in LSSUSPENDED as a worst-case for a representative LWP.

diffstat:

 bin/ps/ps.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (55 lines):

diff -r 2c806d4f8a97 -r 1330c9cc1a5e bin/ps/ps.c
--- a/bin/ps/ps.c       Thu Jul 25 22:32:40 2002 +0000
+++ b/bin/ps/ps.c       Fri Jul 26 00:01:48 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ps.c,v 1.46.2.8 2002/06/06 17:08:04 nathanw Exp $      */
+/*     $NetBSD: ps.c,v 1.46.2.9 2002/07/26 00:01:48 nathanw Exp $      */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
 #if 0
 static char sccsid[] = "@(#)ps.c       8.4 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: ps.c,v 1.46.2.8 2002/06/06 17:08:04 nathanw Exp $");
+__RCSID("$NetBSD: ps.c,v 1.46.2.9 2002/07/26 00:01:48 nathanw Exp $");
 #endif
 #endif /* not lint */
 
@@ -470,7 +470,7 @@
        struct kinfo_lwp *kl;
        int nlwps;
 {
-       int i, onproc, running, sleeping;
+       int i, onproc, running, sleeping, suspended;
        static struct kinfo_lwp zero_lwp;
 
        if (kl == 0)
@@ -490,7 +490,7 @@
                break;
        case SACTIVE:
                /* Pick the most live LWP */
-               onproc = running = sleeping = -1;
+               onproc = running = sleeping = suspended = -1;
                for (i = 0; i < nlwps; i++) {
                        switch (kl[i].l_stat) {
                        case LSONPROC:
@@ -502,6 +502,9 @@
                        case LSSLEEP:
                                sleeping = i;
                                break;
+                       case LSSUSPENDED:
+                               suspended = i;
+                               break;
                        }
                }
                if (onproc != -1)
@@ -510,6 +513,8 @@
                        return &kl[running];
                if (sleeping != -1)
                        return &kl[sleeping];
+               if (suspended != -1)
+                       return &kl[suspended];
                break;
        case SDEAD:
        case SZOMB:



Home | Main Index | Thread Index | Old Index