OBS User unknown 2006-12-18 23:17:32 +00:00 committed by Git OBS Bridge
parent 35c8aad19b
commit d7c05a2c66
47 changed files with 1769 additions and 3105 deletions

View File

@ -1,49 +0,0 @@
From 067a56a080732cb265e78e54deb0a7832d73ea5a Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Tue, 29 Mar 2022 00:00:00 -0500
Subject: [PATCH 1/3] top: update one function prologue after rcfile changes
When top's rcfile was reorganized, trading that 'char'
based field representation for the 'int' scheme, there
was a function prologue that should have been changed.
Thus, this patch will correct that original oversight.
Reference(s):
. Mar, 2022 - rcfile reorganized
commit 46aa96e438435628810b33d20cb1c14dc33dd84f
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/top/top.c b/top/top.c
index 04cf084b..110bea8f 100644
--- a/top/top.c
+++ b/top/top.c
@@ -3981,14 +3981,14 @@ static int configs_path (const char *const fmts, ...) {
* 1. 'SYS_RCRESTRICT' contains two lines consisting of the secure
* mode switch and an update interval. Its presence limits what
* ordinary users are allowed to do.
- * 2. 'Rc_name' contains multiple lines - 3 global + 3 per window.
- * line 1 : an eyecatcher and creating program/alias name
- * line 2 : an id, Mode_altcsr, Mode_irixps, Delay_time, Curwin.
+ * 2. 'Rc_name' contains multiple lines - both global & per window.
+ * line 1 : an eyecatcher and creating program/alias name
+ * line 2 : an id, Mode_altcsr, Mode_irixps, Delay_time, Curwin.
* For each of the 4 windows:
- * line a: contains w->winname, fieldscur
- * line b: contains w->winflags, sortindx, maxtasks, etc
- * line c: contains w->summclr, msgsclr, headclr, taskclr
- * line 15 : miscellaneous additional global settings
+ * lines a: contains w->winname, fieldscur
+ * line b: contains w->winflags, sortindx, maxtasks, etc
+ * line c: contains w->summclr, msgsclr, headclr, taskclr
+ * global : miscellaneous additional settings
* Any remaining lines are devoted to the optional entries
* supporting the 'Other Filter' and 'Inspect' provisions.
* 3. 'SYS_RCDEFAULTS' system-wide defaults if 'Rc_name' absent
--
2.32.0

View File

@ -1,79 +0,0 @@
From 5e9956b9386d88a323c5b114f7b5a9faa90dfdba Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Wed, 30 Mar 2022 12:00:00 -0500
Subject: [PATCH 2/3] ps: restore aix behavior while keeping an original fix
The commit shown below broke the aix behavior that Dr.
Fink recently reported. However, in the proposed patch
the old behavior, showing garbage when '%cpu' was used
with an invalid formatting option, would appear again.
So this patch, based on Werner's patch, goes the extra
distance to prevent that. Along the way we'll disallow
commas in the aix format str to prevent their display.
Reference(s):
https://www.freelists.org/post/procps/Procpsng-400-released-with-newlib,2
. Mar, 2022 - where aix bug was introduced
commit 81df85a1b528d4edb9ab98b37fb6c6244430b6c4
Prototyped-by: Dr. Werner Fink <werner@suse.de>
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
ps/display.c | 2 +-
ps/sortformat.c | 10 ++++++----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/ps/display.c b/ps/display.c
index 11c3a832..75c7d926 100644
--- a/ps/display.c
+++ b/ps/display.c
@@ -592,7 +592,7 @@ static void finalize_stacks (void)
// now accommodate any results not yet satisfied
f_node = format_list;
while (f_node) {
- (*f_node->pr)(NULL, NULL);
+ if (*f_node->pr) (*f_node->pr)(NULL, NULL);
f_node = f_node->next;
}
s_node = sort_list;
diff --git a/ps/sortformat.c b/ps/sortformat.c
index 2293aa95..965219c2 100644
--- a/ps/sortformat.c
+++ b/ps/sortformat.c
@@ -132,17 +132,20 @@ static const char *aix_format_parse(sf_node *sfn){
c = *walk++;
if(c=='%') goto get_desc;
if(!c) goto looks_ok;
+ if(c==',') goto aix_oops;
/* get_text: */
items++;
- get_more_text:
+ get_more:
c = *walk++;
if(c=='%') goto get_desc;
- if(c) goto get_more_text;
+ if(c==' ') goto get_more;
+ if(c) goto aix_oops;
goto looks_ok;
get_desc:
items++;
c = *walk++;
if(c) goto initial;
+ aix_oops:
return _("improper AIX field descriptor");
looks_ok:
;
@@ -313,8 +316,7 @@ static const char *format_parse(sf_node *sfn){
if(0) improper: err=_("improper format list");
if(0) badwidth: err=_("column widths must be unsigned decimal numbers");
if(0) notmacro: err=_("can not set width for a macro (multi-column) format specifier");
- if (!err)
- if(strchr(sfn->sf,'%')) err = aix_format_parse(sfn);
+ if(strchr(sfn->sf,'%')) err = aix_format_parse(sfn);
return err;
}
--
2.32.0

View File

@ -1,37 +0,0 @@
From cb945cf3056cf6140554d54efa21436cfffdfba3 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Wed, 30 Mar 2022 12:00:00 -0500
Subject: [PATCH 3/3] ps: restore thread display when using a pidlist option
This commit will once again display threads when using
the -L option along with any of those pidlist options.
Reference(s):
https://gitlab.com/procps-ng/procps/-/issues/234
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
ps/display.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/ps/display.c b/ps/display.c
index 75c7d926..2e1cc665 100644
--- a/ps/display.c
+++ b/ps/display.c
@@ -289,9 +289,12 @@ static void simple_spew(void){
// -q option (only single SEL_PID_QUICK typecode entry expected in the list, if present)
if (selection_list && selection_list->typecode == SEL_PID_QUICK) {
unsigned *pidlist = xcalloc(selection_list->n, sizeof(unsigned));
+ enum pids_select_type which;
for (i = 0; i < selection_list->n; i++)
pidlist[i] = selection_list->u[selection_list->n-i-1].pid;
- pidread = procps_pids_select(Pids_info, pidlist, selection_list->n, PIDS_SELECT_PID);
+ which = (thread_flags & (TF_loose_tasks|TF_show_task))
+ ? PIDS_SELECT_PID_THREADS : PIDS_SELECT_PID;
+ pidread = procps_pids_select(Pids_info, pidlist, selection_list->n, which);
free(pidlist);
} else {
enum pids_fetch_type which;
--
2.32.0

53
boot.sysctl Normal file
View File

@ -0,0 +1,53 @@
#! /bin/sh
#
# Copyright (c) 2001 SuSE GmbH Nuernberg, Germany. All rights reserved.
#
# /etc/init.d/boot.sysctl
#
### BEGIN INIT INFO
# Provides: boot.sysctl
# Should-Start: setserial boot.isapnp $local_fs
# Required-Stop:
# Default-Start: B
# Default-Stop:
# Description: run sysctl with a given config file or create it
### END INIT INFO
. /etc/rc.status
. /etc/sysconfig/sysctl
rc_reset
case "$1" in
start)
#
# run sysctl if the config file exists
# otherwise generate it
# the values set here might be overridden by the settings
# in /etc/sysconfig/sysctl
#
if [ -x /sbin/sysctl ] ; then
if [ ! -e /etc/sysctl.conf ]; then
echo -n "Sysctl: no file /etc/sysctl.conf"
rc_failed 5
else
echo "Setting current sysctl status from /etc/sysctl.conf"
sysctl -e -p /etc/sysctl.conf
fi
rc_status -v -r
fi
;;
stop)
# skip / do nothing
;;
status)
rc_failed 4
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status}"
exit 1
;;
esac
rc_exit

20
procps-3.2.2-100cpus.diff Normal file
View File

@ -0,0 +1,20 @@
--- procps-3.2.5/top.c
+++ procps-3.2.5/top.c
@@ -1168,7 +1168,7 @@
{ "GgGg", " TTY ", " %-8.8s", 8, -1, SF(TTY), "Controlling Tty", L_stat },
{ "HhHh", " PR", " %3d", -1, -1, SF(PRI), "Priority", L_stat },
{ "IiIi", " NI", " %3d", -1, -1, SF(NCE), "Nice value", L_stat },
- { "JjYy", " #C", " %2u", -1, -1, SF(CPN), "Last used cpu (SMP)", L_stat },
+ { "JjYy", " #C", " %3u", -1, -1, SF(CPN), "Last used cpu (SMP)", L_stat },
{ "KkEe", " %CPU", " %#4.1f", -1, -1, SF(CPU), "CPU usage", L_stat },
{ "LlWw", " TIME", " %6.6s", 6, -1, SF(TME), "CPU Time", L_stat },
{ "MmRr", " TIME+ ", " %9.9s", 9, -1, SF(TME), "CPU Time, hundredths", L_stat },
@@ -1192,7 +1192,7 @@
{ "..Qq", " A", " %4.4s", 4, SK_no, SF(PID), "Accessed Page count", L_stat },
{ "..Nn", " TRS", " %4.4s", 4, SK_Kb, SF(PID), "Code in memory (kb)", L_stat },
{ "..Rr", " WP", " %4.4s", 4, SK_no, SF(PID), "Unwritable Pages", L_stat },
- { "Jj[{", " #C", " %2u", -1, -1, SF(CPN), "Last used cpu (SMP)", L_stat },
+ { "Jj[{", " #C", " %3u", -1, -1, SF(CPN), "Last used cpu (SMP)", L_stat },
{ "..\\|"," Bad", " %2u", -1, -1, SF(CPN), "-- must ignore | --", 0 },
{ "..]}", " Bad", " %2u", -1, -1, SF(CPN), "-- not used --", 0 },
{ "..^~", " Bad", " %2u", -1, -1, SF(CPN), "-- not used --", 0 },

13
procps-3.2.2-ia64.diff Normal file
View File

