import procps-ng-3.3.17-8.el9

This commit is contained in:
CentOS Sources 2022-11-15 02:01:20 -05:00 committed by Stepan Oksanichenko
parent e3f73e9bde
commit ffaa3357f0
4 changed files with 174 additions and 6 deletions

View File

@ -0,0 +1,38 @@
diff -up ./proc/sysinfo.c.ori ./proc/sysinfo.c
--- ./proc/sysinfo.c.ori 2021-02-09 11:11:25.000000000 +0100
+++ ./proc/sysinfo.c 2022-07-29 14:08:42.093322509 +0200
@@ -786,10 +786,8 @@ 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;
+ mem_used = kb_main_total - kb_main_available;
+ kb_main_used = mem_used < 0 ? 0 : (unsigned long) mem_used;
/* zero? might need fallback for 2.6.27 <= kernel <? 3.14 */
if (!kb_main_available) {
diff -up ./top/top.c.ori ./top/top.c
--- ./top/top.c.ori 2021-02-09 11:11:25.000000000 +0100
+++ ./top/top.c 2022-07-29 13:59:04.681966019 +0200
@@ -6076,12 +6076,16 @@ 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_used;
- pct_used = (float)kb_main_used * (100.0 / (float)kb_main_total);
+ // upstream kept old calculation of 'used' here for some reason
+ // https://gitlab.com/procps-ng/procps/-/commit/047d16ccfda6638eda78f56b67def196a2002b6f
+ my_used = kb_main_total - kb_main_free - kb_main_cached - kb_main_buffers;
+ pct_used = (float)my_used * (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_used) * (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

@ -0,0 +1,72 @@
From 401d587d2deb78adcf62517654f955a24b2d537d Mon Sep 17 00:00:00 2001
From: Todd Lewis <todd_lewis@unc.edu>
Date: Mon, 25 Oct 2021 19:38:10 -0400
Subject: [PATCH] fix uid/gid > 2^31
---
pgrep.c | 10 +++++++---
proc/readproc.h | 12 ++++++------
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/pgrep.c b/pgrep.c
index 1905cd1d..7d731620 100644
--- a/pgrep.c
+++ b/pgrep.c
@@ -229,8 +229,12 @@ static int strict_atol (const char *restrict str, long *restrict value)
for ( ; *str; ++str) {
if (! isdigit (*str))
- return (0);
+ return 0;
+ if (res >= LONG_MAX / 10)
+ return 0;
res *= 10;
+ if (res >= LONG_MAX - (*str - '0'))
+ return 0;
res += *str - '0';
}
*value = sign * res;
@@ -305,7 +309,7 @@ static int conv_uid (const char *restrict name, struct el *restrict e)
xwarnx(_("invalid user name: %s"), name);
return 0;
}
- e->num = (int) pwd->pw_uid;
+ e->num = pwd->pw_uid;
return 1;
}
@@ -322,7 +326,7 @@ static int conv_gid (const char *restrict name, struct el *restrict e)
xwarnx(_("invalid group name: %s"), name);
return 0;
}
- e->num = (int) grp->gr_gid;
+ e->num = grp->gr_gid;
return 1;
}
diff --git a/proc/readproc.h b/proc/readproc.h
index 7905ea99..8d9ae392 100644
--- a/proc/readproc.h
+++ b/proc/readproc.h
@@ -159,12 +159,12 @@ typedef struct proc_t {
session, // stat session id
nlwp, // stat,status number of threads, or 0 if no clue
tgid, // (special) thread group ID, the POSIX PID (see also: tid)
- tty, // stat full device number of controlling terminal
- /* FIXME: int uids & gids should be uid_t or gid_t from pwd.h */
- euid, egid, // stat(),status effective
- ruid, rgid, // status real
- suid, sgid, // status saved
- fuid, fgid, // status fs (used for file access only)
+ tty; // stat full device number of controlling terminal
+ uid_t euid; gid_t egid; // stat(),status effective
+ uid_t ruid; gid_t rgid; // status real
+ uid_t suid; gid_t sgid; // status saved
+ uid_t fuid; gid_t fgid; // status fs (used for file access only)
+ int
tpgid, // stat terminal process group id
exit_signal, // stat might not be SIGCHLD
processor; // stat current (or most recent?) CPU
--
GitLab

View File

@ -0,0 +1,40 @@
From 7eade2544e1c45bc516744aeaccc45df1d8f42df Mon Sep 17 00:00:00 2001
From: Kyle Walker <kwalker@redhat.com>
Date: Tue, 11 Feb 2020 14:30:39 -0500
Subject: [PATCH] whattime: Refactor the pretty-print evaluation
This avoids rounding errors such as in the case of 364 days of uptime which
results in only output that prints at the hour and below.
---
proc/whattime.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/proc/whattime.c b/proc/whattime.c
index c223cad..3e1b65c 100644
--- a/proc/whattime.c
+++ b/proc/whattime.c
@@ -69,9 +69,18 @@ char *sprint_uptime(int human_readable) {
if (human_readable) {
updecades = (int) uptime_secs / (60*60*24*365*10);
- upyears = ((int) uptime_secs / (60*60*24*365)) % 10;
- upweeks = ((int) uptime_secs / (60*60*24*7)) % 52;
- updays = ((int) uptime_secs / (60*60*24)) % 7;
+ if (updecades)
+ uptime_secs -= updecades * (60*60*24*365*10);
+
+ upyears = (int) uptime_secs / (60*60*24*365);
+ if (upyears)
+ uptime_secs -= upyears * (60*60*24*365);
+
+ upweeks = (int) uptime_secs / (60*60*24*7);
+ if (upweeks)
+ uptime_secs -= upweeks * (60*60*24*7);
+
+ updays = (int) uptime_secs / (60*60*24);
}
else
updays = (int) uptime_secs / (60*60*24);
--
2.24.1

View File

@ -4,7 +4,7 @@
Summary: System and process monitoring utilities Summary: System and process monitoring utilities
Name: procps-ng Name: procps-ng
Version: 3.3.17 Version: 3.3.17
Release: 5%{?dist} Release: 8%{?dist}
License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+
URL: https://sourceforge.net/projects/procps-ng/ URL: https://sourceforge.net/projects/procps-ng/
@ -17,8 +17,11 @@ Source2: README.top
Patch1: pwait-to-pidwait.patch Patch1: pwait-to-pidwait.patch
Patch2: covscan_findings.patch Patch2: covscan_findings.patch
Patch3: sysctl-support-systemd-globs.patch Patch3: uptime-pretty-mod.patch
Patch4: sysctl-print-dotted-keys-again.patch Patch4: free-new-used-calc.patch
Patch5: sysctl-support-systemd-globs.patch
Patch6: sysctl-print-dotted-keys-again.patch
Patch7: pgrep-uid-gid-overflow-backport.patch
BuildRequires: make BuildRequires: make
@ -162,9 +165,24 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof
%files i18n -f %{name}.lang %files i18n -f %{name}.lang
%changelog %changelog
* Wed Aug 24 2022 Jan Rybar <jrybar@redhat.com> - 3.3.17-5 * Thu Aug 18 2022 Jan Rybar <jrybar@redhat.com> - 3.3.17-8
- sysctl: backport support of systemd glob patterns (and related bz 2116977) - pgrep: uid/gid overflow fix backport
- Resolves: rhbz#2121090 - Resolves: rhbz#2119083
* Mon Aug 15 2022 Jan Rybar <jrybar@redhat.com> - 3.3.17-7
- sysctl: backport - keys with dots instead of slashes again
- Resolves: rhbz#2116977
- Related: rhbz#2052536
* Fri Jul 29 2022 Jan Rybar <jrybar@redhat.com> - 3.3.17-6
- free: backport new 'used' calculation
- sysctl: backport support of systemd glob patterns
- Resolves: rhbz#2003033
- Resolves: rhbz#2052536
* Fri Mar 25 2022 Jan Rybar <jrybar@redhat.com> - 3.3.17-5
- uptime: human readable data not shown if 364 days up
- Resolves: rhbz#2067166
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 3.3.17-4 * Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 3.3.17-4
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags