summaryrefslogtreecommitdiff
path: root/ifpps.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2013-05-25 17:36:13 +0200
committerTobias Klauser <tklauser@distanz.ch>2013-05-25 17:36:13 +0200
commitdca4a1c8eaf1c2d20a6a9b5644603a15283b4df7 (patch)
treed9a64b643b49162bc048965d4addfdee9defb90c /ifpps.c
parent3f15c5bdf0e8259cb836243447fd4f6b4b77b18c (diff)
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 <tklauser@distanz.ch>
Diffstat (limited to 'ifpps.c')
-rw-r--r--ifpps.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ifpps.c b/ifpps.c
index 75cc3e6..4348261 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));