@ -0,0 +1,13 @@
--- procps-3.2.5/proc/devname.c
+++ procps-3.2.5/proc/devname.c
@@ -42,6 +42,10 @@
#define major <-- do not use -->
#define minor <-- do not use -->
#endif
+#ifdef __ia64__
+#undef PAGE_SIZE
+#define PAGE_SIZE (64*1024)
+#endif
typedef struct tty_map_node {
struct tty_map_node *next;

View File

@ -0,0 +1,10 @@
--- procps-3.2.5/top.h
+++ procps-3.2.5/top.h
@@ -132,6 +132,7 @@
#define _PUFF(fmt,arg...) \
do { \
char _str[ROWBUFSIZ]; \
+ if (Pseudo_row >= Screen_rows-1) break; \
int _len = 1 + snprintf(_str, sizeof(_str), fmt, ## arg); \
putp ( Batch ? _str : \
({ \

View File

@ -0,0 +1,87 @@
Only in procps-3.2.0/proc: .depend
Only in procps-3.2.0/proc: alloc.o
Only in procps-3.2.0/proc: devname.o
Only in procps-3.2.0/proc: escape.o
Only in procps-3.2.0/proc: ksym.o
Only in procps-3.2.0/proc: libproc.a
Only in procps-3.2.0/proc: prof.o
Only in procps-3.2.0/proc: pwcache.o
Only in procps-3.2.0/proc: readproc.o
Only in procps-3.2.0/proc: sig.o
Only in procps-3.2.0/proc: slab.o
Only in procps-3.2.0/proc: status.o
Only in procps-3.2.0/proc: sysinfo.o
Only in procps-3.2.0/proc: version.o
Only in procps-3.2.0/proc: whattime.o
Only in procps-3.2.0: w
================================================================================
--- procps-3.2.5/w.c
+++ procps-3.2.5/w.c
@@ -191,7 +191,25 @@
return;
strncpy(uname, u->ut_user, USERSZ); /* force NUL term for printf */
- if (formtype) {
+ switch(formtype) {
+ case 2:
+ printf("%s %s", uname, u->ut_line);
+ if (from)
+ print_host(u->ut_host, sizeof u->ut_host);
+ print_logintime(u->ut_time, stdout);
+ if (*u->ut_line == ':') /* idle unknown for xdm logins */
+ printf(" ?xdm? ");
+ else
+ print_time_ival7(idletime(tty), 0, stdout);
+ print_time_ival7(jcpu/Hertz, (jcpu%Hertz)*(100./Hertz), stdout);
+ if (best) {
+ unsigned long long pcpu = best->utime + best->stime;
+ print_time_ival7(pcpu/Hertz, (pcpu%Hertz)*(100./Hertz), stdout);
+ } else
+ printf(" ? ");
+ break;
+
+ case 1:
printf("%-9.8s%-9.8s", uname, u->ut_line);
if (from)
print_host(u->ut_host, sizeof u->ut_host);
@@ -206,7 +224,8 @@
print_time_ival7(pcpu/Hertz, (pcpu%Hertz)*(100./Hertz), stdout);
} else
printf(" ? ");
- } else {
+ break;
+ case 0:
printf("%-9.8s%-9.8s", u->ut_user, u->ut_line);
if (from)
print_host(u->ut_host, sizeof u->ut_host);
@@ -214,6 +233,8 @@
printf(" ?xdm? ");
else
print_time_ival7(idletime(tty), 0, stdout);
+
+ break;
}
fputs(" ", stdout);
if (likely(best)) {
@@ -238,11 +259,12 @@
#endif
setlocale(LC_ALL, "");
- for (args=0; (ch = getopt(argc, argv, "hlusfV")) != EOF; args++)
+ for (args=0; (ch = getopt(argc, argv, "hlusnfV")) != EOF; args++)
switch (ch) {
case 'h': header = 0; break;
case 'l': longform = 1; break;
case 's': longform = 0; break;
+ case 'n': longform = 2; header=0; break;
case 'f': from = !from; break;
case 'V': display_version(); exit(0);
case 'u': ignoreuser = 1; break;
@@ -251,6 +273,7 @@
" -h skip header\n"
" -l long listing (default)\n"
" -s short listing\n"
+ " -n non truncated listing (large)\n"
" -u ignore uid of processes\n"
" -f toggle FROM field (default %s)\n"
" -V display version\n", FROM_STRING);

View File

@ -0,0 +1,19 @@
--- procps-3.2.5/w.c
+++ procps-3.2.5/w.c
@@ -285,10 +285,16 @@
if (ioctl(1, TIOCGWINSZ, &win) != -1 && win.ws_col > 0)
maxcmd = win.ws_col;
+#if 0
+/* I have no idea why I shouldn't be allowed to see the result
+ with a line wrap. The other solution would be to create a
+ wcat alias, which does w|cat to work around this, but this
+ would be stupid in my opinion. */
if (maxcmd < 71) {
fprintf(stderr, "%d column window is too narrow\n", maxcmd);
exit(1);
}
+#endif
maxcmd -= 29 + (from ? 16 : 0) + (longform ? 20 : 0);
if (maxcmd < 3)
fprintf(stderr, "warning: screen width %d suboptimal.\n", win.ws_col);

View File

@ -0,0 +1,11 @@
--- procps-3.2.5/proc/sysinfo.c
+++ procps-3.2.5/proc/sysinfo.c
@@ -43,7 +43,7 @@
#define VMINFO_FILE "/proc/vmstat"
static int vminfo_fd = -1;
-static char buf[1024];
+static char buf[4096];
/* This macro opens filename only if necessary and seeks to 0 so
* that successive calls to the functions are more efficient.

52
procps-3.2.3-make.diff Normal file
View File

@ -0,0 +1,52 @@
Index: procps-3.2.3/Makefile
================================================================================
--- procps-3.2.5/Makefile
+++ procps-3.2.5/Makefile
@@ -27,7 +27,7 @@
ldconfig := ldconfig
ln_f := ln -f
ln_sf := ln -sf
-install := install -D --owner 0 --group 0
+install := install -D
# Lame x86-64 /lib64 and /usr/lib64 abomination:
lib64 := lib$(shell [ -d /lib64 ] && echo 64)
@@ -91,7 +91,8 @@
-Wstrict-prototypes -Wmissing-prototypes
# Note that some stuff below is conditional on CFLAGS containing
# an option that starts with "-g". (-g, -g2, -g3, -ggdb, etc.)
-CFLAGS := -O2 -s
+RPM_OPT_FLAGS = -O2 -s
+CFLAGS = $(RPM_OPT_FLAGS)
ALL_CFLAGS := $(PKG_CFLAGS) $(CFLAGS)
PKG_LDFLAGS := -Wl,-warn-common
--- procps-3.2.5/proc/module.mk
+++ procps-3.2.5/proc/module.mk
@@ -17,7 +17,7 @@
# numbers for future use, the ELF soname can be set equal to the
# file name until some future date when a stable ABI is declared.
-SHARED := 1
+SHARED := 0
# for lib$(NAME).so and /usr/include/($NAME) and such
NAME := proc
@@ -38,7 +38,7 @@
############
-FPIC := -fpic
+FPIC := -fPIC
ifeq ($(SHARED),1)
ALL += proc/$(SONAME)
@@ -50,7 +50,7 @@
else
ALL += proc/$(ANAME)
#INSTALL += $(usr/lib)$(ANAME)
-LIBFLAGS := -DSHARED=0
+LIBFLAGS := -DSHARED=0 $(FPIC)
LIBPROC := proc/$(ANAME)
endif

View File

@ -0,0 +1,17 @@
--- top.c
+++ top.c
@@ -930,6 +930,14 @@
rewind(fp);
fflush(fp);
+ /* save the previous values of cpus[Cpu_tot](i.e. u_sav, s_sav, n_sav, i_sav,
+ * w_sav, x_sav, y_sav) to cpus[cpu_max] before any changes to cpus[], so these
+ * values are not overwritten when copying cpus[cpu_max] back to cpus[Cpu_tot]
+ * at the end of this function.
+ */
+ if (cpu_max != Cpu_tot)
+ memcpy(&cpus[cpu_max], &cpus[Cpu_tot], sizeof(CPU_t));
+
// first value the last slot with the cpu summary line
if (!fgets(buf, sizeof(buf), fp)) std_err("failed /proc/stat read");
cpus[cpu_max].x = 0; // FIXME: can't tell by kernel version number

11
procps-3.2.5-eof.diff Normal file
View File

@ -0,0 +1,11 @@
--- procps-3.2.5/top.c
+++ procps-3.2.5/top.c
@@ -3285,7 +3285,7 @@
if (rc <= 0) {
// EOF is pretty much a "can't happen" except for a kernel bug.
// We should quickly die via SIGHUP, and thus not spin here.
- // if (rc == 0) end_pgm(0); /* EOF from terminal */
+ if (rc == 0) end_pgm(0); /* EOF from terminal */
fcntl(STDIN_FILENO, F_SETFL, file_flags);
select(1, &fs, NULL, NULL, &tv);
fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK|file_flags);

View File

@ -0,0 +1,679 @@
pmap.1 | 76 +++++---
pmap.c | 559 +++++++++++++++++++++++++++++------------------------------------
2 files changed, 297 insertions(+), 338 deletions(-)
diff -urN procps-3.2.5/pmap.1 procps/pmap.1
--- procps-3.2.5/pmap.1 2005-10-11 14:49:20.000000000 -0400
+++ procps/pmap.1 2005-10-12 10:39:28.000000000 -0400
@@ -1,39 +1,57 @@
-'\" t
-.\" (The preceding line is a note to broken versions of man to tell
-.\" them to pre-process this man page with tbl)
-.\" Man page for pmap.
-.\" Licensed under version 2 of the GNU General Public License.
-.\" Written by Albert Cahalan.
+.\" pmap.1 - manpage for the pmap(1) utility, part of procps
.\"
-.TH PMAP 1 "October 26, 2002" "Linux" "Linux User's Manual"
+.\" Copyright (C) 2005 Robert Love
+.\" Licensed under the terms of the GNU General Public License, v2
+.TH PMAP 1 "12 Oct 2005" "Linux" "Linux User's Manual"
.SH NAME
-pmap \- report memory map of a process
+pmap \- display information about process memory mappings
.SH SYNOPSIS
-.nf
-pmap [ -x | -d ] [ -q ] pids...
-pmap -V
-.fi
+.BI "pmap [ \-d | \-q | \-h | \-V ] " pid
.SH DESCRIPTION
-The pmap command reports the memory map of a process or processes.
-
-.SH "GENERAL OPTIONS"
-.TS
-l l l.
--x extended Show the extended format.
--d device Show the device format.
--q quiet Do not display some header/footer lines.
--V show version Displays version of program.
-.TE
+.BR pmap (1)
+displays information about a process's memory mappings, such as its stack,
+data segment, mapped files, and so on.
+.P
+The
+.BR pmap (1)
+utility will show, for each mapping of a given process, the starting byte
+address in the process's address space, the size, the RSS (size of the mapping
+in physical memory), the amount of dirty pages, the permission, the device node,
+the offset, and the file backing the mapping, if any.
+.P
+As the last line of output, the
+.BR pmap (1)
+utility will tally up the total size of all mappings as well as show the
+total size of writable/private mappings and of shared mappings.
+
+.SH OPTIONS
+.TP
+.B\-d, \-\^\-device
+Display major and minor device numbers.
+.TP
+.B\-q, \-\^\-quiet
+Hide header and memory statistics.
+.TP
+.B\-h, \-\^\-help
+Show pmap usage.
+.TP
+.B\-V, \-\^\-version
+Display version information.
+
+.SH FILES
+.IR /proc/pid/maps " and
+.IR /proc/pid/smaps " \-\- memory mapping information"
.SH "SEE ALSO"
-ps(1) pgrep(1)
+.BR ps (1),
+.BR top (1),
+.BR free (1),
+.BR vmstat (1)
-.SH STANDARDS
-No standards apply, but pmap looks an awful lot like a SunOS command.
+.SH AUTHORS
+Written by Chris Rivera.
-.SH AUTHOR
-Albert Cahalan <albert@users.sf.net> wrote pmap in 2002, and is the current
-maintainer of the procps collection. Please send bug reports
-to <procps-feedback@lists.sf.net>.
+The procps package is maintained by Albert Calahan. Please send
+bug reports to <albert@users.sf.net>.
diff -urN procps-3.2.5/pmap.c procps/pmap.c
--- procps-3.2.5/pmap.c 2005-10-11 14:49:21.000000000 -0400
+++ procps/pmap.c 2005-10-12 10:52:09.000000000 -0400
@@ -1,331 +1,272 @@
/*
- * Copyright 2002 by Albert Cahalan; all rights reserved.
- * This file may be used subject to the terms and conditions of the
- * GNU Library General Public License Version 2, or any later version
- * at your option, as published by the Free Software Foundation.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
+ * pmap - print the address space map of a process
+ *
+ * Chris Rivera <chrismrivera@gmail.com>
+ * Robert Love <rml@novell.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, v2, as
+ * published by the Free Software Foundation
+ *
+ * Copyright (C) 2003, 2005 Chris Rivera
*/
#include <stdio.h>
#include <stdlib.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
#include <string.h>
-#include <unistd.h>
-
-#include <sys/ipc.h>
-#include <sys/shm.h>
+#include <errno.h>
+#include <getopt.h>
#include "proc/readproc.h"
#include "proc/version.h"
-#include "proc/escape.h"
-
-static void usage(void) NORETURN;
-static void usage(void){
- fprintf(stderr,
- "Usage: pmap [-x | -d] [-q] pid...\n"
- "-x show details\n"
- "-d show offset and device number\n"
- "-q quiet; less header/footer info\n"
- "-V show the version number\n"
- );
- exit(1);
-}
-
-static int V_option;
-static int r_option; // ignored -- for SunOS compatibility
-static int x_option;
-static int d_option;
-static int q_option;
-
-
-static unsigned shm_minor = ~0u;
-
-static void discover_shm_minor(void){
- void *addr;
- int shmid;
- char mapbuf[256];
-
- if(!freopen("/proc/self/maps", "r", stdin)) return;
-
- // create
- shmid = shmget(IPC_PRIVATE, 42, IPC_CREAT | 0666);
- if(shmid==-1) return; // failed; oh well
- // attach
- addr = shmat(shmid, NULL, SHM_RDONLY);
- if(addr==(void*)-1) goto out_destroy;
-
- while(fgets(mapbuf, sizeof mapbuf, stdin)){
- char flags[32];
- char *tmp; // to clean up unprintables
- unsigned KLONG start, end;
- unsigned long long file_offset, inode;
- unsigned dev_major, dev_minor;
- sscanf(mapbuf,"%"KLF"x-%"KLF"x %31s %Lx %x:%x %Lu", &start, &end, flags, &file_offset, &dev_major, &dev_minor, &inode);
- tmp = strchr(mapbuf,'\n');
- if(tmp) *tmp='\0';
- tmp = mapbuf;
- while(*tmp){
- if(!isprint(*tmp)) *tmp='?';
- tmp++;
- }
- if(start > (unsigned long)addr) continue;
- if(dev_major) continue;
- if(flags[3] != 's') continue;
- if(strstr(mapbuf,"/SYSV")){
- shm_minor = dev_minor;
- break;
- }
- }
+#define BUFFERSIZE 4096
+#define OBJECTSIZE 128
- if(shmdt(addr)) perror("shmdt");
+struct smap {
+ unsigned long size;
+ unsigned long rss;
+ unsigned long shared_clean;
+ unsigned long shared_dirty;
+ unsigned long private_clean;
+ unsigned long private_dirty;
+};
+
+static unsigned long mapped;
+static unsigned long shared;
+static unsigned long private;
+static unsigned long rss;
+static unsigned long dirty;
+static FILE *smaps_fp;
+
+static void usage(const char *cmd)
+{
+ fprintf(stderr, "usage: %s [options] pid\n", cmd);
+ fprintf(stderr, " -d, --device "
+ "display offset and device numbers\n");
+ fprintf(stderr, " -q, --quiet "
+ "hide header and memory statistics\n");
+ fprintf(stderr, " -V, --version "
+ "display version information\n");
+ fprintf(stderr, " -h, --help "
+ "display this help\n");
+}
-out_destroy:
- if(shmctl(shmid, IPC_RMID, NULL)) perror("IPC_RMID");
+static int get_smap_data(struct smap *smap)
+{
+ unsigned long long data;
+ int assigned;
+ char buff[BUFFERSIZE];
+
+ /* get main line */
+ if (!fgets(buff, BUFFERSIZE - 1, smaps_fp))
+ return 1;
+
+ assigned = sscanf(buff, "%llx-", &data);
+ if (assigned != 1)
+ return 1;
+
+ /* get size */
+ if (!fgets(buff, BUFFERSIZE, smaps_fp))
+ return 1;
+
+ assigned = sscanf(buff, "Size: %lld", &data);
+ if (assigned != 1)
+ return 1;
+ smap->size = data;
+
+ /* get rss */
+ if (!fgets(buff, BUFFERSIZE, smaps_fp))
+ return 1;
+
+ assigned = sscanf(buff, "Rss: %lld", &data);
+ if (assigned != 1)
+ return 1;
+ smap->rss = data;
+ rss += data;
+
+ /* get shared clean */
+ if (!fgets(buff, BUFFERSIZE, smaps_fp))
+ return 1;
+
+ assigned = sscanf(buff, "Shared_Clean: %lld", &data);
+ if (assigned != 1)
+ return 1;
+ smap->shared_clean = data;
+
+ /* get shared dirty */
+ if (!fgets(buff, BUFFERSIZE, smaps_fp))
+ return 1;
+
+ assigned = sscanf(buff, "Shared_Dirty: %lld", &data);
+ if (assigned != 1)
+ return 1;
+ smap->shared_dirty = data;
+ dirty += data;
+
+ /* get private clean */
+ if (!fgets(buff, BUFFERSIZE, smaps_fp))
+ return 1;
+
+ assigned = sscanf(buff, "Private_Clean: %lld", &data);
+ if (assigned != 1)
+ return 1;
+ smap->private_clean = data;
+
+ /* get private dirty */
+ if (!fgets(buff, BUFFERSIZE, smaps_fp))
+ return 1;
+
+ assigned = sscanf(buff, "Private_Dirty: %lld", &data);
+ if (assigned != 1)
+ return 1;
+ smap->private_dirty = data;
+ dirty += data;
- return;
+ return 0;
}
+static void parse_line(pid_t pid, const char *line, int show_devices)
+{
+ unsigned long long low, high, size, offset;
+ unsigned long major, minor;
+ struct smap smap = { .rss = 0 };
+ int assigned;
+ char read_perm, write_perm, exec_perm, access_type;
+ char obj_buff[OBJECTSIZE] = "[anon]";
+
+ assigned = sscanf(line, "%llx-%llx %c%c%c%c %llx %lx:%lx %*u %"
+ STRINGIFY(OBJECTSIZE) "s", &low, &high, &read_perm,
+ &write_perm, &exec_perm, &access_type, &offset, &major,
+ &minor, obj_buff);
+
+ if (assigned < 9) {
+ fprintf(stderr, "failed to parse /proc/%d/maps\n", pid);
+ exit(EXIT_FAILURE);
+ }
+
+ size = high - low;
+ size /= 1024;
+ mapped += size;
+
+ if (smaps_fp && get_smap_data(&smap)) {
+ fprintf(stderr, "failed to parse /proc/%d/smaps\n", pid);
+ exit(1);
+ }
+
+ if (access_type == 's')
+ shared += size;
+ else if (access_type == 'p' && write_perm == 'w')
+ private += size;
+
+ printf("%08llx %6lluK ", low, size);
+
+ if (smaps_fp) {
+ printf("%6luK ", smap.rss);
+ printf("%6luK ", smap.private_dirty + smap.shared_dirty);
+ }
-static const char *mapping_name(proc_t *p, unsigned KLONG addr, unsigned KLONG len, const char *mapbuf, unsigned showpath, unsigned dev_major, unsigned dev_minor, unsigned long long inode){
- const char *cp;
-
- if(!dev_major && dev_minor==shm_minor && strstr(mapbuf,"/SYSV")){
- static char shmbuf[64];
- snprintf(shmbuf, sizeof shmbuf, " [ shmid=0x%Lx ]", inode);
- return shmbuf;
- }
-
- cp = strrchr(mapbuf,'/');
- if(cp){
- if(showpath) return strchr(mapbuf,'/');
- return cp[1] ? cp+1 : cp;
- }
-
- cp = strchr(mapbuf,'/');
- if(cp){
- if(showpath) return cp;
- return strrchr(cp,'/') + 1; // it WILL succeed
- }
-
- cp = " [ anon ]";
- if( (p->start_stack >= addr) && (p->start_stack <= addr+len) ) cp = " [ stack ]";
- return cp;
-}
+ printf("%c%c%c%c ", read_perm, write_perm, exec_perm, access_type);
-static int one_proc(proc_t *p){
- char buf[32];
- char mapbuf[9600];
- char cmdbuf[512];
- unsigned long total_shared = 0ul;
- unsigned long total_private_readonly = 0ul;
- unsigned long total_private_writeable = 0ul;
-
- // Overkill, but who knows what is proper? The "w" prog
- // uses the tty width to determine this.
- int maxcmd = 0xfffff;
-
- sprintf(buf,"/proc/%u/maps",p->tgid);
- if(!freopen(buf, "r", stdin)) return 1;
-
- escape_command(cmdbuf, p, sizeof cmdbuf, &maxcmd, ESC_ARGS|ESC_BRACKETS);
- printf("%u: %s\n", p->tgid, cmdbuf);
-
- if(!q_option && (x_option|d_option)){
- if(x_option){
- if(sizeof(KLONG)==4) printf("Address Kbytes RSS Anon Locked Mode Mapping\n");
- else printf("Address Kbytes RSS Anon Locked Mode Mapping\n");
- }
- if(d_option){
- if(sizeof(KLONG)==4) printf("Address Kbytes Mode Offset Device Mapping\n");
- else printf("Address Kbytes Mode Offset Device Mapping\n");
- }
- }
-
- while(fgets(mapbuf,sizeof mapbuf,stdin)){
- char flags[32];
- char *tmp; // to clean up unprintables
- unsigned KLONG start, end, diff;
- unsigned long long file_offset, inode;
- unsigned dev_major, dev_minor;
- sscanf(mapbuf,"%"KLF"x-%"KLF"x %31s %Lx %x:%x %Lu", &start, &end, flags, &file_offset, &dev_major, &dev_minor, &inode);
- tmp = strchr(mapbuf,'\n');
- if(tmp) *tmp='\0';
- tmp = mapbuf;
- while(*tmp){
- if(!isprint(*tmp)) *tmp='?';
- tmp++;
- }
-
- diff = end-start;
- if(flags[3]=='s') total_shared += diff;
- if(flags[3]=='p'){
- flags[3] = '-';
- if(flags[1]=='w') total_private_writeable += diff;
- else total_private_readonly += diff;
- }
-
- // format used by Solaris 9 and procps-3.2.0+
- // an 'R' if swap not reserved (MAP_NORESERVE, SysV ISM shared mem, etc.)
- flags[4] = '-';
- flags[5] = '\0';
-
- if(x_option){
- const char *cp = mapping_name(p, start, diff, mapbuf, 0, dev_major, dev_minor, inode);
- printf(
- (sizeof(KLONG)==8)
- ? "%016"KLF"x %7lu - - - %s %s\n"
- : "%08lx %7lu - - - %s %s\n",
- start,
- (unsigned long)(diff>>10),
- flags,
- cp
- );
- }
- if(d_option){
- const char *cp = mapping_name(p, start, diff, mapbuf, 0, dev_major, dev_minor, inode);
- printf(
- (sizeof(KLONG)==8)
- ? "%016"KLF"x %7lu %s %016Lx %03x:%05x %s\n"
- : "%08lx %7lu %s %016Lx %03x:%05x %s\n",
- start,
- (unsigned long)(diff>>10),
- flags,
- file_offset,
- dev_major, dev_minor,
- cp
- );
- }
- if(!x_option && !d_option){
- const char *cp = mapping_name(p, start, diff, mapbuf, 1, dev_major, dev_minor, inode);
- printf(
- (sizeof(KLONG)==8)
- ? "%016"KLF"x %6luK %s %s\n"
- : "%08lx %6luK %s %s\n",
- start,
- (unsigned long)(diff>>10),
- flags,
- cp
- );
- }
-
- }
-
- if(!q_option){
- if(x_option){
- if(sizeof(KLONG)==8){
- printf("---------------- ------ ------ ------ ------\n");
- printf(
- "total kB %15ld - - -\n",
- (total_shared + total_private_writeable + total_private_readonly) >> 10
- );
- }else{
- printf("-------- ------- ------- ------- -------\n");
- printf(
- "total kB %7ld - - -\n",
- (total_shared + total_private_writeable + total_private_readonly) >> 10
- );
- }
- }
- if(d_option){
- printf(
- "mapped: %ldK writeable/private: %ldK shared: %ldK\n",
- (total_shared + total_private_writeable + total_private_readonly) >> 10,
- total_private_writeable >> 10,
- total_shared >> 10
- );
- }
- if(!x_option && !d_option){
- if(sizeof(KLONG)==8) printf(" total %16ldK\n", (total_shared + total_private_writeable + total_private_readonly) >> 10);
- else printf(" total %8ldK\n", (total_shared + total_private_writeable + total_private_readonly) >> 10);
- }
- }
+ if (show_devices)
+ printf("%08llx %02lx:%02lx ", offset, major, minor);
- return 0;
+ printf("%s\n", obj_buff);
}
+int main(int argc, char *argv[])
+{
+ proc_t proc;
+ FILE *fp;
+ char path[PATH_MAX];
+ char buff[BUFFERSIZE];
+ int o, show_devices = 0, quiet = 0;
+ pid_t pid;
+
+ struct option longopts[] = {
+ { "help", 0, NULL, 'h' },
+ { "version", 0, NULL, 'V' },
+ { "quiet", 0, NULL, 'q' },
+ { "device", 0, NULL, 'd' },
+ { NULL, 0, NULL, 0 }
+ };
+
+ while ((o = getopt_long(argc, argv, "hqdV", longopts, NULL)) != -1) {
+ switch (o) {
+ case 'V':
+ display_version();
+ return 0;
+ case 'q':
+ quiet = 1;
+ break;
+ case 'd':
+ show_devices = 1;
+ break;
+ case 'h':
+ usage(argv[0]);
+ return 0;
+ default:
+ usage(argv[0]);
+ return 1;
+ }
+ }
+
+ if (argc - optind > 0) {
+ errno = 0;
+ pid = strtoul(argv[optind], NULL, 10);
+ if (errno) {
+ perror("strtoul");
+ exit(EXIT_FAILURE);
+ }
+ } else {
+ usage(argv[0]);
+ exit(EXIT_FAILURE);
+ }
+
+ if (!get_proc_stats(pid, &proc)) {
+ fprintf(stderr, "error getting process information for pid "
+ "%d from /proc/%d\n", pid, pid);
+ exit(EXIT_FAILURE);
+ }
+
+ printf("%d: %s\n", pid, proc.cmd);
+
+ snprintf(path, PATH_MAX, "/proc/%d/maps", pid);
+ fp = fopen(path, "r");
+ if (!fp) {
+ perror("fopen");
+ exit(EXIT_FAILURE);
+ }
+
+ snprintf(path, PATH_MAX, "/proc/%d/smaps", pid);
+ smaps_fp = fopen(path, "r");
+
+ if (!quiet) {
+ printf("START SIZE ");
+
+ if (smaps_fp) {
+ printf(" RSS ");
+ printf(" DIRTY ");
+ }
+
+ if (show_devices)
+ printf("PERM OFFSET DEVICE MAPPING\n");
+ else
+ printf("PERM MAPPING\n");
+ }
+
+ while (fgets(buff, BUFFERSIZE - 1, fp))
+ parse_line(pid, buff, show_devices);
+
+ if (!quiet) {
+ if (smaps_fp)
+ printf("Total: %6luK %6luK %6luK\n\n", mapped, rss, dirty);
+ else
+ printf("mapped: %luK ", mapped);
+
+ printf("%luK writable-private, %luK readonly-private, and %luK shared\n",
+ private, mapped - private - shared, shared);
+ }
-int main(int argc, char *argv[]){
- unsigned *pidlist;
- unsigned count = 0;
- PROCTAB* PT;
- proc_t p;
- int ret = 0;
-
- if(argc<2) usage();
- pidlist = malloc(sizeof(unsigned)*argc); // a bit more than needed perhaps
-
- while(*++argv){
- if(!strcmp("--version",*argv)){
- V_option++;
- continue;
- }
- if(**argv=='-'){
- char *walk = *argv;
- if(!walk[1]) usage();
- while(*++walk){
- switch(*walk){
- case 'V':
- V_option++;
- break;
- case 'x':
- x_option++;
- break;
- case 'r':
- r_option++;
- break;
- case 'd':
- d_option++;
- break;
- case 'q':
- q_option++;
- break;
- default:
- usage();
- }
- }
- }else{
- char *walk = *argv;
- char *endp;
- unsigned long pid;
- if(!strncmp("/proc/",walk,6)){
- walk += 6;
- // user allowed to do: pmap /proc/*
- if(*walk<'0' || *walk>'9') continue;
- }
- if(*walk<'0' || *walk>'9') usage();
- pid = strtoul(walk, &endp, 0);
- if(pid<1ul || pid>0x7ffffffful || *endp) usage();
- pidlist[count++] = pid;
- }
- }
-
- if( (x_option|V_option|r_option|d_option|q_option) >> 1 ) usage(); // dupes
- if(V_option){
- if(count|x_option|r_option|d_option|q_option) usage();
- fprintf(stdout, "pmap (%s)\n", procps_version);
- return 0;
- }
- if(count<1) usage(); // no processes
- if(d_option && x_option) usage();
-
- discover_shm_minor();
-
- pidlist[count] = 0; // old libproc interface is zero-terminated
- PT = openproc(PROC_FILLSTAT|PROC_FILLARG|PROC_PID, pidlist);
- while(readproc(PT, &p)){
- ret |= one_proc(&p);
- if(p.cmdline) free((void*)*p.cmdline);
- count--;
- }
- closeproc(PT);
-
- if(count) ret |= 42; // didn't find all processes asked for
- return ret;
+ return 0;
}

14
procps-3.2.5-top-rc.patch Normal file
View File

@ -0,0 +1,14 @@
--- procps-3.2.5/top.c.rc 2005-06-28 22:36:24.000000000 +0200
+++ procps-3.2.5/top.c 2005-06-28 22:40:27.000000000 +0200
@@ -2393,7 +2393,10 @@
int i;
for (i = 0; i < GROUPSMAX; i++) {
- win_names(&Winstk[i], Winstk[i].rc.winname);
+ /* Please, never use something like sprintf(x, "%s", x); ... see win_names() */
+ char buf[WINNAMSIZ];
+ strncpy(buf, Winstk[i].rc.winname, WINNAMSIZ);
+ win_names(&Winstk[i], buf);
capsmk(&Winstk[i]);
}
// rely on this next guy to force a call (eventually) to reframewins

View File

@ -0,0 +1,95 @@
--- procps-3.2.7/top.c
+++ procps-3.2.7/top.c 2006-06-26 16:46:39.000000000 +0200
@@ -912,6 +912,7 @@
static CPU_t *cpus_refresh (CPU_t *cpus)
{
static FILE *fp = NULL;
+ static int cpu_max;
int i;
int num;
// enough for a /proc/stat CPU line (not the intr line)
@@ -926,36 +927,34 @@
can hold tics representing the /proc/stat cpu summary (the first
line read) -- that slot supports our View_CPUSUM toggle */
cpus = alloc_c((1 + Cpu_tot) * sizeof(CPU_t));
- }
+ cpu_max = Cpu_tot;
+ } else if (cpu_max > Cpu_tot)
+ /* move saved CUPs summary to cpu_max possition */
+ memcpy(&cpus[cpu_max], &cpus[Cpu_tot], sizeof(CPU_t));
+
rewind(fp);
fflush(fp);
// first value the last slot with the cpu summary line
if (!fgets(buf, sizeof(buf), fp)) std_err("failed /proc/stat read");
- cpus[Cpu_tot].x = 0; // FIXME: can't tell by kernel version number
- cpus[Cpu_tot].y = 0; // FIXME: can't tell by kernel version number
- cpus[Cpu_tot].z = 0; // FIXME: can't tell by kernel version number
+ cpus[cpu_max].x = 0; // FIXME: can't tell by kernel version number
+ cpus[cpu_max].y = 0; // FIXME: can't tell by kernel version number
+ cpus[cpu_max].z = 0; // FIXME: can't tell by kernel version number
num = sscanf(buf, "cpu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu",
- &cpus[Cpu_tot].u,
- &cpus[Cpu_tot].n,
- &cpus[Cpu_tot].s,
- &cpus[Cpu_tot].i,
- &cpus[Cpu_tot].w,
- &cpus[Cpu_tot].x,
- &cpus[Cpu_tot].y,
- &cpus[Cpu_tot].z
+ &cpus[cpu_max].u,
+ &cpus[cpu_max].n,
+ &cpus[cpu_max].s,
+ &cpus[cpu_max].i,
+ &cpus[cpu_max].w,
+ &cpus[cpu_max].x,
+ &cpus[cpu_max].y,
+ &cpus[cpu_max].z
);
if (num < 4)
std_err("failed /proc/stat read");
- // and just in case we're 2.2.xx compiled without SMP support...
- if (Cpu_tot == 1) {
- cpus[1].id = 0;
- memcpy(cpus, &cpus[1], sizeof(CPU_t));
- }
-
// now value each separate cpu's tics
- for (i = 0; 1 < Cpu_tot && i < Cpu_tot; i++) {
+ for (i = 0; ; i++) {
if (!fgets(buf, sizeof(buf), fp)) std_err("failed /proc/stat read");
cpus[i].x = 0; // FIXME: can't tell by kernel version number
cpus[i].y = 0; // FIXME: can't tell by kernel version number
@@ -964,9 +963,28 @@
&cpus[i].id,
&cpus[i].u, &cpus[i].n, &cpus[i].s, &cpus[i].i, &cpus[i].w, &cpus[i].x, &cpus[i].y, &cpus[i].z
);
- if (num < 4)
- std_err("failed /proc/stat read");
+ if (num < 4) {
+ Cpu_tot = i;
+ break;
+ }
+ if (i == cpu_max - 1) {
+ // Bump cpu_max and extend cpus
+ cpu_max++;
+ cpus = realloc(cpus, (1 + cpu_max) * sizeof(CPU_t));
+ if (!cpus) std_err("realloc failed");
+ memcpy(&cpus[cpu_max], &cpus[cpu_max-1], sizeof(CPU_t));
+ }
+ }
+
+ if (cpu_max > Cpu_tot)
+ memcpy(&cpus[Cpu_tot], &cpus[cpu_max], sizeof(CPU_t));
+
+ // and just in case we're 2.2.xx compiled without SMP support...
+ if (Cpu_tot == 1) {
+ cpus[1].id = 0;
+ memcpy(cpus, &cpus[1], sizeof(CPU_t));
}
+
return cpus;
}

View File

@ -0,0 +1,27 @@
--- procps-3.2.7/top.c
+++ procps-3.2.7/top.c 2006-06-26 16:26:56.000000000 +0200
@@ -2480,21 +2480,21 @@
static const char err_num_cpus[] = "\aSorry, terminal is not big enough";
#ifdef WARN_NOT_SMP
// standardized 'smp' errors
- static const char err_smp[] = "\aSorry, only 1 cpu detected";
+ static const char err_smp[] = "\aSorry, only one cpu detected";
#endif
switch (c) {
case '1':
if (Cpu_tot+7 > Screen_rows && !CHKw(Curwin, View_CPUSUM)) {
show_msg(err_num_cpus);
- break;
- }
+ } else {
#ifdef WARN_NOT_SMP
if (Cpu_tot > 1) TOGw(Curwin, View_CPUSUM);
else show_msg(err_smp);
#else
TOGw(Curwin, View_CPUSUM);
#endif
+ }
break;
case 'a':

View File

@ -0,0 +1,77 @@
--- proc/readproc.c
+++ proc/readproc.c 2006-07-28 11:20:18.000000000 +0000
@@ -412,7 +412,7 @@ static int file2str(const char *director
int fd, num_read;
sprintf(filename, "%s/%s", directory, what);
- fd = open(filename, O_RDONLY, 0);
+ fd = open(filename, O_RDONLY, O_NOATIME);
if(unlikely(fd==-1)) return -1;
num_read = read(fd, ret, cap - 1);
close(fd);
@@ -423,37 +423,41 @@ 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;
- int fd, tot = 0, n, c, end_of_file = 0;
+ char *p, *rbuf = (char*)0, *endbuf, **q, **ret;
+ int fd, tot = 0, n, c;
int align;
sprintf(buf, "%s/%s", directory, what);
- 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))
- end_of_file = 1;
- if (n == 0 && rbuf == 0)
- return NULL; /* process died between our open and read */
if (n < 0) {
+ if (errno == EINTR)
+ continue;
if (rbuf)
free(rbuf);
- return NULL; /* read error */
+ return NULL; /* read error! */
+ }
+ if (n == 0) {
+ if(rbuf == (char*)0)
+ return NULL; /* process died between our open and read */
+ break; /* we're done */
+ }
+ if (n < (int)(sizeof(buf) - 1)) {
+ if (buf[n-1]) /* last read char not null */
+ buf[n++] = '\0'; /* so append null-terminator */
}
- if (end_of_file && buf[n-1]) /* last read char not null */
- buf[n++] = '\0'; /* so append null-terminator */
rbuf = xrealloc(rbuf, tot + n); /* allocate more memory */
memcpy(rbuf + tot, buf, n); /* copy buffer into it */
tot += n; /* increment total byte ctr */
- if (end_of_file)
- break;
}
close(fd);
- if (n <= 0 && !end_of_file) {
- if (rbuf) free(rbuf);
- return NULL; /* read error */
+ if (tot == 0) {
+ if (rbuf)
+ free(rbuf);
+ return NULL; /* read error? */
}
endbuf = rbuf + tot; /* count space for pointers */
align = (sizeof(char*)-1) - ((tot + sizeof(char*)-1) & (sizeof(char*)-1));
@@ -482,7 +486,7 @@ int read_cmdline(char *restrict const ds
unsigned n = 0;
dst[0] = '\0';
snprintf(name, sizeof name, "/proc/%u/cmdline", pid);
- fd = open(name, O_RDONLY);
+ fd = open(name, O_RDONLY, O_NOATIME);
if(fd==-1) return 0;
for(;;){
ssize_t r = read(fd,dst+n,sz-n);

11
procps-3.2.7-top.1.diff Normal file
View File

@ -0,0 +1,11 @@
--- procps-3.2.7/top.1
+++ procps-3.2.7/top.1 2006-06-26 16:34:01.000000000 +0200
@@ -20,7 +20,7 @@
..
.\" Setup ////////////////////////////////////////////////////////////////
\# ** Comment out '.nr' or set to 0 to eliminate WIDTH fiddlin' !
-.nr half_xtra 4
+.nr half_xtra 0
.
.ll +(\n[half_xtra] + \n[half_xtra])
.

3
procps-3.2.7.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5aae203ea63433a37eb91ec84d08519c5979a881e2d18a94ffcb7e84ff277357
size 229702

View File

@ -1,48 +0,0 @@
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)
---
free.c | 5 +++++
1 file changed, 5 insertions(+)
--- free.c
+++ free.c 2022-03-29 11:17:45.442230673 +0000
@@ -209,6 +209,7 @@ int main(int argc, char **argv)
int c, flags = 0, unit_set = 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, "bkmghltvCc:ws:V", longopts, NULL)) != -1)
switch (c) {
@@ -333,11 +336,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

@ -1,19 +0,0 @@
---
top/top.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- top/top.c
+++ top/top.c 2022-03-29 10:29:24.422368662 +0000
@@ -2457,7 +2457,11 @@ static void zap_fieldstab (void) {
Cpu_pmax = 99.9;
if (Rc.mode_irixps && Cpu_cnt > 1 && !Thread_mode) {
Cpu_pmax = 100.0 * Cpu_cnt;
- if (Cpu_cnt > 10) {
+ if (Cpu_cnt > 1000) {
+ if (Cpu_pmax > 9999999.0) Cpu_pmax = 9999999.0;
+ } else if (Cpu_cnt > 100) {
+ if (Cpu_cnt > 999999.0) Cpu_pmax = 999999.0;
+ } else if (Cpu_cnt > 10) {
if (Cpu_pmax > 99999.0) Cpu_pmax = 99999.0;
} else {
if (Cpu_pmax > 999.9) Cpu_pmax = 999.9;

View File

@ -1,126 +0,0 @@
---
free.1 | 6 ++++++
free.c | 7 ++++++-
proc/meminfo.c | 7 ++++++-
vmstat.c | 7 ++++++-
4 files changed, 24 insertions(+), 3 deletions(-)
--- free.1
+++ free.1 2022-03-28 11:53:32.173182702 +0000
@@ -100,6 +100,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
--- free.c
+++ free.c 2022-03-28 12:05:01.544663755 +0000
@@ -93,6 +93,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, "bkmghltvc:ws:V", longopts, NULL)) != -1)
+ while ((c = getopt_long(argc, argv, "bkmghltvCc:ws:V", longopts, NULL)) != -1)
switch (c) {
case 'b':
check_unit_set(&unit_set);
@@ -349,6 +351,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':
--- proc/meminfo.c
+++ proc/meminfo.c 2022-03-28 12:39:29.291205555 +0000
@@ -3,6 +3,7 @@
*
* Copyright (C) 2015 Craig Small <csmall@dropbear.xyz>
* Copyright (C) 2016-2022 Jim Warner <james.warner@comcast.net>
+ * Copyright (c) 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
--- vmstat.c
+++ vmstat.c 2022-03-28 12:41:52.744612074 +0000
@@ -234,6 +234,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);
@@ -948,6 +949,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'},
@@ -964,7 +966,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);
@@ -1031,6 +1033,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;

View File

@ -1,33 +0,0 @@
---
vmstat.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- vmstat.c
+++ vmstat.c 2022-03-29 09:21:41.156855432 +0000
@@ -362,7 +362,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];
@@ -481,12 +481,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

@ -1,217 +0,0 @@
---
pmap.c | 47 ++++++++++++++++++++++++++++++++-----------
testsuite/pmap.test/pmap.exp | 17 +++++++--------
2 files changed, 44 insertions(+), 20 deletions(-)
--- pmap.c
+++ pmap.c 2022-03-29 11:46:26.323303275 +0000
@@ -55,7 +55,9 @@ const char *nls_Address,
*nls_Kbytes,
*nls_Mode,
*nls_RSS,
- *nls_Dirty;
+ *nls_PSS,
+ *nls_Dirty,
+ *nls_Swap;
static void nls_initialize(void)
{
@@ -79,7 +81,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)
@@ -146,10 +150,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;
@@ -533,12 +537,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));
@@ -561,13 +570,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);
}
@@ -607,6 +618,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;
@@ -619,16 +635,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;
@@ -662,7 +682,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
@@ -714,17 +733,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
@@ -1037,16 +1060,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 2022-03-29 11:19:45.948044571 +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 "\$"
@@ -47,7 +46,7 @@ expect_table $test $pmap_procname $pmap_
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

