mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
gnu: lxqt-session: Fix handling of procps@4.
* gnu/packages/patches/lxqt-session-procps-4.patch: New file. * gnu/local.mk (dist_patch_DATA): Register patch. * gnu/packages/lxqt.cm (lxqt-session): Apply patch.
This commit is contained in:
parent
9665eb21a9
commit
3b2761fae5
3 changed files with 85 additions and 1 deletions
|
@ -1521,6 +1521,7 @@ dist_patch_DATA = \
|
|||
%D%/packages/patches/lua-5.4-liblua-so.patch \
|
||||
%D%/packages/patches/luit-posix.patch \
|
||||
%D%/packages/patches/lvm2-static-link.patch \
|
||||
%D%/packages/patches/lxqt-session-procps-4.patch \
|
||||
%D%/packages/patches/mailutils-variable-lookup.patch \
|
||||
%D%/packages/patches/make-impure-dirs.patch \
|
||||
%D%/packages/patches/mars-install.patch \
|
||||
|
|
|
@ -679,7 +679,8 @@ (define-public lxqt-session
|
|||
(uri (string-append "https://github.com/lxqt/" name "/releases/download/"
|
||||
version "/" name "-" version ".tar.xz"))
|
||||
(sha256
|
||||
(base32 "0rjw3rw6kpaa3csrga005qg5bxmdxfgrnn1qngs2nrny35v97ckl"))))
|
||||
(base32 "0rjw3rw6kpaa3csrga005qg5bxmdxfgrnn1qngs2nrny35v97ckl"))
|
||||
(patches (search-patches "lxqt-session-procps-4.patch"))))
|
||||
(build-system cmake-build-system)
|
||||
(inputs
|
||||
(list eudev
|
||||
|
|
82
gnu/packages/patches/lxqt-session-procps-4.patch
Normal file
82
gnu/packages/patches/lxqt-session-procps-4.patch
Normal file
|
@ -0,0 +1,82 @@
|
|||
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 978/978] 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(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index a3c5e0d..f208600 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/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()
|
||||
|
||||
# Please don't move, must be after lxqt
|
||||
diff --git a/lxqt-session/src/procreaper.cpp b/lxqt-session/src/procreaper.cpp
|
||||
index 2acd030..1ea4bdc 100644
|
||||
--- a/lxqt-session/src/procreaper.cpp
|
||||
+++ b/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<int64_t> & excludedPids)
|
||||
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<int64_t> & excludedPids)
|
||||
::freeproc(proc);
|
||||
}
|
||||
::closeproc(proc_dir);
|
||||
+# endif
|
||||
#elif defined(Q_OS_FREEBSD)
|
||||
int cnt = 0;
|
||||
if (kinfo_proc *proc_info = kinfo_getallproc(&cnt))
|
||||
--
|
||||
2.39.2
|
||||
|
Loading…
Reference in a new issue