Accepting request 1190400 from home:dimstar:Factory

- Switch to procps 4 branch, bsorbing the former procps4 package:
  + Add provides/obsoletes procps4: make zypper replace procps4
    with the main package for users that manually switched.

Do the final switch to procs4; the issues from 2022 (e.g. salt) should be
fixed.

OBS-URL: https://build.opensuse.org/request/show/1190400
OBS-URL: https://build.opensuse.org/package/show/Base:System/procps?expand=0&rev=254
This commit is contained in:
Dirk Mueller 2024-07-30 22:00:16 +00:00 committed by Git OBS Bridge
commit ad8ffc4215
42 changed files with 5048 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

176
79042e07.patch Normal file
View File

@ -0,0 +1,176 @@
From 79042e07fab9956135a21b1df7a69d1fbde7ef79 Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@dropbear.xyz>
Date: Tue, 12 Sep 2023 16:59:18 +1000
Subject: [PATCH] ps: Don't crash when using short option
ps would crash with the -si or -sf options with systemd enabled.
The issue was the utmp wasn't filled in, the long option checked, the
short option did not.
Refactored the showinfo() function so instead of a branch with duplicate
prints for the items in both long and short we just branch on the items
for long output.
Also, made the function prototypes not dependendent on systemd enabled,
it was too messy that way and passing a char* NULL is not really going
to hurt anything.
References:
#301
Signed-off-by: Craig Small <csmall@dropbear.xyz>
---
NEWS | 1 +
src/w.c | 61 ++++++++++++++++++++-------------------------------------
2 files changed, 22 insertions(+), 40 deletions(-)
|diff --git a/NEWS b/NEWS
|index 4ad9f74e..883f9139 100644
|--- a/NEWS
|+++ b/NEWS
|@@ -1,5 +1,6 @@
| procps-ng-NEXT
| ---------------
|+ * w: Don't segfault with -s option issue #301
|
| procps-ng-4.0.4
| ---------------
diff --git a/src/w.c b/src/w.c
index fd6e75f7..e2d754b5 100644
--- a/src/w.c
+++ b/src/w.c
@@ -207,9 +207,7 @@ static void print_display_or_interface(const char *restrict host, int len, int r
/* This routine prints either the hostname or the IP address of the remote */
static void print_from(
-#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
const char *session,
-#endif
const utmp_t *restrict const u, const int ip_addresses, const int fromlen) {
#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
if (session) {
@@ -508,11 +506,10 @@ static int find_best_proc(
#undef PIDS_GETSTR
}
+
static void showinfo(
-#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
const char *session, const char *name,
-#endif
- utmp_t * u, int formtype, int maxcmd, int from,
+ utmp_t * u, const int longform, int maxcmd, int from,
const int userlen, const int fromlen, const int ip_addresses,
const int pids)
{
@@ -575,25 +572,20 @@ static void showinfo(
/* force NUL term for printf */
uname[UT_NAMESIZE] = '\0';
- if (formtype) {
- printf("%-*.*s%-9.8s", userlen + 1, userlen, uname, tty + 5);
+ printf("%-*.*s%-9.8s", userlen + 1, userlen, uname, tty + 5);
+ if (from)
+ print_from(session, NULL, ip_addresses, fromlen);
+
+ /* login time */
+ if (longform) {
#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
if (session) {
uint64_t ltime;
- if (from)
- print_from(session, NULL, ip_addresses, fromlen);
-
sd_session_get_start_time(session, &ltime);
print_logintime(ltime/((uint64_t) 1000000ULL), stdout);
} else {
#endif
- if (from)
- print_from(
-#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
- NULL,
-#endif
- u, ip_addresses, fromlen);
#ifdef HAVE_UTMPX_H
print_logintime(u->ut_tv.tv_sec, stdout);
@@ -603,11 +595,16 @@ static void showinfo(
#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
}
#endif
- if (u && *u->ut_line == ':')
- /* idle unknown for xdm logins */
- printf(" ?xdm? ");
- else
- print_time_ival7(idletime(tty), 0, stdout);
+ }
+ /* idle */
+ if (u && *u->ut_line == ':')
+ /* idle unknown for xdm logins */
+ printf(" ?xdm? ");
+ else
+ print_time_ival7(idletime(tty), 0, stdout);
+
+ /* jpcpu/pcpu */
+ if (longform) {
print_time_ival7(jcpu / hertz, (jcpu % hertz) * (100. / hertz),
stdout);
if (pcpu > 0)
@@ -616,20 +613,8 @@ static void showinfo(
stdout);
else
printf(" ? ");
- } else {
- printf("%-*.*s%-9.8s", userlen + 1, userlen, uname, tty + 5);
- if (from)
- print_from(
-#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
- NULL,
-#endif
- u, ip_addresses, fromlen);
- if (u && *u->ut_line == ':')
- /* idle unknown for xdm logins */
- printf(" ?xdm? ");
- else
- print_time_ival7(idletime(tty), 0, stdout);
}
+ /* what */
if (pids) {
pid_t ut_pid = -1;
if (u)
@@ -798,9 +783,9 @@ int main(int argc, char **argv)
* headers. Try to keep alignment intact. */
printf(_("%-*s TTY "), userlen, _("USER"));
if (from)
- printf("%-*s", fromlen - 1, _("FROM"));
+ printf("%-*s", fromlen, _("FROM"));
if (longform)
- printf(_(" LOGIN@ IDLE JCPU PCPU WHAT\n"));
+ printf(_(" LOGIN@ IDLE JCPU PCPU WHAT\n"));
else
printf(_(" IDLE WHAT\n"));
}
@@ -857,9 +842,7 @@ int main(int argc, char **argv)
continue;
if (!strncmp(u->ut_user, user, UT_NAMESIZE))
showinfo(
-#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
NULL, NULL,
-#endif
u, longform, maxcmd, from, userlen,
fromlen, ip_addresses, pids);
}
@@ -876,9 +859,7 @@ int main(int argc, char **argv)
continue;
if (*u->ut_user)
showinfo(
-#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
NULL, NULL,
-#endif
u, longform, maxcmd, from, userlen,
fromlen, ip_addresses, pids);
}
--
GitLab

102
CVE-2023-4016.patch Normal file
View File

@ -0,0 +1,102 @@
From 2c933ecba3bb1d3041a5a7a53a7b4078a6003413 Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@dropbear.xyz>
Date: Thu, 10 Aug 2023 21:18:38 +1000
Subject: [PATCH] ps: Fix possible buffer overflow in -C option
ps allocates memory using malloc(length of arg * len of struct).
In certain strange circumstances, the arg length could be very large
and the multiplecation will overflow, allocating a small amount of
memory.
Subsequent strncpy() will then write into unallocated memory.
The fix is to use calloc. It's slower but this is a one-time
allocation. Other malloc(x * y) calls have also been replaced
by calloc(x, y)
References:
https://www.freelists.org/post/procps/ps-buffer-overflow-CVE-20234016
https://nvd.nist.gov/vuln/detail/CVE-2023-4016
https://gitlab.com/procps-ng/procps/-/issues/297
https://bugs.debian.org/1042887
Signed-off-by: Craig Small <csmall@dropbear.xyz>
---
ps/parser.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
--- ps/parser.c
+++ ps/parser.c 2023-08-15 12:19:13.375422122 +0000
@@ -183,8 +183,7 @@ static const char *parse_list(const char
int need_item;
const char *err; /* error code that could or did happen */
/*** prepare to operate ***/
- node = malloc(sizeof(selection_node));
- node->u = malloc(strlen(arg)*sizeof(sel_union)); /* waste is insignificant */
+ node = xmalloc(sizeof(selection_node));
node->n = 0;
buf = strdup(arg);
/*** sanity check and count items ***/
@@ -205,6 +204,7 @@ static const char *parse_list(const char
} while (*++walk);
if(need_item) goto parse_error;
node->n = items;
+ node->u = xcalloc(items*sizeof(sel_union));
/*** actually parse the list ***/
walk = buf;
while(items--){
@@ -569,8 +569,8 @@ static const char *parse_bsd_option(void
/* put our tty on a tiny list */
{
selection_node *node;
- node = malloc(sizeof(selection_node));
- node->u = malloc(sizeof(sel_union));
+ node = xmalloc(sizeof(selection_node));
+ node->u = xmalloc(sizeof(sel_union));
node->u[0].tty = cached_tty;
node->typecode = SEL_TTY;
node->n = 1;
@@ -706,8 +706,8 @@ static const char *parse_bsd_option(void
if(!arg){
/* Wow, obsolete BSD syntax. Put our tty on a tiny list. */
selection_node *node;
- node = malloc(sizeof(selection_node));
- node->u = malloc(sizeof(sel_union));
+ node = xmalloc(sizeof(selection_node));
+ node->u = xmalloc(sizeof(sel_union));
node->u[0].tty = cached_tty;
node->typecode = SEL_TTY;
node->n = 1;
@@ -1030,16 +1030,16 @@ static const char *parse_trailing_pids(v
argp = ps_argv + thisarg;
thisarg = ps_argc - 1; /* we must be at the end now */
- pidnode = malloc(sizeof(selection_node));
- pidnode->u = malloc(i*sizeof(sel_union)); /* waste is insignificant */
+ pidnode = xmalloc(sizeof(selection_node));
+ pidnode->u = xcalloc(i*sizeof(sel_union)); /* waste is insignificant */
pidnode->n = 0;
- grpnode = malloc(sizeof(selection_node));
- grpnode->u = malloc(i*sizeof(sel_union)); /* waste is insignificant */
+ grpnode = xmalloc(sizeof(selection_node));
+ grpnode->u = xcalloc(i*sizeof(sel_union)); /* waste is insignificant */
grpnode->n = 0;
- sidnode = malloc(sizeof(selection_node));
- sidnode->u = malloc(i*sizeof(sel_union)); /* waste is insignificant */
+ sidnode = xmalloc(sizeof(selection_node));
+ sidnode->u = xcalloc(i*sizeof(sel_union)); /* waste is insignificant */
sidnode->n = 0;
while(i--){
--- proc/libprocps.sym
+++ proc/libprocps.sym 2023-08-15 12:43:18.905661726 +0000
@@ -67,6 +67,8 @@ global:
unix_print_signals;
uptime;
xalloc_err_handler;
+ xcalloc;
+ xmalloc;
local:
*;
};

33
bsc1195468-23da4f40.patch Normal file
View File

@ -0,0 +1,33 @@
From 23da4f40ea27afe998e92ca317f2dcb48a6ffc1f Mon Sep 17 00:00:00 2001
From: Tommi Rantala <tommi.t.rantala@nokia.com>
Date: Mon, 11 Oct 2021 13:33:18 +0300
Subject: [PATCH] ps: ignore SIGURG
Stop registering signal handler for SIGURG, to avoid ps failure if
someone sends such signal. Without the signal handler, SIGURG will
just be ignored.
Signal 23 (URG) caught by ps (3.3.16).
ps:ps/display.c:66: please report this bug
https://man7.org/linux/man-pages/man7/signal.7.html
https://www.freebsd.org/cgi/man.cgi?sektion=3&query=signal
---
ps/display.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/ps/display.c b/ps/display.c
index 04803c3b..346e21a7 100644
--- a/ps/display.c
+++ b/ps/display.c
@@ -673,6 +673,7 @@ int main(int argc, char *argv[]){
case SIGKILL: /* can not catch */
case SIGSTOP: /* can not catch */
case SIGWINCH: /* don't care if window size changes */
+ case SIGURG: /* Urgent condition on socket (4.2BSD) */
;
}
} while (0);
--
GitLab

View File

@ -0,0 +1,45 @@
From 3dd1661a3d91671ca6c977c2e514f47d807be79d Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@dropbear.xyz>
Date: Mon, 29 Mar 2021 22:11:27 +1100
Subject: [PATCH] docs: psr ps field is last run processor
The ps.1 manpage incorrectly stated that psr field showed the
processor the process was assigned to. However if the assignment
has changed but the process has not run, then the field doesn't
change.
Some digging by @srikard showed it wasn't the processor assigned
but the last one it was run on. The man page now correctly
describes psr in that way.
References:
procps-ng/procps#187
---
ps/ps.1 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git ps/ps.1 ps/ps.1
index 8678123..b433655 100644
--- ps/ps.1
+++ ps/ps.1
|@@ -4,7 +4,7 @@
| .\" Quick hack conversion by Albert Cahalan, 1998.
| .\" Licensed under version 2 of the Gnu General Public License.
| .\"
|-.TH PS "1" "2021-03-05" "procps-ng" "User Commands"
|+.TH PS "1" "2021-03-29" "procps-ng" "User Commands"
| .\"
| .\" To render this page:
| .\" groff -t -b -man -X -P-resolution -P100 -Tps ps.1 &
@@ -1518,7 +1518,7 @@ priority of the process. Higher number means lower priority.
T}
psr PSR T{
-processor that process is currently assigned to.
+processor that process last executed on.
T}
rgid RGID T{
--
2.26.2

View File

@ -0,0 +1,11 @@
--- procps-3.3.17/sysctl.c.old 2021-02-09 11:11:25.000000000 +0100
+++ procps-3.3.17/sysctl.c 2023-12-14 13:56:36.785976315 +0100
@@ -546,6 +546,8 @@
fp = (globbuf.gl_pathv[j][0] == '-' && !globbuf.gl_pathv[j][1])
? stdin : fopen(globbuf.gl_pathv[j], "r");
if (!fp) {
+ if (strcmp ("/usr/lib/sysctl.d/99-sysctl.conf", globbuf.gl_pathv[j]) == 0)
+ continue;
xwarn(_("cannot open \"%s\""), globbuf.gl_pathv[j]);
rc = -1;
goto out;

View File

@ -0,0 +1,41 @@
---
free.1 | 2 +-
proc/sysinfo.c | 9 +++++----
2 files changed, 6 insertions(+), 5 deletions(-)
--- free.1
+++ free.1 2022-12-15 09:40:32.807087343 +0000
@@ -19,7 +19,7 @@ columns are:
Total installed memory (MemTotal and SwapTotal in /proc/meminfo)
.TP
\fBused\fR
-Used memory (calculated as \fBtotal\fR - \fBfree\fR - \fBbuffers\fR - \fBcache\fR)
+Used memory (calculated as \fBtotal\fR - \fBavailable\fR)
.TP
\fBfree\fR
Unused memory (MemFree and SwapFree in /proc/meminfo)
--- proc/sysinfo.c
+++ proc/sysinfo.c 2022-06-22 11:29:39.240066488 +0000
@@ -794,10 +794,6 @@ nextline:
where such values will be dramatically distorted over those of the host. */
if (kb_main_available > kb_main_total)
kb_main_available = kb_main_free;
- mem_used = kb_main_total - kb_main_free - kb_main_cached - kb_main_buffers;
- if (mem_used < 0)
- mem_used = kb_main_total - kb_main_free;
- kb_main_used = (unsigned long)mem_used;
/* zero? might need fallback for 2.6.27 <= kernel <? 3.14 */
if (!kb_main_available) {
@@ -821,6 +817,11 @@ nextline:
kb_main_available = kb_main_free;
#endif /* linux */
}
+
+ mem_used = kb_main_total - kb_main_available;
+ if (mem_used < 0)
+ mem_used = kb_main_total - kb_main_free;
+ kb_main_used = (unsigned long)mem_used;
}
/*****************************************************************/

View File

@ -0,0 +1,37 @@
---
top/top.1 | 4 ++--
top/top.c | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)
--- top/top.1
+++ top/top.1 2022-06-22 12:05:55.572154830 +0000
@@ -565,8 +565,8 @@ visual graphs of those representations.
In the case of \*(MP, the percentage represents the \fBtotal\fR minus the estimated
\fBavail\fR noted above.
-The `Mem' graph itself is divided between \fBused\fR and any remaining memory not
-otherwise accounted for by \fBavail\fR.
+The `Mem' graph itself is divided between the non-cached portion of \fBused\fR and
+any remaining memory not otherwise accounted for by \fBavail\fR.
\*(XT 4b. SUMMARY AREA Commands and the `m' command for additional information
on that special 4-way toggle.
--- top/top.c
+++ top/top.c 2022-06-22 12:03:17.911044097 +0000
@@ -6086,12 +6086,14 @@ numa_nope:
char used[SMLBUFSIZ], util[SMLBUFSIZ], dual[MEDBUFSIZ];
float pct_used, pct_misc, pct_swap;
int ix, num_used, num_misc;
+ unsigned long my_ulong;
- pct_used = (float)kb_main_used * (100.0 / (float)kb_main_total);
+ my_ulong = kb_main_total - kb_main_buffers - kb_main_cached - kb_main_free;
+ pct_used = (float)my_ulong * (100.0 / (float)kb_main_total);
#ifdef MEMGRAPH_OLD
pct_misc = (float)(kb_main_buffers + kb_main_cached) * (100.0 / (float)kb_main_total);
#else
- pct_misc = (float)(kb_main_total - kb_main_available - kb_main_used) * (100.0 / (float)kb_main_total);
+ pct_misc = (float)(kb_main_total - kb_main_available - my_ulong) * (100.0 / (float)kb_main_total);
#endif
if (pct_used + pct_misc > 100.0 || pct_misc < 0) pct_misc = 0;
pct_swap = kb_swap_total ? (float)kb_swap_used * (100.0 / (float)kb_swap_total) : 0;

View File

@ -0,0 +1,61 @@
---
proc/libprocps.sym | 1 +
proc/sysinfo.c | 13 +++++++++++--
proc/sysinfo.h | 2 ++
3 files changed, 14 insertions(+), 2 deletions(-)
--- proc/libprocps.sym
+++ proc/libprocps.sym 2018-04-04 11:30:51.841725161 +0000
@@ -60,6 +60,7 @@ global:
signal_name_to_number;
signal_number_to_name;
smp_num_cpus;
+ __smp_num_cpus;
sprint_uptime;
strtosig;
tty_to_dev;
--- proc/sysinfo.c
+++ proc/sysinfo.c 2018-04-04 11:33:26.306886237 +0000
@@ -47,7 +47,8 @@
#endif
#include <elf.h>
-long smp_num_cpus; /* number of CPUs */
+#undef smp_num_cpus
+long smp_num_cpus=-1; /* number of CPUs */
long page_bytes; /* this architecture's page size */
#define BAD_OPEN_MESSAGE \
@@ -1166,7 +1167,11 @@ out:
///////////////////////////////////////////////////////////////////////////
-void cpuinfo (void) {
+long __smp_num_cpus (void) {
+
+ if (smp_num_cpus != -1)
+ return(smp_num_cpus);
+
// ought to count CPUs in /proc/stat instead of relying
// on glibc, which foolishly tries to parse /proc/cpuinfo
// note: that may have been the case but now /proc/stat
@@ -1181,4 +1186,8 @@ void cpuinfo (void) {
smp_num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
if (smp_num_cpus<1) /* SPARC glibc is buggy */
smp_num_cpus=1;
+
+ return smp_num_cpus;
}
+
+void cpuinfo (void) { (void)__smp_num_cpus(); }
--- proc/sysinfo.h
+++ proc/sysinfo.h 2018-04-04 11:30:51.841725161 +0000
@@ -8,6 +8,8 @@ EXTERN_C_BEGIN
extern unsigned long long Hertz; /* clock tick frequency */
extern long smp_num_cpus; /* number of CPUs */
+extern long __smp_num_cpus(void);
+#define smp_num_cpus __smp_num_cpus()
extern int have_privs; /* boolean, true if setuid or similar */
extern long page_bytes; /* this architecture's bytes per page */

View File

@ -0,0 +1,48 @@
setlocale() sets errno to ENOENT ...
open("/usr/lib/locale/de_DE.UTF-8/LC_NUMERIC", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/locale/de_DE.utf8/LC_NUMERIC", O_RDONLY|O_CLOEXEC) = 3
and this causes a problem later on (bsc#908516)
---
src/free.c | 5 +++++
1 file changed, 5 insertions(+)
--- src/free.c
+++ src/free.c 2022-10-20 13:33:28.880818112 +0000
@@ -208,6 +208,7 @@ int main(int argc, char **argv)
int c, flags = 0, unit_set = 0, rc = 0;
struct commandline_arguments args;
struct meminfo_info *mem_info = NULL;
+ int errsv;
/*
* For long options that have no equivalent short option, use a
@@ -260,10 +261,12 @@ int main(int argc, char **argv)
#ifdef HAVE_PROGRAM_INVOCATION_NAME
program_invocation_name = program_invocation_short_name;
#endif
+ errsv = errno;
setlocale (LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
+ errno = errsv;
while ((c = getopt_long(argc, argv, "bkmghlLtvCc:ws:V", longopts, NULL)) != -1)
switch (c) {
@@ -336,11 +339,13 @@ int main(int argc, char **argv)
break;
case 's':
flags |= FREE_REPEAT;
+ errsv = errno;
errno = 0;
args.repeat_interval = (1000000 * strtod_nol_or_err(optarg, "seconds argument failed"));
if (args.repeat_interval < 1)
xerrx(EXIT_FAILURE,
_("seconds argument `%s' is not positive number"), optarg);
+ errno = errsv;
break;
case 'c':
flags |= FREE_REPEAT;

View File

@ -0,0 +1,38 @@
---
vmstat.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
--- vmstat.c
+++ vmstat.c 2018-04-04 11:16:07.577968520 +0000
@@ -40,6 +40,7 @@
#include <string.h>
#include <sys/ioctl.h>
#include <sys/types.h>
+#include <sys/stat.h>
#include <termios.h>
#include <unistd.h>
#include <time.h>
@@ -708,13 +709,12 @@ static void slabheader(void)
static void slabformat(void)
{
- FILE *fSlab;
+ struct stat fSlab;
struct slab_cache *slabs;
unsigned long nSlab, i, j, k;
const char format[] = "%-24s %6u %6u %6u %6u\n";
- fSlab = fopen("/proc/slabinfo", "rb");
- if (!fSlab) {
+ if (stat("/proc/slabinfo", &fSlab) < 0) {
xwarnx(_("your kernel does not support slabinfo or your permissions are insufficient"));
return;
}
@@ -746,7 +746,6 @@ static void slabformat(void)
}
free(slabs);
}
- fclose(fSlab);
}
static void disksum_format(void)

View File

@ -0,0 +1,61 @@
---
free.c | 19 ++++++++++++++++---
proc/sysinfo.c | 5 ++++-
2 files changed, 20 insertions(+), 4 deletions(-)
--- free.c
+++ free.c 2021-02-10 09:58:35.409695062 +0000
@@ -134,7 +134,7 @@ static const char *scale_size(unsigned l
if (args.exponent > 1) {
/* In desired scale. */
snprintf(buf, sizeof(buf), "%ld",
- (long int)((size * 1024.0) / power(base, args.exponent-1))
+ (long int)(((long long int)size * 1024) / power(base, args.exponent-1))
);
return buf;
}
@@ -381,15 +381,28 @@ int main(int argc, char **argv)
* to print the high info, even if it is zero.
*/
if (flags & FREE_LOHI) {
+ unsigned long kb_low_used;
+ unsigned long kb_high_used;
+
+ if (kb_low_total > kb_low_free)
+ kb_low_used = kb_low_total - kb_low_free;
+ else
+ kb_low_used = 0;
+
+ if (kb_high_total > kb_high_free)
+ kb_high_used = kb_high_total - kb_high_free;
+ else
+ kb_high_used = 0;
+
printf("%-9s", _("Low:"));
printf("%11s", scale_size(kb_low_total, flags, args));
- printf(" %11s", scale_size(kb_low_total - kb_low_free, flags, args));
+ printf(" %11s", scale_size(kb_low_used, flags, args));
printf(" %11s", scale_size(kb_low_free, flags, args));
printf("\n");
printf("%-9s", _("High:"));
printf("%11s", scale_size(kb_high_total, flags, args));
- printf(" %11s", scale_size(kb_high_total - kb_high_free, flags, args));
+ printf(" %11s", scale_size(kb_high_used, flags, args));
printf(" %11s", scale_size(kb_high_free, flags, args));
printf("\n");
}
--- proc/sysinfo.c
+++ proc/sysinfo.c 2021-02-10 10:00:35.227385913 +0000
@@ -783,7 +783,10 @@ nextline:
kb_main_cached = kb_page_cache + kb_slab_reclaimable;
if ((ev=getenv("PS_FULL_CACHE")))
kb_main_cached += kb_swap_cached + kb_nfs_unstable;
- kb_swap_used = kb_swap_total - kb_swap_free;
+ if (kb_swap_total > kb_swap_free)
+ kb_swap_used = kb_swap_total - kb_swap_free;
+ else
+ kb_swap_used = 0;
/* if kb_main_available is greater than kb_main_total or our calculation of
mem_used overflows, that's symptomatic of running within a lxc container

View File

@ -0,0 +1,19 @@
---
top/top.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- top/top.c
+++ top/top.c 2018-04-04 12:09:16.087193018 +0000
@@ -2404,7 +2404,11 @@ static void zap_fieldstab (void) {
Cpu_pmax = 99.9;
if (Rc.mode_irixps && smp_num_cpus > 1 && !Thread_mode) {
Cpu_pmax = 100.0 * smp_num_cpus;
- if (smp_num_cpus > 10) {
+ if (smp_num_cpus > 1000) {
+ if (Cpu_pmax > 9999999.0) Cpu_pmax = 9999999.0;
+ } else if (smp_num_cpus > 100) {
+ if (Cpu_pmax > 999999.0) Cpu_pmax = 999999.0;
+ } else if (smp_num_cpus > 10) {
if (Cpu_pmax > 99999.0) Cpu_pmax = 99999.0;
} else {
if (Cpu_pmax > 999.9) Cpu_pmax = 999.9;

126
procps-ng-3.3.10-slab.patch Normal file
View File

@ -0,0 +1,126 @@
---
library/meminfo.c | 7 ++++++-
man/free.1 | 6 ++++++
src/free.c | 7 ++++++-
src/vmstat.c | 7 ++++++-
4 files changed, 24 insertions(+), 3 deletions(-)
--- library/meminfo.c
+++ library/meminfo.c 2023-09-12 12:08:41.033738450 +0000
@@ -3,6 +3,7 @@
*
* Copyright © 2015-2023 Jim Warner <james.warner@comcast.net>
* Copyright © 2015-2023 Craig Small <csmall@dropbear.xyz>
+ * Copyright © 2008 Bart Van Assche.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -640,6 +641,7 @@ static int meminfo_read_failed (
int size;
unsigned long *valptr;
signed long mem_used;
+ const char *ev;
// remember history from last time around
memcpy(&info->hist.old, &info->hist.new, sizeof(struct meminfo_data));
@@ -692,7 +694,10 @@ static int meminfo_read_failed (
if (0 == mHr(MemAvailable))
mHr(MemAvailable) = mHr(MemFree);
- mHr(derived_mem_cached) = mHr(Cached) + mHr(SReclaimable);
+ if ((ev=getenv("PS_FULL_CACHE")))
+ mHr(derived_mem_cached) = mHr(Cached) + mHr(SReclaimable) + mHr(NFS_Unstable);
+ else
+ mHr(derived_mem_cached) = mHr(Cached) + mHr(SReclaimable);
/* if 'available' is greater than 'total' or our calculation of mem_used
overflows, that's symptomatic of running within a lxc container where
--- man/free.1
+++ man/free.1 2023-09-12 12:08:41.029738522 +0000
@@ -110,6 +110,12 @@ Switch to the wide mode. The wide mode p
than 80 characters. In this mode \fBbuffers\fR and \fBcache\fR
are reported in two separate columns.
.TP
+\fB\-C\fR, \fB\-\-full\-cache\fR
+Add to the plain \fBCached\fR in-memory cache for files also more cache lines as
+the \fBNFS_Unstable\fR pages sent to the server, but not yet committed to stable storage
+and the \fBSwapCached\fR memory that once was swapped out but is swapped back.
+Can be also enabled by the environment variable \fBPS_FULL_CACHE\fR.
+.TP
\fB\-c\fR, \fB\-\-count\fR \fIcount\fR
Display the result
.I count
--- src/free.c
+++ src/free.c 2023-09-12 12:10:26.647842455 +0000
@@ -92,6 +92,7 @@ static void __attribute__ ((__noreturn__
fputs(_(" -v, --committed show committed memory and commit limit\n"), out);
fputs(_(" -s N, --seconds N repeat printing every N seconds\n"), out);
fputs(_(" -c N, --count N repeat printing N times, then exit\n"), out);
+ fputs(_(" -C, --full-cache add further cache lines to main cache\n"), out);
fputs(_(" -w, --wide wide output\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(_(" --help display this help and exit\n"), out);
@@ -244,6 +245,7 @@ int main(int argc, char **argv)
{ "committed", no_argument, NULL, 'v' },
{ "seconds", required_argument, NULL, 's' },
{ "count", required_argument, NULL, 'c' },
+ { "full-cache",no_argument, NULL, 'C' },
{ "wide", no_argument, NULL, 'w' },
{ "help", no_argument, NULL, HELP_OPTION },
{ "version", no_argument, NULL, 'V' },
@@ -263,7 +265,7 @@ int main(int argc, char **argv)
textdomain(PACKAGE);
atexit(close_stdout);
- while ((c = getopt_long(argc, argv, "bkmghlLtvc:ws:V", longopts, NULL)) != -1)
+ while ((c = getopt_long(argc, argv, "bkmghlLtvCc:ws:V", longopts, NULL)) != -1)
switch (c) {
case 'b':
check_unit_set(&unit_set);
@@ -352,6 +354,9 @@ int main(int argc, char **argv)
case 'w':
flags |= FREE_WIDE;
break;
+ case 'C':
+ setenv("PS_FULL_CACHE", "yes", 1);
+ break;
case HELP_OPTION:
usage(stdout);
case 'V':
--- src/vmstat.c
+++ src/vmstat.c 2023-09-12 12:08:41.033738450 +0000
@@ -230,6 +230,7 @@ static void __attribute__ ((__noreturn__
fputs(_(" -p, --partition <dev> partition specific statistics\n"), out);
fputs(_(" -S, --unit <char> define display unit\n"), out);
fputs(_(" -w, --wide wide output\n"), out);
+ fputs(_(" -C, --full-cache add further cache lines to main cache\n"), out);
fputs(_(" -t, --timestamp show timestamp\n"), out);
fputs(_(" -y, --no-first skips first line of output\n"), out);
fputs(USAGE_SEPARATOR, out);
@@ -951,6 +952,7 @@ int main(int argc, char *argv[])
{"partition", required_argument, NULL, 'p'},
{"unit", required_argument, NULL, 'S'},
{"wide", no_argument, NULL, 'w'},
+ {"full-cache", no_argument, NULL, 'C'},
{"timestamp", no_argument, NULL, 't'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
@@ -967,7 +969,7 @@ int main(int argc, char *argv[])
atexit(close_stdout);
while ((c =
- getopt_long(argc, argv, "afmnsdDp:S:wthVy", longopts, NULL)) != -1)
+ getopt_long(argc, argv, "aCfmnsdDp:S:wthVy", longopts, NULL)) != -1)
switch (c) {
case 'V':
printf(PROCPS_NG_VERSION);
@@ -1034,6 +1036,9 @@ int main(int argc, char *argv[])
case 't':
t_option = 1;
break;
+ case 'C':
+ setenv("PS_FULL_CACHE", "yes", 1);
+ break;
case 'y':
/* Don't display stats since system restart */
y_option = 1;

33
procps-ng-3.3.10-xen.dif Normal file
View File

@ -0,0 +1,33 @@
---
vmstat.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- src/vmstat.c
+++ src/vmstat.c 2022-03-29 09:21:41.156855432 +0000
@@ -357,7 +357,7 @@ static void new_format(void)
unsigned long pgpgin[2], pgpgout[2], pswpin[2] = {0,0}, pswpout[2];
unsigned int sleep_half;
unsigned long kb_per_page = sysconf(_SC_PAGESIZE) / 1024ul;
- int debt = 0; /* handle idle ticks running backwards */
+ long long debt = 0; /* handle idle ticks running backwards */
struct tm *tm_ptr;
time_t the_time;
char timebuf[32];
@@ -484,12 +484,12 @@ static void new_format(void)
/* idle can run backwards for a moment -- kernel "feature" */
if (debt) {
- cpu_idl = (int)cpu_idl + debt;
- debt = 0;
+ cpu_idl = cpu_idl + debt;
+ debt = 0LL;
}
- if ((int)cpu_idl < 0) {
- debt = (int)cpu_idl;
- cpu_idl = 0;
+ if (cpu_idl < 0) {
+ debt = cpu_idl;
+ cpu_idl = 0LL;
}
Div = cpu_use + cpu_sys + cpu_idl + cpu_iow + cpu_sto;

View File

@ -0,0 +1,217 @@
---
src/pmap.c | 47 ++++++++++++++++++++++++++++++++-----------
testsuite/pmap.test/pmap.exp | 17 +++++++--------
2 files changed, 44 insertions(+), 20 deletions(-)
--- src/pmap.c
+++ src/pmap.c 2023-09-12 12:23:39.537610124 +0000
@@ -59,7 +59,9 @@ const char *nls_Address,
*nls_Kbytes,
*nls_Mode,
*nls_RSS,
- *nls_Dirty;
+ *nls_PSS,
+ *nls_Dirty,
+ *nls_Swap;
static void nls_initialize(void)
{
@@ -83,7 +85,9 @@ static void nls_initialize(void)
nls_Kbytes = _("Kbytes");
nls_Mode = _("Mode");
nls_RSS = _("RSS");
+ nls_PSS = _("PSS");
nls_Dirty = _("Dirty");
+ nls_Swap = _("Swap");
}
static int justify_print(const char *str, int width, int right)
@@ -150,10 +154,10 @@ static int d_option = 0;
static int n_option = 0;
static int N_option = 0;
static int q_option = 0;
-static int x_option = 0;
+static int x_option = 1;
static int X_option = 0;
-static int map_desc_showpath;
+static int map_desc_showpath = 1;
static unsigned shm_minor = ~0u;
@@ -544,12 +548,17 @@ static int one_proc (struct pids_stack *
char perms[32] = "";
const char *cp2 = NULL;
unsigned long long rss = 0ull;
+ unsigned long long pss = 0ull;
+ unsigned long long swap = 0ull;
unsigned long long private_dirty = 0ull;
unsigned long long shared_dirty = 0ull;
unsigned long long total_rss = 0ull;
+ unsigned long long total_pss = 0ull;
+ unsigned long long total_swap = 0ull;
unsigned long long total_private_dirty = 0ull;
unsigned long long total_shared_dirty = 0ull;
int maxw1=0, maxw2=0, maxw3=0, maxw4=0, maxw5=0;
+ int maxw6=0, maxw7=0;
printf("%u: %s\n", PIDS_VAL(tgid, s_int, p, Pids_info), PIDS_VAL(cmdline, str, p, Pids_info));
@@ -572,13 +581,15 @@ static int one_proc (struct pids_stack *
if (x_option) {
maxw1 = 16;
if (sizeof(long) == 4) maxw1 = 8;
- maxw2 = maxw3 = maxw4 = 7;
+ maxw2 = maxw3 = maxw4 = maxw6 = maxw7 = 7;
maxw5 = 5;
if (!q_option) {
maxw1 = justify_print(nls_Address, maxw1, 0);
maxw2 = justify_print(nls_Kbytes, maxw2, 1);
maxw3 = justify_print(nls_RSS, maxw3, 1);
+ maxw6 = justify_print(nls_PSS, maxw6, 1);
maxw4 = justify_print(nls_Dirty, maxw4, 1);
+ maxw7 = justify_print(nls_Swap, maxw7, 1);
maxw5 = justify_print(nls_Mode, maxw5, 0);
justify_print(nls_Mapping, 0, 0);
}
@@ -618,6 +629,11 @@ static int one_proc (struct pids_stack *
total_rss += smap_value;
continue;
}
+ if (strncmp("Pss", smap_key, 3) == 0) {
+ pss = smap_value;
+ total_pss += smap_value;
+ continue;
+ }
if (strcmp("Shared_Dirty", smap_key) == 0) {
shared_dirty = smap_value;
total_shared_dirty += smap_value;
@@ -630,16 +646,20 @@ static int one_proc (struct pids_stack *
}
if (strcmp("Swap", smap_key) == 0) {
/* doesn't matter as long as last */
+ swap = smap_value;
+ total_swap += smap_value;
if (cp2)
- printf("%0*lx %*lu %*llu %*llu %*s %s\n",
+ printf("%0*lx %*lu %*llu %*llu %*llu %*llu %*s %s\n",
maxw1, start_To_Avoid_Warning,
maxw2, (unsigned long)(diff >> 10),
maxw3, rss,
+ maxw6, pss,
maxw4, (private_dirty + shared_dirty),
+ maxw7, swap,
maxw5, perms,
cp2);
/* reset some counters */
- rss = shared_dirty = private_dirty = 0ull;
+ rss = pss = shared_dirty = private_dirty = swap = 0ull;
diff = end = 0;
perms[0] = '\0';
cp2 = NULL;
@@ -673,7 +693,6 @@ static int one_proc (struct pids_stack *
if (perms[3] == 's')
total_shared += diff;
if (perms[3] == 'p') {
- perms[3] = '-';
if (perms[1] == 'w')
total_private_writeable += diff;
else
@@ -725,17 +744,21 @@ static int one_proc (struct pids_stack *
justify_print("----------------", maxw1, 0);
justify_print("-------", maxw2, 1);
justify_print("-------", maxw3, 1);
+ justify_print("-------", maxw6, 1);
justify_print("-------", maxw4, 1);
+ justify_print("-------", maxw7, 1);
printf("\n");
printf("%-*s ", maxw1, _("total kB"));
- printf("%*ld %*llu %*llu\n",
+ printf("%*ld %*llu %*llu %*llu %*llu\n",
maxw2, (total_shared +
total_private_writeable +
total_private_readonly) >> 10,
maxw3, total_rss,
+ maxw6, total_pss,
maxw4, (total_shared_dirty +
- total_private_dirty));
+ total_private_dirty),
+ maxw7, total_swap);
}
if (d_option) {
printf
@@ -1052,16 +1075,18 @@ int main(int argc, char **argv)
while ((c = getopt_long(argc, argv, "xXrdqA:hVcC:nN:p", longopts, NULL)) != -1)
switch (c) {
case 'x':
- x_option = 1;
+ x_option = !x_option;
break;
case 'X':
X_option++;
+ x_option = 0;
break;
case 'r':
xwarnx(_("option -r is ignored as SunOS compatibility"));
break;
case 'd':
- d_option = 1;
+ d_option = !d_option;
+ x_option = 0;
break;
case 'q':
q_option = 1;
--- testsuite/pmap.test/pmap.exp
+++ testsuite/pmap.test/pmap.exp 2023-09-12 12:25:22.375764402 +0000
@@ -8,16 +8,16 @@ set pmap_procname "${mypid}:\\s+\\S+\[^\
set pmap_initname "1:\\s+\\S+\[^\\r\]+\\s+"
set pmap_std_header $pmap_procname
set pmap_device_header "${pmap_procname}Address\\s+Kbytes\\s+Mode\\s+Offset\\s+Device\\s+Mapping\\s+"
-set pmap_ext_header "${pmap_procname}Address\\s+Kbytes\\s+RSS\\s+Dirty\\s+Mode\\s+Mapping\\s+"
+set pmap_ext_header "${pmap_procname}Address\\s+Kbytes\\s+RSS\\s+PSS\\s+Dirty\\s+Swap\\s+Mode\\s+Mapping\\s+"
set pmap_generic_header "${pmap_procname}\\s+\(?:\[A-Z\]\[a-z\]+ +\)+"
-set pmap_std_items "\(\[0-9a-f\]+\\s+\\d+K \[rwx-\]{5}\\s+\\S+\[^\\r\]+\\s*\)+"
-set pmap_device_items "\(\[0-9a-f\]+\\s+\\d+ \[rwx-\]{5}\\s+\[0-9a-f\]+\\s+\[0-9a-f\]{3}:\[0-9a-f\]{5}\\s+\\S+\[^\\r\]+\\s*\)+"
-set pmap_ext_items "\(\[0-9a-f\]+\\s+\\d+\\s+\\d+\\s+\\d+ \[rwx-\]{5}\\s+\\S+\[^\\r\]+\\s*\)+"
+set pmap_std_items "\(\[0-9a-f\]+\\s+\\d+K \[rwxp-\]{5}\\s+\\S+\[^\\r\]+\\s*\)+"
+set pmap_device_items "\(\[0-9a-f\]+\\s+\\d+ \[rwxp-\]{5}\\s+\[0-9a-f\]+\\s+\[0-9a-f\]{3}:\[0-9a-f\]{5}\\s+\\S+\[^\\r\]+\\s*\)+"
+set pmap_ext_items "\(\[0-9a-f\]+\\s+\\d+\\s+\\d+\\s+\\d+\\s+\\d+ \[rwxp-\]{5}\\s+\\S+\[^\\r\]+\\s*\)+"
set pmap_std_footer "total\\s+\\d+K\\s*\$"
set pmap_device_footer "mapped:\\s+\\d+K\\s+writeable\/private:\\s+\\d+K\\s+shared:\\s+\\d+K\\s*\$"
-set pmap_ext_footer "\[ -\]+\\s+total kB\\s+\\d+(\\s+\[\\d-\]+){2,3}\\s*\$"
+set pmap_ext_footer "total kB\\s+\\d+(\\s+\[\\d-\]+){4,5}\\s*\$"
set test "pmap with no arguments"
spawn $pmap
@@ -26,17 +26,16 @@ expect_pass "$test" "Usage:\\s+\(lt-\)?p
set test "pmap standard output"
spawn $pmap $mypid
-expect_table $test $pmap_std_header $pmap_std_items $pmap_std_footer
+expect_table $test $pmap_ext_header $pmap_ext_items $pmap_ext_footer
set test "pmap standard output with quiet"
spawn $pmap -q $mypid
-expect_table $test $pmap_procname $pmap_std_items "\$"
+expect_table $test $pmap_procname $pmap_ext_items "\$"
set test "pmap device output"
spawn $pmap -d $mypid
expect_table $test $pmap_device_header $pmap_device_items $pmap_device_footer
-
set test "pmap device output quiet (dq)"
spawn $pmap -dq $mypid
expect_table $test $pmap_procname $pmap_device_items "\$"
@@ -50,7 +49,7 @@ if { [ file readable "/proc/self/smaps"
} else {
set test "pmap extended output"
spawn $pmap -x $mypid
- expect_table $test $pmap_ext_header $pmap_ext_items $pmap_ext_footer
+ expect_table $test $pmap_std_header $pmap_std_items $pmap_std_footer
# -X and -XX have no real format as its dependent on smaps
set test "pmap extra extended output"

View File

@ -0,0 +1,407 @@
diff -ur procps-3.3.17/configure.ac procps-3.3.17-no-utmp/configure.ac
--- procps-3.3.17/configure.ac 2023-10-27 17:02:55.230522174 +0200
+++ procps-3.3.17-no-utmp/configure.ac 2023-10-27 17:05:56.027565296 +0200
@@ -214,6 +214,13 @@
AS_IF([test "x$with_systemd" != "xno"], [
PKG_CHECK_MODULES([SYSTEMD], [libsystemd])
AC_DEFINE(WITH_SYSTEMD, 1, [enable systemd support])
+
+ # The functions needed to replace utmp with logind are only available
+ # with systemd v254 or later.
+ old_LIBS="$LIBS"
+ LIBS="$LIBS $SYSTEMD_LIBS"
+ AC_CHECK_FUNCS([sd_session_get_leader])
+ LIBS="$old_LIBS"
])
AM_CONDITIONAL([WITH_SYSTEMD], [test x$with_systemd != xno])
diff -ur procps-3.3.17/proc/whattime.c procps-3.3.17-no-utmp/proc/whattime.c
--- procps-3.3.17/proc/whattime.c 2021-02-09 11:11:25.000000000 +0100
+++ procps-3.3.17-no-utmp/proc/whattime.c 2023-10-27 17:05:56.027565296 +0200
@@ -38,6 +38,15 @@
#include "whattime.h"
#include "sysinfo.h"
+#ifdef WITH_SYSTEMD
+#include <systemd/sd-daemon.h>
+#include <systemd/sd-login.h>
+#endif
+#ifdef WITH_ELOGIND
+#include <elogind/sd-daemon.h>
+#include <elogind/sd-login.h>
+#endif
+
static char buf[256];
static double av[3];
@@ -98,6 +107,11 @@
/* count the number of users */
numuser = 0;
+#if defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)
+ if (sd_booted() > 0)
+ numuser = sd_get_sessions(NULL);
+ else {
+#endif
setutent();
while ((utmpstruct = getutent())) {
if ((utmpstruct->ut_type == USER_PROCESS) &&
@@ -105,6 +119,10 @@
numuser++;
}
endutent();
+#if defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)
+ }
+#endif
+
pos += sprintf(buf + pos, "%2d user%s, ", numuser, numuser == 1 ? "" : "s");
Datei procps-3.3.17/screen.620TQo/23075..f05 ist ein Socket, während Datei procps-3.3.17-no-utmp/screen.620TQo/23075..f05 ein Socket ist.
diff -ur procps-3.3.17/w.c procps-3.3.17-no-utmp/w.c
--- procps-3.3.17/w.c 2023-10-27 17:02:55.194521966 +0200
+++ procps-3.3.17-no-utmp/w.c 2023-10-27 18:10:00.371042829 +0200
@@ -56,11 +56,22 @@
#include <time.h>
#include <unistd.h>
#ifdef HAVE_UTMPX_H
-# include <utmpx.h>
+#include <utmpx.h>
+#ifndef HAVE_UT_HOSTSIZE_IN_UTMPX
+#include <utmp.h>
+#endif
#else
# include <utmp.h>
#endif
#include <arpa/inet.h>
+#ifdef WITH_SYSTEMD
+# include <systemd/sd-login.h>
+# include <systemd/sd-daemon.h>
+#endif
+#ifdef WITH_ELOGIND
+# include <elogind/sd-login.h>
+# include <elogind/sd-daemon.h>
+#endif
static int ignoreuser = 0; /* for '-u' */
static int oldstyle = 0; /* for '-o' */
@@ -72,12 +83,6 @@
typedef struct utmp utmp_t;
#endif
-#if !defined(UT_HOSTSIZE) || defined(__UT_HOSTSIZE)
-# define UT_HOSTSIZE __UT_HOSTSIZE
-# define UT_LINESIZE __UT_LINESIZE
-# define UT_NAMESIZE __UT_NAMESIZE
-#endif
-
#ifdef W_SHOWFROM
# define FROM_STRING "on"
#else
@@ -198,7 +203,25 @@
/* This routine prints either the hostname or the IP address of the remote */
-static void print_from(const utmp_t *restrict const u, const int ip_addresses, const int fromlen) {
+static void print_from(
+#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
+ const char *session,
+#endif
+ const utmp_t *restrict const u, const int ip_addresses, const int fromlen) {
+#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
+ if (session) {
+ char *host = NULL;
+ int r;
+
+ r = sd_session_get_remote_host(session, &host);
+ if (r < 0 || host == NULL)
+ print_host("", 0, fromlen);
+ else {
+ print_host(host, strlen(host), fromlen == 0?strlen(host):fromlen);
+ free(host);
+ }
+ } else {
+#endif
char buf[fromlen + 1];
char buf_ipv6[INET6_ADDRSTRLEN];
int len;
@@ -243,6 +266,9 @@
#else
print_host(u->ut_host, UT_HOSTSIZE, fromlen);
#endif
+#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
+ }
+#endif
}
@@ -341,7 +367,11 @@
* the user for that login session is doing currently. This the
* essential core of 'w'.
*/
-static const proc_t *getproc(const utmp_t * restrict const u,
+static const proc_t *getproc(
+#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
+ const char *session,
+#endif
+ const utmp_t * restrict const u,
const char *restrict const tty,
unsigned long long *restrict const jcpu,
int *restrict const found_utpid)
@@ -351,9 +381,16 @@
const proc_t *best = NULL;
const proc_t *secondbest = NULL;
unsigned uid = ~0U;
+ pid_t ut_pid = -1;
*found_utpid = 0;
if (!ignoreuser) {
+#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
+ if (session) {
+ if (sd_session_get_uid(session, &uid) < 0)
+ return 0;
+ } else {
+#endif
char buf[UT_NAMESIZE + 1];
/* pointer to static data */
struct passwd *passwd_data;
@@ -364,12 +401,21 @@
return NULL;
uid = passwd_data->pw_uid;
/* OK to have passwd_data go out of scope here */
+#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
+ }
+#endif
}
line = tty_to_dev(tty);
*jcpu = 0;
+ if (u)
+ ut_pid = u->ut_pid;
+#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
+ else
+ sd_session_get_leader(session, &ut_pid);
+#endif
for (; *pptr; pptr++) {
- const proc_t *restrict const tmp = *pptr;
- if (unlikely(tmp->tgid == u->ut_pid)) {
+ const proc_t *restrict const tmp = *pptr;
+ if (unlikely(tmp->tgid == ut_pid)) {
*found_utpid = 1;
if (!best)
best = tmp;
@@ -393,7 +439,11 @@
return best ? best : secondbest;
}
-static void showinfo(utmp_t * u, int formtype, int maxcmd, int from,
+static void showinfo(
+#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
+ const char *session, const char *name,
+#endif
+ utmp_t * u, int formtype, int maxcmd, int from,
int userlen, int fromlen, const int ip_addresses)
{
unsigned long long jcpu;
@@ -402,14 +452,36 @@
char uname[UT_NAMESIZE + 1] = "", tty[5 + UT_LINESIZE + 1] = "/dev/";
const proc_t *best;
+#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
+ if (session) {
+ char *sd_tty;
+
+ if (sd_session_get_tty(session, &sd_tty) >= 0) {
+ for (i = 0; i < strlen (sd_tty); i++)
+ /* clean up tty if garbled */
+ if (isalnum(sd_tty[i]) || (sd_tty[i] == '/'))
+ tty[i + 5] = sd_tty[i];
+ else
+ tty[i + 5] = '\0';
+ free(sd_tty);
+ }
+ } else {
+#endif
for (i = 0; i < UT_LINESIZE; i++)
/* clean up tty if garbled */
if (isalnum(u->ut_line[i]) || (u->ut_line[i] == '/'))
tty[i + 5] = u->ut_line[i];
else
tty[i + 5] = '\0';
+#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
+ }
+#endif
- best = getproc(u, tty + 5, &jcpu, &ut_pid_found);
+ best = getproc(
+#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
+ session,
+#endif
+ u, tty + 5, &jcpu, &ut_pid_found);
/*
* just skip if stale utmp entry (i.e. login proc doesn't
@@ -420,26 +492,56 @@
if (!ut_pid_found)
return;
+#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
+ if (name)
+ strncpy(uname, name, UT_NAMESIZE);
+ else
+#endif
+ strncpy(uname, u->ut_user, UT_NAMESIZE);
/* force NUL term for printf */
- strncpy(uname, u->ut_user, UT_NAMESIZE);
+ uname[UT_NAMESIZE] = '\0';
if (formtype) {
- int utlnlen = 8;
- if (formtype > 1) {
- userlen = strnlen(uname, UT_NAMESIZE);
- fromlen = strnlen(u->ut_host, UT_HOSTSIZE);
- utlnlen = strnlen(u->ut_line, UT_LINESIZE);
- maxcmd = MAX_CMD_WIDTH;
+ int utlnlen = 8;
+ if (formtype > 1) {
+ userlen = strnlen(uname, UT_NAMESIZE);
+ if (u) {
+ fromlen = strnlen(u->ut_host, UT_HOSTSIZE);
+ utlnlen = strnlen(u->ut_line, UT_LINESIZE);
+ } else {
+ fromlen = 0;
+ utlnlen = strlen (tty+5);
}
- printf("%-*.*s%-*.*s", userlen + 1, userlen, uname, utlnlen + 1, utlnlen, u->ut_line);
+ maxcmd = MAX_CMD_WIDTH;
+ }
+ printf("%-*.*s%-*.*s", userlen + 1, userlen, uname, utlnlen + 1, utlnlen, tty+5);
+#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
+ if (session) {
+ uint64_t ltime;
+
if (from)
- print_from(u, ip_addresses, fromlen);
+ print_from(session, NULL, ip_addresses, fromlen);
+
+ sd_session_get_start_time(session, &ltime);
+ print_logintime(ltime/((uint64_t) 1000000ULL), stdout);
+ } else {
+#endif
+ if (from)
+ print_from(
+#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
+ NULL,
+#endif
+ u, ip_addresses, fromlen);
+
#ifdef HAVE_UTMPX_H
print_logintime(u->ut_tv.tv_sec, stdout);
#else
print_logintime(u->ut_time, stdout);
#endif
- if (*u->ut_line == ':')
+#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
+ }
+#endif
+ if (u && *u->ut_line == ':')
/* idle unknown for xdm logins */
printf(" ?xdm? ");
else
@@ -454,11 +556,15 @@
} else
printf(" ? ");
} else {
- printf("%-*.*s%-9.8s", userlen + 1, userlen, u->ut_user,
- u->ut_line);
+ printf("%-*.*s%-9.8s", userlen + 1, userlen, uname,
+ tty+5);
if (from)
- print_from(u, ip_addresses, fromlen);
- if (*u->ut_line == ':')
+ print_from(
+#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
+ session,
+#endif
+ u, ip_addresses, fromlen);
+ if (u && *u->ut_line == ':')
/* idle unknown for xdm logins */
printf(" ?xdm? ");
else
@@ -635,7 +741,40 @@
else
printf(_(" IDLE WHAT\n"));
}
-
+#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
+ if (sd_booted() > 0) {
+ char **sessions_list;
+ int sessions;
+ int i;
+
+ sessions = sd_get_sessions (&sessions_list);
+ if (sessions < 0 && sessions != -ENOENT)
+ error(EXIT_FAILURE, -sessions, _("error getting sessions"));
+
+ if (sessions >= 0) {
+ for (int i = 0; i < sessions; i++) {
+ char *name;
+ int r;
+
+ if ((r = sd_session_get_username(sessions_list[i], &name)) < 0)
+ error(EXIT_FAILURE, -r, _("get user name failed"));
+
+ if (user) {
+ if (!strcmp(name, user))
+ showinfo(sessions_list[i], name, NULL, longform,
+ maxcmd, from, userlen, fromlen,
+ ip_addresses);
+ } else {
+ showinfo(sessions_list[i], name, NULL, longform, maxcmd,
+ from, userlen, fromlen, ip_addresses);
+ }
+ free(name);
+ free(sessions_list[i]);
+ }
+ free(sessions_list);
+ }
+ } else {
+#endif
#ifdef HAVE_UTMPX_H
setutxent();
#else
@@ -654,7 +793,11 @@
if (u->ut_type != USER_PROCESS)
continue;
if (!strncmp(u->ut_user, user, UT_NAMESIZE))
- showinfo(u, longform, maxcmd, from, userlen,
+ showinfo(
+#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
+ NULL, NULL,
+#endif
+ u, longform, maxcmd, from, userlen,
fromlen, ip_addresses);
}
} else {
@@ -669,7 +812,11 @@
if (u->ut_type != USER_PROCESS)
continue;
if (*u->ut_user)
- showinfo(u, longform, maxcmd, from, userlen,
+ showinfo(
+#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
+ NULL, NULL,
+#endif
+ u, longform, maxcmd, from, userlen,
fromlen, ip_addresses);
}
}
@@ -678,6 +825,9 @@
#else
endutent();
#endif
+#if (defined(WITH_SYSTEMD) || defined(WITH_ELOGIND)) && defined(HAVE_SD_SESSION_GET_LEADER)
+ }
+#endif
return EXIT_SUCCESS;
}

BIN
procps-ng-3.3.17.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,99 @@
---
ps/common.h | 1 +
ps/global.c | 5 ++++-
ps/output.c | 19 ++++++++++---------
3 files changed, 15 insertions(+), 10 deletions(-)
--- ps/common.h
+++ ps/common.h 2018-04-04 11:14:33.915688098 +0000
@@ -303,6 +303,7 @@ extern int running_only;
extern int screen_cols;
extern int screen_rows;
extern time_t seconds_since_boot;
+extern unsigned long long jiffies_since_boot;
extern selection_node *selection_list;
extern unsigned simple_select;
extern sort_node *sort_list;
--- ps/global.c
+++ ps/global.c 2018-04-04 11:14:33.915688098 +0000
@@ -78,6 +78,7 @@ int prefer_bsd_defaults = -1
int screen_cols = -1;
int screen_rows = -1;
time_t seconds_since_boot = -1;
+unsigned long long jiffies_since_boot = -1;
selection_node *selection_list = (selection_node *)0xdeadbeef;
unsigned simple_select = 0xffffffff;
sort_node *sort_list = (sort_node *)0xdeadbeef; /* ready-to-use sort list */
@@ -361,6 +362,7 @@ static const char *set_personality(void)
/************ Call this to reinitialize everything ***************/
void reset_global(void){
static proc_t p;
+ double uptime_secs;
reset_selection_list();
look_up_our_self(&p);
set_screen_size();
@@ -383,7 +385,8 @@ void reset_global(void){
negate_selection = 0;
page_size = getpagesize();
running_only = 0;
- seconds_since_boot = uptime(0,0);
+ seconds_since_boot = uptime(&uptime_secs,0);
+ jiffies_since_boot = ((long double)uptime_secs * Hertz);
selection_list = NULL;
simple_select = 0;
sort_list = NULL;
--- ps/output.c
+++ ps/output.c 2018-04-04 11:14:33.915688098 +0000
@@ -134,6 +134,7 @@ static int sr_ ## NAME (const proc_t* P,
#define cook_time(P) (P->utime + P->stime) / Hertz
#define cook_etime(P) (((unsigned long long)seconds_since_boot >= (P->start_time / Hertz)) ? ((unsigned long long)seconds_since_boot - (P->start_time / Hertz)) : 0)
+#define cook_jtime(P) (((unsigned long long)jiffies_since_boot >= (P->start_time)) ? ((unsigned long long)jiffies_since_boot - (P->start_time)) : 0)
#define CMP_COOKED_TIME(NAME) \
static int sr_ ## NAME (const proc_t* P, const proc_t* Q) { \
@@ -507,11 +508,11 @@ static int pr_etimes(char *restrict cons
static int pr_c(char *restrict const outbuf, const proc_t *restrict const pp){
unsigned long long total_time; /* jiffies used by this process */
unsigned pcpu = 0; /* scaled %cpu, 99 means 99% */
- unsigned long long seconds; /* seconds of process life */
+ unsigned long long jiffies; /* jiffies of process life */
total_time = pp->utime + pp->stime;
if(include_dead_children) total_time += (pp->cutime + pp->cstime);
- seconds = cook_etime(pp);
- if(seconds) pcpu = (total_time * 100ULL / Hertz) / seconds;
+ jiffies = cook_jtime(pp);
+ if(jiffies) pcpu = (total_time * 100ULL) / jiffies;
if (pcpu > 99U) pcpu = 99U;
return snprintf(outbuf, COLWID, "%2u", pcpu);
}
@@ -519,11 +520,11 @@ static int pr_c(char *restrict const out
static int pr_pcpu(char *restrict const outbuf, const proc_t *restrict const pp){
unsigned long long total_time; /* jiffies used by this process */
unsigned pcpu = 0; /* scaled %cpu, 999 means 99.9% */
- unsigned long long seconds; /* seconds of process life */
+ unsigned long long jiffies; /* jiffies of process life */
total_time = pp->utime + pp->stime;
if(include_dead_children) total_time += (pp->cutime + pp->cstime);
- seconds = cook_etime(pp);
- if(seconds) pcpu = (total_time * 1000ULL / Hertz) / seconds;
+ jiffies = cook_jtime(pp);
+ if(jiffies) pcpu = (total_time * 1000ULL) / jiffies;
if (pcpu > 999U)
return snprintf(outbuf, COLWID, "%u", pcpu/10U);
return snprintf(outbuf, COLWID, "%u.%u", pcpu/10U, pcpu%10U);
@@ -532,11 +533,11 @@ static int pr_pcpu(char *restrict const
static int pr_cp(char *restrict const outbuf, const proc_t *restrict const pp){
unsigned long long total_time; /* jiffies used by this process */
unsigned pcpu = 0; /* scaled %cpu, 999 means 99.9% */
- unsigned long long seconds; /* seconds of process life */
+ unsigned long long jiffies; /* jiffies of process life */
total_time = pp->utime + pp->stime;
if(include_dead_children) total_time += (pp->cutime + pp->cstime);
- seconds = cook_etime(pp);
- if(seconds) pcpu = (total_time * 1000ULL / Hertz) / seconds;
+ jiffies = cook_jtime(pp);
+ if(jiffies) pcpu = (total_time * 1000ULL) / jiffies;
if (pcpu > 999U) pcpu = 999U;
return snprintf(outbuf, COLWID, "%3u", pcpu);
}

View File

@ -0,0 +1,29 @@
Do not setup SIGHUP signal handler if we are in the batch mode
Top enables a signal handler for the SIGHUP signal (loss of terminal). While
this makes sense for top's default interactive mode, it doesn't make any sense
for batch mode. If you run top in nohup just to collect data over time and
disconnect top finishes which is not what one would expect.
Index: procps-3.2.8/top.c
---
top/top.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- top/top.c
+++ top/top.c 2018-04-04 11:33:59.278280201 +0000
@@ -3691,7 +3691,13 @@ static void before (char *me) {
sa.sa_flags = 0;
for (i = SIGRTMAX; i; i--) {
switch (i) {
- case SIGALRM: case SIGHUP: case SIGINT:
+ case SIGHUP:
+ if (Batch)
+ sa.sa_handler = SIG_IGN;
+ else
+ sa.sa_handler = sig_endpgm;
+ break;
+ case SIGALRM: case SIGINT:
case SIGPIPE: case SIGQUIT: case SIGTERM:
case SIGUSR1: case SIGUSR2:
sa.sa_handler = sig_endpgm;

View File

@ -0,0 +1,23 @@
From: Takashi Iwai <tiwai@suse.de>
Subject: Ignore scan_unevictable_pages entry in sysctl, too
References: bnc#868888
scan_unevictable_pages sysctl is deprecated in the recent kernel.
Ignore it for avoiding the kernel warning message.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/sysctl.c | 1 +
1 file changed, 1 insertion(+)
--- a/src/sysctl.c
+++ b/src/sysctl.c
@@ -63,6 +58,7 @@ static const char DEFAULT_PRELOAD[] = "/
static const char *DEPRECATED[] = {
"base_reachable_time",
"retrans_time",
+ "scan_unevictable_pages",
""
};
static bool IgnoreDeprecated;

View File

@ -0,0 +1,27 @@
---
src/top/top.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- src/top/top.c
+++ src/top/top.c 2022-03-29 10:24:43.327490984 +0000
@@ -1684,9 +1684,9 @@ static inline const char *make_str_utf8
static const char *scale_mem (int target, float num, int width, int justr) {
// SK_Kb SK_Mb SK_Gb SK_Tb SK_Pb SK_Eb
#ifdef BOOST_MEMORY
- static const char *fmttab[] = { "%.0f", "%#.1f%c", "%#.3f%c", "%#.3f%c", "%#.3f%c", NULL };
+ static const char *fmttab[] = { "%.0f", "%#.1f%c", "%#.3f%c", "%#.3f%c", "%#.3f%c", "%#.3f%c", NULL };
#else
- static const char *fmttab[] = { "%.0f", "%.1f%c", "%.1f%c", "%.1f%c", "%.1f%c", NULL };
+ static const char *fmttab[] = { "%.0f", "%.1f%c", "%.1f%c", "%.1f%c", "%.1f%c", "%.1f%c", NULL };
#endif
static char buf[SMLBUFSIZ];
char *psfx;
@@ -1696,7 +1696,7 @@ static const char *scale_mem (int target
if (Rc.zero_suppress && 0 >= num)
goto end_justifies;
- for (i = SK_Kb, psfx = Scaled_sfxtab; i < SK_Eb; psfx++, i++) {
+ for (i = SK_Kb, psfx = Scaled_sfxtab; i <= SK_Eb; psfx++, i++) {
if (i >= target
&& (width >= snprintf(buf, sizeof(buf), fmttab[i], num, *psfx)))
goto end_justifies;

View File

@ -0,0 +1,66 @@
---
library/readproc.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
--- library/readproc.c
+++ library/readproc.c 2022-03-28 11:51:04.751862744 +0000
@@ -735,7 +735,7 @@ static int file2str(const char *director
}
len = snprintf(path, sizeof path, "%s/%s", directory, what);
if (len <= 0 || (size_t)len >= sizeof path) return -1;
- if (-1 == (fd = open(path, O_RDONLY, 0))) return -1;
+ if (-1 == (fd = open(path, O_RDONLY, O_NOATIME))) return -1;
while (0 < (num = read(fd, ub->buf + tot_read, ub->siz - tot_read))) {
tot_read += num;
if (tot_read < ub->siz) break;
@@ -759,25 +759,25 @@ static int file2str(const char *director
static char **file2strvec(const char *directory, const char *what) {
char buf[2048]; /* read buf bytes at a time */
char *p, *rbuf = 0, *endbuf, **q, **ret, *strp;
- int fd, tot = 0, n, c, end_of_file = 0;
- int align;
+ int fd, c, end_of_file = 0;
+ ssize_t n, align, tot = 0;
const int len = snprintf(buf, sizeof buf, "%s/%s", directory, what);
if(len <= 0 || (size_t)len >= sizeof buf) return NULL;
- fd = open(buf, O_RDONLY, 0);
+ fd = open(buf, O_RDONLY, O_NOATIME);
if(fd==-1) return NULL;
/* read whole file into a memory buffer, allocating as we go */
while ((n = read(fd, buf, sizeof buf - 1)) >= 0) {
- if (n < (int)(sizeof buf - 1))
+ if (n < (sizeof(buf) - 1))
end_of_file = 1;
- if (n <= 0 && tot <= 0) { /* nothing read now, nothing read before */
+ if (n <= 0 && tot <= 0) /* nothing read now, nothing read before */
break; /* process died between our open and read */
- }
+
/* ARG_LEN is our guesstimated median length of a command-line argument
or environment variable (the minimum is 1, the maximum is 131072) */
#define ARG_LEN 64
- if (tot >= INT_MAX / (ARG_LEN + (int)sizeof(char*)) * ARG_LEN - n) {
+ if (tot >= INT_MAX / (ARG_LEN + sizeof(char*)) * ARG_LEN - n) {
end_of_file = 1; /* integer overflow: null-terminate and break */
n = 0; /* but tot > 0 */
}
@@ -811,7 +811,7 @@ static char **file2strvec(const char *di
c = sizeof(char*); /* one extra for NULL term */
for (p = rbuf; p < endbuf; p++) {
if (!*p || *p == '\n') {
- if (c >= INT_MAX - (tot + (int)sizeof(char*) + align)) break;
+ if (c >= INT_MAX - (tot + sizeof(char*) + align)) break;
c += sizeof(char*);
}
if (*p == '\n')
@@ -824,7 +824,7 @@ static char **file2strvec(const char *di
q = ret = (char**) (endbuf+align); /* ==> free(*ret) to dealloc */
for (strp = p = rbuf; p < endbuf; p++) {
if (!*p) { /* NUL char implies that */
- if (c < 2 * (int)sizeof(char*)) break;
+ if (c < 2 * sizeof(char*)) break;
c -= sizeof(char*);
*q++ = strp; /* point ptrs to the strings */
strp = p+1; /* next string -> next char */

33
procps-ng-3.3.8-tinfo.dif Normal file
View File

@ -0,0 +1,33 @@
---
Makefile.am | 2 +-
configure.ac | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
--- Makefile.am
+++ Makefile.am 2022-10-20 13:21:37.505517043 +0000
@@ -191,7 +191,7 @@ src_top_top_SOURCES += local/strverscmp.
endif
src_top_top_CFLAGS = @NCURSES_CFLAGS@
-src_top_top_LDADD = $(LDADD) @NCURSES_LIBS@ $(DL_LIB)
+src_top_top_LDADD = $(LDADD) @TOP_NCURSES_LIBS@ $(DL_LIB)
endif
if BUILD_SKILL
--- configure.ac
+++ configure.ac 2022-10-20 13:23:50.707138810 +0000
@@ -281,6 +281,14 @@ fi
# else
# WATCH_NCURSES_LIBS="$NCURSES_LIBS"
# fi
+cf_tinfo=""
+AC_CHECK_LIB(tinfo, setupterm, [cf_tinfo="tinfo"])
+if test x$cf_tinfo = xtinfo ; then
+ TOP_NCURSES_LIBS="-ltinfo"
+else
+ TOP_NCURSES_LIBS="$NCURSES_LIBS"
+fi
+AC_SUBST([TOP_NCURSES_LIBS])
AC_ARG_WITH([systemd],
[AS_HELP_STRING([--with-systemd], [enable systemd support])],

View File

@ -0,0 +1,17 @@
---
src/vmstat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- src/vmstat.c
+++ src/vmstat.c 2023-02-08 08:59:05.175343180 +0000
@@ -333,8 +333,8 @@ static void new_header(void)
static unsigned long unitConvert(unsigned long size)
{
- double cvSize;
- cvSize = (double)size / dataUnit * ((statMode == SLABSTAT) ? 1 : 1024);
+ long double cvSize;
+ cvSize = (long double)size / dataUnit * ((statMode == SLABSTAT) ? 1 : 1024);
return ((unsigned long)cvSize);
}

View File

@ -0,0 +1,102 @@
---
procps-ng-4.0.4/man/w.1 | 3 +++
procps-ng-4.0.4/src/w.c | 27 +++++++++++++++++++++++----
2 files changed, 26 insertions(+), 4 deletions(-)
--- procps-ng-4.0.4/man/w.1
+++ procps-ng-4.0.4/man/w.1 2023-11-13 12:22:54.245834105 +0000
@@ -51,6 +51,9 @@ and a
\fB\-s\fR, \fB\-\-short\fR
Use the short format. Don't print the login time, JCPU or PCPU times.
.TP
+\fB\-n\fR, \fB\-\-no\-truncat\fR
+Do not truncate the output format. This option might become renamed in future versions.
+.TP
\fB\-f\fR, \fB\-\-from\fR
Toggle printing the
.B from
--- procps-ng-4.0.4/src/w.c
+++ procps-ng-4.0.4/src/w.c 2023-11-13 12:47:16.843483082 +0000
@@ -218,7 +218,8 @@ static void print_from(
if (r < 0 || host == NULL)
print_host("", 0, fromlen);
else {
- print_host(host, strlen(host), fromlen);
+ print_host(host, strlen(host),
+ fromlen == 0?strlen(host):fromlen);
free(host);
}
} else {
@@ -510,7 +511,7 @@ static int find_best_proc(
static void showinfo(
const char *session, const char *name,
utmp_t * u, const int longform, int maxcmd, int from,
- const int userlen, const int fromlen, const int ip_addresses,
+ int userlen, int fromlen, const int ip_addresses,
const int pids)
{
unsigned long long jcpu, pcpu;
@@ -520,6 +521,7 @@ static void showinfo(
char cmdline[MAX_CMD_WIDTH + 1];
pid_t best_pid = -1;
int pids_length = 0;
+ int utlnlen = 8;
strcpy(cmdline, "-");
@@ -572,7 +574,18 @@ static void showinfo(
/* force NUL term for printf */
uname[UT_NAMESIZE] = '\0';
- printf("%-*.*s%-9.8s", userlen + 1, userlen, uname, tty + 5);
+ if (longform > 1) {
+ userlen = strlen(uname);
+ if (u) {
+ fromlen = strnlen(u->ut_host, UT_HOSTSIZE);
+ utlnlen = strnlen(u->ut_line, UT_LINESIZE);
+ } else {
+ fromlen = 0;
+ utlnlen = strlen (tty+5);
+ }
+ maxcmd = MAX_CMD_WIDTH;
+ }
+ printf("%-*.*s%-*.*s", userlen + 1, userlen, uname, utlnlen + 1, utlnlen, tty+5);
if (from)
print_from(session, NULL, ip_addresses, fromlen);
@@ -643,6 +656,7 @@ static void __attribute__ ((__noreturn__
fputs(_(" -h, --no-header do not print header\n"),out);
fputs(_(" -u, --no-current ignore current process username\n"),out);
fputs(_(" -s, --short short format\n"),out);
+ fputs(_(" -n, --no-truncat non truncated listing (large)\n"),out);
fputs(_(" -f, --from show remote hostname field\n"),out);
fputs(_(" -o, --old-style old style output\n"),out);
fputs(_(" -i, --ip-addr display IP address instead of hostname (if possible)\n"), out);
@@ -681,6 +695,7 @@ int main(int argc, char **argv)
{"no-header", no_argument, NULL, 'h'},
{"no-current", no_argument, NULL, 'u'},
{"short", no_argument, NULL, 's'},
+ {"no-truncat", no_argument, NULL, 'n'},
{"from", no_argument, NULL, 'f'},
{"old-style", no_argument, NULL, 'o'},
{"ip-addr", no_argument, NULL, 'i'},
@@ -703,7 +718,7 @@ int main(int argc, char **argv)
#endif
while ((ch =
- getopt_long(argc, argv, "husfoVip", longopts, NULL)) != -1)
+ getopt_long(argc, argv, "husnfoVip", longopts, NULL)) != -1)
switch (ch) {
case 'h':
header = 0;
@@ -711,6 +726,10 @@ int main(int argc, char **argv)
case 's':
longform = 0;
break;
+ case 'n':
+ longform = 2;
+ header = 0;
+ break;
case 'f':
from = !from;
break;

View File

@ -0,0 +1,14 @@
---
proc/libprocps.sym | 1 +
1 file changed, 1 insertion(+)
--- proc/libprocps.sym
+++ proc/libprocps.sym 2016-07-11 12:45:32.463107052 +0000
@@ -13,6 +13,7 @@ global:
get_ns_id;
get_ns_name;
get_pid_digits;
+ get_proc_stats;
get_slabinfo;
getbtime;
getdiskstat;

View File

@ -0,0 +1,65 @@
---
local/strutils.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
--- local/strutils.c
+++ local/strutils.c 2021-02-09 10:11:25.000000000 +0000
@@ -20,6 +20,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+#include <float.h>
+#include <math.h>
#include <stdlib.h>
#include <ctype.h>
@@ -71,9 +73,9 @@ double strtod_or_err(const char *str, co
*/
double strtod_nol_or_err(char *str, const char *errmesg)
{
- double num;
+ long double num;
const char *cp, *radix;
- double mult;
+ long double mult;
int negative = 0;
if (str != NULL && *str != '\0') {
@@ -95,29 +97,29 @@ double strtod_nol_or_err(char *str, cons
mult=0.1;
while(isdigit(*radix)) {
radix++;
- mult *= 10;
+ mult *= 10.0;
}
while(isdigit(*cp)) {
- num += (*cp - '0') * mult;
- mult /= 10;
+ num += (long double)(*cp - '0') * mult;
+ mult /= 10.0;
cp++;
}
/* got the integers */
if (*cp == '\0')
- return (negative?-num:num);
+ return (double)(negative?-num:num);
if (*cp != '.' && *cp != ',')
error(EXIT_FAILURE, EINVAL, "%s: '%s'", errmesg, str);
cp++;
mult = 0.1;
while(isdigit(*cp)) {
- num += (*cp - '0') * mult;
- mult /= 10;
+ num += (long double)(*cp - '0') * mult;
+ mult /= 10.0;
cp++;
}
if (*cp == '\0')
- return (negative?-num:num);
+ return (double)(negative?-num:num);
}
error(EXIT_FAILURE, errno, "%s: '%s'", errmesg, str);
- return 0;
+ return (double)0;
}

View File

@ -0,0 +1,26 @@
---
library/meminfo.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- library/meminfo.c
+++ library/meminfo.c 2022-03-29 09:50:45.076823155 +0000
@@ -710,7 +710,9 @@ static int meminfo_read_failed (
mHr(derived_mem_used) = (unsigned long)mem_used;
if (mHr(HighFree) < mHr(HighTotal))
- mHr(derived_mem_hi_used) = mHr(HighTotal) - mHr(HighFree);
+ mHr(derived_mem_hi_used) = mHr(HighTotal) - mHr(HighFree);
+ else
+ mHr(derived_mem_hi_used) = 0;
if (0 == mHr(LowTotal)) {
mHr(LowTotal) = mHr(MemTotal);
@@ -718,6 +720,8 @@ static int meminfo_read_failed (
}
if (mHr(LowFree) < mHr(LowTotal))
mHr(derived_mem_lo_used) = mHr(LowTotal) - mHr(LowFree);
+ else
+ mHr(derived_mem_lo_used) = 0;
if (mHr(SwapFree) < mHr(SwapTotal))
mHr(derived_swap_used) = mHr(SwapTotal) - mHr(SwapFree);

View File

@ -0,0 +1,15 @@
---
src/sysctl.c | 2 ++
1 file changed, 2 insertions(+)
--- src/sysctl.c
+++ src/sysctl.c 2023-12-14 13:46:09.181625220 +0000
@@ -772,6 +772,8 @@ static int Preload(SettingList *setlist,
fp = (globbuf.gl_pathv[j][0] == '-' && !globbuf.gl_pathv[j][1])
? stdin : fopen(globbuf.gl_pathv[j], "r");
if (!fp) {
+ if (strcmp ("/usr/lib/sysctl.d/99-sysctl.conf", globbuf.gl_pathv[j]) == 0)
+ continue;
xwarn(_("cannot open \"%s\""), globbuf.gl_pathv[j]);
return EXIT_FAILURE;
}

View File

@ -0,0 +1,38 @@
---
testsuite/pmap.test/pmap.exp | 25 -------------------------
1 file changed, 25 deletions(-)
--- testsuite/pmap.test/pmap.exp
+++ testsuite/pmap.test/pmap.exp 2023-11-15 15:34:02.613151770 +0000
@@ -69,31 +69,6 @@ if { [ file readable "/proc/self/smaps"
expect_pass $test "$pmap_initname\$"
}
-
-proc expect_twice_total { test } {
- set totkb 0
- expect {
- -re "\r\n\\s+(\\d+)\[0-9 \]*KB" {
- set totkb $expect_out(1,string)
- expect {
- -re "\r\n\\s+$totkb\[0-9 \]*KB" { pass "$test" }
- eof { fail "$test" }
- timeout { fail "$test" }
- }
- }
- eof { fail "$test" }
- timeout { fail "$test" }
- }
-}
-
-set test "pmap X pid pid has same total"
-spawn $pmap -X $mypid $mypid
-expect_twice_total "$test"
-
-set test "pmap XX pid pid has same total"
-spawn $pmap -XX $mypid $mypid
-expect_twice_total "$test"
-
set test "pmap finding shm"
make_testshm_proc
if { $shmid == "" } {

BIN
procps-ng-4.0.4.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEXT3w9TizJ8CqeneiAiFmwP88hOMFAmTwbLAACgkQAiFmwP88
hONNRg//a6SXHpenZGCpz6bu6qL6UVGGbanjXOCVzEo0eMwX7/b/Pk3r/wLmtP+a
zpfjYVxyLHakeN4gThphLp01SnkuOmFoqXZBe8XZUQTbRm1BMBmmAi7E8GamDJbw
TgpAIW1qKZPgYRMKB1nSxA5a0OCoM1t8ntXrZdau72LoEnGwuEJEeV4F8GmjZnd/
2XIocwuz3xlm7/ByziZ7GuRqibCs+crhBO3vk120LSCRBCNfoS1uSMrdodO95vpX
EMYCYYMomxOYxq2p1gHDQ+KtEy61zDJ9LbMvzs+9TpHy5Ihw+wXNYu8CQmJIIlnT
7gLoAxhl4Ix0QoyUSgvAu7ANYyndFrz7KBPkOCC/2Ig6BJJzf+YEzWSs1QTh2Lld
vKEDjwqc9UiGW/2yKc0rAmeO1EiQf9dyOe+Sray5OiyLUTtoTUxVLSlXiMwsBWiK
E6dtebUIfxm5uxN5z6Ysmcx+hlxbSVPZkjdWG1W8LQdECsNR8/pPO14VpBYZjvSC
MAvzmONM3FSryxw3y5AeuQLS4lrNw+XuG4y8q7zisBtW7RzS9HkM0yFPco5DlnYm
DlMpnY4PIAltZTO2secnV12CdDljVZ6GjoJqnmLKhM6H4M3H/p3oFiZEIvgd2bKK
D/PV9XZJF1/wnNMxBUgJ9cQuqlh013UOuwUzxJ11q9uDj63n9do=
=XLqg
-----END PGP SIGNATURE-----

2
procps-rpmlintrc Normal file
View File

@ -0,0 +1,2 @@
addFilter(".*W:.*shared-lib-calls-exit.*libproc2\.so.*")
addFilter(".*W:.*macro-in-comment.*%{version}.*")

61
procps-v3.3.3-columns.dif Normal file
View File

@ -0,0 +1,61 @@
---
ps/global.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
--- src/ps/global.c
+++ src/ps/global.c 2022-03-29 09:31:24.242140877 +0000
@@ -264,8 +264,11 @@ static void set_screen_size(void){
screen_cols = ws.ws_col; // hmmm, NetBSD subtracts 1
screen_rows = ws.ws_row;
- // TODO: delete this line
- if(!isatty(STDOUT_FILENO)) screen_cols = OUTBUF_SIZE;
+ if(!isatty(STDOUT_FILENO)){
+ screen_cols = OUTBUF_SIZE;
+ screen_rows = OUTBUF_SIZE;
+ if (personality&PER_UNIX_COLS) return; // SysV/UNIX98 based personality
+ }
columns = getenv("COLUMNS");
if(columns && *columns){
@@ -407,6 +410,7 @@ static const char *set_personality(void)
return NULL;
case_aix:
+ personality |= PER_UNIX_COLS;
bsd_j_format = "FB_j";
bsd_l_format = "FB_l";
/* bsd_s_format not used */
@@ -434,6 +438,7 @@ static const char *set_personality(void)
case_sunos4:
personality = PER_NO_DEFAULT_g;
+ personality |= PER_UNIX_COLS;
prefer_bsd_defaults = 1;
bsd_j_format = "FB_j";
bsd_l_format = "FB_l";
@@ -459,12 +464,14 @@ static const char *set_personality(void)
case_hp:
case_hpux:
personality = PER_HPUX_x;
+ personality |= PER_UNIX_COLS;
return NULL;
case_svr4:
case_sysv:
case_sco:
personality = PER_SVR4_x;
+ personality |= PER_UNIX_COLS;
return NULL;
case_posix:
@@ -505,8 +512,8 @@ void reset_global(void){
}
// --- <pids> interface --------------------------------------------------
- set_screen_size();
set_personality();
+ set_screen_size();
all_processes = 0;
bsd_c_option = 0;

13
procps-v3.3.3-ia64.diff Normal file
View File

@ -0,0 +1,13 @@
--- library/devname.c
+++ library/devname.c 2012-06-01 13:35:43.452010553 +0000
@@ -50,6 +50,10 @@
#define minor(d) ( ((unsigned)(d)&0xffu) | (((unsigned)(d)&0xfff00000u)>>12u) )
#endif
+#ifndef PAGE_SIZE
+# define PAGE_SIZE (sysconf(_SC_PAGESIZE))
+#endif
+
typedef struct tty_map_node {
struct tty_map_node *next;
unsigned short devfs_type; // bool

14
procps-v3.3.3-pwdx.patch Normal file
View File

@ -0,0 +1,14 @@
---
src/pwdx.c | 1 +
1 file changed, 1 insertion(+)
--- src/pwdx.c
+++ src/pwdx.c 2016-07-11 13:17:16.154313659 +0000
@@ -113,6 +113,7 @@ int main(int argc, char *argv[])
buflen = 10 + strlen(argv[i]) + 1;
buf = xmalloc(buflen);
+ errno = 0;
if (check_pid_argument(argv[i]))
xerrx(EXIT_FAILURE, _("invalid process id: %s"),
argv[i]);

View File

@ -0,0 +1,51 @@
---
man/sysctl.8 | 2 ++
src/sysctl.c | 12 ++++++++++++
2 files changed, 14 insertions(+)
--- man/sysctl.8
+++ man/sysctl.8 2022-03-29 10:21:47.926686046 +0000
@@ -123,6 +123,8 @@ will read files from directories in the
order from top to bottom. Once a file of a given filename is loaded, any
file of the same name in subsequent directories is ignored.
+/boot/sysctl.conf-<kernelversion>
+.br
/etc/sysctl.d/*.conf
.br
/run/sysctl.d/*.conf
--- src/sysctl.c
+++ src/sysctl.c 2022-03-29 10:20:51.795708321 +0000
@@ -45,6 +45,7 @@
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/utsname.h>
#include <unistd.h>
#include <ctype.h>
@@ -808,6 +809,7 @@ static int sortpairs(const void *A, cons
static int PreloadSystem(SettingList *setlist)
{
unsigned di, i;
+ struct utsname uts;
const char *dirs[] = {
"/etc/sysctl.d",
"/run/sysctl.d",
@@ -872,6 +874,16 @@ static int PreloadSystem(SettingList *se
}
qsort(cfgs, ncfgs, sizeof(struct cfg *), sortpairs);
+ if (uname(&uts) == 0) {
+ char buf[PATH_MAX];
+ snprintf(buf, sizeof(buf), "/boot/sysctl.conf-%s", uts.release);
+ if (access(buf, R_OK) == 0) {
+ if (!Quiet)
+ printf("* Applying %s ...\n", buf);
+ Preload(setlist, buf);
+ }
+ }
+
for (i = 0; i < ncfgs; ++i) {
if (!Quiet)
printf(_("* Applying %s ...\n"), cfgs[i]->value);

2263
procps.changes Normal file

File diff suppressed because it is too large Load Diff

170
procps.keyring Normal file
View File

@ -0,0 +1,170 @@
-----BEGIN PGP PUBLIC K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6ErDhF1mJC2ZldjGHp
Nf8Hmmfe0suEJt9jOF0b577DdAuZ5MIDSfYjlq7YIdVdp8stHmiivMw=
=enAj
-----END PGP PUBLIC KEY BLOCK-----

419
procps.spec Normal file
View File

@ -0,0 +1,419 @@
#
# spec file for package procps
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define somajor 0
%define libname libproc2-%{somajor}
%if 0%{?suse_version} < 1550
%bcond_with bin2usr
%else
%bcond_without bin2usr
%endif
%bcond_without pidof
%bcond_without nls
Name: procps
Version: 4.0.4
Release: 0
Summary: The ps utilities for /proc
License: GPL-2.0-or-later AND LGPL-2.1-or-later
Group: System/Monitoring
URL: https://sf.net/projects/procps-ng/
Source: https://downloads.sourceforge.net/project/procps-ng/Production/procps-ng-%{version}.tar.xz
Source1: https://downloads.sourceforge.net/project/procps-ng/Production/procps-ng-%{version}.tar.xz.asc
#Alternate: https://gitlab.com/procps-ng/procps/-/archive/v%{version}/procps-v%{version}.tar.gz
Source2: procps-rpmlintrc
Source3: procps.keyring
# PATCH-FIX-USTREAM -- w: Don't crash when using short option
Patch0: 79042e07.patch
Patch1: procps-v3.3.3-ia64.diff
Patch3: procps-ng-3.3.9-w-notruncate.diff
Patch7: procps-ng-3.3.8-readeof.patch
Patch8: procps-ng-3.3.10-slab.patch
Patch11: procps-ng-3.3.10-xen.dif
Patch13: procps-v3.3.3-columns.dif
Patch14: procps-ng-4.0.0-integer-overflow.patch
Patch17: procps-v3.3.3-read-sysctls-also-from-boot-sysctl.conf-kernelversion.diff
Patch18: procps-ng-3.3.8-petabytes.patch
Patch20: procps-ng-3.3.8-tinfo.dif
Patch21: procps-v3.3.3-pwdx.patch
# PATCH-FIX-OPENSUSE -- trifle rest of the old terabyte patch
Patch28: procps-ng-3.3.8-vmstat-terabyte.dif
# PATCH-FIX-SUSE -- Ignore scan_unevictable_pages in sysctl
Patch31: procps-ng-3.3.8-ignore-scan_unevictable_pages.patch
# PATCH-FIX-SUSE -- Avoid errno set by setlocale()
Patch32: procps-ng-3.3.10-errno.patch
# PATCH-FEATURE-SUSE -- Let upstream pmap behave similar to old suse pmap
Patch33: procps-ng-3.3.11-pmap4suse.patch
# PATCH-FIX-SUSE -- Avoid float errors on 32bit architectures
Patch37: procps-ng-4.0.0-floats.dif
# PATCH-FIX-SUSE -- with 4.0.4 the totals on -X option are always reset for each pid
Patch38: procps-ng-4.0.4-pmapX-not-twice-anymore.patch
# PATCH-FIX-SUSE -- ignore dangling symlink to missing /etc/sysctl.conf file
Patch39: procps-ng-4.0.4-ignore-sysctl_conf.patch
BuildRequires: automake
BuildRequires: dejagnu
BuildRequires: diffutils
BuildRequires: libnuma-devel
BuildRequires: libselinux-devel
BuildRequires: libtool
BuildRequires: ncurses-devel
BuildRequires: pkgconfig
BuildRequires: screen
BuildRequires: xz
BuildRequires: pkgconfig(libsystemd)
Provides: procps4 = %{version}
Obsoletes: procps4 <= 4.0.4
Provides: ps = %{version}-%{release}
Obsoletes: ps < %{version}-%{release}
%description
The procps package contains a set of system utilities that provide
system information. Procps includes ps, free, skill, snice, tload, top,
uptime, vmstat, w, and watch. The ps command displays a snapshot of
running processes. The top command provides a repetitive update of the
statuses of running processes. The free command displays the amounts of
free and used memory on your system. The skill command sends a
terminate command (or another specified signal) to a specified set of
processes. The snice command is used to change the scheduling priority
of specified processes. The tload command prints a graph of the current
system load average to a specified tty. The uptime command displays the
current time, how long the system has been running, how many users are
logged on, and system load averages for the past one, five, and fifteen
minutes. The w command displays a list of the users who are currently
logged on and what they are running. The watch program watches a
running program. The vmstat command displays virtual memory statistics
about processes, memory, paging, block I/O, traps, and CPU activity.
%package lang
Summary: Translations for package %{name}
Group: System/Localization
Requires: %{name} = %{version}
Provides: %{name}-lang-all = %{version}
Obsoletes: procps4-lang <= 4.0.4
BuildArch: noarch
%description lang
Provides translations for the "%{name}" package.
%package devel
Summary: Development files for procps
License: GPL-2.0-or-later AND LGPL-2.1-or-later
Group: Development/Libraries/C and C++
Requires: %{libname} = %{version}
Obsoletes: procps4-devel <= 4.0.4
%description devel
The procps library can be used to read informations out from /proc
the process information pseudo-file system.
This subpackage contains the header files for libprocps.
%package -n %{libname}
Summary: The procps library
License: LGPL-2.1-or-later
Group: System/Libraries
%description -n %{libname}
The procps library can be used to read informations out from /proc
the process information pseudo-file system.
%prep
%setup -q -n procps-ng-%{version}
%patch -P0 -p1
%patch -P1
%patch -P3 -p1 -b .trcate
%patch -P7 -b .rof
%patch -P8 -b .cache
%patch -P11
%patch -P13 -b .column
%patch -P14 -b .ovrflw
%patch -P17 -b .sysctl
%patch -P18
%patch -P20 -b .p20
%patch -P21
%patch -P28
%patch -P31 -p1
%patch -P32 -b .p32
%patch -P33 -b .pmap4us
%patch -P37
%patch -P38
%patch -P39
%build
test -s .tarball-version || echo %{version} > .tarball-version
if test -f po/Makefile.in.in
then
autoreconf -fiv
else
sh ./autogen.sh
fi
major=$(sed -rn 's/^#define\s+NCURSES_VERSION_MAJOR\s+([0-9]+)/\1/p' %{_includedir}/ncurses.h)
export NCURSESW_CFLAGS="$(ncursesw${major}-config --cflags)"
export NCURSESW_LIBS="$(ncursesw${major}-config --libs)"
export LFS_CFLAGS="$(getconf LFS_CFLAGS)"
%global optflags %{optflags} -D_GNU_SOURCE $LFS_CFLAGS -DCPU_ZEROTICS -DUSE_X_COLHDR -pipe
%configure \
--disable-static \
%if !%{with nls}
--disable-nls \
%endif
--disable-rpath \
--disable-kill \
%if !%{with pidof}
--disable-pidof \
%endif
--enable-watch8bit \
--enable-shared \
--enable-skill \
--enable-w-from \
--enable-sigwinch \
--enable-wide-percent \
--enable-wide-memory \
--enable-w-from \
--enable-libselinux \
--with-pic=yes \
--with-systemd \
--with-gnu-ld \
--disable-modern-top
%make_build
LD_LIBRARY_PATH=$PWD/proc/.libs \
./src/pmap $$ || {
uname -a
echo /proc/$$/maps
cat /proc/$$/maps
echo /proc/$$/smaps
cat /proc/$$/smaps
exit 1
}
%install
%make_install
install -d %{buildroot}/bin
install -d %{buildroot}/sbin
# clean unwanted files (e.g. coreutils)
rm -f %{buildroot}%{_bindir}/kill
rm -f %{buildroot}%{_bindir}/uptime
rm -f %{buildroot}%{_mandir}/man1/kill.1
rm -f %{buildroot}%{_mandir}/*/man1/kill.1
rm -f %{buildroot}%{_mandir}/man1/uptime.1
rm -f %{buildroot}%{_mandir}/*/man1/uptime.1
find %{buildroot} -type f -name "*.la" -delete -print
rm -rf %{buildroot}%{_datadir}/doc/procps-ng
if cmp -s %{buildroot}%{_mandir}/man1/pidwait.1 %{buildroot}%{_mandir}/man1/pkill.1
then
rm -vf %{buildroot}%{_mandir}/man1/pidwait.1
(cat > %{buildroot}%{_mandir}/man1/pidwait.1)<<-'EOF'
.so man1/pkill.1
EOF
fi
%if %{with bin2usr}
#
# Identical binaries
#
if cmp -s %{buildroot}/%{_bindir}/pgrep %{buildroot}/%{_bindir}/pkill
then
rm -vf %{buildroot}/%{_bindir}/pkill
pushd %{buildroot}/%{_bindir}
ln pgrep pkill
popd
fi
if cmp -s %{buildroot}/%{_bindir}/snice %{buildroot}/%{_bindir}/skill
then
rm -vf %{buildroot}/%{_bindir}/skill
pushd %{buildroot}/%{_bindir}
ln snice skill
popd
fi
%if 0%{?suse_version} < 1550
ln -s %{_bindir}/ps %{buildroot}/bin/
ln -s %{_bindir}/pgrep %{buildroot}/bin/
ln -s %{_bindir}/pkill %{buildroot}/bin/
ln -s %{_sbindir}/sysctl %{buildroot}/sbin/
%endif
%else
mv %{buildroot}%{_bindir}/ps %{buildroot}/bin/
mv %{buildroot}%{_bindir}/pgrep %{buildroot}/bin/
mv %{buildroot}%{_bindir}/pkill %{buildroot}/bin/
mv %{buildroot}%{_sbindir}/sysctl %{buildroot}/sbin/
#
# Identical binaries
#
if cmp -s %{buildroot}/bin/pgrep %{buildroot}/bin/pkill
then
rm -vf %{buildroot}/bin/pkill
pushd %{buildroot}/bin
ln pgrep pkill
popd
fi
if cmp -s %{buildroot}/%{_bindir}/snice %{buildroot}/%{_bindir}/skill
then
rm -vf %{buildroot}/%{_bindir}/skill
pushd %{buildroot}/%{_bindir}
ln snice skill
popd
fi
ln -s /bin/ps %{buildroot}%{_bindir}/ps
ln -s /bin/pgrep %{buildroot}%{_bindir}/pgrep
ln -s /bin/pkill %{buildroot}%{_bindir}/pkill
ln -s /sbin/sysctl %{buildroot}%{_sbindir}/sysctl
%endif
%find_lang procps-ng --with-man --all-name
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%check
set +x
ls -ld /proc/[a-z]*
cat /proc/stat
set -x
#
# Skip w test as there is no valid utmp
#
rm -rvf testsuite/w.test
#
# Provide a tty for testing
#
LANG=POSIX
LC_ALL=$LANG
unset LC_CTYPE
TMPDIR=$(mktemp -d /tmp/bash.XXXXXXXXXX) || exit 1
SCREENDIR=$(mktemp -d ${PWD}/screen.XXXXXX) || exit 1
SCREENRC=${SCREENDIR}/bash
export SCREENRC SCREENDIR
exec 0< /dev/null
SCREENLOG=${SCREENDIR}/log
> $SCREENLOG
cat > $SCREENRC<<-EOF
deflogin off
deflog on
logfile $SCREENLOG
logfile flush 1
logtstamp off
log on
setsid on
scrollback 0
silence on
utf8 on
EOF
tail -q -s 0.5 -f $SCREENLOG & pid=$!
env HOME=$PWD TERM=$TERM TMPDIR=$TMPDIR SCREENRC=$SCREENRC SCREENDIR=$SCREENDIR \
screen -D -m make check
sleep 1
kill -TERM $pid
error=no
for log in testsuite/*.log test-suite.log
do
if grep -E '^(XFAIL|FAIL|ERROR):' $log
then
echo Check $log
cat $log
error=yes
fi
done
%if 0%{?qemu_user_space_build}
if test -x /usr/bin/qemu-%_build_arch
then
echo Do not fail as pgrep as well as ps will find unexpected qemu-%_build_arch on command lines
exit 0
fi
%endif
test $error = no || exit 1
%files
%defattr (-,root,root,755)
%license COPYING COPYING.LIB
%doc NEWS doc/bugs.md doc/FAQ
%if %{with bin2usr}
%if 0%{?suse_version} < 1550
%verify(link) /bin/ps
%verify(link) /bin/pgrep
%verify(link) /bin/pkill
%verify(link) /sbin/sysctl
%endif
%{_bindir}/ps
%{_bindir}/pgrep
%{_bindir}/pkill
%{_sbindir}/sysctl
%else
/bin/ps
/bin/pgrep
/bin/pkill
/sbin/sysctl
%verify(link) %{_bindir}/ps
%verify(link) %{_bindir}/pgrep
%verify(link) %{_bindir}/pkill
%verify(link) %{_sbindir}/sysctl
%endif
%{_bindir}/free
%if %{with pidof}
%{_bindir}/pidof
%endif
%{_bindir}/pmap
%{_bindir}/pidwait
%{_bindir}/pwdx
%{_bindir}/skill
%{_bindir}/slabtop
%{_bindir}/snice
%{_bindir}/tload
%{_bindir}/top
%{_bindir}/vmstat
%{_bindir}/w
%{_bindir}/watch
%{_mandir}/man1/free.1%{?ext_man}
%{_mandir}/man1/pgrep.1%{?ext_man}
%if %{with pidof}
%{_mandir}/man1/pidof.1%{?ext_man}
%endif
%{_mandir}/man1/pkill.1%{?ext_man}
%{_mandir}/man1/pmap.1%{?ext_man}
%{_mandir}/man1/ps.1%{?ext_man}
%{_mandir}/man1/pidwait.1%{?ext_man}
%{_mandir}/man1/pwdx.1%{?ext_man}
%{_mandir}/man1/skill.1%{?ext_man}
%{_mandir}/man1/slabtop.1%{?ext_man}
%{_mandir}/man1/snice.1%{?ext_man}
%{_mandir}/man1/tload.1%{?ext_man}
%{_mandir}/man1/top.1%{?ext_man}
%{_mandir}/man1/w.1%{?ext_man}
%{_mandir}/man1/watch.1%{?ext_man}
%{_mandir}/man5/sysctl.conf.5%{?ext_man}
%{_mandir}/man8/vmstat.8%{?ext_man}
%{_mandir}/man8/sysctl.8%{?ext_man}
%files devel
%defattr (-,root,root,755)
%dir %{_includedir}/libproc2/
%{_includedir}/libproc2/*.h
%{_libdir}/libproc2.so
%{_libdir}/pkgconfig/libproc2.pc
%{_mandir}/man3/procps.3%{?ext_man}
%{_mandir}/man3/procps_misc.3%{?ext_man}
%{_mandir}/man3/procps_pids.3%{?ext_man}
%files -n %{libname}
%defattr (-,root,root,755)
%{_libdir}/libproc2.so.%{somajor}*
%files lang -f procps-ng.lang
%changelog