sys-process/procps: Sync with Gentoo

It's from Gentoo commit 46a42efa49214237cd5130c7d66cee8f3840aef2.

Signed-off-by: Flatcar Buildbot <buildbot@flatcar-linux.org>
This commit is contained in:
Flatcar Buildbot 2026-01-12 07:17:46 +00:00 committed by Krzesimir Nowak
parent beddb493e7
commit 482479d265
5 changed files with 365 additions and 2 deletions

View File

@ -0,0 +1,186 @@
From 66a37d3abf14dfd450b4ded7f1ccb0506699e7d1 Mon Sep 17 00:00:00 2001
Message-ID: <66a37d3abf14dfd450b4ded7f1ccb0506699e7d1.1763650309.git.sam@gentoo.org>
From: Sam James <sam@gentoo.org>
Date: Thu, 20 Nov 2025 14:43:13 +0000
Subject: [PATCH] build-sys: fix option handling
Explicit --enable-pidwait wasn't setting ENABLE_PIDWAIT. Fix that by
moving the ENABLE_PIDWAIT handling outside of AC_ARG_ENABLE.
While here, fix all the other AC_* calls to correctly set enable_XYZ or
with_XYZ to avoid other problems, otherwise they'd be left unset if
enabled rather than set to the correct value (yes or no).
---
configure.ac | 43 ++++++++++++++++++++++---------------------
1 file changed, 22 insertions(+), 21 deletions(-)
diff --git a/configure.ac b/configure.ac
index fe5ac458..97033143 100644
--- a/configure.ac
+++ b/configure.ac
@@ -181,7 +181,7 @@ fi
AC_SUBST([WITH_COLORWATCH])
AC_ARG_ENABLE([colorwatch],
AS_HELP_STRING([--enable-colorwatch], [enable watch to use color by default]),
- [], [enable_colorwatch=no]
+ [enable_colorwatch=$enableval], [enable_colorwatch=no]
)
if test "$enable_colorwatch" = "yes"; then
AC_DEFINE([WITH_COLORWATCH], [1], [Enable color watch by default])
@@ -191,7 +191,7 @@ fi
AC_ARG_ENABLE([libselinux],
AS_HELP_STRING([--enable-libselinux], [enable libselinux]),
- [], [enable_libselinux=no]
+ [enable_libselinux=$enableval], [enable_libselinux=no]
)
if test "$enable_libselinux" = "yes"; then
AC_DEFINE([ENABLE_LIBSELINUX], [1], [Enable libselinux])
@@ -223,7 +223,7 @@ AC_SUBST([HARDEN_LDFLAGS])
# Optional packages - AC_ARG_WITH
AC_ARG_WITH([ncurses],
AS_HELP_STRING([--without-ncurses], [build only applications not needing ncurses]),
- [],
+ [with_ncurses=$withval],
[with_ncurses=yes]
)
if test "x$with_ncurses" = xno; then
@@ -267,7 +267,7 @@ fi
AC_ARG_WITH([systemd],
[AS_HELP_STRING([--with-systemd], [enable systemd support])],
- [], [with_systemd=no]
+ [with_systemd=$withval], [with_systemd=no]
)
AS_IF([test "x$with_systemd" != "xno"], [
PKG_CHECK_MODULES([SYSTEMD], [libsystemd],,
@@ -286,7 +286,7 @@ AM_CONDITIONAL([WITH_SYSTEMD], [test x$with_systemd != xno])
AC_ARG_WITH([elogind],
[AS_HELP_STRING([--with-elogind], [enable elogind support])],
- [], [with_elogind=no]
+ [with_elogind=$withval], [with_elogind=no]
)
# Do not allow elogind if systemd is wanted and found
AS_IF([test "x$with_systemd" != "xno"], [with_elogind=no])
@@ -300,7 +300,7 @@ AM_CONDITIONAL([WITH_ELOGIND], [test x$with_elogind != xno])
# AC_ARG_ENABLEs
AC_ARG_ENABLE([pidof],
AS_HELP_STRING([--disable-pidof], [do not build pidof]),
- [], [enable_pidof=yes]
+ [enable_pidof=$enableval], [enable_pidof=yes]
)
AM_CONDITIONAL(BUILD_PIDOF, test "x$enable_pidof" = xyes)
@@ -308,11 +308,12 @@ AM_CONDITIONAL(BUILD_PIDOF, test "x$enable_pidof" = xyes)
# Cannot use AC_CHECK_FUNC as it (incorrectly) passes with pidfd_open missing
AC_ARG_ENABLE([pidwait],
AS_HELP_STRING([--disable-pidwait], [do not build pidwait]),
- [], [
- enable_pidwait=yes
- AC_DEFINE(ENABLE_PIDWAIT, 1, [enable pidwait])
- ]
+ [enable_pidwait=$enableval], [enable_pidwait=yes]
)
+
+AS_IF([test "x$enable_pidwait" = xyes], [
+ AC_DEFINE(ENABLE_PIDWAIT, 1, [enable pidwait])
+], [])
AM_CONDITIONAL(BUILD_PIDWAIT, test "x$enable_pidwait" = xyes)
AC_MSG_CHECKING([for pidfd_open()])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/pidfd.h>]], [[pidfd_open(1,1)]])],
@@ -346,12 +347,12 @@ AC_LINK_IFELSE(
AC_ARG_ENABLE([kill],
AS_HELP_STRING([--disable-kill], [do not build kill]),
- [], [enable_kill=yes]
+ [enable_kill=$enableval], [enable_kill=yes]
)
AM_CONDITIONAL(BUILD_KILL, test "x$enable_kill" = xyes)
AC_ARG_ENABLE([w],
AS_HELP_STRING([--disable-w], [do not build w]),
- [], [enable_w=yes]
+ [enable_w=$enableval], [enable_w=yes]
)
AM_CONDITIONAL(BUILD_W, test "x$enable_w" = xyes)
@@ -360,19 +361,19 @@ AM_CONDITIONAL(CYGWIN, test "x$host_os" = xcygwin)
AC_ARG_ENABLE([skill],
AS_HELP_STRING([--enable-skill], [build skill and snice]),
- [], [enable_skill=no]
+ [enable_skill=$enableval], [enable_skill=no]
)
AM_CONDITIONAL(BUILD_SKILL, test "x$enable_skill" = xyes)
AC_ARG_ENABLE([examples],
AS_HELP_STRING([--enable-examples], [add example files to installation]),
- [], [enable_examples=no]
+ [enable_examples=$enableval], [enable_examples=no]
)
AM_CONDITIONAL(EXAMPLE_FILES, test "x$enable_examples" = xyes)
AC_ARG_ENABLE([sigwinch],
AS_HELP_STRING([--enable-sigwinch], [reduce impact of x-windows resize operations on top]),
- [], [enable_sigwinch=no]
+ [enable_sigwinch=$enableval], [enable_sigwinch=no]
)
if test "x$enable_sigwinch" = xyes; then
AC_DEFINE(SIGNALS_LESS, 1, [reduce impact of x-windows resize operations on top])
@@ -380,7 +381,7 @@ fi
AC_ARG_ENABLE([wide-percent],
AS_HELP_STRING([--enable-wide-percent], [provide extra precision under %CPU and %MEM for top]),
- [], [enable_wide_percent=no]
+ [enable_wide_percent=$enableval], [enable_wide_percent=no]
)
if test "x$enable_wide_percent" = xyes; then
AC_DEFINE(BOOST_PERCNT, 1, [provide extra precision under %CPU and %MEM for top])
@@ -388,7 +389,7 @@ fi
AC_ARG_ENABLE([wide-memory],
AS_HELP_STRING([--enable-wide-memory], [provide extra precision under memory fields for top]),
- [], [enable_wide_memory=no]
+ [enable_wide_memory=$enableval], [enable_wide_memory=no]
)
if test "x$enable_wide_memory" = xyes; then
AC_DEFINE(BOOST_MEMORY, 1, [provide extra precision under memory fields for top])
@@ -396,7 +397,7 @@ fi
AC_ARG_ENABLE([modern-top],
AS_HELP_STRING([--disable-modern-top], [disable new startup defaults, return to original top]),
- [], [enable_modern_top=yes]
+ [enable_modern_top=$enableval], [enable_modern_top=yes]
)
if test "x$enable_modern_top" = xno; then
AC_DEFINE(ORIG_TOPDEFS, 1, [disable new startup defaults, return to original top])
@@ -405,7 +406,7 @@ fi
DL_LIB=
AC_ARG_ENABLE([numa],
AS_HELP_STRING([--disable-numa], [disable NUMA/Node support in top]),
- [], [enable_numa=yes]
+ [enable_numa=$enableval], [enable_numa=yes]
)
if test "x$enable_numa" = xno; then
AC_DEFINE([NUMA_DISABLE], [1], [disable NUMA/Node support in top])
@@ -420,7 +421,7 @@ AC_SUBST([DL_LIB])
AC_ARG_ENABLE([w-from],
AS_HELP_STRING([--enable-w-from], [enable w from field by default]),
- [], [enable_w_from=no]
+ [enable_w_from=$enableval], [enable_w_from=no]
)
if test "x$enable_w_from" = xyes; then
AC_DEFINE(W_SHOWFROM, 1, [enable w from field by default])
@@ -428,7 +429,7 @@ fi
AC_ARG_ENABLE([whining],
AS_HELP_STRING([--disable-whining], [do not print unnecessary warnings (slackware-ism)]),
- [], [enable_whining=yes]
+ [enable_whining=$enableval], [enable_whining=yes]
)
if test "x$enable_whining" = xyes; then
AC_DEFINE(BUILD_WITH_WHINE, 1, [should extra warnings be printed (slackware-ism)])
--
2.52.0

View File

@ -0,0 +1,43 @@
https://gitlab.com/procps-ng/procps/-/issues/386
https://gitlab.com/procps-ng/procps/-/merge_requests/262
From 0298cd70368f76ce6bfe46a55cebd105d5d53e94 Mon Sep 17 00:00:00 2001
From: Chris Down <chris@chrisdown.name>
Date: Sat, 26 Jul 2025 22:38:12 +0100
Subject: [PATCH] pgrep: Fix pidwait only waiting for half of specified
processes
The pidwait command currently waits for only half of the given
processes. This happens because when a monitored process terminates, its
pidfd can generate two events: one for the process exiting (EPOLLIN),
and another for it being reaped by its parent (EPOLLIN or EPOLLHUP). The
existing code increments its completion counter for every event
returned, causing it to count each process termination twice and exit
prematurely.
This fix tells the kernel to deactivate the file descriptor after the
first event (process exit) is delivered, and prevents any subsequent
events from being processed for the same pidfd.
References: #386
Signed-off-by: Chris Down <chris@chrisdown.name>
---
src/pgrep.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pgrep.c b/src/pgrep.c
index 4c5ed521..20cc251d 100644
--- a/src/pgrep.c
+++ b/src/pgrep.c
@@ -1433,7 +1433,7 @@ int main (int argc, char **argv)
warn(_("opening pid %ld failed"), procs[i].num);
continue;
}
- ev.events = EPOLLIN | EPOLLET;
+ ev.events = EPOLLIN | EPOLLET | EPOLLONESHOT;
ev.data.fd = pidfd;
if (epoll_ctl(epollfd, EPOLL_CTL_ADD, pidfd, &ev) != -1)
poll_count++;
--
GitLab

