Return long long from get_zram_mem_used()
Commit 187a6aeb112ecbf85387a21ea75cf6beb3f9fc76 replaced atoll() with
fscanf("%ld"). Though unlikely, there could theoretically be 32-bit
devices with >2GB zram where the type difference matters.
Bug: 25951511
Change-Id: I902e27a214038fea1396185ef9a521316b0009f9
Signed-off-by: Greg Hackmann <ghackmann@google.com>
diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp
index 71f881e..2488111 100644
--- a/core/jni/android_os_Debug.cpp
+++ b/core/jni/android_os_Debug.cpp
@@ -595,14 +595,14 @@
MEMINFO_COUNT
};
-static long get_zram_mem_used()
+static long long get_zram_mem_used()
{
#define ZRAM_SYSFS "/sys/block/zram0/"
FILE *f = fopen(ZRAM_SYSFS "mm_stat", "r");
if (f) {
- long mem_used_total = 0;
+ long long mem_used_total = 0;
- int matched = fscanf(f, "%*d %*d %ld %*d %*d %*d %*d", &mem_used_total);
+ int matched = fscanf(f, "%*d %*d %lld %*d %*d %*d %*d", &mem_used_total);
if (matched != 1)
ALOGW("failed to parse " ZRAM_SYSFS "mm_stat");
@@ -612,9 +612,9 @@
f = fopen(ZRAM_SYSFS "mem_used_total", "r");
if (f) {
- long mem_used_total = 0;
+ long long mem_used_total = 0;
- int matched = fscanf(f, "%ld", &mem_used_total);
+ int matched = fscanf(f, "%lld", &mem_used_total);
if (matched != 1)
ALOGW("failed to parse " ZRAM_SYSFS "mem_used_total");