Merged update from upstream sources

This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/procps-ng.git#53ec6254a89ef0f7cf11616dca0d76adddccc085
This commit is contained in:
DistroBaker 2020-12-22 19:02:31 +00:00
parent e0b30b9900
commit 66034740b3
4 changed files with 190 additions and 1 deletions

View File

@ -0,0 +1,99 @@
diff --git a/pidof.1 b/pidof.1
index 8ef4abf..5f95b85 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 90ecb13..0754754 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 = "scdnxmo:S:?Vh";
+ const char *opts = "scdnxwmo: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;
@@ -359,6 +364,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) {

View File

@ -0,0 +1,22 @@
commit 584c65ba375a4f7242ddeb74f6006f8f9f5c8d08
Author: Jan Rybar <jrybar@redhat.com>
Date: Fri Nov 6 14:45:56 2020 +0000
pkill manpage to document '-e' option
diff --git a/pgrep.1 b/pgrep.1
index 9c29fb9c..a1810f0d 100644
--- a/pgrep.1
+++ b/pgrep.1
@@ -62,6 +62,11 @@ newline).
.RB ( pgrep
only.)
.TP
+\fB\-e\fR, \fB\-\-echo\fR
+Display name and PID of the process being killed.
+.RB ( pkill
+only.)
+.TP
\fB\-f\fR, \fB\-\-full\fR
The
.I pattern

View File

@ -4,7 +4,7 @@
Summary: System and process monitoring utilities
Name: procps-ng
Version: 3.3.16
Release: 1%{?dist}
Release: 2%{?dist}
License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+
URL: https://sourceforge.net/projects/procps-ng/
@ -16,6 +16,9 @@ Source1: README.md
Source2: README.top
Patch1: pidof-show-worker-threads.patch
Patch2: pidof-show-workers-option.patch
Patch3: pkill-manpage-e-option.patch
Patch4: ps-exe-format-option.patch
BuildRequires: ncurses-devel
BuildRequires: libtool
@ -156,6 +159,13 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof
%exclude %{_mandir}/translated/*
%changelog
* Tue Dec 22 2020 Jan Rybar <jrybar@redhat.com> - 3.3.16-2
- ps: new exe format option to show real path to exe
- pidof: new -w option to show kernel worker threads
- pkill: manpage to document -e option
- Resolves: bz#1629413
- Resolves: bz#1399206
* Tue Aug 18 2020 Jan Rybar <jrybar@redhat.com> - 3.3.16-1
- Rebase to newest upstream version

View File

@ -0,0 +1,58 @@
diff --git a/ps/output.c b/ps/output.c
index e718f19..b66d543 100644
--- a/ps/output.c
+++ b/ps/output.c
@@ -1250,6 +1250,26 @@ static int pr_luid(char *restrict const outbuf, const proc_t *restrict const pp)
}
+/* full path to executable */
+static int pr_exe(char *restrict const outbuf, const proc_t *restrict const pp){
+ char filename[48];
+ ssize_t num_read = 0;
+
+ snprintf(filename, sizeof filename, "/proc/%d/exe", pp->tgid);
+
+ num_read = readlink(filename, outbuf, OUTBUF_SIZE-1);
+ if (num_read > 0) {
+ outbuf[num_read] = '\0';
+ }
+ else {
+ outbuf[0] = '-';
+ outbuf[1] = '\0';
+ num_read = 1;
+ }
+
+ return num_read;
+}
+
/************************* Systemd stuff ********************************/
static int pr_sd_unit(char *restrict const outbuf, const proc_t *restrict const pp){
return snprintf(outbuf, COLWID, "%s", pp->sd_unit);
@@ -1533,6 +1553,7 @@ static const format_struct format_array[] = {
{"etimes", "ELAPSED", pr_etimes, sr_etime, 7, 0, BSD, ET|RIGHT}, /* FreeBSD */
{"euid", "EUID", pr_euid, sr_euid, 5, 0, LNX, ET|RIGHT},
{"euser", "EUSER", pr_euser, sr_euser, 8, USR, LNX, ET|USER},
+{"exe", "EXE", pr_exe, sr_nop, 27, 0, LNX, PO|UNLIMITED},
{"f", "F", pr_flag, sr_flags, 1, 0, XXX, ET|RIGHT}, /*flags*/
{"fgid", "FGID", pr_fgid, sr_fgid, 5, 0, LNX, ET|RIGHT},
{"fgroup", "FGROUP", pr_fgroup, sr_fgroup, 8, GRP, LNX, ET|USER},
diff --git a/ps/ps.1 b/ps/ps.1
index 844341c..6818667 100644
--- a/ps/ps.1
+++ b/ps/ps.1
@@ -1253,6 +1253,14 @@ option can be used to force the decimal representation. (alias
.BR uname ", " user ).
T}
+exe EXE T{
+path to the executable. Useful if path cannot be printed via
+.BR cmd ", " comm
+or
+.BR args
+format options.
+T}
+
f F T{
flags associated with the process, see the
.B PROCESS FLAGS