summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c3ded5c)
raw | patch | inline | side by side (parent: c3ded5c)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 16 Feb 2009 12:34:44 +0000 (13:34 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 16 Feb 2009 12:34:44 +0000 (13:34 +0100) |
src/swap.c | patch | blob | history |
diff --git a/src/swap.c b/src/swap.c
index bcfe4a2228408ac7327fcc860523ae89f5a467e2..ca3b5efa342da9bc66abaf78513699a655966b8b 100644 (file)
--- a/src/swap.c
+++ b/src/swap.c
}
#if defined(DEV_BSIZE) && (DEV_BSIZE > 0)
-# define C_SWAP_BLOCK_SIZE DEV_BSIZE
+# define C_SWAP_BLOCK_SIZE ((uint64_t) DEV_BSIZE)
#else
-# define C_SWAP_BLOCK_SIZE 512
+# define C_SWAP_BLOCK_SIZE ((uint64_t) 512)
#endif
for (i = 0; i < swap_num; i++)
if ((swap_entries[i].se_flags & SWF_ENABLE) == 0)
continue;
- used += swap_entries[i].se_inuse * C_SWAP_BLOCK_SIZE;
- total += swap_entries[i].se_nblks * C_SWAP_BLOCK_SIZE;
+ used += ((uint64_t) swap_entries[i].se_inuse)
+ * C_SWAP_BLOCK_SIZE;
+ total += ((uint64_t) swap_entries[i].se_nblks)
+ * C_SWAP_BLOCK_SIZE;
+ }
+
+ if (total < used)
+ {
+ ERROR ("swap plugin: Total swap space (%"PRIu64") "
+ "is less than used swap space (%"PRIu64").",
+ total, used);
+ return (-1);
}
swap_submit ("used", (gauge_t) used);