From 495de5dd2a1a7fa2ebca012e5298dafb477d8969f58c809e5464f68e73be44e5 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Thu, 14 Apr 2022 15:23:21 +0000 Subject: [PATCH] Accepting request 969331 from openSUSE:Factory Revert, see https://bugzilla.opensuse.org/show_bug.cgi?id=1198266 OBS-URL: https://build.opensuse.org/request/show/969331 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/procps?expand=0&rev=127 --- ...unction-prologue-after-rcfile-change.patch | 49 ----- ...ehavior-while-keeping-an-original-fi.patch | 79 -------- ...d-display-when-using-a-pidlist-optio.patch | 37 ---- bsc1195468-23da4f40.patch | 33 ++++ procps-3.3.17-bsc1181976.patch | 45 +++++ procps-ng-3.3.10-bnc634071_procstat2.diff | 61 ++++++ procps-ng-3.3.10-errno.patch | 12 +- procps-ng-3.3.10-fdleak.dif | 38 ++++ procps-ng-3.3.10-integer-overflow.patch | 61 ++++++ procps-ng-3.3.10-large_pcpu.patch | 20 +- procps-ng-3.3.10-slab.patch | 135 ++++++-------- procps-ng-3.3.10-xen.dif | 56 +++--- procps-ng-3.3.11-pmap4suse.patch | 67 ++++--- procps-ng-3.3.17.tar.xz | 3 + procps-ng-3.3.8-accuracy.dif | 99 ++++++++++ procps-ng-3.3.8-bnc634840.patch | 2 +- ...-3.3.8-ignore-scan_unevictable_pages.patch | 2 +- procps-ng-3.3.8-petabytes.patch | 14 +- procps-ng-3.3.8-readeof.patch | 74 ++++---- procps-ng-3.3.8-tinfo.dif | 12 +- procps-ng-3.3.8-vmstat-terabyte.dif | 14 +- procps-ng-3.3.9-w-notruncate.diff | 52 +++--- procps-ng-3.3.9-watch.patch | 14 ++ procps-ng-4.0.0-accuracy.dif | 176 ------------------ procps-ng-4.0.0-floats.dif | 65 ------- procps-ng-4.0.0-integer-overflow.patch | 26 --- procps-ng-4.0.0.tar.xz | 3 - procps-rpmlintrc | 2 +- procps-v3.3.3-columns.dif | 18 +- procps-v3.3.3-ia64.diff | 2 +- ...o-from-boot-sysctl.conf-kernelversion.diff | 24 +-- procps.changes | 93 --------- procps.spec | 73 +++++--- 33 files changed, 643 insertions(+), 818 deletions(-) delete mode 100644 0001-top-update-one-function-prologue-after-rcfile-change.patch delete mode 100644 0002-ps-restore-aix-behavior-while-keeping-an-original-fi.patch delete mode 100644 0003-ps-restore-thread-display-when-using-a-pidlist-optio.patch create mode 100644 bsc1195468-23da4f40.patch create mode 100644 procps-3.3.17-bsc1181976.patch create mode 100644 procps-ng-3.3.10-bnc634071_procstat2.diff create mode 100644 procps-ng-3.3.10-fdleak.dif create mode 100644 procps-ng-3.3.10-integer-overflow.patch create mode 100644 procps-ng-3.3.17.tar.xz create mode 100644 procps-ng-3.3.8-accuracy.dif create mode 100644 procps-ng-3.3.9-watch.patch delete mode 100644 procps-ng-4.0.0-accuracy.dif delete mode 100644 procps-ng-4.0.0-floats.dif delete mode 100644 procps-ng-4.0.0-integer-overflow.patch delete mode 100644 procps-ng-4.0.0.tar.xz diff --git a/0001-top-update-one-function-prologue-after-rcfile-change.patch b/0001-top-update-one-function-prologue-after-rcfile-change.patch deleted file mode 100644 index 35be90a..0000000 --- a/0001-top-update-one-function-prologue-after-rcfile-change.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 067a56a080732cb265e78e54deb0a7832d73ea5a Mon Sep 17 00:00:00 2001 -From: Jim Warner -Date: Tue, 29 Mar 2022 00:00:00 -0500 -Subject: [PATCH 1/3] top: update one function prologue after rcfile changes - -When top's rcfile was reorganized, trading that 'char' -based field representation for the 'int' scheme, there -was a function prologue that should have been changed. - -Thus, this patch will correct that original oversight. - -Reference(s): -. Mar, 2022 - rcfile reorganized -commit 46aa96e438435628810b33d20cb1c14dc33dd84f - -Signed-off-by: Jim Warner ---- - top/top.c | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -diff --git a/top/top.c b/top/top.c -index 04cf084b..110bea8f 100644 ---- a/top/top.c -+++ b/top/top.c -@@ -3981,14 +3981,14 @@ static int configs_path (const char *const fmts, ...) { - * 1. 'SYS_RCRESTRICT' contains two lines consisting of the secure - * mode switch and an update interval. Its presence limits what - * ordinary users are allowed to do. -- * 2. 'Rc_name' contains multiple lines - 3 global + 3 per window. -- * line 1 : an eyecatcher and creating program/alias name -- * line 2 : an id, Mode_altcsr, Mode_irixps, Delay_time, Curwin. -+ * 2. 'Rc_name' contains multiple lines - both global & per window. -+ * line 1 : an eyecatcher and creating program/alias name -+ * line 2 : an id, Mode_altcsr, Mode_irixps, Delay_time, Curwin. - * For each of the 4 windows: -- * line a: contains w->winname, fieldscur -- * line b: contains w->winflags, sortindx, maxtasks, etc -- * line c: contains w->summclr, msgsclr, headclr, taskclr -- * line 15 : miscellaneous additional global settings -+ * lines a: contains w->winname, fieldscur -+ * line b: contains w->winflags, sortindx, maxtasks, etc -+ * line c: contains w->summclr, msgsclr, headclr, taskclr -+ * global : miscellaneous additional settings - * Any remaining lines are devoted to the optional entries - * supporting the 'Other Filter' and 'Inspect' provisions. - * 3. 'SYS_RCDEFAULTS' system-wide defaults if 'Rc_name' absent --- -2.32.0 - diff --git a/0002-ps-restore-aix-behavior-while-keeping-an-original-fi.patch b/0002-ps-restore-aix-behavior-while-keeping-an-original-fi.patch deleted file mode 100644 index a02c91d..0000000 --- a/0002-ps-restore-aix-behavior-while-keeping-an-original-fi.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 5e9956b9386d88a323c5b114f7b5a9faa90dfdba Mon Sep 17 00:00:00 2001 -From: Jim Warner -Date: Wed, 30 Mar 2022 12:00:00 -0500 -Subject: [PATCH 2/3] ps: restore aix behavior while keeping an original fix - -The commit shown below broke the aix behavior that Dr. -Fink recently reported. However, in the proposed patch -the old behavior, showing garbage when '%cpu' was used -with an invalid formatting option, would appear again. - -So this patch, based on Werner's patch, goes the extra -distance to prevent that. Along the way we'll disallow -commas in the aix format str to prevent their display. - -Reference(s): -https://www.freelists.org/post/procps/Procpsng-400-released-with-newlib,2 -. Mar, 2022 - where aix bug was introduced -commit 81df85a1b528d4edb9ab98b37fb6c6244430b6c4 - -Prototyped-by: Dr. Werner Fink -Signed-off-by: Jim Warner ---- - ps/display.c | 2 +- - ps/sortformat.c | 10 ++++++---- - 2 files changed, 7 insertions(+), 5 deletions(-) - -diff --git a/ps/display.c b/ps/display.c -index 11c3a832..75c7d926 100644 ---- a/ps/display.c -+++ b/ps/display.c -@@ -592,7 +592,7 @@ static void finalize_stacks (void) - // now accommodate any results not yet satisfied - f_node = format_list; - while (f_node) { -- (*f_node->pr)(NULL, NULL); -+ if (*f_node->pr) (*f_node->pr)(NULL, NULL); - f_node = f_node->next; - } - s_node = sort_list; -diff --git a/ps/sortformat.c b/ps/sortformat.c -index 2293aa95..965219c2 100644 ---- a/ps/sortformat.c -+++ b/ps/sortformat.c -@@ -132,17 +132,20 @@ static const char *aix_format_parse(sf_node *sfn){ - c = *walk++; - if(c=='%') goto get_desc; - if(!c) goto looks_ok; -+ if(c==',') goto aix_oops; - /* get_text: */ - items++; -- get_more_text: -+ get_more: - c = *walk++; - if(c=='%') goto get_desc; -- if(c) goto get_more_text; -+ if(c==' ') goto get_more; -+ if(c) goto aix_oops; - goto looks_ok; - get_desc: - items++; - c = *walk++; - if(c) goto initial; -+ aix_oops: - return _("improper AIX field descriptor"); - looks_ok: - ; -@@ -313,8 +316,7 @@ static const char *format_parse(sf_node *sfn){ - if(0) improper: err=_("improper format list"); - if(0) badwidth: err=_("column widths must be unsigned decimal numbers"); - if(0) notmacro: err=_("can not set width for a macro (multi-column) format specifier"); -- if (!err) -- if(strchr(sfn->sf,'%')) err = aix_format_parse(sfn); -+ if(strchr(sfn->sf,'%')) err = aix_format_parse(sfn); - return err; - } - --- -2.32.0 - diff --git a/0003-ps-restore-thread-display-when-using-a-pidlist-optio.patch b/0003-ps-restore-thread-display-when-using-a-pidlist-optio.patch deleted file mode 100644 index 9a5ae9e..0000000 --- a/0003-ps-restore-thread-display-when-using-a-pidlist-optio.patch +++ /dev/null @@ -1,37 +0,0 @@ -From cb945cf3056cf6140554d54efa21436cfffdfba3 Mon Sep 17 00:00:00 2001 -From: Jim Warner -Date: Wed, 30 Mar 2022 12:00:00 -0500 -Subject: [PATCH 3/3] ps: restore thread display when using a pidlist option - -This commit will once again display threads when using -the -L option along with any of those pidlist options. - -Reference(s): -https://gitlab.com/procps-ng/procps/-/issues/234 - -Signed-off-by: Jim Warner ---- - ps/display.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/ps/display.c b/ps/display.c -index 75c7d926..2e1cc665 100644 ---- a/ps/display.c -+++ b/ps/display.c -@@ -289,9 +289,12 @@ static void simple_spew(void){ - // -q option (only single SEL_PID_QUICK typecode entry expected in the list, if present) - if (selection_list && selection_list->typecode == SEL_PID_QUICK) { - unsigned *pidlist = xcalloc(selection_list->n, sizeof(unsigned)); -+ enum pids_select_type which; - for (i = 0; i < selection_list->n; i++) - pidlist[i] = selection_list->u[selection_list->n-i-1].pid; -- pidread = procps_pids_select(Pids_info, pidlist, selection_list->n, PIDS_SELECT_PID); -+ which = (thread_flags & (TF_loose_tasks|TF_show_task)) -+ ? PIDS_SELECT_PID_THREADS : PIDS_SELECT_PID; -+ pidread = procps_pids_select(Pids_info, pidlist, selection_list->n, which); - free(pidlist); - } else { - enum pids_fetch_type which; --- -2.32.0 - diff --git a/bsc1195468-23da4f40.patch b/bsc1195468-23da4f40.patch new file mode 100644 index 0000000..d0f0102 --- /dev/null +++ b/bsc1195468-23da4f40.patch @@ -0,0 +1,33 @@ +From 23da4f40ea27afe998e92ca317f2dcb48a6ffc1f Mon Sep 17 00:00:00 2001 +From: Tommi Rantala +Date: Mon, 11 Oct 2021 13:33:18 +0300 +Subject: [PATCH] ps: ignore SIGURG + +Stop registering signal handler for SIGURG, to avoid ps failure if +someone sends such signal. Without the signal handler, SIGURG will +just be ignored. + + Signal 23 (URG) caught by ps (3.3.16). + ps:ps/display.c:66: please report this bug + +https://man7.org/linux/man-pages/man7/signal.7.html +https://www.freebsd.org/cgi/man.cgi?sektion=3&query=signal +--- + ps/display.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/ps/display.c b/ps/display.c +index 04803c3b..346e21a7 100644 +--- a/ps/display.c ++++ b/ps/display.c +@@ -673,6 +673,7 @@ int main(int argc, char *argv[]){ + case SIGKILL: /* can not catch */ + case SIGSTOP: /* can not catch */ + case SIGWINCH: /* don't care if window size changes */ ++ case SIGURG: /* Urgent condition on socket (4.2BSD) */ + ; + } + } while (0); +-- +GitLab + diff --git a/procps-3.3.17-bsc1181976.patch b/procps-3.3.17-bsc1181976.patch new file mode 100644 index 0000000..fcb2f74 --- /dev/null +++ b/procps-3.3.17-bsc1181976.patch @@ -0,0 +1,45 @@ +From 3dd1661a3d91671ca6c977c2e514f47d807be79d Mon Sep 17 00:00:00 2001 +From: Craig Small +Date: Mon, 29 Mar 2021 22:11:27 +1100 +Subject: [PATCH] docs: psr ps field is last run processor + +The ps.1 manpage incorrectly stated that psr field showed the +processor the process was assigned to. However if the assignment +has changed but the process has not run, then the field doesn't +change. + +Some digging by @srikard showed it wasn't the processor assigned +but the last one it was run on. The man page now correctly +describes psr in that way. + +References: + procps-ng/procps#187 +--- + ps/ps.1 | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git ps/ps.1 ps/ps.1 +index 8678123..b433655 100644 +--- ps/ps.1 ++++ ps/ps.1 +|@@ -4,7 +4,7 @@ +| .\" Quick hack conversion by Albert Cahalan, 1998. +| .\" Licensed under version 2 of the Gnu General Public License. +| .\" +|-.TH PS "1" "2021-03-05" "procps-ng" "User Commands" +|+.TH PS "1" "2021-03-29" "procps-ng" "User Commands" +| .\" +| .\" To render this page: +| .\" groff -t -b -man -X -P-resolution -P100 -Tps ps.1 & +@@ -1518,7 +1518,7 @@ priority of the process. Higher number means lower priority. + T} + + psr PSR T{ +-processor that process is currently assigned to. ++processor that process last executed on. + T} + + rgid RGID T{ +-- +2.26.2 + diff --git a/procps-ng-3.3.10-bnc634071_procstat2.diff b/procps-ng-3.3.10-bnc634071_procstat2.diff new file mode 100644 index 0000000..fbc178b --- /dev/null +++ b/procps-ng-3.3.10-bnc634071_procstat2.diff @@ -0,0 +1,61 @@ +--- + proc/libprocps.sym | 1 + + proc/sysinfo.c | 13 +++++++++++-- + proc/sysinfo.h | 2 ++ + 3 files changed, 14 insertions(+), 2 deletions(-) + +--- proc/libprocps.sym ++++ proc/libprocps.sym 2018-04-04 11:30:51.841725161 +0000 +@@ -60,6 +60,7 @@ global: + signal_name_to_number; + signal_number_to_name; + smp_num_cpus; ++ __smp_num_cpus; + sprint_uptime; + strtosig; + tty_to_dev; +--- proc/sysinfo.c ++++ proc/sysinfo.c 2018-04-04 11:33:26.306886237 +0000 +@@ -47,7 +47,8 @@ + #endif + #include + +-long smp_num_cpus; /* number of CPUs */ ++#undef smp_num_cpus ++long smp_num_cpus=-1; /* number of CPUs */ + long page_bytes; /* this architecture's page size */ + + #define BAD_OPEN_MESSAGE \ +@@ -1166,7 +1167,11 @@ out: + + /////////////////////////////////////////////////////////////////////////// + +-void cpuinfo (void) { ++long __smp_num_cpus (void) { ++ ++ if (smp_num_cpus != -1) ++ return(smp_num_cpus); ++ + // ought to count CPUs in /proc/stat instead of relying + // on glibc, which foolishly tries to parse /proc/cpuinfo + // note: that may have been the case but now /proc/stat +@@ -1181,4 +1186,8 @@ void cpuinfo (void) { + smp_num_cpus = sysconf(_SC_NPROCESSORS_ONLN); + if (smp_num_cpus<1) /* SPARC glibc is buggy */ + smp_num_cpus=1; ++ ++ return smp_num_cpus; + } ++ ++void cpuinfo (void) { (void)__smp_num_cpus(); } +--- proc/sysinfo.h ++++ proc/sysinfo.h 2018-04-04 11:30:51.841725161 +0000 +@@ -8,6 +8,8 @@ EXTERN_C_BEGIN + + extern unsigned long long Hertz; /* clock tick frequency */ + extern long smp_num_cpus; /* number of CPUs */ ++extern long __smp_num_cpus(void); ++#define smp_num_cpus __smp_num_cpus() + extern int have_privs; /* boolean, true if setuid or similar */ + extern long page_bytes; /* this architecture's bytes per page */ + diff --git a/procps-ng-3.3.10-errno.patch b/procps-ng-3.3.10-errno.patch index 8c09558..48c0aae 100644 --- a/procps-ng-3.3.10-errno.patch +++ b/procps-ng-3.3.10-errno.patch @@ -10,16 +10,16 @@ and this causes a problem later on (bsc#908516) 1 file changed, 5 insertions(+) --- free.c -+++ free.c 2022-03-29 11:17:45.442230673 +0000 -@@ -209,6 +209,7 @@ int main(int argc, char **argv) ++++ free.c 2018-04-04 12:47:06.360757839 +0000 +@@ -197,6 +197,7 @@ int main(int argc, char **argv) + { int c, flags = 0, unit_set = 0; struct commandline_arguments args; - struct meminfo_info *mem_info = NULL; + int errsv; /* * For long options that have no equivalent short option, use a -@@ -260,10 +261,12 @@ int main(int argc, char **argv) +@@ -247,10 +248,12 @@ int main(int argc, char **argv) #ifdef HAVE_PROGRAM_INVOCATION_NAME program_invocation_name = program_invocation_short_name; #endif @@ -30,9 +30,9 @@ and this causes a problem later on (bsc#908516) atexit(close_stdout); + errno = errsv; - while ((c = getopt_long(argc, argv, "bkmghltvCc:ws:V", longopts, NULL)) != -1) + while ((c = getopt_long(argc, argv, "bkmghltCc:ws:V", longopts, NULL)) != -1) switch (c) { -@@ -333,11 +336,13 @@ int main(int argc, char **argv) +@@ -317,11 +320,13 @@ int main(int argc, char **argv) break; case 's': flags |= FREE_REPEAT; diff --git a/procps-ng-3.3.10-fdleak.dif b/procps-ng-3.3.10-fdleak.dif new file mode 100644 index 0000000..ee7d736 --- /dev/null +++ b/procps-ng-3.3.10-fdleak.dif @@ -0,0 +1,38 @@ +--- + vmstat.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +--- vmstat.c ++++ vmstat.c 2018-04-04 11:16:07.577968520 +0000 +@@ -40,6 +40,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -708,13 +709,12 @@ static void slabheader(void) + + static void slabformat(void) + { +- FILE *fSlab; ++ struct stat fSlab; + struct slab_cache *slabs; + unsigned long nSlab, i, j, k; + const char format[] = "%-24s %6u %6u %6u %6u\n"; + +- fSlab = fopen("/proc/slabinfo", "rb"); +- if (!fSlab) { ++ if (stat("/proc/slabinfo", &fSlab) < 0) { + xwarnx(_("your kernel does not support slabinfo or your permissions are insufficient")); + return; + } +@@ -746,7 +746,6 @@ static void slabformat(void) + } + free(slabs); + } +- fclose(fSlab); + } + + static void disksum_format(void) diff --git a/procps-ng-3.3.10-integer-overflow.patch b/procps-ng-3.3.10-integer-overflow.patch new file mode 100644 index 0000000..d6482dd --- /dev/null +++ b/procps-ng-3.3.10-integer-overflow.patch @@ -0,0 +1,61 @@ +--- + free.c | 19 ++++++++++++++++--- + proc/sysinfo.c | 5 ++++- + 2 files changed, 20 insertions(+), 4 deletions(-) + +--- free.c ++++ free.c 2021-02-10 09:58:35.409695062 +0000 +@@ -134,7 +134,7 @@ static const char *scale_size(unsigned l + if (args.exponent > 1) { + /* In desired scale. */ + snprintf(buf, sizeof(buf), "%ld", +- (long int)((size * 1024.0) / power(base, args.exponent-1)) ++ (long int)(((long long int)size * 1024) / power(base, args.exponent-1)) + ); + return buf; + } +@@ -381,15 +381,28 @@ int main(int argc, char **argv) + * to print the high info, even if it is zero. + */ + if (flags & FREE_LOHI) { ++ unsigned long kb_low_used; ++ unsigned long kb_high_used; ++ ++ if (kb_low_total > kb_low_free) ++ kb_low_used = kb_low_total - kb_low_free; ++ else ++ kb_low_used = 0; ++ ++ if (kb_high_total > kb_high_free) ++ kb_high_used = kb_high_total - kb_high_free; ++ else ++ kb_high_used = 0; ++ + printf("%-9s", _("Low:")); + printf("%11s", scale_size(kb_low_total, flags, args)); +- printf(" %11s", scale_size(kb_low_total - kb_low_free, flags, args)); ++ printf(" %11s", scale_size(kb_low_used, flags, args)); + printf(" %11s", scale_size(kb_low_free, flags, args)); + printf("\n"); + + printf("%-9s", _("High:")); + printf("%11s", scale_size(kb_high_total, flags, args)); +- printf(" %11s", scale_size(kb_high_total - kb_high_free, flags, args)); ++ printf(" %11s", scale_size(kb_high_used, flags, args)); + printf(" %11s", scale_size(kb_high_free, flags, args)); + printf("\n"); + } +--- proc/sysinfo.c ++++ proc/sysinfo.c 2021-02-10 10:00:35.227385913 +0000 +@@ -783,7 +783,10 @@ nextline: + kb_main_cached = kb_page_cache + kb_slab_reclaimable; + if ((ev=getenv("PS_FULL_CACHE"))) + kb_main_cached += kb_swap_cached + kb_nfs_unstable; +- kb_swap_used = kb_swap_total - kb_swap_free; ++ if (kb_swap_total > kb_swap_free) ++ kb_swap_used = kb_swap_total - kb_swap_free; ++ else ++ kb_swap_used = 0; + + /* if kb_main_available is greater than kb_main_total or our calculation of + mem_used overflows, that's symptomatic of running within a lxc container diff --git a/procps-ng-3.3.10-large_pcpu.patch b/procps-ng-3.3.10-large_pcpu.patch index cb3f63f..2f344de 100644 --- a/procps-ng-3.3.10-large_pcpu.patch +++ b/procps-ng-3.3.10-large_pcpu.patch @@ -3,17 +3,17 @@ 1 file changed, 5 insertions(+), 1 deletion(-) --- top/top.c -+++ top/top.c 2022-03-29 10:29:24.422368662 +0000 -@@ -2457,7 +2457,11 @@ static void zap_fieldstab (void) { ++++ top/top.c 2018-04-04 12:09:16.087193018 +0000 +@@ -2404,7 +2404,11 @@ static void zap_fieldstab (void) { Cpu_pmax = 99.9; - if (Rc.mode_irixps && Cpu_cnt > 1 && !Thread_mode) { - Cpu_pmax = 100.0 * Cpu_cnt; -- if (Cpu_cnt > 10) { -+ if (Cpu_cnt > 1000) { -+ if (Cpu_pmax > 9999999.0) Cpu_pmax = 9999999.0; -+ } else if (Cpu_cnt > 100) { -+ if (Cpu_cnt > 999999.0) Cpu_pmax = 999999.0; -+ } else if (Cpu_cnt > 10) { + if (Rc.mode_irixps && smp_num_cpus > 1 && !Thread_mode) { + Cpu_pmax = 100.0 * smp_num_cpus; +- if (smp_num_cpus > 10) { ++ if (smp_num_cpus > 1000) { ++ if (Cpu_pmax > 9999999.0) Cpu_pmax = 9999999.0; ++ } else if (smp_num_cpus > 100) { ++ if (Cpu_pmax > 999999.0) Cpu_pmax = 999999.0; ++ } else if (smp_num_cpus > 10) { if (Cpu_pmax > 99999.0) Cpu_pmax = 99999.0; } else { if (Cpu_pmax > 999.9) Cpu_pmax = 999.9; diff --git a/procps-ng-3.3.10-slab.patch b/procps-ng-3.3.10-slab.patch index a9e1124..e444d47 100644 --- a/procps-ng-3.3.10-slab.patch +++ b/procps-ng-3.3.10-slab.patch @@ -1,12 +1,12 @@ --- free.1 | 6 ++++++ free.c | 7 ++++++- - proc/meminfo.c | 7 ++++++- - vmstat.c | 7 ++++++- - 4 files changed, 24 insertions(+), 3 deletions(-) + proc/sysinfo.c | 4 ++++ + vmstat.c | 6 +++++- + 4 files changed, 21 insertions(+), 2 deletions(-) --- free.1 -+++ free.1 2022-03-28 11:53:32.173182702 +0000 ++++ free.1 2019-12-11 06:20:16.659772479 +0000 @@ -100,6 +100,12 @@ Switch to the wide mode. The wide mode p than 80 characters. In this mode \fBbuffers\fR and \fBcache\fR are reported in two separate columns. @@ -21,33 +21,33 @@ Display the result .I count --- free.c -+++ free.c 2022-03-28 12:05:01.544663755 +0000 -@@ -93,6 +93,7 @@ static void __attribute__ ((__noreturn__ - fputs(_(" -v, --committed show committed memory and commit limit\n"), out); ++++ free.c 2019-12-11 06:20:16.659772479 +0000 +@@ -90,6 +90,7 @@ static void __attribute__ ((__noreturn__ + fputs(_(" -t, --total show total for RAM + swap\n"), out); fputs(_(" -s N, --seconds N repeat printing every N seconds\n"), out); fputs(_(" -c N, --count N repeat printing N times, then exit\n"), out); + fputs(_(" -C, --full-cache add further cache lines to main cache\n"), out); fputs(_(" -w, --wide wide output\n"), out); fputs(USAGE_SEPARATOR, out); fputs(_(" --help display this help and exit\n"), out); -@@ -244,6 +245,7 @@ int main(int argc, char **argv) - { "committed", no_argument, NULL, 'v' }, +@@ -231,6 +232,7 @@ int main(int argc, char **argv) + { "total", no_argument, NULL, 't' }, { "seconds", required_argument, NULL, 's' }, { "count", required_argument, NULL, 'c' }, -+ { "full-cache",no_argument, NULL, 'C' }, ++ { "full-cache",required_argument, NULL, HELP_OPTION }, { "wide", no_argument, NULL, 'w' }, { "help", no_argument, NULL, HELP_OPTION }, { "version", no_argument, NULL, 'V' }, -@@ -263,7 +265,7 @@ int main(int argc, char **argv) +@@ -250,7 +252,7 @@ int main(int argc, char **argv) textdomain(PACKAGE); atexit(close_stdout); -- while ((c = getopt_long(argc, argv, "bkmghltvc:ws:V", longopts, NULL)) != -1) -+ while ((c = getopt_long(argc, argv, "bkmghltvCc:ws:V", longopts, NULL)) != -1) +- while ((c = getopt_long(argc, argv, "bkmghltc:ws:V", longopts, NULL)) != -1) ++ while ((c = getopt_long(argc, argv, "bkmghltCc:ws:V", longopts, NULL)) != -1) switch (c) { case 'b': check_unit_set(&unit_set); -@@ -349,6 +351,9 @@ int main(int argc, char **argv) +@@ -333,6 +335,9 @@ int main(int argc, char **argv) case 'w': flags |= FREE_WIDE; break; @@ -57,70 +57,59 @@ case HELP_OPTION: usage(stdout); case 'V': ---- proc/meminfo.c -+++ proc/meminfo.c 2022-03-28 12:39:29.291205555 +0000 +--- proc/sysinfo.c ++++ proc/sysinfo.c 2019-12-11 06:20:16.659772479 +0000 @@ -3,6 +3,7 @@ - * - * Copyright (C) 2015 Craig Small - * Copyright (C) 2016-2022 Jim Warner + * Copyright (C) 1992-1998 by Michael K. Johnson, johnsonm@redhat.com + * Copyright 1998-2003 Albert Cahalan + * June 2003, Fabian Frederick, disk and slab info + * Copyright (c) 2008 Bart Van Assche. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public -@@ -640,6 +641,7 @@ static int meminfo_read_failed ( - int size; - unsigned long *valptr; - signed long mem_used; -+ const char *ev; +@@ -700,6 +701,7 @@ void meminfo(void){ + int linux_version_code = procps_linux_version(); + mem_table_struct findme = { namebuf, NULL}; + mem_table_struct *found; ++ const char *ev; + char *head; + char *tail; + static const mem_table_struct mem_table[] = { +@@ -779,6 +781,8 @@ nextline: + kb_inactive = kb_inact_dirty + kb_inact_clean + kb_inact_laundry; + } + kb_main_cached = kb_page_cache + kb_slab_reclaimable; ++ if ((ev=getenv("PS_FULL_CACHE"))) ++ kb_main_cached += kb_swap_cached + kb_nfs_unstable; + kb_swap_used = kb_swap_total - kb_swap_free; - // remember history from last time around - memcpy(&info->hist.old, &info->hist.new, sizeof(struct meminfo_data)); -@@ -692,7 +694,10 @@ static int meminfo_read_failed ( - - if (0 == mHr(MemAvailable)) - mHr(MemAvailable) = mHr(MemFree); -- mHr(derived_mem_cached) = mHr(Cached) + mHr(SReclaimable); -+ if ((ev=getenv("PS_FULL_CACHE"))) -+ mHr(derived_mem_cached) = mHr(Cached) + mHr(SReclaimable) + mHr(NFS_Unstable); -+ else -+ mHr(derived_mem_cached) = mHr(Cached) + mHr(SReclaimable); - - /* if 'available' is greater than 'total' or our calculation of mem_used - overflows, that's symptomatic of running within a lxc container where + /* if kb_main_available is greater than kb_main_total or our calculation of --- vmstat.c -+++ vmstat.c 2022-03-28 12:41:52.744612074 +0000 -@@ -234,6 +234,7 @@ static void __attribute__ ((__noreturn__ - fputs(_(" -p, --partition partition specific statistics\n"), out); - fputs(_(" -S, --unit define display unit\n"), out); - fputs(_(" -w, --wide wide output\n"), out); -+ fputs(_(" -C, --full-cache add further cache lines to main cache\n"), out); - fputs(_(" -t, --timestamp show timestamp\n"), out); - fputs(_(" -y, --no-first skips first line of output\n"), out); - fputs(USAGE_SEPARATOR, out); -@@ -948,6 +949,7 @@ int main(int argc, char *argv[]) - {"partition", required_argument, NULL, 'p'}, - {"unit", required_argument, NULL, 'S'}, - {"wide", no_argument, NULL, 'w'}, -+ {"full-cache", no_argument, NULL, 'C'}, - {"timestamp", no_argument, NULL, 't'}, - {"help", no_argument, NULL, 'h'}, - {"version", no_argument, NULL, 'V'}, -@@ -964,7 +966,7 @@ int main(int argc, char *argv[]) - atexit(close_stdout); ++++ vmstat.c 2019-12-11 06:22:44.716984764 +0000 +@@ -103,6 +103,7 @@ static void __attribute__ ((__noreturn__ + fputs(_(" -p, --partition partition specific statistics\n"), out); + fputs(_(" -S, --unit define display unit\n"), out); + fputs(_(" -w, --wide wide output\n"), out); ++ fputs(_(" -C, --full-cache add further cache lines to main cache\n"), out); + fputs(_(" -t, --timestamp show timestamp\n"), out); + fputs(USAGE_SEPARATOR, out); + fputs(USAGE_HELP, out); +@@ -899,7 +900,7 @@ int main(int argc, char *argv[]) + atexit(close_stdout); - while ((c = -- getopt_long(argc, argv, "afmnsdDp:S:wthVy", longopts, NULL)) != -1) -+ getopt_long(argc, argv, "aCfmnsdDp:S:wthVy", longopts, NULL)) != -1) - switch (c) { - case 'V': - printf(PROCPS_NG_VERSION); -@@ -1031,6 +1033,9 @@ int main(int argc, char *argv[]) - case 't': - t_option = 1; - break; -+ case 'C': -+ setenv("PS_FULL_CACHE", "yes", 1); -+ break; - case 'y': - /* Don't display stats since system restart */ - y_option = 1; + while ((c = +- getopt_long(argc, argv, "afmnsdDp:S:wthV", longopts, ++ getopt_long(argc, argv, "aCfmnsdDp:S:wthV", longopts, + NULL)) != -1) + switch (c) { + case 'V': +@@ -968,6 +969,9 @@ int main(int argc, char *argv[]) + case 't': + t_option = 1; + break; ++ case 'C': ++ setenv("PS_FULL_CACHE", "yes", 1); ++ break; + default: + /* no other aguments defined yet. */ + usage(stderr); diff --git a/procps-ng-3.3.10-xen.dif b/procps-ng-3.3.10-xen.dif index 1110d56..7babd2d 100644 --- a/procps-ng-3.3.10-xen.dif +++ b/procps-ng-3.3.10-xen.dif @@ -1,33 +1,29 @@ ---- - vmstat.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - --- vmstat.c -+++ vmstat.c 2022-03-29 09:21:41.156855432 +0000 -@@ -362,7 +362,7 @@ static void new_format(void) - unsigned long pgpgin[2], pgpgout[2], pswpin[2] = {0,0}, pswpout[2]; - unsigned int sleep_half; - unsigned long kb_per_page = sysconf(_SC_PAGESIZE) / 1024ul; -- int debt = 0; /* handle idle ticks running backwards */ -+ long long debt = 0; /* handle idle ticks running backwards */ - struct tm *tm_ptr; - time_t the_time; - char timebuf[32]; -@@ -481,12 +481,12 @@ static void new_format(void) ++++ vmstat.c 2015-01-27 14:57:19.467491788 +0000 +@@ -295,7 +295,7 @@ static void new_format(void) + unsigned int intr[2], ctxt[2]; + unsigned int sleep_half; + unsigned long kb_per_page = sysconf(_SC_PAGESIZE) / 1024ul; +- int debt = 0; /* handle idle ticks running backwards */ ++ long long debt = 0; /* handle idle ticks running backwards */ + struct tm *tm_ptr; + time_t the_time; + char timebuf[32]; +@@ -386,12 +386,12 @@ static void new_format(void) - /* idle can run backwards for a moment -- kernel "feature" */ - if (debt) { -- cpu_idl = (int)cpu_idl + debt; -- debt = 0; -+ cpu_idl = cpu_idl + debt; -+ debt = 0LL; - } -- if ((int)cpu_idl < 0) { -- debt = (int)cpu_idl; -- cpu_idl = 0; -+ if (cpu_idl < 0) { -+ debt = cpu_idl; -+ cpu_idl = 0LL; - } + /* idle can run backwards for a moment -- kernel "feature" */ + if (debt) { +- didl = (int)didl + debt; +- debt = 0; ++ didl = (long long)didl + debt; ++ debt = 0LL; + } +- if ((int)didl < 0) { +- debt = (int)didl; +- didl = 0; ++ if ((long long)didl < 0) { ++ debt = (long long)didl; ++ didl = 0ULL; + } - Div = cpu_use + cpu_sys + cpu_idl + cpu_iow + cpu_sto; + Div = duse + dsys + didl + diow + dstl; diff --git a/procps-ng-3.3.11-pmap4suse.patch b/procps-ng-3.3.11-pmap4suse.patch index 295e19d..efcaffa 100644 --- a/procps-ng-3.3.11-pmap4suse.patch +++ b/procps-ng-3.3.11-pmap4suse.patch @@ -4,8 +4,8 @@ 2 files changed, 44 insertions(+), 20 deletions(-) --- pmap.c -+++ pmap.c 2022-03-29 11:46:26.323303275 +0000 -@@ -55,7 +55,9 @@ const char *nls_Address, ++++ pmap.c 2018-06-05 09:37:34.404294888 +0000 +@@ -49,7 +49,9 @@ const char *nls_Address, *nls_Kbytes, *nls_Mode, *nls_RSS, @@ -16,7 +16,7 @@ static void nls_initialize(void) { -@@ -79,7 +81,9 @@ static void nls_initialize(void) +@@ -73,7 +75,9 @@ static void nls_initialize(void) nls_Kbytes = _("Kbytes"); nls_Mode = _("Mode"); nls_RSS = _("RSS"); @@ -26,20 +26,20 @@ } static int justify_print(const char *str, int width, int right) -@@ -146,10 +150,10 @@ static int d_option = 0; - static int n_option = 0; - static int N_option = 0; - static int q_option = 0; --static int x_option = 0; +@@ -141,10 +145,10 @@ static int d_option; + static int n_option; + static int N_option; + static int q_option; +-static int x_option; +static int x_option = 1; - static int X_option = 0; + static int X_option; -static int map_desc_showpath; +static int map_desc_showpath = 1; static unsigned shm_minor = ~0u; -@@ -533,12 +537,17 @@ static int one_proc (struct pids_stack * +@@ -522,12 +526,17 @@ static int one_proc(const proc_t * p) char perms[32] = ""; const char *cp2 = NULL; unsigned long long rss = 0ull; @@ -55,12 +55,12 @@ int maxw1=0, maxw2=0, maxw3=0, maxw4=0, maxw5=0; + int maxw6=0, maxw7=0; - printf("%u: %s\n", PIDS_VAL(tgid, s_int, p, Pids_info), PIDS_VAL(cmdline, str, p, Pids_info)); - -@@ -561,13 +570,15 @@ static int one_proc (struct pids_stack * + /* Overkill, but who knows what is proper? The "w" prog uses + * the tty width to determine this. +@@ -557,13 +566,15 @@ static int one_proc(const proc_t * p) if (x_option) { maxw1 = 16; - if (sizeof(long) == 4) maxw1 = 8; + if (sizeof(KLONG) == 4) maxw1 = 8; - maxw2 = maxw3 = maxw4 = 7; + maxw2 = maxw3 = maxw4 = maxw6 = maxw7 = 7; maxw5 = 5; @@ -74,7 +74,7 @@ maxw5 = justify_print(nls_Mode, maxw5, 0); justify_print(nls_Mapping, 0, 0); } -@@ -607,6 +618,11 @@ static int one_proc (struct pids_stack * +@@ -603,6 +614,11 @@ static int one_proc(const proc_t * p) total_rss += smap_value; continue; } @@ -86,30 +86,29 @@ if (strcmp("Shared_Dirty", smap_key) == 0) { shared_dirty = smap_value; total_shared_dirty += smap_value; -@@ -619,16 +635,20 @@ static int one_proc (struct pids_stack * +@@ -615,15 +631,19 @@ static int one_proc(const proc_t * p) } if (strcmp("Swap", smap_key) == 0) { /* doesn't matter as long as last */ +- if (cp2) printf("%0*" KLF "x %*lu %*llu %*llu %*s %s\n", + swap = smap_value; + total_swap += smap_value; - if (cp2) -- printf("%0*lx %*lu %*llu %*llu %*s %s\n", -+ printf("%0*lx %*lu %*llu %*llu %*llu %*llu %*s %s\n", - maxw1, start_To_Avoid_Warning, - maxw2, (unsigned long)(diff >> 10), - maxw3, rss, -+ maxw6, pss, - maxw4, (private_dirty + shared_dirty), -+ maxw7, swap, - maxw5, perms, - cp2); ++ if (cp2) printf("%0*" KLF "x %*lu %*llu %*llu %*llu %*llu %*s %s\n", + maxw1, start, + maxw2, (unsigned long)(diff >> 10), + maxw3, rss, ++ maxw6, pss, + maxw4, (private_dirty + shared_dirty), ++ maxw7, swap, + maxw5, perms, + cp2); /* reset some counters */ - rss = shared_dirty = private_dirty = 0ull; + rss = pss = shared_dirty = private_dirty = swap = 0ull; - diff = end = 0; - perms[0] = '\0'; - cp2 = NULL; -@@ -662,7 +682,6 @@ static int one_proc (struct pids_stack * + start = diff = end = 0; + perms[0] = '\0'; + cp2 = NULL; +@@ -656,7 +676,6 @@ static int one_proc(const proc_t * p) if (perms[3] == 's') total_shared += diff; if (perms[3] == 'p') { @@ -117,7 +116,7 @@ if (perms[1] == 'w') total_private_writeable += diff; else -@@ -714,17 +733,21 @@ static int one_proc (struct pids_stack * +@@ -708,17 +727,21 @@ static int one_proc(const proc_t * p) justify_print("----------------", maxw1, 0); justify_print("-------", maxw2, 1); justify_print("-------", maxw3, 1); @@ -141,7 +140,7 @@ } if (d_option) { printf -@@ -1037,16 +1060,18 @@ int main(int argc, char **argv) +@@ -1028,16 +1051,18 @@ int main(int argc, char **argv) while ((c = getopt_long(argc, argv, "xXrdqA:hVcC:nN:p", longopts, NULL)) != -1) switch (c) { case 'x': @@ -163,7 +162,7 @@ case 'q': q_option = 1; --- testsuite/pmap.test/pmap.exp -+++ testsuite/pmap.test/pmap.exp 2022-03-29 11:19:45.948044571 +0000 ++++ testsuite/pmap.test/pmap.exp 2018-06-05 09:23:53.955370363 +0000 @@ -8,16 +8,16 @@ set pmap_procname "${mypid}:\\s+\\S+\[^\ set pmap_initname "1:\\s+\\S+\[^\\r\]+\\s+" set pmap_std_header $pmap_procname diff --git a/procps-ng-3.3.17.tar.xz b/procps-ng-3.3.17.tar.xz new file mode 100644 index 0000000..be1edc5 --- /dev/null +++ b/procps-ng-3.3.17.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4518b3e7aafd34ec07d0063d250fd474999b20b200218c3ae56f5d2113f141b4 +size 1008428 diff --git a/procps-ng-3.3.8-accuracy.dif b/procps-ng-3.3.8-accuracy.dif new file mode 100644 index 0000000..352b730 --- /dev/null +++ b/procps-ng-3.3.8-accuracy.dif @@ -0,0 +1,99 @@ +--- + ps/common.h | 1 + + ps/global.c | 5 ++++- + ps/output.c | 19 ++++++++++--------- + 3 files changed, 15 insertions(+), 10 deletions(-) + +--- ps/common.h ++++ ps/common.h 2018-04-04 11:14:33.915688098 +0000 +@@ -303,6 +303,7 @@ extern int running_only; + extern int screen_cols; + extern int screen_rows; + extern time_t seconds_since_boot; ++extern unsigned long long jiffies_since_boot; + extern selection_node *selection_list; + extern unsigned simple_select; + extern sort_node *sort_list; +--- ps/global.c ++++ ps/global.c 2018-04-04 11:14:33.915688098 +0000 +@@ -78,6 +78,7 @@ int prefer_bsd_defaults = -1 + int screen_cols = -1; + int screen_rows = -1; + time_t seconds_since_boot = -1; ++unsigned long long jiffies_since_boot = -1; + selection_node *selection_list = (selection_node *)0xdeadbeef; + unsigned simple_select = 0xffffffff; + sort_node *sort_list = (sort_node *)0xdeadbeef; /* ready-to-use sort list */ +@@ -361,6 +362,7 @@ static const char *set_personality(void) + /************ Call this to reinitialize everything ***************/ + void reset_global(void){ + static proc_t p; ++ double uptime_secs; + reset_selection_list(); + look_up_our_self(&p); + set_screen_size(); +@@ -383,7 +385,8 @@ void reset_global(void){ + negate_selection = 0; + page_size = getpagesize(); + running_only = 0; +- seconds_since_boot = uptime(0,0); ++ seconds_since_boot = uptime(&uptime_secs,0); ++ jiffies_since_boot = ((long double)uptime_secs * Hertz); + selection_list = NULL; + simple_select = 0; + sort_list = NULL; +--- ps/output.c ++++ ps/output.c 2018-04-04 11:14:33.915688098 +0000 +@@ -134,6 +134,7 @@ static int sr_ ## NAME (const proc_t* P, + #define cook_time(P) (P->utime + P->stime) / Hertz + + #define cook_etime(P) (((unsigned long long)seconds_since_boot >= (P->start_time / Hertz)) ? ((unsigned long long)seconds_since_boot - (P->start_time / Hertz)) : 0) ++#define cook_jtime(P) (((unsigned long long)jiffies_since_boot >= (P->start_time)) ? ((unsigned long long)jiffies_since_boot - (P->start_time)) : 0) + + #define CMP_COOKED_TIME(NAME) \ + static int sr_ ## NAME (const proc_t* P, const proc_t* Q) { \ +@@ -507,11 +508,11 @@ static int pr_etimes(char *restrict cons + static int pr_c(char *restrict const outbuf, const proc_t *restrict const pp){ + unsigned long long total_time; /* jiffies used by this process */ + unsigned pcpu = 0; /* scaled %cpu, 99 means 99% */ +- unsigned long long seconds; /* seconds of process life */ ++ unsigned long long jiffies; /* jiffies of process life */ + total_time = pp->utime + pp->stime; + if(include_dead_children) total_time += (pp->cutime + pp->cstime); +- seconds = cook_etime(pp); +- if(seconds) pcpu = (total_time * 100ULL / Hertz) / seconds; ++ jiffies = cook_jtime(pp); ++ if(jiffies) pcpu = (total_time * 100ULL) / jiffies; + if (pcpu > 99U) pcpu = 99U; + return snprintf(outbuf, COLWID, "%2u", pcpu); + } +@@ -519,11 +520,11 @@ static int pr_c(char *restrict const out + static int pr_pcpu(char *restrict const outbuf, const proc_t *restrict const pp){ + unsigned long long total_time; /* jiffies used by this process */ + unsigned pcpu = 0; /* scaled %cpu, 999 means 99.9% */ +- unsigned long long seconds; /* seconds of process life */ ++ unsigned long long jiffies; /* jiffies of process life */ + total_time = pp->utime + pp->stime; + if(include_dead_children) total_time += (pp->cutime + pp->cstime); +- seconds = cook_etime(pp); +- if(seconds) pcpu = (total_time * 1000ULL / Hertz) / seconds; ++ jiffies = cook_jtime(pp); ++ if(jiffies) pcpu = (total_time * 1000ULL) / jiffies; + if (pcpu > 999U) + return snprintf(outbuf, COLWID, "%u", pcpu/10U); + return snprintf(outbuf, COLWID, "%u.%u", pcpu/10U, pcpu%10U); +@@ -532,11 +533,11 @@ static int pr_pcpu(char *restrict const + static int pr_cp(char *restrict const outbuf, const proc_t *restrict const pp){ + unsigned long long total_time; /* jiffies used by this process */ + unsigned pcpu = 0; /* scaled %cpu, 999 means 99.9% */ +- unsigned long long seconds; /* seconds of process life */ ++ unsigned long long jiffies; /* jiffies of process life */ + total_time = pp->utime + pp->stime; + if(include_dead_children) total_time += (pp->cutime + pp->cstime); +- seconds = cook_etime(pp); +- if(seconds) pcpu = (total_time * 1000ULL / Hertz) / seconds; ++ jiffies = cook_jtime(pp); ++ if(jiffies) pcpu = (total_time * 1000ULL) / jiffies; + if (pcpu > 999U) pcpu = 999U; + return snprintf(outbuf, COLWID, "%3u", pcpu); + } diff --git a/procps-ng-3.3.8-bnc634840.patch b/procps-ng-3.3.8-bnc634840.patch index c41087f..8420855 100644 --- a/procps-ng-3.3.8-bnc634840.patch +++ b/procps-ng-3.3.8-bnc634840.patch @@ -12,7 +12,7 @@ Index: procps-3.2.8/top.c --- top/top.c +++ top/top.c 2018-04-04 11:33:59.278280201 +0000 -@@ -3557,7 +3557,13 @@ static void before (char *me) { +@@ -3691,7 +3691,13 @@ static void before (char *me) { sa.sa_flags = 0; for (i = SIGRTMAX; i; i--) { switch (i) { diff --git a/procps-ng-3.3.8-ignore-scan_unevictable_pages.patch b/procps-ng-3.3.8-ignore-scan_unevictable_pages.patch index ee311d1..8f64330 100644 --- a/procps-ng-3.3.8-ignore-scan_unevictable_pages.patch +++ b/procps-ng-3.3.8-ignore-scan_unevictable_pages.patch @@ -13,7 +13,7 @@ Signed-off-by: Takashi Iwai --- a/sysctl.c +++ b/sysctl.c -@@ -58,6 +58,7 @@ static const char DEFAULT_PRELOAD[] = "/ +@@ -59,6 +59,7 @@ static const char DEFAULT_PRELOAD[] = "/ static const char *DEPRECATED[] = { "base_reachable_time", "retrans_time", diff --git a/procps-ng-3.3.8-petabytes.patch b/procps-ng-3.3.8-petabytes.patch index 1b30726..de342cd 100644 --- a/procps-ng-3.3.8-petabytes.patch +++ b/procps-ng-3.3.8-petabytes.patch @@ -3,9 +3,9 @@ 1 file changed, 3 insertions(+), 3 deletions(-) --- top/top.c -+++ top/top.c 2022-03-29 10:24:43.327490984 +0000 -@@ -1564,9 +1564,9 @@ static inline const char *make_str_utf8 - static const char *scale_mem (int target, float num, int width, int justr) { ++++ top/top.c 2018-04-04 11:49:56.472660056 +0000 +@@ -1626,9 +1626,9 @@ static inline const char *make_str_utf8 + static const char *scale_mem (int target, unsigned long num, int width, int justr) { // SK_Kb SK_Mb SK_Gb SK_Tb SK_Pb SK_Eb #ifdef BOOST_MEMORY - static const char *fmttab[] = { "%.0f", "%#.1f%c", "%#.3f%c", "%#.3f%c", "%#.3f%c", NULL }; @@ -15,13 +15,13 @@ + static const char *fmttab[] = { "%.0f", "%.1f%c", "%.1f%c", "%.1f%c", "%.1f%c", "%.1f%c", NULL }; #endif static char buf[SMLBUFSIZ]; - char *psfx; -@@ -1576,7 +1576,7 @@ static const char *scale_mem (int target - if (Rc.zero_suppress && 0 >= num) + float scaled_num; +@@ -1640,7 +1640,7 @@ static const char *scale_mem (int target goto end_justifies; + scaled_num = num; - for (i = SK_Kb, psfx = Scaled_sfxtab; i < SK_Eb; psfx++, i++) { + for (i = SK_Kb, psfx = Scaled_sfxtab; i <= SK_Eb; psfx++, i++) { if (i >= target - && (width >= snprintf(buf, sizeof(buf), fmttab[i], num, *psfx))) + && (width >= snprintf(buf, sizeof(buf), fmttab[i], scaled_num, *psfx))) goto end_justifies; diff --git a/procps-ng-3.3.8-readeof.patch b/procps-ng-3.3.8-readeof.patch index adfccbc..ccdaf20 100644 --- a/procps-ng-3.3.8-readeof.patch +++ b/procps-ng-3.3.8-readeof.patch @@ -3,9 +3,9 @@ 1 file changed, 10 insertions(+), 10 deletions(-) --- proc/readproc.c -+++ proc/readproc.c 2022-03-28 11:51:04.751862744 +0000 -@@ -728,7 +728,7 @@ static int file2str(const char *director - } ++++ proc/readproc.c 2018-06-05 08:54:06.408030693 +0000 +@@ -675,7 +675,7 @@ static int file2str(const char *director + else ub->buf = xcalloc((ub->siz = buffGRW)); len = snprintf(path, sizeof path, "%s/%s", directory, what); if (len <= 0 || (size_t)len >= sizeof path) return -1; - if (-1 == (fd = open(path, O_RDONLY, 0))) return -1; @@ -13,9 +13,9 @@ while (0 < (num = read(fd, ub->buf + tot_read, ub->siz - tot_read))) { tot_read += num; if (tot_read < ub->siz) break; -@@ -752,25 +752,25 @@ static int file2str(const char *director - static char **file2strvec(const char *directory, const char *what) { - char buf[2048]; /* read buf bytes at a time */ +@@ -695,25 +695,25 @@ static int file2str(const char *director + static char** file2strvec(const char* directory, const char* what) { + char buf[2048]; /* read buf bytes at a time */ char *p, *rbuf = 0, *endbuf, **q, **ret, *strp; - int fd, tot = 0, n, c, end_of_file = 0; - int align; @@ -30,37 +30,37 @@ /* read whole file into a memory buffer, allocating as we go */ while ((n = read(fd, buf, sizeof buf - 1)) >= 0) { -- if (n < (int)(sizeof buf - 1)) -+ if (n < (sizeof(buf) - 1)) - end_of_file = 1; -- if (n <= 0 && tot <= 0) { /* nothing read now, nothing read before */ -+ if (n <= 0 && tot <= 0) /* nothing read now, nothing read before */ - break; /* process died between our open and read */ -- } +- if (n < (int)(sizeof buf - 1)) ++ if (n < sizeof buf - 1) + end_of_file = 1; +- if (n <= 0 && tot <= 0) { /* nothing read now, nothing read before */ ++ if (n <= 0 && tot <= 0) /* nothing read now, nothing read before */ + break; /* process died between our open and read */ +- } + - /* ARG_LEN is our guesstimated median length of a command-line argument - or environment variable (the minimum is 1, the maximum is 131072) */ - #define ARG_LEN 64 -- if (tot >= INT_MAX / (ARG_LEN + (int)sizeof(char*)) * ARG_LEN - n) { -+ if (tot >= INT_MAX / (ARG_LEN + sizeof(char*)) * ARG_LEN - n) { - end_of_file = 1; /* integer overflow: null-terminate and break */ - n = 0; /* but tot > 0 */ - } -@@ -804,7 +804,7 @@ static char **file2strvec(const char *di - c = sizeof(char*); /* one extra for NULL term */ + /* ARG_LEN is our guesstimated median length of a command-line argument + or environment variable (the minimum is 1, the maximum is 131072) */ + #define ARG_LEN 64 +- if (tot >= INT_MAX / (ARG_LEN + (int)sizeof(char*)) * ARG_LEN - n) { ++ if (tot >= INT_MAX / (ARG_LEN + sizeof(char*)) * ARG_LEN - n) { + end_of_file = 1; /* integer overflow: null-terminate and break */ + n = 0; /* but tot > 0 */ + } +@@ -741,7 +741,7 @@ static char** file2strvec(const char* di + c = sizeof(char*); /* one extra for NULL term */ for (p = rbuf; p < endbuf; p++) { - if (!*p || *p == '\n') { -- if (c >= INT_MAX - (tot + (int)sizeof(char*) + align)) break; -+ if (c >= INT_MAX - (tot + sizeof(char*) + align)) break; - c += sizeof(char*); - } - if (*p == '\n') -@@ -817,7 +817,7 @@ static char **file2strvec(const char *di - q = ret = (char**) (endbuf+align); /* ==> free(*ret) to dealloc */ + if (!*p || *p == '\n') { +- if (c >= INT_MAX - (tot + (int)sizeof(char*) + align)) break; ++ if (c >= INT_MAX - (tot + sizeof(char*) + align)) break; + c += sizeof(char*); + } + if (*p == '\n') +@@ -753,7 +753,7 @@ static char** file2strvec(const char* di + q = ret = (char**) (endbuf+align); /* ==> free(*ret) to dealloc */ for (strp = p = rbuf; p < endbuf; p++) { - if (!*p) { /* NUL char implies that */ -- if (c < 2 * (int)sizeof(char*)) break; -+ if (c < 2 * sizeof(char*)) break; - c -= sizeof(char*); - *q++ = strp; /* point ptrs to the strings */ - strp = p+1; /* next string -> next char */ + if (!*p) { /* NUL char implies that */ +- if (c < 2 * (int)sizeof(char*)) break; ++ if (c < 2 * sizeof(char*)) break; + c -= sizeof(char*); + *q++ = strp; /* point ptrs to the strings */ + strp = p+1; /* next string -> next char */ diff --git a/procps-ng-3.3.8-tinfo.dif b/procps-ng-3.3.8-tinfo.dif index 63fbd98..ed19e57 100644 --- a/procps-ng-3.3.8-tinfo.dif +++ b/procps-ng-3.3.8-tinfo.dif @@ -4,9 +4,9 @@ 2 files changed, 9 insertions(+), 1 deletion(-) --- Makefile.am -+++ Makefile.am 2022-03-29 10:32:27.691037616 +0000 -@@ -190,7 +190,7 @@ if CYGWIN - top_top_SOURCES += lib/strverscmp.c ++++ Makefile.am 2018-04-04 12:28:14.937957527 +0000 +@@ -171,7 +171,7 @@ else + slabtop_LDADD = $(LDADD) @NCURSES_LIBS@ endif -top_top_LDADD = $(LDADD) @NCURSES_LIBS@ $(DL_LIB) @@ -15,8 +15,8 @@ if BUILD_SKILL --- configure.ac -+++ configure.ac 2022-03-29 10:33:50.621534246 +0000 -@@ -233,8 +233,16 @@ else ++++ configure.ac 2018-04-04 12:29:23.364676155 +0000 +@@ -194,8 +194,16 @@ else else WATCH_NCURSES_LIBS="$NCURSES_LIBS" fi @@ -31,5 +31,5 @@ AC_SUBST([NCURSES_LIBS]) +AC_SUBST([TOP_NCURSES_LIBS]) AC_SUBST([WATCH_NCURSES_LIBS]) + AC_SUBST([WATCH_NCURSES_CFLAGS]) - AC_ARG_WITH([systemd], diff --git a/procps-ng-3.3.8-vmstat-terabyte.dif b/procps-ng-3.3.8-vmstat-terabyte.dif index 04144c7..d2f8212 100644 --- a/procps-ng-3.3.8-vmstat-terabyte.dif +++ b/procps-ng-3.3.8-vmstat-terabyte.dif @@ -3,15 +3,15 @@ 1 file changed, 2 insertions(+), 2 deletions(-) --- vmstat.c -+++ vmstat.c 2022-03-29 10:36:49.654287539 +0000 -@@ -337,8 +337,8 @@ static void new_header(void) ++++ vmstat.c 2016-07-11 13:18:04.993371059 +0000 +@@ -273,8 +273,8 @@ static void new_header(void) static unsigned long unitConvert(unsigned long size) { -- float cvSize; -- cvSize = (float)size / dataUnit * ((statMode == SLABSTAT) ? 1 : 1024); -+ long double cvSize; -+ cvSize = (long double)size / dataUnit * ((statMode == SLABSTAT) ? 1 : 1024); - return ((unsigned long)cvSize); +- float cvSize; +- cvSize = (float)size / dataUnit * ((statMode == SLABSTAT) ? 1 : 1024); ++ long double cvSize; ++ cvSize = (long double)size / dataUnit * ((statMode == SLABSTAT) ? 1 : 1024); + return ((unsigned long)cvSize); } diff --git a/procps-ng-3.3.9-w-notruncate.diff b/procps-ng-3.3.9-w-notruncate.diff index b327a7c..faa54e2 100644 --- a/procps-ng-3.3.9-w-notruncate.diff +++ b/procps-ng-3.3.9-w-notruncate.diff @@ -4,7 +4,7 @@ 2 files changed, 18 insertions(+), 3 deletions(-) --- w.1 -+++ w.1 2022-03-23 15:02:32.728894724 +0000 ++++ w.1 2021-02-10 09:47:10.894888530 +0000 @@ -40,6 +40,9 @@ and a \fB\-s\fR, \fB\-\-short\fR Use the short format. Don't print the login time, JCPU or PCPU times. @@ -16,32 +16,32 @@ Toggle printing the .B from --- w.c -+++ w.c 2022-03-28 11:20:25.453174765 +0000 -@@ -450,7 +450,7 @@ static int find_best_proc( ++++ w.c 2021-02-10 09:51:09.750284453 +0000 +@@ -394,7 +394,7 @@ static const proc_t *getproc(const utmp_ + } - static void showinfo( - utmp_t * u, int formtype, int maxcmd, int from, -- const int userlen, const int fromlen, const int ip_addresses) -+ int userlen, int fromlen, const int ip_addresses) + static void showinfo(utmp_t * u, int formtype, int maxcmd, int from, +- const int userlen, const int fromlen, const int ip_addresses) ++ int userlen, int fromlen, const int ip_addresses) { - unsigned long long jcpu, pcpu; - unsigned i; -@@ -481,7 +481,13 @@ static void showinfo( - strncpy(uname, u->ut_user, UT_NAMESIZE); + unsigned long long jcpu; + int ut_pid_found; +@@ -424,7 +424,13 @@ static void showinfo(utmp_t * u, int for + strncpy(uname, u->ut_user, UT_NAMESIZE); - if (formtype) { -- printf("%-*.*s%-9.8s", userlen + 1, userlen, uname, u->ut_line); -+ int utlnlen = 8; -+ if (formtype > 1) { -+ userlen = strnlen(uname, UT_NAMESIZE); -+ fromlen = strnlen(u->ut_host, UT_HOSTSIZE); -+ utlnlen = strnlen(u->ut_line, UT_LINESIZE); -+ } -+ printf("%-*.*s%-*.*s", userlen + 1, userlen, uname, utlnlen + 1, utlnlen, u->ut_line); - if (from) - print_from(u, ip_addresses, fromlen); + if (formtype) { +- printf("%-*.*s%-9.8s", userlen + 1, userlen, uname, u->ut_line); ++ int utlnlen = 8; ++ if (formtype > 1) { ++ userlen = strnlen(uname, UT_NAMESIZE); ++ fromlen = strnlen(u->ut_host, UT_HOSTSIZE); ++ utlnlen = strnlen(u->ut_line, UT_LINESIZE); ++ } ++ printf("%-*.*s%-*.*s", userlen + 1, userlen, uname, utlnlen + 1, utlnlen, u->ut_line); + if (from) + print_from(u, ip_addresses, fromlen); #ifdef HAVE_UTMPX_H -@@ -526,6 +532,7 @@ static void __attribute__ ((__noreturn__ +@@ -478,6 +484,7 @@ static void __attribute__ ((__noreturn__ fputs(_(" -h, --no-header do not print header\n"),out); fputs(_(" -u, --no-current ignore current process username\n"),out); fputs(_(" -s, --short short format\n"),out); @@ -49,7 +49,7 @@ fputs(_(" -f, --from show remote hostname field\n"),out); fputs(_(" -o, --old-style old style output\n"),out); fputs(_(" -i, --ip-addr display IP address instead of hostname (if possible)\n"), out); -@@ -562,6 +569,7 @@ int main(int argc, char **argv) +@@ -514,6 +521,7 @@ int main(int argc, char **argv) {"no-header", no_argument, NULL, 'h'}, {"no-current", no_argument, NULL, 'u'}, {"short", no_argument, NULL, 's'}, @@ -57,7 +57,7 @@ {"from", no_argument, NULL, 'f'}, {"old-style", no_argument, NULL, 'o'}, {"ip-addr", no_argument, NULL, 'i'}, -@@ -583,7 +591,7 @@ int main(int argc, char **argv) +@@ -535,7 +543,7 @@ int main(int argc, char **argv) #endif while ((ch = @@ -66,7 +66,7 @@ switch (ch) { case 'h': header = 0; -@@ -591,6 +599,10 @@ int main(int argc, char **argv) +@@ -546,6 +554,10 @@ int main(int argc, char **argv) case 's': longform = 0; break; diff --git a/procps-ng-3.3.9-watch.patch b/procps-ng-3.3.9-watch.patch new file mode 100644 index 0000000..b3ea05d --- /dev/null +++ b/procps-ng-3.3.9-watch.patch @@ -0,0 +1,14 @@ +--- + proc/libprocps.sym | 1 + + 1 file changed, 1 insertion(+) + +--- proc/libprocps.sym ++++ proc/libprocps.sym 2016-07-11 12:45:32.463107052 +0000 +@@ -13,6 +13,7 @@ global: + get_ns_id; + get_ns_name; + get_pid_digits; ++ get_proc_stats; + get_slabinfo; + getbtime; + getdiskstat; diff --git a/procps-ng-4.0.0-accuracy.dif b/procps-ng-4.0.0-accuracy.dif deleted file mode 100644 index 3c35588..0000000 --- a/procps-ng-4.0.0-accuracy.dif +++ /dev/null @@ -1,176 +0,0 @@ ---- - proc/pids.c | 18 +++++++++++++++--- - proc/pids.h | 1 + - ps/common.h | 3 +++ - ps/display.c | 1 + - ps/global.c | 1 + - ps/output.c | 18 +++++++++--------- - 6 files changed, 30 insertions(+), 12 deletions(-) - ---- proc/pids.c -+++ proc/pids.c 2022-03-30 08:53:15.180093896 +0000 -@@ -92,6 +92,7 @@ struct pids_info { - PROCTAB *fetch_PT; // oldlib interface for 'select' & 'reap' - unsigned long hertz; // for the 'TIME' & 'UTILIZATION' calculations - double boot_seconds; // for TIME_ELAPSED & 'UTILIZATION' calculations -+ unsigned long long boot_tics; // for TIME_ELAPSED & 'UTILIZATION' calculations - PROCTAB *get_PT; // oldlib interface for active 'get' - struct stacks_extent *get_ext; // for active 'get' (also within 'extents') - enum pids_fetch_type get_type; // last known type of 'get' request -@@ -282,6 +283,7 @@ setDECL(TICS_USER_C) { (void)I; R->re - setDECL(TIME_ALL) { R->result.real = ((double)P->utime + P->stime) / I->hertz; } - setDECL(TIME_ALL_C) { R->result.real = ((double)P->utime + P->stime + P->cutime + P->cstime) / I->hertz; } - setDECL(TIME_ELAPSED) { double t = (double)P->start_time / I->hertz; R->result.real = I->boot_seconds > t ? I->boot_seconds - t : 0; } -+setDECL(TICS_ELAPSED) { R->result.ull_int = I->boot_tics >= P->start_time ? I->boot_tics - P->start_time : 0; } - setDECL(TIME_START) { R->result.real = (double)P->start_time / I->hertz; } - REG_set(TTY, s_int, tty) - setDECL(TTY_NAME) { char buf[64]; freNAME(str)(R); dev_to_tty(buf, sizeof(buf), P->tty, P->tid, ABBREV_DEV); if (!(R->result.str = strdup(buf))) I->seterr = 1; } -@@ -571,6 +573,7 @@ static struct { - { RS(TIME_ALL), f_stat, NULL, QS(real), 0, TS(real) }, - { RS(TIME_ALL_C), f_stat, NULL, QS(real), 0, TS(real) }, - { RS(TIME_ELAPSED), f_stat, NULL, QS(real), 0, TS(real) }, -+ { RS(TICS_ELAPSED), f_stat, NULL, QS(ull_int), 0, TS(ull_int) }, - { RS(TIME_START), f_stat, NULL, QS(real), 0, TS(real) }, - { RS(TTY), f_stat, NULL, QS(s_int), 0, TS(s_int) }, - { RS(TTY_NAME), f_stat, FF(str), QS(strvers), 0, TS(str) }, -@@ -1441,8 +1444,11 @@ fresh_start: - /* when in a namespace with proc mounted subset=pid, - we will be restricted to process information only */ - info->boot_seconds = 0; -- if (0 >= procps_uptime(&up_secs, NULL)) -+ info->boot_tics = 0; -+ if (0 >= procps_uptime(&up_secs, NULL)) { - info->boot_seconds = up_secs; -+ info->boot_tics = up_secs * info->hertz; -+ } - - if (NULL == info->read_something(info->get_PT, &info->get_proc)) - return NULL; -@@ -1484,8 +1490,11 @@ PROCPS_EXPORT struct pids_fetch *procps_ - /* when in a namespace with proc mounted subset=pid, - we will be restricted to process information only */ - info->boot_seconds = 0; -- if (0 >= procps_uptime(&up_secs, NULL)) -+ info->boot_tics = 0; -+ if (0 >= procps_uptime(&up_secs, NULL)) { - info->boot_seconds = up_secs; -+ info->boot_tics = up_secs * info->hertz; -+ } - - rc = pids_stacks_fetch(info); - -@@ -1589,8 +1598,11 @@ PROCPS_EXPORT struct pids_fetch *procps_ - /* when in a namespace with proc mounted subset=pid, - we will be restricted to process information only */ - info->boot_seconds = 0; -- if (0 >= procps_uptime(&up_secs, NULL)) -+ info->boot_tics = 0; -+ if (0 >= procps_uptime(&up_secs, NULL)) { - info->boot_seconds = up_secs; -+ info->boot_tics = up_secs * info->hertz; -+ } - - rc = pids_stacks_fetch(info); - ---- proc/pids.h -+++ proc/pids.h 2022-03-30 08:53:15.180093896 +0000 -@@ -165,6 +165,7 @@ enum pids_item { - PIDS_TIME_ALL, // real derived from stat: (utime + stime) / hertz - PIDS_TIME_ALL_C, // real derived from stat: (utime + stime + cutime + cstime) / hertz - PIDS_TIME_ELAPSED, // real derived from /proc/uptime - (starttime / hertz) -+ PIDS_TICS_ELAPSED, // ull_int derived from /proc/uptime - starttime - PIDS_TIME_START, // real derived from stat: start_time / hertz - PIDS_TTY, // s_int stat: tty_nr - PIDS_TTY_NAME, // str derived from TTY ---- ps/common.h -+++ ps/common.h 2022-03-30 08:53:15.180093896 +0000 -@@ -42,6 +42,8 @@ - #define namREL(e) rel_ ## e - #define makEXT(e) extern int namREL(e); - #define makREL(e) int namREL(e) = -1; -+#define makEXTULL(e) extern unsigned long long namREL(e); -+#define makRELULL(e) unsigned long long namREL(e) = -1; - #define chkREL(e) if (namREL(e) < 0) { \ - Pids_items[Pids_index] = PIDS_ ## e; \ - namREL(e) = (Pids_index < PIDSITEMS) ? Pids_index++ : rel_noop; } -@@ -160,6 +162,7 @@ makEXT(TICS_ALL) - makEXT(TICS_ALL_C) - makEXT(TIME_ALL) - makEXT(TIME_ELAPSED) -+makEXT(TICS_ELAPSED) - makEXT(TICS_BEGAN) - makEXT(TTY) - makEXT(TTY_NAME) ---- ps/display.c -+++ ps/display.c 2022-03-30 08:54:22.410871769 +0000 -@@ -584,6 +584,7 @@ static void finalize_stacks (void) - chkREL(TICS_ALL_C) - chkREL(TIME_ALL) - chkREL(TIME_ELAPSED) -+ chkREL(TICS_ELAPSED) - chkREL(TICS_BEGAN) - // special items with 'extra' used as former pcpu - chkREL(extra) ---- ps/global.c -+++ ps/global.c 2022-03-30 08:53:15.180093896 +0000 -@@ -141,6 +141,7 @@ makREL(TICS_ALL) - makREL(TICS_ALL_C) - makREL(TIME_ALL) - makREL(TIME_ELAPSED) -+makREL(TICS_ELAPSED) - makREL(TICS_BEGAN) - makREL(TTY) - makREL(TTY_NAME) ---- ps/output.c -+++ ps/output.c 2022-03-30 08:53:15.180093896 +0000 -@@ -517,13 +517,13 @@ setREL1(TIME_ELAPSED) - static int pr_c(char *restrict const outbuf, const proc_t *restrict const pp){ - unsigned long long total_time; /* jiffies used by this process */ - unsigned pcpu; /* scaled %cpu, 99 means 99% */ -- unsigned long long seconds; /* seconds of process life */ -+ unsigned long long jiffies; /* jiffies of process life */ - setREL4(TICS_ALL,TICS_ALL_C,TIME_ELAPSED,UTILIZATION) - pcpu = 0; - if(include_dead_children) total_time = rSv(TICS_ALL_C, ull_int, pp); - else total_time = rSv(TICS_ALL, ull_int, pp); -- seconds = rSv(TIME_ELAPSED, real, pp); -- if(seconds) pcpu = (total_time * 100ULL / Hertz) / seconds; -+ jiffies = rSv(TICS_ELAPSED, ull_int, pp); -+ if(jiffies) pcpu = (total_time * 100ULL) / jiffies; - if (pcpu > 99U) pcpu = 99U; - return snprintf(outbuf, COLWID, "%2u", pcpu); - } -@@ -532,13 +532,13 @@ setREL4(TICS_ALL,TICS_ALL_C,TIME_ELAPSED - static int pr_pcpu(char *restrict const outbuf, const proc_t *restrict const pp){ - unsigned long long total_time; /* jiffies used by this process */ - unsigned pcpu; /* scaled %cpu, 999 means 99.9% */ -- unsigned long long seconds; /* seconds of process life */ -+ unsigned long long jiffies; /* jiffies of process life */ - setREL4(TICS_ALL,TICS_ALL_C,TIME_ELAPSED,UTILIZATION) - pcpu = 0; - if(include_dead_children) total_time = rSv(TICS_ALL_C, ull_int, pp); - else total_time = rSv(TICS_ALL, ull_int, pp); -- seconds = rSv(TIME_ELAPSED, real, pp); -- if(seconds) pcpu = (total_time * 1000ULL / Hertz) / seconds; -+ jiffies = rSv(TICS_ELAPSED, ull_int, pp); -+ if(jiffies) pcpu = (total_time * 1000ULL) / jiffies; - if (pcpu > 999U) - return snprintf(outbuf, COLWID, "%u", pcpu/10U); - return snprintf(outbuf, COLWID, "%u.%u", pcpu/10U, pcpu%10U); -@@ -548,13 +548,13 @@ setREL4(TICS_ALL,TICS_ALL_C,TIME_ELAPSED - static int pr_cp(char *restrict const outbuf, const proc_t *restrict const pp){ - unsigned long long total_time; /* jiffies used by this process */ - unsigned pcpu; /* scaled %cpu, 999 means 99.9% */ -- unsigned long long seconds; /* seconds of process life */ -+ unsigned long long jiffies; /* jiffies of process life */ - setREL4(TICS_ALL,TICS_ALL_C,TIME_ELAPSED,UTILIZATION) - pcpu = 0; - if(include_dead_children) total_time = rSv(TICS_ALL_C, ull_int, pp); - else total_time = rSv(TICS_ALL, ull_int, pp); -- seconds = rSv(TIME_ELAPSED, real, pp); -- if(seconds) pcpu = (total_time * 1000ULL / Hertz) / seconds; -+ jiffies = rSv(TICS_ELAPSED, ull_int, pp); -+ if(jiffies) pcpu = (total_time * 1000ULL) / jiffies; - if (pcpu > 999U) pcpu = 999U; - return snprintf(outbuf, COLWID, "%3u", pcpu); - } diff --git a/procps-ng-4.0.0-floats.dif b/procps-ng-4.0.0-floats.dif deleted file mode 100644 index 139bd94..0000000 --- a/procps-ng-4.0.0-floats.dif +++ /dev/null @@ -1,65 +0,0 @@ ---- - lib/strutils.c | 22 ++++++++++++---------- - 1 file changed, 12 insertions(+), 10 deletions(-) - ---- lib/strutils.c -+++ lib/strutils.c 2021-02-09 10:11:25.000000000 +0000 -@@ -20,6 +20,8 @@ - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -+#include -+#include - #include - #include - -@@ -71,9 +73,9 @@ double strtod_or_err(const char *str, co - */ - double strtod_nol_or_err(char *str, const char *errmesg) - { -- double num; -+ long double num; - const char *cp, *radix; -- double mult; -+ long double mult; - int negative = 0; - - if (str != NULL && *str != '\0') { -@@ -95,29 +97,29 @@ double strtod_nol_or_err(char *str, cons - mult=0.1; - while(isdigit(*radix)) { - radix++; -- mult *= 10; -+ mult *= 10.0; - } - while(isdigit(*cp)) { -- num += (*cp - '0') * mult; -- mult /= 10; -+ num += (long double)(*cp - '0') * mult; -+ mult /= 10.0; - cp++; - } - /* got the integers */ - if (*cp == '\0') -- return (negative?-num:num); -+ return (double)(negative?-num:num); - if (*cp != '.' && *cp != ',') - error(EXIT_FAILURE, EINVAL, "%s: '%s'", errmesg, str); - - cp++; - mult = 0.1; - while(isdigit(*cp)) { -- num += (*cp - '0') * mult; -- mult /= 10; -+ num += (long double)(*cp - '0') * mult; -+ mult /= 10.0; - cp++; - } - if (*cp == '\0') -- return (negative?-num:num); -+ return (double)(negative?-num:num); - } - error(EXIT_FAILURE, errno, "%s: '%s'", errmesg, str); -- return 0; -+ return (double)0; - } diff --git a/procps-ng-4.0.0-integer-overflow.patch b/procps-ng-4.0.0-integer-overflow.patch deleted file mode 100644 index 3267a6a..0000000 --- a/procps-ng-4.0.0-integer-overflow.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- - proc/meminfo.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - ---- proc/meminfo.c -+++ proc/meminfo.c 2022-03-29 09:50:45.076823155 +0000 -@@ -710,7 +710,9 @@ static int meminfo_read_failed ( - mHr(derived_mem_used) = (unsigned long)mem_used; - - if (mHr(HighFree) < mHr(HighTotal)) -- mHr(derived_mem_hi_used) = mHr(HighTotal) - mHr(HighFree); -+ mHr(derived_mem_hi_used) = mHr(HighTotal) - mHr(HighFree); -+ else -+ mHr(derived_mem_hi_used) = 0; - - if (0 == mHr(LowTotal)) { - mHr(LowTotal) = mHr(MemTotal); -@@ -718,6 +720,8 @@ static int meminfo_read_failed ( - } - if (mHr(LowFree) < mHr(LowTotal)) - mHr(derived_mem_lo_used) = mHr(LowTotal) - mHr(LowFree); -+ else -+ mHr(derived_mem_lo_used) = 0; - - if (mHr(SwapFree) < mHr(SwapTotal)) - mHr(derived_swap_used) = mHr(SwapTotal) - mHr(SwapFree); diff --git a/procps-ng-4.0.0.tar.xz b/procps-ng-4.0.0.tar.xz deleted file mode 100644 index 3dba9bc..0000000 --- a/procps-ng-4.0.0.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0f4d92794edb7a1c95bb3b8c1f823de62be5d0043459c2155fd07fa859c16513 -size 1002084 diff --git a/procps-rpmlintrc b/procps-rpmlintrc index 58d74f5..0bb1e23 100644 --- a/procps-rpmlintrc +++ b/procps-rpmlintrc @@ -1 +1 @@ -addFilter(".*W:.*shared-lib-calls-exit.*libproc-2\.so.*") +addFilter(".*W:.*shared-lib-calls-exit.*libprocps\.so.*") diff --git a/procps-v3.3.3-columns.dif b/procps-v3.3.3-columns.dif index 03b3212..a4df3c0 100644 --- a/procps-v3.3.3-columns.dif +++ b/procps-v3.3.3-columns.dif @@ -3,8 +3,8 @@ 1 file changed, 10 insertions(+), 3 deletions(-) --- ps/global.c -+++ ps/global.c 2022-03-29 09:31:24.242140877 +0000 -@@ -257,8 +257,11 @@ static void set_screen_size(void){ ++++ ps/global.c 2016-07-11 13:04:59.600533764 +0000 +@@ -147,8 +147,11 @@ static void set_screen_size(void){ screen_cols = ws.ws_col; // hmmm, NetBSD subtracts 1 screen_rows = ws.ws_row; @@ -18,7 +18,7 @@ columns = getenv("COLUMNS"); if(columns && *columns){ -@@ -400,6 +403,7 @@ static const char *set_personality(void) +@@ -290,6 +293,7 @@ static const char *set_personality(void) return NULL; case_aix: @@ -26,7 +26,7 @@ bsd_j_format = "FB_j"; bsd_l_format = "FB_l"; /* bsd_s_format not used */ -@@ -427,6 +431,7 @@ static const char *set_personality(void) +@@ -317,6 +321,7 @@ static const char *set_personality(void) case_sunos4: personality = PER_NO_DEFAULT_g; @@ -34,7 +34,7 @@ prefer_bsd_defaults = 1; bsd_j_format = "FB_j"; bsd_l_format = "FB_l"; -@@ -452,12 +457,14 @@ static const char *set_personality(void) +@@ -342,12 +347,14 @@ static const char *set_personality(void) case_hp: case_hpux: personality = PER_HPUX_x; @@ -49,10 +49,10 @@ return NULL; case_posix: -@@ -498,8 +505,8 @@ void reset_global(void){ - } - // --- interface -------------------------------------------------- - +@@ -365,8 +372,8 @@ void reset_global(void){ + double uptime_secs; + reset_selection_list(); + look_up_our_self(&p); - set_screen_size(); set_personality(); + set_screen_size(); diff --git a/procps-v3.3.3-ia64.diff b/procps-v3.3.3-ia64.diff index 2d3d3ba..8d1eb4c 100644 --- a/procps-v3.3.3-ia64.diff +++ b/procps-v3.3.3-ia64.diff @@ -1,6 +1,6 @@ --- proc/devname.c +++ proc/devname.c 2012-06-01 13:35:43.452010553 +0000 -@@ -51,6 +51,10 @@ +@@ -53,6 +53,10 @@ #define minor <-- do not use --> #endif diff --git a/procps-v3.3.3-read-sysctls-also-from-boot-sysctl.conf-kernelversion.diff b/procps-v3.3.3-read-sysctls-also-from-boot-sysctl.conf-kernelversion.diff index cca68b9..b9ef207 100644 --- a/procps-v3.3.3-read-sysctls-also-from-boot-sysctl.conf-kernelversion.diff +++ b/procps-v3.3.3-read-sysctls-also-from-boot-sysctl.conf-kernelversion.diff @@ -4,35 +4,35 @@ 2 files changed, 14 insertions(+) --- sysctl.8 -+++ sysctl.8 2022-03-29 10:21:47.926686046 +0000 -@@ -117,6 +117,8 @@ will read files from directories in the - order from top to bottom. Once a file of a given filename is loaded, any - file of the same name in subsequent directories is ignored. - ++++ sysctl.8 2021-02-10 10:05:27.781748090 +0000 +@@ -81,6 +81,8 @@ directories in the following list in giv + Once a file of a given filename is loaded, any file of the same name + in subsequent directories is ignored. + .br +/boot/sysctl.conf- +.br /etc/sysctl.d/*.conf .br /run/sysctl.d/*.conf --- sysctl.c -+++ sysctl.c 2022-03-29 10:20:51.795708321 +0000 -@@ -40,6 +40,7 @@ ++++ sysctl.c 2021-02-10 10:04:25.290952318 +0000 +@@ -39,6 +39,7 @@ #include #include #include +#include #include - #include -@@ -794,6 +795,7 @@ static int sortpairs(const void *A, cons - static int PreloadSystem(SettingList *setlist) + #include "c.h" +@@ -621,6 +622,7 @@ static int sortpairs(const void *A, cons + static int PreloadSystem(void) { unsigned di, i; + struct utsname uts; const char *dirs[] = { "/etc/sysctl.d", "/run/sysctl.d", -@@ -858,6 +860,16 @@ static int PreloadSystem(SettingList *se +@@ -685,6 +687,16 @@ static int PreloadSystem(void) } qsort(cfgs, ncfgs, sizeof(struct cfg *), sortpairs); @@ -42,7 +42,7 @@ + if (access(buf, R_OK) == 0) { + if (!Quiet) + printf("* Applying %s ...\n", buf); -+ Preload(setlist, buf); ++ Preload(buf); + } + } + diff --git a/procps.changes b/procps.changes index 5576af3..3fe2d72 100644 --- a/procps.changes +++ b/procps.changes @@ -1,96 +1,3 @@ -------------------------------------------------------------------- -Thu Mar 31 07:45:35 UTC 2022 - Dr. Werner Fink - -- Drop patch procps-ng-4.0.0-aix_sortformats.dif as replaced by - upstream patch 0002-ps-restore-aix-behavior-while-keeping-an-original-fi.patch -- Add upstream patches - * 0001-top-update-one-function-prologue-after-rcfile-change.patch - * 0003-ps-restore-thread-display-when-using-a-pidlist-optio.patch - -------------------------------------------------------------------- -Wed Mar 30 09:52:27 UTC 2022 - Dr. Werner Fink - -- Drop not needed patch procps-ng-3.3.9-watch.patch as the API - has changed here - -------------------------------------------------------------------- -Wed Mar 30 09:23:58 UTC 2022 - Dr. Werner Fink - -- Add patch procps-ng-4.0.0-floats.dif to avoid float errors on - 32bit architectures - -------------------------------------------------------------------- -Wed Mar 30 09:12:42 UTC 2022 - Dr. Werner Fink - -- Add patch procps-ng-4.0.0-aix_sortformats.dif to restore AIX sort - format support as well - -------------------------------------------------------------------- -Tue Mar 29 12:49:48 UTC 2022 - Dr. Werner Fink - -- Update to procps-ng-4.0.0 - + Warning: new shared library interface with libproc-2 - * Rename pwait to pidwait - * free: Add committed line option merge #25 - * free: Fix -h --si combined options issue #133, #223 - * free: Fix first column justification issue #229, #204, #206, Debian #1001689 - * free: Better spacing for Chinese language issue #213 - * library: renamed to libproc-2 and reset to 0:0:0 - * library: add support for accessing smaps_rollup issue #112, #201 - * library: add support for accessing autogroups - * library: add support for LIBPROC_HIDE_KERNEL env var merge #147 - * library: add support for cpu utilization to pids i/f - * pkill: Check for lt- variants of program name issue #192 - * pgrep: Add newline after regex error message merge #91 - * pgrep: Fix selection where uid/gid > 2^31 merge !146 - * pgrep: Select on cgroup v2 paths issue #168 - * ps: Add OOM and OOMADJ fields issue #198 - * ps: Add IO Accounting fields issue #184 - * ps: Add PSS and USS fields issue #112 - * ps: Add two new autogroup fields - * ps: Ignore SIGURG merge !142 - * slabtop: Don't combine d and o options issue #160 - * sysctl: Add support for systemd glob patterns issue #191 - * sysctl: Check resolved path to be under /proc/sys issue #179 - * sysctl: return non-zero if EINVAL return for write merge #76 - * sysctl.conf.5: Note max line length issue #77 - * top: added LOGID similar to 3.3.13 ps LUID - * top: added EXE identical to 3.3.17 ps EXE - * top: exploit some library smaps_rollup provisions issue #112 - * top: added four new IO accounting fields issue #184 - * top: 'F' key is now a new forest view 'focus' toggle - * top: summary area memory lines can print two abreast - * top: added two new autogroup fields - * top: added long versions of command line options - * top: added cpu utilization & 2 time related fields - * top: the time related fields can now be user scaled - * uptime: print short/pretty format correctly issue #217 - * vmstat: add -y option to remove first line merge !72 -- Remove patch now upstream fixed - * procps-3.3.17-bsc1181976.patch - * procps-ng-3.3.10-bnc634071_procstat2.diff - * procps-ng-3.3.10-fdleak.dif - * bsc1195468-23da4f40.patch -- Port patches - * procps-ng-3.3.10-errno.patch - * procps-ng-3.3.10-large_pcpu.patch - * procps-ng-3.3.10-slab.patch - * procps-ng-3.3.10-xen.dif - * procps-ng-3.3.11-pmap4suse.patch - * procps-ng-3.3.8-bnc634840.patch - * procps-ng-3.3.8-ignore-scan_unevictable_pages.patch - * procps-ng-3.3.8-petabytes.patch - * procps-ng-3.3.8-readeof.patch - * procps-ng-3.3.8-tinfo.dif - * procps-ng-3.3.8-vmstat-terabyte.dif - * procps-ng-3.3.9-w-notruncate.diff - * procps-v3.3.3-columns.dif - * procps-v3.3.3-ia64.diff - * procps-v3.3.3-read-sysctls-also-from-boot-sysctl.conf-kernelversion.diff -- Port and rename patch - * procps-ng-3.3.8-accuracy.dif becomes procps-ng-4.0.0-accuracy.dif - * procps-ng-3.3.10-integer-overflow.patch becomes procps-ng-4.0.0-integer-overflow.patch - ------------------------------------------------------------------- Fri Feb 4 09:21:59 UTC 2022 - Dr. Werner Fink diff --git a/procps.spec b/procps.spec index d776756..23c3525 100644 --- a/procps.spec +++ b/procps.spec @@ -16,8 +16,8 @@ # -%define somajor 0 -%define libname libproc-2-%{somajor} +%define somajor 8 +%define libname libprocps%{somajor} %if !0%{?usrmerged} %bcond_with bin2usr %else @@ -26,7 +26,7 @@ %bcond_without pidof %bcond_without nls Name: procps -Version: 4.0.0 +Version: 3.3.17 Release: 0 Summary: The ps utilities for /proc License: GPL-2.0-or-later AND LGPL-2.1-or-later @@ -35,14 +35,17 @@ URL: https://sf.net/projects/procps-ng/ Source: https://downloads.sourceforge.net/project/procps-ng/Production/procps-ng-%{version}.tar.xz #Alternate: https://gitlab.com/procps-ng/procps/-/archive/v%{version}/procps-v%{version}.tar.gz Source1: procps-rpmlintrc +Patch0: procps-ng-3.3.9-watch.patch Patch1: procps-v3.3.3-ia64.diff Patch3: procps-ng-3.3.9-w-notruncate.diff Patch7: procps-ng-3.3.8-readeof.patch Patch8: procps-ng-3.3.10-slab.patch -Patch10: procps-ng-4.0.0-accuracy.dif +Patch10: procps-ng-3.3.8-accuracy.dif Patch11: procps-ng-3.3.10-xen.dif +Patch12: procps-ng-3.3.10-fdleak.dif Patch13: procps-v3.3.3-columns.dif -Patch14: procps-ng-4.0.0-integer-overflow.patch +Patch14: procps-ng-3.3.10-integer-overflow.patch +Patch15: procps-ng-3.3.10-bnc634071_procstat2.diff Patch16: procps-ng-3.3.8-bnc634840.patch Patch17: procps-v3.3.3-read-sysctls-also-from-boot-sysctl.conf-kernelversion.diff Patch18: procps-ng-3.3.8-petabytes.patch @@ -57,12 +60,10 @@ Patch31: procps-ng-3.3.8-ignore-scan_unevictable_pages.patch Patch32: procps-ng-3.3.10-errno.patch # PATCH-FEATURE-SUSE -- Let upstream pmap behave similar to old suse pmap Patch33: procps-ng-3.3.11-pmap4suse.patch -# PATCH-FIX-UPSTREAM -- Avoid error on AIX sort formats -Patch34: 0001-top-update-one-function-prologue-after-rcfile-change.patch -Patch35: 0002-ps-restore-aix-behavior-while-keeping-an-original-fi.patch -Patch36: 0003-ps-restore-thread-display-when-using-a-pidlist-optio.patch -# PATCH-FIX-SUSE -- Avoid float errors on 32bit architectures -Patch37: procps-ng-4.0.0-floats.dif +# PATCH-FIX-UPSTREAM -- bsc#1181976 +Patch34: procps-3.3.17-bsc1181976.patch +# PATCH-FIX-UPSTREAM -- bsc#1195468 +Patch35: bsc1195468-23da4f40.patch BuildRequires: automake BuildRequires: dejagnu BuildRequires: diffutils @@ -120,15 +121,18 @@ The procps library can be used to read informations out from /proc the process information pseudo-file system. %prep -%setup -q -n %{name}-ng-%{version} +%setup -q +%patch0 %patch1 %patch3 -b .trcate %patch7 -b .rof %patch8 -b .cache %patch10 -b .acc %patch11 +%patch12 %patch13 -b .column %patch14 -b .ovrflw +%patch15 %patch16 %patch17 -b .sysctl %patch18 @@ -139,10 +143,8 @@ the process information pseudo-file system. %patch31 -p1 %patch32 %patch33 -b .pmap4us -%patch34 -p1 +%patch34 %patch35 -p1 -%patch36 -p1 -%patch37 %build test -s .tarball-version || echo %{version} > .tarball-version @@ -203,11 +205,11 @@ rm -f %{buildroot}%{_mandir}/*/man1/uptime.1 find %{buildroot} -type f -name "*.la" -delete -print rm -rf %{buildroot}%{_datadir}/doc/procps-ng -if cmp -s %{buildroot}%{_mandir}/man1/pidwait.1 %{buildroot}%{_mandir}/man1/pkill.1 +if cmp -s %{buildroot}%{_mandir}/man1/procps.1 %{buildroot}%{_mandir}/man1/ps.1 then - rm -vf %{buildroot}%{_mandir}/man1/pidwait.1 - (cat > %{buildroot}%{_mandir}/man1/pidwait.1)<<-'EOF' - .so man1/pkill.1 + rm -vf %{buildroot}%{_mandir}/man1/procps.1 + (cat > %{buildroot}%{_mandir}/man1/procps.1)<<-'EOF' + .so man1/ps.1 EOF fi @@ -350,7 +352,7 @@ test $error = no || exit 1 %{_bindir}/pidof %endif %{_bindir}/pmap -%{_bindir}/pidwait +%{_bindir}/pwait %{_bindir}/pwdx %{_bindir}/skill %{_bindir}/slabtop @@ -367,8 +369,9 @@ test $error = no || exit 1 %endif %{_mandir}/man1/pkill.1%{?ext_man} %{_mandir}/man1/pmap.1%{?ext_man} +%{_mandir}/man1/procps.1%{?ext_man} %{_mandir}/man1/ps.1%{?ext_man} -%{_mandir}/man1/pidwait.1%{?ext_man} +%{_mandir}/man1/pwait.1%{?ext_man} %{_mandir}/man1/pwdx.1%{?ext_man} %{_mandir}/man1/skill.1%{?ext_man} %{_mandir}/man1/slabtop.1%{?ext_man} @@ -383,17 +386,29 @@ test $error = no || exit 1 %files devel %defattr (-,root,root,755) -%dir %{_includedir}/procps -%{_includedir}/procps/*.h -%{_libdir}/libproc-2.so -%{_libdir}/pkgconfig/libproc-2.pc -%{_mandir}/man3/procps.3%{?ext_man} -%{_mandir}/man3/procps_misc.3%{?ext_man} -%{_mandir}/man3/procps_pids.3%{?ext_man} +%dir %{_includedir}/proc +%{_includedir}/proc/alloc.h +%{_includedir}/proc/devname.h +%{_includedir}/proc/escape.h +%{_includedir}/proc/numa.h +%{_includedir}/proc/procps.h +%{_includedir}/proc/pwcache.h +%{_includedir}/proc/readproc.h +%{_includedir}/proc/sig.h +%{_includedir}/proc/slab.h +%{_includedir}/proc/sysinfo.h +%{_includedir}/proc/version.h +%{_includedir}/proc/wchan.h +%{_includedir}/proc/whattime.h +%{_libdir}/libprocps.so +%{_libdir}/pkgconfig/libprocps.pc +%{_mandir}/man3/openproc.3%{?ext_man} +%{_mandir}/man3/readproc.3%{?ext_man} +%{_mandir}/man3/readproctab.3%{?ext_man} %files -n %{libname} %defattr (-,root,root,755) -%{_libdir}/libproc-2.so.%{somajor}* +%{_libdir}/libprocps.so.%{somajor}* %files lang -f procps-ng.lang