procps/0032-top-do-not-lie-about-purported-alphabetical-ordering.patch

64 lines
2.0 KiB
Diff

Based on 57ab5eed15a577fda6ce24753948ab29f30de2d4 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Fri, 29 Nov 2013 00:00:00 -0600
Subject: [PATCH] top: do not lie about purported alphabetical orderings
Excluding those special X_XON/X_XOF enums, which might
not even be present, restore strict collating order of
all the case labels in the task_show switch statement.
Also, adjust a few sort callbacks for the same reason.
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git top/top.c top/top.c
index 70eaa4a..59dcb3f 100644
--- top/top.c
+++ top/top.c
@@ -246,9 +246,9 @@ SCB_NUM1(CPU, pcpu)
SCB_NUM1(DAT, drs)
SCB_NUM1(DRT, dt)
SCB_STRS(ENV, environ[0])
-SCB_NUM1(FLG, flags)
SCB_NUM1(FL1, maj_flt)
SCB_NUM1(FL2, min_flt)
+SCB_NUM1(FLG, flags)
SCB_NUM1(FV1, maj_delta)
SCB_NUM1(FV2, min_delta)
SCB_NUMx(GID, egid)
@@ -5220,15 +5220,15 @@ static const char *task_show (const WIN_t *q, const proc_t *p) {
case P_ENV:
makeVAR(p->environ[0]);
break;
- case P_FLG:
- cp = make_str(hex_make(p->flags, 1), W, Js, AUTOX_NO);
- break;
case P_FL1:
cp = scale_num(p->maj_flt, W, Jn);
break;
case P_FL2:
cp = scale_num(p->min_flt, W, Jn);
break;
+ case P_FLG:
+ cp = make_str(hex_make(p->flags, 1), W, Js, AUTOX_NO);
+ break;
case P_FV1:
cp = scale_num(p->maj_delta, W, Jn);
break;
@@ -5308,8 +5308,8 @@ static const char *task_show (const WIN_t *q, const proc_t *p) {
case P_THD:
cp = make_num(p->nlwp, W, Jn, AUTOX_NO);
break;
- case P_TME:
case P_TM2:
+ case P_TME:
{ TIC_t t = p->utime + p->stime;
if (CHKw(q, Show_CTIMES)) t += (p->cutime + p->cstime);
cp = scale_tics(t, W, Jn);
--
1.7.9.2