about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--mincore.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mincore.c b/mincore.c
index c6915f1..6b8b0e2 100644
--- a/mincore.c
+++ b/mincore.c
@@ -9,6 +9,8 @@ static void mincore_stats(const char *path)
         size_t map_len;
         int fd;
         size_t i;
+        static const char *fmt = sizeof(void *) == 8 ?
+                                 "%s: %016lu %x\n": "%s: %08lu %x\n";
 
         if ((fd = open(path, O_RDONLY|O_NOATIME)) < 0) {
                 fprintf(stderr, "%s: open(): %s\n", path, strerror(errno));
@@ -42,9 +44,7 @@ static void mincore_stats(const char *path)
         }
 
         for (i = 0; i < vec_len; ++i)
-                printf("%s: [%08lu] %x\n",
-                       path, (unsigned long)i,
-                       (vec[i]));
+                printf(fmt, path, (unsigned long)(page_size() * i), vec[i]);
 err_munmap:
         munmap(map, map_len);
 err_free: