update to version v4.0.4

This commit is contained in:
li weigang 2023-11-01 10:15:03 +08:00
parent 04877d3af6
commit 3aadbd9c6b
13 changed files with 19 additions and 581 deletions

View File

@ -1,54 +0,0 @@
From 35dc38cb7fcfb71b151a020abb16197b88370337 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Wed, 24 May 2023 00:00:00 -0500
Subject: [PATCH 1/3] ps: address missing or corrupted fields with -m option
Coincidentally, a Debian bug report and a gitlab issue
were raised at nearly the same time and are referenced
below. They both dealt with that '-m' (thread) option.
That option forces tasks and their threads to be shown
on separate lines. Also, information may be suppressed
between that main process and any lightweight process.
The bottom line was sometimes a required pids_item may
not have been requested from the library before trying
to display a result. For the best case, some incorrect
results might be shown. However, in the worst case (as
with PIDS_WCHAN_NAME) a segmentation fault is created.
[ After addressing the '-m' option problems, another ]
[ issue was found with that '-F' (extra full format) ]
[ option. The PSR (processor) field was always zero. ]
[ It was addressed in a similar manner to the above. ]
Reference(s):
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1036631
https://gitlab.com/procps-ng/procps/-/issues/279
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
src/ps/display.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/ps/display.c b/src/ps/display.c
index 4207cf87..46ac844f 100644
--- a/src/ps/display.c
+++ b/src/ps/display.c
@@ -600,6 +600,13 @@ static void finalize_stacks (void)
// special items with 'extra' used as former pcpu
chkREL(extra)
chkREL(noop)
+ // lastly, any remaining needs ...
+ if (format_flags & FF_Uf)
+ chkREL(PROCESSOR);
+ if (thread_flags & TF_U_m) {
+ chkREL(PRIORITY);
+ chkREL(WCHAN_NAME);
+ }
// now accommodate any results not yet satisfied
f_node = format_list;
--
2.33.0

View File

