Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 444058 Details for
Bug 591762
sys-process/procps: top: memory based fields goof on >1G
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
update
2-scalemem-fix.patch (text/plain), 1.45 KB, created by
Raymond Jennings
on 2016-08-24 20:38:03 UTC
(
hide
)
Description:
update
Filename:
MIME Type:
Creator:
Raymond Jennings
Created:
2016-08-24 20:38:03 UTC
Size:
1.45 KB
patch
obsolete
>diff --git a/top/top.c b/top/top.c >index 9d0e56a..1df0588 100644 >--- a/top/top.c >+++ b/top/top.c >@@ -1552,15 +1552,40 @@ static const char *scale_mem (int target, unsigned long num, int width, int just > if (Rc.zero_suppress && 0 >= num) > goto end_justifies; > >+ i = SK_Kb; >+ psfx = Scaled_sfxtab; > scaled_num = num; >- for (i = SK_Kb, psfx = Scaled_sfxtab; i < SK_Eb; psfx++, i++) { >- if (i >= target >- && (width >= snprintf(buf, sizeof(buf), fmttab[i], scaled_num, *psfx))) >- goto end_justifies; >+ >+ // apply the minimum scaling >+ while (i < target) { >+ psfx++; >+ i++; > scaled_num /= 1024.0; > } > >- // well shoot, this outta' fit... >+ // get it to fit in the buffer >+ while (i <= SK_Eb) { >+ // first try lopping off digits >+ static char fmt[SMLBUFSIZ]; >+ int precision = (i == 0 ? 0 : 3); >+ >+ do { >+ snprintf(fmt, sizeof(fmt), "%%.%uf%%c", precision); >+ if (snprintf(buf, sizeof(buf), fmt, scaled_num, (i > 0 ? *psfx : '\0')) <= width) { >+ goto end_justifies; // it fits! >+ } >+ // drop a digit off the end and try again >+ precision--; >+ } while (precision > 0); >+ >+ // dropped all digits after decimal, still too big >+ // scale it and try again. >+ psfx++; >+ i++; >+ scaled_num /= 1024.0; >+ } >+ >+ // everything failed > snprintf(buf, sizeof(buf), "?"); > end_justifies: > return justify_pad(buf, width, justr);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 591762
:
443826
|
443834
|
444056
| 444058