Subject: bin/7025: top output is not sorted by cpu value on alpha
To: None <gnats-bugs@gnats.netbsd.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: netbsd-bugs
Date: 02/21/1999 14:00:20
>Number:         7025
>Category:       bin
>Synopsis:       top output is not sorted by cpu value on alpha
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 20 21:05:00 1999
>Last-Modified:
>Originator:     Izumi Tsutsui
>Organization:
Izumi Tsutsui	Himeji City, Japan
>Release:        NetBSD-current source supped on 19990219
>Environment:
NetBSD devonair 1.3I NetBSD 1.3I (DEVONAIR) #15: Sat Feb 20 23:48:10 JST 1999 \
    tsutsui@devonair:/usr/src/sys/arch/alpha/compile/DEVONAIR alpha

>Description:
On alpha, outputs of top are not sorted by cpu value even though
they can be sorted by res, size and time sort keys.

>How-To-Repeat:
Just type `top -s0' on alpha. Running top does not appear at the top.

>Fix:
Apply attached patch. type of p_pctcpu is u_int32_t,
and type of lresult is pctcpu which is typedef'ed as long.

--- machine/m_netbsd13.c.orig	Mon Feb 15 09:30:26 1999
+++ machine/m_netbsd13.c	Sun Feb 21 03:31:31 1999
@@ -664,7 +664,7 @@
  */
 
 #define ORDERKEY_PCTCPU \
-    if (lresult = PP(p2, p_pctcpu) - PP(p1, p_pctcpu),\
+    if (lresult = (pctcpu)PP(p2, p_pctcpu) - PP(p1, p_pctcpu),\
 	(result = lresult > 0 ? 1 : lresult < 0 ? -1 : 0) == 0)
 
 #define ORDERKEY_CPTICKS \

>Audit-Trail:
>Unformatted: