From eada1d62c72d3eba0a26a12ae2b9821c1f199037 Mon Sep 17 00:00:00 2001 From: Peter Hercek Date: Wed, 13 Jul 2011 19:35:59 +0200 Subject: [PATCH] mem_vsize and mem_res need to be 64 bit (sf.net #3366272) if process allocated 4GiB or more of ram then {top mem_vsize} did not report correct number Signed-off-by: Pavel Labath --- src/top.c | 2 +- src/top.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/top.c b/src/top.c index 29b169be..c99987d3 100644 --- a/src/top.c +++ b/src/top.c @@ -237,7 +237,7 @@ static int process_parse_stat(struct process *process) strncpy(procname, lparen + 1, rc); procname[rc] = '\0'; rc = sscanf(rparen + 1, "%3s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %lu " - "%lu %*s %*s %*s %d %*s %*s %*s %u %u", state, &process->user_time, + "%lu %*s %*s %*s %d %*s %*s %*s %llu %llu", state, &process->user_time, &process->kernel_time, &nice_val, &process->vsize, &process->rss); if (rc < 6) { NORM_ERR("scaning data for %s failed, got only %d fields", procname, rc); diff --git a/src/top.h b/src/top.h index 51bf9364..720ea2a7 100644 --- a/src/top.h +++ b/src/top.h @@ -111,8 +111,8 @@ struct process { unsigned long previous_user_time; unsigned long previous_kernel_time; unsigned long total_cpu_time; - unsigned int vsize; - unsigned int rss; + unsigned long long vsize; + unsigned long long rss; #ifdef IOSTATS unsigned long long read_bytes; unsigned long long previous_read_bytes;