@ -1,29 +0,0 @@
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
@@ -3557,7 +3557,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

@ -1,23 +0,0 @@
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>
---
sysctl.c | 1 +
1 file changed, 1 insertion(+)
--- a/sysctl.c
+++ b/sysctl.c
@@ -58,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

@ -1,27 +0,0 @@
---
top/top.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- top/top.c
+++ top/top.c 2022-03-29 10:24:43.327490984 +0000
@@ -1564,9 +1564,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;
@@ -1576,7 +1576,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

@ -1,66 +0,0 @@
---
proc/readproc.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
--- proc/readproc.c
+++ proc/readproc.c 2022-03-28 11:51:04.751862744 +0000
@@ -728,7 +728,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;
@@ -752,25 +752,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 */
}
@@ -804,7 +804,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')
@@ -817,7 +817,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 */

View File

@ -1,35 +0,0 @@
---
Makefile.am | 2 +-
configure.ac | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
--- Makefile.am
+++ Makefile.am 2022-03-29 10:32:27.691037616 +0000
@@ -190,7 +190,7 @@ if CYGWIN
top_top_SOURCES += lib/strverscmp.c
endif
-top_top_LDADD = $(LDADD) @NCURSES_LIBS@ $(DL_LIB)
+top_top_LDADD = $(LDADD) @TOP_NCURSES_LIBS@ $(DL_LIB)
endif
if BUILD_SKILL
--- configure.ac
+++ configure.ac 2022-03-29 10:33:50.621534246 +0000
@@ -233,8 +233,16 @@ else
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
fi
AC_SUBST([NCURSES_LIBS])
+AC_SUBST([TOP_NCURSES_LIBS])
AC_SUBST([WATCH_NCURSES_LIBS])
AC_ARG_WITH([systemd],

View File

@ -1,17 +0,0 @@
---
vmstat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- vmstat.c
+++ vmstat.c 2022-03-29 10:36:49.654287539 +0000
@@ -337,8 +337,8 @@ static void new_header(void)
static unsigned long unitConvert(unsigned long size)
{
- float cvSize;
- cvSize = (float)size / dataUnit * ((statMode == SLABSTAT) ? 1 : 1024);
+ long double cvSize;
+ cvSize = (long double)size / dataUnit * ((statMode == SLABSTAT) ? 1 : 1024);
return ((unsigned long)cvSize);
}

View File

@ -1,79 +0,0 @@
---
w.1 | 3 +++
w.c | 18 +++++++++++++++---
2 files changed, 18 insertions(+), 3 deletions(-)
--- w.1
+++ w.1 2022-03-23 15:02:32.728894724 +0000
@@ -40,6 +40,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
--- w.c
+++ w.c 2022-03-28 11:20:25.453174765 +0000
@@ -450,7 +450,7 @@ static int find_best_proc(
static void showinfo(
utmp_t * u, int formtype, int maxcmd, int from,
- const int userlen, const int fromlen, const int ip_addresses)
+ int userlen, int fromlen, const int ip_addresses)
{
unsigned long long jcpu, pcpu;
unsigned i;
@@ -481,7 +481,13 @@ static void showinfo(
strncpy(uname, u->ut_user, UT_NAMESIZE);
if (formtype) {
- printf("%-*.*s%-9.8s", userlen + 1, userlen, uname, u->ut_line);
+ 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);
+ }
+ printf("%-*.*s%-*.*s", userlen + 1, userlen, uname, utlnlen + 1, utlnlen, u->ut_line);
if (from)
print_from(u, ip_addresses, fromlen);
#ifdef HAVE_UTMPX_H
@@ -526,6 +532,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);
@@ -562,6 +569,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'},
@@ -583,7 +591,7 @@ int main(int argc, char **argv)
#endif
while ((ch =
- getopt_long(argc, argv, "husfoVi", longopts, NULL)) != -1)
+ getopt_long(argc, argv, "husnfoVi", longopts, NULL)) != -1)
switch (ch) {
case 'h':
header = 0;
@@ -591,6 +599,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

@ -1,176 +0,0 @@
---
proc/pids.c | 18 +++++++++++++++---
proc/pids.h | 1 +
ps/common.h | 3 +++
ps/display.c | 1 +
ps/global.c | 1 +
ps/output.c | 18 +++++++++---------
6 files changed, 30 insertions(+), 12 deletions(-)
--- proc/pids.c
+++ proc/pids.c 2022-03-30 08:53:15.180093896 +0000
@@ -92,6 +92,7 @@ struct pids_info {
PROCTAB *fetch_PT; // oldlib interface for 'select' & 'reap'
unsigned long hertz; // for the 'TIME' & 'UTILIZATION' calculations
double boot_seconds; // for TIME_ELAPSED & 'UTILIZATION' calculations
+ unsigned long long boot_tics; // for TIME_ELAPSED & 'UTILIZATION' calculations
PROCTAB *get_PT; // oldlib interface for active 'get'
struct stacks_extent *get_ext; // for active 'get' (also within 'extents')
enum pids_fetch_type get_type; // last known type of 'get' request
@@ -282,6 +283,7 @@ setDECL(TICS_USER_C) { (void)I; R->re
setDECL(TIME_ALL) { R->result.real = ((double)P->utime + P->stime) / I->hertz; }
setDECL(TIME_ALL_C) { R->result.real = ((double)P->utime + P->stime + P->cutime + P->cstime) / I->hertz; }
setDECL(TIME_ELAPSED) { double t = (double)P->start_time / I->hertz; R->result.real = I->boot_seconds > t ? I->boot_seconds - t : 0; }
+setDECL(TICS_ELAPSED) { R->result.ull_int = I->boot_tics >= P->start_time ? I->boot_tics - P->start_time : 0; }
setDECL(TIME_START) { R->result.real = (double)P->start_time / I->hertz; }
REG_set(TTY, s_int, tty)
setDECL(TTY_NAME) { char buf[64]; freNAME(str)(R); dev_to_tty(buf, sizeof(buf), P->tty, P->tid, ABBREV_DEV); if (!(R->result.str = strdup(buf))) I->seterr = 1; }
@@ -571,6 +573,7 @@ static struct {
{ RS(TIME_ALL), f_stat, NULL, QS(real), 0, TS(real) },
{ RS(TIME_ALL_C), f_stat, NULL, QS(real), 0, TS(real) },
{ RS(TIME_ELAPSED), f_stat, NULL, QS(real), 0, TS(real) },
+ { RS(TICS_ELAPSED), f_stat, NULL, QS(ull_int), 0, TS(ull_int) },
{ RS(TIME_START), f_stat, NULL, QS(real), 0, TS(real) },
{ RS(TTY), f_stat, NULL, QS(s_int), 0, TS(s_int) },
{ RS(TTY_NAME), f_stat, FF(str), QS(strvers), 0, TS(str) },
@@ -1441,8 +1444,11 @@ fresh_start:
/* when in a namespace with proc mounted subset=pid,
we will be restricted to process information only */
info->boot_seconds = 0;
- if (0 >= procps_uptime(&up_secs, NULL))
+ info->boot_tics = 0;
+ if (0 >= procps_uptime(&up_secs, NULL)) {
info->boot_seconds = up_secs;
+ info->boot_tics = up_secs * info->hertz;
+ }
if (NULL == info->read_something(info->get_PT, &info->get_proc))
return NULL;
@@ -1484,8 +1490,11 @@ PROCPS_EXPORT struct pids_fetch *procps_
/* when in a namespace with proc mounted subset=pid,
we will be restricted to process information only */
info->boot_seconds = 0;
- if (0 >= procps_uptime(&up_secs, NULL))
+ info->boot_tics = 0;
+ if (0 >= procps_uptime(&up_secs, NULL)) {
info->boot_seconds = up_secs;
+ info->boot_tics = up_secs * info->hertz;
+ }
rc = pids_stacks_fetch(info);
@@ -1589,8 +1598,11 @@ PROCPS_EXPORT struct pids_fetch *procps_
/* when in a namespace with proc mounted subset=pid,
we will be restricted to process information only */
info->boot_seconds = 0;
- if (0 >= procps_uptime(&up_secs, NULL))
+ info->boot_tics = 0;
+ if (0 >= procps_uptime(&up_secs, NULL)) {
info->boot_seconds = up_secs;
+ info->boot_tics = up_secs * info->hertz;
+ }
rc = pids_stacks_fetch(info);
--- proc/pids.h
+++ proc/pids.h 2022-03-30 08:53:15.180093896 +0000
@@ -165,6 +165,7 @@ enum pids_item {
PIDS_TIME_ALL, // real derived from stat: (utime + stime) / hertz
PIDS_TIME_ALL_C, // real derived from stat: (utime + stime + cutime + cstime) / hertz
PIDS_TIME_ELAPSED, // real derived from /proc/uptime - (starttime / hertz)
+ PIDS_TICS_ELAPSED, // ull_int derived from /proc/uptime - starttime
PIDS_TIME_START, // real derived from stat: start_time / hertz
PIDS_TTY, // s_int stat: tty_nr
PIDS_TTY_NAME, // str derived from TTY
--- ps/common.h
+++ ps/common.h 2022-03-30 08:53:15.180093896 +0000
@@ -42,6 +42,8 @@
#define namREL(e) rel_ ## e
#define makEXT(e) extern int namREL(e);
#define makREL(e) int namREL(e) = -1;
+#define makEXTULL(e) extern unsigned long long namREL(e);
+#define makRELULL(e) unsigned long long namREL(e) = -1;
#define chkREL(e) if (namREL(e) < 0) { \
Pids_items[Pids_index] = PIDS_ ## e; \
namREL(e) = (Pids_index < PIDSITEMS) ? Pids_index++ : rel_noop; }
@@ -160,6 +162,7 @@ makEXT(TICS_ALL)
makEXT(TICS_ALL_C)
makEXT(TIME_ALL)
makEXT(TIME_ELAPSED)
+makEXT(TICS_ELAPSED)
makEXT(TICS_BEGAN)
makEXT(TTY)
makEXT(TTY_NAME)
--- ps/display.c
+++ ps/display.c 2022-03-30 08:54:22.410871769 +0000
@@ -584,6 +584,7 @@ static void finalize_stacks (void)
chkREL(TICS_ALL_C)
chkREL(TIME_ALL)
chkREL(TIME_ELAPSED)
+ chkREL(TICS_ELAPSED)
chkREL(TICS_BEGAN)
// special items with 'extra' used as former pcpu
chkREL(extra)
--- ps/global.c
+++ ps/global.c 2022-03-30 08:53:15.180093896 +0000
@@ -141,6 +141,7 @@ makREL(TICS_ALL)
makREL(TICS_ALL_C)
makREL(TIME_ALL)
makREL(TIME_ELAPSED)
+makREL(TICS_ELAPSED)
makREL(TICS_BEGAN)
makREL(TTY)
makREL(TTY_NAME)
--- ps/output.c
+++ ps/output.c 2022-03-30 08:53:15.180093896 +0000
@@ -517,13 +517,13 @@ setREL1(TIME_ELAPSED)
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; /* scaled %cpu, 99 means 99% */
- unsigned long long seconds; /* seconds of process life */
+ unsigned long long jiffies; /* jiffies of process life */
setREL4(TICS_ALL,TICS_ALL_C,TIME_ELAPSED,UTILIZATION)
pcpu = 0;
if(include_dead_children) total_time = rSv(TICS_ALL_C, ull_int, pp);
else total_time = rSv(TICS_ALL, ull_int, pp);
- seconds = rSv(TIME_ELAPSED, real, pp);
- if(seconds) pcpu = (total_time * 100ULL / Hertz) / seconds;
+ jiffies = rSv(TICS_ELAPSED, ull_int, pp);
+ if(jiffies) pcpu = (total_time * 100ULL) / jiffies;
if (pcpu > 99U) pcpu = 99U;
return snprintf(outbuf, COLWID, "%2u", pcpu);
}
@@ -532,13 +532,13 @@ setREL4(TICS_ALL,TICS_ALL_C,TIME_ELAPSED
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; /* scaled %cpu, 999 means 99.9% */
- unsigned long long seconds; /* seconds of process life */
+ unsigned long long jiffies; /* jiffies of process life */
setREL4(TICS_ALL,TICS_ALL_C,TIME_ELAPSED,UTILIZATION)
pcpu = 0;
if(include_dead_children) total_time = rSv(TICS_ALL_C, ull_int, pp);
else total_time = rSv(TICS_ALL, ull_int, pp);
- seconds = rSv(TIME_ELAPSED, real, pp);
- if(seconds) pcpu = (total_time * 1000ULL / Hertz) / seconds;
+ jiffies = rSv(TICS_ELAPSED, ull_int, 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);
@@ -548,13 +548,13 @@ setREL4(TICS_ALL,TICS_ALL_C,TIME_ELAPSED
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; /* scaled %cpu, 999 means 99.9% */
- unsigned long long seconds; /* seconds of process life */
+ unsigned long long jiffies; /* jiffies of process life */
setREL4(TICS_ALL,TICS_ALL_C,TIME_ELAPSED,UTILIZATION)
pcpu = 0;
if(include_dead_children) total_time = rSv(TICS_ALL_C, ull_int, pp);
else total_time = rSv(TICS_ALL, ull_int, pp);
- seconds = rSv(TIME_ELAPSED, real, pp);
- if(seconds) pcpu = (total_time * 1000ULL / Hertz) / seconds;
+ jiffies = rSv(TICS_ELAPSED, ull_int, pp);
+ if(jiffies) pcpu = (total_time * 1000ULL) / jiffies;
if (pcpu > 999U) pcpu = 999U;
return snprintf(outbuf, COLWID, "%3u", pcpu);
}

View File

@ -1,65 +0,0 @@
---
lib/strutils.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
--- lib/strutils.c
+++ lib/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

@ -1,26 +0,0 @@
---
proc/meminfo.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- proc/meminfo.c
+++ proc/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

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0f4d92794edb7a1c95bb3b8c1f823de62be5d0043459c2155fd07fa859c16513
size 1002084

View File

@ -1 +0,0 @@
addFilter(".*W:.*shared-lib-calls-exit.*libproc-2\.so.*")

View File

@ -1,61 +0,0 @@
---
ps/global.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
--- ps/global.c
+++ ps/global.c 2022-03-29 09:31:24.242140877 +0000
@@ -257,8 +257,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){
@@ -400,6 +403,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 */
@@ -427,6 +431,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";
@@ -452,12 +457,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:
@@ -498,8 +505,8 @@ void reset_global(void){
}
// --- <pids> interface --------------------------------------------------
- set_screen_size();
set_personality();
+ set_screen_size();
all_processes = 0;
bsd_c_option = 0;

View File

@ -1,13 +0,0 @@
--- proc/devname.c
+++ proc/devname.c 2012-06-01 13:35:43.452010553 +0000
@@ -51,6 +51,10 @@
#define minor <-- do not use -->
#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

View File

@ -1,14 +0,0 @@
---
pwdx.c | 1 +
1 file changed, 1 insertion(+)
--- pwdx.c
+++ pwdx.c 2016-07-11 13:17:16.154313659 +0000
@@ -109,6 +109,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

@ -1,51 +0,0 @@
---
sysctl.8 | 2 ++
sysctl.c | 12 ++++++++++++
2 files changed, 14 insertions(+)
--- sysctl.8
+++ sysctl.8 2022-03-29 10:21:47.926686046 +0000
@@ -117,6 +117,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
--- sysctl.c
+++ sysctl.c 2022-03-29 10:20:51.795708321 +0000
@@ -40,6 +40,7 @@
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/utsname.h>
#include <unistd.h>
#include <ctype.h>
@@ -794,6 +795,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",
@@ -858,6 +860,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);

File diff suppressed because it is too large Load Diff

View File

@ -1,84 +1,47 @@
#
# spec file for package procps
# spec file for package procps (Version 3.2.7)
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# 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/
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
%define somajor 0
%define libname libproc-2-%{somajor}
%if !0%{?usrmerged}
%bcond_with bin2usr
%else
%bcond_without bin2usr
%endif
%bcond_without pidof
%bcond_without nls
Name: procps
Version: 4.0.0
Release: 0
Summary: The ps utilities for /proc
License: GPL-2.0-or-later AND LGPL-2.1-or-later
URL: http://procps.sf.net
License: GPL, LGPL
Group: System/Monitoring
URL: https://sf.net/projects/procps-ng/
Source: https://downloads.sourceforge.net/project/procps-ng/Production/procps-ng-%{version}.tar.xz
#Alternate: https://gitlab.com/procps-ng/procps/-/archive/v%{version}/procps-v%{version}.tar.gz
Source1: procps-rpmlintrc
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
Patch10: procps-ng-4.0.0-accuracy.dif
Patch11: procps-ng-3.3.10-xen.dif
Patch13: procps-v3.3.3-columns.dif
Patch14: procps-ng-4.0.0-integer-overflow.patch
Patch16: procps-ng-3.3.8-bnc634840.patch
Patch17: procps-v3.3.3-read-sysctls-also-from-boot-sysctl.conf-kernelversion.diff
Patch18: procps-ng-3.3.8-petabytes.patch
Patch19: procps-ng-3.3.10-large_pcpu.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-UPSTREAM -- Avoid error on AIX sort formats
Patch34: 0001-top-update-one-function-prologue-after-rcfile-change.patch
Patch35: 0002-ps-restore-aix-behavior-while-keeping-an-original-fi.patch
Patch36: 0003-ps-restore-thread-display-when-using-a-pidlist-optio.patch
# PATCH-FIX-SUSE -- Avoid float errors on 32bit architectures
Patch37: procps-ng-4.0.0-floats.dif
BuildRequires: automake
BuildRequires: dejagnu
BuildRequires: diffutils
BuildRequires: libselinux-devel
BuildRequires: libtool
BuildRequires: ncurses-devel
BuildRequires: pkgconfig
BuildRequires: screen
BuildRequires: xz
BuildRequires: pkgconfig(libsystemd)
Provides: ps = %{version}-%{release}
Obsoletes: ps < %{version}-%{release}
%ifarch ia64 x86_64 ppc64 ppc %{sparc}
BuildRequires: libnuma-devel
%endif
%lang_package
PreReq: %fillup_prereq %insserv_prereq
Autoreqprov: on
Version: 3.2.7
Release: 3
Summary: ps utilities for /proc
Provides: ps
Obsoletes: ps
Source: http://procps.sourceforge.net/procps-%version.tar.bz2
Source1: boot.sysctl
Source2: systat.xinetd
Source3: sysctl.conf
Patch: procps-3.2.3-make.diff
Patch1: procps-3.2.2-100cpus.diff
Patch2: procps-3.2.5-eof.diff
Patch3: procps-3.2.2-ia64.diff
Patch6: procps-3.2.7-manycpus.diff
Patch7: procps-3.2.2-w-notruncate.diff
Patch8: procps-3.2.2-w-simply-work.diff
Patch9: procps-3.2.7-top.1.diff
Patch10: procps-3.2.2-top-termsize.patch
Patch11: procps-3.2.3-buffersize.diff
Patch12: pwdx-bufferoverflow.diff
Patch13: procps-3.2.5-pmap-smaps-rml-2.patch
Patch15: procps-3.2.5-top-rc.patch
Patch16: procps-3.2.7-cpu_hotplug.patch
Patch17: procps-3.2.5-CPU-states.patch
Patch18: procps-3.2.7-readeof.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
The procps package contains a set of system utilities that provide
@ -98,303 +61,514 @@ 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 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}
%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.
Authors:
--------
Albert Cahalan <albert@users.sf.net>
(and many more)
%prep
%setup -q -n %{name}-ng-%{version}
%patch1
%patch3 -b .trcate
%patch7 -b .rof
%patch8 -b .cache
%patch10 -b .acc
%patch11
%patch13 -b .column
%patch14 -b .ovrflw
%patch16
%patch17 -b .sysctl
%setup -q
%patch -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch15 -p1
%patch16 -p1
%patch17
%patch18
%patch19
%patch20
%patch21
%patch28
%patch31 -p1
%patch32
%patch33 -b .pmap4us
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37
%build
test -s .tarball-version || echo %{version} > .tarball-version
#./autogen.sh
autoreconf -fiv
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 \
./pmap $$ || {
uname -a
echo /proc/$$/maps
cat /proc/$$/maps
echo /proc/$$/smaps
cat /proc/$$/smaps
exit 1
}
make CFLAGS="-Wall -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 $RPM_OPT_FLAGS -pipe" \
CC="gcc"
%install
%make_install
install -d %{buildroot}/bin
install -d %{buildroot}/sbin
make DESTDIR=$RPM_BUILD_ROOT install
install -d $RPM_BUILD_ROOT/etc/init.d $RPM_BUILD_ROOT/etc/xinetd.d
install -m 755 %SOURCE1 $RPM_BUILD_ROOT/etc/init.d
install -m 644 %SOURCE2 $RPM_BUILD_ROOT/etc/xinetd.d/systat
install -m 644 %SOURCE3 $RPM_BUILD_ROOT/etc
# clean unwanted files (coreutils)
rm -f $RPM_BUILD_ROOT/bin/kill
rm -f $RPM_BUILD_ROOT/usr/bin/uptime
rm -f $RPM_BUILD_ROOT%_mandir/man1/kill.1
rm -f $RPM_BUILD_ROOT%_mandir/man1/uptime.1
# 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
%clean
rm -rf $RPM_BUILD_ROOT
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
%post
%{fillup_and_insserv -ny boot.sysctl boot.sysctl}
%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%{?usrmerged}
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
#
# 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
SCREENDIR=$(mktemp -d ${PWD}/screen.XXXXXX) || exit 1
SCREENRC=${SCREENDIR}/bash
export SCREENRC SCREENDIR
exec 0< /dev/null
SCREENLOG=${SCREENDIR}/log
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
TMPDIR=$(mktemp -d /tmp/bash.XXXXXXXXXX) || exit 1
> $SCREENLOG
tail -q -s 0.5 -f $SCREENLOG & pid=$!
env HOME=$PWD TERM=$TERM TMPDIR=$TMPDIR SCREENRC=$SCREENRC SCREENDIR=$SCREENDIR \
screen -D -m make check
kill -TERM $pid
error=no
for log in test-suite.log testsuite/*.log
do
if grep -E '^(XFAIL|FAIL|ERROR):' $log
then
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
%postun
%insserv_cleanup
%files
%defattr (-,root,root,755)
%license COPYING COPYING.LIB
%doc NEWS Documentation/bugs.md Documentation/FAQ
%if %{with bin2usr}
%if !0%{?usrmerged}
%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
%doc NEWS README COPYING
%config /etc/init.d/boot.sysctl
%config(noreplace) /etc/sysctl.conf
%config(noreplace) /etc/xinetd.d/systat
/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}
/usr/bin/free
/usr/bin/pgrep
/usr/bin/pkill
/usr/bin/pmap
/usr/bin/pwdx
/usr/bin/skill
/usr/bin/slabtop
/usr/bin/snice
/usr/bin/tload
/usr/bin/top
/usr/bin/vmstat
/usr/bin/w
/usr/bin/watch
%_mandir/man1/free.1.gz
%_mandir/man1/pgrep.1.gz
%_mandir/man1/pkill.1.gz
%_mandir/man1/pmap.1.gz
%_mandir/man1/ps.1.gz
%_mandir/man1/pwdx.1.gz
%_mandir/man1/skill.1.gz
%_mandir/man1/slabtop.1.gz
%_mandir/man1/snice.1.gz
%_mandir/man1/tload.1.gz
%_mandir/man1/top.1.gz
%_mandir/man1/w.1.gz
%_mandir/man1/watch.1.gz
%_mandir/man5/sysctl.conf.5.gz
%_mandir/man8/vmstat.8.gz
%_mandir/man8/sysctl.8.gz
%files devel
%defattr (-,root,root,755)
%dir %{_includedir}/procps
%{_includedir}/procps/*.h
%{_libdir}/libproc-2.so
%{_libdir}/pkgconfig/libproc-2.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}/libproc-2.so.%{somajor}*
%files lang -f procps-ng.lang
%changelog
%changelog -n procps
* Fri Jul 28 2006 - werner@suse.de
- Don't stop reading if the read buffer boundary is reached [#194598]
* Fri Jul 28 2006 - olh@suse.de
- remove unneeded boot.ldconfig from boot.sysctl
boot.sysctl should depend on boot.localfs (#181972)
* Mon Jun 26 2006 - werner@suse.de
- Update to version 3.2.7
* Thu May 18 2006 - werner@suse.de
- Add stealtime patch (bug #86394)
* Mon Mar 20 2006 - hvogel@suse.de
- fix %%CPU column format [#159480]
* Thu Mar 16 2006 - hvogel@suse.de
- make CPU states consistent [#158572]
* Wed Mar 15 2006 - hvogel@suse.de
- fix last patch to not lead to constant CPU usage [#156395]
* Mon Feb 20 2006 - hvogel@suse.de
- dont crash if a CPU is hotplugged [#151285]
* Wed Feb 08 2006 - hvogel@suse.de
- fix ~/.toprc handling [#140319]
* Fri Jan 27 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
* Tue Jan 24 2006 - mmj@suse.de
- Add support for terabytes of memory [#145014]
* Wed Jan 04 2006 - mmj@suse.de
- Document 'H' - Threads in top.1 (thanks Tony Ernst)
* Mon Oct 31 2005 - mmj@suse.de
- Update to 3.2.6:
o vmstat: /proc/stat buffer big enough for 1024 CPUs
o dietlibc needs termios.h for struct winsize
o top: can do per-task display
o more MIPS crud
o begin prep for setuid
o top: fix %%CPU max on 2..9 CPU SMP
o ps: fix crash related to realloc
o ps: man page more detailed
o spelling fixes
o top: crash on resize fixed
o vmstat: -p handles /dev/ and does not overflow
* Thu Oct 13 2005 - mmj@suse.de
- Updated patch from rml
* Wed Oct 12 2005 - mmj@suse.de
- Add patch from Chris Rivera for "smaps" that provides per-mapping
RSS information.
* Mon Apr 18 2005 - mmj@suse.de
- Fix potential bufferoverflow in pwdx [#78074]
* Tue Feb 08 2005 - mmj@suse.de
- Update to 3.2.5:
* display problem on 64-bit systems fixed
* top: variable-width PID and PPID
* top: variable-width %%CPU
* sysctl: better error messages
* ps: security labels can contain any printable ASCII
* top: help and version message on stdout, with exit(0)
* ps: SIGTSTP and SIGTTOU shouldn't print bug email address
* slabtop: compile with glibc 2.2.17 (and older, likely)
* slabtop: fix overflow on huge NUMA boxes
* slabtop: accept any slabinfo 2.x format
* ps: alignment after WCHAN fixed
* pmap: when no -x or -d option, show full path
* Tue Jan 11 2005 - mmj@suse.de
- Make our CFLAGS and RPM_OPT_FLAGS actually get used [#49378]
* Tue Dec 07 2004 - mmj@suse.de
- Update to procps-3.2.4:
* support 64-bit MIPS with n32 binary
* sparc32 optimized for sparc32 again
* pwdx: new command
* ps: UTF-8 username + command
* ps: more room for some columns
* ps: tolerate SubDomain security module CONTEXT/LABEL data
* watch: passes COLUMNS and LINES in environment
* top: in batch mode, tolerate unknown $TERM
* pkill: quiet about processes that die before kill()
* Wed Oct 27 2004 - mmj@suse.de
- Increase buffer size for reading proc files. [#44776]
* Thu Sep 23 2004 - lmuelle@suse.de
- Ensure to activate boot.sysctl if we do a first installation, [#44481].
* Wed Sep 15 2004 - lmuelle@suse.de
- Add default sysctl.conf file.
* Mon Aug 16 2004 - garloff@suse.de
- Update to procps-3.2.3:
* avoid truncating long usernames
* avoid warning about -lncurses when not linking (more)
* new names for shared libraries (packagers: watch out!)
* build fixes and manpages updates
* wchan now '*' for multi-threaded processes
* ps: STAT shows l for multi-threaded processes
* vmstat: some overflow problems fixed -- thanks Holger Kiehl
- Use ps manpage from from the package.
* Tue Aug 03 2004 - garloff@suse.de
- Update to procps-3.2.2:
* build tweaks and docu updates
* ps: k option and personality-specific -x support
* sysctl: -a and -N options, better error handling
* top: tolerate sparse CPU numbering, cope with terminals
lacking ram & sram, avoid xterm clear-to-eol at eol
* vmstat: fix -d
* watch: sub-second intervals
- Rediff patches.
* Wed Jun 02 2004 - uli@suse.de
- fixed crash in small terminal (bug #37651)
* Tue Mar 30 2004 - stepan@suse.de
- Fix ps.1 [#35584]
- update to 3.2.1 to get rid of incompatible SE Linux patches.
3.2.1 is a bugfix release:
* ps: STAT flags for fg process group and session leader
* ps: STAT flags for swapped out process dropped (was broken)
* ps: new -M and Z options for security data (SE Linux, etc.)
* slabtop: detect broken /proc/slabinfo -- thanks to Fabian
Frederick
* slabtop: ensure that error messages show up on the screen --
FF again
* Mon Mar 29 2004 - mmj@suse.de
- Fix top.1 man page and include pmap.1 [#35584]
* Sun Mar 21 2004 - adrian@suse.de
- show the result of w also with line wrapps, like in good old times.
(ok'ed by stepan)
* Wed Mar 03 2004 - stepan@suse.de
- add notruncate option to w (for powermanagement code)
* Mon Mar 01 2004 - stepan@suse.de
- fix handling of many CPUs in top (#34347)
* Tue Feb 24 2004 - stepan@suse.de
- update to procps 3.2.0
* build on IA-64 again
* pmap: output like Solaris 9, not Solaris 7
* ps: also handle SELinux on the 2.4.xx kernels
* top: during a ^Z, the terminal was messed up
* future-proof the tty handling
* add slabtop
* pmap: detect the primary stack
* pmap: -d format
* free: report high and low memory
* Fri Feb 20 2004 - ro@suse.de
- boot.sysctl: do nothing for stop case
* Sun Feb 15 2004 - kukuk@suse.de
- Disable some tests not working on all architectures
* Sat Feb 14 2004 - kukuk@suse.de
- Rename package to procps
- Move procinfo and psmisc into seperate packages
- Update to 3.1.15 (includes SELinux support)
* Fri Jan 23 2004 - bk@suse.de
- pstree: UTF-8: never draw >1 '+' at end of line(no change for ASCII)
- pstree: Fix -G which uses VT100 line drawing: use the full width
* Mon Nov 17 2003 - stepan@suse.de
- fix package to build as user. Thanks to olh.
* Thu Oct 23 2003 - stepan@suse.de
- update to procps 3.1.14
* ps fully supports thread display (H, -L, m, -m, and -T)
* top can show CPU usage for IO-wait, IRQ, and softirq
* can set $PS_FORMAT to choose your own default ps format
* better width control ("ps -o pid,wchan:42,args")
* width of ps PID column adjusts to your system
* vmstat lets you choose units you like: 1000, 1024, 1000000...
* top can sort by any column (old sort keys available too)
* top can select a single user to display
* top can be put in multi-window mode and/or color mode
* vmstat has the -s option, as found on UNIX and BSD systems
* vmstat has the -f option, as found on UNIX and BSD systems
* watch doesn't eat the first blank line by mistake
* vmstat uses a fast O(1) algorithm on 2.5.xx kernels
* pmap command is SunOS-compatible
* vmstat shows IO-wait time
* pgrep and pkill can find the oldest matching process
* sysctl handles the Linux 2.5.xx VLAN interfaces
* ps has a new "-F" format (very nice, like DYNIX/ptx has)
* ps with proper BSD process selection
* better handling of very long uptimes
* Tue Oct 14 2003 - stepan@suse.de
- fix 32bit build on AMD64
* Wed Oct 01 2003 - stepan@suse.de
- update to procps 3.1.13
* Sat Sep 20 2003 - schwab@suse.de
- Handle EOF from terminal [#31126].
* Mon Sep 15 2003 - stepan@suse.de
- fix "#C" display problem with more than 99 CPUs. (#28163)
* Fri Sep 05 2003 - stepan@suse.de
- top: fix 4G overflow on 64bit platforms (bug #28539)
(procps-3.1.11-bigproc.diff)
* Fri Aug 08 2003 - stepan@suse.de
- update procps to version 3.1.11:
* compile with gcc 2.95 again (C99 issue)
- fix sysctl insertion (bug #28593)
* Mon Jul 14 2003 - stepan@suse.de
- update procps to version 3.1.10
* handle GPLONLY_ symbols
* kill: better man page
* skill: better man page
* ps: PID-like columns change width as needed
* top: COMMAND instead of Command
* vmstat: -m displays slabinfo
* vmstat: -d displays disk stats
- update psmisc to 21.3 (has our patch included)
* SELinux SID selection uses -d instead of -S to stop the
confusion of signal names.
* Doesnt segfault on long cmdnames, thanks Ben Low
* More fixes for types, also some GCC 3.2 fixes
* Changed a long to a long long in pstree.
* Fri Jul 04 2003 - stepan@suse.de
- update to version 3.1.9
* memory sizes fixed for 64-bit w/ gcc 3.x
* ps: detect broken OS install w/o /proc mounted
* top: fix suspend/resume behavior
* top: ditch warning until a _good_ interface is found
* kill: more info in the man page
* ps: document the -o, o, -O, and O options
* vmstat: choose units you like: 1000, 1024, 1000000...
* Fri Jun 13 2003 - coolo@suse.de
- fixing cwd
* Thu Jun 12 2003 - coolo@suse.de
- use %%find_lang
* Tue Jun 03 2003 - coolo@suse.de
- use BuildRoot
- use %%_mandir
* Wed May 14 2003 - stepan@suse.de
- drop XConsole and xcpustate as there are the almost identical
tools xconsole and xosview. This drops X11 dependencies of this
package completely.
- fix default permissions of locale directories (bug #26120)
* Thu Mar 27 2003 - stepan@suse.de
- fix truncating bug in pstree when specifying -al
- merge psmisc diffs
* Fri Mar 21 2003 - stepan@suse.de
- update procps to 3.1.8
- update xcpustate to 2.6beta
- fix build on itanium
* Wed Mar 05 2003 - stepan@suse.de
- add xinetd config file for systat service
* Tue Mar 04 2003 - stepan@suse.de
- update procps to 3.1.6
* includes discontig mem fixes
* includes fix for missing processes (bug #23526)
* Mon Feb 24 2003 - stepan@suse.de
- new, working discontig patch
* Wed Feb 19 2003 - stepan@suse.de
- fix broken ps with discontig kernel (bug #23788)
* Mon Feb 03 2003 - schwab@suse.de
- Don't package uptime, now part of coreutils.
* Wed Nov 27 2002 - stepan@suse.de
- fix newlines in string again, to satisfy compiler (killall)
* Fri Nov 22 2002 - stepan@suse.de
- make x utility build triggerable by %%{build_with_x}
* Thu Nov 14 2002 - werner@suse.de
- Stupid compiler does not accept newlines in strings.
* Tue Oct 15 2002 - werner@suse.de
- Fix bug #20604: new procps version 2.0.10
- port all required patches to 2.0.10
- Update psmisc to 21.2
- port all required patches to 21.2
* Tue Sep 10 2002 - adrian@suse.de
- fix split alias
-Obsoletes: ps:/usr/X11R6/bin/xcpustate
+Provides: ps:/usr/X11R6/bin/xcpustate
* Thu Aug 22 2002 - kukuk@suse.de
- fix PreRequires.
* Fri Aug 16 2002 - werner@suse.de
- Add PreReq (bug #17963)
* Thu Aug 15 2002 - ro@suse.de
- modify required-start in boot.sysctl: boot.setup is gone
* Tue Aug 06 2002 - werner@suse.de
- Statistics of cpu usage: no negative averages (bug #17449)
* Mon Aug 05 2002 - kukuk@suse.de
- boot.sysclt: rename serial to setserial, setserial and
boot.isapnp are "should-start".
* Wed Mar 20 2002 - ro@suse.de
- boot.sysctl: don't write out sysctl.conf if it doesn't exist
sysctl can't read the file of a complete dump
* Fri Feb 22 2002 - werner@suse.de
- Fix bug #12816: generate signal list with signal cpp macros
to get it correct on all architectures. Make SIG prefix
work of signal names.
* Fri Feb 01 2002 - ro@suse.de
- added stop/status for sysctl boot script
* Mon Jan 21 2002 - ro@suse.de
- added boot-script for sysctl (inactive by default)
* Mon Jan 07 2002 - ro@suse.de
- fixed segfault (thanks to andreas)
* Thu Dec 20 2001 - werner@suse.de
- Make it compile
* Thu Dec 20 2001 - werner@suse.de
- Sometimes it happens that /proc can not be open, then we have
to exit gratefully :^)
* Fri Nov 09 2001 - schwab@suse.de
- Fix idle time overflow in vmstat.
- Fix missing declarations.
* Mon Sep 17 2001 - werner@suse.de
- Fix lsdev from procinfo
- Use the correct type for uptime integers (procinfo)
* Tue Sep 04 2001 - werner@suse.de
- Move fuser from /usr/bin/ to /bin/
* Tue Sep 04 2001 - werner@suse.de
- Fix bug #9797: update to psmisc-20.1
- Update procinfo to procinfo-18
- Add bigbuff, retcode, sysctl-error, and biguid patch frm RH
(last one should fix bug #9933)
* Tue Apr 24 2001 - werner@suse.de
- Package split (#7078)
* Fri Apr 20 2001 - werner@suse.de
- tty in proc's stat is an int
* Thu Mar 29 2001 - ro@suse.de
- initialize page_size before first use
* Wed Mar 28 2001 - schwab@suse.de
- Kill improper use of PAGE_SIZE.
* Tue Mar 27 2001 - werner@suse.de
- Make it work again
- Make w know about locale
* Tue Mar 13 2001 - schwab@suse.de
- Use getpagesize instead of PAGE_SHIFT.
- Don't compile with -fwritable-strings.
* Mon Mar 12 2001 - werner@suse.de
- Skip oldps
* Fri Mar 09 2001 - werner@suse.de
- Make it run on a IA64
* Mon Feb 19 2001 - werner@suse.de
- Make program watch recognize locale environment (bug#6395)
* Thu Jan 25 2001 - werner@suse.de
- Make `fuser -s -k' work (bug#6143)
* Mon Jan 22 2001 - werner@suse.de
- Avoid segfaults on mmap'ed buffer by adding '\0'
* Wed Jan 10 2001 - werner@suse.de
- Fix format handling (bug#5386)
* Wed Dec 20 2000 - werner@suse.de
- Reset locale during sscanf calls to POSIX
* Tue Dec 19 2000 - werner@suse.de
- Use %%llu for input (sscanf) and output (printf) format of
unsigned long long (free.c, top.c, and sysinfo.c).
* Wed Dec 13 2000 - werner@suse.de
- Update to procps 2.0.7: now SMP should be visible in top
- Remove sessreg from file list
- Add pgrep and pkill to file list
* Mon Dec 04 2000 - ro@suse.de
- don't try to strip man-pages
* Wed Nov 22 2000 - uli@suse.de
- fixed to build on PPC
* Fri Nov 17 2000 - ro@suse.de
- compile-fix for old sessreg (glibc/X11 clash atexit)
* Sat May 27 2000 - kukuk@suse.de
- Add Group tag
- Use docdir macro
* Mon May 08 2000 - ro@suse.de
- procinfo fixed for smp/alpha
* Mon Feb 28 2000 - werner@suse.de
- Install some docus (closes bug #1509)
* Fri Feb 25 2000 - kukuk@suse.de
- Fix problem that glibc and ncurses uses the same define for
different things.
* Thu Feb 24 2000 - schwab@suse.de
- procps: fix scanf format string
* Fri Feb 04 2000 - kasal@suse.cz
- remove smp_num_cpus -- it's done in 2.0.6
* Wed Jan 19 2000 - ro@suse.de
- usr/man -> usr/share/man
* Wed Jan 19 2000 - kasal@suse.de
- fixed "ps u" -- ie. fixed read_total_main()
* Mon Dec 06 1999 - werner@suse.de
- Argh: fix Makefile to install sysctl.conf.5 man page
* Mon Dec 06 1999 - werner@suse.de
- Install sysctl tool of procps 2.0.6
* Fri Dec 03 1999 - kasal@suse.de
- upgraded procps to 2.0.6, to get the package compiled on sparc
* Wed Nov 24 1999 - kettner@suse.de
- fixed bug in procinfo on AXP
* Mon Sep 13 1999 - bs@suse.de
- ran old prepare_spec on spec file to switch to new prepare_spec.
* Tue Sep 07 1999 - werner@suse.de
- Avoid SEGV if /proc isn't mounted (e.g. in single user mode)
* Tue Sep 07 1999 - werner@suse.de
- Fix some maunal page (missed tbl mark, some nasty .TH's)
* Wed Aug 18 1999 - werner@suse.de
- Update procinfo (ver 17), procps (ver 2.0.2) but hold
ver 1.2.11 (sessreg, XConsole, libproc for xcpustate),
update psmisc (ver 18)
- Patch procps 2.0.2 with debian diff and make ps
usable again (select bits should be 0x0a0a to see
all ttys if ps is called).
* Wed Apr 14 1999 - bk@suse.de
- updated procinfo patckage from version 15 to 16
* annoying interrupt warning("recompile me!") is gone
* display on SMP has been fixed
* Tue Apr 06 1999 - bk@suse.de
- update to procps-1.2.11
- fixed segfault in /usr/bin/w
* Mon Mar 22 1999 - florian@suse.de
- update to procps-1.2.10
* Fri Oct 30 1998 - ro@suse.de
- update to procinfo-15 and procps-1.2.9
- extra source for xcpustate-2.5 (no more in procps)
- patched xcpustate to display mem,swap,net for linux
* Thu May 07 1998 - florian@suse.de
- add "-g" option to killall to kill a complete process group
- update to procps 1.2.7
- update to procinfo 13
* Fri Mar 13 1998 - bs@suse.de
- switched version to `date` (problem with version for update).
* Mon Mar 02 1998 - florian@suse.de
- update to psmisc 17
- update to procps 1.2.6
- update to procinfo 12
* Fri Oct 17 1997 - ro@suse.de
- ready for autobuild
* Sat Jul 05 1997 - florian@suse.de
- updated to 1.12.2 again (with fixes)
- fix output of free
- top with wrong options won't destroy the display
- XConsole is not suid-root anymore as "xconsole" can be used without
being suid root
* Mon Jun 30 1997 - bs@suse.de
- switched back to version 1.11.6
* Sun Jun 22 1997 - florian@suse.de
- update to version 1.12.2
- add procinfo 0.11
* Tue May 20 1997 - florian@suse.de
- update to version 1.11.6
* Sun Apr 13 1997 - florian@suse.de
- update to new version 1.11.3
- update to psmisc 12a
* Wed Jan 22 1997 - florian@suse.de
- update to version 1.11.1
* Thu Jan 02 1997 - florian@suse.de
new version 1.01
'top' is completely new
people might get a much faster 'ps', if they delete '/etc/psdevtab'
and call 'ps' as root...

10
pwdx-bufferoverflow.diff Normal file
View File

@ -0,0 +1,10 @@
--- procps-3.2.7/pwdx.c
+++ procps-3.2.7/pwdx.c 2006-06-26 16:38:12.000000000 +0200
@@ -60,6 +60,7 @@
for (i = 1; i < argc; i++) {
if (regexec(&re, argv[i], 0, NULL, 0) != 0) {
snprintf(buf, sizeof buf, "pwdx: invalid process id: %s\n", argv[i]);
+ buf[sizeof(buf)-1] = '\0';
die(buf);
}
if (!strcmp("-V", argv[i]) || !strcmp("--version", argv[i]))

0
ready Normal file
View File

7
sysctl.conf Normal file
View File

@ -0,0 +1,7 @@
# Disable response to broadcasts.
# You don't want yourself becoming a Smurf amplifier.
net.ipv4.icmp_echo_ignore_broadcasts = 1
# enable route verification on all interfaces
net.ipv4.conf.all.rp_filter = 1
# enable ipV6 forwarding
#net.ipv6.conf.all.forwarding = 1

17
systat.xinetd Normal file
View File

@ -0,0 +1,17 @@
# Finger, systat and netstat give out user information which may be
# valuable to potential "system crackers." Many sites choose to disable
# some or all of these services to improve security.
# Try "telnet localhost systat" and "telnet localhost netstat" to see that
# information yourself!
#
service systat
{
disable = yes
socket_type = stream
protocol = tcp
wait = no
user = nobody
server = /bin/ps
server_args = -auwwx
}