lxqt-session: Update procps-ng patches

Remove the old backported patch which has been merged in.  Add
a new backport that updates lxqt-session for procps-ng API changes.

Signed-off-by: Rob Woolley <rob.woolley@windriver.com>
This commit is contained in:
Rob Woolley
2025-03-04 07:25:13 -08:00
committed by Andreas Müller
parent a632c520d5
commit c1744b35df
3 changed files with 53 additions and 86 deletions

View File

@@ -14,7 +14,7 @@ DEPENDS += " \
"
SRC_URI += "file://0001-do-not-check-for-xdg-udser-dirs-at-build-time-it-is-.patch \
file://reaper-build-run-on-systems-with-procps-ng-4.0.0.patch"
file://adopt-api-changes-for-procps-ng.patch"
SRCREV = "b7c4029438091cecff0fe01ac0cb54b2f405ef80"
PV = "1.4.0"

View File

@@ -0,0 +1,52 @@
Upstream-Status: Backport
From 4e5d62200fceb75a7867005c29103aa502733270 Mon Sep 17 00:00:00 2001
From: Christian Hesse <mail@eworm.de>
Date: Mon, 23 Dec 2024 16:13:31 +0100
Subject: [PATCH] Adopt API changes for procps-ng 4.0.5 (#565)
The 'info' parameter was dropped in 'VAL' macros.
https://gitlab.com/procps-ng/procps/-/commit/967fdcfb06e20aad0f31073474cb94545c9bdea5
---
CMakeLists.txt | 3 +++
lxqt-session/src/procreaper.cpp | 8 ++++++++
2 files changed, 11 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 932f7894..855a35f9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,6 +40,9 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
message(STATUS "Using PROCPS -> ${PROCPS_MODULE_NAME} v${PROCPS_VERSION}")
if (PROCPS_VERSION VERSION_GREATER_EQUAL 4.0.0)
add_definitions("-DUSING_LIBPROC2")
+ if (PROCPS_VERSION VERSION_GREATER_EQUAL 4.0.5)
+ add_definitions("-DUSING_LIBPROC2_1")
+ endif()
endif()
endif()
diff --git a/lxqt-session/src/procreaper.cpp b/lxqt-session/src/procreaper.cpp
index ea614530..8069c606 100644
--- a/lxqt-session/src/procreaper.cpp
+++ b/lxqt-session/src/procreaper.cpp
@@ -121,10 +121,18 @@ void ProcReaper::stop(const std::set<int64_t> & excludedPids)
pids_stack * stack = nullptr;
while ((stack = procps_pids_get(info, PIDS_FETCH_TASKS_ONLY)))
{
+# if defined(USING_LIBPROC2_1)
+ const int ppid = PIDS_VAL(rel_ppid, s_int, stack);
+# else
const int ppid = PIDS_VAL(rel_ppid, s_int, stack, info);
+# endif
if (ppid == my_pid)
{
+# if defined(USING_LIBPROC2_1)
+ const int tgid = PIDS_VAL(rel_tgid, s_int, stack);
+# else
const int tgid = PIDS_VAL(rel_tgid, s_int, stack, info);
+# endif
children.push_back(tgid);
}
}

View File

@@ -1,85 +0,0 @@
The do_configure task for lxqt-session uses pkgconfig to find libprocps.
However, newer releases are named libprocps2. Allow either to be used.
Upstream-Status: Backport[https://github.com/lxqt/lxqt-session/commit/d1db1c791195f3c0cf148e2be8bd46c5a51ca535]
Signed-off-by: Rob Woolley <rob.woolley@windriver.com>
From d1db1c791195f3c0cf148e2be8bd46c5a51ca535 Mon Sep 17 00:00:00 2001
From: Palo Kisa <palo.kisa@gmail.com>
Date: Tue, 7 Mar 2023 14:21:40 +0100
Subject: [PATCH] reaper: Build/Run on systems with procps-ng >= 4.0.0 (#456)
On Linux, make it possible to use libproc2 or libprocps whichever is
available.
---
CMakeLists.txt | 6 +++++-
lxqt-session/src/procreaper.cpp | 24 +++++++++++++++++++++++-
2 files changed, 28 insertions(+), 2 deletions(-)
Index: git/CMakeLists.txt
===================================================================
--- git.orig/CMakeLists.txt
+++ git/CMakeLists.txt
@@ -35,7 +35,11 @@ find_package(X11 REQUIRED)
message(STATUS "Building with Qt${Qt5Core_VERSION}")
find_package(PkgConfig REQUIRED)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
- pkg_search_module(PROCPS REQUIRED libprocps)
+ pkg_search_module(PROCPS REQUIRED libproc2 libprocps)
+ message(STATUS "Using PROCPS -> ${PROCPS_MODULE_NAME} v${PROCPS_VERSION}")
+ if (PROCPS_VERSION VERSION_GREATER_EQUAL 4.0.0)
+ add_definitions("-DUSING_LIBPROC2")
+ endif()
endif()
Index: git/lxqt-session/src/procreaper.cpp
===================================================================
--- git.orig/lxqt-session/src/procreaper.cpp
+++ git/lxqt-session/src/procreaper.cpp
@@ -29,7 +29,11 @@
#include "log.h"
#if defined(Q_OS_LINUX)
#include <sys/prctl.h>
-#include <proc/readproc.h>
+# if defined(USING_LIBPROC2)
+# include <libproc2/pids.h>
+# else
+# include <proc/readproc.h>
+# endif
#elif defined(Q_OS_FREEBSD)
#include <sys/procctl.h>
#include <libutil.h>
@@ -109,6 +113,23 @@ void ProcReaper::stop(const std::set<int
const pid_t my_pid = ::getpid();
std::vector<pid_t> children;
#if defined(Q_OS_LINUX)
+# if defined(USING_LIBPROC2)
+ constexpr pids_item items[] = { PIDS_ID_PPID, PIDS_ID_TGID };
+ enum rel_items { rel_ppid, rel_tgid };
+ pids_info * info = nullptr;
+ procps_pids_new(&info, const_cast<pids_item *>(items), sizeof(items) / sizeof(pids_item));
+ pids_stack * stack = nullptr;
+ while ((stack = procps_pids_get(info, PIDS_FETCH_TASKS_ONLY)))
+ {
+ const int ppid = PIDS_VAL(rel_ppid, s_int, stack, info);
+ if (ppid == my_pid)
+ {
+ const int tgid = PIDS_VAL(rel_tgid, s_int, stack, info);
+ children.push_back(tgid);
+ }
+ }
+ procps_pids_unref(&info);
+# else
PROCTAB * proc_dir = ::openproc(PROC_FILLSTAT);
while (proc_t * proc = ::readproc(proc_dir, nullptr))
{
@@ -119,6 +140,7 @@ void ProcReaper::stop(const std::set<int
::freeproc(proc);
}
::closeproc(proc_dir);
+# endif
#elif defined(Q_OS_FREEBSD)
int cnt = 0;
if (kinfo_proc *proc_info = kinfo_getallproc(&cnt))