From 5602d74872d0b7aa418152bf7ccbbb8ca9b60655 Mon Sep 17 00:00:00 2001 From: Rmys Date: Wed, 7 Dec 2022 12:42:46 +0300 Subject: [PATCH] procps ver. bump --- .../files/fedora/covscan-findings.patch | 49 ++ .../procps/files/fedora/free-si-fix.patch | 12 + .../files/fedora/pwait-to-pidwait.patch | 286 ++++++ .../files/fedora/sysctl-hyphen-param.patch | 833 ++++++++++++++++++ .../sysctl-print-dotted-keys-again.patch | 153 ++++ system/base/procps/files/fs66093.patch | 60 -- system/base/procps/files/nohz.patch | 10 - .../files/procps-3.2.2-top-termsize.patch | 10 - .../files/procps-3.2.2-w-simply-work.diff | 19 - .../base/procps/files/procps-3.2.5-eof.diff | 11 - .../files/procps-3.2.5-proc-mount.patch | 6 - .../base/procps/files/procps-3.2.7-0x9b.patch | 28 - .../base/procps/files/procps-3.2.7-FAQ.patch | 49 -- .../files/procps-3.2.7-free-hlmem.patch | 23 - .../files/procps-3.2.7-libselinux.patch | 61 -- .../procps/files/procps-3.2.7-longcmd.patch | 22 - .../base/procps/files/procps-3.2.7-misc.patch | 36 - .../procps/files/procps-3.2.7-noproc.patch | 19 - .../procps/files/procps-3.2.7-ps-cgroup.patch | 67 -- .../procps/files/procps-3.2.7-ps-eip64.patch | 48 - .../files/procps-3.2.7-ps-libselinux.patch | 11 - .../files/procps-3.2.7-ps-man-fmt.patch | 12 - .../procps/files/procps-3.2.7-ps-stime.patch | 71 -- .../procps/files/procps-3.2.7-pseudo.patch | 19 - .../procps/files/procps-3.2.7-psman.patch | 22 - .../files/procps-3.2.7-slabtop-once.patch | 113 --- .../files/procps-3.2.7-sysctl-ignore.patch | 87 -- .../files/procps-3.2.7-sysctl-writeonly.patch | 56 -- .../files/procps-3.2.7-top-clrscr.patch | 19 - .../procps/files/procps-3.2.7-top-cpu0.patch | 20 - .../files/procps-3.2.7-top-cpuint.patch | 12 - .../files/procps-3.2.7-top-env-cpuloop.patch | 83 -- .../files/procps-3.2.7-top-env-vmsize.patch | 55 -- .../files/procps-3.2.7-top-manpage.patch | 24 - .../procps/files/procps-3.2.7-top-rc.patch | 15 - .../files/procps-3.2.7-top-remcpu.patch | 98 --- .../files/procps-3.2.7-top-sorthigh.path | 37 - .../base/procps/files/procps-3.2.7-top.1.diff | 342 ------- .../files/procps-3.2.7-vmstat-cpusteal.patch | 52 -- .../files/procps-3.2.7-vmstat-header.patch | 12 - .../procps-3.2.7-vmstat-partstats-long.patch | 95 -- ...cps-3.2.7-vmstat-partstats-reqwrites.patch | 12 - .../files/procps-3.2.7-vmstat-pgpg.patch | 235 ----- ...rocps-3.2.7-vmstat-timestamp-manpage.patch | 22 - .../files/procps-3.2.7-vmstat-timestamp.patch | 117 --- .../procps/files/procps-3.2.7-w-best.patch | 16 - .../files/procps-3.2.7-watch-unicode.patch | 139 --- .../procps-3.2.8-constructor-order.patch | 38 - .../base/procps/files/procps-3.2.8-make.patch | 13 - ...-3.2.8-ps-cgroup-suppress-root-group.patch | 36 - .../procps/files/procps-3.2.8-setlocale.patch | 66 -- .../procps/files/procps-3.2.8-threads.patch | 49 -- .../files/procps-3.2.8-vmstat-getopt.patch | 126 --- .../procps/files/procps-enable-core.patch | 11 - .../base/procps/files/procps-pmap-smaps.patch | 138 --- .../procps/files/pwdx-bufferoverflow.diff | 10 - system/base/procps/pspec.xml | 15 +- 57 files changed, 1346 insertions(+), 2754 deletions(-) create mode 100644 system/base/procps/files/fedora/covscan-findings.patch create mode 100644 system/base/procps/files/fedora/free-si-fix.patch create mode 100644 system/base/procps/files/fedora/pwait-to-pidwait.patch create mode 100644 system/base/procps/files/fedora/sysctl-hyphen-param.patch create mode 100644 system/base/procps/files/fedora/sysctl-print-dotted-keys-again.patch delete mode 100644 system/base/procps/files/fs66093.patch delete mode 100644 system/base/procps/files/nohz.patch delete mode 100644 system/base/procps/files/procps-3.2.2-top-termsize.patch delete mode 100644 system/base/procps/files/procps-3.2.2-w-simply-work.diff delete mode 100644 system/base/procps/files/procps-3.2.5-eof.diff delete mode 100644 system/base/procps/files/procps-3.2.5-proc-mount.patch delete mode 100644 system/base/procps/files/procps-3.2.7-0x9b.patch delete mode 100644 system/base/procps/files/procps-3.2.7-FAQ.patch delete mode 100644 system/base/procps/files/procps-3.2.7-free-hlmem.patch delete mode 100644 system/base/procps/files/procps-3.2.7-libselinux.patch delete mode 100644 system/base/procps/files/procps-3.2.7-longcmd.patch delete mode 100644 system/base/procps/files/procps-3.2.7-misc.patch delete mode 100644 system/base/procps/files/procps-3.2.7-noproc.patch delete mode 100644 system/base/procps/files/procps-3.2.7-ps-cgroup.patch delete mode 100644 system/base/procps/files/procps-3.2.7-ps-eip64.patch delete mode 100644 system/base/procps/files/procps-3.2.7-ps-libselinux.patch delete mode 100644 system/base/procps/files/procps-3.2.7-ps-man-fmt.patch delete mode 100644 system/base/procps/files/procps-3.2.7-ps-stime.patch delete mode 100644 system/base/procps/files/procps-3.2.7-pseudo.patch delete mode 100644 system/base/procps/files/procps-3.2.7-psman.patch delete mode 100644 system/base/procps/files/procps-3.2.7-slabtop-once.patch delete mode 100644 system/base/procps/files/procps-3.2.7-sysctl-ignore.patch delete mode 100644 system/base/procps/files/procps-3.2.7-sysctl-writeonly.patch delete mode 100644 system/base/procps/files/procps-3.2.7-top-clrscr.patch delete mode 100644 system/base/procps/files/procps-3.2.7-top-cpu0.patch delete mode 100644 system/base/procps/files/procps-3.2.7-top-cpuint.patch delete mode 100644 system/base/procps/files/procps-3.2.7-top-env-cpuloop.patch delete mode 100644 system/base/procps/files/procps-3.2.7-top-env-vmsize.patch delete mode 100644 system/base/procps/files/procps-3.2.7-top-manpage.patch delete mode 100644 system/base/procps/files/procps-3.2.7-top-rc.patch delete mode 100644 system/base/procps/files/procps-3.2.7-top-remcpu.patch delete mode 100644 system/base/procps/files/procps-3.2.7-top-sorthigh.path delete mode 100644 system/base/procps/files/procps-3.2.7-top.1.diff delete mode 100644 system/base/procps/files/procps-3.2.7-vmstat-cpusteal.patch delete mode 100644 system/base/procps/files/procps-3.2.7-vmstat-header.patch delete mode 100644 system/base/procps/files/procps-3.2.7-vmstat-partstats-long.patch delete mode 100644 system/base/procps/files/procps-3.2.7-vmstat-partstats-reqwrites.patch delete mode 100644 system/base/procps/files/procps-3.2.7-vmstat-pgpg.patch delete mode 100644 system/base/procps/files/procps-3.2.7-vmstat-timestamp-manpage.patch delete mode 100644 system/base/procps/files/procps-3.2.7-vmstat-timestamp.patch delete mode 100644 system/base/procps/files/procps-3.2.7-w-best.patch delete mode 100644 system/base/procps/files/procps-3.2.7-watch-unicode.patch delete mode 100644 system/base/procps/files/procps-3.2.8-constructor-order.patch delete mode 100644 system/base/procps/files/procps-3.2.8-make.patch delete mode 100644 system/base/procps/files/procps-3.2.8-ps-cgroup-suppress-root-group.patch delete mode 100644 system/base/procps/files/procps-3.2.8-setlocale.patch delete mode 100644 system/base/procps/files/procps-3.2.8-threads.patch delete mode 100644 system/base/procps/files/procps-3.2.8-vmstat-getopt.patch delete mode 100644 system/base/procps/files/procps-enable-core.patch delete mode 100644 system/base/procps/files/procps-pmap-smaps.patch delete mode 100644 system/base/procps/files/pwdx-bufferoverflow.diff diff --git a/system/base/procps/files/fedora/covscan-findings.patch b/system/base/procps/files/fedora/covscan-findings.patch new file mode 100644 index 00000000..c9a3b225 --- /dev/null +++ b/system/base/procps/files/fedora/covscan-findings.patch @@ -0,0 +1,49 @@ +diff --git a/lib/test_process.c b/lib/test_process.c +index e20b270d..f8ff5ed0 100644 +--- a/lib/test_process.c ++++ b/lib/test_process.c +@@ -69,6 +69,7 @@ signal_handler(int signum, siginfo_t *siginfo, void *ucontext) + exit(EXIT_FAILURE); + } + ++ free(signame); + } + + int main(int argc, char *argv[]) +diff --git a/pmap.c b/pmap.c +index 49a2a6a8..d8565fc3 100644 +--- a/pmap.c ++++ b/pmap.c +@@ -346,6 +346,9 @@ static void print_extended_maps (FILE *f) + if (listnode == NULL) { + assert(firstmapping == 2); + listnode = calloc(1, sizeof *listnode); ++ if (listnode == NULL) ++ xerrx(EXIT_FAILURE, _("ERROR: memory allocation failed")); ++ + if (listhead == NULL) { + assert(listtail == NULL); + listhead = listnode; +diff --git a/watch.c b/watch.c +index 1a95454e..772879cd 100644 +--- a/watch.c ++++ b/watch.c +@@ -124,8 +124,6 @@ static void reset_ansi(void) + + static void init_ansi_colors(void) + { +- int color; +- + short ncurses_colors[] = { + -1, COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW, + COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE +@@ -172,6 +170,9 @@ static int process_ansi_color_escape_sequence(char** escape_sequence) { + // ESC[ 48;2;⟨r⟩;⟨g⟩;⟨b⟩ m Select RGB background color + int num; + ++ if (!escape_sequence) ++ return 0; /* avoid NULLPTR dereference, return "not understood" */ ++ + if ((*escape_sequence)[0] != ';') + return 0; /* not understood */ + diff --git a/system/base/procps/files/fedora/free-si-fix.patch b/system/base/procps/files/fedora/free-si-fix.patch new file mode 100644 index 00000000..c414a98d --- /dev/null +++ b/system/base/procps/files/fedora/free-si-fix.patch @@ -0,0 +1,12 @@ +diff -up ./free.c.ori ./free.c +--- ./free.c.ori 2022-09-20 15:02:22.469320938 +0200 ++++ ./free.c 2022-09-20 15:03:33.767710892 +0200 +@@ -120,7 +120,7 @@ static const char *scale_size(unsigned l + + /* default output */ + if (args.exponent == 0 && !(flags & FREE_HUMANREADABLE)) { +- snprintf(buf, sizeof(buf), "%ld", size); ++ snprintf(buf, sizeof(buf), "%ld", (long)( ((long long int)size) * 1024 / (long long int)base)); + return buf; + } + diff --git a/system/base/procps/files/fedora/pwait-to-pidwait.patch b/system/base/procps/files/fedora/pwait-to-pidwait.patch new file mode 100644 index 00000000..b5997096 --- /dev/null +++ b/system/base/procps/files/fedora/pwait-to-pidwait.patch @@ -0,0 +1,286 @@ +From 52afb3a8d31871d28b1c39573a7ed5196c2d5023 Mon Sep 17 00:00:00 2001 +From: Craig Small +Date: Mon, 15 Feb 2021 21:10:06 +1100 +Subject: [PATCH] pidwait: Rename from pwait + +pwait is already in at least Debian in a different package + +References: + https://bugs.debian.org/982391 +--- +diff --git a/Makefile.am b/Makefile.am +index e037e4c..de15e13 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -49,8 +49,8 @@ bin_PROGRAMS = \ + uptime \ + vmstat \ + w +-if BUILD_PWAIT +-bin_PROGRAMS += pwait ++if BUILD_PIDWAIT ++bin_PROGRAMS += pidwait + endif + else + usrbin_exec_PROGRAMS += \ +@@ -85,8 +85,8 @@ dist_man_MANS += \ + sysctl.conf.5 \ + ps/ps.1 + +-if BUILD_PWAIT +-dist_man_MANS += pwait.1 ++if BUILD_PIDWAIT ++dist_man_MANS += pidwait.1 + endif + endif + +@@ -199,8 +199,8 @@ free_SOURCES = free.c lib/strutils.c lib/fileutils.c + pgrep_SOURCES = pgrep.c lib/fileutils.c lib/nsutils.c + pkill_SOURCES = pgrep.c lib/fileutils.c lib/nsutils.c + pmap_SOURCES = pmap.c lib/fileutils.c +-if BUILD_PWAIT +-pwait_SOURCES = pgrep.c lib/fileutils.c lib/nsutils.c ++if BUILD_PIDWAIT ++pidwait_SOURCES = pgrep.c lib/fileutils.c lib/nsutils.c + endif + if !CYGWIN + pwdx_SOURCES = pwdx.c lib/fileutils.c +diff --git a/NEWS b/NEWS +index da63c9c..5fe6761 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,3 +1,7 @@ ++procps-ng-NEXT ++--------------- ++ * Rename pwait to pidwait ++ + procps-ng-3.3.17 + --------------- + * library: Incremented to 8:3:0 +diff --git a/configure.ac b/configure.ac +index 56a8669..750c0fb 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -132,20 +132,20 @@ AC_TRY_COMPILE([#include ], + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no)) + +-AC_CHECK_FUNC([pidfd_open], [enable_pwait=yes], [ ++AC_CHECK_FUNC([pidfd_open], [enable_pidwait=yes], [ + AC_MSG_CHECKING([for __NR_pidfd_open]) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ + #include + #ifndef __NR_pidfd_open + #error __NR_pidfd_open not defined + #endif +- ])], [enable_pwait=yes], [enable_pwait=no]) +- AC_MSG_RESULT([$enable_pwait]) ++ ])], [enable_pidwait=yes], [enable_pidwait=no]) ++ AC_MSG_RESULT([$enable_pidwait]) + ]) +-if test "$enable_pwait" = yes; then +- AC_DEFINE([ENABLE_PWAIT], [1], [Enable pwait]) ++if test "$enable_pidwait" = yes; then ++ AC_DEFINE([ENABLE_PIDWAIT], [1], [Enable pidwait]) + fi +-AM_CONDITIONAL([BUILD_PWAIT], [test x$enable_pwait = xyes]) ++AM_CONDITIONAL([BUILD_PIDWAIT], [test x$enable_pidwait = xyes]) + + dnl watch8bit must be before the AC_ARG_WITH set as it sets up ncurses + AC_SUBST([WITH_WATCH8BIT]) +diff --git a/pgrep.1 b/pgrep.1 +index 4f8907b..af6dcd5 100644 +--- a/pgrep.1 ++++ b/pgrep.1 +@@ -9,7 +9,7 @@ + .\" + .TH PGREP "1" "2020-06-04" "procps-ng" "User Commands" + .SH NAME +-pgrep, pkill, pwait \- look up, signal, or wait for processes based on name and other attributes ++pgrep, pkill, pidwait \- look up, signal, or wait for processes based on name and other attributes + .SH SYNOPSIS + .B pgrep + [options] pattern +@@ -17,7 +17,7 @@ pgrep, pkill, pwait \- look up, signal, or wait for processes based on name and + .B pkill + [options] pattern + .br +-.B pwait ++.B pidwait + [options] pattern + .SH DESCRIPTION + .B pgrep +@@ -45,7 +45,7 @@ will send the specified signal (by default + .BR SIGTERM ) + to each process instead of listing them on stdout. + .PP +-.B pwait ++.B pidwait + will wait for each process instead of listing them on stdout. + .SH OPTIONS + .TP +@@ -60,7 +60,7 @@ only.) + \fB\-c\fR, \fB\-\-count\fR + Suppress normal output; instead print a count of matching processes. When + count does not match anything, e.g. returns zero, the command will return +-non-zero value. Note that for pkill and pwait, the count is the number of ++non-zero value. Note that for pkill and pidwait, the count is the number of + matching processes, not the processes that were successfully signaled or waited + for. + .TP +@@ -88,7 +88,7 @@ translated into + .BR pgrep 's, + .BR pkill 's, + or +-.BR pwait 's ++.BR pidwait 's + own process group. + .TP + \fB\-G\fR, \fB\-\-group\fR \fIgid\fP,... +@@ -126,7 +126,7 @@ is translated into + .BR pgrep 's, + .BR pkill 's, + or +-.BR pwait 's ++.BR pidwait 's + own session ID. + .TP + \fB\-t\fR, \fB\-\-terminal\fR \fIterm\fP,... +@@ -145,7 +145,7 @@ symbolical value may be used. + Negates the matching. This option is usually used in + .BR pgrep 's + or +-.BR pwait 's ++.BR pidwait 's + context. In + .BR pkill 's + context the short option is disabled to avoid accidental usage of the option. +@@ -154,7 +154,7 @@ context the short option is disabled to avoid accidental usage of the option. + Shows all thread ids instead of pids in + .BR pgrep 's + or +-.BR pwait 's ++.BR pidwait 's + context. In + .BR pkill 's + context this option is disabled. +@@ -167,7 +167,7 @@ match the + .TP + \fB\-F\fR, \fB\-\-pidfile\fR \fIfile\fR + Read \fIPID\fRs from \fIfile\fR. This option is more useful for +-.BR pkill or pwait ++.BR pkill or pidwait + than + .BR pgrep . + .TP +@@ -237,7 +237,7 @@ $ renice +4 $(pgrep chrome) + .PD 0 + .TP + 0 +-One or more processes matched the criteria. For pkill and pwait, one or more ++One or more processes matched the criteria. For pkill and pidwait, one or more + processes must also have been successfully signalled or waited for. + .TP + 1 +@@ -258,7 +258,7 @@ The running + .BR pgrep , + .BR pkill , + or +-.B pwait ++.B pidwait + process will never report itself as a + match. + .SH BUGS +diff --git a/pgrep.c b/pgrep.c +index 4fe5e8a..1905cd1 100644 +--- a/pgrep.c ++++ b/pgrep.c +@@ -38,7 +38,7 @@ + #include + #include + +-#if defined(ENABLE_PWAIT) && !defined(HAVE_PIDFD_OPEN) ++#if defined(ENABLE_PIDWAIT) && !defined(HAVE_PIDFD_OPEN) + #include + #include + #endif +@@ -68,8 +68,8 @@ + static enum { + PGREP = 0, + PKILL, +-#ifdef ENABLE_PWAIT +- PWAIT, ++#ifdef ENABLE_PIDWAIT ++ PIDWAIT, + #endif + } prog_mode; + +@@ -136,8 +136,8 @@ static int __attribute__ ((__noreturn__)) usage(int opt) + fputs(_(" -q, --queue integer value to be sent with the signal\n"), fp); + fputs(_(" -e, --echo display what is killed\n"), fp); + break; +-#ifdef ENABLE_PWAIT +- case PWAIT: ++#ifdef ENABLE_PIDWAIT ++ case PIDWAIT: + fputs(_(" -e, --echo display PIDs before waiting\n"), fp); + break; + #endif +@@ -687,7 +687,7 @@ static struct el * select_procs (int *num) + xerrx(EXIT_FAILURE, _("internal error")); + } + +- // pkill and pwait don't support -w, but this is checked in getopt ++ // pkill and pidwait don't support -w, but this is checked in getopt + if (opt_threads) { + while (readtask(ptp, &task, &subtask)){ + // don't add redundant tasks +@@ -742,7 +742,7 @@ static int signal_option(int *argc, char **argv) + return -1; + } + +-#if defined(ENABLE_PWAIT) && !defined(HAVE_PIDFD_OPEN) ++#if defined(ENABLE_PIDWAIT) && !defined(HAVE_PIDFD_OPEN) + static int pidfd_open (pid_t pid, unsigned int flags) + { + return syscall(__NR_pidfd_open, pid, flags); +@@ -793,9 +793,9 @@ static void parse_opts (int argc, char **argv) + {NULL, 0, NULL, 0} + }; + +-#ifdef ENABLE_PWAIT +- if (strcmp (program_invocation_short_name, "pwait") == 0) { +- prog_mode = PWAIT; ++#ifdef ENABLE_PIDWAIT ++ if (strcmp (program_invocation_short_name, "pidwait") == 0) { ++ prog_mode = PIDWAIT; + strcat (opts, "e"); + } else + #endif +@@ -1008,7 +1008,7 @@ int main (int argc, char **argv) + int num; + int i; + int kill_count = 0; +-#ifdef ENABLE_PWAIT ++#ifdef ENABLE_PIDWAIT + int poll_count = 0; + int wait_count = 0; + int epollfd = epoll_create(1); +@@ -1055,8 +1055,8 @@ int main (int argc, char **argv) + fprintf(stdout, "%d\n", num); + return !kill_count; + +-#ifdef ENABLE_PWAIT +- case PWAIT: ++#ifdef ENABLE_PIDWAIT ++ case PIDWAIT: + if (opt_count) + fprintf(stdout, "%d\n", num); + +diff --git a/pwait.1 b/pidwait.1 +similarity index 100% +rename from pwait.1 +rename to pidwait.1 +-- +GitLab + diff --git a/system/base/procps/files/fedora/sysctl-hyphen-param.patch b/system/base/procps/files/fedora/sysctl-hyphen-param.patch new file mode 100644 index 00000000..5b4a145c --- /dev/null +++ b/system/base/procps/files/fedora/sysctl-hyphen-param.patch @@ -0,0 +1,833 @@ +diff -up ./NEWS.ori ./NEWS +diff -up ./sysctl.c.ori ./sysctl.c +--- ./sysctl.c.ori 2021-02-09 11:11:25.000000000 +0100 ++++ ./sysctl.c 2022-03-31 18:27:36.536486629 +0200 +@@ -17,6 +17,7 @@ + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * ++ * Part of this code comes from systemd, especially sysctl.c + * Changelog: + * v1.01: + * - added -p to preload values from a file +@@ -40,6 +41,7 @@ + #include + #include + #include ++#include + + #include "c.h" + #include "fileutils.h" +@@ -66,12 +68,34 @@ static bool PrintName; + static bool PrintNewline; + static bool IgnoreError; + static bool Quiet; ++static bool DryRun; + static char *pattern; + + #define LINELEN 4096 + static char *iobuf; + static size_t iolen = LINELEN; + ++typedef struct SysctlSetting { ++ char *key; ++ char *path; ++ char *value; ++ bool ignore_failure; ++ bool glob_exclude; ++ struct SysctlSetting *next; ++} SysctlSetting; ++ ++typedef struct SettingList { ++ struct SysctlSetting *head; ++ struct SysctlSetting *tail; ++} SettingList; ++ ++#define GLOB_CHARS "*?[" ++static inline bool string_is_glob(const char *p) ++{ ++ return !!strpbrk(p, GLOB_CHARS); ++} ++ ++ + /* Function prototypes. */ + static int pattern_match(const char *string, const char *pat); + static int DisplayAll(const char *restrict const path); +@@ -100,6 +124,81 @@ static void slashdot(char *restrict p, c + } + } + ++static void setting_free(SysctlSetting *s) { ++ if (!s) ++ return; ++ ++ free(s->key); ++ free(s->path); ++ free(s->value); ++ free(s); ++} ++ ++static SysctlSetting *setting_new( ++ const char *key, ++ const char *value, ++ bool ignore_failure, ++ bool glob_exclude) { ++ ++ SysctlSetting *s = NULL; ++ char *path = NULL; ++ int proc_len; ++ ++ proc_len = strlen(PROC_PATH); ++ /* used to open the file */ ++ path = xmalloc(strlen(key) + proc_len + 2); ++ strcpy(path, PROC_PATH); ++ if (key[0] == '-') ++ strcat(path + proc_len, key+1); ++ else ++ strcat(path + proc_len, key); ++ /* change . to / */ ++ slashdot(path + proc_len, '.', '/'); ++ ++ s = xmalloc(sizeof(SysctlSetting)); ++ ++ *s = (SysctlSetting) { ++ .key = strdup(key), ++ .path = path, ++ .value = value? strdup(value): NULL, ++ .ignore_failure = ignore_failure, ++ .glob_exclude = glob_exclude, ++ .next = NULL, ++ }; ++ ++ return s; ++} ++ ++static void settinglist_add(SettingList *l, SysctlSetting *s) { ++ SysctlSetting *old_tail; ++ ++ if (!l) ++ return; ++ ++ if (l->head == NULL) ++ l->head = s; ++ ++ if (l->tail != NULL) { ++ old_tail = l->tail; ++ old_tail->next = s; ++ } ++ l->tail = s; ++} ++ ++static SysctlSetting *settinglist_findpath(const SettingList *l, const char *path) { ++ SysctlSetting *node; ++ ++ for (node=l->head; node != NULL; node = node->next) { ++ if (strcmp(node->path, path) == 0) ++ return node; ++ } ++ return NULL; ++} ++ ++/* Function prototypes. */ ++static int pattern_match(const char *string, const char *pat); ++static int DisplayAll(const char *restrict const path); ++ + /* + * Display the usage format + */ +@@ -115,6 +214,7 @@ static void __attribute__ ((__noreturn__ + fputs(_(" -A alias of -a\n"), out); + fputs(_(" -X alias of -a\n"), out); + fputs(_(" --deprecated include deprecated parameters to listing\n"), out); ++ fputs(_(" --dry-run Print the key and values but do not write\n"), out); + fputs(_(" -b, --binary print value without new line\n"), out); + fputs(_(" -e, --ignore ignore unknown variables errors\n"), out); + fputs(_(" -N, --names print variable names without values\n"), out); +@@ -138,6 +238,39 @@ static void __attribute__ ((__noreturn__ + } + + /* ++ * Strip left/leading side of a string ++ */ ++static char *lstrip(char *line) ++{ ++ char *start; ++ ++ if (!line || !*line) ++ return line; ++ ++ start = line; ++ while(isspace(*start)) start++; ++ ++ return start; ++} ++ ++/* ++ * Strip right/trailing side of a string ++ * by placing a \0 ++ */ ++static void rstrip(char *line) ++{ ++ char *end; ++ ++ if (!line || !*line) ++ return; ++ ++ end = line + strlen(line) - 1; ++ while(end > line && isspace(*end)) end--; ++ ++ end[1] = '\0'; ++} ++ ++/* + * Strip the leading and trailing spaces from a string + */ + static char *StripLeadingAndTrailingSpaces(char *oneline) +@@ -166,7 +299,7 @@ static char *StripLeadingAndTrailingSpac + */ + static int ReadSetting(const char *restrict const name) + { +- int rc = 0; ++ int rc = EXIT_SUCCESS; + char *restrict tmpname; + char *restrict outname; + ssize_t rlen; +@@ -198,7 +331,7 @@ static int ReadSetting(const char *restr + if (stat(tmpname, &ts) < 0) { + if (!IgnoreError) { + xwarn(_("cannot stat %s"), tmpname); +- rc = -1; ++ rc = EXIT_FAILURE; + } + goto out; + } +@@ -215,7 +348,7 @@ static int ReadSetting(const char *restr + } + + if (pattern && !pattern_match(outname, pattern)) { +- rc = 0; ++ rc = EXIT_SUCCESS; + goto out; + } + +@@ -231,19 +364,19 @@ static int ReadSetting(const char *restr + case ENOENT: + if (!IgnoreError) { + xwarnx(_("\"%s\" is an unknown key"), outname); +- rc = -1; ++ rc = EXIT_FAILURE; + } + break; + case EACCES: + xwarnx(_("permission denied on key '%s'"), outname); +- rc = -1; ++ rc = EXIT_FAILURE; + break; + case EIO: /* Ignore stable_secret below /proc/sys/net/ipv6/conf */ +- rc = -1; ++ rc = EXIT_FAILURE; + break; + default: + xwarn(_("reading key \"%s\""), outname); +- rc = -1; ++ rc = EXIT_FAILURE; + break; + } + } else { +@@ -279,7 +412,7 @@ static int ReadSetting(const char *restr + case EACCES: + xwarnx(_("permission denied on key '%s'"), + outname); +- rc = -1; ++ rc = EXIT_FAILURE; + break; + case EISDIR: { + size_t len; +@@ -291,11 +424,11 @@ static int ReadSetting(const char *restr + goto out; + } + case EIO: /* Ignore stable_secret below /proc/sys/net/ipv6/conf */ +- rc = -1; ++ rc = EXIT_FAILURE; + break; + default: + xwarnx(_("reading key \"%s\""), outname); +- rc = -1; ++ rc = EXIT_FAILURE; + case 0: + break; + } +@@ -323,7 +456,7 @@ static int is_deprecated(char *filename) + */ + static int DisplayAll(const char *restrict const path) + { +- int rc = 0; ++ int rc = EXIT_SUCCESS; + int rc2; + DIR *restrict dp; + struct dirent *restrict de; +@@ -333,7 +466,7 @@ static int DisplayAll(const char *restri + + if (!dp) { + xwarnx(_("unable to open directory \"%s\""), path); +- rc = -1; ++ rc = EXIT_FAILURE; + } else { + readdir(dp); /* skip . */ + readdir(dp); /* skip .. */ +@@ -369,130 +502,183 @@ static int DisplayAll(const char *restri + /* + * Write a sysctl setting + */ +-static int WriteSetting(const char *setting) +-{ +- int rc = 0; +- const char *name = setting; +- const char *value; +- const char *equals; +- char *tmpname; +- char *outname; +- char *last_dot; +- bool ignore_failure; ++static int WriteSetting( ++ const char *key, ++ const char *path, ++ const char *value, ++ const bool ignore_failure) { + +- FILE *fp; ++ int rc = EXIT_SUCCESS; ++ FILE *fp; + struct stat ts; + +- if (!name) +- /* probably don't want to display this err */ +- return 0; +- +- equals = strchr(setting, '='); +- +- if (!equals) { +- xwarnx(_("\"%s\" must be of the form name=value"), +- setting); +- return -1; +- } +- +- /* point to the value in name=value */ +- value = equals + 1; +- +- if (!*name || name == equals) { +- xwarnx(_("malformed setting \"%s\""), setting); +- return -2; +- } +- +- ignore_failure = name[0] == '-'; +- if (ignore_failure) +- name++; ++ if (!key || !path) ++ return rc; + +- /* used to open the file */ +- tmpname = xmalloc(equals - name + 1 + strlen(PROC_PATH)); +- strcpy(tmpname, PROC_PATH); +- strncat(tmpname, name, (int) (equals - name)); +- tmpname[equals - name + strlen(PROC_PATH)] = 0; +- /* change . to / */ +- slashdot(tmpname + strlen(PROC_PATH), '.', '/'); +- +- /* used to display the output */ +- outname = xmalloc(equals - name + 1); +- strncpy(outname, name, (int) (equals - name)); +- outname[equals - name] = 0; +- /* change / to . */ +- slashdot(outname, '/', '.'); +- last_dot = strrchr(outname, '.'); +- if (last_dot != NULL && is_deprecated(last_dot + 1)) { +- xwarnx(_("%s is deprecated, value not set"), outname); +- goto out; +- } +- +- if (stat(tmpname, &ts) < 0) { ++ if (stat(path, &ts) < 0) { + if (!IgnoreError) { +- xwarn(_("cannot stat %s"), tmpname); +- rc = -1; ++ xwarn(_("cannot stat %s"), path); ++ rc = EXIT_FAILURE; + } +- goto out; ++ return rc; + } + + if ((ts.st_mode & S_IWUSR) == 0) { +- xwarn(_("setting key \"%s\""), outname); +- goto out; ++ xwarn(_("setting key \"%s\""), key); ++ return rc; + } + + if (S_ISDIR(ts.st_mode)) { +- xwarn(_("setting key \"%s\""), outname); +- goto out; ++ xwarn(_("setting key \"%s\""), key); ++ return rc; + } + +- fp = fprocopen(tmpname, "w"); +- +- if (!fp) { +- switch (errno) { +- case ENOENT: +- if (!IgnoreError) { +- xwarnx(_("\"%s\" is an unknown key%s"), outname, (ignore_failure?_(", ignoring"):"")); ++ if (!DryRun) { ++ if ((fp = fprocopen(path, "w")) == NULL) { ++ switch (errno) { ++ case ENOENT: ++ if (!IgnoreError) { ++ xwarnx(_("\"%s\" is an unknown key%s"), ++ key, (ignore_failure?_(", ignoring"):"")); + if (!ignore_failure) +- rc = -1; ++ rc = EXIT_FAILURE; + } + break; +- case EPERM: +- case EROFS: +- case EACCES: +- xwarnx(_("permission denied on key \"%s\"%s"), outname, (ignore_failure?_(", ignoring"):"")); +- break; +- default: +- xwarn(_("setting key \"%s\"%s"), outname, (ignore_failure?_(", ignoring"):"")); +- break; +- } +- if (!ignore_failure && errno != ENOENT) +- rc = -1; +- } else { +- rc = fprintf(fp, "%s\n", value); +- if (0 < rc) +- rc = 0; +- if (close_stream(fp) != 0) +- xwarn(_("setting key \"%s\""), outname); +- else if (rc == 0 && !Quiet) { +- if (NameOnly) { +- fprintf(stdout, "%s\n", outname); +- } else { +- if (PrintName) { +- fprintf(stdout, "%s = %s\n", +- outname, value); +- } else { +- if (PrintNewline) +- fprintf(stdout, "%s\n", value); +- else +- fprintf(stdout, "%s", value); +- } +- } +- } +- } +- out: +- free(tmpname); +- free(outname); +- return rc; ++ case EPERM: ++ case EROFS: ++ case EACCES: ++ xwarnx(_("permission denied on key \"%s\"%s"), ++ key, (ignore_failure?_(", ignoring"):"")); ++ break; ++ default: ++ xwarn(_("setting key \"%s\"%s"), ++ key, (ignore_failure?_(", ignoring"):"")); ++ break; ++ } ++ if (!ignore_failure && errno != ENOENT) ++ rc = EXIT_FAILURE; ++ } else { ++ if (0 < fprintf(fp, "%s\n", value)) ++ rc = EXIT_SUCCESS; ++ if (close_stream(fp) != 0) { ++ xwarn(_("setting key \"%s\""), path); ++ return rc; ++ } ++ } ++ } ++ if ((rc == EXIT_SUCCESS && !Quiet) || DryRun) { ++ if (NameOnly) { ++ printf("%s\n", value); ++ } else { ++ if (PrintName) { ++ printf("%s = %s\n", path, value); ++ } else { ++ if (PrintNewline) ++ printf("%s\n", value); ++ else ++ printf("%s", value); ++ } ++ } ++ } ++ return rc; ++} ++ ++/* ++ * parse each configuration line, there are multiple ways of specifying ++ * a key/value here: ++ * ++ * key = value simple setting ++ * -key = value ignore errors ++ * key.pattern.*.with.glob = value set keys that match glob ++ * -key.pattern.exclude.with.glob dont set this value ++ * key.pattern.override.with.glob = value set this glob match to value ++ * ++ */ ++ ++static SysctlSetting *parse_setting_line( ++ const char *path, ++ const int linenum, ++ char *line) ++{ ++ SysctlSetting *s; ++ char *key; ++ char *value; ++ bool glob_exclude = FALSE; ++ bool ignore_failure = FALSE; ++ ++ key = lstrip(line); ++ if (strlen(key) < 2) ++ return NULL; ++ ++ /* skip over comments */ ++ if (key[0] == '#' || key[0] == ';') ++ return NULL; ++ ++ if (pattern && !pattern_match(key, pattern)) ++ return NULL; ++ ++ value = strchr(key, '='); ++ if (value == NULL) { ++ if (key[0] == '-') { ++ glob_exclude = TRUE; ++ key++; ++ value = NULL; ++ rstrip(key); ++ } else { ++ xwarnx(_("%s(%d): invalid syntax, continuing..."), ++ path, linenum); ++ return NULL; ++ } ++ } else { ++ value[0]='\0'; ++ if (key[0] == '-') { ++ ignore_failure = TRUE; ++ key++; ++ } ++ value++; // skip over = ++ value=lstrip(value); ++ rstrip(value); ++ rstrip(key); ++ } ++ return setting_new(key, value, ignore_failure, glob_exclude); ++} ++ ++/* Go through the setting list, expand and sort out ++ * setting globs and actually write the settings out ++ */ ++static int write_setting_list(const SettingList *sl) ++{ ++ SysctlSetting *node; ++ int rc = EXIT_SUCCESS; ++ ++ for (node=sl->head; node != NULL; node=node->next) { ++ if (node->glob_exclude) ++ continue; ++ ++ if (string_is_glob(node->path)) { ++ char *gl_path; ++ glob_t globbuf; ++ int i; ++ ++ if (glob(node->path, 0, NULL, &globbuf) != 0) ++ continue; ++ ++ for(i=0; i < globbuf.gl_pathc; i++) { ++ if (settinglist_findpath(sl, globbuf.gl_pathv[i])) ++ continue; // override or exclude ++ ++ rc |= WriteSetting(node->key, globbuf.gl_pathv[i], node->value, ++ node->ignore_failure); ++ } ++ } else { ++ rc |= WriteSetting(node->key, node->path, node->value, ++ node->ignore_failure); ++ } ++ ++ ++ } ++ ++ return rc; + } + + static int pattern_match(const char *string, const char *pat) +@@ -513,12 +699,12 @@ static int pattern_match(const char *str + * Preload the sysctl's from the conf file. We parse the file and then + * reform it (strip out whitespace). + */ +-static int Preload(const char *restrict const filename) ++static int Preload(SettingList *setlist, const char *restrict const filename) + { + FILE *fp; + char *t; + int n = 0; +- int rc = 0; ++ int rc = EXIT_SUCCESS; + ssize_t rlen; + char *name, *value; + glob_t globbuf; +@@ -547,62 +733,26 @@ static int Preload(const char *restrict + ? stdin : fopen(globbuf.gl_pathv[j], "r"); + if (!fp) { + xwarn(_("cannot open \"%s\""), globbuf.gl_pathv[j]); +- rc = -1; +- goto out; ++ return EXIT_FAILURE; + } + + while ((rlen = getline(&iobuf, &iolen, fp)) > 0) { + size_t offset; ++ SysctlSetting *setting; + + n++; + + if (rlen < 2) + continue; + +- t = StripLeadingAndTrailingSpaces(iobuf); +- if (strlen(t) < 2) +- continue; +- +- if (*t == '#' || *t == ';') +- continue; +- +- name = strtok(t, "="); +- if (!name || !*name) { +- xwarnx(_("%s(%d): invalid syntax, continuing..."), +- globbuf.gl_pathv[j], n); +- continue; +- } +- +- StripLeadingAndTrailingSpaces(name); +- +- if (pattern && !pattern_match(name, pattern)) +- continue; +- +- offset = strlen(name); +- memmove(&iobuf[0], name, offset); +- iobuf[offset++] = '='; +- +- value = strtok(NULL, "\n\r"); +- if (!value || !*value) { +- xwarnx(_("%s(%d): invalid syntax, continuing..."), +- globbuf.gl_pathv[j], n); +- continue; +- } +- +- while ((*value == ' ' || *value == '\t') && *value != 0) +- value++; +- +- /* should NameOnly affect this? */ +- memmove(&iobuf[offset], value, strlen(value)); +- offset += strlen(value); +- iobuf[offset] = '\0'; +- +- rc |= WriteSetting(iobuf); ++ if ( (setting = parse_setting_line(globbuf.gl_pathv[j], n, iobuf)) ++ == NULL) ++ continue; ++ settinglist_add(setlist, setting); + } + + fclose(fp); + } +-out: + return rc; + } + +@@ -618,7 +768,7 @@ static int sortpairs(const void *A, cons + return strcmp(a->name, b->name); + } + +-static int PreloadSystem(void) ++static int PreloadSystem(SettingList *setlist) + { + unsigned di, i; + const char *dirs[] = { +@@ -630,7 +780,7 @@ static int PreloadSystem(void) + }; + struct pair **cfgs = NULL; + unsigned ncfgs = 0; +- int rc = 0; ++ int rc = EXIT_SUCCESS; + struct stat ts; + enum { nprealloc = 16 }; + +@@ -688,14 +838,14 @@ static int PreloadSystem(void) + for (i = 0; i < ncfgs; ++i) { + if (!Quiet) + printf(_("* Applying %s ...\n"), cfgs[i]->value); +- rc |= Preload(cfgs[i]->value); ++ rc |= Preload(setlist, cfgs[i]->value); + } + + + if (stat(DEFAULT_PRELOAD, &ts) == 0 && S_ISREG(ts.st_mode)) { + if (!Quiet) + printf(_("* Applying %s ...\n"), DEFAULT_PRELOAD); +- rc |= Preload(DEFAULT_PRELOAD); ++ rc |= Preload(setlist, DEFAULT_PRELOAD); + } + + /* cleaning */ +@@ -717,15 +867,19 @@ int main(int argc, char *argv[]) + bool preloadfileOpt = false; + int ReturnCode = 0; + int c; ++ int rc; + const char *preloadfile = NULL; ++ SettingList *setlist; + + enum { + DEPRECATED_OPTION = CHAR_MAX + 1, +- SYSTEM_OPTION ++ SYSTEM_OPTION, ++ DRYRUN_OPTION + }; + static const struct option longopts[] = { + {"all", no_argument, NULL, 'a'}, + {"deprecated", no_argument, NULL, DEPRECATED_OPTION}, ++ {"dry-run", no_argument, NULL, DRYRUN_OPTION}, + {"binary", no_argument, NULL, 'b'}, + {"ignore", no_argument, NULL, 'e'}, + {"names", no_argument, NULL, 'N'}, +@@ -753,6 +907,10 @@ int main(int argc, char *argv[]) + IgnoreError = false; + Quiet = false; + IgnoreDeprecated = true; ++ DryRun = false; ++ setlist = xmalloc(sizeof(SettingList)); ++ setlist->head = NULL; ++ setlist->tail = NULL; + + if (argc < 2) + Usage(stderr); +@@ -805,7 +963,12 @@ int main(int argc, char *argv[]) + break; + case SYSTEM_OPTION: + IgnoreError = true; +- return PreloadSystem(); ++ rc |= PreloadSystem(setlist); ++ rc |= write_setting_list(setlist); ++ return rc; ++ case DRYRUN_OPTION: ++ DryRun = true; ++ break; + case 'r': + pattern = xstrdup(optarg); + break; +@@ -833,15 +996,16 @@ int main(int argc, char *argv[]) + int ret = EXIT_SUCCESS, i; + if (!preloadfile) { + if (!argc) { +- ret |= Preload(DEFAULT_PRELOAD); ++ ret |= Preload(setlist, DEFAULT_PRELOAD); + } + } else { + /* This happens when -pfile option is + * used without space. */ +- ret |= Preload(preloadfile); ++ ret |= Preload(setlist, preloadfile); + } + for (i = 0; i < argc; i++) +- ret |= Preload(argv[i]); ++ ret |= Preload(setlist, argv[i]); ++ ret |= write_setting_list(setlist); + return ret; + } + +@@ -855,9 +1019,14 @@ int main(int argc, char *argv[]) + program_invocation_short_name); + + for ( ; *argv; argv++) { +- if (WriteMode || strchr(*argv, '=')) +- ReturnCode += WriteSetting(*argv); +- else ++ if (WriteMode || strchr(*argv, '=')) { ++ SysctlSetting *s; ++ if ( (s = parse_setting_line("command line", 0, *argv)) != NULL) ++ ReturnCode |= WriteSetting(s->key, s->path, s->value, ++ s->ignore_failure); ++ else ++ ReturnCode |= EXIT_FAILURE; ++ } else + ReturnCode += ReadSetting(*argv); + } + return ReturnCode; +diff -up ./testsuite/config/unix.exp.ori ./testsuite/config/unix.exp +--- ./testsuite/config/unix.exp.ori 2021-02-09 11:11:25.000000000 +0100 ++++ ./testsuite/config/unix.exp 2022-03-31 18:27:36.536486629 +0200 +@@ -136,6 +136,15 @@ proc expect_table_dsc { test match_heade + #} + } + ++proc expect_spawn_retval { test retval } { ++ foreach {pid spawnid os_error_flag value} [wait] break ++ ++ if {$value == $retval} { ++ return ++ } ++ fail "$test (exit value)" ++} ++ + proc make_pipeproc { } { + global pipeproc_pid pipeproc_spawnid topdir + +diff -up ./testsuite/sysctl_glob_test.conf.ori ./testsuite/sysctl_glob_test.conf +--- ./testsuite/sysctl_glob_test.conf.ori 2022-03-31 18:27:36.537486635 +0200 ++++ ./testsuite/sysctl_glob_test.conf 2022-03-31 18:27:36.537486635 +0200 +@@ -0,0 +1,6 @@ ++# ++# Test configuration for for glob in sysctl ++# ++fs.protected_* = 2 ++fs.protected_hardlinks = 1 ++-fs.protected_regular +diff -up ./testsuite/sysctl.test/sysctl_write.exp.ori ./testsuite/sysctl.test/sysctl_write.exp +--- ./testsuite/sysctl.test/sysctl_write.exp.ori 2022-03-31 18:27:36.536486629 +0200 ++++ ./testsuite/sysctl.test/sysctl_write.exp 2022-03-31 18:27:36.536486629 +0200 +@@ -0,0 +1,29 @@ ++ ++set sysctl ${topdir}sysctl ++ ++set test "sysctl write from command line" ++spawn $sysctl --dry-run kernel.hostname=procps-test ++expect_pass "$test" "/proc/sys/kernel/hostname = procps-test" ++ ++set test "sysctl write from configuration file" ++spawn $sysctl --dry-run -f ${topdir}testsuite/sysctl_glob_test.conf ++expect_pass "$test" "/proc/sys/fs/protected_fifos = 2\\s+/proc/sys/fs/protected_symlinks = 2\\s+/proc/sys/fs/protected_hardlinks = 1" ++ ++set hostname_file "/proc/sys/kernel/hostname" ++if {[file exists ${hostname_file}]} { ++ if {[file writable ${hostname_file}]} { ++ unsupported "sysctl write: hostname file is writable" ++ } else { ++ set test "sysctl write unwritable file" ++ spawn $sysctl -q kernel.hostname=procpstest ++ expect_pass "$test" "sysctl: permission denied on key \"kernel.hostname\"\\s*$" ++ expect_spawn_retval "$test" 1 ++ ++ set test "sysctl write unwritable file ignored" ++ spawn $sysctl -q -- -kernel.hostname=procpstest ++ expect_pass "$test" "sysctl: permission denied on key \"kernel.hostname\", ignoring\\s*$" ++ expect_spawn_retval "$test" 0 ++ } ++} else { ++ unsupported "sysctl write: hostname file doe not exist" ++} diff --git a/system/base/procps/files/fedora/sysctl-print-dotted-keys-again.patch b/system/base/procps/files/fedora/sysctl-print-dotted-keys-again.patch new file mode 100644 index 00000000..b8c32d77 --- /dev/null +++ b/system/base/procps/files/fedora/sysctl-print-dotted-keys-again.patch @@ -0,0 +1,153 @@ +diff -up ./NEWS.ori ./NEWS +--- ./NEWS.ori 2022-08-15 11:59:35.929714848 +0200 ++++ ./NEWS 2022-08-15 12:00:12.892937479 +0200 +@@ -1,4 +1,14 @@ + procps-ng-NEXT ++<<<<<<< HEAD ++======= ++ * library ++ Re-add elogind support merge #151 ++ * ps: threads again display when -L is used with -q issue #234 ++ * ps: proper aix format string behavior was restored ++ * sysctl: print dotted keys again ++ ++procps-ng-4.0.0 ++>>>>>>> b159c198 (sysctl: print dotted keys again) + --------------- + * Rename pwait to pidwait + +diff -up ./sysctl.c.ori ./sysctl.c +--- ./sysctl.c.ori 2022-08-15 11:59:35.934714878 +0200 ++++ ./sysctl.c 2022-08-15 12:00:12.893937485 +0200 +@@ -152,7 +152,7 @@ static SysctlSetting *setting_new( + strcat(path + proc_len, key+1); + else + strcat(path + proc_len, key); +- /* change . to / */ ++ /* change . to / for path */ + slashdot(path + proc_len, '.', '/'); + + s = xmalloc(sizeof(SysctlSetting)); +@@ -510,7 +510,8 @@ static int WriteSetting( + + int rc = EXIT_SUCCESS; + FILE *fp; +- struct stat ts; ++ struct stat ts; ++ char *dotted_key; + + if (!key || !path) + return rc; +@@ -523,13 +524,22 @@ static int WriteSetting( + return rc; + } + +- if ((ts.st_mode & S_IWUSR) == 0) { +- xwarn(_("setting key \"%s\""), key); ++ /* Convert the globbed path into a dotted key */ ++ if ( (dotted_key = strdup(path + strlen(PROC_PATH))) == NULL) { ++ xerrx(EXIT_FAILURE, _("strdup key")); ++ return EXIT_FAILURE; ++ } ++ slashdot(dotted_key, '/', '.'); ++ ++ if ((ts.st_mode & S_IWUSR) == 0) { ++ xwarn(_("setting key \"%s\""), dotted_key); ++ free(dotted_key); + return rc; + } + +- if (S_ISDIR(ts.st_mode)) { +- xwarn(_("setting key \"%s\""), key); ++ if (S_ISDIR(ts.st_mode)) { ++ xwarn(_("setting key \"%s\""), dotted_key); ++ free(dotted_key); + return rc; + } + +@@ -539,7 +549,7 @@ static int WriteSetting( + case ENOENT: + if (!IgnoreError) { + xwarnx(_("\"%s\" is an unknown key%s"), +- key, (ignore_failure?_(", ignoring"):"")); ++ dotted_key, (ignore_failure?_(", ignoring"):"")); + if (!ignore_failure) + rc = EXIT_FAILURE; + } +@@ -548,11 +558,11 @@ static int WriteSetting( + case EROFS: + case EACCES: + xwarnx(_("permission denied on key \"%s\"%s"), +- key, (ignore_failure?_(", ignoring"):"")); ++ dotted_key, (ignore_failure?_(", ignoring"):"")); + break; + default: + xwarn(_("setting key \"%s\"%s"), +- key, (ignore_failure?_(", ignoring"):"")); ++ dotted_key, (ignore_failure?_(", ignoring"):"")); + break; + } + if (!ignore_failure && errno != ENOENT) +@@ -561,7 +571,7 @@ static int WriteSetting( + if (0 < fprintf(fp, "%s\n", value)) + rc = EXIT_SUCCESS; + if (close_stream(fp) != 0) { +- xwarn(_("setting key \"%s\""), path); ++ xwarn(_("setting key \"%s\""), dotted_key); + return rc; + } + } +@@ -571,7 +581,7 @@ static int WriteSetting( + printf("%s\n", value); + } else { + if (PrintName) { +- printf("%s = %s\n", path, value); ++ printf("%s = %s\n", dotted_key, value); + } else { + if (PrintNewline) + printf("%s\n", value); +@@ -580,6 +590,7 @@ static int WriteSetting( + } + } + } ++ free(dotted_key); + return rc; + } + +diff -up ./testsuite/sysctl_slash_test.conf.ori ./testsuite/sysctl_slash_test.conf +--- ./testsuite/sysctl_slash_test.conf.ori 2022-08-15 12:00:12.894937491 +0200 ++++ ./testsuite/sysctl_slash_test.conf 2022-08-15 12:00:12.893937485 +0200 +@@ -0,0 +1 @@ ++kernel/hostname = procps-test +diff -up ./testsuite/sysctl.test/sysctl_write.exp.ori ./testsuite/sysctl.test/sysctl_write.exp +--- ./testsuite/sysctl.test/sysctl_write.exp.ori 2022-08-15 11:59:35.934714878 +0200 ++++ ./testsuite/sysctl.test/sysctl_write.exp 2022-08-15 12:00:12.893937485 +0200 +@@ -3,11 +3,19 @@ set sysctl ${topdir}sysctl + + set test "sysctl write from command line" + spawn $sysctl --dry-run kernel.hostname=procps-test +-expect_pass "$test" "/proc/sys/kernel/hostname = procps-test" ++expect_pass "$test" "kernel.hostname = procps-test" ++ ++set test "sysctl write from command line using slash" ++spawn $sysctl --dry-run kernel/hostname=procps-test ++expect_pass "$test" "kernel.hostname = procps-test" + + set test "sysctl write from configuration file" + spawn $sysctl --dry-run -f ${topdir}testsuite/sysctl_glob_test.conf +-expect_pass "$test" "/proc/sys/fs/protected_fifos = 2\\s+/proc/sys/fs/protected_symlinks = 2\\s+/proc/sys/fs/protected_hardlinks = 1" ++expect_pass "$test" "fs.protected_fifos = 2\\s+fs.protected_symlinks = 2\\s+fs.protected_hardlinks = 1" ++ ++set test "sysctl write from file with slashes" ++spawn $sysctl --dry-run -f ${topdir}testsuite/sysctl_slash_test.conf ++expect_pass "$test" "kernel.hostname = procps-test" + + set hostname_file "/proc/sys/kernel/hostname" + if {[file exists ${hostname_file}]} { +@@ -25,5 +33,5 @@ if {[file exists ${hostname_file}]} { + expect_spawn_retval "$test" 0 + } + } else { +- unsupported "sysctl write: hostname file doe not exist" ++ unsupported "sysctl write: hostname file does not exist" + } diff --git a/system/base/procps/files/fs66093.patch b/system/base/procps/files/fs66093.patch deleted file mode 100644 index 57a9346e..00000000 --- a/system/base/procps/files/fs66093.patch +++ /dev/null @@ -1,60 +0,0 @@ -From bb96fc42956c9ed926a1b958ab715f8b4a663dec Mon Sep 17 00:00:00 2001 -From: Craig Small -Date: Sun, 5 Jan 2020 15:05:55 +1100 -Subject: [PATCH] pgrep: check sanity of SC_ARG_MAX - -A kernel change means we cannot trust what sysconf(SC_ARG_MAX) -returns. We clamp it so its more than 4096 and less than 128*1024 -which is what findutils does. - -References: - procps-ng/procps#152 - https://git.savannah.gnu.org/cgit/findutils.git/tree/lib/buildcmd.c#n535 - https://lwn.net/Articles/727862/ ---- - pgrep.c | 22 +++++++++++++++++++++- - 1 file changed, 21 insertions(+), 1 deletion(-) - -diff --git a/pgrep.c b/pgrep.c -index 01563db..bde7448 100644 ---- a/pgrep.c -+++ b/pgrep.c -@@ -485,6 +485,26 @@ static regex_t * do_regcomp (void) - return preg; - } - -+/* -+ * SC_ARG_MAX used to return the maximum size a command line can be -+ * however changes to the kernel mean this can be bigger than we can -+ * alloc. Clamp it to 128kB like xargs and friends do -+ * Should also not be smaller than POSIX_ARG_MAX which is 4096 -+ */ -+static size_t get_arg_max(void) -+{ -+#define MIN_ARG_SIZE 4096u -+#define MAX_ARG_SIZE (128u * 1024u) -+ -+ size_t val = sysconf(_SC_ARG_MAX); -+ -+ if (val < MIN_ARG_SIZE) -+ val = MIN_ARG_SIZE; -+ if (val > MAX_ARG_SIZE) -+ val = MAX_ARG_SIZE; -+ -+ return val; -+} - static struct el * select_procs (int *num) - { - PROCTAB *ptp; -@@ -497,7 +517,7 @@ static struct el * select_procs (int *num) - regex_t *preg; - pid_t myself = getpid(); - struct el *list = NULL; -- long cmdlen = sysconf(_SC_ARG_MAX) * sizeof(char); -+ long cmdlen = get_arg_max() * sizeof(char); - char *cmdline = xmalloc(cmdlen); - char *cmdsearch = xmalloc(cmdlen); - char *cmdoutput = xmalloc(cmdlen); --- -2.26.2 - diff --git a/system/base/procps/files/nohz.patch b/system/base/procps/files/nohz.patch deleted file mode 100644 index 72373c12..00000000 --- a/system/base/procps/files/nohz.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- procps-3.2.7~/top.c 2006-06-25 08:41:48.000000000 +0200 -+++ procps-3.2.7/top.c 2007-07-20 12:50:00.000000000 +0200 -@@ -2886,6 +2886,7 @@ - s_frme = cpu->s - cpu->s_sav; - n_frme = cpu->n - cpu->n_sav; - i_frme = TRIMz(cpu->i - cpu->i_sav); -+ if ((u_frme == 0) && (i_frme == 0)) i_frme = 100.0; - w_frme = cpu->w - cpu->w_sav; - x_frme = cpu->x - cpu->x_sav; - y_frme = cpu->y - cpu->y_sav; diff --git a/system/base/procps/files/procps-3.2.2-top-termsize.patch b/system/base/procps/files/procps-3.2.2-top-termsize.patch deleted file mode 100644 index 85844a40..00000000 --- a/system/base/procps/files/procps-3.2.2-top-termsize.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- 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 : \ - ({ \ diff --git a/system/base/procps/files/procps-3.2.2-w-simply-work.diff b/system/base/procps/files/procps-3.2.2-w-simply-work.diff deleted file mode 100644 index 51ae80e6..00000000 --- a/system/base/procps/files/procps-3.2.2-w-simply-work.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- 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); diff --git a/system/base/procps/files/procps-3.2.5-eof.diff b/system/base/procps/files/procps-3.2.5-eof.diff deleted file mode 100644 index c18f38ef..00000000 --- a/system/base/procps/files/procps-3.2.5-eof.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- 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); diff --git a/system/base/procps/files/procps-3.2.5-proc-mount.patch b/system/base/procps/files/procps-3.2.5-proc-mount.patch deleted file mode 100644 index d64528fb..00000000 --- a/system/base/procps/files/procps-3.2.5-proc-mount.patch +++ /dev/null @@ -1,6 +0,0 @@ ---- a/proc/readproc.c -+++ b/proc/readproc.c -@@ -858,2 +858,2 @@ - if(file2str("/proc/self", "stat", sbuf, sizeof sbuf) == -1){ -- fprintf(stderr, "Error, do this: mount -t proc none /proc\n"); -+ fprintf(stderr, "Error, do this: mount -t proc proc /proc\n"); diff --git a/system/base/procps/files/procps-3.2.7-0x9b.patch b/system/base/procps/files/procps-3.2.7-0x9b.patch deleted file mode 100644 index 4429f84d..00000000 --- a/system/base/procps/files/procps-3.2.7-0x9b.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff -up procps-3.2.7/proc/escape.c.p8 procps-3.2.7/proc/escape.c ---- procps-3.2.7/proc/escape.c.p8 2005-01-05 21:50:26.000000000 +0100 -+++ procps-3.2.7/proc/escape.c 2008-09-01 11:31:15.000000000 +0200 -@@ -79,6 +79,7 @@ static int escape_str_utf8(char *restric - // multibyte - printable - // Got space? - if (my_cells+wlen > *maxcells || my_bytes+1+len >= bufsize) break; -+#ifdef OUTPUT_PARANOID - // 0x9b is control byte for some terminals - if (memchr(src, 0x9B, len)) { - // unsafe multibyte -@@ -87,13 +88,16 @@ static int escape_str_utf8(char *restric - my_cells++; - my_bytes++; - } else { -+#endif - // safe multibyte - memcpy(dst, src, len); - my_cells += wlen; - dst += len; - my_bytes += len; - src += len; -+#ifdef OUTPUT_PARANOID - } -+#endif - } - } - //fprintf(stdout, "cells: %d\n", my_cells); diff --git a/system/base/procps/files/procps-3.2.7-FAQ.patch b/system/base/procps/files/procps-3.2.7-FAQ.patch deleted file mode 100644 index 562273ef..00000000 --- a/system/base/procps/files/procps-3.2.7-FAQ.patch +++ /dev/null @@ -1,49 +0,0 @@ -diff -up procps-3.2.7/ps/parser.c.p3 procps-3.2.7/ps/parser.c ---- procps-3.2.7/ps/parser.c.p3 2008-09-01 11:11:50.000000000 +0200 -+++ procps-3.2.7/ps/parser.c 2008-09-01 11:11:50.000000000 +0200 -@@ -1238,7 +1238,7 @@ try_bsd: - // as SysV options... and you're screwed if you've been patching - // out the friendly warning. Cut-over is likely to be in 2005. - if(!(personality & PER_FORCE_BSD)) -- fprintf(stderr, "Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html\n"); -+ fprintf(stderr, "Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-%s/FAQ\n",procps_number_version); - // Remember: contact albert@users.sf.net or procps-feedback@lists.sf.net - // if you should feel tempted. Be damn sure you understand all - // the issues. The same goes for other stuff too, BTW. Please ask. -diff -up procps-3.2.7/proc/version.h.p3 procps-3.2.7/proc/version.h ---- procps-3.2.7/proc/version.h.p3 2002-12-15 01:08:32.000000000 +0100 -+++ procps-3.2.7/proc/version.h 2008-09-01 11:11:50.000000000 +0200 -@@ -16,6 +16,7 @@ EXTERN_C_BEGIN - - extern void display_version(void); /* display suite version */ - extern const char procps_version[]; /* global buf for suite version */ -+extern const char procps_number_version[]; /* global buf for suite number version */ - - extern int linux_version_code; /* runtime version of LINUX_VERSION_CODE - in /usr/include/linux/version.h */ -diff -up procps-3.2.7/proc/library.map.p3 procps-3.2.7/proc/library.map ---- procps-3.2.7/proc/library.map.p3 2005-03-14 05:32:40.000000000 +0100 -+++ procps-3.2.7/proc/library.map 2008-09-01 11:11:50.000000000 +0200 -@@ -9,7 +9,7 @@ global: - escape_str; escape_strlist; - openproc; closeproc; - tty_to_dev; dev_to_tty; open_psdb_message; open_psdb; lookup_wchan; -- display_version; procps_version; linux_version_code; -+ display_version; procps_version; procps_number_version; linux_version_code; - Hertz; smp_num_cpus; have_privs; - sprint_uptime; uptime; user_from_uid; print_uptime; loadavg; - pretty_print_signals; print_given_signals; unix_print_signals; signal_name_to_number; signal_number_to_name; -diff -up procps-3.2.7/proc/version.c.p3 procps-3.2.7/proc/version.c ---- procps-3.2.7/proc/version.c.p3 2003-01-29 02:11:43.000000000 +0100 -+++ procps-3.2.7/proc/version.c 2008-09-01 11:11:50.000000000 +0200 -@@ -16,8 +16,10 @@ - - #ifdef MINORVERSION - const char procps_version[] = "procps version " VERSION "." SUBVERSION "." MINORVERSION; -+const char procps_number_version[] = VERSION "." SUBVERSION "." MINORVERSION; - #else - const char procps_version[] = "procps version " VERSION "." SUBVERSION; -+const char procps_number_version[] = VERSION "." SUBVERSION; - #endif - - void display_version(void) { diff --git a/system/base/procps/files/procps-3.2.7-free-hlmem.patch b/system/base/procps/files/procps-3.2.7-free-hlmem.patch deleted file mode 100644 index c5ef9cc4..00000000 --- a/system/base/procps/files/procps-3.2.7-free-hlmem.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff -up procps-3.2.7/free.1.hlmem procps-3.2.7/free.1 ---- procps-3.2.7/free.1.hlmem 2009-02-24 10:54:35.000000000 +0100 -+++ procps-3.2.7/free.1 2009-02-24 11:00:26.000000000 +0100 -@@ -7,7 +7,7 @@ free \- Display amount of free and used - .SH SYNOPSIS - .BR "free " [ "\-b" " | " "\-k" " | " "\-m" "] [" "\-o" "] [" "\-s" - .I delay --.RB "] [" "\-t" "] [" "\-V" ] -+.RB "] [" "\-t" "] [" "\-l" "] [" "\-V" "] - .SH DESCRIPTION - \fBfree\fP displays the total amount of free and used physical and swap - memory in the system, as well as the buffers used by the kernel. -@@ -28,7 +28,9 @@ may actually specify any floating point - .BR usleep (3) - is used for microsecond resolution delay times. - .PP --The \fB\-V\fP displays version information. -+The \fB-l\fP switch shows detailed low and high memory statistics. -+.PP -+The \fB\-V\fP switch displays version information. - .SH FILES - .ta - .IR /proc/meminfo "\-\- memory information" diff --git a/system/base/procps/files/procps-3.2.7-libselinux.patch b/system/base/procps/files/procps-3.2.7-libselinux.patch deleted file mode 100644 index c07c8dc9..00000000 --- a/system/base/procps/files/procps-3.2.7-libselinux.patch +++ /dev/null @@ -1,61 +0,0 @@ -diff -up procps-3.2.7/ps/output.c.p12 procps-3.2.7/ps/output.c ---- procps-3.2.7/ps/output.c.p12 2006-06-19 01:27:02.000000000 +0200 -+++ procps-3.2.7/ps/output.c 2008-09-01 11:35:06.000000000 +0200 -@@ -1090,7 +1090,7 @@ static int pr_sgi_p(char *restrict const - return snprintf(outbuf, COLWID, "*"); - } - -- -+#ifdef STATICLIB - /****************** FLASK & seLinux security stuff **********************/ - // move the bulk of this to libproc sometime - -@@ -1122,7 +1122,7 @@ fail: - return 1; - } - --#if 0 -+#else - // This needs more study, considering: - // 1. the static linking option (maybe disable this in that case) - // 2. the -z and -Z option issue -@@ -1134,7 +1134,7 @@ static int pr_context(char *restrict con - char *context; - - if(!ps_getpidcon && !tried_load){ -- void *handle = dlopen("libselinux.so.1", RTLD_NOW); -+ void *handle = dlopen("libselinux.so", RTLD_NOW); - if(handle){ - dlerror(); - ps_getpidcon = dlsym(handle, "getpidcon"); -diff -up procps-3.2.7/Makefile.p12 procps-3.2.7/Makefile ---- procps-3.2.7/Makefile.p12 2006-06-24 11:02:25.000000000 +0200 -+++ procps-3.2.7/Makefile 2008-09-01 11:35:06.000000000 +0200 -@@ -73,12 +73,12 @@ CURSES := -lncurses - # Something like this is probably needed to make the SE Linux - # library loading not conflict with embedded systems stuff. - # --#ifeq ($(SHARED),1) --#ldl := -ldl --#LIBTYPE := -DSHAREDLIB --#else --#LIBTYPE := -DSTATICLIB --#endif -+ifeq ($(SHARED),1) -+ldl := -ldl -+LIBTYPE := -DSHAREDLIB -+else -+LIBTYPE := -DSTATICLIB -+endif - - # Preprocessor flags. - PKG_CPPFLAGS := -D_GNU_SOURCE -I proc -@@ -103,7 +103,7 @@ PKG_CFLAGS := -fno-common -ffast-math - # Note that some stuff below is conditional on CFLAGS containing - # an option that starts with "-g". (-g, -g2, -g3, -ggdb, etc.) - CFLAGS := -O2 -s --ALL_CFLAGS := $(PKG_CFLAGS) $(CFLAGS) -+ALL_CFLAGS := $(PKG_CFLAGS) $(CFLAGS) $(LIBTYPE) - - PKG_LDFLAGS := -Wl,-warn-common - LDFLAGS := diff --git a/system/base/procps/files/procps-3.2.7-longcmd.patch b/system/base/procps/files/procps-3.2.7-longcmd.patch deleted file mode 100644 index 7c4fdca3..00000000 --- a/system/base/procps/files/procps-3.2.7-longcmd.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- procps-3.2.7/proc/readproc.c.kzak 2006-06-16 10:18:13.000000000 +0200 -+++ procps-3.2.7/proc/readproc.c 2006-09-27 11:25:13.000000000 +0200 -@@ -432,14 +432,17 @@ - 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) { -+ while ((n = read(fd, buf, sizeof buf - 1)) >= 0) { - if (n < (int)(sizeof buf - 1)) - end_of_file = 1; -- if (n == 0 && rbuf == 0) -+ if (n == 0 && rbuf == 0) { -+ close(fd); - return NULL; /* process died between our open and read */ -+ } - if (n < 0) { - if (rbuf) - free(rbuf); -+ close(fd); - return NULL; /* read error */ - } - if (end_of_file && buf[n-1]) /* last read char not null */ diff --git a/system/base/procps/files/procps-3.2.7-misc.patch b/system/base/procps/files/procps-3.2.7-misc.patch deleted file mode 100644 index d42e8a34..00000000 --- a/system/base/procps/files/procps-3.2.7-misc.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff -up procps-3.2.7/watch.c.p2 procps-3.2.7/watch.c ---- procps-3.2.7/watch.c.p2 2006-06-17 11:18:38.000000000 +0200 -+++ procps-3.2.7/watch.c 2008-09-01 10:46:17.000000000 +0200 -@@ -25,6 +25,9 @@ - #include - #include - #include "proc/procps.h" -+#include -+#include -+#include - - #ifdef FORCE_8BIT - #undef isprint -@@ -138,6 +141,7 @@ int - main(int argc, char *argv[]) - { - int optc; -+ int fd; - int option_differences = 0, - option_differences_cumulative = 0, - option_help = 0, option_version = 0; -@@ -260,7 +264,13 @@ main(int argc, char *argv[]) - mvaddstr(0, width - tsl + 1, ts); - free(header); - } -- -+ close(0); -+ fd=open("/dev/null",O_RDWR); -+ if (fd!=0) { -+ perror("open"); -+ do_exit(2); -+ } -+ - if (!(p = popen(command, "r"))) { - perror("popen"); - do_exit(2); diff --git a/system/base/procps/files/procps-3.2.7-noproc.patch b/system/base/procps/files/procps-3.2.7-noproc.patch deleted file mode 100644 index a1fcb4bc..00000000 --- a/system/base/procps/files/procps-3.2.7-noproc.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff -up procps-3.2.7/top.c.p6 procps-3.2.7/top.c ---- procps-3.2.7/top.c.p6 2006-06-25 08:41:48.000000000 +0200 -+++ procps-3.2.7/top.c 2008-09-01 11:28:15.000000000 +0200 -@@ -3331,12 +3331,15 @@ static void frame_make (void) - - int main (int dont_care_argc, char *argv[]) - { -+ struct stat isproc; - (void)dont_care_argc; - before(*argv); - // +-------------+ - windows_stage1(); // top (sic) slice - configs_read(); // > spread etc, < - parse_args(&argv[1]); // > lean stuff, < -+ if (stat("/proc/self", &isproc)==-1) -+ std_err("/proc is not mounted, required for output data"); - whack_terminal(); // > onions etc. < - windows_stage2(); // as bottom slice - // +-------------+ diff --git a/system/base/procps/files/procps-3.2.7-ps-cgroup.patch b/system/base/procps/files/procps-3.2.7-ps-cgroup.patch deleted file mode 100644 index b638c4f9..00000000 --- a/system/base/procps/files/procps-3.2.7-ps-cgroup.patch +++ /dev/null @@ -1,67 +0,0 @@ -diff -up procps-3.2.7/ps/output.c.pom procps-3.2.7/ps/output.c ---- procps-3.2.7/ps/output.c.pom 2009-02-15 13:16:27.000000000 +0100 -+++ procps-3.2.7/ps/output.c 2009-02-15 14:02:34.000000000 +0100 -@@ -1097,6 +1097,40 @@ static int pr_sgi_p(char *restrict const - return snprintf(outbuf, COLWID, "*"); - } - -+static int pr_cgroup(char *restrict const outbuf, const proc_t *restrict const pp){ -+ char filename[48]; -+ FILE *fd; -+ int counter = 0; -+ int c; -+ int is_cgroup = 0; -+ -+ outbuf[0]='\0'; -+ snprintf(filename, sizeof filename, "/proc/%d/cgroup", pp->tgid); -+ fd = fopen(filename, "r"); -+ if (likely(fd == NULL)) goto fail; -+ while (( (c = fgetc(fd)) != EOF) && (counter<665)) { -+ if (is_cgroup == 0) { -+ if (c == ':') { -+ is_cgroup = 1; -+ if (counter>0) -+ outbuf[counter++]=';'; -+ } -+ }else -+ if ((c == '\n') || (c == '\0')) -+ is_cgroup = 0; -+ else -+ outbuf[counter++]=c; -+ } -+ outbuf[counter]='\0'; -+ close(fd); -+ if (counter>0) -+ return counter; -+fail: -+ outbuf[0] = '-'; -+ outbuf[1] = '\0'; -+ return 1; -+} -+ - #ifdef STATICLIB - /****************** FLASK & seLinux security stuff **********************/ - // move the bulk of this to libproc sometime -@@ -1291,6 +1325,7 @@ static const format_struct format_array[ - {"bsdtime", "TIME", pr_bsdtime, sr_nop, 6, 0, LNX, ET|RIGHT}, - {"c", "C", pr_c, sr_pcpu, 2, 0, SUN, ET|RIGHT}, - {"caught", "CAUGHT", pr_sigcatch, sr_nop, 9, 0, BSD, TO|SIGNAL}, /*sigcatch*/ -+{"cgroup", "CGROUP", pr_cgroup, sr_nop, 35, 0, LNX, PO|LEFT}, /* cgroups*/ - {"class", "CLS", pr_class, sr_sched, 3, 0, XXX, TO|LEFT}, - {"cls", "CLS", pr_class, sr_sched, 3, 0, HPU, TO|RIGHT}, /*says HPUX or RT*/ - {"cmaj_flt", "-", pr_nop, sr_cmaj_flt, 1, 0, LNX, AN|RIGHT}, -diff -up procps-3.2.7/ps/ps.1.pom procps-3.2.7/ps/ps.1 ---- procps-3.2.7/ps/ps.1.pom 2009-02-15 13:16:27.000000000 +0100 -+++ procps-3.2.7/ps/ps.1 2009-02-15 14:00:33.000000000 +0100 -@@ -908,6 +908,10 @@ width of the field, a 32 or 64 bits mask - displayed. (alias\ \fBsig_catch\fR,\ \fBsigcatch\fR). - T} - -+cgroup CGROUP T{ -+display control groups to which the process belonges. -+t} -+ - class CLS T{ - scheduling class of the process. (alias\ \fBpolicy\fR,\ \fBcls\fR). - Field's possible values are: - diff --git a/system/base/procps/files/procps-3.2.7-ps-eip64.patch b/system/base/procps/files/procps-3.2.7-ps-eip64.patch deleted file mode 100644 index 9eb851f4..00000000 --- a/system/base/procps/files/procps-3.2.7-ps-eip64.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- procps-3.2.7/ps/ps.1.eip64 2007-06-14 11:08:35.000000000 +0200 -+++ procps-3.2.7/ps/ps.1 2007-06-14 11:03:28.000000000 +0200 -@@ -1156,6 +1156,14 @@ - or\ a\ decimal representation otherwise. - T} - -+rip RIP T{ -+64-bit instruction pointer. -+T} -+ -+rsp RSP T{ -+64-bit stack pointer. -+T} -+ - rss RSS T{ - resident set size, the non\-swapped physical memory that - a task has used (in\ kiloBytes). ---- procps-3.2.7/ps/output.c.eip64 2007-06-14 11:08:24.000000000 +0200 -+++ procps-3.2.7/ps/output.c 2007-06-14 10:58:21.000000000 +0200 -@@ -764,10 +764,18 @@ - return snprintf(outbuf, COLWID, "%08x", (unsigned)(pp->kstk_esp)); - } - -+static int pr_rsp(char *restrict const outbuf, const proc_t *restrict const pp){ -+ return snprintf(outbuf, COLWID, "%016lx", (unsigned long)(pp->kstk_esp)); -+} -+ - static int pr_eip(char *restrict const outbuf, const proc_t *restrict const pp){ - return snprintf(outbuf, COLWID, "%08x", (unsigned)(pp->kstk_eip)); - } - -+static int pr_rip(char *restrict const outbuf, const proc_t *restrict const pp){ -+ return snprintf(outbuf, COLWID, "%016lx", (unsigned long)(pp->kstk_eip)); -+} -+ - /* This function helps print old-style time formats */ - static int old_time_helper(char *dst, unsigned long long t, unsigned long long rel) { - if(!t) return snprintf(dst, COLWID, " -"); -@@ -1403,7 +1411,9 @@ - {"resident", "RES", pr_nop, sr_resident, 5,MEM, LNX, PO|RIGHT}, - {"rgid", "RGID", pr_rgid, sr_rgid, 5, 0, XXX, ET|RIGHT}, - {"rgroup", "RGROUP", pr_rgroup, sr_rgroup, 8, GRP, U98, ET|USER}, /* was 8 wide */ -+{"rip", "RIP", pr_rip, sr_kstk_eip, 16, 0, LNX, TO|RIGHT}, - {"rlink", "RLINK", pr_nop, sr_nop, 8, 0, BSD, AN|RIGHT}, -+{"rsp", "RSP", pr_rsp, sr_kstk_eip, 16, 0, LNX, TO|RIGHT}, - {"rss", "RSS", pr_rss, sr_rss, 5, 0, XXX, PO|RIGHT}, /* was 5 wide */ - {"rssize", "RSS", pr_rss, sr_vm_rss, 5, 0, DEC, PO|RIGHT}, /*rsz*/ - {"rsz", "RSZ", pr_rss, sr_vm_rss, 5, 0, BSD, PO|RIGHT}, /*rssize*/ diff --git a/system/base/procps/files/procps-3.2.7-ps-libselinux.patch b/system/base/procps/files/procps-3.2.7-ps-libselinux.patch deleted file mode 100644 index 47213589..00000000 --- a/system/base/procps/files/procps-3.2.7-ps-libselinux.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- procps-3.2.7/ps/output.c.libselinux 2007-08-27 08:34:13.000000000 +0200 -+++ procps-3.2.7/ps/output.c 2007-08-27 08:34:30.000000000 +0200 -@@ -1141,7 +1141,7 @@ - char *context; - - if(!ps_getpidcon && !tried_load){ -- void *handle = dlopen("libselinux.so", RTLD_NOW); -+ void *handle = dlopen("libselinux.so.1", RTLD_NOW); - if(handle){ - dlerror(); - ps_getpidcon = dlsym(handle, "getpidcon"); diff --git a/system/base/procps/files/procps-3.2.7-ps-man-fmt.patch b/system/base/procps/files/procps-3.2.7-ps-man-fmt.patch deleted file mode 100644 index f3a80dca..00000000 --- a/system/base/procps/files/procps-3.2.7-ps-man-fmt.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up procps-3.2.7/ps/ps.1.ps-man-fmt procps-3.2.7/ps/ps.1 ---- procps-3.2.7/ps/ps.1.ps-man-fmt 2008-09-01 11:43:18.000000000 +0200 -+++ procps-3.2.7/ps/ps.1 2008-09-01 11:43:41.000000000 +0200 -@@ -30,7 +30,7 @@ - .\" the space needed for the 1st two columns. - .\" Making it messy: inches, ens, points, scaled points... - .\" --.nr ColSize ((\n(.lu-\n(.iu/\n(.Hu-20u)n) -+.nr ColSize ((\n[.l] - \n[.i]) / 1n - 20) - .\" - .\" This is for command options - .nr OptSize (16u) diff --git a/system/base/procps/files/procps-3.2.7-ps-stime.patch b/system/base/procps/files/procps-3.2.7-ps-stime.patch deleted file mode 100644 index d58b77e6..00000000 --- a/system/base/procps/files/procps-3.2.7-ps-stime.patch +++ /dev/null @@ -1,71 +0,0 @@ ---- procps-3.2.7/ps/output.c.jitter 2007-04-26 13:15:47.000000000 +0200 -+++ procps-3.2.7/ps/output.c 2007-04-26 13:31:24.000000000 +0200 -@@ -77,7 +77,6 @@ - static int wide_signals; /* true if we have room */ - - static unsigned long seconds_since_1970; --static unsigned long time_of_boot; - static unsigned long page_shift; - - -@@ -1952,7 +1951,6 @@ - // available space: page_size*outbuf_pages-SPACE_AMOUNT - - seconds_since_1970 = time(NULL); -- time_of_boot = seconds_since_1970 - seconds_since_boot; - - meminfo(); - ---- procps-3.2.7/ps/common.h.jitter 2005-01-27 04:43:22.000000000 +0100 -+++ procps-3.2.7/ps/common.h 2007-04-26 12:44:01.000000000 +0200 -@@ -302,6 +302,7 @@ - extern int screen_cols; - extern int screen_rows; - extern unsigned long seconds_since_boot; -+extern unsigned long time_of_boot; - extern selection_node *selection_list; - extern unsigned simple_select; - extern sort_node *sort_list; ---- procps-3.2.7/ps/global.c.jitter 2005-10-30 01:43:34.000000000 +0200 -+++ procps-3.2.7/ps/global.c 2007-04-26 13:26:38.000000000 +0200 -@@ -70,6 +70,7 @@ - int screen_cols = -1; - int screen_rows = -1; - unsigned long seconds_since_boot = -1; -+unsigned long time_of_boot = -1; - selection_node *selection_list = (selection_node *)0xdeadbeef; - unsigned simple_select = 0xffffffff; - sort_node *sort_list = (sort_node *)0xdeadbeef; /* ready-to-use sort list */ -@@ -361,7 +362,23 @@ - look_up_our_self(&p); - set_screen_size(); - set_personality(); -- -+ int fd; -+ char *buf[BUFFSIZE]; -+ const char *b; -+ -+ /* get boot time from /proc/stat */ -+ fd = open("/proc/stat", O_RDONLY, 0); -+ if (fd != -1) { -+ buf[BUFFSIZE-1] = 0; -+ read(fd, buf, BUFFSIZE-1); -+ b = strstr(buf, "btime "); -+ if (b) { -+ sscanf(b, "btime %lu", &time_of_boot); -+ seconds_since_boot = time(0) - time_of_boot; -+ } -+ close(fd); -+ } -+ - all_processes = 0; - bsd_c_option = 0; - bsd_e_option = 0; -@@ -380,7 +397,6 @@ - negate_selection = 0; - page_size = getpagesize(); - running_only = 0; -- seconds_since_boot = uptime(0,0); - selection_list = NULL; - simple_select = 0; - sort_list = NULL; diff --git a/system/base/procps/files/procps-3.2.7-pseudo.patch b/system/base/procps/files/procps-3.2.7-pseudo.patch deleted file mode 100644 index 7f4de7da..00000000 --- a/system/base/procps/files/procps-3.2.7-pseudo.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff -up procps-3.2.7/top.h.p7 procps-3.2.7/top.h ---- procps-3.2.7/top.h.p7 2006-06-25 08:41:48.000000000 +0200 -+++ procps-3.2.7/top.h 2008-09-01 11:29:15.000000000 +0200 -@@ -149,8 +149,13 @@ do { - int _len = 1 + snprintf(_str, sizeof(_str), fmt, ## arg); \ - if (Batch) _ptr = _str; \ - else { \ -- _ptr = &Pseudo_scrn[Pseudo_row++ * Pseudo_cols]; \ -- if (memcmp(_ptr, _str, _len)) { \ -+ int _rest; \ -+ _ptr = &Pseudo_scrn[Pseudo_row * Pseudo_cols]; \ -+ _rest = Pseudo_size-(_ptr-Pseudo_scrn); \ -+ Pseudo_row = (Pseudo_row+1) % Screen_rows; \ -+ if (_rest < _len) \ -+ _len = _rest; \ -+ if (memcmp(_ptr, _str, _len)) { \ - memcpy(_ptr, _str, _len); \ - } else { \ - _ptr = "\n"; \ diff --git a/system/base/procps/files/procps-3.2.7-psman.patch b/system/base/procps/files/procps-3.2.7-psman.patch deleted file mode 100644 index 7ba6cff3..00000000 --- a/system/base/procps/files/procps-3.2.7-psman.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- procps-3.2.7/ps/ps.1.psman 2007-06-20 08:30:47.000000000 +0200 -+++ procps-3.2.7/ps/ps.1 2007-06-20 08:50:10.000000000 +0200 -@@ -21,8 +21,8 @@ - .\" See /usr/share/groff/current/tmac/an-old.tmac for what these do. - .\" Setting them to zero provides extra space, but only do that for - .\" plain text output. PostScript and such will remain indented. --.if n .nr IN 0n --.if n .nr an-prevailing-indent 0n -+.\" .if n .nr IN 0n -+.\" .if n .nr an-prevailing-indent 0n - .\" - .\" - .\" ColSize is used for the format spec table. -@@ -838,6 +838,8 @@ - .\" lB1 lB1 lBw(5.5i) - .\" lB1 l1 l. - .\" -+.RE -+ - .TS - expand; - lB1 lB1 lBw(\n[ColSize]n) diff --git a/system/base/procps/files/procps-3.2.7-slabtop-once.patch b/system/base/procps/files/procps-3.2.7-slabtop-once.patch deleted file mode 100644 index d3319cfe..00000000 --- a/system/base/procps/files/procps-3.2.7-slabtop-once.patch +++ /dev/null @@ -1,113 +0,0 @@ -diff -up procps-3.2.7/slabtop.c.once procps-3.2.7/slabtop.c ---- procps-3.2.7/slabtop.c.once 2008-12-11 13:24:52.000000000 +0100 -+++ procps-3.2.7/slabtop.c 2008-12-11 13:33:12.000000000 +0100 -@@ -268,9 +268,24 @@ static void parse_input(char c) - } - } - -+/*printw or printf depending on the context*/ -+static void printwf(int once, const char *s,...) -+{ -+va_list va; -+ -+va_start(va,s); -+if(once) -+ vprintf(s,va); -+else -+ vwprintw(stdscr, s, va); -+va_end(va); -+} -+ -+ - int main(int argc, char *argv[]) - { - int o; -+ int once = 0; - unsigned short old_rows; - struct slab_info *slab_list = NULL; - -@@ -307,6 +322,7 @@ int main(int argc, char *argv[]) - break; - case 'o': - delay = 0; -+ once = 1; - break; - case 'V': - display_version(); -@@ -322,12 +338,18 @@ int main(int argc, char *argv[]) - if (tcgetattr(0, &saved_tty) == -1) - perror("tcgetattr"); - -- initscr(); -- term_size(0); -- old_rows = rows; -- resizeterm(rows, cols); -- signal(SIGWINCH, term_size); -- signal(SIGINT, sigint_handler); -+ if(!once) { -+ initscr(); -+ term_size(0); -+ old_rows = rows; -+ resizeterm(rows, cols); -+ signal(SIGWINCH, term_size); -+ signal(SIGINT, sigint_handler); -+ } else { -+ old_rows = rows; -+ rows = 80; -+ cols = 24; -+ } - - do { - struct slab_info *curr; -@@ -341,12 +363,12 @@ int main(int argc, char *argv[]) - break; - - if (old_rows != rows) { -- resizeterm(rows, cols); -+ if(!once) resizeterm(rows, cols); - old_rows = rows; - } - - move(0,0); -- printw( " Active / Total Objects (%% used) : %d / %d (%.1f%%)\n" -+ printwf(once, " Active / Total Objects (%% used) : %d / %d (%.1f%%)\n" - " Active / Total Slabs (%% used) : %d / %d (%.1f%%)\n" - " Active / Total Caches (%% used) : %d / %d (%.1f%%)\n" - " Active / Total Size (%% used) : %.2fK / %.2fK (%.1f%%)\n" -@@ -360,15 +382,15 @@ int main(int argc, char *argv[]) - - slab_list = slabsort(slab_list); - -- attron(A_REVERSE); -- printw( "%6s %6s %4s %8s %6s %8s %10s %-23s\n", -+ if(!once) attron(A_REVERSE); -+ printwf(once, "%6s %6s %4s %8s %6s %8s %10s %-23s\n", - "OBJS", "ACTIVE", "USE", "OBJ SIZE", "SLABS", - "OBJ/SLAB", "CACHE SIZE", "NAME"); -- attroff(A_REVERSE); -+ if(!once) attroff(A_REVERSE); - - curr = slab_list; - for (i = 0; i < rows - 8 && curr->next; i++) { -- printw("%6u %6u %3u%% %7.2fK %6u %8u %9uK %-23s\n", -+ printwf(once, "%6u %6u %3u%% %7.2fK %6u %8u %9uK %-23s\n", - curr->nr_objs, curr->nr_active_objs, curr->use, - curr->obj_size / 1024.0, curr->nr_slabs, - curr->objs_per_slab, (unsigned)(curr->cache_size / 1024), -@@ -376,7 +398,7 @@ int main(int argc, char *argv[]) - curr = curr->next; - } - -- refresh(); -+ if(!once) refresh(); - put_slabinfo(slab_list); - - FD_ZERO(&readfds); -@@ -392,6 +414,6 @@ int main(int argc, char *argv[]) - - tcsetattr(0, TCSAFLUSH, &saved_tty); - free_slabinfo(slab_list); -- endwin(); -+ if(!once) endwin(); - return 0; - } diff --git a/system/base/procps/files/procps-3.2.7-sysctl-ignore.patch b/system/base/procps/files/procps-3.2.7-sysctl-ignore.patch deleted file mode 100644 index a7d6880b..00000000 --- a/system/base/procps/files/procps-3.2.7-sysctl-ignore.patch +++ /dev/null @@ -1,87 +0,0 @@ ---- procps-3.2.7/sysctl.c.kzak 2007-04-03 01:26:01.000000000 +0200 -+++ procps-3.2.7/sysctl.c 2007-04-03 01:26:13.000000000 +0200 -@@ -63,6 +63,44 @@ - static const char ERR_PRELOAD_FILE[] = "error: unable to open preload file \"%s\"\n"; - static const char WARN_BAD_LINE[] = "warning: %s(%d): invalid syntax, continuing...\n"; - -+/* Ignore deprecated sysctls -+ * -- we use this list when we scan (DisplayAll) /proc/sys only. We don't use it -+ * in case when user direcly uses deprecated key. It's better when user can read -+ * an error message from kernel. -+ */ -+struct sysctl_ignore { -+ const char *prefix; -+ int prefix_len; -+ const char *option; -+ int option_len; -+}; -+ -+#define IGNORE_ENTRY(prefix, option) \ -+ { prefix, sizeof(prefix)-1, option, sizeof(option)-1 } -+ -+static struct sysctl_ignore Ignore[] = -+{ -+ IGNORE_ENTRY( "net.ipv6.neigh", "base_reachable_time" ), -+ IGNORE_ENTRY( "net.ipv6.neigh", "retrans_time" ) -+}; -+ -+static bool IsIgnored(const char *name) -+{ -+ unsigned int i; -+ int sz = strlen(name); -+ -+ for (i = 0; i < sizeof(Ignore)/sizeof(struct sysctl_ignore); i++) { -+ struct sysctl_ignore *p = &Ignore[i]; -+ -+ if (sz < (p->prefix_len + p->option_len)) -+ continue; -+ -+ if (strncmp(name, p->prefix, p->prefix_len) == 0 && -+ strcmp(name + (sz - p->option_len), p->option) == 0) -+ return true; -+ } -+ return false; -+} - - static void slashdot(char *restrict p, char old, char new){ - p = strpbrk(p,"/."); -@@ -122,7 +160,7 @@ - * Read a sysctl setting - * - */ --static int ReadSetting(const char *restrict const name) { -+static int ReadSetting(const char *restrict const name, bool useign) { - int rc = 0; - char *restrict tmpname; - char *restrict outname; -@@ -145,6 +183,12 @@ - outname = strdup(name); - slashdot(outname,'/','.'); /* change / to . */ - -+ if (useign && IsIgnored(outname)) { -+ free(outname); -+ free(tmpname); -+ return rc; -+ } -+ - if (stat(tmpname, &st)==0) { - if (st.st_mode & (S_IRUSR|S_IROTH|S_IRGRP)) - fp = fopen(tmpname, "r"); -@@ -257,7 +301,7 @@ - strcat(tmpdir, "/"); - DisplayAll(tmpdir); - } else { -- rc |= ReadSetting(tmpdir+strlen(PROC_PATH)); -+ rc |= ReadSetting(tmpdir+strlen(PROC_PATH), true); - } - } - free(tmpdir); -@@ -519,7 +563,7 @@ - if (WriteMode || index(*argv, '=')) - ReturnCode = WriteSetting(*argv); - else -- ReturnCode = ReadSetting(*argv); -+ ReturnCode = ReadSetting(*argv, false); - } - } - diff --git a/system/base/procps/files/procps-3.2.7-sysctl-writeonly.patch b/system/base/procps/files/procps-3.2.7-sysctl-writeonly.patch deleted file mode 100644 index 7b23f677..00000000 --- a/system/base/procps/files/procps-3.2.7-sysctl-writeonly.patch +++ /dev/null @@ -1,56 +0,0 @@ -diff -up procps-3.2.7/sysctl.c.p9 procps-3.2.7/sysctl.c ---- procps-3.2.7/sysctl.c.p9 2006-06-25 02:51:51.000000000 +0200 -+++ procps-3.2.7/sysctl.c 2008-09-01 11:31:58.000000000 +0200 -@@ -127,7 +127,8 @@ static int ReadSetting(const char *restr - char *restrict tmpname; - char *restrict outname; - char inbuf[1025]; -- FILE *restrict fp; -+ FILE *restrict fp = NULL; -+ struct stat st; - - if (!name || !*name) { - fprintf(stderr, ERR_INVALID_KEY, name); -@@ -144,7 +145,13 @@ static int ReadSetting(const char *restr - outname = strdup(name); - slashdot(outname,'/','.'); /* change / to . */ - -- fp = fopen(tmpname, "r"); -+ if (stat(tmpname, &st)==0) { -+ if (st.st_mode & (S_IRUSR|S_IROTH|S_IRGRP)) -+ fp = fopen(tmpname, "r"); -+ else -+ /* ignore write-only files */ -+ return -1; -+ } - - if (!fp) { - switch(errno) { -@@ -158,12 +165,16 @@ static int ReadSetting(const char *restr - fprintf(stderr, ERR_PERMISSION_DENIED, outname); - rc = -1; - break; -+ case EINVAL: /* fopen()/stat() invalid argument */ -+ case ENOTTY: /* inappropriate ioctl for device */ -+ break; - default: - fprintf(stderr, ERR_UNKNOWN_READING, strerror(errno), outname); - rc = -1; - break; - } - } else { -+ errno=0; - if(fgets(inbuf, sizeof inbuf - 1, fp)) { - // this loop is required, see - // /sbin/sysctl -a | egrep -6 dev.cdrom.info -@@ -183,7 +194,9 @@ static int ReadSetting(const char *restr - } - } - } while(fgets(inbuf, sizeof inbuf - 1, fp)); -- } else { -+ -+ /* fgets() returns NULL and errno without change if the file is empty */ -+ } else if (errno) { - switch(errno) { - case EACCES: - fprintf(stderr, ERR_PERMISSION_DENIED, outname); diff --git a/system/base/procps/files/procps-3.2.7-top-clrscr.patch b/system/base/procps/files/procps-3.2.7-top-clrscr.patch deleted file mode 100644 index 8a025684..00000000 --- a/system/base/procps/files/procps-3.2.7-top-clrscr.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff -up procps-3.2.7/top.c.clrscr procps-3.2.7/top.c ---- procps-3.2.7/top.c.clrscr 2008-04-08 08:49:48.000000000 +0200 -+++ procps-3.2.7/top.c 2008-04-08 08:50:07.000000000 +0200 -@@ -2109,6 +2109,7 @@ static void fields_sort (void) - *p = x + 'A'; - Curwin->rc.sortindx = x; - putp(Cap_curs_norm); -+ putp(Cap_clr_scr); - } - - -@@ -2134,6 +2135,7 @@ static void fields_toggle (void) - *p = i + 'A'; - } - putp(Cap_curs_norm); -+ putp(Cap_clr_scr); - } - - /*###### Windows/Field Groups support #################################*/ diff --git a/system/base/procps/files/procps-3.2.7-top-cpu0.patch b/system/base/procps/files/procps-3.2.7-top-cpu0.patch deleted file mode 100644 index eb81121c..00000000 --- a/system/base/procps/files/procps-3.2.7-top-cpu0.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- procps-3.2.7/top.c.orig 2007-09-07 21:28:41.000000000 +0100 -+++ procps-3.2.7/top.c 2007-09-07 21:29:15.000000000 +0100 -@@ -959,8 +959,15 @@ - - // 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)); -+ cpus[0].id = cpus[1].id = 0; -+ cpus[0].u = cpus[1].u; -+ cpus[0].n = cpus[1].n; -+ cpus[0].s = cpus[1].s; -+ cpus[0].i = cpus[1].i; -+ cpus[0].w = cpus[1].w; -+ cpus[0].x = cpus[1].x; -+ cpus[0].y = cpus[1].y; -+ cpus[0].z = cpus[1].z; - } - - // now value each separate cpu's tics diff --git a/system/base/procps/files/procps-3.2.7-top-cpuint.patch b/system/base/procps/files/procps-3.2.7-top-cpuint.patch deleted file mode 100644 index 9d204ed4..00000000 --- a/system/base/procps/files/procps-3.2.7-top-cpuint.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up procps-3.2.7/top.c.cpuint procps-3.2.7/top.c ---- procps-3.2.7/top.c.cpuint 2008-01-11 08:32:44.000000000 +0100 -+++ procps-3.2.7/top.c 2008-01-11 08:32:52.000000000 +0100 -@@ -1824,7 +1824,7 @@ static void configs_read (void) - if(Rc.mode_irixps && smp_num_cpus>1){ - // good for 100 CPUs per process - pcpu_max_value = 9999.0; -- Fieldstab[P_CPU].fmts = " %4.0f"; -+ Fieldstab[P_CPU].fmts = " %4.1f"; - } - - // lastly, establish the true runtime secure mode and delay time diff --git a/system/base/procps/files/procps-3.2.7-top-env-cpuloop.patch b/system/base/procps/files/procps-3.2.7-top-env-cpuloop.patch deleted file mode 100644 index 8d499009..00000000 --- a/system/base/procps/files/procps-3.2.7-top-env-cpuloop.patch +++ /dev/null @@ -1,83 +0,0 @@ -diff -up procps-3.2.7/top.c.p15 procps-3.2.7/top.c ---- procps-3.2.7/top.c.p15 2008-09-01 11:37:51.000000000 +0200 -+++ procps-3.2.7/top.c 2008-09-01 11:37:51.000000000 +0200 -@@ -121,6 +121,7 @@ static int No_ksyms = -1, // set t - Secure_mode = 0; // set if some functionality restricted - - static int VIRT_vmsize = 0; //use vm_size for VIRT -+static int CPU_loop = 0; // wait for reliable CPU data - - /* Some cap's stuff to reduce runtime calls -- - to accomodate 'Batch' mode, they begin life as empty strings */ -@@ -1679,6 +1680,8 @@ static void before (char *me) - - if (( getenv("STATSIZE")) && ( atoi(getenv("STATSIZE")) == 1 )) - VIRT_vmsize = 1; -+ if (( getenv("CPULOOP")) && ( atoi(getenv("CPULOOP")) == 1 )) -+ CPU_loop = 1; - } - - -@@ -2978,6 +2981,7 @@ static proc_t **summary_show (void) - { - static proc_t **p_table = NULL; - static CPU_t *smpcpu = NULL; -+ static int first = 0; - - // whoa first time, gotta' prime the pump... - if (!p_table) { -@@ -3025,6 +3029,28 @@ static proc_t **summary_show (void) - - smpcpu = cpus_refresh(smpcpu); - -+ if (first==0 && CPU_loop) -+ { -+ int i; -+ CPU_t *cpu; -+ for (i = 0; i < Cpu_tot; i++) { -+ cpu = &smpcpu[i]; -+ cpu->u_sav = cpu->u; -+ cpu->s_sav = cpu->s; -+ cpu->n_sav = cpu->n; -+ cpu->i_sav = cpu->i; -+ cpu->w_sav = cpu->w; -+ cpu->x_sav = cpu->x; -+ cpu->y_sav = cpu->y; -+ cpu->z_sav = cpu->z; -+ } -+ tv.tv_sec = Rc.delay_time; -+ tv.tv_usec = (Rc.delay_time - (int)Rc.delay_time) * 1000000; -+ select(0, NULL, NULL, NULL, &tv); -+ -+ smpcpu = cpus_refresh(smpcpu); -+ } -+ - if (CHKw(Curwin, View_CPUSUM)) { - // display just the 1st /proc/stat line - summaryhlp(&smpcpu[Cpu_tot], "Cpu(s):"); -@@ -3050,6 +3076,8 @@ static proc_t **summary_show (void) - } - - SETw(Curwin, NEWFRAM_cwo); -+ -+ first = 1; - return p_table; - } - -diff -up procps-3.2.7/top.1.p15 procps-3.2.7/top.1 ---- procps-3.2.7/top.1.p15 2008-09-01 11:37:51.000000000 +0200 -+++ procps-3.2.7/top.1 2008-09-01 11:37:51.000000000 +0200 -@@ -1183,6 +1183,13 @@ Then ponder this: - Send bug reports to: - Albert D\. Cahalan, - -+The top command calculates Cpu(s) by looking at the change in CPU time values -+between samples. When you first run it, it has no previous sample to compare -+to, so these initial values are the percentages since boot. It means you need -+at least two loops or you have to ignore summary output from the first loop. -+This is problem for example for batch mode. There is a possible workaround if -+you define the CPULOOP=1 environment variable. The top command will be run one -+extra hidden loop for CPU data before standard output. - - .\" ---------------------------------------------------------------------- - .SH 8. HISTORY Former top diff --git a/system/base/procps/files/procps-3.2.7-top-env-vmsize.patch b/system/base/procps/files/procps-3.2.7-top-env-vmsize.patch deleted file mode 100644 index 1e57f612..00000000 --- a/system/base/procps/files/procps-3.2.7-top-env-vmsize.patch +++ /dev/null @@ -1,55 +0,0 @@ -diff -up procps-3.2.7/top.c.p14 procps-3.2.7/top.c ---- procps-3.2.7/top.c.p14 2008-09-01 11:36:55.000000000 +0200 -+++ procps-3.2.7/top.c 2008-09-01 11:36:55.000000000 +0200 -@@ -120,6 +120,8 @@ static int No_ksyms = -1, // set t - Loops = -1, // number of iterations, -1 loops forever - Secure_mode = 0; // set if some functionality restricted - -+static int VIRT_vmsize = 0; //use vm_size for VIRT -+ - /* Some cap's stuff to reduce runtime calls -- - to accomodate 'Batch' mode, they begin life as empty strings */ - static char Cap_clr_eol [CAPBUFSIZ], -@@ -1674,6 +1676,9 @@ static void before (char *me) - Fieldstab[P_PPD].fmts = pid_fmt; - Fieldstab[P_PPD].head = " PPID" + 10 - pid_digits; - } -+ -+ if (( getenv("STATSIZE")) && ( atoi(getenv("STATSIZE")) == 1 )) -+ VIRT_vmsize = 1; - } - - -@@ -2207,6 +2212,7 @@ static void reframewins (void) - } - if (!Frames_libflags) Frames_libflags = L_DEFAULT; - if (selection_type=='p') Frames_libflags |= PROC_PID; -+ if (VIRT_vmsize) Frames_libflags |= L_status; - } - - -@@ -3186,7 +3192,10 @@ static void task_show (const WIN_t *q, c - MKCOL(p->ruser); - break; - case P_VRT: -- MKCOL(scale_num(PAGES_TO_KB(p->size), w, s)); -+ if (VIRT_vmsize) -+ MKCOL(scale_num(PAGES_TO_KB(p->vm_size), w, s)); -+ else -+ MKCOL(scale_num(PAGES_TO_KB(p->size), w, s)); - break; - case P_WCH: - if (No_ksyms) { -diff -up procps-3.2.7/top.1.p14 procps-3.2.7/top.1 ---- procps-3.2.7/top.1.p14 2006-06-19 06:33:51.000000000 +0200 -+++ procps-3.2.7/top.1 2008-09-01 11:36:55.000000000 +0200 -@@ -401,7 +401,8 @@ A task's currently used share of availab - o:\fB VIRT\fR \*(EM Virtual Image (kb) - The total amount of \*(MV used by the task. - It includes all code, data and shared libraries plus pages that have been --swapped out. -+swapped out. (Note: you can define the STATSIZE=1 environment variable and the VIRT -+will be calculated from the /proc/#/state VmSize field.) - - VIRT = SWAP + RES. - diff --git a/system/base/procps/files/procps-3.2.7-top-manpage.patch b/system/base/procps/files/procps-3.2.7-top-manpage.patch deleted file mode 100644 index 0f16bd94..00000000 --- a/system/base/procps/files/procps-3.2.7-top-manpage.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -up procps-3.2.7/top.1.cpudesc procps-3.2.7/top.1 ---- procps-3.2.7/top.1.cpudesc 2008-01-18 08:04:19.000000000 +0100 -+++ procps-3.2.7/top.1 2008-01-18 08:15:49.000000000 +0100 -@@ -540,6 +540,20 @@ You\fI move\fR a field to the\fB left\fR - upper case\fR letter and to the\fB right\fR with the\fB lower case\fR - letter. - -+.\" ...................................................................... -+.SS 2c. SUMMARY Area Fields -+.\" ---------------------------------------------------------------------- -+The summary area fields describing CPU statistics are abbreviated. They provide -+information about times spent in: -+ \fR us = user mode -+ \fR sy = system mode -+ \fR ni = low priority user mode (nice) -+ \fR id = idle task -+ \fR wa = I/O waiting -+ \fR hi = servicing IRQs -+ \fR si = servicing soft IRQs -+ \fR st = steal (time given to other DomU instances) -+ - - .\" ---------------------------------------------------------------------- - .SH 3. INTERACTIVE Commands diff --git a/system/base/procps/files/procps-3.2.7-top-rc.patch b/system/base/procps/files/procps-3.2.7-top-rc.patch deleted file mode 100644 index f79625c0..00000000 --- a/system/base/procps/files/procps-3.2.7-top-rc.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff -up procps-3.2.7/top.c.p10 procps-3.2.7/top.c ---- procps-3.2.7/top.c.p10 2008-09-01 11:33:06.000000000 +0200 -+++ procps-3.2.7/top.c 2008-09-01 11:33:06.000000000 +0200 -@@ -2462,7 +2462,10 @@ static void windows_stage2 (void) - 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 diff --git a/system/base/procps/files/procps-3.2.7-top-remcpu.patch b/system/base/procps/files/procps-3.2.7-top-remcpu.patch deleted file mode 100644 index 88d14ef0..00000000 --- a/system/base/procps/files/procps-3.2.7-top-remcpu.patch +++ /dev/null @@ -1,98 +0,0 @@ ---- procps-3.2.7/top.c.remcpu 2006-07-10 10:41:11.000000000 +0200 -+++ procps-3.2.7/top.c 2006-07-10 10:41:35.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,24 +927,29 @@ - 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"); -@@ -955,7 +961,7 @@ - } - - // 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 +970,35 @@ - &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[0].id = cpus[1].id = 0; -+ cpus[0].u = cpus[1].u; -+ cpus[0].n = cpus[1].n; -+ cpus[0].s = cpus[1].s; -+ cpus[0].i = cpus[1].i; -+ cpus[0].w = cpus[1].w; -+ cpus[0].x = cpus[1].x; -+ cpus[0].y = cpus[1].y; -+ cpus[0].z = cpus[1].z; - } -+ - return cpus; - } - diff --git a/system/base/procps/files/procps-3.2.7-top-sorthigh.path b/system/base/procps/files/procps-3.2.7-top-sorthigh.path deleted file mode 100644 index e17df1e2..00000000 --- a/system/base/procps/files/procps-3.2.7-top-sorthigh.path +++ /dev/null @@ -1,37 +0,0 @@ ---- procps-3.2.7/top.c.sorthigh 2007-02-05 09:06:34.000000000 +0100 -+++ procps-3.2.7/top.c 2007-02-05 09:09:35.000000000 +0100 -@@ -3121,6 +3121,7 @@ - unsigned w = Fieldstab[i].width; - - int advance = (x==0) && !Rc.mode_altscr; -+ f += advance; - - switch (i) { - case P_CMD: -@@ -3179,7 +3180,7 @@ - break; - case P_PRI: - if (unlikely(-99 > p->priority) || unlikely(999 < p->priority)) { -- f = " RT"; -+ f = advance ? " RT" : " RT"; - MKCOL(""); - } else - MKCOL((int)p->priority); -@@ -3227,7 +3228,7 @@ - break; - case P_WCH: - if (No_ksyms) { -- f = " %08lx "; -+ f = advance ? "%08lx " : " %08lx "; - MKCOL((long)p->wchan); - } else { - MKCOL(lookup_wchan(p->wchan, p->XXXID)); -@@ -3236,7 +3237,7 @@ - - } /* end: switch 'procflag' */ - -- rp = scat(rp, cbuf+advance); -+ rp = scat(rp, cbuf); - } /* end: for 'maxpflgs' */ - - PUFF( diff --git a/system/base/procps/files/procps-3.2.7-top.1.diff b/system/base/procps/files/procps-3.2.7-top.1.diff deleted file mode 100644 index 7153f903..00000000 --- a/system/base/procps/files/procps-3.2.7-top.1.diff +++ /dev/null @@ -1,342 +0,0 @@ ---- 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]) - . -@@ -504,7 +504,7 @@ and 'Order fields' screens. - .\" ...................................................................... - .SS 2b. SELECTING and ORDERING Columns - .\" ---------------------------------------------------------------------- --After pressing the \*(CIs 'f' (Fields select) or \'o' (Order fields) you will -+After pressing the \*(CIs 'f' (Fields select) or 'o' (Order fields) you will - be shown a screen containing the current \fBfields string\fR followed by names - and descriptions for all fields. - -@@ -580,7 +580,7 @@ Use either of these keys if you have a l - see current status, - - .TP 7 --\ \ \'\fB?\fR\' or \'\fBh\fR\' :\fIHelp\fR -+\ \ '\fB?\fR' or '\fBh\fR' :\fIHelp\fR - There are two help levels available. - The first will provide a reminder of all the basic \*(CIs. - If \*(Me is\fI secured\fR, that screen will be abbreviated. -@@ -589,7 +589,7 @@ Typing 'h' or '?' on that help screen wi - applicable to \*(AM. - - .TP 7 --\ \ \'\fB=\fR\' :\fIExit_Task_Limits\fR -+\ \ '\fB=\fR' :\fIExit_Task_Limits\fR - Removes restrictions on which tasks are shown. - This command will reverse any 'i' (idle tasks) and 'n' (max tasks) commands - that might be active. -@@ -599,13 +599,13 @@ See the '-p' \*(CO for a discussion of P - When operating in \*(AM this command has a slightly broader meaning. - - .TP 7 --\ \ \'\fBA\fR\' :\fIAlternate_Display_Mode_toggle\fR -+\ \ '\fBA\fR' :\fIAlternate_Display_Mode_toggle\fR - This command will switch between \*(FM and \*(AM. - \*(XT 4. ALTERNATE\-DISPLAY Mode and the 'G' \*(CI for insight into - \*(CWs and field groups. - - .TP 7 --\ \ \'\fBB\fR\' :\fIBold_Disable/Enable_toggle\fR -+\ \ '\fBB\fR' :\fIBold_Disable/Enable_toggle\fR - This command will influence use of the 'bold' terminfo capability and - alters\fB both\fR the \*(SA and \*(TA for the \*(CW. - While it is intended primarily for use with dumb terminals, it can be -@@ -617,7 +617,7 @@ Thus, unless the 'x' and/or 'y' toggles - there will be no visual confirmation that they are even on. - - .TP 7 --*\ \'\fBd\fR\' or \'\fBs\fR\' :\fIChange_Delay_Time_interval\fR -+*\ '\fBd\fR' or '\fBs\fR' :\fIChange_Delay_Time_interval\fR - You will be prompted to enter the delay time, in seconds, between - display updates. - -@@ -631,32 +631,32 @@ If at any time you wish to know the curr - and view the system summary on the second line. - - .TP 7 --\ \ \'\fBG\fR\' :\fIChoose_Another_Window/Field_Group\fR -+\ \ '\fBG\fR' :\fIChoose_Another_Window/Field_Group\fR - You will be prompted to enter a number between 1 and 4 designating the - window/field group which should be made the \*(CW. - You will soon grow comfortable with these 4 windows, especially after - experimenting with \*(AM. - - .TP 7 --\ \ \'\fBI\fR\' :\fIIrix/Solaris_Mode_toggle\fR -+\ \ '\fBI\fR' :\fIIrix/Solaris_Mode_toggle\fR - When operating in 'Solaris mode' ('I' toggled \*F), a task's \*(Pu usage - will be divided by the total number of \*(PUs. - After issuing this command, you'll be informed of the new state of this toggle. - - .TP 7 --\ \ \'\fBu\fR\' :\fIselect a user\fR -+\ \ '\fBu\fR' :\fIselect a user\fR - You will be prompted for a UID or username. Only processes - belonging to the selected user will be displayed. This option - matches on the effective UID. - - .TP 7 --\ \ \'\fBU\fR\' :\fIselect a user\fR -+\ \ '\fBU\fR' :\fIselect a user\fR - You will be prompted for a UID or username. Only processes - belonging to the selected user will be displayed. This option - matches on the real, effective, saved, and filesystem UID. - - .TP 7 --*\ \'\fBk\fR\' :\fIKill_a_task\fR -+*\ '\fBk\fR' :\fIKill_a_task\fR - You will be prompted for a PID and then the signal to send. - The default signal, as reflected in the prompt, is SIGTERM. - However, you can send any signal, via number or name. -@@ -667,24 +667,24 @@ depending on your progress: - 2) at the signal prompt, type 0 - - .TP 7 --\ \ \'\fBq\fR\' :\fIQuit\fR -+\ \ '\fBq\fR' :\fIQuit\fR - - .TP 7 --*\ \'\fBr\fR\' :\fIRenice_a_Task\fR -+*\ '\fBr\fR' :\fIRenice_a_Task\fR - You will be prompted for a PID and then the value to nice it to. - Entering a positive value will cause a process to lose priority. - Conversely, a negative value will cause a process to be viewed more - favorably by the kernel. - - .TP 7 --\ \ \'\fBW\fR\' :\fIWrite_the_Configuration_File\fR -+\ \ '\fBW\fR' :\fIWrite_the_Configuration_File\fR - This will save all of your options and toggles plus the current - display mode and delay time. - By issuing this command just before quitting \*(Me, you will be able restart - later in exactly that same state. - - .TP 7 --\ \ \'\fBZ\fR\' :\fIChange_Color_Mapping -+\ \ '\fBZ\fR' :\fIChange_Color_Mapping - This key will take you to a separate screen where you can change the - colors for the \*(CW, or for all windows. - For details regarding this \*(CI \*(Xt 3d. COLOR Mapping. -@@ -704,21 +704,21 @@ These commands always impact just the \* - \*(CWs and field groups. - - .TP 7 --\ \ \'\fBl\fR\' :\fIToggle_Load_Average/Uptime\fR \*(EM On/Off -+\ \ '\fBl\fR' :\fIToggle_Load_Average/Uptime\fR \*(EM On/Off - This is also the line containing the program name (possibly an alias) when - operating in \*(FM or the \*(CW name when operating in \*(AM. - - .TP 7 --\ \ \'\fBm\fR\' :\fIToggle_Memory/Swap_Usage\fR \*(EM On/Off -+\ \ '\fBm\fR' :\fIToggle_Memory/Swap_Usage\fR \*(EM On/Off - This command affects two \*(SA lines. - - .TP 7 --\ \ \'\fBt\fR\' :\fIToggle_Task/Cpu_States\fR \*(EM On/Off -+\ \ '\fBt\fR' :\fIToggle_Task/Cpu_States\fR \*(EM On/Off - This command affects from 2 to many \*(SA lines, depending on the state - of the '1' toggle and whether or not \*(Me is running under true SMP. - - .TP 7 --\ \ \'\fB1\fR\' :\fIToggle_Single/Separate_Cpu_States\fR \*(EM On/Off -+\ \ '\fB1\fR' :\fIToggle_Single/Separate_Cpu_States\fR \*(EM On/Off - This command affects how the 't' command's Cpu States portion is shown. - Although this toggle exists primarily to serve massively-parallel SMP machines, - it is not restricted to solely SMP environments. -@@ -750,12 +750,12 @@ global 'B' (bold disable) toggle. - .in - - .TP 7 --\ \ \'\fBb\fR\' :\fIBold/Reverse_toggle\fR -+\ \ '\fBb\fR' :\fIBold/Reverse_toggle\fR - This command will impact how the 'x' and 'y' toggles are displayed. - Further, it will only be available when at least one of those toggles is \*O. - - .TP 7 --\ \ \'\fBx\fR\' :\fIColumn_Highlight_toggle\fR -+\ \ '\fBx\fR' :\fIColumn_Highlight_toggle\fR - Changes highlighting for the current sort field. - You probably don't need a constant visual reminder of the sort field and - \*(Me hopes that you always run with 'column highlight' \*F, due to the cost -@@ -765,7 +765,7 @@ If you forget which field is being sorte - visual reminder. - - .TP 7 --\ \ \'\fBy\fR\' :\fIRow_Highlight_toggle\fR -+\ \ '\fBy\fR' :\fIRow_Highlight_toggle\fR - Changes highlighting for "running" tasks. - For additional insight into this task state, \*(Xt 2a. DESCRIPTIONS of Fields, - Process Status. -@@ -774,7 +774,7 @@ Use of this provision provides important - The only costs will be a few additional tty escape sequences. - - .TP 7 --\ \ \'\fBz\fR\' :\fIColor/Monochrome_toggle\fR -+\ \ '\fBz\fR' :\fIColor/Monochrome_toggle\fR - Switches the \*(CW between your last used color scheme and the older form - of black-on-white or white-on-black. - This command will alter\fB both\fR the \*(SA and \*(TA but does not affect the -@@ -785,24 +785,24 @@ state of the 'x', 'y' or 'b' toggles. - .B CONTENT\fR of \*(TW - .PD 0 - .TP 7 --\ \ \'\fBc\fR\' :\fICommand_Line/Program_Name_toggle\fR -+\ \ '\fBc\fR' :\fICommand_Line/Program_Name_toggle\fR - This command will be honored whether or not the 'Command' column - is currently visible. - Later, should that field come into view, the change you applied will be seen. - - .TP 7 --\ \ \'\fBf\fR\' and \'\fBo\fR\' :\fIFields_select\fR or \fIOrder_fields\fR -+\ \ '\fBf\fR' and '\fBo\fR' :\fIFields_select\fR or \fIOrder_fields\fR - These keys display separate screens where you can change which - fields are displayed and their order. - For additional information on these \*(CIs - \*(Xt 2b. SELECTING and ORDERING Columns. - - .TP 7 --\ \ \'\fBH\fR\' :\fIThreads_toggle\fR -+\ \ '\fBH\fR' :\fIThreads_toggle\fR - When this toggle is \*O, all individual threads will be displayed. Otherwise, \*(Me displays a summation of all threads in a process. - - .TP 7 --\ \ \'\fBS\fR\' :\fICumulative_Time_Mode_toggle\fR -+\ \ '\fBS\fR' :\fICumulative_Time_Mode_toggle\fR - When 'Cumulative mode' is \*O, each process is listed with the \*(Pu - time that it and its dead children have used. - -@@ -818,7 +818,7 @@ If you wish to know in advance whether o - effect, simply ask for help and view the window summary on the second line. - - .TP 7 --\ \ \'\fBu\fR\' :\fIShow_Specific_User_Only\fR -+\ \ '\fBu\fR' :\fIShow_Specific_User_Only\fR - You will be prompted to enter the name of the user to display. - Thereafter, in that \*(TW only matching User ID's will be shown, or possibly - no tasks will be shown. -@@ -831,7 +831,7 @@ just press at the prompt, withou - .B SIZE\fR of \*(TW - .PD 0 - .TP 7 --\ \ \'\fBi\fR\' :\fIIdle_Processes_toggle\fR -+\ \ '\fBi\fR' :\fIIdle_Processes_toggle\fR - Displays all tasks or just active tasks. - When this toggle is \*F, idled or zombied processes will not be displayed. - -@@ -839,7 +839,7 @@ If this command is applied to the last \ - affect the window's size, as all prior \*(TDs will have already been painted. - - .TP 7 --\ \ \'\fBn\fR\' or \'#\' :\fISet_Maximum_Tasks\fR -+\ \ '\fBn\fR' or '#' :\fISet_Maximum_Tasks\fR - You will be prompted to enter the number of tasks to display. - The lessor of your number and available screen rows will be used. - -@@ -878,12 +878,12 @@ The sort field might\fI not\fR be visibl - .in - - .TP 7 --\ \ \'\fB<\fR\' :\fIMove_Sort_Field_Left\fR -+\ \ '\fB<\fR' :\fIMove_Sort_Field_Left\fR - Moves the sort column to the left unless the current sort field is - the first field being displayed. - - .TP 7 --\ \ \'\fB>\fR\' :\fIMove_Sort_Field_Right\fR -+\ \ '\fB>\fR' :\fIMove_Sort_Field_Right\fR - Moves the sort column to the right unless the current sort field is - the last field being displayed. - -@@ -894,7 +894,7 @@ the current sort field is visible. - .in - - .TP 7 --\ \ \'\fBF\fR\' or \'\fBO\fR\' :\fISelect_Sort_Field\fR -+\ \ '\fBF\fR' or '\fBO\fR' :\fISelect_Sort_Field\fR - These keys display a separate screen where you can change which field - is used as the sort column. - -@@ -907,7 +907,7 @@ This \*(CI can be a convenient way to si - when running \*(Me with column highlighting turned \*F. - - .TP 7 --\ \ \'\fBR\fR\' :\fIReverse/Normal_Sort_Field_toggle\fR -+\ \ '\fBR\fR' :\fIReverse/Normal_Sort_Field_toggle\fR - Using this \*(CI you can alternate between high-to-low and low-to-high sorts. - - .PP -@@ -984,7 +984,7 @@ know what window is the \*(CW. - .\" ...................................................................... - .SS 4b. COMMANDS for Windows - .TP 7 --\ \ \'\fB-\fR\' and \'\fB_\fR\' :\fIShow/Hide_Window(s)_toggles\fR -+\ \ '\fB-\fR' and '\fB_\fR' :\fIShow/Hide_Window(s)_toggles\fR - The '-' key turns the \*(CW's \*(TD \*O and \*F. - When \*O, that \*(TA will show a minimum of the columns header you've - established with the 'f' and 'o' commands. -@@ -998,7 +998,7 @@ If all 4 \*(TDs are currently visible, t - as the only display element. - - .TP 7 --*\ \'\fB=\fR\' and \'\fB+\fR\' :\fIEqualize_(re-balance)_Window(s)\fR -+*\ '\fB=\fR' and '\fB+\fR' :\fIEqualize_(re-balance)_Window(s)\fR - The '=' key forces the \*(CW's \*(TD to be visible. - It also reverses any 'i' (idle tasks) and 'n' (max tasks) commands that might - be active. -@@ -1009,7 +1009,7 @@ They will also have retained any customi - except for the 'i' (idle tasks) and 'n' (max tasks) commands. - - .TP 7 --*\ \'\fBA\fR\' :\fIAlternate_Display_Mode_toggle\fR -+*\ '\fBA\fR' :\fIAlternate_Display_Mode_toggle\fR - This command will switch between \*(FM and \*(AM. - - The first time you issue this command, all four \*(TDs will be shown. -@@ -1017,7 +1017,7 @@ Thereafter when you switch modes, you wi - chosen to make visible. - - .TP 7 --*\ \'\fBa\fR\' and \'\fBw\fR\' :\fINext_Window_Forward/Backward\fR -+*\ '\fBa\fR' and '\fBw\fR' :\fINext_Window_Forward/Backward\fR - This will change the \*(CW, which in turn changes the window to which - commands are directed. - These keys act in a circular fashion so you can reach any desired \*(CW -@@ -1028,7 +1028,7 @@ whenever the \*(CW name loses its emphas - the \*(TD is \*F and many commands will be restricted. - - .TP 7 --*\ \'\fBG\fR\' :\fIChoose_Another_Window/Field_Group\fR -+*\ '\fBG\fR' :\fIChoose_Another_Window/Field_Group\fR - You will be prompted to enter a number between 1 and 4 designating the - window/field group which should be made the \*(CW. - -@@ -1037,15 +1037,15 @@ In \*(AM, it is simply a less convenient - commands. - - .TP 7 --\ \ \'\fBg\fR\' :\fIChange_Window/Field_Group_Name\fR -+\ \ '\fBg\fR' :\fIChange_Window/Field_Group_Name\fR - You will be prompted for a new name to be applied to the \*(CW. - It does not require that the window name be visible - (the 'l' toggle to be \*O). - - .IP "*" 3 - The \*(CIs shown with an \*(AS have use beyond \*(AM. -- \'=', 'A', 'G' are always available -- \'a', 'w' act the same when color mapping -+ '=', 'A', 'G' are always available -+ 'a', 'w' act the same when color mapping - - - .\" ---------------------------------------------------------------------- diff --git a/system/base/procps/files/procps-3.2.7-vmstat-cpusteal.patch b/system/base/procps/files/procps-3.2.7-vmstat-cpusteal.patch deleted file mode 100644 index a20723f2..00000000 --- a/system/base/procps/files/procps-3.2.7-vmstat-cpusteal.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- procps-3.2.7/vmstat.c.steal 2006-07-10 10:49:49.000000000 +0200 -+++ procps-3.2.7/vmstat.c 2006-07-10 10:54:03.000000000 +0200 -@@ -150,15 +150,15 @@ - //////////////////////////////////////////////////////////////////////////// - - static void new_header(void){ -- printf("procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----\n"); -+ printf("procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------\n"); - printf( -- "%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s\n", -+ "%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s %2s\n", - "r","b", - "swpd", "free", a_option?"inact":"buff", a_option?"active":"cache", - "si","so", - "bi","bo", - "in","cs", -- "us","sy","id","wa" -+ "us","sy","id","wa", "st" - ); - } - -@@ -173,7 +173,7 @@ - //////////////////////////////////////////////////////////////////////////// - - static void new_format(void) { -- const char format[]="%2u %2u %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u\n"; -+ const char format[]="%2u %2u %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u %2u\n"; - unsigned int tog=0; /* toggle switch for cleaner code */ - unsigned int i; - unsigned int hz = Hertz; -@@ -217,8 +217,8 @@ - (unsigned)( (100*duse + divo2) / Div ), - (unsigned)( (100*dsys + divo2) / Div ), - (unsigned)( (100*didl + divo2) / Div ), -- (unsigned)( (100*diow + divo2) / Div ) /* , -- (unsigned)( (100*dstl + divo2) / Div ) */ -+ (unsigned)( (100*diow + divo2) / Div ), -+ (unsigned)( (100*dstl + divo2) / Div ) - ); - - for(i=1;iname,((const vm_table_struct*)b)->name); - } -@@ -626,10 +629,10 @@ - unsigned long vm_nr_reverse_maps; // includes PageDirect - unsigned long vm_nr_mapped; // mapped into pagetables - unsigned long vm_nr_slab; // in slab --unsigned long vm_pgpgin; // kB disk reads (same as 1st num on /proc/stat page line) --unsigned long vm_pgpgout; // kB disk writes (same as 2nd num on /proc/stat page line) --unsigned long vm_pswpin; // swap reads (same as 1st num on /proc/stat swap line) --unsigned long vm_pswpout; // swap writes (same as 2nd num on /proc/stat swap line) -+unsigned long long vm_pgpgin; // kB disk reads (same as 1st num on /proc/stat page line) -+unsigned long long vm_pgpgout; // kB disk writes (same as 2nd num on /proc/stat page line) -+unsigned long long vm_pswpin; // swap reads (same as 1st num on /proc/stat swap line) -+unsigned long long vm_pswpout; // swap writes (same as 2nd num on /proc/stat swap line) - unsigned long vm_pgalloc; // page allocations - unsigned long vm_pgfree; // page freeings - unsigned long vm_pgactivate; // pages moved inactive -> active -@@ -668,54 +671,54 @@ - - void vminfo(void){ - char namebuf[16]; /* big enough to hold any row name */ -- vm_table_struct findme = { namebuf, NULL}; -+ vm_table_struct findme = { namebuf, NULL, 0}; - vm_table_struct *found; - char *head; - char *tail; - static const vm_table_struct vm_table[] = { -- {"allocstall", &vm_allocstall}, -- {"kswapd_inodesteal", &vm_kswapd_inodesteal}, -- {"kswapd_steal", &vm_kswapd_steal}, -- {"nr_dirty", &vm_nr_dirty}, // page version of meminfo Dirty -- {"nr_mapped", &vm_nr_mapped}, // page version of meminfo Mapped -- {"nr_page_table_pages", &vm_nr_page_table_pages},// same as meminfo PageTables -- {"nr_pagecache", &vm_nr_pagecache}, // gone in 2.5.66+ kernels -- {"nr_reverse_maps", &vm_nr_reverse_maps}, // page version of meminfo ReverseMaps GONE -- {"nr_slab", &vm_nr_slab}, // page version of meminfo Slab -- {"nr_unstable", &vm_nr_unstable}, -- {"nr_writeback", &vm_nr_writeback}, // page version of meminfo Writeback -- {"pageoutrun", &vm_pageoutrun}, -- {"pgactivate", &vm_pgactivate}, -- {"pgalloc", &vm_pgalloc}, // GONE (now separate dma,high,normal) -- {"pgalloc_dma", &vm_pgalloc_dma}, -- {"pgalloc_high", &vm_pgalloc_high}, -- {"pgalloc_normal", &vm_pgalloc_normal}, -- {"pgdeactivate", &vm_pgdeactivate}, -- {"pgfault", &vm_pgfault}, -- {"pgfree", &vm_pgfree}, -- {"pginodesteal", &vm_pginodesteal}, -- {"pgmajfault", &vm_pgmajfault}, -- {"pgpgin", &vm_pgpgin}, // important -- {"pgpgout", &vm_pgpgout}, // important -- {"pgrefill", &vm_pgrefill}, // GONE (now separate dma,high,normal) -- {"pgrefill_dma", &vm_pgrefill_dma}, -- {"pgrefill_high", &vm_pgrefill_high}, -- {"pgrefill_normal", &vm_pgrefill_normal}, -- {"pgrotated", &vm_pgrotated}, -- {"pgscan", &vm_pgscan}, // GONE (now separate direct,kswapd and dma,high,normal) -- {"pgscan_direct_dma", &vm_pgscan_direct_dma}, -- {"pgscan_direct_high", &vm_pgscan_direct_high}, -- {"pgscan_direct_normal",&vm_pgscan_direct_normal}, -- {"pgscan_kswapd_dma", &vm_pgscan_kswapd_dma}, -- {"pgscan_kswapd_high", &vm_pgscan_kswapd_high}, -- {"pgscan_kswapd_normal",&vm_pgscan_kswapd_normal}, -- {"pgsteal", &vm_pgsteal}, // GONE (now separate dma,high,normal) -- {"pgsteal_dma", &vm_pgsteal_dma}, -- {"pgsteal_high", &vm_pgsteal_high}, -- {"pgsteal_normal", &vm_pgsteal_normal}, -- {"pswpin", &vm_pswpin}, // important -- {"pswpout", &vm_pswpout}, // important -- {"slabs_scanned", &vm_slabs_scanned}, -+ VM_TABENTRY(allocstall), -+ VM_TABENTRY(kswapd_inodesteal), -+ VM_TABENTRY(kswapd_steal), -+ VM_TABENTRY(nr_dirty), -+ VM_TABENTRY(nr_mapped), -+ VM_TABENTRY(nr_page_table_pages), -+ VM_TABENTRY(nr_pagecache), -+ VM_TABENTRY(nr_reverse_maps), -+ VM_TABENTRY(nr_slab), -+ VM_TABENTRY(nr_unstable), -+ VM_TABENTRY(nr_writeback), -+ VM_TABENTRY(pageoutrun), -+ VM_TABENTRY(pgactivate), -+ VM_TABENTRY(pgalloc), -+ VM_TABENTRY(pgalloc_dma), -+ VM_TABENTRY(pgalloc_high), -+ VM_TABENTRY(pgalloc_normal), -+ VM_TABENTRY(pgdeactivate), -+ VM_TABENTRY(pgfault), -+ VM_TABENTRY(pgfree), -+ VM_TABENTRY(pginodesteal), -+ VM_TABENTRY(pgmajfault), -+ VM_TABENTRY(pgpgin), -+ VM_TABENTRY(pgpgout), -+ VM_TABENTRY(pgrefill), -+ VM_TABENTRY(pgrefill_dma), -+ VM_TABENTRY(pgrefill_high), -+ VM_TABENTRY(pgrefill_normal), -+ VM_TABENTRY(pgrotated), -+ VM_TABENTRY(pgscan), -+ VM_TABENTRY(pgscan_direct_dma), -+ VM_TABENTRY(pgscan_direct_high), -+ VM_TABENTRY(pgscan_direct_normal), -+ VM_TABENTRY(pgscan_kswapd_dma), -+ VM_TABENTRY(pgscan_kswapd_high), -+ VM_TABENTRY(pgscan_kswapd_normal), -+ VM_TABENTRY(pgsteal), -+ VM_TABENTRY(pgsteal_dma), -+ VM_TABENTRY(pgsteal_high), -+ VM_TABENTRY(pgsteal_normal), -+ VM_TABENTRY(pswpin), -+ VM_TABENTRY(pswpout), -+ VM_TABENTRY(slabs_scanned) - }; - const int vm_table_count = sizeof(vm_table)/sizeof(vm_table_struct); - -@@ -741,7 +744,10 @@ - ); - head = tail+1; - if(!found) goto nextline; -- *(found->slot) = strtoul(head,&tail,10); -+ if (found->sz == sizeof(unsigned long long)) -+ *((unsigned long long *) found->slot) = strtoull(head,&tail,10); -+ else -+ *((unsigned long *) found->slot) = strtoul(head,&tail,10); - nextline: - - //if(found) fprintf(stderr,"%s=%d\n",found->name,*(found->slot)); ---- procps-3.2.7/vmstat.c.kzak 2006-08-04 10:52:38.000000000 +0200 -+++ procps-3.2.7/vmstat.c 2006-08-04 12:05:49.000000000 +0200 -@@ -180,7 +180,7 @@ - unsigned int running,blocked,dummy_1,dummy_2; - jiff cpu_use[2], cpu_nic[2], cpu_sys[2], cpu_idl[2], cpu_iow[2], cpu_xxx[2], cpu_yyy[2], cpu_zzz[2]; - jiff duse, dsys, didl, diow, dstl, Div, divo2; -- unsigned long pgpgin[2], pgpgout[2], pswpin[2], pswpout[2]; -+ unsigned long long pgpgin[2], pgpgout[2], pswpin[2], pswpout[2]; - unsigned int intr[2], ctxt[2]; - unsigned int sleep_half; - unsigned long kb_per_page = sysconf(_SC_PAGESIZE) / 1024ul; -@@ -509,7 +509,7 @@ - static void sum_format(void) { - unsigned int running, blocked, btime, processes; - jiff cpu_use, cpu_nic, cpu_sys, cpu_idl, cpu_iow, cpu_xxx, cpu_yyy, cpu_zzz; -- unsigned long pgpgin, pgpgout, pswpin, pswpout; -+ unsigned long long pgpgin, pgpgout, pswpin, pswpout; - unsigned int intr, ctxt; - - meminfo(); -@@ -539,10 +539,10 @@ - printf("%13Lu IRQ cpu ticks\n", cpu_xxx); - printf("%13Lu softirq cpu ticks\n", cpu_yyy); - printf("%13Lu stolen cpu ticks\n", cpu_zzz); -- printf("%13lu pages paged in\n", pgpgin); -- printf("%13lu pages paged out\n", pgpgout); -- printf("%13lu pages swapped in\n", pswpin); -- printf("%13lu pages swapped out\n", pswpout); -+ printf("%13llu pages paged in\n", pgpgin); -+ printf("%13llu pages paged out\n", pgpgout); -+ printf("%13llu pages swapped in\n", pswpin); -+ printf("%13llu pages swapped out\n", pswpout); - printf("%13u interrupts\n", intr); - printf("%13u CPU context switches\n", ctxt); - printf("%13u boot time\n", btime); -@@ -554,7 +554,7 @@ - static void fork_format(void) { - unsigned int running, blocked, btime, processes; - jiff cpu_use, cpu_nic, cpu_sys, cpu_idl, cpu_iow, cpu_xxx, cpu_yyy, cpu_zzz; -- unsigned long pgpgin, pgpgout, pswpin, pswpout; -+ unsigned long long pgpgin, pgpgout, pswpin, pswpout; - unsigned int intr, ctxt; - - getstat(&cpu_use, &cpu_nic, &cpu_sys, &cpu_idl, diff --git a/system/base/procps/files/procps-3.2.7-vmstat-timestamp-manpage.patch b/system/base/procps/files/procps-3.2.7-vmstat-timestamp-manpage.patch deleted file mode 100644 index 37a1f486..00000000 --- a/system/base/procps/files/procps-3.2.7-vmstat-timestamp-manpage.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff -up procps-3.2.7/vmstat.8.timestamp procps-3.2.7/vmstat.8 ---- procps-3.2.7/vmstat.8.timestamp 2009-02-03 12:32:27.000000000 +0100 -+++ procps-3.2.7/vmstat.8 2009-02-03 12:34:37.000000000 +0100 -@@ -8,6 +8,7 @@ vmstat \- Report virtual memory statisti - .B vmstat - .RB [ "\-a" ] - .RB [ "\-n" ] -+.RB [ "\-t" ] - .RI [ delay " [ " count ]] - .br - .B vmstat -@@ -43,7 +44,9 @@ equivalent to the total number of tasks - is represented by one or more tasks, depending on thread usage. - This display does not repeat. - .PP --The \fB-m\fP displays slabinfo. -+The \fB-t\fP switch adds timestamp to the output. -+.PP -+The \fB-m\fP switch displays slabinfo. - .PP - The \fB-n\fP switch causes the header to be displayed only once rather than periodically. - .PP diff --git a/system/base/procps/files/procps-3.2.7-vmstat-timestamp.patch b/system/base/procps/files/procps-3.2.7-vmstat-timestamp.patch deleted file mode 100644 index d7ca0682..00000000 --- a/system/base/procps/files/procps-3.2.7-vmstat-timestamp.patch +++ /dev/null @@ -1,117 +0,0 @@ ---- procps-3.2.7/vmstat.c 2008-12-11 22:11:30.042532106 -0500 -+++ procps-3.2.7/vmstat.c.timestamp 2008-12-11 22:08:11.553529883 -0500 -@@ -25,6 +25,7 @@ - #include - #include - #include -+#include - - #include "proc/sysinfo.h" - #include "proc/version.h" -@@ -56,6 +57,7 @@ - - static unsigned int height; // window height - static unsigned int moreheaders=TRUE; -+static unsigned int showtimestamp=FALSE; - - - ///////////////////////////////////////////////////////////////////////// -@@ -71,6 +73,7 @@ - fprintf(stderr," -p prints disk partition statistics\n"); - fprintf(stderr," -s prints vm table\n"); - fprintf(stderr," -m prints slabinfo\n"); -+ fprintf(stderr," -t add timestamp to output\n"); - fprintf(stderr," -S unit size\n"); - fprintf(stderr," delay is the delay between updates in seconds. \n"); - fprintf(stderr," unit size k:1000 K:1024 m:1000000 M:1048576 (default is K)\n"); -@@ -150,7 +153,11 @@ - //////////////////////////////////////////////////////////////////////////// - - static void new_header(void){ -- printf("procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----\n"); -+ if(!showtimestamp){ -+ printf("procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----\n"); -+ } else { -+ printf("procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ ---timestamp---\n"); -+ } - printf( - "%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s %2s\n", - "r","b", -@@ -173,7 +180,7 @@ - //////////////////////////////////////////////////////////////////////////// - - static void new_format(void) { -- const char format[]="%2u %2u %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u %2u\n"; -+ const char format[]="%2u %2u %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u %2u\t%s\n"; - unsigned int tog=0; /* toggle switch for cleaner code */ - unsigned int i; - unsigned int hz = Hertz; -@@ -185,6 +192,10 @@ - unsigned int sleep_half; - unsigned long kb_per_page = sysconf(_SC_PAGESIZE) / 1024ul; - int debt = 0; // handle idle ticks running backwards -+ struct tm *tm_ptr; -+ time_t the_time; -+ char timebuf[32]; -+ timebuf[0] = '\0'; - - sleep_half=(sleep_time/2); - new_header(); -@@ -196,6 +207,13 @@ - &running,&blocked, - &dummy_1, &dummy_2); - -+ if (showtimestamp) -+ { -+ (void) time( &the_time ); -+ tm_ptr = localtime( &the_time ); -+ strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S %Z", tm_ptr); -+ } -+ - duse= *cpu_use + *cpu_nic; - dsys= *cpu_sys + *cpu_xxx + *cpu_yyy; - didl= *cpu_idl; -@@ -218,7 +236,8 @@ - (unsigned)( (100*dsys + divo2) / Div ), - (unsigned)( (100*didl + divo2) / Div ), - (unsigned)( (100*diow + divo2) / Div ), -- (unsigned)( (100*dstl + divo2) / Div ) -+ (unsigned)( (100*dstl + divo2) / Div ), -+ timebuf - ); - - for(i=1;itgid == u->ut_pid)) { - *found_utpid = 1; -- best = tmp; -+ if (!best) -+ best = tmp; - } - if(tmp->tty != line) continue; - (*jcpu) += tmp->utime + tmp->stime; -- secondbest = tmp; - /* same time-logic here as for "best" below */ - if(! (secondbest && tmp->start_time <= secondbest->start_time) ){ - secondbest = tmp; diff --git a/system/base/procps/files/procps-3.2.7-watch-unicode.patch b/system/base/procps/files/procps-3.2.7-watch-unicode.patch deleted file mode 100644 index bfe6fe22..00000000 --- a/system/base/procps/files/procps-3.2.7-watch-unicode.patch +++ /dev/null @@ -1,139 +0,0 @@ -diff -u procps-3.2.7/Makefile procps/Makefile ---- procps-3.2.7/Makefile 2007-01-16 17:24:49.000000000 +0100 -+++ procps/Makefile 2007-01-16 17:29:27.000000000 +0100 -@@ -67,7 +67,7 @@ - # plus the top-level Makefile to make it work stand-alone. - _TARFILES := Makefile - --CURSES := -lncurses -+CURSES := -lncursesw - - # This seems about right for the dynamic library stuff. - # Something like this is probably needed to make the SE Linux -diff -u procps-3.2.7/watch.c procps/watch.c ---- procps-3.2.7/watch.c 2007-01-16 17:24:49.000000000 +0100 -+++ procps/watch.c 2007-01-16 18:06:57.000000000 +0100 -@@ -28,6 +28,8 @@ - #include - #include - #include -+#include -+#include - - #ifdef FORCE_8BIT - #undef isprint -@@ -137,6 +139,27 @@ - } - } - -+static wint_t -+readwc(FILE *stream, mbstate_t *mbs) -+{ -+ for (;;) { -+ int chr; -+ char c; -+ wchar_t wc; -+ size_t len; -+ -+ chr = getc(stream); -+ if (chr == EOF) -+ return WEOF; -+ c = chr; -+ len = mbrtowc(&wc, &c, 1, mbs); -+ if (len == (size_t)-1) -+ memset(mbs, 0, sizeof(*mbs)); -+ else if (len != (size_t)-2) -+ return wc; -+ } -+} -+ - int - main(int argc, char *argv[]) - { -@@ -243,6 +266,7 @@ - FILE *p; - int x, y; - int oldeolseen = 1; -+ mbstate_t mbs; - - if (screen_size_changed) { - get_terminal_size(); -@@ -276,49 +300,63 @@ - do_exit(2); - } - -+ memset(&mbs, 0, sizeof(mbs)); - for (y = show_title; y < height; y++) { - int eolseen = 0, tabpending = 0; - for (x = 0; x < width; x++) { -- int c = ' '; -- int attr = 0; -+ wint_t c = L' '; -+ int attr = 0, c_width; -+ cchar_t cc; -+ wchar_t wstr[2]; - - if (!eolseen) { - /* if there is a tab pending, just spit spaces until the - next stop instead of reading characters */ - if (!tabpending) - do -- c = getc(p); -- while (c != EOF && !isprint(c) -- && c != '\n' -- && c != '\t'); -- if (c == '\n') -+ c = readwc(p, &mbs); -+ while (c != WEOF && !iswprint(c) -+ && c != L'\n' -+ && c != L'\t'); -+ if (c == L'\n') - if (!oldeolseen && x == 0) { - x = -1; - continue; - } else - eolseen = 1; -- else if (c == '\t') -+ else if (c == L'\t') - tabpending = 1; -- if (c == EOF || c == '\n' || c == '\t') -- c = ' '; -+ if (c == WEOF || c == L'\n' || c == L'\t') -+ c = L' '; - if (tabpending && (((x + 1) % 8) == 0)) - tabpending = 0; - } -+ wstr[0] = c; -+ wstr[1] = 0; -+ setcchar (&cc, wstr, 0, 0, NULL); - move(y, x); - if (option_differences) { -- chtype oldch = inch(); -- char oldc = oldch & A_CHARTEXT; -+ cchar_t oldc; -+ wchar_t oldwstr[2]; -+ attr_t attrs; -+ short colors; -+ -+ in_wch(&oldc); -+ getcchar(&oldc, oldwstr, &attrs, &colors, NULL); - attr = !first_screen -- && ((char)c != oldc -+ && (wstr[0] != oldwstr[0] - || - (option_differences_cumulative -- && (oldch & A_ATTRIBUTES))); -+ && attrs)); - } - if (attr) - standout(); -- addch(c); -+ add_wch(&cc); - if (attr) - standend(); -+ c_width = wcwidth(c); -+ if (c_width > 1) -+ x += c_width - 1; - } - oldeolseen = eolseen; - } diff --git a/system/base/procps/files/procps-3.2.8-constructor-order.patch b/system/base/procps/files/procps-3.2.8-constructor-order.patch deleted file mode 100644 index 87b5a034..00000000 --- a/system/base/procps/files/procps-3.2.8-constructor-order.patch +++ /dev/null @@ -1,38 +0,0 @@ -Description: Call libproc constructors in strict order - Having one constructor depend on another means if the order is reversed - you get a different result. Patched based on idea by Tom Evans. -Bug-Debian: http://bugs.debian.org/460331 -Author: Craig Small -Adapted to Fedora: Jan Görig ---- a/proc/sysinfo.c -+++ b/proc/sysinfo.c -@@ -213,6 +213,7 @@ - static void init_libproc(void) __attribute__((constructor)); - static void init_libproc(void){ - have_privs = check_for_privs(); -+ init_Linux_version(); /* Must be called before we check code */ - // ought to count CPUs in /proc/stat instead of relying - // on glibc, which foolishly tries to parse /proc/cpuinfo - // ---- a/proc/version.c -+++ b/proc/version.c -@@ -33,8 +33,7 @@ - - int linux_version_code; - --static void init_Linux_version(void) __attribute__((constructor)); --static void init_Linux_version(void) { -+void init_Linux_version(void) { - static struct utsname uts; - int x = 0, y = 0, z = 0; /* cleared in case sscanf() < 3 */ - ---- a/proc/version.h -+++ b/proc/version.h -@@ -14,6 +14,7 @@ - - EXTERN_C_BEGIN - -+void init_Linux_version(void); /* Get Linux version */ - extern void display_version(void); /* display suite version */ - extern const char procps_version[]; /* global buf for suite version */ - extern const char procps_number_version[]; /* global buf for suite number version */ diff --git a/system/base/procps/files/procps-3.2.8-make.patch b/system/base/procps/files/procps-3.2.8-make.patch deleted file mode 100644 index 9e815460..00000000 --- a/system/base/procps/files/procps-3.2.8-make.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -up procps-3.2.8/Makefile.make procps-3.2.8/Makefile ---- procps-3.2.8/Makefile.make 2010-09-08 18:16:34.000000000 +0200 -+++ procps-3.2.8/Makefile 2010-09-08 18:54:41.668727996 +0200 -@@ -174,7 +174,8 @@ INSTALL := $(BINFILES) $(MANFILES) - # want this rule first, use := on ALL, and ALL not filled in yet - all: do_all - ---include */module.mk -+-include proc/module.mk -+-include ps/module.mk - - do_all: $(ALL) - diff --git a/system/base/procps/files/procps-3.2.8-ps-cgroup-suppress-root-group.patch b/system/base/procps/files/procps-3.2.8-ps-cgroup-suppress-root-group.patch deleted file mode 100644 index 4b192c1f..00000000 --- a/system/base/procps/files/procps-3.2.8-ps-cgroup-suppress-root-group.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- procps-3.2.8/ps/output.c 2010-05-18 06:00:18.000000000 +0200 -+++ procps-3.2.8.lennart/ps/output.c 2010-05-18 05:59:46.000000000 +0200 -@@ -1109,7 +1109,7 @@ - static int pr_cgroup(char *restrict const outbuf, const proc_t *restrict const pp){ - char filename[48]; - FILE *fd; -- int counter = 0; -+ int counter = 0, last_begin = 0, slash = 0; - int c; - int is_cgroup = 0; - -@@ -1121,15 +1121,22 @@ - if (is_cgroup == 0) { - if (c == ':') { - is_cgroup = 1; -+ slash = 0; - if (counter>0) - outbuf[counter++]=';'; - } - }else -- if ((c == '\n') || (c == '\0')) -- is_cgroup = 0; -+ if ((c == '\n') || (c == '\0')){ -+ if (slash) /* if the last char was a / this process is in the root cgroup which we should suppress */ -+ counter = last_begin; - else -+ last_begin = counter; -+ is_cgroup = 0; -+ } else { -+ slash = c == '/'; - outbuf[counter++]=c; - } -+ } - outbuf[counter]='\0'; - close(fd); - if (counter>0) diff --git a/system/base/procps/files/procps-3.2.8-setlocale.patch b/system/base/procps/files/procps-3.2.8-setlocale.patch deleted file mode 100644 index c197fd38..00000000 --- a/system/base/procps/files/procps-3.2.8-setlocale.patch +++ /dev/null @@ -1,66 +0,0 @@ -diff -Nur procps-3.2.8-orig/proc/sysinfo.c procps-3.2.8/proc/sysinfo.c ---- procps-3.2.8-orig/proc/sysinfo.c 2008-03-24 05:33:43.000000000 +0100 -+++ procps-3.2.8/proc/sysinfo.c 2009-12-18 22:50:52.000000000 +0100 -@@ -74,17 +74,19 @@ - /***********************************************************************/ - int uptime(double *restrict uptime_secs, double *restrict idle_secs) { - double up=0, idle=0; -- char *restrict savelocale; -+ char *savelocale; - - FILE_TO_BUF(UPTIME_FILE,uptime_fd); -- savelocale = setlocale(LC_NUMERIC, NULL); -+ savelocale = strdup(setlocale(LC_NUMERIC, NULL)); - setlocale(LC_NUMERIC,"C"); - if (sscanf(buf, "%lf %lf", &up, &idle) < 2) { - setlocale(LC_NUMERIC,savelocale); -+ free(savelocale); - fputs("bad data in " UPTIME_FILE "\n", stderr); - return 0; - } - setlocale(LC_NUMERIC,savelocale); -+ free(savelocale); - SET_IF_DESIRED(uptime_secs, up); - SET_IF_DESIRED(idle_secs, idle); - return up; /* assume never be zero seconds in practice */ -@@ -128,9 +130,9 @@ - double up_1, up_2, seconds; - unsigned long long jiffies; - unsigned h; -- char *restrict savelocale; -+ char *savelocale; - -- savelocale = setlocale(LC_NUMERIC, NULL); -+ savelocale = strdup(setlocale(LC_NUMERIC, NULL)); - setlocale(LC_NUMERIC, "C"); - do{ - FILE_TO_BUF(UPTIME_FILE,uptime_fd); sscanf(buf, "%lf", &up_1); -@@ -141,6 +143,7 @@ - /* uptime(&up_2, NULL); */ - } while((long long)( (up_2-up_1)*1000.0/up_1 )); /* want under 0.1% error */ - setlocale(LC_NUMERIC, savelocale); -+ free(savelocale); - jiffies = user_j + nice_j + sys_j + other_j; - seconds = (up_1 + up_2) / 2; - h = (unsigned)( (double)jiffies/seconds/smp_num_cpus ); -@@ -303,16 +306,18 @@ - /***********************************************************************/ - void loadavg(double *restrict av1, double *restrict av5, double *restrict av15) { - double avg_1=0, avg_5=0, avg_15=0; -- char *restrict savelocale; -+ char *savelocale; - - FILE_TO_BUF(LOADAVG_FILE,loadavg_fd); -- savelocale = setlocale(LC_NUMERIC, NULL); -+ savelocale = strdup(setlocale(LC_NUMERIC, NULL)); - setlocale(LC_NUMERIC, "C"); - if (sscanf(buf, "%lf %lf %lf", &avg_1, &avg_5, &avg_15) < 3) { - fputs("bad data in " LOADAVG_FILE "\n", stderr); -+ free(savelocale); - exit(1); - } - setlocale(LC_NUMERIC, savelocale); -+ free(savelocale); - SET_IF_DESIRED(av1, avg_1); - SET_IF_DESIRED(av5, avg_5); - SET_IF_DESIRED(av15, avg_15); diff --git a/system/base/procps/files/procps-3.2.8-threads.patch b/system/base/procps/files/procps-3.2.8-threads.patch deleted file mode 100644 index 2491aa4c..00000000 --- a/system/base/procps/files/procps-3.2.8-threads.patch +++ /dev/null @@ -1,49 +0,0 @@ -diff -up procps-3.2.8/top.c.threads procps-3.2.8/top.c ---- procps-3.2.8/top.c.threads 2009-10-01 07:14:43.000000000 -0400 -+++ procps-3.2.8/top.c 2009-10-05 14:05:00.000000000 -0400 -@@ -1138,6 +1138,7 @@ static proc_t **procs_refresh (proc_t ** - #define ENTsz sizeof(proc_t) - static unsigned savmax = 0; // first time, Bypass: (i) - proc_t *ptsk = (proc_t *)-1; // first time, Force: (ii) -+ proc_t *saved_ptsk; - unsigned curmax = 0; // every time (jeeze) - PROCTAB* PT; - static int show_threads_was_enabled = 0; // optimization -@@ -1172,6 +1173,10 @@ static proc_t **procs_refresh (proc_t ** - while (curmax < savmax) { - proc_t *ttsk; - if (unlikely(!(ptsk = readproc(PT, NULL)))) break; -+ if(!show_threads_was_enabled) -+ saved_ptsk = ptsk; -+ else -+ saved_ptsk = NULL; - show_threads_was_enabled = 1; - while (curmax < savmax) { - unsigned idx; -@@ -1189,7 +1194,7 @@ static proc_t **procs_refresh (proc_t ** - prochlp(ttsk); - ++curmax; - } -- free(ptsk); // readproc() proc_t not used -+ if(!saved_ptsk) free(ptsk); // readproc() proc_t not used - } - } - -@@ -1208,7 +1213,8 @@ static proc_t **procs_refresh (proc_t ** - else { // show each thread in a process separately - while (ptsk) { - proc_t *ttsk; -- if (likely(ptsk = readproc(PT, NULL))) { -+ if (likely(ptsk = readproc(PT, NULL)) || -+ unlikely(saved_ptsk && (ptsk = saved_ptsk)) ) { - show_threads_was_enabled = 1; - while (1) { - table = alloc_r(table, (curmax + 1) * PTRsz); -@@ -1216,6 +1222,7 @@ static proc_t **procs_refresh (proc_t ** - prochlp(ttsk); - table[curmax++] = ttsk; - } -+ saved_ptsk = NULL; - free(ptsk); // readproc() proc_t not used - } - } diff --git a/system/base/procps/files/procps-3.2.8-vmstat-getopt.patch b/system/base/procps/files/procps-3.2.8-vmstat-getopt.patch deleted file mode 100644 index 48b9ada9..00000000 --- a/system/base/procps/files/procps-3.2.8-vmstat-getopt.patch +++ /dev/null @@ -1,126 +0,0 @@ -diff -up procps-3.2.8/vmstat.c.getopt procps-3.2.8/vmstat.c ---- procps-3.2.8/vmstat.c.getopt 2010-04-06 14:39:24.000000000 +0200 -+++ procps-3.2.8/vmstat.c 2010-04-06 14:47:52.000000000 +0200 -@@ -30,14 +30,15 @@ - #include "proc/sysinfo.h" - #include "proc/version.h" - --static unsigned long dataUnit=1024; --static char szDataUnit [16]; - #define UNIT_B 1 - #define UNIT_k 1000 - #define UNIT_K 1024 - #define UNIT_m 1000000 - #define UNIT_M 1048576 - -+static unsigned long dataUnit=UNIT_K; -+static char szDataUnit[3] = "K"; -+ - #define VMSTAT 0 - #define DISKSTAT 0x00000001 - #define VMSUMSTAT 0x00000002 -@@ -609,12 +610,10 @@ static int winhi(void) { - //////////////////////////////////////////////////////////////////////////// - - int main(int argc, char *argv[]) { -- char partition[16]; -- argc=0; /* redefined as number of integer arguments */ -- for (argv++;*argv;argv++) { -- if ('-' ==(**argv)) { -- switch (*(++(*argv))) { -- -+ char *partition = NULL; -+ int c; -+ -+ while((c = getopt(argc, argv, "VdafmDnp:S:s")) != EOF) switch(c) { - case 'V': - display_version(); - exit(0); -@@ -630,7 +629,7 @@ int main(int argc, char *argv[]) { - fork_format(); - exit(0); - case 'm': -- statMode |= SLABSTAT; -+ statMode |= SLABSTAT; - break; - case 'D': - statMode |= DISKSUMSTAT; -@@ -641,29 +640,21 @@ int main(int argc, char *argv[]) { - break; - case 'p': - statMode |= PARTITIONSTAT; -- if (argv[1]){ -- char *cp = *++argv; -- if(!memcmp(cp,"/dev/",5)) cp += 5; -- snprintf(partition, sizeof partition, "%s", cp); -- }else{ -- fprintf(stderr, "-p requires an argument\n"); -- exit(EXIT_FAILURE); -- } -+ partition = optarg; -+ if (memcmp(partition, "/dev/", 5) == 0) partition += 5; - break; - case 'S': -- if (argv[1]){ -- ++argv; -- if (!strcmp(*argv, "k")) dataUnit=UNIT_k; -- else if (!strcmp(*argv, "K")) dataUnit=UNIT_K; -- else if (!strcmp(*argv, "m")) dataUnit=UNIT_m; -- else if (!strcmp(*argv, "M")) dataUnit=UNIT_M; -- else {fprintf(stderr, "-S requires k, K, m or M (default is kb)\n"); -- exit(EXIT_FAILURE); -- } -- strcpy(szDataUnit, *argv); -- }else {fprintf(stderr, "-S requires an argument\n"); -- exit(EXIT_FAILURE); -- } -+ switch(optarg[0]) { -+ case 'b': case 'B': dataUnit = UNIT_B; break; -+ case 'k': dataUnit = UNIT_k; break; -+ case 'K': dataUnit = UNIT_K; break; -+ case 'm': dataUnit = UNIT_m; break; -+ case 'M': dataUnit = UNIT_M; break; -+ default: -+ fprintf(stderr, "-S requires k, K, m or M (default is kb)\n"); -+ exit(EXIT_FAILURE); -+ } -+ szDataUnit[0] = optarg[0]; - break; - case 's': - statMode |= VMSUMSTAT; -@@ -674,23 +665,18 @@ int main(int argc, char *argv[]) { - default: - /* no other aguments defined yet. */ - usage(); -- } -- }else{ -- argc++; -- switch (argc) { -- case 1: -- if ((sleep_time = atoi(*argv)) == 0) -- usage(); -- num_updates = ULONG_MAX; -- break; -- case 2: -- num_updates = atol(*argv); -- break; -- default: -- usage(); -- } /* switch */ -- } --} -+ } -+ -+ if (optind < argc) { -+if ((sleep_time = atoi(argv[optind++])) == 0) -+ usage(); -+ num_updates = ULONG_MAX; -+ } -+ if (optind < argc) -+ num_updates = atol(argv[optind++]); -+ if (optind < argc) -+ usage(); -+ - if (moreheaders) { - int tmp=winhi()-3; - height=((tmp>0)?tmp:22); diff --git a/system/base/procps/files/procps-enable-core.patch b/system/base/procps/files/procps-enable-core.patch deleted file mode 100644 index b7310c1c..00000000 --- a/system/base/procps/files/procps-enable-core.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- procps-3.2.7/ps/display.c.enable-core 2009-02-27 11:57:21.000000000 +0000 -+++ procps-3.2.7/ps/display.c 2009-02-27 11:57:48.000000000 +0000 -@@ -562,6 +562,8 @@ - default: - sigaction(i,&sa,NULL); - case 0: -+ case SIGABRT: -+ case SIGSEGV: - case SIGINT: /* ^C */ - case SIGTSTP: /* ^Z */ - case SIGTTOU: /* see stty(1) man page */ diff --git a/system/base/procps/files/procps-pmap-smaps.patch b/system/base/procps/files/procps-pmap-smaps.patch deleted file mode 100644 index 6e670b35..00000000 --- a/system/base/procps/files/procps-pmap-smaps.patch +++ /dev/null @@ -1,138 +0,0 @@ -diff -up procps-3.2.8/pmap.c.pmap procps-3.2.8/pmap.c ---- procps-3.2.8/pmap.c.pmap 2008-10-19 21:34:34.000000000 +0200 -+++ procps-3.2.8/pmap.c 2010-02-08 15:40:19.000000000 +0100 -@@ -126,24 +126,38 @@ static int one_proc(proc_t *p){ - char buf[32]; - char mapbuf[9600]; - char cmdbuf[512]; -+ FILE *fp; - unsigned long total_shared = 0ul; - unsigned long total_private_readonly = 0ul; - unsigned long total_private_writeable = 0ul; - -+ char *cp2=NULL; -+ unsigned long long rss = 0ull; -+ unsigned long long private_dirty = 0ull; -+ unsigned long long shared_dirty = 0ull; -+ unsigned long long total_rss = 0ull; -+ unsigned long long total_private_dirty = 0ull; -+ unsigned long long total_shared_dirty = 0ull; -+ unsigned KLONG diff = 0; -+ - // 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; -+ if ( (fp = fopen(buf, "r")) == NULL) return 1; -+ if (x_option) { -+ sprintf(buf,"/proc/%u/smaps",p->tgid); -+ if ( (fp = freopen(buf, "r", fp)) == NULL) 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(sizeof(KLONG)==4) printf("Address Kbytes RSS Dirty Mode Mapping\n"); -+ else printf("Address Kbytes RSS Dirty Mode Mapping\n"); - } - if(d_option){ - if(sizeof(KLONG)==4) printf("Address Kbytes Mode Offset Device Mapping\n"); -@@ -151,12 +165,54 @@ static int one_proc(proc_t *p){ - } - } - -- while(fgets(mapbuf,sizeof mapbuf,stdin)){ -+ while(fgets(mapbuf,sizeof mapbuf,fp)){ - char flags[32]; - char *tmp; // to clean up unprintables -- unsigned KLONG start, end, diff; -+ unsigned KLONG start, end; - unsigned long long file_offset, inode; - unsigned dev_major, dev_minor; -+ unsigned long long smap_value; -+ char smap_key[20]; -+ -+ /* hex values are lower case or numeric, keys are upper */ -+ if (mapbuf[0] >= 'A' && mapbuf[0] <= 'Z') { -+ /* Its a key */ -+ if (sscanf(mapbuf,"%20[^:]: %llu", smap_key, &smap_value) == 2) { -+ if (strncmp("Rss", smap_key, 3) == 0) { -+ rss = smap_value; -+ total_rss += smap_value; -+ continue; -+ } -+ if (strncmp("Shared_Dirty", smap_key, 12) == 0) { -+ shared_dirty = smap_value; -+ total_shared_dirty += smap_value; -+ continue; -+ } -+ if (strncmp("Private_Dirty", smap_key, 13) == 0) { -+ private_dirty = smap_value; -+ total_private_dirty += smap_value; -+ continue; -+ } -+ if (strncmp("Swap", smap_key, 4) == 0) { /*doesnt matter as long as last*/ -+ printf( -+ (sizeof(KLONG)==8) -+ ? "%016"KLF"x %7lu %7llu %7llu %s %s\n" -+ : "%08lx %7lu %7llu %7llu %s %s\n", -+ start, -+ (unsigned long)(diff>>10), -+ rss, -+ (private_dirty + shared_dirty), -+ flags, -+ cp2 -+ ); -+ /* reset some counters */ -+ rss = shared_dirty = private_dirty = 0ull; -+ continue; -+ } -+ /* Other keys */ -+ continue; -+ } -+ } - sscanf(mapbuf,"%"KLF"x-%"KLF"x %31s %Lx %x:%x %Lu", &start, &end, flags, &file_offset, &dev_major, &dev_minor, &inode); - - if(start > range_high) -@@ -186,16 +242,9 @@ static int one_proc(proc_t *p){ - 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 -- ); -+ cp2 = mapping_name(p, start, diff, mapbuf, 0, dev_major, dev_minor, inode); -+ /* printed with the keys */ -+ continue; - } - if(d_option){ - const char *cp = mapping_name(p, start, diff, mapbuf, 0, dev_major, dev_minor, inode); -@@ -232,10 +281,12 @@ static int one_proc(proc_t *p){ - if(!q_option){ - if(x_option){ - if(sizeof(KLONG)==8){ -- printf("---------------- ------ ------ ------ ------\n"); -+ printf("---------------- ------ ------ ------\n"); - printf( -- "total kB %15ld - - -\n", -- (total_shared + total_private_writeable + total_private_readonly) >> 10 -+ "total kB %15ld %7llu %7llu\n", -+ (total_shared + total_private_writeable + total_private_readonly) >> 10, -+ total_rss, (total_shared_dirty+total_private_dirty) -+ - ); - }else{ - printf("-------- ------- ------- ------- -------\n"); diff --git a/system/base/procps/files/pwdx-bufferoverflow.diff b/system/base/procps/files/pwdx-bufferoverflow.diff deleted file mode 100644 index ab7a391a..00000000 --- a/system/base/procps/files/pwdx-bufferoverflow.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- 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])) diff --git a/system/base/procps/pspec.xml b/system/base/procps/pspec.xml index a5d381f0..094c8cfe 100644 --- a/system/base/procps/pspec.xml +++ b/system/base/procps/pspec.xml @@ -12,12 +12,16 @@ app:console Standard informational utilities and process-handling tools procps is the package that has a bunch of small useful utilities that give information about processes using the /proc filesystem. The package includes the programs ps, top, vmstat, w, kill, free, slabtop, and skill. - http://downloads.sourceforge.net/project/procps-ng/Production/procps-ng-3.3.16.tar.xz + http://downloads.sourceforge.net/project/procps-ng/Production/procps-ng-3.3.17.tar.xz ncurses-devel - fs66093.patch + fedora/covscan-findings.patch + fedora/free-si-fix.patch + fedora/pwait-to-pidwait.patch + fedora/sysctl-hyphen-param.patch + fedora/sysctl-print-dotted-keys-again.patch @@ -41,6 +45,13 @@ + + 2022-12-07 + 3.3.17 + Version bump. + Mustafa Cinasal + muscnsl@gmail.com + 2020-12-09 3.3.16