Compare commits
1 Commits
Author | SHA256 | Date | |
---|---|---|---|
19ee3e065f |
@@ -67,10 +67,10 @@ index 723cf02..3599fea 100644
|
|||||||
+AC_CHECK_FUNC([name_to_handle_at],[
|
+AC_CHECK_FUNC([name_to_handle_at],[
|
||||||
+ AC_DEFINE([HAS_NAME_TO_HANDLE_AT], [1], [System has name_to_handle_at(2) system call])])
|
+ AC_DEFINE([HAS_NAME_TO_HANDLE_AT], [1], [System has name_to_handle_at(2) system call])])
|
||||||
+
|
+
|
||||||
|
AC_CHECK_HEADERS([sys/syscall.h])
|
||||||
AC_CHECK_DECLS([SYS_statx],
|
AC_CHECK_DECLS([SYS_statx],
|
||||||
[has_syscall_statx="yes"],
|
[has_syscall_statx="yes"],
|
||||||
[has_syscall_statx="no"],
|
@@ -105,9 +119,9 @@ AC_SUBST([TERMCAP_LIB])
|
||||||
@@ -112,9 +126,9 @@ AC_SUBST([TERMCAP_LIB])
|
|
||||||
|
|
||||||
dnl Checks for header files.
|
dnl Checks for header files.
|
||||||
AC_HEADER_DIRENT
|
AC_HEADER_DIRENT
|
||||||
@@ -482,7 +482,7 @@ index f2bd3e9..8e4c853 100644
|
|||||||
- if (statn(filepath, STATX_INO, &st) != 0)
|
- if (statn(filepath, STATX_INO, &st) != 0)
|
||||||
+ if (statn(filepath, STATX_INO, &st) != 0)
|
+ if (statn(filepath, STATX_INO, &st) != 0)
|
||||||
{
|
{
|
||||||
if (errno != ENOENT && errno != ENOTDIR && errno != EACCES)
|
if (errno != ENOENT && errno != ENOTDIR)
|
||||||
{
|
{
|
||||||
@@ -1651,6 +1784,9 @@ static void check_dir(
|
@@ -1651,6 +1784,9 @@ static void check_dir(
|
||||||
filepath, strerror(errno));
|
filepath, strerror(errno));
|
||||||
@@ -1123,7 +1123,7 @@ index f2bd3e9..8e4c853 100644
|
|||||||
/*
|
/*
|
||||||
* Somehow the realpath(3) glibc function call, nevertheless
|
* Somehow the realpath(3) glibc function call, nevertheless
|
||||||
* it avoids lstat(2) system calls.
|
* it avoids lstat(2) system calls.
|
||||||
@@ -2211,6 +2770,52 @@ char *expandpath(
|
@@ -2215,6 +2774,52 @@ char *expandpath(
|
||||||
}
|
}
|
||||||
lnkbuf[n] = '\0'; /* Don't be fooled by readlink(2) */
|
lnkbuf[n] = '\0'; /* Don't be fooled by readlink(2) */
|
||||||
|
|
||||||
|
@@ -1,160 +0,0 @@
|
|||||||
From a146bfc359a4d4d96c438f3a0fa988c6a171d40d Mon Sep 17 00:00:00 2001
|
|
||||||
From: Craig Small <csmall@dropbear.xyz>
|
|
||||||
Date: Wed, 13 Mar 2024 22:01:07 +1100
|
|
||||||
Subject: [PATCH] killall,pstree use clock_gettime not uptime
|
|
||||||
|
|
||||||
/proc/uptime can become a container uptime in LXC containers
|
|
||||||
but the process start time is still relative to the boot time.
|
|
||||||
|
|
||||||
This means things like "newer than" or "older than" will be incorrect
|
|
||||||
in some containers, using clock_gettime() fixes this as its always the
|
|
||||||
hosts boot time.
|
|
||||||
|
|
||||||
References:
|
|
||||||
https://bugs.debian.org/1066090
|
|
||||||
https://gitlab.com/procps-ng/procps/-/commit/b5e19c1730bcc68d553f44b5585704e3c92267bf#83c45d853acc8384452b404946e4a0c484b16a4e
|
|
||||||
|
|
||||||
Signed-off-by: Craig Small <csmall@dropbear.xyz>
|
|
||||||
---
|
|
||||||
ChangeLog | 4 ++++
|
|
||||||
src/killall.c | 39 +++++++++++++++++++--------------------
|
|
||||||
src/pstree.c | 39 +++++++++++++++++++--------------------
|
|
||||||
3 files changed, 42 insertions(+), 40 deletions(-)
|
|
||||||
|
|
||||||
diff --git ChangeLog ChangeLog
|
|
||||||
index 15c5725..f4dcfd2 100644
|
|
||||||
--- ChangeLog
|
|
||||||
+++ ChangeLog
|
|
||||||
@@ -1,3 +1,7 @@
|
|
||||||
+Changes in NEXT
|
|
||||||
+===============
|
|
||||||
+ * killall,pstree: Use gettime instead of uptime Debian 1066090
|
|
||||||
+
|
|
||||||
Changes in 23.7
|
|
||||||
===============
|
|
||||||
* build-sys: Make disable-statx work
|
|
||||||
diff --git src/killall.c src/killall.c
|
|
||||||
index 81dcc4b..229e61c 100644
|
|
||||||
--- src/killall.c
|
|
||||||
+++ src/killall.c
|
|
||||||
@@ -45,6 +45,7 @@
|
|
||||||
#include <regex.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <assert.h>
|
|
||||||
+#include <time.h>
|
|
||||||
|
|
||||||
#ifdef WITH_SELINUX
|
|
||||||
#include <dlfcn.h>
|
|
||||||
@@ -132,30 +133,28 @@ ask (char *name, pid_t pid, const int signal)
|
|
||||||
/* Never should get here */
|
|
||||||
}
|
|
||||||
|
|
||||||
-static double
|
|
||||||
-uptime()
|
|
||||||
-{
|
|
||||||
- char * savelocale;
|
|
||||||
- char buf[2048];
|
|
||||||
- FILE* file;
|
|
||||||
- if (!(file=fopen( PROC_BASE "/uptime", "r"))) {
|
|
||||||
- fprintf(stderr, "killall: error opening uptime file\n");
|
|
||||||
- exit(1);
|
|
||||||
- }
|
|
||||||
- savelocale = setlocale(LC_NUMERIC,"C");
|
|
||||||
- if (fscanf(file, "%2047s", buf) == EOF) perror("uptime");
|
|
||||||
- fclose(file);
|
|
||||||
- setlocale(LC_NUMERIC,savelocale);
|
|
||||||
- return atof(buf);
|
|
||||||
-}
|
|
||||||
|
|
||||||
-/* process age from jiffies to seconds via uptime */
|
|
||||||
+/* process age from jiffies to seconds via uptime
|
|
||||||
+ * Cannot use /proc/uptime as this can change in containers
|
|
||||||
+ * but process start time does not
|
|
||||||
+ */
|
|
||||||
static double process_age(const unsigned long long jf)
|
|
||||||
{
|
|
||||||
+ struct timespec ts;
|
|
||||||
+ double sc_clk_tck;
|
|
||||||
double age;
|
|
||||||
- double sc_clk_tck = sysconf(_SC_CLK_TCK);
|
|
||||||
- assert(sc_clk_tck > 0);
|
|
||||||
- age = uptime() - jf / sc_clk_tck;
|
|
||||||
+
|
|
||||||
+ if (clock_gettime(CLOCK_BOOTTIME, &ts) != 0) {
|
|
||||||
+ perror("clock_gettime():");
|
|
||||||
+ exit(EXIT_FAILURE);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if ( (sc_clk_tck = sysconf(_SC_CLK_TCK)) < 0) {
|
|
||||||
+ perror("sysconf(CLK_TCK):");
|
|
||||||
+ exit(EXIT_FAILURE);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ age = (ts.tv_sec + ts.tv_nsec * 1.0e-9) - jf / sc_clk_tck;
|
|
||||||
if (age < 0L)
|
|
||||||
return 0L;
|
|
||||||
return age;
|
|
||||||
diff --git src/pstree.c src/pstree.c
|
|
||||||
index 39265d1..2545e24 100644
|
|
||||||
--- src/pstree.c
|
|
||||||
+++ src/pstree.c
|
|
||||||
@@ -44,6 +44,7 @@
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <limits.h>
|
|
||||||
#include <locale.h>
|
|
||||||
+#include <time.h>
|
|
||||||
|
|
||||||
#include "i18n.h"
|
|
||||||
#include "comm.h"
|
|
||||||
@@ -1028,30 +1029,28 @@ static void trim_tree_by_parent(PROC * current)
|
|
||||||
trim_tree_by_parent(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
-static double
|
|
||||||
-uptime()
|
|
||||||
-{
|
|
||||||
- char * savelocale;
|
|
||||||
- char buf[2048];
|
|
||||||
- FILE* file;
|
|
||||||
- if (!(file=fopen( PROC_BASE "/uptime", "r"))) {
|
|
||||||
- fprintf(stderr, "pstree: error opening uptime file\n");
|
|
||||||
- exit(1);
|
|
||||||
- }
|
|
||||||
- savelocale = setlocale(LC_NUMERIC,"C");
|
|
||||||
- if (fscanf(file, "%2047s", buf) == EOF) perror("uptime");
|
|
||||||
- fclose(file);
|
|
||||||
- setlocale(LC_NUMERIC,savelocale);
|
|
||||||
- return atof(buf);
|
|
||||||
-}
|
|
||||||
|
|
||||||
-/* process age from jiffies to seconds via uptime */
|
|
||||||
+/* process age from jiffies to seconds via uptime
|
|
||||||
+ * Cannot use /proc/uptime as this can change in containers
|
|
||||||
+ * but process start time does not
|
|
||||||
+ */
|
|
||||||
static double process_age(const unsigned long long jf)
|
|
||||||
{
|
|
||||||
+ struct timespec ts;
|
|
||||||
+ double sc_clk_tck;
|
|
||||||
double age;
|
|
||||||
- double sc_clk_tck = sysconf(_SC_CLK_TCK);
|
|
||||||
- assert(sc_clk_tck > 0);
|
|
||||||
- age = uptime() - jf / sc_clk_tck;
|
|
||||||
+
|
|
||||||
+ if (clock_gettime(CLOCK_BOOTTIME, &ts) != 0) {
|
|
||||||
+ perror("clock_gettime():");
|
|
||||||
+ exit(EXIT_FAILURE);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if ( (sc_clk_tck = sysconf(_SC_CLK_TCK)) < 0) {
|
|
||||||
+ perror("sysconf(CLK_TCK):");
|
|
||||||
+ exit(EXIT_FAILURE);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ age = (ts.tv_sec + ts.tv_nsec * 1.0e-9) - jf / sc_clk_tck;
|
|
||||||
if (age < 0L)
|
|
||||||
return 0L;
|
|
||||||
return age;
|
|
||||||
--
|
|
||||||
2.35.3
|
|
||||||
|
|
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
--- src/pstree.c
|
--- src/pstree.c
|
||||||
+++ src/pstree.c 2022-12-13 07:46:58.243076344 +0000
|
+++ src/pstree.c 2022-12-13 07:46:58.243076344 +0000
|
||||||
@@ -81,6 +81,7 @@ extern const char *__progname;
|
@@ -79,6 +79,7 @@ extern const char *__progname;
|
||||||
#define UTF_HD "\342\224\254" /* U+252C, Horizontal and down */
|
#define UTF_HD "\342\224\254" /* U+252C, Horizontal and down */
|
||||||
|
|
||||||
#define VT_BEG "\033(0\017" /* use graphic chars */
|
#define VT_BEG "\033(0\017" /* use graphic chars */
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
#define VT_END "\033(B" /* back to normal char set */
|
#define VT_END "\033(B" /* back to normal char set */
|
||||||
#define VT_V "x" /* see UTF definitions above */
|
#define VT_V "x" /* see UTF definitions above */
|
||||||
#define VT_VR "t"
|
#define VT_VR "t"
|
||||||
@@ -594,6 +595,28 @@ static void out_scontext(const PROC *cur
|
@@ -578,6 +579,28 @@ static void out_scontext(const PROC *cur
|
||||||
out_string("'");
|
out_string("'");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
static void out_newline(void)
|
static void out_newline(void)
|
||||||
{
|
{
|
||||||
if (last_char && cur_x == output_width)
|
if (last_char && cur_x == output_width)
|
||||||
@@ -833,11 +856,12 @@ dump_tree(PROC * current, int level, int
|
@@ -817,11 +840,12 @@ dump_tree(PROC * current, int level, int
|
||||||
for (lvl = 0; lvl < level; lvl++) {
|
for (lvl = 0; lvl < level; lvl++) {
|
||||||
for (i = width[lvl] + 1; i; i--)
|
for (i = width[lvl] + 1; i; i--)
|
||||||
out_char(' ');
|
out_char(' ');
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (rep < 2)
|
if (rep < 2)
|
||||||
@@ -947,7 +971,7 @@ dump_tree(PROC * current, int level, int
|
@@ -931,7 +955,7 @@ dump_tree(PROC * current, int level, int
|
||||||
}
|
}
|
||||||
width[level] = comm_len + cur_x - offset + add;
|
width[level] = comm_len + cur_x - offset + add;
|
||||||
if (cur_x >= output_width && trunc) {
|
if (cur_x >= output_width && trunc) {
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
out_string("+");
|
out_string("+");
|
||||||
out_newline();
|
out_newline();
|
||||||
return;
|
return;
|
||||||
@@ -971,7 +995,7 @@ dump_tree(PROC * current, int level, int
|
@@ -955,7 +979,7 @@ dump_tree(PROC * current, int level, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (first) {
|
if (first) {
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
--- configure.ac
|
--- configure.ac
|
||||||
+++ configure.ac 2022-12-13 07:57:11.751636898 +0000
|
+++ configure.ac 2022-12-13 07:57:11.751636898 +0000
|
||||||
@@ -169,7 +169,7 @@ AC_CHECK_MEMBERS([struct user_regs_struc
|
@@ -162,7 +162,7 @@ AC_CHECK_MEMBERS([struct user_regs_struc
|
||||||
struct user_regs_struct.rdi,
|
struct user_regs_struct.rdi,
|
||||||
struct user_regs_struct.rsi,
|
struct user_regs_struct.rsi,
|
||||||
struct user_regs_struct.rdx], [],[],
|
struct user_regs_struct.rdx], [],[],
|
BIN
psmisc-v23.6.tar.bz2
(Stored with Git LFS)
Normal file
BIN
psmisc-v23.6.tar.bz2
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
psmisc-v23.7.tar.bz2
(Stored with Git LFS)
BIN
psmisc-v23.7.tar.bz2
(Stored with Git LFS)
Binary file not shown.
@@ -1,40 +1,3 @@
|
|||||||
-------------------------------------------------------------------
|
|
||||||
Tue Feb 18 12:04:10 UTC 2025 - Dr. Werner Fink <werner@suse.de>
|
|
||||||
|
|
||||||
- Looks like Factory and TW includes glibc-gconv-modules-extra at build time
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
|
||||||
Thu Dec 5 12:30:55 UTC 2024 - Adrian Schröter <adrian@suse.de>
|
|
||||||
|
|
||||||
- add loongarch64 as peekfd supported arch
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
|
||||||
Mon May 27 11:55:43 UTC 2024 - Dr. Werner Fink <werner@suse.de>
|
|
||||||
|
|
||||||
- Update to 23.7
|
|
||||||
* build-sys: Make disable-statx work
|
|
||||||
* fuser: Fallback to stat() if no statx() Debian 1030747 #48
|
|
||||||
* fuser: silently ignore EACCES when scanning proc directories
|
|
||||||
* killall: small formatting fixes Debian #1037231
|
|
||||||
* pstree: Do not assume root PID #49
|
|
||||||
* pslog: include config.h #51 !36
|
|
||||||
* misc: Update gettext to 0.21
|
|
||||||
- Add patch from upstream 0001-killall,pstree-use-clock_gettime-not-uptime.patch
|
|
||||||
- Port the patches
|
|
||||||
* 0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch
|
|
||||||
* psmisc-22.21-pstree.patch
|
|
||||||
- Port patch psmisc-v23.6.dif and rename it to psmisc-v23.7.dif
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
|
||||||
Thu Feb 29 15:01:09 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>
|
|
||||||
|
|
||||||
- Use %patch -P N instead of deprecated %patchN.
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
|
||||||
Mon Oct 23 13:36:04 UTC 2023 - Dr. Werner Fink <werner@suse.de>
|
|
||||||
|
|
||||||
- Fix version at configure time as there was no .tarball-version
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Feb 16 16:06:59 UTC 2023 - Ludwig Nussel <lnussel@suse.de>
|
Thu Feb 16 16:06:59 UTC 2023 - Ludwig Nussel <lnussel@suse.de>
|
||||||
|
|
||||||
|
15
psmisc.spec
15
psmisc.spec
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package psmisc
|
# spec file for package psmisc
|
||||||
#
|
#
|
||||||
# Copyright (c) 2025 SUSE LLC
|
# Copyright (c) 2023 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@@ -33,7 +33,7 @@ BuildRequires: netcat-openbsd
|
|||||||
BuildRequires: pkgconfig(libapparmor)
|
BuildRequires: pkgconfig(libapparmor)
|
||||||
%endif
|
%endif
|
||||||
URL: https://gitlab.com/psmisc/psmisc/
|
URL: https://gitlab.com/psmisc/psmisc/
|
||||||
Version: 23.7
|
Version: 23.6
|
||||||
Release: 0
|
Release: 0
|
||||||
Provides: ps:/usr/bin/killall
|
Provides: ps:/usr/bin/killall
|
||||||
Summary: Utilities for managing processes on your system
|
Summary: Utilities for managing processes on your system
|
||||||
@@ -41,13 +41,12 @@ License: GPL-2.0-or-later
|
|||||||
Group: System/Monitoring
|
Group: System/Monitoring
|
||||||
Source: https://gitlab.com/%{name}/%{name}/-/archive/v%{version}/%{name}-v%{version}.tar.bz2
|
Source: https://gitlab.com/%{name}/%{name}/-/archive/v%{version}/%{name}-v%{version}.tar.bz2
|
||||||
Patch0: %{name}-v%{version}.dif
|
Patch0: %{name}-v%{version}.dif
|
||||||
Patch1: 0001-killall,pstree-use-clock_gettime-not-uptime.patch
|
|
||||||
Patch2: %{name}-22.21-pstree.patch
|
Patch2: %{name}-22.21-pstree.patch
|
||||||
# PATCH-ADD-SUSE boo#908068, boo#1046237, boo#1046237
|
# PATCH-ADD-SUSE boo#908068, boo#1046237, boo#1046237
|
||||||
# https://gitlab.com/bitstreamout/psmisc/tree/mountinfo
|
# https://gitlab.com/bitstreamout/psmisc/tree/mountinfo
|
||||||
Patch3: 0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch
|
Patch3: 0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch
|
||||||
|
|
||||||
%define have_peekfd %ix86 x86_64 ppc ppc64 ppc64le %arm mipsel m68k aarch64 loongarch64
|
%define have_peekfd %ix86 x86_64 ppc ppc64 ppc64le %arm mipsel m68k aarch64
|
||||||
|
|
||||||
%description
|
%description
|
||||||
The psmisc package contains utilities for managing processes on your
|
The psmisc package contains utilities for managing processes on your
|
||||||
@@ -61,10 +60,9 @@ processes that are using specified files or filesystems.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n %{name}-v%{version}
|
%setup -q -n %{name}-v%{version}
|
||||||
%patch -P 1 -p0 -b .uptime
|
%patch2 -p0 -b .pstree
|
||||||
%patch -P 2 -p0 -b .pstree
|
%patch3 -p0 -b .mntinf
|
||||||
%patch -P 3 -p0 -b .mntinf
|
%patch0 -p0 -b .p0
|
||||||
%patch -P 0 -p0 -b .p0
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
grep -h src/ po/*.po|\
|
grep -h src/ po/*.po|\
|
||||||
@@ -72,7 +70,6 @@ grep -h src/ po/*.po|\
|
|||||||
tr ' ' '\n'|\
|
tr ' ' '\n'|\
|
||||||
sort -t : -k1,1 -u|\
|
sort -t : -k1,1 -u|\
|
||||||
sed -r 's/:[0-9]+$//' > po/POTFILES.in
|
sed -r 's/:[0-9]+$//' > po/POTFILES.in
|
||||||
echo %version > .tarball-version
|
|
||||||
autoreconf -fi
|
autoreconf -fi
|
||||||
CFLAGS="-D_GNU_SOURCE -D_DEFAULT_SOURCE ${RPM_OPT_FLAGS} -pipe -fPIE"
|
CFLAGS="-D_GNU_SOURCE -D_DEFAULT_SOURCE ${RPM_OPT_FLAGS} -pipe -fPIE"
|
||||||
CXXFLAGS="$CFLAGS"
|
CXXFLAGS="$CFLAGS"
|
||||||
|
Reference in New Issue
Block a user