diff --git a/SOURCES/procps-ng-3.3.15-pidof-show-worker-threads.patch b/SOURCES/procps-ng-3.3.15-pidof-show-worker-threads.patch new file mode 100644 index 0000000..bb470d9 --- /dev/null +++ b/SOURCES/procps-ng-3.3.15-pidof-show-worker-threads.patch @@ -0,0 +1,54 @@ +From 7dcb6b8eb6c69584d0d56797935f836bc06642f5 Mon Sep 17 00:00:00 2001 +From: Jan Rybar +Date: Tue, 7 Apr 2020 13:41:48 +0200 +Subject: [PATCH] pidof: show worker threads + +Reimplementation of pidof for procps toolset contains sort of deactivated code and does not return results for processes without task.cmdline entry (usually kernel worker threads). Old pidof and pgrep do that in comparison. Despite all perks provided by using pgrep instead, pidof should show those workers again. +--- + pidof.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/pidof.c b/pidof.c +index b0d08cc..90ecb13 100644 +--- a/pidof.c ++++ b/pidof.c +@@ -142,6 +142,7 @@ 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; +@@ -167,9 +168,10 @@ static void select_procs (void) + } + } + +- if (!is_omitted(task.XXXID) && task.cmdline && *task.cmdline) { ++ if (!is_omitted(task.XXXID)) { + +- cmd_arg0 = *task.cmdline; ++ 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 == '-') { +@@ -191,12 +193,14 @@ static void select_procs (void) + !strcmp(program_base, cmd_arg0) || + !strcmp(program, cmd_arg0) || + ++ !strcmp(program, stat_cmd) || ++ + !strcmp(program, exe_link_base) || + !strcmp(program, exe_link)) + { + match = 1; + +- } else if (opt_scripts_too && *(task.cmdline+1)) { ++ } else if (opt_scripts_too && task.cmdline && *(task.cmdline+1)) { + + cmd_arg1 = *(task.cmdline+1); + +-- +2.25.2 + diff --git a/SPECS/procps-ng.spec b/SPECS/procps-ng.spec index 08fadf3..f450a22 100644 --- a/SPECS/procps-ng.spec +++ b/SPECS/procps-ng.spec @@ -4,7 +4,7 @@ Summary: System and process monitoring utilities Name: procps-ng Version: 3.3.15 -Release: 1%{?dist} +Release: 2%{?dist} License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ Group: Applications/System URL: https://sourceforge.net/projects/procps-ng/ @@ -16,6 +16,8 @@ Source1: README.md # wget https://gitlab.com/procps-ng/procps/raw/e0784ddaed30d095bb1d9a8ad6b5a23d10a212c4/top/README.top Source2: README.top +Patch1: procps-ng-3.3.15-pidof-show-worker-threads.patch + BuildRequires: ncurses-devel BuildRequires: libtool BuildRequires: autoconf @@ -23,6 +25,7 @@ BuildRequires: automake BuildRequires: gcc BuildRequires: gettext-devel BuildRequires: systemd-devel +BuildRequires: git %if %{tests_enabled} BuildRequires: dejagnu @@ -83,7 +86,7 @@ Conflicts: man-pages-pl < 0.7-5 Internationalization pack for procps-ng %prep -%setup -q -n %{name}-%{version} +%autosetup -S git cp -p %{SOURCE1} . cp -p %{SOURCE2} top/ @@ -156,6 +159,11 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof %files i18n -f %{name}.lang %changelog +* Tue Apr 14 2020 Jan Rybar - 3.3.15-2 +- pidof: show kernel workers +- gating activated +- Resolves: rhbz#1803640 + * Wed Jul 04 2018 Jan Rybar - 3.3.15-1 - Rebase to 3.3.15 - Translated manual pages moved to -i18n subpackage