!31 update verion to 3.3.17
Merge pull request !31 from zhouwenpei/master
This commit is contained in:
commit
31797d661c
@ -10,10 +10,10 @@ Signed-off-by: xuchunmei <xuchunmei@huawei.com>
|
||||
2 files changed, 18 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/top/top.c b/top/top.c
|
||||
index d890140..9bfc7f0 100644
|
||||
index b53e532..20cf7a1 100644
|
||||
--- a/top/top.c
|
||||
+++ b/top/top.c
|
||||
@@ -4139,6 +4139,23 @@ static void parse_args (char **args) {
|
||||
@@ -4337,6 +4337,23 @@ static void parse_args (char **args) {
|
||||
args += ai;
|
||||
if (pn) cp = pn + ci;
|
||||
} continue;
|
||||
@ -38,18 +38,18 @@ index d890140..9bfc7f0 100644
|
||||
error_exit(fmtmk(N_fmt(UNKNOWN_opts_fmt)
|
||||
, *cp, Myname, N_txt(USAGE_abbrev_txt)));
|
||||
diff --git a/top/top_nls.c b/top/top_nls.c
|
||||
index 0af77ce..79a18e1 100644
|
||||
index ab3029e..97c3468 100644
|
||||
--- a/top/top_nls.c
|
||||
+++ b/top/top_nls.c
|
||||
@@ -350,7 +350,7 @@ static void build_norm_nlstab (void) {
|
||||
Norm_nlstab[OFF_one_word_txt] = _("Off");
|
||||
/* Translation Hint: Only the following words should be translated
|
||||
. secs (seconds), max (maximum), user, field, cols (columns)*/
|
||||
- Norm_nlstab[USAGE_abbrev_txt] = _(" -hv | -bcEHiOSs1 -d secs -n max -u|U user -p pid(s) -o field -w [cols]");
|
||||
+ Norm_nlstab[USAGE_abbrev_txt] = _(" -hv | -bcEHiOSs1 -d secs -n max -u|U user -p pid(s) -o field -w [cols] -M -N num");
|
||||
- Norm_nlstab[USAGE_abbrev_txt] = _(" -hv | -bcEeHiOSs1 -d secs -n max -u|U user -p pid(s) -o field -w [cols]");
|
||||
+ Norm_nlstab[USAGE_abbrev_txt] = _(" -hv | -bcEeHiOSs1 -d secs -n max -u|U user -p pid(s) -o field -w [cols] -M -N num");
|
||||
Norm_nlstab[FAIL_statget_txt] = _("failed /proc/stat read");
|
||||
Norm_nlstab[FOREST_modes_fmt] = _("Forest mode %s");
|
||||
Norm_nlstab[FAIL_tty_get_txt] = _("failed tty get");
|
||||
--
|
||||
1.8.3.1
|
||||
2.27.0
|
||||
|
||||
@ -1,60 +0,0 @@
|
||||
From bb96fc42956c9ed926a1b958ab715f8b4a663dec Mon Sep 17 00:00:00 2001
|
||||
From: Craig Small <csmall@dropbear.xyz>
|
||||
Date: Sun, 5 Jan 2020 15:05:55 +1100
|
||||
Subject: [PATCH] pgrep: check sanity of SC_ARG_MAX
|
||||
|
||||
A kernel change means we cannot trust what sysconf(SC_ARG_MAX)
|
||||
returns. We clamp it so its more than 4096 and less than 128*1024
|
||||
which is what findutils does.
|
||||
|
||||
References:
|
||||
procps-ng/procps#152
|
||||
https://git.savannah.gnu.org/cgit/findutils.git/tree/lib/buildcmd.c#n535
|
||||
https://lwn.net/Articles/727862/
|
||||
---
|
||||
pgrep.c | 22 +++++++++++++++++++++-
|
||||
1 file changed, 21 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/pgrep.c b/pgrep.c
|
||||
index 01563db..bde7448 100644
|
||||
--- a/pgrep.c
|
||||
+++ b/pgrep.c
|
||||
@@ -485,6 +485,26 @@ static regex_t * do_regcomp (void)
|
||||
return preg;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * SC_ARG_MAX used to return the maximum size a command line can be
|
||||
+ * however changes to the kernel mean this can be bigger than we can
|
||||
+ * alloc. Clamp it to 128kB like xargs and friends do
|
||||
+ * Should also not be smaller than POSIX_ARG_MAX which is 4096
|
||||
+ */
|
||||
+static size_t get_arg_max(void)
|
||||
+{
|
||||
+#define MIN_ARG_SIZE 4096u
|
||||
+#define MAX_ARG_SIZE (128u * 1024u)
|
||||
+
|
||||
+ size_t val = sysconf(_SC_ARG_MAX);
|
||||
+
|
||||
+ if (val < MIN_ARG_SIZE)
|
||||
+ val = MIN_ARG_SIZE;
|
||||
+ if (val > MAX_ARG_SIZE)
|
||||
+ val = MAX_ARG_SIZE;
|
||||
+
|
||||
+ return val;
|
||||
+}
|
||||
static struct el * select_procs (int *num)
|
||||
{
|
||||
PROCTAB *ptp;
|
||||
@@ -497,7 +517,7 @@ static struct el * select_procs (int *num)
|
||||
regex_t *preg;
|
||||
pid_t myself = getpid();
|
||||
struct el *list = NULL;
|
||||
- long cmdlen = sysconf(_SC_ARG_MAX) * sizeof(char);
|
||||
+ long cmdlen = get_arg_max() * sizeof(char);
|
||||
char *cmdline = xmalloc(cmdlen);
|
||||
char *cmdsearch = xmalloc(cmdlen);
|
||||
char *cmdoutput = xmalloc(cmdlen);
|
||||
--
|
||||
2.22.0.windows.1
|
||||
|
||||
@ -1,85 +0,0 @@
|
||||
From 00028aa23732598aecad6f1c146f3f9751372958 Mon Sep 17 00:00:00 2001
|
||||
From: Jim Warner <james.warner@comcast.net>
|
||||
Date: Wed, 1 Jan 2020 00:00:00 -0500
|
||||
Subject: [PATCH] top: whack insidious bug surrounding auto-sized fields
|
||||
|
||||
This commit duplicates a change to that newlib branch.
|
||||
However, it should be noted that such a change was not
|
||||
really necessary under this master branch since proc_t
|
||||
data remains valid much longer. It is being duplicated
|
||||
here as documentation only. Below is the original msg.
|
||||
|
||||
------------------------------------------------------
|
||||
This patch will eliminate a bug which is unique to our
|
||||
newlib branch. It's extremely rare and only happens if
|
||||
a search ('L'/'&') is initiated during the period when
|
||||
fields are currently being auto-sized (AUTOX_MODE on).
|
||||
|
||||
This bug surfaces as either all zero results for tasks
|
||||
displayed or a segmentation fault, depending upon what
|
||||
fields were activated. It is caused by the timing of a
|
||||
call to the <pids> 'reset' function. When called after
|
||||
a task refresh, but before do_key(), this bug appears.
|
||||
|
||||
So this patch just ensures that 'reset' will be called
|
||||
after do_key() & before the tasks have been refreshed.
|
||||
------------------------------------------------------
|
||||
|
||||
Signed-off-by: Jim Warner <james.warner@comcast.net>
|
||||
---
|
||||
top/top.c | 11 ++++++-----
|
||||
top/top.h | 2 +-
|
||||
2 files changed, 7 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/top/top.c b/top/top.c
|
||||
index 1aa5a8c..09b8ef9 100644
|
||||
--- a/top/top.c
|
||||
+++ b/top/top.c
|
||||
@@ -2320,7 +2320,8 @@ static inline void widths_resize (void) {
|
||||
Autox_found = 1;
|
||||
}
|
||||
}
|
||||
- if (Autox_found) calibrate_fields();
|
||||
+ // trigger a call to calibrate_fields (via zap_fieldstab)
|
||||
+ if (Autox_found) Frames_signal = BREAK_autox;
|
||||
} // end: widths_resize
|
||||
|
||||
|
||||
@@ -6407,6 +6408,10 @@ static void frame_make (void) {
|
||||
WIN_t *w = Curwin; // avoid gcc bloat with a local copy
|
||||
int i, scrlins;
|
||||
|
||||
+ // check auto-sized width increases from the last iteration...
|
||||
+ if (AUTOX_MODE && Autox_found)
|
||||
+ widths_resize();
|
||||
+
|
||||
// deal with potential signal(s) since the last time around...
|
||||
if (Frames_signal)
|
||||
zap_fieldstab();
|
||||
@@ -6459,10 +6464,6 @@ static void frame_make (void) {
|
||||
/* we'll deem any terminal not supporting tgoto as dumb and disable
|
||||
the normal non-interactive output optimization... */
|
||||
if (!Cap_can_goto) PSU_CLREOS(0);
|
||||
-
|
||||
- /* lastly, check auto-sized width needs for the next iteration */
|
||||
- if (AUTOX_MODE && Autox_found)
|
||||
- widths_resize();
|
||||
} // end: frame_make
|
||||
|
||||
|
||||
diff --git a/top/top.h b/top/top.h
|
||||
index 2a578b8..432a4f4 100644
|
||||
--- a/top/top.h
|
||||
+++ b/top/top.h
|
||||
@@ -224,7 +224,7 @@ enum scale_enum {
|
||||
|
||||
/* Used to manipulate (and document) the Frames_signal states */
|
||||
enum resize_states {
|
||||
- BREAK_off = 0, BREAK_kbd, BREAK_sig
|
||||
+ BREAK_off = 0, BREAK_kbd, BREAK_sig, BREAK_autox
|
||||
};
|
||||
|
||||
/* This typedef just ensures consistent 'process flags' handling */
|
||||
--
|
||||
2.22.0.windows.1
|
||||
|
||||
@ -1,52 +0,0 @@
|
||||
From 9e4c2cca392399d7e1cf167816913581631b842c Mon Sep 17 00:00:00 2001
|
||||
From: Jim Warner <james.warner@comcast.net>
|
||||
Date: Fri, 3 Jan 2020 00:00:00 -0600
|
||||
Subject: [PATCH] top: at abnormal end allow core dumps (fix qualys bug)
|
||||
|
||||
A Qualys audit patch, represented in the commit below,
|
||||
added the _exit() call to our abnormal signal handler.
|
||||
Unfortunately, that disabled the associated core dump.
|
||||
|
||||
This patch restores expected behavior of those signals
|
||||
whose default produces a core dump file + termination.
|
||||
|
||||
Reference(s):
|
||||
commit 0847390b8335c1747a3ea0944123b2f594251bc0
|
||||
|
||||
Signed-off-by: Jim Warner <james.warner@comcast.net>
|
||||
---
|
||||
top/top.c | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/top/top.c b/top/top.c
|
||||
index 09b8ef9..8e8c7d9 100644
|
||||
--- a/top/top.c
|
||||
+++ b/top/top.c
|
||||
@@ -579,18 +579,22 @@ static void error_exit (const char *str) {
|
||||
|
||||
/*
|
||||
* Catches all remaining signals not otherwise handled */
|
||||
+static void sig_abexit (int sig) NORETURN;
|
||||
static void sig_abexit (int sig) {
|
||||
sigset_t ss;
|
||||
|
||||
-// POSIX.1-2004 async-signal-safe: sigfillset, sigprocmask, signal, raise
|
||||
+// POSIX.1-2004 async-signal-safe: sigfillset, sigprocmask, signal, sigemptyset, sigaddset, raise
|
||||
sigfillset(&ss);
|
||||
sigprocmask(SIG_BLOCK, &ss, NULL);
|
||||
at_eoj(); // restore tty in preparation for exit
|
||||
fprintf(stderr, N_fmt(EXIT_signals_fmt)
|
||||
, sig, signal_number_to_name(sig), Myname);
|
||||
signal(sig, SIG_DFL); // allow core dumps, if applicable
|
||||
+ sigemptyset(&ss);
|
||||
+ sigaddset(&ss, sig);
|
||||
+ sigprocmask(SIG_UNBLOCK, &ss, NULL);
|
||||
raise(sig); // ( plus set proper return code )
|
||||
- _exit(sig | 0x80); // if default sig action is ignore
|
||||
+ _exit(EXIT_FAILURE); // if default sig action is ignore
|
||||
} // end: sig_abexit
|
||||
|
||||
|
||||
--
|
||||
2.22.0.windows.1
|
||||
|
||||
@ -1,48 +0,0 @@
|
||||
From 7db65421d0a964f898312ce29ae044019e40958a Mon Sep 17 00:00:00 2001
|
||||
From: Jim Warner <james.warner@comcast.net>
|
||||
Date: Sat, 4 Jan 2020 00:00:00 -0600
|
||||
Subject: [PATCH] ps: for abnormal end allow core dumps (fix qualys bug)
|
||||
|
||||
A Qualys audit patch, represented in the commit below,
|
||||
added the _exit() call to our abnormal signal handler.
|
||||
Unfortunately, that disabled the associated core dump.
|
||||
|
||||
This patch restores expected behavior of those signals
|
||||
whose default produces a core dump file + termination.
|
||||
|
||||
Reference(s):
|
||||
commit 2e4a59422104ed7fa5502874f9076b8118edd6a8
|
||||
|
||||
Signed-off-by: Jim Warner <james.warner@comcast.net>
|
||||
---
|
||||
ps/display.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/ps/display.c b/ps/display.c
|
||||
index 28e1a6e..95a55c3 100644
|
||||
--- a/ps/display.c
|
||||
+++ b/ps/display.c
|
||||
@@ -48,6 +48,10 @@ char *myname;
|
||||
|
||||
/* just reports a crash */
|
||||
static void signal_handler(int signo){
|
||||
+ sigset_t ss;
|
||||
+
|
||||
+ sigfillset(&ss);
|
||||
+ sigprocmask(SIG_BLOCK, &ss, NULL);
|
||||
if(signo==SIGPIPE) _exit(0); /* "ps | head" will cause this */
|
||||
/* fprintf() is not reentrant, but we _exit() anyway */
|
||||
fprintf(stderr,
|
||||
@@ -65,6 +69,9 @@ static void signal_handler(int signo){
|
||||
default:
|
||||
error_at_line(0, 0, __FILE__, __LINE__, "%s", _("please report this bug"));
|
||||
signal(signo, SIG_DFL); /* allow core file creation */
|
||||
+ sigemptyset(&ss);
|
||||
+ sigaddset(&ss, signo);
|
||||
+ sigprocmask(SIG_UNBLOCK, &ss, NULL);
|
||||
kill(getpid(), signo);
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
--
|
||||
2.22.0.windows.1
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
From ed34b1228ed08fbfdbf6f1a61ca7ca62448ccd86 Mon Sep 17 00:00:00 2001
|
||||
From: Jim Warner <james.warner@comcast.net>
|
||||
Date: Wed, 22 Jan 2020 00:00:00 -0600
|
||||
Subject: [PATCH] top: restore one line of code to sig_endpgm() function
|
||||
|
||||
When that potential abend at program end was addressed
|
||||
in the patch shown below, one line of code was removed
|
||||
in error. That line served to suppress some end-of-job
|
||||
reports should ATEOJ_RPTSTD or ATEOJ_RPTHSH be active.
|
||||
|
||||
So, this patch restores that previously deleted logic.
|
||||
|
||||
Reference(s):
|
||||
. potential SEGV fix, master branch
|
||||
commit d37f85c269fbb6e905802ffdbce0ba4173ba21a9
|
||||
|
||||
Signed-off-by: Jim Warner <james.warner@comcast.net>
|
||||
---
|
||||
top/top.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/top/top.c b/top/top.c
|
||||
index 8e8c7d9..63ec5fe 100644
|
||||
--- a/top/top.c
|
||||
+++ b/top/top.c
|
||||
@@ -604,6 +604,7 @@ static void sig_abexit (int sig) {
|
||||
* SIGUSR1 and SIGUSR2 */
|
||||
static void sig_endpgm (int dont_care_sig) NORETURN;
|
||||
static void sig_endpgm (int dont_care_sig) {
|
||||
+ Frames_signal = BREAK_sig;
|
||||
bye_bye(NULL);
|
||||
(void)dont_care_sig;
|
||||
} // end: sig_endpgm
|
||||
--
|
||||
2.22.0.windows.1
|
||||
|
||||
@ -1,77 +0,0 @@
|
||||
From 5cd29e5093efa3c6ee9c5310b64347f1d54b707d Mon Sep 17 00:00:00 2001
|
||||
From: Jim Warner <james.warner@comcast.net>
|
||||
Date: Sat, 15 Feb 2020 00:00:00 -0600
|
||||
Subject: [PATCH] top: restore configuration file backward compatibility
|
||||
|
||||
The Debian bug referenced below has nothing to do with
|
||||
locales. In fact, top was made locale independent back
|
||||
in release 3.3.13 (April, 2018). However, that bug did
|
||||
reveal some misplaced logic which this patch corrects.
|
||||
|
||||
Prompted by the Qualys audit, all rcfile field strings
|
||||
were checked for potential duplicates which could only
|
||||
have resulted from some user's manual/malicious edits.
|
||||
|
||||
Unfortunately, that code was executed before top had a
|
||||
chance to enforce the proper/maximum string length (in
|
||||
the event an extremely old rcfile had just been read).
|
||||
This created some potential string overrun references.
|
||||
|
||||
In top's original 3.3.15 implementation, the potential
|
||||
overrun extended for 15 characters. That is the number
|
||||
of field characters added with 3.3.9 (December, 2013).
|
||||
But, since strchr() was used, no error exit was taken.
|
||||
|
||||
In the revised 3.3.16 implementation, the strchr() was
|
||||
replaced with '&w->rc.fieldscur[n]'. This held overrun
|
||||
to a single position while producing an error message.
|
||||
|
||||
So, this commit just moves that logic to a point where
|
||||
fieldscur is guaranteed to be longer than EU_MAXPFLGS.
|
||||
|
||||
Reference(s):
|
||||
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=951335
|
||||
. revised 3.3.16 validation logic
|
||||
commit 291d98ee5036567f93d21bc11142b0a7e2ee70ae
|
||||
. original 3.3.15 validation logic
|
||||
commit fdb58974e24c025a1f866f324c62f1d8f96234f8
|
||||
|
||||
Signed-off-by: Jim Warner <james.warner@comcast.net>
|
||||
|
||||
This patch has been modified to fit euler os
|
||||
Signed-off-by: chenmingmin <chenmingmin@huawei.com>
|
||||
---
|
||||
top/top.c | 10 +++++-----
|
||||
1 files changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/top/top.c b/top/top.c
|
||||
index 63ec5fe..b4fe21e 100644
|
||||
--- a/top/top.c
|
||||
+++ b/top/top.c
|
||||
@@ -3939,11 +3939,6 @@ static const char *configs_file (FILE *fp, const char *name, float *delay) {
|
||||
// too bad fscanf is not as flexible with his format string as snprintf
|
||||
#error Hey, fix the above fscanf 'PFLAGSSIZ' dependency !
|
||||
#endif
|
||||
- // ensure there's been no manual alteration of fieldscur
|
||||
- for (n = 0 ; n < EU_MAXPFLGS; n++) {
|
||||
- if (&w->rc.fieldscur[n] != strrchr(w->rc.fieldscur, w->rc.fieldscur[n]))
|
||||
- return p;
|
||||
- }
|
||||
// be tolerant of missing release 3.3.10 graph modes additions
|
||||
if (3 > fscanf(fp, "\twinflags=%d, sortindx=%d, maxtasks=%d, graph_cpus=%d, graph_mems=%d\n"
|
||||
, &w->rc.winflags, &w->rc.sortindx, &w->rc.maxtasks, &w->rc.graph_cpus, &w->rc.graph_mems))
|
||||
@@ -3989,6 +3984,11 @@ static const char *configs_file (FILE *fp, const char *name, float *delay) {
|
||||
return p;
|
||||
break;
|
||||
}
|
||||
+ // ensure there's been no manual alteration of fieldscur
|
||||
+ for (n = 0 ; n < EU_MAXPFLGS; n++) {
|
||||
+ if (&w->rc.fieldscur[n] != strrchr(w->rc.fieldscur, w->rc.fieldscur[n]))
|
||||
+ return p;
|
||||
+ }
|
||||
#ifndef USE_X_COLHDR
|
||||
OFFw(w, NOHIFND_xxx | NOHISEL_xxx);
|
||||
#endif
|
||||
--
|
||||
2.22.0.windows.1
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
From b52a26740445904c01233166271817743f2e4b40 Mon Sep 17 00:00:00 2001
|
||||
From: Dylan Swiggett <swiggett@google.com>
|
||||
Date: Tue, 29 Nov 2016 22:34:37 +0000
|
||||
Subject: [PATCH] Fixes small bug in struct proc_t documentation.
|
||||
|
||||
From http://man7.org/linux/man-pages/man5/proc.5.html:
|
||||
|
||||
(22) starttime %llu
|
||||
The time the process started after system boot. In
|
||||
kernels before Linux 2.6, this value was expressed
|
||||
in jiffies. Since Linux 2.6, the value is expressed
|
||||
in clock ticks (divide by sysconf(_SC_CLK_TCK)).
|
||||
---
|
||||
proc/readproc.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/proc/readproc.h b/proc/readproc.h
|
||||
index a3fdb51..7905ea9 100644
|
||||
--- a/proc/readproc.h
|
||||
+++ b/proc/readproc.h
|
||||
@@ -74,7 +74,7 @@ typedef struct proc_t {
|
||||
// and so on...
|
||||
cutime, // stat cumulative utime of process and reaped children
|
||||
cstime, // stat cumulative stime of process and reaped children
|
||||
- start_time; // stat start time of process -- seconds since 1-1-70
|
||||
+ start_time; // stat start time of process -- seconds since system boot
|
||||
#ifdef SIGNAL_STRING
|
||||
char
|
||||
// Linux 2.1.7x and up have 64 signals. Allow 64, plus '\0' and padding.
|
||||
--
|
||||
2.22.0.windows.1
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
From 64a17dfe35d4f0fdd8658156bf920578b32a497f Mon Sep 17 00:00:00 2001
|
||||
From: Jim Warner <james.warner@comcast.net>
|
||||
Date: Wed, 7 Oct 2020 17:06:36 +0800
|
||||
Subject: [PATCH 32/34] misc: eliminate a couple of miscellaneous gcc warnings
|
||||
|
||||
This commit just addresses those warnings shown below.
|
||||
|
||||
Reference(s):
|
||||
proc/sysinfo.c: In function `getrunners':
|
||||
proc/sysinfo.c:491:26: warning: `%s' directive writing up to 255 bytes into a region of size 26 [-Wformat-overflow=]
|
||||
491 | sprintf(tbuf, "/proc/%s/stat", ent->d_name);
|
||||
| ^~
|
||||
https://gitlab.com/procps-ng/procps/-/commit/e3196502784b11c70d6e3c33159403d2f7c118e1
|
||||
|
||||
This patch has been modified to fit euler os
|
||||
Signed-off-by: chenmingmin <chenmingmin@huawei.com>
|
||||
---
|
||||
proc/sysinfo.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/proc/sysinfo.c b/proc/sysinfo.c
|
||||
index 4b2090b..5daa70b 100644
|
||||
--- a/proc/sysinfo.c
|
||||
+++ b/proc/sysinfo.c
|
||||
@@ -488,7 +488,7 @@ static void getrunners(unsigned int *restrict running, unsigned int *restrict bl
|
||||
char c;
|
||||
|
||||
if (!isdigit(ent->d_name[0])) continue;
|
||||
- sprintf(tbuf, "/proc/%s/stat", ent->d_name);
|
||||
+ snprintf(tbuf, sizeof(tbuf), "/proc/%s/stat", ent->d_name);
|
||||
|
||||
fd = open(tbuf, O_RDONLY, 0);
|
||||
if (fd == -1) continue;
|
||||
--
|
||||
2.22.0.windows.1
|
||||
|
||||
@ -1,40 +0,0 @@
|
||||
From f57a0301e3adfa5fd456404a200182c7f21da03a Mon Sep 17 00:00:00 2001
|
||||
From: Jim Warner <james.warner@comcast.net>
|
||||
Date: Wed, 9 Sep 2020 00:00:00 -0500
|
||||
Subject: [PATCH] top: fix potential SEGV when no tasks were displayable
|
||||
|
||||
This patch fixes a nearly decade old bug discovered by
|
||||
Frederik Deweerdt. His merge request shown below would
|
||||
be an adequate solution except for iterative overhead.
|
||||
|
||||
This alternate patch will represent substantially less
|
||||
overhead for an admittedly extremely rare possibility.
|
||||
|
||||
Reference(s):
|
||||
https://gitlab.com/procps-ng/procps/-/merge_requests/114
|
||||
|
||||
And-thanks-to: Frederik Deweerdt <fdeweerdt@fastly.com>
|
||||
Signed-off-by: Jim Warner <james.warner@comcast.net>
|
||||
|
||||
This patch has been modified to fit euler os
|
||||
Signed-off-by: chenmingmin <chenmingmin@huawei.com>
|
||||
---
|
||||
top/top.c | 2 ++
|
||||
1 files changed, 2 insertions(+)
|
||||
|
||||
diff --git a/top/top.c b/top/top.c
|
||||
index e06a61f..1147938 100644
|
||||
--- a/top/top.c
|
||||
+++ b/top/top.c
|
||||
@@ -6486,6 +6486,8 @@ static int window_show (WIN_t *q, int wmax) {
|
||||
|
||||
// Display Column Headings -- and distract 'em while we sort (maybe)
|
||||
PUFF("\n%s%s%s", q->capclr_hdr, q->columnhdr, Caps_endline);
|
||||
+ // and just in case 'Monpids' is active but matched no processes ...
|
||||
+ if (!Frame_maxtask) return 1; // 1 for the column header
|
||||
|
||||
if (CHKw(q, Show_FOREST))
|
||||
forest_create(q);
|
||||
--
|
||||
2.22.0.windows.1
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
From 6e1715d9ebcffd7a673cbacbca4416c42d103c7b Mon Sep 17 00:00:00 2001
|
||||
From: Jim Warner <james.warner@comcast.net>
|
||||
Date: Sun, 13 Sep 2020 00:00:00 -0500
|
||||
Subject: [PATCH] top: fix additional SEGVs if no tasks were displayable
|
||||
|
||||
This patch is an outgrowth of that commit shown below.
|
||||
|
||||
Many additional potential segmentation faults might be
|
||||
encountered if interactive commands are opened up to a
|
||||
user when a '-p' switch has a single non-existent pid.
|
||||
|
||||
[ always the 'k', 'L', 'r', 'Y' keys & maybe 'v' too ]
|
||||
|
||||
So, this patch will restrict such a loser (oops, user)
|
||||
to a reduced subset of normal commands until he/she/it
|
||||
quits then restarts top with something to be displayed
|
||||
or issues the '=' command overriding that '-p' switch.
|
||||
|
||||
Reference(s):
|
||||
commit f57a0301e3adfa5fd456404a200182c7f21da03a
|
||||
|
||||
Signed-off-by: Jim Warner <james.warner@comcast.net>
|
||||
---
|
||||
top/top.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/top/top.c b/top/top.c
|
||||
index 1147938..2afe648 100644
|
||||
--- a/top/top.c
|
||||
+++ b/top/top.c
|
||||
@@ -5897,6 +5897,8 @@ static void do_key (int ch) {
|
||||
write_rcfile();
|
||||
goto all_done;
|
||||
default: // and now, the real work...
|
||||
+ // and just in case 'Monpids' is active but matched no processes ...
|
||||
+ if (!Frame_maxtask && ch != '=') goto all_done;
|
||||
for (i = 0; i < MAXTBL(key_tab); ++i)
|
||||
if (strchr(key_tab[i].keys, ch)) {
|
||||
key_tab[i].func(ch);
|
||||
--
|
||||
2.22.0.windows.1
|
||||
|
||||
@ -1,34 +0,0 @@
|
||||
From 5f859b30d34c3e1ec3fca48d55248b502669fcc5 Mon Sep 17 00:00:00 2001
|
||||
From: Craig Small <csmall@dropbear.xyz>
|
||||
Date: Tue, 22 Dec 2020 16:08:49 +1100
|
||||
Subject: [PATCH] pgrep: Remove memory leak
|
||||
|
||||
This is part of !118 where @tt.rantala found a memory leak.
|
||||
The other part of !118 may come later if the performance change
|
||||
is significant.
|
||||
|
||||
References:
|
||||
procps-ng/procps!118
|
||||
---
|
||||
pgrep.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/pgrep.c b/pgrep.c
|
||||
index 205a1db..4fe5e8a 100644
|
||||
--- a/pgrep.c
|
||||
+++ b/pgrep.c
|
||||
@@ -716,6 +716,11 @@ static struct el * select_procs (int *num)
|
||||
free(cmdsearch);
|
||||
free(cmdoutput);
|
||||
|
||||
+ if (preg) {
|
||||
+ regfree(preg);
|
||||
+ free(preg);
|
||||
+ }
|
||||
+
|
||||
return list;
|
||||
}
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,37 +0,0 @@
|
||||
From 31343570e17cb13605c2c5a5c8b9a21d443bbb2a Mon Sep 17 00:00:00 2001
|
||||
From: Stephen Brennan <stephen.s.brennan@oracle.com>
|
||||
Date: Thu, 19 Nov 2020 16:03:58 -0800
|
||||
Subject: [PATCH] Set TZ to avoid repeated stat("/etc/localtime")
|
||||
|
||||
With glibc, each time the strftime() function is used (twice per process
|
||||
in a typical ps -fe run), a stat("/etc/localtime") system call is used
|
||||
to determine the timezone. Not only does this add extra system call
|
||||
overhead, but when multiple ps processes are trying to access this
|
||||
file (or multiple glibc programs using strftime) in parallel, this can
|
||||
trigger significant lock contention within the OS kernel.
|
||||
|
||||
Since ps is not intended to run for long periods of time as a
|
||||
daemon (during which the system timezone could be altered and PS might
|
||||
reasonably be expected to adapt its output), there is no benefit to
|
||||
repeatedly doing this stat(). To stop this behavior, explicitly set the
|
||||
TZ variable to its default value (:/etc/localtime) whenever it is unset.
|
||||
glibc will then cache the stat() result.
|
||||
---
|
||||
ps/display.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/ps/display.c b/ps/display.c
|
||||
index 95a55c3..06094d3 100644
|
||||
--- a/ps/display.c
|
||||
+++ b/ps/display.c
|
||||
@@ -633,6 +633,7 @@ int main(int argc, char *argv[]){
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain(PACKAGE, LOCALEDIR);
|
||||
textdomain(PACKAGE);
|
||||
+ setenv("TZ", ":/etc/localtime", 0);
|
||||
|
||||
#ifdef DEBUG
|
||||
init_stack_trace(argv[0]);
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
From 79097e55e4b08ec8c1de8332e32cf03c4be1d4ec Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rapha=C3=ABl=20Jakse?= <raphael.gitlab@jakse.fr>
|
||||
Date: Fri, 7 Sep 2018 12:57:03 +0000
|
||||
Subject: [PATCH] kill: Fix argument handling for negative PIDs
|
||||
|
||||
---
|
||||
skill.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/skill.c b/skill.c
|
||||
index 5a79a41..38ebdc5 100644
|
||||
--- a/skill.c
|
||||
+++ b/skill.c
|
||||
@@ -507,7 +507,7 @@ static void __attribute__ ((__noreturn__))
|
||||
} else {
|
||||
/* Special case for signal digit negative
|
||||
* PIDs */
|
||||
- pid = atoi(argv[optind]);
|
||||
+ pid = atoi(argv[optind-1]);
|
||||
if (kill((pid_t)pid, signo) != 0)
|
||||
exitvalue = EXIT_FAILURE;
|
||||
exit(exitvalue);
|
||||
--
|
||||
2.27.0
|
||||
|
||||
Binary file not shown.
BIN
procps-ng-3.3.17.tar.xz
Normal file
BIN
procps-ng-3.3.17.tar.xz
Normal file
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
Name: procps-ng
|
||||
Version: 3.3.16
|
||||
Release: 16
|
||||
Version: 3.3.17
|
||||
Release: 1
|
||||
Summary: Utilities that provide system information.
|
||||
License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+
|
||||
URL: https://sourceforge.net/projects/procps-ng/
|
||||
@ -9,24 +9,10 @@ Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.xz
|
||||
Source1: README.md
|
||||
Source2: README.top
|
||||
|
||||
Patch0000: backport-0001-pgrep-check-sanity-of-SC_ARG_MAX.patch
|
||||
Patch0001: backport-0002-top-whack-insidious-bug-surrounding-auto-sized-field.patch
|
||||
Patch0002: backport-0003-top-at-abnormal-end-allow-core-dumps-fix-qualys-bug.patch
|
||||
Patch0003: backport-0004-ps-for-abnormal-end-allow-core-dumps-fix-qualys-bug.patch
|
||||
Patch0004: backport-0005-top-restore-one-line-of-code-to-sig_endpgm-function.patch
|
||||
Patch0005: backport-0006-top-restore-configuration-file-backward-compatibilit.patch
|
||||
Patch0006: backport-0007-Fixes-small-bug-in-struct-proc_t-documentation.patch
|
||||
Patch0007: backport-0008-misc-eliminate-a-couple-of-miscellaneous-gcc-warning.patch
|
||||
Patch0008: backport-0009-top-fix-potential-SEGV-when-no-tasks-were-displayabl.patch
|
||||
Patch0009: backport-0010-top-fix-additional-SEGVs-if-no-tasks-were-displayabl.patch
|
||||
Patch0010: backport-0011-pgrep-Remove-memory-leak.patch
|
||||
Patch0011: backport-0012-Set-TZ-to-avoid-repeated-stat-etc-localtime.patch
|
||||
Patch0012: backport-0013-kill-Fix-argument-handling-for-negative-PIDs.patch
|
||||
Patch0013: backport-0014-top-fix-two-potential-alternate-display-mode-abends.patch
|
||||
Patch0014: backport-0015-top-In-the-bye_bye-function-replace-fputs-with-the-w.patch
|
||||
|
||||
Patch9000: feature-add-options-M-and-N-for-top.patch
|
||||
Patch9001: bugfix-top-exit-with-error-when-pid-overflow.patch
|
||||
Patch1: 0001-top-fix-two-potential-alternate-display-mode-abends.patch
|
||||
Patch2: 0002-top-In-the-bye_bye-function-replace-fputs-with-the-w.patch
|
||||
Patch3: 0003-add-options-M-and-N-for-top.patch
|
||||
Patch4: 0004-top-exit-with-error-when-pid-overflow.patch
|
||||
|
||||
BuildRequires: ncurses-devel libtool autoconf automake gcc gettext-devel systemd-devel
|
||||
|
||||
@ -58,7 +44,7 @@ The package is used for the Internationalization of %{name}
|
||||
%package_help
|
||||
|
||||
%prep
|
||||
%autosetup -n %{name}-%{version} -p1
|
||||
%autosetup -n procps-%{version} -p1
|
||||
|
||||
cp -p %{SOURCE1} .
|
||||
cp -p %{SOURCE2} top/
|
||||
@ -74,8 +60,6 @@ make CFLAGS="%{optflags}"
|
||||
%install
|
||||
%make_install
|
||||
|
||||
find man-po/ -type d -maxdepth 1 -mindepth 1 | while read dirname; do cp -a $dirname %{buildroot}%{_mandir}/ ; done
|
||||
|
||||
%find_lang %{name} --all-name --with-man
|
||||
|
||||
ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof
|
||||
@ -106,9 +90,11 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof
|
||||
%files help
|
||||
%doc AUTHORS Documentation/bugs.md Documentation/FAQ NEWS README.md top/README.top Documentation/TODO
|
||||
%{_mandir}/man*
|
||||
%{_mandir}/translated
|
||||
|
||||
%changelog
|
||||
* Thu Dec 2 2021 zhouwenpei <zhouwenpei1@huawei.com> - 3.3.17-1
|
||||
- update to 3.3.17
|
||||
|
||||
* Wed Jun 30 2021 hewenliang <hewenliang4@huawei.com> - 3.3.16-16
|
||||
- sync patches
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user