Update to 3.3.13
OBS-URL: https://build.opensuse.org/package/show/Base:System/procps?expand=0&rev=185
This commit is contained in:
parent
996ca7e8fc
commit
d182cba24f
@ -1,97 +0,0 @@
|
||||
From 702a464040bef969db7483d3cc122dfeec653d6f Mon Sep 17 00:00:00 2001
|
||||
From: Werner Fink <werner@suse.de>
|
||||
Date: Thu, 18 Jan 2018 11:06:55 +0100
|
||||
Subject: [PATCH 1/3] Preload sysctl lines even if longer than stdio buffer
|
||||
|
||||
by using getline(3) to use a dynamically increased buffer
|
||||
if required by the input found in sysctl configuration files.
|
||||
|
||||
Signed-off-by: Werner Fink <werner@suse.de>
|
||||
---
|
||||
sysctl.c | 31 ++++++++++++++++++++++++-------
|
||||
1 file changed, 24 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git sysctl.c sysctl.c
|
||||
index 7c05243..42162f5 100644
|
||||
--- sysctl.c
|
||||
+++ sysctl.c
|
||||
@@ -511,18 +511,21 @@ static int pattern_match(const char *string, const char *pat)
|
||||
*/
|
||||
static int Preload(const char *restrict const filename)
|
||||
{
|
||||
- char oneline[LINELEN];
|
||||
- char buffer[LINELEN];
|
||||
+ char *oneline;
|
||||
FILE *fp;
|
||||
char *t;
|
||||
int n = 0;
|
||||
int rc = 0;
|
||||
+ size_t blen = LINELEN;
|
||||
+ ssize_t rlen;
|
||||
char *name, *value;
|
||||
glob_t globbuf;
|
||||
int globerr;
|
||||
int globflg;
|
||||
int j;
|
||||
|
||||
+ oneline = xmalloc(blen);
|
||||
+
|
||||
globflg = GLOB_NOCHECK;
|
||||
#ifdef GLOB_BRACE
|
||||
globflg |= GLOB_BRACE;
|
||||
@@ -544,13 +547,19 @@ static int Preload(const char *restrict const filename)
|
||||
? stdin : fopen(globbuf.gl_pathv[j], "r");
|
||||
if (!fp) {
|
||||
xwarn(_("cannot open \"%s\""), globbuf.gl_pathv[j]);
|
||||
- return -1;
|
||||
+ rc = -1;
|
||||
+ goto out;
|
||||
}
|
||||
|
||||
- while (fgets(oneline, sizeof oneline, fp)) {
|
||||
+ while ((rlen = getline(&oneline, &blen, fp)) != -1) {
|
||||
+ size_t offset;
|
||||
+
|
||||
n++;
|
||||
- t = StripLeadingAndTrailingSpaces(oneline);
|
||||
|
||||
+ if (rlen < 2)
|
||||
+ continue;
|
||||
+
|
||||
+ t = StripLeadingAndTrailingSpaces(oneline);
|
||||
if (strlen(t) < 2)
|
||||
continue;
|
||||
|
||||
@@ -569,6 +578,10 @@ static int Preload(const char *restrict const filename)
|
||||
if (pattern && !pattern_match(name, pattern))
|
||||
continue;
|
||||
|
||||
+ offset = strlen(name);
|
||||
+ memmove(&oneline[0], name, offset);
|
||||
+ oneline[offset++] = '=';
|
||||
+
|
||||
value = strtok(NULL, "\n\r");
|
||||
if (!value || !*value) {
|
||||
xwarnx(_("%s(%d): invalid syntax, continuing..."),
|
||||
@@ -580,12 +593,16 @@ static int Preload(const char *restrict const filename)
|
||||
value++;
|
||||
|
||||
/* should NameOnly affect this? */
|
||||
- sprintf(buffer, "%s=%s", name, value);
|
||||
- rc |= WriteSetting(buffer);
|
||||
+ memmove(&oneline[offset], value, strlen(value));
|
||||
+ offset += strlen(value);
|
||||
+ oneline[offset] = '\0';
|
||||
+
|
||||
+ rc |= WriteSetting(oneline);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
+out:
|
||||
return rc;
|
||||
}
|
||||
|
||||
--
|
||||
2.16.1
|
||||
|
@ -1,451 +0,0 @@
|
||||
From c69b0f34444cfc15489b0d6b076a10f4d4478cb7 Mon Sep 17 00:00:00 2001
|
||||
From: Werner Fink <werner@suse.de>
|
||||
Date: Thu, 18 Jan 2018 11:26:37 +0100
|
||||
Subject: [PATCH 2/3] Add flexible buffered I/O based on fopencookie(3)
|
||||
|
||||
to be able to read and write large buffers below /proc.
|
||||
The buffers and file offsets are handled dynamically
|
||||
on the required buffer size at read, that is lseek(2)
|
||||
is used to determine this size. Large buffers at
|
||||
write are split at a delimeter into pieces and also
|
||||
lseek(2) is used to write each of them.
|
||||
|
||||
Signed-off-by: Werner Fink <werner@suse.de>
|
||||
---
|
||||
Makefile.am | 4
|
||||
proc/libprocps.sym | 1
|
||||
proc/procio.3 | 80 ++++++++++++++
|
||||
proc/procio.c | 293 +++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
proc/procio.h | 11 +
|
||||
5 files changed, 389 insertions(+)
|
||||
|
||||
--- Makefile.am
|
||||
+++ Makefile.am 2018-01-30 09:22:55.979438743 +0000
|
||||
@@ -167,6 +167,8 @@ proc_libprocps_la_SOURCES = \
|
||||
proc/devname.h \
|
||||
proc/escape.c \
|
||||
proc/escape.h \
|
||||
+ proc/procio.c \
|
||||
+ proc/procio.h \
|
||||
proc/procps-private.h \
|
||||
proc/procps.h \
|
||||
proc/pwcache.c \
|
||||
@@ -191,6 +193,7 @@ proc_libprocps_la_include_HEADERS = \
|
||||
proc/alloc.h \
|
||||
proc/devname.h \
|
||||
proc/escape.h \
|
||||
+ proc/procio.h \
|
||||
proc/procps.h \
|
||||
proc/pwcache.h \
|
||||
proc/readproc.h \
|
||||
@@ -202,6 +205,7 @@ proc_libprocps_la_include_HEADERS = \
|
||||
proc/whattime.h
|
||||
|
||||
dist_man_MANS += \
|
||||
+ proc/procio.3 \
|
||||
proc/openproc.3 \
|
||||
proc/readproc.3 \
|
||||
proc/readproctab.3
|
||||
--- proc/libprocps.sym
|
||||
+++ proc/libprocps.sym 2018-01-30 09:21:46.596751319 +0000
|
||||
@@ -8,6 +8,7 @@ global:
|
||||
escape_str;
|
||||
escape_strlist;
|
||||
escaped_copy;
|
||||
+ fprocopen;
|
||||
free_slabinfo;
|
||||
freeproc;
|
||||
get_ns_id;
|
||||
--- proc/procio.3
|
||||
+++ proc/procio.3 2018-01-30 09:21:46.596751319 +0000
|
||||
@@ -0,0 +1,80 @@
|
||||
+'\" t -*- coding: UTF-8 -*-
|
||||
+.\"
|
||||
+.\" This file describes the readproc interface to the /proc filesystem
|
||||
+.\"
|
||||
+.\" Copyright 2018 Werner Fink <werner@suse.de>
|
||||
+.\"
|
||||
+.\" Permission is granted to make and distribute verbatim copies of this
|
||||
+.\" manual provided the copyright notice and this permission notice are
|
||||
+.\" preserved on all copies.
|
||||
+.\"
|
||||
+.\" Permission is granted to copy and distribute modified versions of this
|
||||
+.\" manual under the conditions for verbatim copying, provided that the
|
||||
+.\" entire resulting derived work is distributed under the terms of a
|
||||
+.\" permission notice identical to this one
|
||||
+.\"
|
||||
+.\" Formatted or processed versions of this manual, if unaccompanied by
|
||||
+.\" the source, must acknowledge the copyright and authors of this work.
|
||||
+.\"
|
||||
+.TH PROCIO 3 "16 January 2018" "Linux Manpage" "Linux Programmer's Manual"
|
||||
+.SH NAME
|
||||
+fprocopen \- stream open functions on files below /proc/##
|
||||
+.SH SYNOPSIS
|
||||
+.B #define _GNU_SOURCE
|
||||
+.br
|
||||
+.B #include <stdio.h>
|
||||
+.br
|
||||
+.B #include <proc/procio.h>
|
||||
+.sp
|
||||
+.BI "FILE *fprocopen(const char *path, const char *mode);
|
||||
+
|
||||
+.SH DESCRIPTION
|
||||
+
|
||||
+The
|
||||
+.B fprocopen
|
||||
+function opens files below
|
||||
+.I /proc/##
|
||||
+whose name is the string to by path and associates a stream with it.
|
||||
+The argument
|
||||
+.I mode
|
||||
+points to a string beginning with one of the following sequences
|
||||
+.TP
|
||||
+.B r
|
||||
+Open a file below
|
||||
+.I /proc/##
|
||||
+for reading even large buffers. The stream is positioned at
|
||||
+the beginning of the file.
|
||||
+.TP
|
||||
+.BR w [ <del> ]
|
||||
+Open a file below
|
||||
+.I /proc/##
|
||||
+for writing even large buffers. The optional delimeter character
|
||||
+can be one of the follwoing
|
||||
+.BR '\ ' ,\ ',' ,\ '.' ,\ and\ ':'
|
||||
+where the default is the colon
|
||||
+.BR ',' .
|
||||
+This allows to split very large input lines into pieces at this
|
||||
+delimeter and write each of them to the opened file below
|
||||
+.IR /proc/## .
|
||||
+.TP
|
||||
+.B e
|
||||
+The underlying file descriptor will be closed if you use any
|
||||
+of the ‘exec...’ functions within your code.
|
||||
+.PP
|
||||
+The internal API allows to use stdio functions to read and write
|
||||
+large buffers below
|
||||
+.IR /proc/## .
|
||||
+.PP
|
||||
+.SH SEE ALSO
|
||||
+.BR fopen (3),
|
||||
+.br
|
||||
+.BR fopencookie (3)
|
||||
+.br
|
||||
+.BR setvbuf (3)
|
||||
+.br
|
||||
+.BR lseek (3)
|
||||
+.PP
|
||||
+.SH COPYRIGHT
|
||||
+2018 Werner Fink,
|
||||
+.SH AUTHOR
|
||||
+Werner Fink <werner@suse.de>
|
||||
--- proc/procio.c
|
||||
+++ proc/procio.c 2018-01-30 09:21:46.596751319 +0000
|
||||
@@ -0,0 +1,293 @@
|
||||
+/*
|
||||
+ * procio.c -- Replace stdio for read and write on files below
|
||||
+ * proc to be able to read and write large buffers as well.
|
||||
+ *
|
||||
+ * Copyright (C) 2017 Werner Fink
|
||||
+ *
|
||||
+ * This library is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This library is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with this library; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+ */
|
||||
+
|
||||
+#ifndef _GNU_SOURCE
|
||||
+# define _GNU_SOURCE
|
||||
+#endif
|
||||
+#include <errno.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <libio.h>
|
||||
+#include <limits.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <sys/stat.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+typedef struct pcookie {
|
||||
+ char *buf;
|
||||
+ size_t count;
|
||||
+ size_t length;
|
||||
+ off_t offset;
|
||||
+ int fd;
|
||||
+ int delim;
|
||||
+ int final:1;
|
||||
+} pcookie_t;
|
||||
+
|
||||
+static ssize_t proc_read(void *, char *, size_t);
|
||||
+static ssize_t proc_write(void *, const char *, size_t);
|
||||
+static int proc_close(void *);
|
||||
+
|
||||
+__extension__
|
||||
+static cookie_io_functions_t procio = {
|
||||
+ .read = proc_read,
|
||||
+ .write = proc_write,
|
||||
+ .seek = NULL,
|
||||
+ .close = proc_close,
|
||||
+};
|
||||
+
|
||||
+FILE *fprocopen(const char *path, const char *mode)
|
||||
+{
|
||||
+ pcookie_t *cookie = NULL;
|
||||
+ FILE *handle = NULL;
|
||||
+ mode_t flags = 0;
|
||||
+ size_t len = 0;
|
||||
+ int c, delim;
|
||||
+
|
||||
+ if (!mode || !(len = strlen(mode))) {
|
||||
+ errno = EINVAL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ /* No append mode possible */
|
||||
+ switch (mode[0]) {
|
||||
+ case 'r':
|
||||
+ flags |= O_RDONLY;
|
||||
+ break;
|
||||
+ case 'w':
|
||||
+ flags |= O_WRONLY|O_TRUNC;
|
||||
+ break;
|
||||
+ default:
|
||||
+ errno = EINVAL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ delim = ','; /* default delimeter is the colon */
|
||||
+ for (c = 1; c < len; c++) {
|
||||
+ switch (mode[c]) {
|
||||
+ case '\0':
|
||||
+ break;
|
||||
+ case '+':
|
||||
+ errno = EINVAL;
|
||||
+ goto out;
|
||||
+ case 'e':
|
||||
+ flags |= O_CLOEXEC;
|
||||
+ continue;
|
||||
+ case 'b':
|
||||
+ case 'm':
|
||||
+ case 'x':
|
||||
+ /* ignore this */
|
||||
+ continue;
|
||||
+ default:
|
||||
+ if (mode[c] == ' ' || (mode[c] >= ',' && mode[c] <= '.') || mode[c] == ':')
|
||||
+ delim = mode[c];
|
||||
+ else {
|
||||
+ errno = EINVAL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ cookie = (pcookie_t *)malloc(sizeof(pcookie_t));
|
||||
+ if (!cookie)
|
||||
+ goto out;
|
||||
+ cookie->count = BUFSIZ;
|
||||
+ cookie->buf = (char *)malloc(cookie->count);
|
||||
+ if (!cookie->buf) {
|
||||
+ int errsv = errno;
|
||||
+ free(cookie);
|
||||
+ errno = errsv;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ cookie->final = 0;
|
||||
+ cookie->offset = 0;
|
||||
+ cookie->length = 0;
|
||||
+ cookie->delim = delim;
|
||||
+
|
||||
+ cookie->fd = openat(AT_FDCWD, path, flags);
|
||||
+ if (cookie->fd < 0) {
|
||||
+ int errsv = errno;
|
||||
+ free(cookie->buf);
|
||||
+ free(cookie);
|
||||
+ errno = errsv;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ handle = fopencookie(cookie, mode, procio);
|
||||
+ if (!handle) {
|
||||
+ int errsv = errno;
|
||||
+ close(cookie->fd);
|
||||
+ free(cookie->buf);
|
||||
+ free(cookie);
|
||||
+ errno = errsv;
|
||||
+ goto out;
|
||||
+ }
|
||||
+out:
|
||||
+ return handle;
|
||||
+}
|
||||
+
|
||||
+static
|
||||
+ssize_t proc_read(void *c, char *buf, size_t count)
|
||||
+{
|
||||
+ pcookie_t *cookie = c;
|
||||
+ ssize_t len = -1;
|
||||
+ void *ptr;
|
||||
+
|
||||
+ if (cookie->count < count) {
|
||||
+ ptr = realloc(cookie->buf, count);
|
||||
+ if (!ptr)
|
||||
+ goto out;
|
||||
+ cookie->buf = ptr;
|
||||
+ cookie->count = count;
|
||||
+ }
|
||||
+
|
||||
+ while (!cookie->final) {
|
||||
+ len = read(cookie->fd, cookie->buf, cookie->count);
|
||||
+
|
||||
+ if (len <= 0) {
|
||||
+ if (len == 0) {
|
||||
+ /* EOF */
|
||||
+ cookie->final = 1;
|
||||
+ cookie->buf[cookie->length] = '\0';
|
||||
+ break;
|
||||
+ }
|
||||
+ goto out; /* error or done */
|
||||
+ }
|
||||
+
|
||||
+ cookie->length = len;
|
||||
+
|
||||
+ if (cookie->length < cookie->count)
|
||||
+ continue;
|
||||
+
|
||||
+ /* Likly to small buffer here */
|
||||
+
|
||||
+ lseek(cookie->fd, 0, SEEK_SET); /* reset for a retry */
|
||||
+
|
||||
+ ptr = realloc(cookie->buf, cookie->count += BUFSIZ);
|
||||
+ if (!ptr)
|
||||
+ goto out;
|
||||
+ cookie->buf = ptr;
|
||||
+ }
|
||||
+
|
||||
+ len = count;
|
||||
+ if (cookie->length - cookie->offset < len)
|
||||
+ len = cookie->length - cookie->offset;
|
||||
+
|
||||
+ if (len < 0)
|
||||
+ len = 0;
|
||||
+
|
||||
+ if (len) {
|
||||
+ (void)memcpy(buf, cookie->buf+cookie->offset, len);
|
||||
+ cookie->offset += len;
|
||||
+ } else
|
||||
+ len = EOF;
|
||||
+out:
|
||||
+ return len;
|
||||
+}
|
||||
+
|
||||
+#define LINELEN 4096
|
||||
+
|
||||
+static
|
||||
+ssize_t proc_write(void *c, const char *buf, size_t count)
|
||||
+{
|
||||
+ pcookie_t *cookie = c;
|
||||
+ ssize_t len = -1;
|
||||
+ void *ptr;
|
||||
+
|
||||
+ if (!count) {
|
||||
+ len = 0;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ /* NL is the final input */
|
||||
+ cookie->final = memrchr(buf, '\n', count) ? 1 : 0;
|
||||
+
|
||||
+ while (cookie->count < cookie->offset + count) {
|
||||
+ ptr = realloc(cookie->buf, cookie->count += count);
|
||||
+ if (!ptr)
|
||||
+ goto out;
|
||||
+ cookie->buf = ptr;
|
||||
+ }
|
||||
+
|
||||
+ len = count;
|
||||
+ (void)memcpy(cookie->buf+cookie->offset, buf, count);
|
||||
+ cookie->offset += count;
|
||||
+
|
||||
+ if (cookie->final) {
|
||||
+ len = write(cookie->fd, cookie->buf, cookie->offset);
|
||||
+ if (len < 0 && errno == EINVAL) {
|
||||
+ size_t offset;
|
||||
+ off_t amount;
|
||||
+ char *token;
|
||||
+ /*
|
||||
+ * Oops buffer might be to large, split buffer into
|
||||
+ * pieces at delimeter if provided
|
||||
+ */
|
||||
+ if (!cookie->delim)
|
||||
+ goto out; /* Hey dude?! */
|
||||
+ offset = 0;
|
||||
+ do {
|
||||
+ token = NULL;
|
||||
+ if (cookie->offset > LINELEN)
|
||||
+ token = (char*)memrchr(cookie->buf+offset, ',', LINELEN);
|
||||
+ else
|
||||
+ token = (char*)memrchr(cookie->buf+offset, '\n', LINELEN);
|
||||
+ if (token)
|
||||
+ *token = '\n';
|
||||
+ else {
|
||||
+ errno = EINVAL;
|
||||
+ len = -1;
|
||||
+ goto out; /* Wrong/Missing delimeter? */
|
||||
+ }
|
||||
+ if (offset > 0)
|
||||
+ lseek(cookie->fd, 1, SEEK_CUR);
|
||||
+
|
||||
+ amount = token-(cookie->buf+offset)+1;
|
||||
+ ptr = cookie->buf+offset;
|
||||
+
|
||||
+ len = write(cookie->fd, ptr, amount);
|
||||
+ if (len < 1 || len >= cookie->offset)
|
||||
+ break;
|
||||
+
|
||||
+ offset += len;
|
||||
+ cookie->offset -= len;
|
||||
+
|
||||
+ } while (cookie->offset > 0);
|
||||
+ }
|
||||
+ if (len > 0)
|
||||
+ len = count;
|
||||
+ }
|
||||
+out:
|
||||
+ return len;
|
||||
+}
|
||||
+
|
||||
+static
|
||||
+int proc_close(void *c)
|
||||
+{
|
||||
+ pcookie_t *cookie = c;
|
||||
+ close(cookie->fd);
|
||||
+ free(cookie->buf);
|
||||
+ free(cookie);
|
||||
+ return 0;
|
||||
+}
|
||||
--- proc/procio.h
|
||||
+++ proc/procio.h 2018-01-30 09:21:46.596751319 +0000
|
||||
@@ -0,0 +1,11 @@
|
||||
+#ifndef PROCPS_PROC_PROCIO_H
|
||||
+#define PROCPS_PROC_PROCIO_H
|
||||
+
|
||||
+#include "procps.h"
|
||||
+
|
||||
+EXTERN_C_BEGIN
|
||||
+
|
||||
+extern FILE *fprocopen(const char *, const char *);
|
||||
+
|
||||
+EXTERN_C_END
|
||||
+#endif
|
@ -1,203 +0,0 @@
|
||||
From 97079405b6c7c7c39234d69c548d2f2fea4aa77e Mon Sep 17 00:00:00 2001
|
||||
From: Werner Fink <werner@suse.de>
|
||||
Date: Thu, 18 Jan 2018 11:38:02 +0100
|
||||
Subject: [PATCH 3/3] Use new standard I/O for reading/writing sysctl values
|
||||
|
||||
thereby use one allocated buffer for I/O which now might
|
||||
be increased by the stdio function getline(3) on the
|
||||
file if required.
|
||||
|
||||
Signed-off-by: Werner Fink <werner@suse.de>
|
||||
---
|
||||
sysctl.c | 53 +++++++++++++++++++++++------------------------------
|
||||
1 file changed, 23 insertions(+), 30 deletions(-)
|
||||
|
||||
--- sysctl.c
|
||||
+++ sysctl.c 2018-01-30 09:34:51.429936410 +0000
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "fileutils.h"
|
||||
#include "nls.h"
|
||||
#include "xalloc.h"
|
||||
+#include "proc/procio.h"
|
||||
#include "proc/procps.h"
|
||||
#include "proc/version.h"
|
||||
|
||||
@@ -68,6 +69,10 @@ static bool IgnoreError;
|
||||
static bool Quiet;
|
||||
static char *pattern;
|
||||
|
||||
+#define LINELEN 4096
|
||||
+static char *iobuf;
|
||||
+static size_t iolen = LINELEN;
|
||||
+
|
||||
/* Function prototypes. */
|
||||
static int pattern_match(const char *string, const char *pat);
|
||||
static int DisplayAll(const char *restrict const path);
|
||||
@@ -160,14 +165,12 @@ static char *StripLeadingAndTrailingSpac
|
||||
/*
|
||||
* Read a sysctl setting
|
||||
*/
|
||||
-#define IOBUFSIZ (128<<10)
|
||||
-static char *iobuf;
|
||||
static int ReadSetting(const char *restrict const name)
|
||||
{
|
||||
int rc = 0;
|
||||
char *restrict tmpname;
|
||||
char *restrict outname;
|
||||
- char inbuf[1025];
|
||||
+ ssize_t rlen;
|
||||
FILE *restrict fp;
|
||||
struct stat ts;
|
||||
|
||||
@@ -222,7 +225,7 @@ static int ReadSetting(const char *restr
|
||||
goto out;
|
||||
}
|
||||
|
||||
- fp = fopen(tmpname, "r");
|
||||
+ fp = fprocopen(tmpname, "r");
|
||||
|
||||
if (!fp) {
|
||||
switch (errno) {
|
||||
@@ -245,10 +248,8 @@ static int ReadSetting(const char *restr
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
- if (iobuf)
|
||||
- setvbuf(fp, iobuf, _IOFBF, IOBUFSIZ);
|
||||
errno = 0;
|
||||
- if (fgets(inbuf, sizeof inbuf - 1, fp)) {
|
||||
+ if ((rlen = getline(&iobuf, &iolen, fp)) > 0) {
|
||||
/* this loop is required, see
|
||||
* /sbin/sysctl -a | egrep -6 dev.cdrom.info
|
||||
*/
|
||||
@@ -257,23 +258,23 @@ static int ReadSetting(const char *restr
|
||||
if (PrintName) {
|
||||
fprintf(stdout, "%s = ", outname);
|
||||
do {
|
||||
- fprintf(stdout, "%s", inbuf);
|
||||
- nlptr = &inbuf[strlen(inbuf) - 1];
|
||||
+ fprintf(stdout, "%s", iobuf);
|
||||
+ nlptr = &iobuf[strlen(iobuf) - 1];
|
||||
/* already has the \n in it */
|
||||
if (*nlptr == '\n')
|
||||
break;
|
||||
- } while (fgets(inbuf, sizeof inbuf - 1, fp));
|
||||
+ } while ((rlen = getline(&iobuf, &iolen, fp)) > 0);
|
||||
if (*nlptr != '\n')
|
||||
putchar('\n');
|
||||
} else {
|
||||
if (!PrintNewline) {
|
||||
- nlptr = strchr(inbuf, '\n');
|
||||
+ nlptr = strchr(iobuf, '\n');
|
||||
if (nlptr)
|
||||
*nlptr = '\0';
|
||||
}
|
||||
- fprintf(stdout, "%s", inbuf);
|
||||
+ fprintf(stdout, "%s", iobuf);
|
||||
}
|
||||
- } while (fgets(inbuf, sizeof inbuf - 1, fp));
|
||||
+ } while ((rlen = getline(&iobuf, &iolen, fp)) > 0);
|
||||
} else {
|
||||
switch (errno) {
|
||||
case EACCES:
|
||||
@@ -440,7 +441,7 @@ static int WriteSetting(const char *sett
|
||||
goto out;
|
||||
}
|
||||
|
||||
- fp = fopen(tmpname, "w");
|
||||
+ fp = fprocopen(tmpname, "w");
|
||||
|
||||
if (!fp) {
|
||||
switch (errno) {
|
||||
@@ -460,8 +461,6 @@ static int WriteSetting(const char *sett
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
- if (iobuf)
|
||||
- setvbuf(fp, iobuf, _IOFBF, IOBUFSIZ);
|
||||
rc = fprintf(fp, "%s\n", value);
|
||||
if (0 < rc)
|
||||
rc = 0;
|
||||
@@ -503,20 +502,16 @@ static int pattern_match(const char *str
|
||||
return (1);
|
||||
}
|
||||
|
||||
-#define LINELEN 4096
|
||||
-
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
- char *oneline;
|
||||
FILE *fp;
|
||||
char *t;
|
||||
int n = 0;
|
||||
int rc = 0;
|
||||
- size_t blen = LINELEN;
|
||||
ssize_t rlen;
|
||||
char *name, *value;
|
||||
glob_t globbuf;
|
||||
@@ -524,8 +519,6 @@ static int Preload(const char *restrict
|
||||
int globflg;
|
||||
int j;
|
||||
|
||||
- oneline = xmalloc(blen);
|
||||
-
|
||||
globflg = GLOB_NOCHECK;
|
||||
#ifdef GLOB_BRACE
|
||||
globflg |= GLOB_BRACE;
|
||||
@@ -551,7 +544,7 @@ static int Preload(const char *restrict
|
||||
goto out;
|
||||
}
|
||||
|
||||
- while ((rlen = getline(&oneline, &blen, fp)) != -1) {
|
||||
+ while ((rlen = getline(&iobuf, &iolen, fp)) > 0) {
|
||||
size_t offset;
|
||||
|
||||
n++;
|
||||
@@ -559,7 +552,7 @@ static int Preload(const char *restrict
|
||||
if (rlen < 2)
|
||||
continue;
|
||||
|
||||
- t = StripLeadingAndTrailingSpaces(oneline);
|
||||
+ t = StripLeadingAndTrailingSpaces(iobuf);
|
||||
if (strlen(t) < 2)
|
||||
continue;
|
||||
|
||||
@@ -579,8 +572,8 @@ static int Preload(const char *restrict
|
||||
continue;
|
||||
|
||||
offset = strlen(name);
|
||||
- memmove(&oneline[0], name, offset);
|
||||
- oneline[offset++] = '=';
|
||||
+ memmove(&iobuf[0], name, offset);
|
||||
+ iobuf[offset++] = '=';
|
||||
|
||||
value = strtok(NULL, "\n\r");
|
||||
if (!value || !*value) {
|
||||
@@ -593,11 +586,11 @@ static int Preload(const char *restrict
|
||||
value++;
|
||||
|
||||
/* should NameOnly affect this? */
|
||||
- memmove(&oneline[offset], value, strlen(value));
|
||||
+ memmove(&iobuf[offset], value, strlen(value));
|
||||
offset += strlen(value);
|
||||
- oneline[offset] = '\0';
|
||||
+ iobuf[offset] = '\0';
|
||||
|
||||
- rc |= WriteSetting(oneline);
|
||||
+ rc |= WriteSetting(iobuf);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
@@ -835,7 +828,7 @@ int main(int argc, char *argv[])
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
- iobuf = (char*)malloc(IOBUFSIZ); /* Allow to fail */
|
||||
+ iobuf = xmalloc(iolen);
|
||||
|
||||
if (DisplayAllOpt)
|
||||
return DisplayAll(PROC_PATH);
|
@ -5,8 +5,8 @@
|
||||
3 files changed, 14 insertions(+), 2 deletions(-)
|
||||
|
||||
--- proc/libprocps.sym
|
||||
+++ proc/libprocps.sym 2016-07-11 13:11:10.857365085 +0000
|
||||
@@ -54,6 +54,7 @@ global:
|
||||
+++ proc/libprocps.sym 2018-04-04 11:30:51.841725161 +0000
|
||||
@@ -60,6 +60,7 @@ global:
|
||||
signal_name_to_number;
|
||||
signal_number_to_name;
|
||||
smp_num_cpus;
|
||||
@ -15,10 +15,10 @@
|
||||
strtosig;
|
||||
tty_to_dev;
|
||||
--- proc/sysinfo.c
|
||||
+++ proc/sysinfo.c 2016-07-11 13:11:10.857365085 +0000
|
||||
@@ -37,7 +37,8 @@
|
||||
#include <netinet/in.h> /* htons */
|
||||
+++ proc/sysinfo.c 2018-04-04 11:33:26.306886237 +0000
|
||||
@@ -45,7 +45,8 @@
|
||||
#endif
|
||||
#include <elf.h>
|
||||
|
||||
-long smp_num_cpus; /* number of CPUs */
|
||||
+#undef smp_num_cpus
|
||||
@ -26,7 +26,7 @@
|
||||
long page_bytes; /* this architecture's page size */
|
||||
|
||||
#define BAD_OPEN_MESSAGE \
|
||||
@@ -1076,7 +1077,11 @@ out:
|
||||
@@ -1152,7 +1153,11 @@ out:
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
// ought to count CPUs in /proc/stat instead of relying
|
||||
// on glibc, which foolishly tries to parse /proc/cpuinfo
|
||||
// note: that may have been the case but now /proc/stat
|
||||
@@ -1091,4 +1096,8 @@ void cpuinfo (void) {
|
||||
@@ -1167,4 +1172,8 @@ void cpuinfo (void) {
|
||||
smp_num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
|
||||
if (smp_num_cpus<1) /* SPARC glibc is buggy */
|
||||
smp_num_cpus=1;
|
||||
@ -49,7 +49,7 @@
|
||||
+
|
||||
+void cpuinfo (void) { (void)__smp_num_cpus(); }
|
||||
--- proc/sysinfo.h
|
||||
+++ proc/sysinfo.h 2016-07-11 13:11:10.857365085 +0000
|
||||
+++ proc/sysinfo.h 2018-04-04 11:30:51.841725161 +0000
|
||||
@@ -8,6 +8,8 @@ EXTERN_C_BEGIN
|
||||
|
||||
extern unsigned long long Hertz; /* clock tick frequency */
|
||||
|
@ -10,16 +10,16 @@ and this causes a problem later on (bsc#908516)
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
--- free.c
|
||||
+++ free.c 2016-07-11 13:22:25.480344200 +0000
|
||||
@@ -205,6 +205,7 @@ int main(int argc, char **argv)
|
||||
+++ free.c 2018-04-04 12:47:06.360757839 +0000
|
||||
@@ -197,6 +197,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
int c, flags = 0, unit_set = 0;
|
||||
char *endptr;
|
||||
struct commandline_arguments args;
|
||||
+ int errsv;
|
||||
|
||||
/*
|
||||
* For long options that have no equivalent short option, use a
|
||||
@@ -255,10 +256,12 @@ int main(int argc, char **argv)
|
||||
@@ -247,10 +248,12 @@ int main(int argc, char **argv)
|
||||
#ifdef HAVE_PROGRAM_INVOCATION_NAME
|
||||
program_invocation_name = program_invocation_short_name;
|
||||
#endif
|
||||
@ -32,7 +32,7 @@ and this causes a problem later on (bsc#908516)
|
||||
|
||||
while ((c = getopt_long(argc, argv, "bkmghltCc:ws:V", longopts, NULL)) != -1)
|
||||
switch (c) {
|
||||
@@ -325,11 +328,13 @@ int main(int argc, char **argv)
|
||||
@@ -317,11 +320,13 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
case 's':
|
||||
flags |= FREE_REPEAT;
|
||||
|
@ -1,5 +1,9 @@
|
||||
---
|
||||
vmstat.c | 7 +++----
|
||||
1 file changed, 3 insertions(+), 4 deletions(-)
|
||||
|
||||
--- vmstat.c
|
||||
+++ vmstat.c 2015-01-27 14:59:34.049571755 +0000
|
||||
+++ vmstat.c 2018-04-04 11:16:07.577968520 +0000
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
@ -8,7 +12,7 @@
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
@@ -690,13 +691,12 @@ static void slabheader(void)
|
||||
@@ -686,13 +687,12 @@ static void slabheader(void)
|
||||
|
||||
static void slabformat(void)
|
||||
{
|
||||
@ -24,7 +28,7 @@
|
||||
xwarnx(_("your kernel does not support slabinfo or your permissions are insufficient"));
|
||||
return;
|
||||
}
|
||||
@@ -728,7 +728,6 @@ static void slabformat(void)
|
||||
@@ -724,7 +724,6 @@ static void slabformat(void)
|
||||
}
|
||||
free(slabs);
|
||||
}
|
||||
|
@ -1,11 +1,20 @@
|
||||
---
|
||||
free.c | 17 +++++++++++++++--
|
||||
free.c | 19 ++++++++++++++++---
|
||||
proc/sysinfo.c | 5 ++++-
|
||||
2 files changed, 19 insertions(+), 3 deletions(-)
|
||||
2 files changed, 20 insertions(+), 4 deletions(-)
|
||||
|
||||
--- free.c
|
||||
+++ free.c 2016-07-11 13:05:52.351515040 +0000
|
||||
@@ -387,15 +387,28 @@ int main(int argc, char **argv)
|
||||
+++ free.c 2018-04-04 11:29:36.599107898 +0000
|
||||
@@ -134,7 +134,7 @@ static const char *scale_size(unsigned l
|
||||
if (args.exponent > 1) {
|
||||
/* In desired scale. */
|
||||
snprintf(buf, sizeof(buf), "%ld",
|
||||
- (long int)((size * 1024) / power(base, args.exponent-1))
|
||||
+ (long int)(((long long int)size * 1024) / power(base, args.exponent-1))
|
||||
);
|
||||
return buf;
|
||||
}
|
||||
@@ -379,15 +379,28 @@ int main(int argc, char **argv)
|
||||
* to print the high info, even if it is zero.
|
||||
*/
|
||||
if (flags & FREE_LOHI) {
|
||||
@ -37,8 +46,8 @@
|
||||
printf("\n");
|
||||
}
|
||||
--- proc/sysinfo.c
|
||||
+++ proc/sysinfo.c 2016-07-11 13:08:00.145047300 +0000
|
||||
@@ -709,7 +709,10 @@ nextline:
|
||||
+++ proc/sysinfo.c 2018-04-04 11:17:32.480409601 +0000
|
||||
@@ -781,7 +781,10 @@ nextline:
|
||||
kb_main_cached = kb_page_cache + kb_slab_reclaimable;
|
||||
if ((ev=getenv("PS_FULL_CACHE")))
|
||||
kb_main_cached += kb_swap_cached + kb_nfs_unstable;
|
||||
|
@ -1,43 +1,19 @@
|
||||
---
|
||||
top/top.c | 17 +++++++++++++++--
|
||||
1 file changed, 15 insertions(+), 2 deletions(-)
|
||||
top/top.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
--- top/top.c
|
||||
+++ top/top.c 2016-07-11 13:14:56.681005709 +0000
|
||||
@@ -2295,8 +2295,15 @@ static void zap_fieldstab (void) {
|
||||
Fieldstab[EU_CPU].width = 5;
|
||||
+++ top/top.c 2018-04-04 12:09:16.087193018 +0000
|
||||
@@ -2458,7 +2458,11 @@ static void zap_fieldstab (void) {
|
||||
Cpu_pmax = 99.9;
|
||||
if (Rc.mode_irixps && smp_num_cpus > 1 && !Thread_mode) {
|
||||
Cpu_pmax = 100.0 * smp_num_cpus;
|
||||
- if (smp_num_cpus > 10) {
|
||||
+ if (smp_num_cpus > 1000) {
|
||||
+ if (Cpu_pmax > 9999999.0) Cpu_pmax = 9999999.0;
|
||||
+ Fieldstab[EU_CPU].width = 8;
|
||||
+ } else if (smp_num_cpus > 100) {
|
||||
+ if (Cpu_pmax > 999999.0) Cpu_pmax = 999999.0;
|
||||
+ Fieldstab[EU_CPU].width = 7;
|
||||
+ } else if (smp_num_cpus > 10) {
|
||||
if (Cpu_pmax > 99999.0) Cpu_pmax = 99999.0;
|
||||
+ Fieldstab[EU_CPU].width = 6;
|
||||
} else {
|
||||
if (Cpu_pmax > 999.9) Cpu_pmax = 999.9;
|
||||
}
|
||||
@@ -2306,12 +2313,18 @@ static void zap_fieldstab (void) {
|
||||
Fieldstab[EU_CPU].width = 4;
|
||||
if (Rc.mode_irixps && smp_num_cpus > 1 && !Thread_mode) {
|
||||
Cpu_pmax = 100.0 * smp_num_cpus;
|
||||
+ if (smp_num_cpus > 1000) {
|
||||
+ if (Cpu_pmax > 9999999.0) Cpu_pmax = 9999999.0;
|
||||
+ Fieldstab[EU_CPU].width = 7;
|
||||
+ } else if (smp_num_cpus > 100) {
|
||||
+ if (Cpu_pmax > 999999.0) Cpu_pmax = 999999.0;
|
||||
+ Fieldstab[EU_CPU].width = 6;
|
||||
if (smp_num_cpus > 10) {
|
||||
if (Cpu_pmax > 99999.0) Cpu_pmax = 99999.0;
|
||||
+ Fieldstab[EU_CPU].width = 5;
|
||||
} else {
|
||||
if (Cpu_pmax > 999.9) Cpu_pmax = 999.9;
|
||||
}
|
||||
- Fieldstab[EU_CPU].width = 5;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
---
|
||||
free.1 | 7 +++++++
|
||||
free.1 | 6 ++++++
|
||||
free.c | 7 ++++++-
|
||||
proc/sysinfo.c | 4 ++++
|
||||
vmstat.c | 6 +++++-
|
||||
4 files changed, 22 insertions(+), 2 deletions(-)
|
||||
4 files changed, 21 insertions(+), 2 deletions(-)
|
||||
|
||||
--- free.1
|
||||
+++ free.1 2016-07-11 12:50:09.681730441 +0000
|
||||
+++ free.1 2018-04-04 11:13:44.744590770 +0000
|
||||
@@ -100,6 +100,12 @@ Switch to the wide mode. The wide mode p
|
||||
than 80 characters. In this mode \fBbuffers\fR and \fBcache\fR
|
||||
are reported in two separate columns.
|
||||
@ -21,7 +21,7 @@
|
||||
Display the result
|
||||
.I count
|
||||
--- free.c
|
||||
+++ free.c 2016-07-11 12:50:09.681730441 +0000
|
||||
+++ free.c 2018-04-04 11:13:44.748590695 +0000
|
||||
@@ -90,6 +90,7 @@ static void __attribute__ ((__noreturn__
|
||||
fputs(_(" -t, --total show total for RAM + swap\n"), out);
|
||||
fputs(_(" -s N, --seconds N repeat printing every N seconds\n"), out);
|
||||
@ -30,7 +30,7 @@
|
||||
fputs(_(" -w, --wide wide output\n"), out);
|
||||
fputs(USAGE_SEPARATOR, out);
|
||||
fputs(_(" --help display this help and exit\n"), out);
|
||||
@@ -239,6 +240,7 @@ int main(int argc, char **argv)
|
||||
@@ -231,6 +232,7 @@ int main(int argc, char **argv)
|
||||
{ "total", no_argument, NULL, 't' },
|
||||
{ "seconds", required_argument, NULL, 's' },
|
||||
{ "count", required_argument, NULL, 'c' },
|
||||
@ -38,7 +38,7 @@
|
||||
{ "wide", no_argument, NULL, 'w' },
|
||||
{ "help", no_argument, NULL, HELP_OPTION },
|
||||
{ "version", no_argument, NULL, 'V' },
|
||||
@@ -258,7 +260,7 @@ int main(int argc, char **argv)
|
||||
@@ -250,7 +252,7 @@ int main(int argc, char **argv)
|
||||
textdomain(PACKAGE);
|
||||
atexit(close_stdout);
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
switch (c) {
|
||||
case 'b':
|
||||
check_unit_set(&unit_set);
|
||||
@@ -341,6 +343,9 @@ int main(int argc, char **argv)
|
||||
@@ -333,6 +335,9 @@ int main(int argc, char **argv)
|
||||
case 'w':
|
||||
flags |= FREE_WIDE;
|
||||
break;
|
||||
@ -58,7 +58,7 @@
|
||||
usage(stdout);
|
||||
case 'V':
|
||||
--- proc/sysinfo.c
|
||||
+++ proc/sysinfo.c 2016-07-11 12:57:46.980885685 +0000
|
||||
+++ proc/sysinfo.c 2018-04-04 11:13:44.748590695 +0000
|
||||
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 1992-1998 by Michael K. Johnson, johnsonm@redhat.com
|
||||
* Copyright 1998-2003 Albert Cahalan
|
||||
@ -67,7 +67,7 @@
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -626,6 +627,7 @@ void meminfo(void){
|
||||
@@ -698,6 +699,7 @@ void meminfo(void){
|
||||
int linux_version_code = procps_linux_version();
|
||||
mem_table_struct findme = { namebuf, NULL};
|
||||
mem_table_struct *found;
|
||||
@ -75,7 +75,7 @@
|
||||
char *head;
|
||||
char *tail;
|
||||
static const mem_table_struct mem_table[] = {
|
||||
@@ -705,6 +707,8 @@ nextline:
|
||||
@@ -777,6 +779,8 @@ nextline:
|
||||
kb_inactive = kb_inact_dirty + kb_inact_clean + kb_inact_laundry;
|
||||
}
|
||||
kb_main_cached = kb_page_cache + kb_slab_reclaimable;
|
||||
@ -85,7 +85,7 @@
|
||||
|
||||
/* if kb_main_available is greater than kb_main_total or our calculation of
|
||||
--- vmstat.c
|
||||
+++ vmstat.c 2016-07-11 12:50:09.685730365 +0000
|
||||
+++ vmstat.c 2018-04-04 11:13:44.748590695 +0000
|
||||
@@ -103,6 +103,7 @@ static void __attribute__ ((__noreturn__
|
||||
fputs(_(" -p, --partition <dev> partition specific statistics\n"), out);
|
||||
fputs(_(" -S, --unit <char> define display unit\n"), out);
|
||||
@ -94,7 +94,7 @@
|
||||
fputs(_(" -t, --timestamp show timestamp\n"), out);
|
||||
fputs(USAGE_SEPARATOR, out);
|
||||
fputs(USAGE_HELP, out);
|
||||
@@ -881,7 +882,7 @@ int main(int argc, char *argv[])
|
||||
@@ -877,7 +878,7 @@ int main(int argc, char *argv[])
|
||||
atexit(close_stdout);
|
||||
|
||||
while ((c =
|
||||
@ -103,7 +103,7 @@
|
||||
NULL)) != EOF)
|
||||
switch (c) {
|
||||
case 'V':
|
||||
@@ -950,6 +951,9 @@ int main(int argc, char *argv[])
|
||||
@@ -946,6 +947,9 @@ int main(int argc, char *argv[])
|
||||
case 't':
|
||||
t_option = 1;
|
||||
break;
|
||||
|
@ -1,10 +1,10 @@
|
||||
---
|
||||
pmap.c | 50 +++++++++++++++++++++++++++++++------------
|
||||
testsuite/pmap.test/pmap.exp | 17 ++++++--------
|
||||
2 files changed, 45 insertions(+), 22 deletions(-)
|
||||
pmap.c | 48 ++++++++++++++++++++++++++++++++-----------
|
||||
testsuite/pmap.test/pmap.exp | 17 +++++++--------
|
||||
2 files changed, 44 insertions(+), 21 deletions(-)
|
||||
|
||||
--- pmap.c
|
||||
+++ pmap.c 2016-05-30 11:36:45.447592219 +0000
|
||||
+++ pmap.c 2018-04-04 12:52:03.219187662 +0000
|
||||
@@ -48,7 +48,9 @@ const char *nls_Address,
|
||||
*nls_Kbytes,
|
||||
*nls_Mode,
|
||||
@ -74,7 +74,7 @@
|
||||
maxw5 = justify_print(nls_Mode, maxw5, 0);
|
||||
justify_print(nls_Mapping, 0, 0);
|
||||
}
|
||||
@@ -605,6 +616,11 @@ static int one_proc(proc_t * p)
|
||||
@@ -603,6 +614,11 @@ static int one_proc(proc_t * p)
|
||||
total_rss += smap_value;
|
||||
continue;
|
||||
}
|
||||
@ -83,17 +83,15 @@
|
||||
+ total_pss += smap_value;
|
||||
+ continue;
|
||||
+ }
|
||||
if (strncmp("Shared_Dirty", smap_key, 12) == 0) {
|
||||
if (strcmp("Shared_Dirty", smap_key) == 0) {
|
||||
shared_dirty = smap_value;
|
||||
total_shared_dirty += smap_value;
|
||||
@@ -615,17 +631,20 @@ static int one_proc(proc_t * p)
|
||||
total_private_dirty += smap_value;
|
||||
@@ -614,16 +630,19 @@ static int one_proc(proc_t * p)
|
||||
continue;
|
||||
}
|
||||
- if (strncmp("Swap", smap_key, 4) == 0) {
|
||||
if (strcmp("Swap", smap_key) == 0) {
|
||||
- /*doesn't matter as long as last */
|
||||
- printf("%0*" KLF "x %*lu %*llu %*llu %*s %s\n",
|
||||
+ if (strncmp("Swap", smap_key, 4) == 0 && strlen(smap_key) == 4) {
|
||||
+ swap = smap_value;
|
||||
+ total_swap += smap_value;
|
||||
+ printf("%0*" KLF "x %*lu %*llu %*llu %*llu %*llu %*s %s\n",
|
||||
@ -111,7 +109,7 @@
|
||||
diff = 0;
|
||||
continue;
|
||||
}
|
||||
@@ -656,7 +675,6 @@ static int one_proc(proc_t * p)
|
||||
@@ -654,7 +673,6 @@ static int one_proc(proc_t * p)
|
||||
if (perms[3] == 's')
|
||||
total_shared += diff;
|
||||
if (perms[3] == 'p') {
|
||||
@ -119,7 +117,7 @@
|
||||
if (perms[1] == 'w')
|
||||
total_private_writeable += diff;
|
||||
else
|
||||
@@ -708,17 +726,21 @@ static int one_proc(proc_t * p)
|
||||
@@ -706,17 +724,21 @@ static int one_proc(proc_t * p)
|
||||
justify_print("----------------", maxw1, 0);
|
||||
justify_print("-------", maxw2, 1);
|
||||
justify_print("-------", maxw3, 1);
|
||||
@ -143,7 +141,7 @@
|
||||
}
|
||||
if (d_option) {
|
||||
printf
|
||||
@@ -1025,16 +1047,18 @@ int main(int argc, char **argv)
|
||||
@@ -1023,16 +1045,18 @@ int main(int argc, char **argv)
|
||||
while ((c = getopt_long(argc, argv, "xXrdqA:hVcC:nN:p", longopts, NULL)) != -1)
|
||||
switch (c) {
|
||||
case 'x':
|
||||
@ -165,7 +163,7 @@
|
||||
case 'q':
|
||||
q_option = 1;
|
||||
--- testsuite/pmap.test/pmap.exp
|
||||
+++ testsuite/pmap.test/pmap.exp 2016-07-12 15:12:26.592609617 +0000
|
||||
+++ testsuite/pmap.test/pmap.exp 2018-04-04 12:47:45.452023967 +0000
|
||||
@@ -8,16 +8,16 @@ set pmap_procname "${mypid}:\\s+\\S+\[^\
|
||||
set pmap_initname "1:\\s+\\S+\[^\\r\]+\\s+"
|
||||
set pmap_std_header $pmap_procname
|
||||
|
@ -1,26 +0,0 @@
|
||||
---
|
||||
sysctl.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
--- sysctl.c
|
||||
+++ sysctl.c 2017-07-06 09:23:55.635379302 +0000
|
||||
@@ -239,6 +239,9 @@ static int ReadSetting(const char *restr
|
||||
xwarnx(_("permission denied on key '%s'"), outname);
|
||||
rc = -1;
|
||||
break;
|
||||
+ case EIO: /* Ignore stable_secret below /proc/sys/net/ipv6/conf */
|
||||
+ rc = -1;
|
||||
+ break;
|
||||
default:
|
||||
xwarn(_("reading key \"%s\""), outname);
|
||||
rc = -1;
|
||||
@@ -288,6 +291,9 @@ static int ReadSetting(const char *restr
|
||||
rc = DisplayAll(tmpname);
|
||||
goto out;
|
||||
}
|
||||
+ case EIO: /* Ignore stable_secret below /proc/sys/net/ipv6/conf */
|
||||
+ rc = -1;
|
||||
+ break;
|
||||
default:
|
||||
xwarnx(_("reading key \"%s\""), outname);
|
||||
rc = -1;
|
@ -1,97 +0,0 @@
|
||||
---
|
||||
include/strutils.h | 2 +-
|
||||
lib/strutils.c | 22 ++++++++++++----------
|
||||
lib/test_strtod_nol.c | 7 ++++---
|
||||
3 files changed, 17 insertions(+), 14 deletions(-)
|
||||
|
||||
--- include/strutils.h
|
||||
+++ include/strutils.h 2016-07-12 16:28:56.748950404 +0000
|
||||
@@ -7,6 +7,6 @@
|
||||
|
||||
extern long strtol_or_err(const char *str, const char *errmesg);
|
||||
extern double strtod_or_err(const char *str, const char *errmesg);
|
||||
-double strtod_nol_or_err(char *str, const char *errmesg);
|
||||
+extern double strtod_nol_or_err(char *str, const char *errmesg);
|
||||
|
||||
#endif
|
||||
--- lib/strutils.c
|
||||
+++ lib/strutils.c 2016-07-13 06:49:41.641951219 +0000
|
||||
@@ -20,6 +20,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
+#include <float.h>
|
||||
+#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
@@ -71,9 +73,9 @@ double strtod_or_err(const char *str, co
|
||||
*/
|
||||
double strtod_nol_or_err(char *str, const char *errmesg)
|
||||
{
|
||||
- double num;
|
||||
+ long double num;
|
||||
const char *cp, *radix;
|
||||
- double mult;
|
||||
+ long double mult;
|
||||
int negative = 0;
|
||||
|
||||
if (str != NULL && *str != '\0') {
|
||||
@@ -95,29 +97,29 @@ double strtod_nol_or_err(char *str, cons
|
||||
mult=0.1;
|
||||
while(isdigit(*radix)) {
|
||||
radix++;
|
||||
- mult *= 10;
|
||||
+ mult *= 10.0;
|
||||
}
|
||||
while(isdigit(*cp)) {
|
||||
- num += (*cp - '0') * mult;
|
||||
- mult /= 10;
|
||||
+ num += (long double)(*cp - '0') * mult;
|
||||
+ mult /= 10.0;
|
||||
cp++;
|
||||
}
|
||||
/* got the integers */
|
||||
if (*cp == '\0')
|
||||
- return (negative?-num:num);
|
||||
+ return (double)(negative?-num:num);
|
||||
if (*cp != '.' && *cp != ',')
|
||||
error(EXIT_FAILURE, EINVAL, "%s: '%s'", errmesg, str);
|
||||
|
||||
cp++;
|
||||
mult = 0.1;
|
||||
while(isdigit(*cp)) {
|
||||
- num += (*cp - '0') * mult;
|
||||
- mult /= 10;
|
||||
+ num += (long double)(*cp - '0') * mult;
|
||||
+ mult /= 10.0;
|
||||
cp++;
|
||||
}
|
||||
if (*cp == '\0')
|
||||
- return (negative?-num:num);
|
||||
+ return (double)(negative?-num:num);
|
||||
}
|
||||
error(EXIT_FAILURE, errno, "%s: '%s'", errmesg, str);
|
||||
- return 0;
|
||||
+ return (double)0;
|
||||
}
|
||||
--- lib/test_strtod_nol.c
|
||||
+++ lib/test_strtod_nol.c 2016-07-13 07:01:43.887513423 +0000
|
||||
@@ -1,4 +1,5 @@
|
||||
-
|
||||
+#include <float.h>
|
||||
+#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "strutils.h"
|
||||
@@ -33,8 +34,8 @@ int main(int argc, char *argv[])
|
||||
double val;
|
||||
|
||||
for(i=0; tests[i].string != NULL; i++) {
|
||||
- if(strtod_nol_or_err(tests[i].string, "Cannot parse number") !=
|
||||
- tests[i].result) {
|
||||
+ val = strtod_nol_or_err(tests[i].string, "Cannot parse number");
|
||||
+ if(fabs(tests[i].result - val) > DBL_EPSILON) {
|
||||
fprintf(stderr, "FAIL: strtod_nol_or_err(\"%s\") != %f\n",
|
||||
tests[i].string, tests[i].result);
|
||||
return EXIT_FAILURE;
|
@ -1,74 +0,0 @@
|
||||
From a89cebe1970fb0cd87d71e4524d6620c2b673369 Mon Sep 17 00:00:00 2001
|
||||
From: Werner Fink <werner@suse.de>
|
||||
Date: Mon, 22 May 2017 12:17:53 +0200
|
||||
Subject: [PATCH] Allow sysctl to print lines longer than 1024 chars
|
||||
|
||||
as well do not open /proc/sys files if only the names of the
|
||||
system control names of the kernel parameters should be shown.
|
||||
Avoid leaking tmpname in case of a pattern mismatch.
|
||||
|
||||
Signed-off-by: Werner Fink <werner@suse.de>
|
||||
---
|
||||
sysctl.c | 42 ++++++++++++++++++++++++------------------
|
||||
1 file changed, 24 insertions(+), 18 deletions(-)
|
||||
|
||||
--- sysctl.c
|
||||
+++ sysctl.c 2017-07-06 08:11:02.011136954 +0000
|
||||
@@ -211,8 +211,13 @@ static int ReadSetting(const char *restr
|
||||
}
|
||||
|
||||
if (pattern && !pattern_match(outname, pattern)) {
|
||||
- free(outname);
|
||||
- return 0;
|
||||
+ rc = 0;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (NameOnly) {
|
||||
+ fprintf(stdout, "%s\n", outname);
|
||||
+ goto out;
|
||||
}
|
||||
|
||||
fp = fopen(tmpname, "r");
|
||||
@@ -241,24 +246,25 @@ static int ReadSetting(const char *restr
|
||||
* /sbin/sysctl -a | egrep -6 dev.cdrom.info
|
||||
*/
|
||||
do {
|
||||
- if (NameOnly) {
|
||||
- fprintf(stdout, "%s\n", outname);
|
||||
- } else {
|
||||
- /* already has the \n in it */
|
||||
- if (PrintName) {
|
||||
- fprintf(stdout, "%s = %s",
|
||||
- outname, inbuf);
|
||||
- if (inbuf[strlen(inbuf) - 1] != '\n')
|
||||
- putchar('\n');
|
||||
- } else {
|
||||
- if (!PrintNewline) {
|
||||
- char *nlptr =
|
||||
- strchr(inbuf, '\n');
|
||||
- if (nlptr)
|
||||
- *nlptr = '\0';
|
||||
- }
|
||||
+ char *nlptr;
|
||||
+ if (PrintName) {
|
||||
+ fprintf(stdout, "%s = ", outname);
|
||||
+ do {
|
||||
fprintf(stdout, "%s", inbuf);
|
||||
+ nlptr = &inbuf[strlen(inbuf) - 1];
|
||||
+ /* already has the \n in it */
|
||||
+ if (*nlptr == '\n')
|
||||
+ break;
|
||||
+ } while (fgets(inbuf, sizeof inbuf - 1, fp));
|
||||
+ if (*nlptr != '\n')
|
||||
+ putchar('\n');
|
||||
+ } else {
|
||||
+ if (!PrintNewline) {
|
||||
+ nlptr = strchr(inbuf, '\n');
|
||||
+ if (nlptr)
|
||||
+ *nlptr = '\0';
|
||||
}
|
||||
+ fprintf(stdout, "%s", inbuf);
|
||||
}
|
||||
} while (fgets(inbuf, sizeof inbuf - 1, fp));
|
||||
} else {
|
@ -1,44 +0,0 @@
|
||||
---
|
||||
sysctl.c | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
Index: sysctl.c
|
||||
===================================================================
|
||||
--- sysctl.c.orig
|
||||
+++ sysctl.c
|
||||
@@ -160,6 +160,8 @@ static char *StripLeadingAndTrailingSpac
|
||||
/*
|
||||
* Read a sysctl setting
|
||||
*/
|
||||
+#define IOBUFSIZ (128<<10)
|
||||
+static char *iobuf;
|
||||
static int ReadSetting(const char *restrict const name)
|
||||
{
|
||||
int rc = 0;
|
||||
@@ -240,6 +242,8 @@ static int ReadSetting(const char *restr
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
+ if (iobuf)
|
||||
+ setvbuf(fp, iobuf, _IOFBF, IOBUFSIZ);
|
||||
errno = 0;
|
||||
if (fgets(inbuf, sizeof inbuf - 1, fp)) {
|
||||
/* this loop is required, see
|
||||
@@ -450,6 +454,8 @@ static int WriteSetting(const char *sett
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
+ if (iobuf)
|
||||
+ setvbuf(fp, iobuf, _IOFBF, IOBUFSIZ);
|
||||
rc = fprintf(fp, "%s\n", value);
|
||||
if (0 < rc)
|
||||
rc = 0;
|
||||
@@ -806,6 +812,8 @@ int main(int argc, char *argv[])
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
+ iobuf = (char*)malloc(IOBUFSIZ); /* Allow to fail */
|
||||
+
|
||||
if (DisplayAllOpt)
|
||||
return DisplayAll(PROC_PATH);
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6ed65ab86318f37904e8f9014415a098bec5bc53653e5d9ab404f95ca5e1a7d4
|
||||
size 845484
|
3
procps-ng-3.3.13.tar.xz
Normal file
3
procps-ng-3.3.13.tar.xz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:52b05b2bd5b05f46f24766a10474337ebadd828df9915e2b178df291cf88f7d3
|
||||
size 901156
|
@ -5,7 +5,7 @@
|
||||
3 files changed, 15 insertions(+), 10 deletions(-)
|
||||
|
||||
--- ps/common.h
|
||||
+++ ps/common.h 2016-07-11 13:02:13.815735709 +0000
|
||||
+++ ps/common.h 2018-04-04 11:14:33.915688098 +0000
|
||||
@@ -302,6 +302,7 @@ extern int running_only;
|
||||
extern int screen_cols;
|
||||
extern int screen_rows;
|
||||
@ -15,7 +15,7 @@
|
||||
extern unsigned simple_select;
|
||||
extern sort_node *sort_list;
|
||||
--- ps/global.c
|
||||
+++ ps/global.c 2016-07-11 13:02:13.815735709 +0000
|
||||
+++ ps/global.c 2018-04-04 11:14:33.915688098 +0000
|
||||
@@ -78,6 +78,7 @@ int prefer_bsd_defaults = -1
|
||||
int screen_cols = -1;
|
||||
int screen_rows = -1;
|
||||
@ -43,8 +43,8 @@
|
||||
simple_select = 0;
|
||||
sort_list = NULL;
|
||||
--- ps/output.c
|
||||
+++ ps/output.c 2016-07-11 13:02:13.815735709 +0000
|
||||
@@ -132,6 +132,7 @@ static int sr_ ## NAME (const proc_t* P,
|
||||
+++ ps/output.c 2018-04-04 11:14:33.915688098 +0000
|
||||
@@ -135,6 +135,7 @@ static int sr_ ## NAME (const proc_t* P,
|
||||
#define cook_time(P) (P->utime + P->stime) / Hertz
|
||||
|
||||
#define cook_etime(P) (((unsigned long long)seconds_since_boot >= (P->start_time / Hertz)) ? ((unsigned long long)seconds_since_boot - (P->start_time / Hertz)) : 0)
|
||||
@ -52,7 +52,7 @@
|
||||
|
||||
#define CMP_COOKED_TIME(NAME) \
|
||||
static int sr_ ## NAME (const proc_t* P, const proc_t* Q) { \
|
||||
@@ -505,11 +506,11 @@ static int pr_etimes(char *restrict cons
|
||||
@@ -508,11 +509,11 @@ static int pr_etimes(char *restrict cons
|
||||
static int pr_c(char *restrict const outbuf, const proc_t *restrict const pp){
|
||||
unsigned long long total_time; /* jiffies used by this process */
|
||||
unsigned pcpu = 0; /* scaled %cpu, 99 means 99% */
|
||||
@ -67,7 +67,7 @@
|
||||
if (pcpu > 99U) pcpu = 99U;
|
||||
return snprintf(outbuf, COLWID, "%2u", pcpu);
|
||||
}
|
||||
@@ -517,11 +518,11 @@ static int pr_c(char *restrict const out
|
||||
@@ -520,11 +521,11 @@ static int pr_c(char *restrict const out
|
||||
static int pr_pcpu(char *restrict const outbuf, const proc_t *restrict const pp){
|
||||
unsigned long long total_time; /* jiffies used by this process */
|
||||
unsigned pcpu = 0; /* scaled %cpu, 999 means 99.9% */
|
||||
@ -82,7 +82,7 @@
|
||||
if (pcpu > 999U)
|
||||
return snprintf(outbuf, COLWID, "%u", pcpu/10U);
|
||||
return snprintf(outbuf, COLWID, "%u.%u", pcpu/10U, pcpu%10U);
|
||||
@@ -530,11 +531,11 @@ static int pr_pcpu(char *restrict const
|
||||
@@ -533,11 +534,11 @@ static int pr_pcpu(char *restrict const
|
||||
static int pr_cp(char *restrict const outbuf, const proc_t *restrict const pp){
|
||||
unsigned long long total_time; /* jiffies used by this process */
|
||||
unsigned pcpu = 0; /* scaled %cpu, 999 means 99.9% */
|
||||
|
@ -11,8 +11,8 @@ Index: procps-3.2.8/top.c
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
--- top/top.c
|
||||
+++ top/top.c 2016-07-11 13:12:07.436272792 +0000
|
||||
@@ -3328,7 +3328,13 @@ static void before (char *me) {
|
||||
+++ top/top.c 2018-04-04 11:33:59.278280201 +0000
|
||||
@@ -3575,7 +3575,13 @@ static void before (char *me) {
|
||||
sa.sa_flags = 0;
|
||||
for (i = SIGRTMAX; i; i--) {
|
||||
switch (i) {
|
||||
|
@ -13,7 +13,7 @@ Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
|
||||
--- a/sysctl.c
|
||||
+++ b/sysctl.c
|
||||
@@ -57,6 +57,7 @@ static const char DEFAULT_PRELOAD[] = "/
|
||||
@@ -59,6 +59,7 @@ static const char DEFAULT_PRELOAD[] = "/
|
||||
static const char *DEPRECATED[] = {
|
||||
"base_reachable_time",
|
||||
"retrans_time",
|
||||
|
@ -3,20 +3,20 @@
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
--- top/top.c
|
||||
+++ top/top.c 2016-07-11 13:13:56.178173598 +0000
|
||||
@@ -1536,9 +1536,9 @@ static inline const char *make_str (cons
|
||||
+++ top/top.c 2018-04-04 11:49:56.472660056 +0000
|
||||
@@ -1688,9 +1688,9 @@ static inline const char *make_str_utf8
|
||||
static const char *scale_mem (int target, unsigned long num, int width, int justr) {
|
||||
#ifndef NOBOOST_MEMS
|
||||
// SK_Kb SK_Mb SK_Gb SK_Tb SK_Pb SK_Eb
|
||||
#ifdef BOOST_MEMORY
|
||||
- static const char *fmttab[] = { "%.0f", "%#.1f%c", "%#.3f%c", "%#.3f%c", "%#.3f%c", NULL };
|
||||
+ static const char *fmttab[] = { "%.0f", "%#.1f%c", "%#.3f%c", "%#.3f%c", "%#.3f%c", "%#.3f%c", NULL };
|
||||
#else
|
||||
- static const char *fmttab[] = { "%.0f", "%.0f%c", "%.0f%c", "%.0f%c", "%.0f%c", NULL };
|
||||
+ static const char *fmttab[] = { "%.0f", "%.0f%c", "%.0f%c", "%.0f%c", "%.0f%c", "%.0f%c", NULL };
|
||||
- static const char *fmttab[] = { "%.0f", "%.1f%c", "%.1f%c", "%.1f%c", "%.1f%c", NULL };
|
||||
+ static const char *fmttab[] = { "%.0f", "%.1f%c", "%.1f%c", "%.1f%c", "%.1f%c", "%.1f%c", NULL };
|
||||
#endif
|
||||
static char buf[SMLBUFSIZ];
|
||||
float scaled_num;
|
||||
@@ -1550,7 +1550,7 @@ static const char *scale_mem (int target
|
||||
@@ -1702,7 +1702,7 @@ static const char *scale_mem (int target
|
||||
goto end_justifies;
|
||||
|
||||
scaled_num = num;
|
||||
|
@ -3,8 +3,8 @@
|
||||
1 file changed, 25 insertions(+), 24 deletions(-)
|
||||
|
||||
--- proc/readproc.c
|
||||
+++ proc/readproc.c 2016-07-11 12:49:24.778601134 +0000
|
||||
@@ -643,7 +643,7 @@ static int file2str(const char *director
|
||||
+++ proc/readproc.c 2018-04-04 11:13:11.593199324 +0000
|
||||
@@ -644,7 +644,7 @@ static int file2str(const char *director
|
||||
if (ub->buf) ub->buf[0] = '\0';
|
||||
else ub->buf = xcalloc((ub->siz = buffGRW));
|
||||
sprintf(path, "%s/%s", directory, what);
|
||||
@ -13,7 +13,7 @@
|
||||
while (0 < (num = read(fd, ub->buf + tot_read, ub->siz - tot_read))) {
|
||||
tot_read += num;
|
||||
if (tot_read < ub->siz) break;
|
||||
@@ -658,41 +658,42 @@ static int file2str(const char *director
|
||||
@@ -659,41 +659,42 @@ static int file2str(const char *director
|
||||
|
||||
static char** file2strvec(const char* directory, const char* what) {
|
||||
char buf[2048]; /* read buf bytes at a time */
|
||||
@ -78,7 +78,7 @@
|
||||
endbuf = rbuf + tot; /* count space for pointers */
|
||||
align = (sizeof(char*)-1) - ((tot + sizeof(char*)-1) & (sizeof(char*)-1));
|
||||
for (c = 0, p = rbuf; p < endbuf; p++) {
|
||||
@@ -725,7 +726,7 @@ static int read_unvectored(char *restric
|
||||
@@ -726,7 +727,7 @@ static int read_unvectored(char *restric
|
||||
unsigned n = 0;
|
||||
|
||||
snprintf(path, sizeof(path), "%s/%s", whom, what);
|
||||
|
@ -4,9 +4,9 @@
|
||||
2 files changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
--- Makefile.am
|
||||
+++ Makefile.am 2016-07-11 13:16:34.327120958 +0000
|
||||
@@ -112,7 +112,7 @@ if CYGWIN
|
||||
top_top_SOURCES += lib/strverscmp.c
|
||||
+++ Makefile.am 2018-04-04 12:28:14.937957527 +0000
|
||||
@@ -165,7 +165,7 @@ else
|
||||
slabtop_LDADD = $(LDADD) @NCURSES_LIBS@
|
||||
endif
|
||||
|
||||
-top_top_LDADD = $(LDADD) @NCURSES_LIBS@ $(DL_LIB)
|
||||
@ -15,8 +15,8 @@
|
||||
|
||||
if BUILD_SKILL
|
||||
--- configure.ac
|
||||
+++ configure.ac 2016-07-11 13:15:42.864114271 +0000
|
||||
@@ -141,9 +141,17 @@ else
|
||||
+++ configure.ac 2018-04-04 12:29:23.364676155 +0000
|
||||
@@ -163,8 +163,16 @@ else
|
||||
else
|
||||
WATCH_NCURSES_LIBS="$NCURSES_LIBS"
|
||||
fi
|
||||
@ -29,8 +29,7 @@
|
||||
+ fi
|
||||
fi
|
||||
AC_SUBST([NCURSES_LIBS])
|
||||
AC_SUBST([WATCH_NCURSES_LIBS])
|
||||
+AC_SUBST([TOP_NCURSES_LIBS])
|
||||
AC_SUBST([WATCH_NCURSES_LIBS])
|
||||
AC_SUBST([WATCH_NCURSES_CFLAGS])
|
||||
|
||||
AC_ARG_WITH([systemd],
|
||||
[AS_HELP_STRING([--with-systemd], [enable systemd support])],
|
||||
|
@ -1,6 +1,10 @@
|
||||
---
|
||||
top/top.1 | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- top/top.1
|
||||
+++ top/top.1 2013-05-29 10:50:57.169939440 +0000
|
||||
@@ -9,7 +9,7 @@
|
||||
+++ top/top.1 2018-04-04 11:11:58.234544896 +0000
|
||||
@@ -7,7 +7,7 @@
|
||||
..
|
||||
\# Setup ////////////////////////////////////////////////////////////////
|
||||
\# ** Comment out '.nr' or set to 0 to eliminate WIDTH fiddlin' !
|
||||
|
@ -4,10 +4,10 @@
|
||||
2 files changed, 14 insertions(+)
|
||||
|
||||
--- sysctl.8
|
||||
+++ sysctl.8 2016-07-11 13:12:48.427481461 +0000
|
||||
@@ -80,6 +80,8 @@ Print value without new line.
|
||||
\fB\-\-system\fR
|
||||
Load settings from all system configuration files.
|
||||
+++ sysctl.8 2018-04-04 11:38:10.173667994 +0000
|
||||
@@ -81,6 +81,8 @@ directories in the following list in giv
|
||||
Once a file of a given filename is loaded, any file of the same name
|
||||
in subsequent directories is ignored.
|
||||
.br
|
||||
+/boot/sysctl.conf-<kernelversion>
|
||||
+.br
|
||||
@ -15,7 +15,7 @@
|
||||
.br
|
||||
/etc/sysctl.d/*.conf
|
||||
--- sysctl.c
|
||||
+++ sysctl.c 2016-07-11 13:12:48.427481461 +0000
|
||||
+++ sysctl.c 2018-04-04 11:36:32.515463365 +0000
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
@ -24,7 +24,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "c.h"
|
||||
@@ -584,6 +585,7 @@ static int sortpairs(const void *A, cons
|
||||
@@ -613,6 +614,7 @@ static int sortpairs(const void *A, cons
|
||||
static int PreloadSystem(void)
|
||||
{
|
||||
unsigned di, i;
|
||||
@ -32,7 +32,7 @@
|
||||
const char *dirs[] = {
|
||||
"/run/sysctl.d",
|
||||
"/etc/sysctl.d",
|
||||
@@ -648,6 +650,16 @@ static int PreloadSystem(void)
|
||||
@@ -677,6 +679,16 @@ static int PreloadSystem(void)
|
||||
}
|
||||
qsort(cfgs, ncfgs, sizeof(struct cfg *), sortpairs);
|
||||
|
||||
|
@ -1,3 +1,72 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Apr 4 13:16:25 UTC 2018 - werner@suse.de
|
||||
|
||||
- Update to procps-ng-3.3.13
|
||||
* library: Increment to 7:0:1
|
||||
No changes, no removals
|
||||
New fuctions: numa_init, numa_max_node, numa_node_of_cpu,
|
||||
numa_uninit, xalloc_err_handler
|
||||
* doc: Document I idle state in ps.1 and top.1 Debian #886967
|
||||
* free: fix some of the SI multiples issue #45
|
||||
* kill: -l space between name parses correctly Debian #854407
|
||||
* library: dont use vm_min_free on non Linux Debian #831396
|
||||
* library: dont use SIGPWR on FreeBSD Debian #832148
|
||||
* library: don't strip off wchan prefixes (ps & top) Redhat #1322111
|
||||
* pgrep: warn about 15+ char name only if -f not used
|
||||
* pgrep/pkill: only match in same namespace by default merge #41
|
||||
* pidof: specify separator between pids merge #58
|
||||
* pkill: Return 0 only if we can kill process Debian #852758
|
||||
* pmap: fix duplicate output line under '-x' option Redhat #1374061
|
||||
* ps: avoid eip/esp address truncations Debian #846361
|
||||
* ps: recognizes SCHED_DEADLINE as valid CPU scheduler
|
||||
* ps: display NUMA node under which a thread ran issue #58
|
||||
* ps: Add seconds display for cputime and time merge #43
|
||||
* ps: Add LUID field merge #57 Redhat #1518986
|
||||
* sysctl: Permit empty string for value issue #74
|
||||
* sysctl: Don't segv when file not available issue #76
|
||||
* sysctl: Read and write large buffers merge #56
|
||||
* top: add config file support for XDG specification
|
||||
* top: eliminated minor libnuma memory leak
|
||||
* top: show fewer memory decimal places (configurable) issue #50
|
||||
* top: provide command line switch for memory scaling Redhat #1034466, issue #53
|
||||
* top: provide command line switch for CPU States issue #55
|
||||
* top: provides more accurate cpu usage at startup Redhat #1182327
|
||||
* top: display NUMA node under which a thread ran issue #58
|
||||
* top: fix argument parsing quirk resulting in SEGV Redhat #1450429
|
||||
* top: delay interval accepts non-locale radix point Redhat #1182248
|
||||
* top: address a wishlist man page NLS suggestion Debian #865689
|
||||
* top: fix potential distortion in 'Mem' graph display issue #64
|
||||
* top: provide proper multi-byte string handling issue #68
|
||||
* top: startup defaults are fully customizable Redhat #1153049, #1499410, issues #6, #78
|
||||
* see man page 6c. SYSTEM Configuration File
|
||||
* watch: define HOST_NAME_MAX where not defined Debian #830734
|
||||
* vmstat: Fix alignment for disk partition format issue #69
|
||||
* watch: Support ANSI 39,49 reset sequences issue #73
|
||||
- Removed now patch now upstream
|
||||
0001-Preload-sysctl-lines-even-if-longer-than-stdio-buffe.patch
|
||||
0002-Add-flexible-buffered-I-O-based-on-fopencookie-3.patch
|
||||
0003-Use-new-standard-I-O-for-reading-writing-sysctl-valu.patch
|
||||
procps-ng-3.3.12-stable_secret.patch
|
||||
procps-ng-3.3.12-strtod.patch
|
||||
procps-ng-3.3.12-sysctl-a.patch
|
||||
procps-ng-3.3.12-sysctl-iobuf.patch
|
||||
- Port patches
|
||||
procps-ng-3.3.10-bnc634071_procstat2.diff
|
||||
procps-ng-3.3.10-errno.patch
|
||||
procps-ng-3.3.10-fdleak.dif
|
||||
procps-ng-3.3.10-integer-overflow.patch
|
||||
procps-ng-3.3.10-large_pcpu.patch
|
||||
procps-ng-3.3.10-slab.patch
|
||||
procps-ng-3.3.11-pmap4suse.patch
|
||||
procps-ng-3.3.8-accuracy.dif
|
||||
procps-ng-3.3.8-bnc634840.patch
|
||||
procps-ng-3.3.8-ignore-scan_unevictable_pages.patch
|
||||
procps-ng-3.3.8-petabytes.patch
|
||||
procps-ng-3.3.8-readeof.patch
|
||||
procps-ng-3.3.8-tinfo.dif
|
||||
procps-ng-3.3.8-top.1.diff
|
||||
procps-v3.3.3-read-sysctls-also-from-boot-sysctl.conf-kernelversion.diff
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Feb 22 15:10:44 UTC 2018 - fvogt@suse.com
|
||||
|
||||
|
36
procps.spec
36
procps.spec
@ -21,15 +21,15 @@
|
||||
%bcond_with bin2usr
|
||||
%bcond_with pidof
|
||||
Name: procps
|
||||
Version: 3.3.12
|
||||
Version: 3.3.13
|
||||
Release: 0
|
||||
Summary: The ps utilities for /proc
|
||||
#Alternate: https://gitlab.com/procps-ng/procps/repository/archive.tar.bz2?ref=v3.3.12
|
||||
#Alternate: https://gitlab.com/procps-ng/procps/repository/archive.tar.bz2?ref=v3.3.13
|
||||
#Also: http://gitorious.org/procps/
|
||||
License: GPL-2.0+ and LGPL-2.1+
|
||||
License: GPL-2.0-or-later AND LGPL-2.1-or-later
|
||||
Group: System/Monitoring
|
||||
Url: http://sf.net/projects/procps-ng/
|
||||
Source: http://downloads.sourceforge.net/project/procps-ng/Production/procps-ng-3.3.12.tar.xz
|
||||
Source: http://downloads.sourceforge.net/project/procps-ng/Production/procps-ng-3.3.13.tar.xz
|
||||
Source2: boot.sysctl
|
||||
Patch0: procps-ng-3.3.9-watch.patch
|
||||
Patch1: procps-v3.3.3-ia64.diff
|
||||
@ -51,25 +51,12 @@ Patch20: procps-ng-3.3.8-tinfo.dif
|
||||
Patch21: procps-v3.3.3-pwdx.patch
|
||||
# PATCH-FIX-OPENSUSE -- trifle rest of the old terabyte patch
|
||||
Patch28: procps-ng-3.3.8-vmstat-terabyte.dif
|
||||
# PATCH-FIX-SUSE -- Avoid error due missed declaration
|
||||
Patch30: procps-ng-3.3.12-strtod.patch
|
||||
# PATCH-FIX-SUSE -- Ignore scan_unevictable_pages in sysctl
|
||||
Patch31: procps-ng-3.3.8-ignore-scan_unevictable_pages.patch
|
||||
# PATCH-FIX-SUSE -- Avoid errno set by setlocale()
|
||||
Patch32: procps-ng-3.3.10-errno.patch
|
||||
# PATCH-FEATURE-SUSE -- Let upstream pmap behave simialr to old suse pmap
|
||||
Patch33: procps-ng-3.3.11-pmap4suse.patch
|
||||
# PATCH-FIX-UPSTREAM -- Allow content lines below /proc/sys longer than 1024 characters
|
||||
Patch34: procps-ng-3.3.12-sysctl-a.patch
|
||||
# PATCH-ENHANCE-SUSE -- Increase buffer on reading/writing /proc/sys values
|
||||
Patch35: procps-ng-3.3.12-sysctl-iobuf.patch
|
||||
# PATCH-FIX-SUSE -- Ignore EIO on reading unset value of e.g. /proc/sys/net/ipv6/conf/all/stable_secret
|
||||
Patch36: procps-ng-3.3.12-stable_secret.patch
|
||||
# PATCH-ENHANCE-SUSE -- Use increased buffer on writing /proc/sys/net/ipv4/ip_local_reserved_ports
|
||||
#Patch37: procps-ng-3.3.12-sysctl-iobuf-write.patch
|
||||
Patch37: 0001-Preload-sysctl-lines-even-if-longer-than-stdio-buffe.patch
|
||||
Patch38: 0002-Add-flexible-buffered-I-O-based-on-fopencookie-3.patch
|
||||
Patch39: 0003-Use-new-standard-I-O-for-reading-writing-sysctl-valu.patch
|
||||
|
||||
BuildRequires: automake
|
||||
BuildRequires: dejagnu
|
||||
@ -114,7 +101,7 @@ about processes, memory, paging, block I/O, traps, and CPU activity.
|
||||
|
||||
%package devel
|
||||
Summary: Include Files and Libraries mandatory for Development
|
||||
License: GPL-2.0+ and LGPL-2.1+
|
||||
License: GPL-2.0-or-later AND LGPL-2.1-or-later
|
||||
Group: Development/Libraries/C and C++
|
||||
Requires: %{libname} = %{version}
|
||||
|
||||
@ -124,7 +111,7 @@ to develop applications that require these.
|
||||
|
||||
%package -n %{libname}
|
||||
Summary: The procps library
|
||||
License: LGPL-2.1+
|
||||
License: LGPL-2.1-or-later
|
||||
Group: System/Libraries
|
||||
|
||||
%description -n %{libname}
|
||||
@ -152,16 +139,9 @@ the process information pseudo-file system,
|
||||
%patch20
|
||||
%patch21
|
||||
%patch28
|
||||
%patch30
|
||||
%patch31 -p1
|
||||
%patch32
|
||||
%patch33
|
||||
%patch34
|
||||
%patch35
|
||||
%patch36
|
||||
%patch37 -b .0001
|
||||
%patch38 -b .0002
|
||||
%patch39 -b .0003
|
||||
|
||||
%build
|
||||
#
|
||||
@ -383,6 +363,7 @@ test $error = no || exit 1
|
||||
%endif
|
||||
%{_mandir}/man1/pkill.1%{ext_man}
|
||||
%{_mandir}/man1/pmap.1%{ext_man}
|
||||
%{_mandir}/man1/procps.1%{ext_man}
|
||||
%{_mandir}/man1/ps.1%{ext_man}
|
||||
%{_mandir}/man1/pwdx.1%{ext_man}
|
||||
%{_mandir}/man1/skill.1%{ext_man}
|
||||
@ -402,7 +383,7 @@ test $error = no || exit 1
|
||||
%{_includedir}/proc/alloc.h
|
||||
%{_includedir}/proc/devname.h
|
||||
%{_includedir}/proc/escape.h
|
||||
%{_includedir}/proc/procio.h
|
||||
%{_includedir}/proc/numa.h
|
||||
%{_includedir}/proc/procps.h
|
||||
%{_includedir}/proc/pwcache.h
|
||||
%{_includedir}/proc/readproc.h
|
||||
@ -414,7 +395,6 @@ test $error = no || exit 1
|
||||
%{_includedir}/proc/whattime.h
|
||||
%{_libdir}/libprocps.so
|
||||
%{_libdir}/pkgconfig/libprocps.pc
|
||||
%{_mandir}/man3/procio.3%{ext_man}
|
||||
%{_mandir}/man3/openproc.3%{ext_man}
|
||||
%{_mandir}/man3/readproc.3%{ext_man}
|
||||
%{_mandir}/man3/readproctab.3%{ext_man}
|
||||
|
Loading…
Reference in New Issue
Block a user