Backport upstream changes from newlib tree of procps to our procps (bsc#1181475)

OBS-URL: https://build.opensuse.org/package/show/Base:System/procps?expand=0&rev=235
This commit is contained in:
Dr. Werner Fink 2022-06-22 12:20:21 +00:00 committed by Git OBS Bridge
parent a4de879ccc
commit 943ff2a7f6
4 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,29 @@
---
proc/sysinfo.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
--- proc/sysinfo.c
+++ proc/sysinfo.c 2022-06-22 11:29:39.240066488 +0000
@@ -794,10 +794,6 @@ nextline:
where such values will be dramatically distorted over those of the host. */
if (kb_main_available > kb_main_total)
kb_main_available = kb_main_free;
- mem_used = kb_main_total - kb_main_free - kb_main_cached - kb_main_buffers;
- if (mem_used < 0)
- mem_used = kb_main_total - kb_main_free;
- kb_main_used = (unsigned long)mem_used;
/* zero? might need fallback for 2.6.27 <= kernel <? 3.14 */
if (!kb_main_available) {
@@ -821,6 +817,11 @@ nextline:
kb_main_available = kb_main_free;
#endif /* linux */
}
+
+ mem_used = kb_main_total - kb_main_available;
+ if (mem_used < 0)
+ mem_used = kb_main_total - kb_main_free;
+ kb_main_used = (unsigned long)mem_used;
}
/*****************************************************************/

View File

@ -0,0 +1,37 @@
---
top/top.1 | 4 ++--
top/top.c | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)
--- top/top.1
+++ top/top.1 2022-06-22 12:05:55.572154830 +0000
@@ -565,8 +565,8 @@ visual graphs of those representations.
In the case of \*(MP, the percentage represents the \fBtotal\fR minus the estimated
\fBavail\fR noted above.
-The `Mem' graph itself is divided between \fBused\fR and any remaining memory not
-otherwise accounted for by \fBavail\fR.
+The `Mem' graph itself is divided between the non-cached portion of \fBused\fR and
+any remaining memory not otherwise accounted for by \fBavail\fR.
\*(XT 4b. SUMMARY AREA Commands and the `m' command for additional information
on that special 4-way toggle.
--- top/top.c
+++ top/top.c 2022-06-22 12:03:17.911044097 +0000
@@ -6086,12 +6086,14 @@ numa_nope:
char used[SMLBUFSIZ], util[SMLBUFSIZ], dual[MEDBUFSIZ];
float pct_used, pct_misc, pct_swap;
int ix, num_used, num_misc;
+ unsigned long my_ulong;
- pct_used = (float)kb_main_used * (100.0 / (float)kb_main_total);
+ my_ulong = kb_main_total - kb_main_buffers - kb_main_cached - kb_main_free;
+ pct_used = (float)my_ulong * (100.0 / (float)kb_main_total);
#ifdef MEMGRAPH_OLD
pct_misc = (float)(kb_main_buffers + kb_main_cached) * (100.0 / (float)kb_main_total);
#else
- pct_misc = (float)(kb_main_total - kb_main_available - kb_main_used) * (100.0 / (float)kb_main_total);
+ pct_misc = (float)(kb_main_total - kb_main_available - my_ulong) * (100.0 / (float)kb_main_total);
#endif
if (pct_used + pct_misc > 100.0 || pct_misc < 0) pct_misc = 0;
pct_swap = kb_swap_total ? (float)kb_swap_used * (100.0 / (float)kb_swap_total) : 0;

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Wed Jun 22 12:12:35 UTC 2022 - Dr. Werner Fink <werner@suse.de>
- Add the patches
* procps-3.3.17-library-bsc1181475.patch
* procps-3.3.17-top-bsc1181475.patch
which are backports of current newlib tree to solve bug bsc#1181475
* 'free' command reports misleading "used" value
-------------------------------------------------------------------
Fri Feb 4 09:21:59 UTC 2022 - Dr. Werner Fink <werner@suse.de>

View File

@ -64,6 +64,9 @@ Patch33: procps-ng-3.3.11-pmap4suse.patch
Patch34: procps-3.3.17-bsc1181976.patch
# PATCH-FIX-UPSTREAM -- bsc#1195468
Patch35: bsc1195468-23da4f40.patch
# PATCH-BACKPORT-FROM-UPSTREAM -- bsc#1181475: 'free' command reports misleading "used" value
Patch42: procps-3.3.17-library-bsc1181475.patch
Patch43: procps-3.3.17-top-bsc1181475.patch
BuildRequires: automake
BuildRequires: dejagnu
BuildRequires: diffutils
@ -145,6 +148,8 @@ the process information pseudo-file system.
%patch33 -b .pmap4us
%patch34
%patch35 -p1
%patch42
%patch43
%build
test -s .tarball-version || echo %{version} > .tarball-version