View File

@ -15,7 +15,7 @@ S="${WORKDIR}"/${PN}-ng-${PV}
# See bug #913210
LICENSE="GPL-2+ LGPL-2+ LGPL-2.1+"
SLOT="0/0-ng"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
IUSE="elogind +kill modern-top +ncurses nls selinux static-libs skill systemd test unicode"
RESTRICT="!test? ( test )"

View File

@ -15,7 +15,7 @@ S="${WORKDIR}"/${PN}-ng-${PV}
# See bug #913210
LICENSE="GPL-2+ LGPL-2+ LGPL-2.1+"
SLOT="0/1-ng"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
IUSE="elogind +kill modern-top +ncurses nls selinux static-libs skill systemd test unicode"
RESTRICT="!test? ( test )"

View File

@ -0,0 +1,134 @@
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit autotools flag-o-matic multilib-minimal toolchain-funcs
DESCRIPTION="Standard informational utilities and process-handling tools"
HOMEPAGE="https://gitlab.com/procps-ng/procps"
# Per e.g. https://gitlab.com/procps-ng/procps/-/releases/v4.0.5, the dist tarballs
# are still hosted on SF.
SRC_URI="https://downloads.sourceforge.net/${PN}-ng/${PN}-ng-${PV}.tar.xz"
S="${WORKDIR}"/${PN}-ng-${PV}
# See bug #913210
LICENSE="GPL-2+ LGPL-2+ LGPL-2.1+"
SLOT="0/1-ng"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
IUSE="elogind +kill modern-top +ncurses nls selinux static-libs skill systemd test unicode"
RESTRICT="!test? ( test )"
DEPEND="
elogind? ( sys-auth/elogind )
elibc_musl? ( sys-libs/error-standalone )
ncurses? ( >=sys-libs/ncurses-5.7-r7:=[unicode(+)?] )
selinux? ( sys-libs/libselinux[${MULTILIB_USEDEP}] )
systemd? ( sys-apps/systemd[${MULTILIB_USEDEP}] )
"
RDEPEND="
${DEPEND}
!<app-i18n/man-pages-l10n-4.2.0-r1
!<app-i18n/man-pages-de-2.12-r1
!<app-i18n/man-pages-pl-0.7-r1
!<app-i18n/man-pages-zh_CN-1.6.4.2
kill? (
!sys-apps/coreutils[kill]
!sys-apps/util-linux[kill]
)
"
BDEPEND="
elogind? ( virtual/pkgconfig )
elibc_musl? ( virtual/pkgconfig )
ncurses? ( virtual/pkgconfig )
systemd? ( virtual/pkgconfig )
test? ( dev-util/dejagnu )
"
# bug #898830
QA_CONFIG_IMPL_DECL_SKIP=( makedev )
PATCHES=(
"${FILESDIR}"/${PN}-4.0.4-xfail-pmap-test.patch
"${FILESDIR}"/${PN}-4.0.5-sysctl-manpage.patch # bug #565304
"${FILESDIR}"/${PN}-4.0.5-fix-tests-multilib.patch
"${FILESDIR}"/${PN}-4.0.5-top-legacy-config-vuln.patch # bug #958286
"${FILESDIR}"/${PN}-4.0.5-macos.patch
"${FILESDIR}"/${PN}-4.0.5-pgrep-old-linux-headers.patch # bug #911375
"${FILESDIR}"/${PN}-4.0.5-pidwait-half.patch # bug #959706
"${FILESDIR}"/${PN}-4.0.5-pgrep-pidwait.patch
)
src_prepare() {
default
# Only needed for fix-tests-multilib.patch and pgrep-old-linux-headers.patch
eautoreconf
}
multilib_src_configure() {
# http://www.freelists.org/post/procps/PATCH-enable-transparent-large-file-support
# bug #471102
append-lfs-flags
# Workaround for bug #947680, can be dropped w/ >4.0.5
if use elibc_musl ; then
append-cflags "$($(tc-getPKG_CONFIG) --cflags error-standalone)"
append-libs "$($(tc-getPKG_CONFIG) --libs error-standalone)"
fi
local myeconfargs=(
# No elogind multilib support
$(multilib_native_use_with elogind)
$(multilib_native_use_enable kill)
$(multilib_native_use_enable modern-top)
$(multilib_native_enable pidof)
$(multilib_native_enable pidwait)
$(multilib_native_use_with ncurses)
# bug #794997
$(multilib_native_use_enable !elibc_musl w)
$(use_enable nls)
$(use_enable selinux libselinux)
$(use_enable static-libs static)
$(use_with systemd)
$(use_enable skill)
)
if use ncurses; then
# Only pass whis when we are building the 'watch' command
myeconfargs+=( $(multilib_native_use_enable unicode watch8bit) )
fi
ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
}
multilib_src_test() {
local ps="${BUILD_DIR}/src/ps/pscommand"
if [[ $("${ps}" --no-headers -o cls -q $$) == IDL ]]; then
# bug #708230
ewarn "Skipping tests due to SCHED_IDLE"
else
# bug #461302
emake check </dev/null
fi
}
multilib_src_install() {
default
dodoc "${S}"/sysctl.conf
if multilib_is_native_abi; then
# We keep ps and kill in /bin per bug #565304.
dodir /bin
mv "${ED}"/usr/bin/ps "${ED}"/bin/ || die
if use kill; then
mv "${ED}"/usr/bin/kill "${ED}"/bin/ || die
fi
fi
}
multilib_src_install_all() {
einstalldocs
find "${ED}" -type f -name '*.la' -delete || die
}