diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-05-09 20:52:55 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-05-09 20:52:55 -0700 |
commit | a175bb9be830984b6ac54bbc87551dffa3354190 (patch) | |
tree | e79a8ee85508ccd1eb2ffb081a58eec4e958304d | |
parent | ac8967f99c74b6725e5e39a9010d8a3b0ee8d1cb (diff) | |
download | pcu-a175bb9be830984b6ac54bbc87551dffa3354190.tar.gz |
mincore: show byte offset instead of page offset
The page offset is architecture and kernel-dependent, whereas the byte offset is universally understood.
-rw-r--r-- | mincore.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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: |