diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2025-02-28 00:00:47 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2025-02-28 00:00:48 +0100 |
commit | 1d7bfa53e29b52afb43d02eed126a37374fa3be9 (patch) | |
tree | 171c5c9ca45b0aa4493879f5938609c23a6b73db | |
parent | 9e583f3dcfe5a48e19033362847791c9004574f2 (diff) |
procfs: Fix meminfo computation
For >4G size we need to force 64bit computation on 32bit systems.
-rw-r--r-- | procfs/rootdir.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/procfs/rootdir.c b/procfs/rootdir.c index 2c0d46f3..92ae32f0 100644 --- a/procfs/rootdir.c +++ b/procfs/rootdir.c @@ -313,24 +313,24 @@ rootdir_gc_meminfo (void *hook, char **contents, ssize_t *contents_len) assert_backtrace (cnt == HOST_BASIC_INFO_COUNT); fprintf (m, - "MemTotal: %14lu kB\n" - "MemFree: %14lu kB\n" - "Buffers: %14lu kB\n" - "Cached: %14lu kB\n" - "Active: %14lu kB\n" - "Inactive: %14lu kB\n" - "Mlocked: %14lu kB\n" + "MemTotal: %14llu kB\n" + "MemFree: %14llu kB\n" + "Buffers: %14llu kB\n" + "Cached: %14llu kB\n" + "Active: %14llu kB\n" + "Inactive: %14llu kB\n" + "Mlocked: %14llu kB\n" , - (long unsigned) (vmstats.free_count + - vmstats.active_count + - vmstats.inactive_count + - vmstats.wire_count) * PAGE_SIZE / 1024, - (long unsigned) vmstats.free_count * PAGE_SIZE / 1024, + (long long unsigned) (vmstats.free_count + + vmstats.active_count + + vmstats.inactive_count + + vmstats.wire_count) * PAGE_SIZE / 1024, + (long long unsigned) vmstats.free_count * PAGE_SIZE / 1024, 0UL, - (long unsigned) cache_stats.cache_count * PAGE_SIZE / 1024, - (long unsigned) vmstats.active_count * PAGE_SIZE / 1024, - (long unsigned) vmstats.inactive_count * PAGE_SIZE / 1024, - (long unsigned) vmstats.wire_count * PAGE_SIZE / 1024); + (long long unsigned) cache_stats.cache_count * PAGE_SIZE / 1024, + (long long unsigned) vmstats.active_count * PAGE_SIZE / 1024, + (long long unsigned) vmstats.inactive_count * PAGE_SIZE / 1024, + (long long unsigned) vmstats.wire_count * PAGE_SIZE / 1024); err = get_swapinfo (&swap); if (err) |