diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2015-01-15 12:32:36 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-01-15 12:42:11 +0100 |
commit | 1791dc06ea8458bb54e723a320b0ee87098ab498 (patch) | |
tree | 55083b3fa4ab5db1583bee3df556908095baa7d1 | |
parent | c48b19bbe127551ffb2b6d02b33ef78865341cfc (diff) | |
download | unitd-1791dc06ea8458bb54e723a320b0ee87098ab498.tar unitd-1791dc06ea8458bb54e723a320b0ee87098ab498.zip |
system: increase memory field sizes to 64bit
On an Alix APU board with 4GB of available ram, the total memory is reported
as "-179417088" bytes. Increase the ubus field sizes to 64bit integers in
order to avoid overflows.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
-rw-r--r-- | system.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -206,15 +206,15 @@ static int system_info(struct ubus_context *ctx, struct ubus_object *obj, blobmsg_close_array(&b, c); c = blobmsg_open_table(&b, "memory"); - blobmsg_add_u32(&b, "total", info.mem_unit * info.totalram); - blobmsg_add_u32(&b, "free", info.mem_unit * info.freeram); - blobmsg_add_u32(&b, "shared", info.mem_unit * info.sharedram); - blobmsg_add_u32(&b, "buffered", info.mem_unit * info.bufferram); + blobmsg_add_u64(&b, "total", info.mem_unit * info.totalram); + blobmsg_add_u64(&b, "free", info.mem_unit * info.freeram); + blobmsg_add_u64(&b, "shared", info.mem_unit * info.sharedram); + blobmsg_add_u64(&b, "buffered", info.mem_unit * info.bufferram); blobmsg_close_table(&b, c); c = blobmsg_open_table(&b, "swap"); - blobmsg_add_u32(&b, "total", info.mem_unit * info.totalswap); - blobmsg_add_u32(&b, "free", info.mem_unit * info.freeswap); + blobmsg_add_u64(&b, "total", info.mem_unit * info.totalswap); + blobmsg_add_u64(&b, "free", info.mem_unit * info.freeswap); blobmsg_close_table(&b, c); ubus_send_reply(ctx, req, b.head); |