@ -1,58 +0,0 @@
From 93b7f05e54293af4919498fceedb236a523336df Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Fri, 26 May 2023 00:00:00 -0500
Subject: [PATCH 2/3] ps: trade previous fix for final solution to -m option
Well as luck would have it I found yet another missing
field (SCHED_CLASS) that's needed by that '-m' option.
And, while it could just be added to the previous test
of thread_flags and TF_U_m, here is a much better fix.
[ The problem lies with the lists_and_needs function ]
[ where a new format list was created and some print ]
[ functions changed to pr_nop which displays a dash! ]
[ So, by calling the finalize_stacks function before ]
[ calling lists_and_needs, the former will see those ]
[ format nodes before any print function is changed. ]
Reference(s):
May, 2023 - missing fields with -m option
commit 35dc38cb7fcfb71b151a020abb16197b88370337
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
src/ps/display.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/src/ps/display.c b/src/ps/display.c
index 46ac844f..e1a3b0da 100644
--- a/src/ps/display.c
+++ b/src/ps/display.c
@@ -600,13 +600,6 @@ static void finalize_stacks (void)
// special items with 'extra' used as former pcpu
chkREL(extra)
chkREL(noop)
- // lastly, any remaining needs ...
- if (format_flags & FF_Uf)
- chkREL(PROCESSOR);
- if (thread_flags & TF_U_m) {
- chkREL(PRIORITY);
- chkREL(WCHAN_NAME);
- }
// now accommodate any results not yet satisfied
f_node = format_list;
@@ -676,8 +669,8 @@ int main(int argc, char *argv[]){
init_output(); /* must be between parser and output */
- lists_and_needs();
finalize_stacks();
+ lists_and_needs();
if(forest_type || sort_list) fancy_spew(); /* sort or forest */
else simple_spew(); /* no sort, no forest */
--
2.33.0

View File

@ -1,95 +0,0 @@
From bc688d630aeeeda5e003d35bbcfcdba08f21b399 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Wed, 31 May 2023 00:00:00 -0500
Subject: [PATCH] library: restore the proper main thread tics valuation
The issue cited below revealed an earlier commit, also
shown below, resulted in an incorrect tics value for a
thread group leader. That change was made so the group
leader would have a proper autogroup id, not a -1 that
was shown with sibling threads which lacked that file.
So this patch will just restore pre version 4 behavior
while not upsetting LIBPROC_HIDE_KERNEL functionality.
[ this change means that when THREAD mode is active, ]
[ the autogroup id & nice values won't be available. ]
[ they were only shown for the group leaders anyway. ]
Reference(s):
https://gitlab.com/procps-ng/procps/-/issues/280
. Aug, 2021 - thread group leader change
commit a37526260917bac624ae6b75fd9f4ea7287d81ad
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
library/readproc.c | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/library/readproc.c b/library/readproc.c
index 94030e94..2dfe4c9e 100644
--- a/library/readproc.c
+++ b/library/readproc.c
@@ -1361,7 +1361,14 @@ static proc_t *simple_readtask(PROCTAB *restrict const PT, proc_t *restrict cons
if (flags & PROC_FILLAUTOGRP) // value the 2 autogroup fields
autogroup_fill(path, t);
- if (rc == 0) return t;
+ // openproc() ensured that a ppid will be present when needed ...
+ if (rc == 0) {
+ if (PT->hide_kernel && (t->ppid == 2 || t->tid == 2)) {
+ free_acquired(t);
+ return NULL;
+ }
+ return t;
+ }
errno = ENOMEM;
next_task:
return NULL;
@@ -1463,7 +1470,6 @@ proc_t *readproc(PROCTAB *restrict const PT, proc_t *restrict p) {
free_acquired(p);
for(;;){
- if (errno == ENOMEM) goto out;
// fills in the path, plus p->tid and p->tgid
if (!PT->finder(PT,p)) goto out;
@@ -1484,7 +1490,7 @@ out:
proc_t *readeither (PROCTAB *restrict const PT, proc_t *restrict x) {
static __thread proc_t skel_p; // skeleton proc_t, only uses tid + tgid
static __thread proc_t *new_p; // for process/task transitions
- static __thread int canary, leader;
+ static __thread int canary;
char path[PROCPATHLEN];
proc_t *ret;
@@ -1498,23 +1504,18 @@ proc_t *readeither (PROCTAB *restrict const PT, proc_t *restrict x) {
next_proc:
new_p = NULL;
for (;;) {
- if (errno == ENOMEM) goto end_procs;
// fills in the PT->path, plus skel_p.tid and skel_p.tgid
if (!PT->finder(PT,&skel_p)) goto end_procs; // simple_nextpid
- leader = skel_p.tid;
if (!task_dir_missing) break;
if ((ret = PT->reader(PT,x))) return ret; // simple_readproc
}
next_task:
// fills in our path, plus x->tid and x->tgid
- if (!(PT->taskfinder(PT,&skel_p,x,path))) // simple_nexttid
+ if ((!(PT->taskfinder(PT,&skel_p,x,path))) // simple_nexttid
+ || (!(ret = PT->taskreader(PT,x,path)))) { // simple_readtask
goto next_proc;
- /* to avoid loss of some thread group leader data,
- we must check its base dir, not its 'task' dir! */
- if (x->tid == leader) ret = PT->reader(PT,x); // simple_readproc
- else ret = PT->taskreader(PT,x,path); // simple_readtask
- if (!ret) goto next_proc;
+ }
if (!new_p) {
new_p = ret;
canary = new_p->tid;
--
GitLab

View File

@ -1,41 +0,0 @@
From b51ef773ad5cbd3eb9e348df4f70eb03307ce044 Mon Sep 17 00:00:00 2001
From: EulerOSWander <314264452@qq.com>
Date: Mon, 12 Jun 2023 14:19:30 +0800
Subject: [PATCH] pmap: Increase memory allocation failure judgment
Call trace:
#0 __vsnprintf_internal
#1 0x00007f967aedd656 in __GI___snprintf
#2 0x00005612da28c707 in snprintf
#3 config_read (rc_filename=<optimized out>) at pmap.c:885
#4 0x00005612da28b8c0 int main at pmap.c:1144
The above stack is caused by calling a null pointer
after the memory allocation fails. Increase the null
pointer judgment.
signed-off-by: zhoujie <zhoujie133@huawei.com>
---
src/pmap.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/pmap.c b/src/pmap.c
index 658b2501..74d57dab 100644
--- a/src/pmap.c
+++ b/src/pmap.c
@@ -881,7 +881,11 @@ static int config_read (char *rc_filename)
}
/* add the field in the list */
- cnf_listnode = calloc(1, sizeof *cnf_listnode);
+ if (!(cnf_listnode = calloc(1, sizeof *cnf_listnode))) {
+ xwarnx(_("memory allocation failed"));
+ fclose(f);
+ return 0;
+ }
snprintf(cnf_listnode -> description, sizeof(cnf_listnode -> description), "%s", token);
cnf_listnode -> next = cnf_listhead;
cnf_listhead = cnf_listnode;
--
2.33.0

View File

@ -1,70 +0,0 @@
From 2c933ecba3bb1d3041a5a7a53a7b4078a6003413 Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@dropbear.xyz>
Date: Thu, 10 Aug 2023 21:18:38 +1000
Subject: [PATCH] ps: Fix possible buffer overflow in -C option
ps allocates memory using malloc(length of arg * len of struct).
In certain strange circumstances, the arg length could be very large
and the multiplecation will overflow, allocating a small amount of
memory.
Subsequent strncpy() will then write into unallocated memory.
The fix is to use calloc. It's slower but this is a one-time
allocation. Other malloc(x * y) calls have also been replaced
by calloc(x, y)
References:
https://www.freelists.org/post/procps/ps-buffer-overflow-CVE-20234016
https://nvd.nist.gov/vuln/detail/CVE-2023-4016
https://gitlab.com/procps-ng/procps/-/issues/297
https://bugs.debian.org/1042887
Conflict: remove NEWS part
Signed-off-by: Craig Small <csmall@dropbear.xyz>
---
src/ps/parser.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/ps/parser.c b/src/ps/parser.c
index 248aa741..15873dfa 100644
--- a/src/ps/parser.c
+++ b/src/ps/parser.c
@@ -189,7 +189,6 @@ static const char *parse_list(const char *arg, const char *(*parse_fn)(char *, s
const char *err; /* error code that could or did happen */
/*** prepare to operate ***/
node = xmalloc(sizeof(selection_node));
- node->u = xmalloc(strlen(arg)*sizeof(sel_union)); /* waste is insignificant */
node->n = 0;
buf = strdup(arg);
/*** sanity check and count items ***/
@@ -210,6 +209,7 @@ static const char *parse_list(const char *arg, const char *(*parse_fn)(char *, s
} while (*++walk);
if(need_item) goto parse_error;
node->n = items;
+ node->u = xcalloc(items, sizeof(sel_union));
/*** actually parse the list ***/
walk = buf;
while(items--){
@@ -1050,15 +1050,15 @@ static const char *parse_trailing_pids(void){
thisarg = ps_argc - 1; /* we must be at the end now */
pidnode = xmalloc(sizeof(selection_node));
- pidnode->u = xmalloc(i*sizeof(sel_union)); /* waste is insignificant */
+ pidnode->u = xcalloc(i, sizeof(sel_union)); /* waste is insignificant */
pidnode->n = 0;
grpnode = xmalloc(sizeof(selection_node));
- grpnode->u = xmalloc(i*sizeof(sel_union)); /* waste is insignificant */
+ grpnode->u = xcalloc(i,sizeof(sel_union)); /* waste is insignificant */
grpnode->n = 0;
sidnode = xmalloc(sizeof(selection_node));
- sidnode->u = xmalloc(i*sizeof(sel_union)); /* waste is insignificant */
+ sidnode->u = xcalloc(i, sizeof(sel_union)); /* waste is insignificant */
sidnode->n = 0;
while(i--){
--
2.33.0

View File

@ -1,32 +0,0 @@
From 833cdc64f06989fc1949d056e8ec11d5cd99e4c0 Mon Sep 17 00:00:00 2001
From: hdzhoujie <zhoujie133@huawei.com>
Date: Wed, 19 Apr 2023 19:40:31 +0800
Subject: [PATCH] top: added 'guest' tics when multiple cpus were merged
The 'guest' tics are added in the
sum_tics function, but when multiple
cpus are combined for display, the
'guest' tics are not added cumulatively
in the sum_unify function.
signed-off-by: zhoujie <zhoujie133@huawei.com>
---
src/top/top.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/top/top.c b/src/top/top.c
index 02ef8f6d..abe6e66c 100644
--- a/src/top/top.c
+++ b/src/top/top.c
@@ -6396,6 +6396,8 @@ static int sum_unify (struct stat_stack *this, int nobuf) {
stack[stat_IR].result.sl_int += rSv(stat_IR, sl_int);
stack[stat_SI].result.sl_int += rSv(stat_SI, sl_int);
stack[stat_ST].result.sl_int += rSv(stat_ST, sl_int);
+ stack[stat_GU].result.sl_int += rSv(stat_GU, sl_int);
+ stack[stat_GN].result.sl_int += rSv(stat_GN, sl_int);
stack[stat_SUM_USR].result.sl_int += rSv(stat_SUM_USR, sl_int);
stack[stat_SUM_SYS].result.sl_int += rSv(stat_SUM_SYS, sl_int);
stack[stat_SUM_TOT].result.sl_int += rSv(stat_SUM_TOT, sl_int);
--
2.33.0

View File

@ -1,93 +0,0 @@
From bb7e161d5a06f1bbd5a98cf868eab356c6c1bac2 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Thu, 16 Mar 2023 00:00:00 -0500
Subject: [PATCH] top: address the missing 'guest' tics for summary area
Well this is embarrassing. After repeatedly flogging a
horse (represented by issue #274) I was certain it was
dead. But, it turns out that the darn thing yet lived.
In fact, the bug that was patched was not even the one
the poster experienced. Now merge request #173 finally
penetrated my foggy brain and explicated the real bug.
Since forever (linux 2.6), top has ignored those guest
and guest_nice fields in /proc/stat. When many virtual
machines were running that overhead went unrecognized.
So, this commit simply adds those tics to the 'system'
figures so that it can be seen in text or graph modes.
Reference(s):
https://gitlab.com/procps-ng/procps/-/merge_requests/173
https://gitlab.com/procps-ng/procps/-/issues/274
. Mar 2023, avoid keystroke '%Cpu' distortions
commit 7e33fc47c642aceea8ad53e86a6797239b91f5f9
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
man/top.1 | 7 +++++--
src/top/top.c | 7 +++++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/man/top.1 b/man/top.1
index 5a77beb1..8bf804aa 100644
--- a/man/top.1
+++ b/man/top.1
@@ -527,6 +527,9 @@ Depending on your kernel version, the \fBst\fR field may not be shown.
\fBst\fR : time stolen from this vm by the hypervisor
.fi
+The `sy' value above also reflects the time running a virtual \*(Pu
+for guest operating systems, including those that have been niced.
+
Beyond the first tasks/threads line, there are alternate \*(PU display
modes available via the 4-way `t' \*(CT.
They show an abbreviated summary consisting of these elements:
@@ -537,8 +540,8 @@ They show an abbreviated summary consisting of these elements:
.fi
Where: a) is the `user' (us + ni) percentage; b) is the `system'
-(sy + hi + si) percentage; c) is the total percentage; and d) is
-one of two visual graphs of those representations.
+(sy + hi + si + guests) percentage; c) is the total percentage;
+and d) is one of two visual graphs of those representations.
Such graphs also reflect separate `user' and `system' portions.
If the `4' \*(CT is used to yield more than two cpus per line,
diff --git a/src/top/top.c b/src/top/top.c
index 26a9adb5..02ef8f6d 100644
--- a/src/top/top.c
+++ b/src/top/top.c
@@ -286,6 +286,7 @@ static enum stat_item Stat_items[] = {
STAT_TIC_DELTA_NICE, STAT_TIC_DELTA_IDLE,
STAT_TIC_DELTA_IOWAIT, STAT_TIC_DELTA_IRQ,
STAT_TIC_DELTA_SOFTIRQ, STAT_TIC_DELTA_STOLEN,
+ STAT_TIC_DELTA_GUEST, STAT_TIC_DELTA_GUEST_NICE,
STAT_TIC_SUM_DELTA_USER, STAT_TIC_SUM_DELTA_SYSTEM,
#ifdef CORE_TYPE_NO
STAT_TIC_SUM_DELTA_TOTAL };
@@ -298,6 +299,7 @@ enum Rel_statitems {
stat_NI, stat_IL,
stat_IO, stat_IR,
stat_SI, stat_ST,
+ stat_GU, stat_GN,
stat_SUM_USR, stat_SUM_SYS,
#ifdef CORE_TYPE_NO
stat_SUM_TOT };
@@ -6340,6 +6342,11 @@ static int sum_tics (struct stat_stack *this, const char *pfx, int nobuf) {
if (1 > tot_frme) idl_frme = tot_frme = 1;
scale = 100.0 / (float)tot_frme;
+ /* account for VM tics not otherwise provided for ...
+ ( with xtra-procps-debug.h, can't use PID_VAL w/ assignment ) */
+ this->head[stat_SY].result.sl_int += rSv(stat_GU) + rSv(stat_GN);
+ this->head[stat_SUM_SYS].result.sl_int += rSv(stat_GU) + rSv(stat_GN);
+
/* display some kinda' cpu state percentages
(who or what is explained by the passed prefix) */
if (Curwin->rc.graph_cpus) {
--
2.27.0

View File

@ -1,51 +0,0 @@
From 786335b9673f9c3af0b3897799b30b205e99748a Mon Sep 17 00:00:00 2001
From: hdzhoujie <zhoujie133@huawei.com>
Date: Fri, 5 May 2023 20:00:25 +0800
Subject: [PATCH] top: lessen summary cpu distortions with first display
When the cpu utilization is displayed for
the first time, the reading of the /proc/stat
file is very close to each other, resulting
in large fluctuations. The version before
refactoring, such as v3.3.17, has a delay
before reading the /proc/stat file for the
second time, and the same delay is added here.
signed-off-by: zhoujie <zhoujie133@huawei.com>
signed-off-by: he jingxian <hejingxian@huawei.com>
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
src/top/top.c | 3 +++
src/top/top.h | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/top/top.c b/src/top/top.c
index 757b8d3b..98444fd4 100644
--- a/src/top/top.c
+++ b/src/top/top.c
@@ -3735,6 +3735,9 @@ static void before (char *me) {
Graph_cpus = alloc_c(sizeof(struct graph_parms));
Graph_mems = alloc_c(sizeof(struct graph_parms));
#undef doALL
+
+ // don't distort startup cpu(s) display ...
+ usleep(LIB_USLEEP);
} // end: before
diff --git a/src/top/top.h b/src/top/top.h
index d633f3e1..03de1ca3 100644
--- a/src/top/top.h
+++ b/src/top/top.h
@@ -121,7 +121,7 @@ char *strcasestr(const char *haystack, const char *needle);
/* Length of time a message is displayed and the duration
of a 'priming' wait during library startup (in microseconds) */
#define MSG_USLEEP 1250000
-#define LIB_USLEEP 150000
+#define LIB_USLEEP 100000
/* Specific process id monitoring support (command line only) */
#define MONPIDMAX 20
--
2.33.0

View File

@ -1,70 +0,0 @@
From f4eeff0b26a2c48552f8ed843bea95bf97437d2a Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@dropbear.xyz>
Date: Tue, 11 Jul 2023 19:16:15 +1000
Subject: [PATCH] vmstat: Print guest time
Guest time was removed from User time but not printed. This meant
that if guest time was non-zero then the CPU numbers did not add
up to 100%
References:
!191
!113
commit 2461bb5bc17ee4bc01b142b5bba2c5d87578285c
Signed-off-by: Craig Small <csmall@dropbear.xyz>
---
src/vmstat.c | 6 +++---
testsuite/vmstat.test/vmstat.exp | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/vmstat.c b/src/vmstat.c
index acb7b80..68d356c 100644
--- a/src/vmstat.c
+++ b/src/vmstat.c
@@ -254,13 +254,13 @@ static void new_header(void)
* that follow (marked with max x chars) might not work,
* unless manual page is translated as well. */
const char *header =
- _("procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----");
+ _("procs -----------memory---------- ---swap-- -----io---- -system-- -------cpu-------");
const char *wide_header =
_("--procs-- -----------------------memory---------------------- ---swap-- -----io---- -system-- ----------cpu----------");
const char *timestamp_header = _(" -----timestamp-----");
const char format[] =
- "%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s %2s";
+ "%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s %2s %2s";
const char wide_format[] =
"%4s %4s %12s %12s %12s %12s %4s %4s %5s %5s %4s %4s %3s %3s %3s %3s %3s %3s";
@@ -349,7 +349,7 @@ static void new_format(void)
#define MEMv(E) MEMINFO_VAL(E, ul_int, mem_stack, mem_info)
#define DSYSv(E) STAT_VAL(E, s_int, stat_stack, stat_info)
const char format[] =
- "%2lu %2lu %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u %2u";
+ "%2lu %2lu %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u %2u %2u";
const char wide_format[] =
"%4lu %4lu %12lu %12lu %12lu %12lu %4u %4u %5u %5u %4u %4u %3u %3u %3u %3u %3u %3u";
diff --git a/testsuite/vmstat.test/vmstat.exp b/testsuite/vmstat.test/vmstat.exp
index 1cd13a1..48d0b0f 100644
--- a/testsuite/vmstat.test/vmstat.exp
+++ b/testsuite/vmstat.test/vmstat.exp
@@ -12,11 +12,11 @@ if { [ file readable "/proc/vmstat" ] == 0 } {
} else {
set test "vmstat with no arguments"
spawn $vmstat
- expect_pass "$test" "^procs\[ -\]+memory\[ -\]+swap\[ -\]+io\[ -\]+system\[ -\]+cpu\[ -\]+\\s*r\\s+b\\s+swpd\\s+free\\s+buff\\s+cache\\s+si\\s+so\\s+bi\\s+bo\\s+in\\s+cs us sy id wa st\\s*\(\\s+\\d+\){17}\\s*$"
+ expect_pass "$test" "^procs\[ -\]+memory\[ -\]+swap\[ -\]+io\[ -\]+system\[ -\]+cpu\[ -\]+\\s*r\\s+b\\s+swpd\\s+free\\s+buff\\s+cache\\s+si\\s+so\\s+bi\\s+bo\\s+in\\s+cs us sy id wa st gu\\s*\(\\s+\\d+\){18}\\s*$"
set test "vmstat with -a flag"
spawn $vmstat -a
- expect_pass "$test" "^procs\[ -\]+memory\[ -\]+swap\[ -\]+io\[ -\]+system\[ -\]+cpu\[ -\]+\\s*r\\s+b\\s+swpd\\s+free\\s+inact\\s+active\\s+si\\s+so\\s+bi\\s+bo\\s+in\\s+cs us sy id wa st\\s*\(\\s+\\d+\){17}\\s*$"
+ expect_pass "$test" "^procs\[ -\]+memory\[ -\]+swap\[ -\]+io\[ -\]+system\[ -\]+cpu\[ -\]+\\s*r\\s+b\\s+swpd\\s+free\\s+inact\\s+active\\s+si\\s+so\\s+bi\\s+bo\\s+in\\s+cs us sy id wa st gu\\s*\(\\s+\\d+\){18}\\s*$"
set test "vmstat fork option"
spawn $vmstat -f
--
2.33.0

View File

@ -6,14 +6,17 @@ Subject: [PATCH] procps-ng: add -M and -N options for top
Signed-off-by: xuchunmei <xuchunmei@huawei.com>
Signed-off-by: zhoujie <zhoujie133@huawei.com>
Signed-off-by: Qiang Wei <qiang.wei@suse.com>
Signed-off-by: liweigang <weigangli99@gmail.com>
---
top/top.c | 15 ++++++++++++++-
top/top_nls.c | 2 ++
src/top/top.c | 15 ++++++++++++++-
src/top/top_nls.c | 2 ++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/top/top.c b/src/top/top.c
index 969c553..466341f 100644
--- a/src/top/top.c
+++ b/src/top/top.c
@@ -4227,7 +4227,7 @@ default_or_error:
@@ -4243,7 +4243,7 @@ default_or_error:
* overridden -- we'll force some on and negate others in our
* best effort to honor the loser's (oops, user's) wishes... */
static void parse_args (int argc, char **argv) {
@ -22,7 +25,7 @@ Signed-off-by: Qiang Wei <qiang.wei@suse.com>
static const struct option lopts[] = {
{ "batch-mode", no_argument, NULL, 'b' },
{ "cmdline-toggle", no_argument, NULL, 'c' },
@@ -4248,6 +4248,8 @@ static void parse_args (int argc, char *
@@ -4264,6 +4264,8 @@ static void parse_args (int argc, char **argv) {
{ "version", no_argument, NULL, 'V' },
{ "width", optional_argument, NULL, 'w' },
{ "single-cpu-toggle", no_argument, NULL, '1' },
@ -31,7 +34,7 @@ Signed-off-by: Qiang Wei <qiang.wei@suse.com>
{ NULL, 0, NULL, 0 }
};
float tmp_delay = FLT_MAX;
@@ -4370,6 +4372,17 @@ static void parse_args (int argc, char *
@@ -4386,6 +4388,17 @@ static void parse_args (int argc, char **argv) {
error_exit(fmtmk(N_fmt(BAD_widtharg_fmt), cp));
Width_mode = (int)tmp;
continue;
@ -47,8 +50,10 @@ Signed-off-by: Qiang Wei <qiang.wei@suse.com>
+ continue;
+ }
default:
// we'll rely on getopt for any error message ...
bye_bye(NULL);
/* we'll rely on getopt for any error message while
forcing an EXIT_FAILURE with an empty string ... */
diff --git a/src/top/top_nls.c b/src/top/top_nls.c
index d7ab8dc..0201d64 100644
--- a/src/top/top_nls.c
+++ b/src/top/top_nls.c
@@ -431,6 +431,8 @@ static void build_norm_nlstab (void) {
@ -60,3 +65,6 @@ Signed-off-by: Qiang Wei <qiang.wei@suse.com>
"\n"
" -h, --help display this help text, then exit\n"
" -V, --version output version information & exit\n"
--
2.41.0

Binary file not shown.

BIN
procps-ng-4.0.4.tar.xz Normal file

Binary file not shown.

View File

@ -1,5 +1,5 @@
Name: procps-ng
Version: 4.0.3
Version: 4.0.4
Release: 1
Summary: Utilities that provide system information.
License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+
@ -11,15 +11,6 @@ Source2: README.top
Patch1: openeuler-add-M-and-N-options-for-top.patch
Patch2: openeuler-top-exit-with-error-when-pid-overflow.patch
Patch3: backport-top-address-the-missing-guest-tics-for-summary-area.patch
Patch4: backport-0001-ps-address-missing-or-corrupted-fields-with-m-option.patch
Patch5: backport-0002-ps-trade-previous-fix-for-final-solution-to-m-option.patch
Patch6: backport-top-lessen-summary-cpu-distortions-with-first-displa.patch
Patch7: backport-pmap-Increase-memory-allocation-failure-judgment.patch
Patch8: backport-top-added-guest-tics-when-multiple-cpus-were-merged.patch
Patch9: backport-library-restore-the-proper-main-thread-tics-valuation.patch
Patch10: backport-vmstat-Print-guest-time.patch
Patch11: backport-ps-Fix-possible-buffer-overflow-in-C-option.patch
BuildRequires: ncurses-devel libtool autoconf automake gcc gettext-devel systemd-devel
@ -102,6 +93,9 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof
%{_mandir}/man*
%changelog
* Wed Nov 01 2023 liweigang <weigangli99@gmail.com> - 4.0.4-1
- update to version v4.0.4
* Tue Aug 15 2023 Liu Chao <liuchao173@huawei.com> - 4.0.3-1
- Update to v4.0.3