procps/procps-ng-3.3.8-readeof.patch

67 lines
2.8 KiB
Diff
Raw Normal View History

Accepting request 418010 from Base:System - Avoid fillup and insserv on modern systems (bsc#992845) - Use test suite but avoid the w command due dummy utmp * This requires dejagnu for the runtest command * This requires screen to be able to provide a tty - Add patch procps-ng-3.3.12-strtod.patch to fix missed extern declaration of strtod_nol_or_err() - Update to procps-ng-3.3.12 * libprocps API 6:0:0 * build: formerly optional --enable-oomem unconditional * free: man document rewritten for shared Debian #755233 * free: interpret intervals in non-locale way Debian #692113 * kill: report error if cannot kill process Debian #733172 * library: refine calculation of 'cached' memory * library: find tty quicker Debian #770215 * library: eliminate threads display inconsistencies Redhat #1284091 * pidof: check cmd if space found in argv0 * pmap: fixed detail parsing on long mapping lines * pmap: fix occasional incorrect memory usage values Redhat #1262864 * ps: sort by cgroup Debian #692279 * ps: display control group name with -o cgname * ps: fallback to attr/current for context Debian #786956 * ps: enabled broken 'thcount' option Redhat #1174313 * tests: conditionally add prctl Debian #816237 * top: displays the 3 new linux-4.5 RES memory fields * top: man page memory fields corrected + new narrative * top: added display of CGNAME (control group name) * top: is now more responsive to cpus brought online * top: namespace cols use suppressible zero OBS-URL: https://build.opensuse.org/request/show/418010 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/procps?expand=0&rev=99
2016-08-18 09:15:06 +02:00
---
proc/readproc.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
Accepting request 418010 from Base:System - Avoid fillup and insserv on modern systems (bsc#992845) - Use test suite but avoid the w command due dummy utmp * This requires dejagnu for the runtest command * This requires screen to be able to provide a tty - Add patch procps-ng-3.3.12-strtod.patch to fix missed extern declaration of strtod_nol_or_err() - Update to procps-ng-3.3.12 * libprocps API 6:0:0 * build: formerly optional --enable-oomem unconditional * free: man document rewritten for shared Debian #755233 * free: interpret intervals in non-locale way Debian #692113 * kill: report error if cannot kill process Debian #733172 * library: refine calculation of 'cached' memory * library: find tty quicker Debian #770215 * library: eliminate threads display inconsistencies Redhat #1284091 * pidof: check cmd if space found in argv0 * pmap: fixed detail parsing on long mapping lines * pmap: fix occasional incorrect memory usage values Redhat #1262864 * ps: sort by cgroup Debian #692279 * ps: display control group name with -o cgname * ps: fallback to attr/current for context Debian #786956 * ps: enabled broken 'thcount' option Redhat #1174313 * tests: conditionally add prctl Debian #816237 * top: displays the 3 new linux-4.5 RES memory fields * top: man page memory fields corrected + new narrative * top: added display of CGNAME (control group name) * top: is now more responsive to cpus brought online * top: namespace cols use suppressible zero OBS-URL: https://build.opensuse.org/request/show/418010 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/procps?expand=0&rev=99
2016-08-18 09:15:06 +02:00
--- proc/readproc.c
+++ proc/readproc.c 2018-06-05 08:54:06.408030693 +0000
@@ -675,7 +675,7 @@ static int file2str(const char *director
else ub->buf = xcalloc((ub->siz = buffGRW));
len = snprintf(path, sizeof path, "%s/%s", directory, what);
if (len <= 0 || (size_t)len >= sizeof path) return -1;
- if (-1 == (fd = open(path, O_RDONLY, 0))) return -1;
+ if (-1 == (fd = open(path, O_RDONLY, O_NOATIME))) return -1;
while (0 < (num = read(fd, ub->buf + tot_read, ub->siz - tot_read))) {
tot_read += num;
if (tot_read < ub->siz) break;
@@ -695,25 +695,25 @@ static int file2str(const char *director
static char** file2strvec(const char* directory, const char* what) {
char buf[2048]; /* read buf bytes at a time */
char *p, *rbuf = 0, *endbuf, **q, **ret, *strp;
- int fd, tot = 0, n, c, end_of_file = 0;
- int align;
+ int fd, c, end_of_file = 0;
+ ssize_t n, align, tot = 0;
const int len = snprintf(buf, sizeof buf, "%s/%s", directory, what);
if(len <= 0 || (size_t)len >= sizeof buf) return NULL;
- fd = open(buf, O_RDONLY, 0);
+ fd = open(buf, O_RDONLY, O_NOATIME);
if(fd==-1) return NULL;
/* read whole file into a memory buffer, allocating as we go */
while ((n = read(fd, buf, sizeof buf - 1)) >= 0) {
- if (n < (int)(sizeof buf - 1))
+ if (n < sizeof buf - 1)
end_of_file = 1;
- if (n <= 0 && tot <= 0) { /* nothing read now, nothing read before */
+ if (n <= 0 && tot <= 0) /* nothing read now, nothing read before */
break; /* process died between our open and read */
- }
+
/* ARG_LEN is our guesstimated median length of a command-line argument
or environment variable (the minimum is 1, the maximum is 131072) */
#define ARG_LEN 64
- if (tot >= INT_MAX / (ARG_LEN + (int)sizeof(char*)) * ARG_LEN - n) {
+ if (tot >= INT_MAX / (ARG_LEN + sizeof(char*)) * ARG_LEN - n) {
end_of_file = 1; /* integer overflow: null-terminate and break */
n = 0; /* but tot > 0 */
}
@@ -741,7 +741,7 @@ static char** file2strvec(const char* di
c = sizeof(char*); /* one extra for NULL term */
for (p = rbuf; p < endbuf; p++) {
if (!*p || *p == '\n') {
- if (c >= INT_MAX - (tot + (int)sizeof(char*) + align)) break;
+ if (c >= INT_MAX - (tot + sizeof(char*) + align)) break;
c += sizeof(char*);
}
if (*p == '\n')
@@ -753,7 +753,7 @@ static char** file2strvec(const char* di
q = ret = (char**) (endbuf+align); /* ==> free(*ret) to dealloc */
for (strp = p = rbuf; p < endbuf; p++) {
if (!*p) { /* NUL char implies that */
- if (c < 2 * (int)sizeof(char*)) break;
+ if (c < 2 * sizeof(char*)) break;
c -= sizeof(char*);
*q++ = strp; /* point ptrs to the strings */
strp = p+1; /* next string -> next char */