diff options
author | Jim Warner <james.warner@comcast.net> | 2021-12-14 00:00:00 -0600 |
---|---|---|
committer | Craig Small <csmall@dropbear.xyz> | 2021-12-16 20:50:07 +1100 |
commit | 957b74292f8a77595bc2c7b451e2451337b9553a (patch) | |
tree | 6e4ef6497beb0074d21e9e7e1e7aa0d28a4a7a44 | |
parent | aeb35b18dac71f895915b09b4b63df1765b3c03b (diff) | |
download | procps-ng-957b74292f8a77595bc2c7b451e2451337b9553a.tar.gz |
ps,top: convert 'PIDS_PROCESSOR' into a signed integer
Not only does that library tweak help to simplify some
top code, but now that ps snprintf fmtstr will finally
be accurate. That is two birdies with a single pebble!
Signed-off-by: Jim Warner <james.warner@comcast.net>
-rw-r--r-- | ps/output.c | 2 | ||||
-rw-r--r-- | top/top.c | 7 |
2 files changed, 3 insertions, 6 deletions
diff --git a/ps/output.c b/ps/output.c index bd79d9b..73719a4 100644 --- a/ps/output.c +++ b/ps/output.c @@ -1013,7 +1013,7 @@ setREL1(RSS_RLIM) /* should print leading tilde ('~') if process is bound to the CPU */ static int pr_psr(char *restrict const outbuf, const proc_t *restrict const pp){ setREL1(PROCESSOR) - return snprintf(outbuf, COLWID, "%d", rSv(PROCESSOR, u_int, pp)); + return snprintf(outbuf, COLWID, "%d", rSv(PROCESSOR, s_int, pp)); } static int pr_pss(char *restrict const outbuf, const proc_t *restrict const pp){ @@ -1703,7 +1703,7 @@ static struct { { 3, -1, A_right, PIDS_PRIORITY }, // s_int EU_PRI { 3, -1, A_right, PIDS_NICE }, // s_int EU_NCE { 3, -1, A_right, PIDS_NLWP }, // s_int EU_THD - { 0, -1, A_right, PIDS_PROCESSOR }, // u_int EU_CPN + { 0, -1, A_right, PIDS_PROCESSOR }, // s_int EU_CPN { 5, -1, A_right, PIDS_TICS_ALL_DELTA }, // u_int EU_CPU { 6, -1, A_right, PIDS_TICS_ALL }, // ull_int EU_TME { 9, -1, A_right, PIDS_TICS_ALL }, // ull_int EU_TM2 @@ -6029,6 +6029,7 @@ static const char *task_show (const WIN_t *q, int idx) { break; /* s_int, make_num without auto width */ case EU_AGI: // PIDS_AUTOGRP_ID + case EU_CPN: // PIDS_PROCESSOR case EU_NMA: // PIDS_PROCESSOR_NODE case EU_PGD: // PIDS_ID_PGRP case EU_PID: // PIDS_ID_PID @@ -6081,10 +6082,6 @@ static const char *task_show (const WIN_t *q, int idx) { cp = scale_pcnt(u, W, Jn); } break; - /* u_int, make_num without auto width */ - case EU_CPN: // PIDS_PROCESSOR - cp = make_num(rSv(EU_CPN, u_int), W, Jn, AUTOX_NO, 0); - break; /* u_int, make_num with auto width */ case EU_GID: // PIDS_ID_EGID case EU_UED: // PIDS_ID_EUID |