We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0f7b340 commit 4139165Copy full SHA for 4139165
meminfo.c
@@ -56,12 +56,15 @@ static long available_guesstimate(const char* buf)
56
meminfo_t parse_meminfo()
57
{
58
static FILE* fd;
59
+ // On Linux 5.3, "wc -c /proc/meminfo" counts 1391 bytes.
60
+ // 8192 should be enough for the foreseeable future.
61
static char buf[8192];
62
static int guesstimate_warned = 0;
63
meminfo_t m;
64
65
if (fd == NULL)
- fd = fopen("/proc/meminfo", "r");
66
+ // main() makes sure that we are in /proc
67
+ fd = fopen("meminfo", "r");
68
if (fd == NULL) {
69
fatal(102, "could not open /proc/meminfo: %s\n", strerror(errno));
70
}
0 commit comments