[git commit] nmeter: increase maximum /proc file size (needed for large machines)
Denys Vlasenko
vda.linux at googlemail.com
Tue Jan 24 11:47:32 UTC 2023
commit: https://git.busybox.net/busybox/commit/?id=c2739e11dee92770839ac9b2dbf020459baec7b9
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
function old new delta
get_file 185 201 +16
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
procps/nmeter.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/procps/nmeter.c b/procps/nmeter.c
index 68e6f3325..e52c868df 100644
--- a/procps/nmeter.c
+++ b/procps/nmeter.c
@@ -59,9 +59,9 @@
typedef unsigned long long ullong;
-enum { /* Preferably use powers of 2 */
+enum {
PROC_MIN_FILE_SIZE = 256,
- PROC_MAX_FILE_SIZE = 16 * 1024,
+ PROC_MAX_FILE_SIZE = 64 * 1024, /* 16k was a bit too small for a 128-CPU machine */
};
typedef struct proc_file {
@@ -176,7 +176,10 @@ static void readfile_z(proc_file *pf, const char* fname)
close(fd);
if (rdsz > 0) {
if (rdsz == sz-1 && sz < PROC_MAX_FILE_SIZE) {
- sz *= 2;
+ if (sz < 4 * 1024)
+ sz *= 2;
+ else
+ sz += 4 * 1024;
buf = xrealloc(buf, sz);
goto again;
}
More information about the busybox-cvs
mailing list