From dca4a1c8eaf1c2d20a6a9b5644603a15283b4df7 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Sat, 25 May 2013 17:36:13 +0200 Subject: [PATCH] ifpps: Convert mem_free/mem_total members of struct ifstat to uint64_t Memory usage can never be negative, so make these members unsigned. Signed-off-by: Tobias Klauser --- ifpps.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ifpps.c b/ifpps.c index 75cc3e63..43482613 100644 --- a/ifpps.c +++ b/ifpps.c @@ -35,7 +35,8 @@ struct ifstat { long long unsigned int tx_fifo, tx_colls, tx_carrier; long long unsigned int irqs[MAX_CPUS], irqs_srx[MAX_CPUS], irqs_stx[MAX_CPUS]; int64_t cpu_user[MAX_CPUS], cpu_nice[MAX_CPUS], cpu_sys[MAX_CPUS]; - int64_t cpu_idle[MAX_CPUS], cpu_iow[MAX_CPUS], mem_free, mem_total; + int64_t cpu_idle[MAX_CPUS], cpu_iow[MAX_CPUS]; + uint64_t mem_free, mem_total; uint32_t irq_nr, procs_run, procs_iow, cswitch, forks; struct wifi_stat wifi; }; @@ -296,10 +297,10 @@ static int stats_proc_memory(struct ifstat *stats) if ((ptr = strstr(buff, "MemTotal:"))) { ptr += strlen("MemTotal:"); - stats->mem_total = strtol(ptr, &ptr, 10); + stats->mem_total = strtoul(ptr, &ptr, 10); } else if ((ptr = strstr(buff, "MemFree:"))) { ptr += strlen("MemFree:"); - stats->mem_free = strtol(ptr, &ptr, 10); + stats->mem_free = strtoul(ptr, &ptr, 10); } memset(buff, 0, sizeof(buff)); -- 2.11.4.GIT