Compare commits

...

No commits in common. "imports/c8-beta/procps-ng-3.3.15-2.el8" and "c8" have entirely different histories.

13 changed files with 771 additions and 1 deletions

View File

@ -0,0 +1,60 @@
diff --git a/ps/parser.c b/ps/parser.c
index 4263a1f..b33f319 100644
--- a/ps/parser.c
+++ b/ps/parser.c
@@ -31,7 +31,7 @@
#include <sys/stat.h>
#include <sys/types.h>
-#include "../proc/alloc.h"
+#include "xalloc.h"
#include "common.h"
#include "c.h"
@@ -184,8 +184,8 @@ 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 = malloc(sizeof(selection_node));
- node->u = malloc(strlen(arg)*sizeof(sel_union)); /* waste is insignificant */
node->n = 0;
+ node->u = NULL;
buf = strdup(arg);
/*** sanity check and count items ***/
need_item = 1; /* true */
@@ -199,12 +199,13 @@ static const char *parse_list(const char *arg, const char *(*parse_fn)(char *, s
need_item=1;
break;
default:
- if(need_item) items++;
+ if(need_item && items<INT_MAX) items++;
need_item=0;
}
} 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--){
@@ -1031,15 +1032,15 @@ static const char *parse_trailing_pids(void){
thisarg = ps_argc - 1; /* we must be at the end now */
pidnode = malloc(sizeof(selection_node));
- pidnode->u = malloc(i*sizeof(sel_union)); /* waste is insignificant */
+ pidnode->u = xcalloc(i, sizeof(sel_union)); /* waste is insignificant */
pidnode->n = 0;
grpnode = malloc(sizeof(selection_node));
- grpnode->u = malloc(i*sizeof(sel_union)); /* waste is insignificant */
+ grpnode->u = xcalloc(i, sizeof(sel_union)); /* waste is insignificant */
grpnode->n = 0;
sidnode = malloc(sizeof(selection_node));
- sidnode->u = malloc(i*sizeof(sel_union)); /* waste is insignificant */
+ sidnode->u = xcalloc(i, sizeof(sel_union)); /* waste is insignificant */
sidnode->n = 0;
while(i--){
--
2.40.1

View File

@ -0,0 +1,43 @@
diff -up ./ps/display.c.ori ./ps/display.c
--- ./ps/display.c.ori 2018-05-18 23:32:21.998979977 +0200
+++ ./ps/display.c 2022-11-24 15:11:26.678314866 +0100
@@ -44,26 +44,31 @@
#define SIGCHLD SIGCLD
#endif
+#define SIG_IS_TERM_OR_HUP(signo) (((signo) == SIGTERM) || (signo) == SIGHUP)
+
char *myname;
/* just reports a crash */
static void signal_handler(int signo){
if(signo==SIGPIPE) _exit(0); /* "ps | head" will cause this */
/* fprintf() is not reentrant, but we _exit() anyway */
- fprintf(stderr,
- _("Signal %d (%s) caught by %s (%s).\n"),
- signo,
- signal_number_to_name(signo),
- myname,
- PACKAGE_VERSION
- );
+ if (!SIG_IS_TERM_OR_HUP(signo)) {
+ fprintf(stderr,
+ _("Signal %d (%s) caught by %s (%s).\n"),
+ signo,
+ signal_number_to_name(signo),
+ myname,
+ PACKAGE_VERSION
+ );
+ }
switch (signo) {
case SIGHUP:
case SIGUSR1:
case SIGUSR2:
exit(EXIT_FAILURE);
default:
- error_at_line(0, 0, __FILE__, __LINE__, "%s", _("please report this bug"));
+ if (!SIG_IS_TERM_OR_HUP(signo))
+ error_at_line(0, 0, __FILE__, __LINE__, "%s", _("please report this bug"));
signal(signo, SIG_DFL); /* allow core file creation */
kill(getpid(), signo);
_exit(EXIT_FAILURE);

View File

@ -0,0 +1,28 @@
commit c833a6241893c7e566a5eed762661942e4cd90d3
Author: Todd Lewis <utoddl@gmail.com>
Date: Mon Oct 29 18:33:48 2018 +0000
Fix user and group name to number conversion for uid/gid above 2^31.
diff --git a/pgrep.c b/pgrep.c
index bde7448..8b82a54 100644
--- a/pgrep.c
+++ b/pgrep.c
@@ -280,7 +280,7 @@ static int conv_uid (const char *restrict name, struct el *restrict e)
xwarnx(_("invalid user name: %s"), name);
return 0;
}
- e->num = pwd->pw_uid;
+ e->num = (int) pwd->pw_uid;
return 1;
}
@@ -297,7 +297,7 @@ static int conv_gid (const char *restrict name, struct el *restrict e)
xwarnx(_("invalid group name: %s"), name);
return 0;
}
- e->num = grp->gr_gid;
+ e->num = (int) grp->gr_gid;
return 1;
}

View File

@ -0,0 +1,57 @@
diff -up ./pgrep.c.ori ./pgrep.c
--- ./pgrep.c.ori 2022-08-17 15:38:29.655530551 +0200
+++ ./pgrep.c 2022-08-17 15:38:53.702661752 +0200
@@ -204,8 +204,12 @@ static int strict_atol (const char *rest
for ( ; *str; ++str) {
if (! isdigit (*str))
- return (0);
+ return 0;
+ if (res >= LONG_MAX / 10)
+ return 0;
res *= 10;
+ if (res >= LONG_MAX - (*str - '0'))
+ return 0;
res += *str - '0';
}
*value = sign * res;
@@ -280,7 +284,7 @@ static int conv_uid (const char *restric
xwarnx(_("invalid user name: %s"), name);
return 0;
}
- e->num = (int) pwd->pw_uid;
+ e->num = pwd->pw_uid;
return 1;
}
@@ -297,7 +301,7 @@ static int conv_gid (const char *restric
xwarnx(_("invalid group name: %s"), name);
return 0;
}
- e->num = (int) grp->gr_gid;
+ e->num = grp->gr_gid;
return 1;
}
diff -up ./proc/readproc.h.ori ./proc/readproc.h
--- ./proc/readproc.h.ori 2018-05-19 00:04:15.218532055 +0200
+++ ./proc/readproc.h 2022-08-17 15:38:53.702661752 +0200
@@ -159,12 +159,12 @@ typedef struct proc_t {
session, // stat session id
nlwp, // stat,status number of threads, or 0 if no clue
tgid, // (special) thread group ID, the POSIX PID (see also: tid)
- tty, // stat full device number of controlling terminal
- /* FIXME: int uids & gids should be uid_t or gid_t from pwd.h */
- euid, egid, // stat(),status effective
- ruid, rgid, // status real
- suid, sgid, // status saved
- fuid, fgid, // status fs (used for file access only)
+ tty; // stat full device number of controlling terminal
+ uid_t euid; gid_t egid; // stat(),status effective
+ uid_t ruid; gid_t rgid; // status real
+ uid_t suid; gid_t sgid; // status saved
+ uid_t fuid; gid_t fgid; // status fs (used for file access only)
+ int
tpgid, // stat terminal process group id
exit_signal, // stat might not be SIGCHLD
processor; // stat current (or most recent?) CPU

View File

@ -0,0 +1,112 @@
From d9b3415d2a761cb7669a67f5309665335d5eb4c4 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Mon, 9 Nov 2020 16:10:22 +0100
Subject: [PATCH] New '-w' option for kernel workers.
---
pidof.1 | 3 +++
pidof.c | 17 ++++++++++++-----
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/pidof.1 b/pidof.1
index 1368704..c85c088 100644
--- a/pidof.1
+++ b/pidof.1
@@ -45,6 +45,9 @@ the current root directory of processes they do not own.
.IP \-x
Scripts too - this causes the program to also return process id's of
shells running the named scripts.
+.IP \-w
+Show also processes that do not have visible command line (e.g. kernel
+worker threads).
.IP "-o \fIomitpid\fP"
Tells \fIpidof\fP to omit processes with that process id. The special
pid \fB%PPID\fP can be used to name the parent process of the \fIpidof\fP
diff --git a/pidof.c b/pidof.c
index 94e19bb..7fdf27a 100644
--- a/pidof.c
+++ b/pidof.c
@@ -55,6 +55,8 @@ static char *program = NULL;
static int opt_single_shot = 0; /* -s */
static int opt_scripts_too = 0; /* -x */
static int opt_rootdir_check = 0; /* -c */
+static int opt_with_workers = 0; /* -w */
+
static char *pidof_root = NULL;
@@ -69,6 +71,7 @@ static int __attribute__ ((__noreturn__)) usage(int opt)
fputs(_(" -s, --single-shot return one PID only\n"), fp);
fputs(_(" -c, --check-root omit processes with different root\n"), fp);
fputs(_(" -x also find shells running the named scripts\n"), fp);
+ fputs(_(" -w, --with-workers show kernel workers too\n"), fp);
fputs(_(" -o, --omit-pid <PID,...> omit processes with PID\n"), fp);
fputs(_(" -S, --separator SEP use SEP as separator put between PIDs"), fp);
fputs(USAGE_SEPARATOR, fp);
@@ -142,7 +145,6 @@ static void select_procs (void)
static int size = 0;
char *cmd_arg0, *cmd_arg0base;
char *cmd_arg1, *cmd_arg1base;
- char *stat_cmd;
char *program_base;
char *root_link;
char *exe_link;
@@ -168,10 +170,9 @@ static void select_procs (void)
}
}
- if (!is_omitted(task.XXXID)) {
+ if (!is_omitted(task.XXXID) && ((task.cmdline && *task.cmdline) || opt_with_workers)) {
cmd_arg0 = (task.cmdline && *task.cmdline) ? *task.cmdline : "\0";
- stat_cmd = task.cmd ? task.cmd : "\0";
/* processes starting with '-' are login shells */
if (*cmd_arg0 == '-') {
@@ -193,7 +194,7 @@ static void select_procs (void)
!strcmp(program_base, cmd_arg0) ||
!strcmp(program, cmd_arg0) ||
- !strcmp(program, stat_cmd) ||
+ (opt_with_workers && !strcmp(program, task.cmd)) ||
!strcmp(program, exe_link_base) ||
!strcmp(program, exe_link))
@@ -293,13 +294,14 @@ int main (int argc, char **argv)
int first_pid = 1;
const char *separator = " ";
- const char *opts = "scnxmo:S:?Vh";
+ const char *opts = "scnxwmo:S:?Vh";
static const struct option longopts[] = {
{"check-root", no_argument, NULL, 'c'},
{"single-shot", no_argument, NULL, 's'},
{"omit-pid", required_argument, NULL, 'o'},
{"separator", required_argument, NULL, 's'},
+ {"with-workers", no_argument, NULL, 'w'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0}
@@ -325,6 +327,9 @@ int main (int argc, char **argv)
case 'x':
opt_scripts_too = 1;
break;
+ case 'w':
+ opt_with_workers = 1;
+ break;
case 'c':
if (geteuid() == 0) {
opt_rootdir_check = 1;
@@ -358,6 +363,8 @@ int main (int argc, char **argv)
program = argv[optind++];
+ if (*program == '\0') continue;
+
select_procs(); /* get the list of matching processes */
if (proc_count) {
--
2.25.4

View File

@ -0,0 +1,13 @@
diff --git a/pidof.c b/pidof.c
index 7fdf27a..2166265 100644
--- a/pidof.c
+++ b/pidof.c
@@ -300,7 +300,7 @@ int main (int argc, char **argv)
{"check-root", no_argument, NULL, 'c'},
{"single-shot", no_argument, NULL, 's'},
{"omit-pid", required_argument, NULL, 'o'},
- {"separator", required_argument, NULL, 's'},
+ {"separator", required_argument, NULL, 'S'},
{"with-workers", no_argument, NULL, 'w'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},

View File

@ -0,0 +1,23 @@
diff --git a/ps/display.c b/ps/display.c
index 1927fd6..e7ab351 100644
--- a/ps/display.c
+++ b/ps/display.c
@@ -357,7 +357,7 @@ static void simple_spew(void){
if (selection_list && selection_list->typecode == SEL_PID_QUICK) {
flags |= PROC_PID;
- pidlist = (pid_t*) malloc(selection_list->n * sizeof(pid_t));
+ pidlist = (pid_t*) malloc((selection_list->n + 1) * sizeof(pid_t));
if (!pidlist) {
fprintf(stderr, _("error: not enough memory\n"));
exit(1);
@@ -366,6 +366,9 @@ static void simple_spew(void){
for (i = 0; i < selection_list->n; i++) {
pidlist[i] = selection_list->u[selection_list->n-i-1].pid;
}
+
+ // delimit the array with nul object (0); RHBZ#2153813
+ pidlist[selection_list->n] = (pid_t)0;
}
ptp = openproc(flags, pidlist);

View File

@ -0,0 +1,39 @@
From 06995518605fed7a1a29551be0eff01b2f9e89b7 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Tue, 13 Dec 2022 16:02:50 -0500
Subject: [PATCH]
---
ps/common.h | 2 +-
ps/select.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ps/common.h b/ps/common.h
index 905d320..fc4d3a8 100644
--- a/ps/common.h
+++ b/ps/common.h
@@ -189,7 +189,7 @@ typedef union sel_union {
uid_t uid;
gid_t gid;
dev_t tty;
- char cmd[64]; /* this is _not_ \0 terminated */
+ char cmd[16]; /* this is _not_ \0 terminated */
} sel_union;
typedef struct selection_node {
diff --git a/ps/select.c b/ps/select.c
index f58ca25..e12982d 100644
--- a/ps/select.c
+++ b/ps/select.c
@@ -117,7 +117,7 @@ static int proc_was_listed(proc_t *buf){
break; case SEL_SESS: return_if_match(session,pid);
break; case SEL_COMM: i=sn->n; while(i--)
- if(!strncmp( buf->cmd, (*(sn->u+i)).cmd, 63 )) return 1;
+ if(!strncmp( buf->cmd, (*(sn->u+i)).cmd, 15 )) return 1;
--
2.31.1

View File

@ -0,0 +1,96 @@
diff -up ./NEWS.ori ./NEWS
diff -up ./sysctl.8.ori ./sysctl.8
--- ./sysctl.8.ori 2018-03-03 07:59:18.064843718 +0100
+++ ./sysctl.8 2022-07-29 16:33:02.906648974 +0200
@@ -6,7 +6,7 @@
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details."
-.TH SYSCTL "8" "2018-02-19" "procps-ng" "System Administration"
+.TH SYSCTL "8" "2020-02-27" "procps-ng" "System Administration"
.SH NAME
sysctl \- configure kernel parameters at runtime
.SH SYNOPSIS
@@ -81,10 +81,10 @@ 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
-/run/sysctl.d/*.conf
-.br
/etc/sysctl.d/*.conf
.br
+/run/sysctl.d/*.conf
+.br
/usr/local/lib/sysctl.d/*.conf
.br
/usr/lib/sysctl.d/*.conf
@@ -152,6 +152,16 @@ echo 256 > /proc/sys/net/ipv6/neigh/eth0
.SH FILES
.I /proc/sys
.br
+.I /etc/sysctl.d/*.conf
+.br
+.I /run/sysctl.d/*.conf
+.br
+.I /usr/local/lib/sysctl.d/*.conf
+.br
+.I /usr/lib/sysctl.d/*.conf
+.br
+.I /lib/sysctl.d/*.conf
+.br
.I /etc/sysctl.conf
.SH SEE ALSO
.BR sysctl.conf (5)
diff -up ./sysctl.conf.5.ori ./sysctl.conf.5
--- ./sysctl.conf.5.ori 2017-12-22 05:13:14.771653252 +0100
+++ ./sysctl.conf.5 2022-07-29 16:33:02.907648980 +0200
@@ -51,22 +51,22 @@ to list all possible parameters. The des
.RE
.PP
.SH FILES
-.TP
-/run/sysctl.d/*.conf
-.TQ
-/etc/sysctl.d/*.conf
-.TQ
-/usr/local/lib/sysctl.d/*.conf
-.TQ
-/usr/lib/sysctl.d/*.conf
-.TQ
-/lib/sysctl.d/*.conf
-.TQ
-/etc/sysctl.conf
+.I /etc/sysctl.d/*.conf
+.br
+.I /run/sysctl.d/*.conf
+.br
+.I /usr/local/lib/sysctl.d/*.conf
+.br
+.I /usr/lib/sysctl.d/*.conf
+.br
+.I /lib/sysctl.d/*.conf
+.br
+.I /etc/sysctl.conf
+
The paths where
-sysctl
+.B sysctl
preload files usually exist. See also
-sysctl
+.B sysctl
option
.IR \-\-system .
.SH SEE ALSO
diff -up ./sysctl.c.ori ./sysctl.c
--- ./sysctl.c.ori 2018-05-17 13:23:41.574213737 +0200
+++ ./sysctl.c 2022-07-29 16:33:02.907648980 +0200
@@ -614,8 +614,8 @@ static int PreloadSystem(void)
{
unsigned di, i;
const char *dirs[] = {
- "/run/sysctl.d",
"/etc/sysctl.d",
+ "/run/sysctl.d",
"/usr/local/lib/sysctl.d",
"/usr/lib/sysctl.d",
"/lib/sysctl.d",

View File

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

View File

@ -0,0 +1,147 @@
diff --git a/vmstat.8 b/vmstat.8
index fa0938c..fd1078f 100644
--- a/vmstat.8
+++ b/vmstat.8
@@ -87,6 +87,9 @@ Display version information and exit.
.TP
\fB\-h\fR, \fB\-\-help\fR
Display help and exit.
+.TP
+\fB\-y\fR, \fB\-\-no-first\fR
+Omits first report with statistics since system boot.
.PD
.SH "FIELD DESCRIPTION FOR VM MODE"
.SS
diff --git a/vmstat.c b/vmstat.c
index f2aa2f4..07496cd 100644
--- a/vmstat.c
+++ b/vmstat.c
@@ -75,6 +75,9 @@ static int a_option;
/* "-w" means "wide output" */
static int w_option;
+/* "-y" means "skip first output" */
+static int y_option;
+
/* "-t" means "show timestamp" */
static int t_option;
@@ -104,6 +107,7 @@ static void __attribute__ ((__noreturn__))
fputs(_(" -S, --unit <char> define display unit\n"), out);
fputs(_(" -w, --wide wide output\n"), out);
fputs(_(" -t, --timestamp show timestamp\n"), out);
+ fputs(_(" -y, --no-first skips first line of output\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(USAGE_HELP, out);
fputs(USAGE_VERSION, out);
@@ -304,43 +308,47 @@ static void new_format(void)
cpu_zzz, pgpgin, pgpgout, pswpin, pswpout, intr, ctxt, &running,
&blocked, &dummy_1, &dummy_2);
- if (t_option) {
- (void) time( &the_time );
- tm_ptr = localtime( &the_time );
- strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S", tm_ptr);
- }
+ if (y_option == 0) {
+ if (t_option) {
+ (void) time( &the_time );
+ tm_ptr = localtime( &the_time );
+ strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S", tm_ptr);
+ }
- duse = *cpu_use + *cpu_nic;
- dsys = *cpu_sys + *cpu_xxx + *cpu_yyy;
- didl = *cpu_idl;
- diow = *cpu_iow;
- dstl = *cpu_zzz;
- Div = duse + dsys + didl + diow + dstl;
- if (!Div) Div = 1, didl = 1;
- divo2 = Div / 2UL;
- printf(w_option ? wide_format : format,
- running, blocked,
- unitConvert(kb_swap_used), unitConvert(kb_main_free),
- unitConvert(a_option?kb_inactive:kb_main_buffers),
- unitConvert(a_option?kb_active:kb_main_cached),
- (unsigned)( (unitConvert(*pswpin * kb_per_page) * hz + divo2) / Div ),
- (unsigned)( (unitConvert(*pswpout * kb_per_page) * hz + divo2) / Div ),
- (unsigned)( (*pgpgin * hz + divo2) / Div ),
- (unsigned)( (*pgpgout * hz + divo2) / Div ),
- (unsigned)( (*intr * hz + divo2) / Div ),
- (unsigned)( (*ctxt * hz + divo2) / Div ),
- (unsigned)( (100*duse + divo2) / Div ),
- (unsigned)( (100*dsys + divo2) / Div ),
- (unsigned)( (100*didl + divo2) / Div ),
- (unsigned)( (100*diow + divo2) / Div ),
- (unsigned)( (100*dstl + divo2) / Div )
- );
+ duse = *cpu_use + *cpu_nic;
+ dsys = *cpu_sys + *cpu_xxx + *cpu_yyy;
+ didl = *cpu_idl;
+ diow = *cpu_iow;
+ dstl = *cpu_zzz;
+ Div = duse + dsys + didl + diow + dstl;
+ if (!Div) Div = 1, didl = 1;
+ divo2 = Div / 2UL;
+ printf(w_option ? wide_format : format,
+ running, blocked,
+ unitConvert(kb_swap_used), unitConvert(kb_main_free),
+ unitConvert(a_option?kb_inactive:kb_main_buffers),
+ unitConvert(a_option?kb_active:kb_main_cached),
+ (unsigned)( (unitConvert(*pswpin * kb_per_page) * hz + divo2) / Div ),
+ (unsigned)( (unitConvert(*pswpout * kb_per_page) * hz + divo2) / Div ),
+ (unsigned)( (*pgpgin * hz + divo2) / Div ),
+ (unsigned)( (*pgpgout * hz + divo2) / Div ),
+ (unsigned)( (*intr * hz + divo2) / Div ),
+ (unsigned)( (*ctxt * hz + divo2) / Div ),
+ (unsigned)( (100*duse + divo2) / Div ),
+ (unsigned)( (100*dsys + divo2) / Div ),
+ (unsigned)( (100*didl + divo2) / Div ),
+ (unsigned)( (100*diow + divo2) / Div ),
+ (unsigned)( (100*dstl + divo2) / Div )
+ );
- if (t_option) {
- printf(" %s", timebuf);
- }
+ if (t_option) {
+ printf(" %s", timebuf);
+ }
- printf("\n");
+ printf("\n");
+ }
+ else
+ num_updates++;
/* main loop */
for (i = 1; infinite_updates || i < num_updates; i++) {
@@ -865,6 +873,7 @@ int main(int argc, char *argv[])
{"timestamp", no_argument, NULL, 't'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
+ {"no-first", no_argument, NULL, 'y'},
{NULL, 0, NULL, 0}
};
@@ -877,7 +886,7 @@ int main(int argc, char *argv[])
atexit(close_stdout);
while ((c =
- getopt_long(argc, argv, "afmnsdDp:S:wthV", longopts,
+ getopt_long(argc, argv, "afmnsdDp:S:wthVy", longopts,
NULL)) != EOF)
switch (c) {
case 'V':
@@ -946,6 +955,11 @@ int main(int argc, char *argv[])
case 't':
t_option = 1;
break;
+ case 'y':
+ /* Don't display stats since system restart */
+ y_option = 1;
+ break;
+
default:
/* no other aguments defined yet. */
usage(stderr);

View File

@ -0,0 +1,41 @@
commit 354b5a56bf2ea831427ab8268ec7101bd3870f8e
Author: Jan Rybar <jrybar@redhat.com>
Date: Thu Apr 30 17:06:18 2020 +0200
vmstat and watch manpage slight fixes
vmstat - align wording with proc manpage to clarify ambiguities (rhbz#1796043)
watch - manpage presumes ntp tools are present by default (which they're not on rpm and deb distros, rhbz#1583669)
diff --git a/vmstat.8 b/vmstat.8
index e408bca..dcc1b1e 100644
--- a/vmstat.8
+++ b/vmstat.8
@@ -93,7 +93,7 @@ Display help and exit.
.B "Procs"
.nf
r: The number of runnable processes (running or waiting for run time).
-b: The number of processes in uninterruptible sleep.
+b: The number of processes blocked waiting for I/O to complete.
.fi
.PP
.SS
diff --git a/watch.1 b/watch.1
index 256c36b..e06e04e 100644
--- a/watch.1
+++ b/watch.1
@@ -34,7 +34,7 @@ every
.I interval
seconds. Try it with
.B ntptime
-and notice how the fractional seconds stays (nearly) the same, as opposed to
+(if present) and notice how the fractional seconds stays (nearly) the same, as opposed to
normal mode where they continuously increase.
.TP
\fB\-t\fR, \fB\-\-no\-title\fR
@@ -190,4 +190,4 @@ watch uname \-r
.I \-p
isn't guaranteed to work across reboots, especially in the face of
.B ntpdate
-or other bootup time-changing mechanisms)
+(if present) or other bootup time-changing mechanisms)

View File

@ -4,7 +4,7 @@
Summary: System and process monitoring utilities
Name: procps-ng
Version: 3.3.15
Release: 2%{?dist}
Release: 14%{?dist}
License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+
Group: Applications/System
URL: https://sourceforge.net/projects/procps-ng/
@ -17,6 +17,18 @@ Source1: README.md
Source2: README.top
Patch1: procps-ng-3.3.15-pidof-show-worker-threads.patch
Patch2: procps-ng-3.3.15-pgrep-uid-conversion-overflow.patch
Patch3: procps-ng-3.3.15-vmstat-watch-manpage.patch
Patch4: procps-ng-3.3.15-pidof-kernel-workers-option.patch
Patch5: procps-ng-3.3.15-pidof-separator-option-backport.patch
Patch6: procps-ng-3.3.15-uptime-pretty-mod.patch
Patch7: procps-ng-3.3.15-vmstat-omit-first-report.patch
Patch8: procps-ng-3.3.15-sysctl-config-dir-order.patch
Patch9: procps-ng-3.3.15-pgrep-uid-gid-overflow.patch
Patch10: procps-ng-3.3.15-display-sig-unsafe.patch
Patch11: procps-ng-3.3.15-ps-select.patch
Patch12: procps-ng-3.3.15-ps-out-of-bonds-read.patch
Patch13: procps-ng-3.3.15-cve-2023-4016.patch
BuildRequires: ncurses-devel
BuildRequires: libtool
@ -159,6 +171,65 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof
%files i18n -f %{name}.lang
%changelog
* Tue Aug 15 2023 Jan Rybar <jrybar@redhat.com> - 3.3.15-14
- CVE-2023-4016: ps: possible buffer overflow
- Resolves: rhbz#2228503
* Tue Jan 17 2023 Jan Rybar <jrybar@redhat.com> - 3.3.15-13
- version bump requested to create -devel subpkg for CRB inclusion
- Resolves: rhbz#2164781
* Tue Jan 17 2023 Jan Rybar <jrybar@redhat.com> - 3.3.15-12
- ps: out-of-bonds read in quick mode
- Resolves: rhbz#2153813
* Tue Dec 13 2022 Kyle Walker <kwalker@redhat.com> - 3.3.15-11
- ps: revert increase command name length to 64 ____ (catch up)
- Resolves: rhbz#2144978
* Wed Nov 23 2022 Jan Rybar <jrybar@redhat.com> - 3.3.15-10
- display.c: backport: async-signal-unsafe handler deadlocks on SIGHUP
- Resolves: rhbz#2141696
* Wed Aug 17 2022 Jan Rybar <jrybar@redhat.com> - 3.3.15-9
- pgrep: backport uid/gid overflow fix
- Resolves: rhbz#1827731
* Wed Jul 20 2022 Jan Rybar <jrybar@redhat.com> - 3.3.15-8
- vmstat: added -y option to omit first report
- Resolves: rhbz#2027350
- sysctl: backport config directory order, align with systemd
- Resolves: rhbz#2111915
* Wed Mar 23 2022 Jan Rybar <jrybar@redhat.com> - 3.3.15-7
- uptime: human readable data not shown if 364 days up
- Resolves: rhbz#1772999
* Tue Dec 01 2020 Jan Rybar <jrybar@redhat.com> - 3.3.15-6
- pidof: option for separator collides with other option
- Resolves: rhbz#1895985
* Mon Nov 09 2020 Jan Rybar <jrybar@redhat.com> - 3.3.15-5
- version bump due to unspotted malformed backport patch
- Resolves: rhbz#1860486
- Resolves: rhbz#1894526
- Related: rhbz#1803640
* Fri Nov 06 2020 Jan Rybar <jrybar@redhat.com> - 3.3.15-4
- pidof: new option to show kernel worker threads
- pidof: empty input causes to show kernel worker threads
- Resolves: rhbz#1860486
- Resolves: rhbz#1894526
- Related: rhbz#1803640
-
* Wed Jul 08 2020 Jan Rybar <jrybar@redhat.com> - 3.3.15-3
- pgrep: uid/gid conversion overflow
- vmstat: align manpage with procfs wording
- watch: manpage presumes NTP on system
- Resolves: rhbz#1827731
- Resolves: rhbz#1829920
- Resolves: rhbz#1583669
* Tue Apr 14 2020 Jan Rybar <jrybar@redhat.com> - 3.3.15-2
- pidof: show kernel workers
- gating activated