git: 376418fcbd4e - stable/13 - posixshmcontrol(1): for regular shmfd, report used pages number
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 20 Jan 2023 03:23:36 UTC
The branch stable/13 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=376418fcbd4e933f7dc3fbc687a2814699fbb7cf
commit 376418fcbd4e933f7dc3fbc687a2814699fbb7cf
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-11-23 22:01:05 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-01-20 03:20:11 +0000
posixshmcontrol(1): for regular shmfd, report used pages number
Tested by: pho
(cherry picked from commit 1bbc5101348b9ca23cef6bde6c22751e69e8cf91)
---
usr.bin/posixshmcontrol/posixshmcontrol.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/usr.bin/posixshmcontrol/posixshmcontrol.c b/usr.bin/posixshmcontrol/posixshmcontrol.c
index f64fcd3dd663..3b9d1dc256c3 100644
--- a/usr.bin/posixshmcontrol/posixshmcontrol.c
+++ b/usr.bin/posixshmcontrol/posixshmcontrol.c
@@ -404,6 +404,8 @@ stat_one_shm(const char *path, bool hsize, bool uname)
char sizebuf[8];
struct stat st;
int error, fd, ret;
+ struct shm_largepage_conf conf_dummy;
+ bool largepage;
fd = shm_open(path, O_RDONLY, 0);
if (fd == -1) {
@@ -442,9 +444,13 @@ stat_one_shm(const char *path, bool hsize, bool uname)
(long)st.st_ctim.tv_nsec);
printf("birth\t%ld.%09ld\n", (long)st.st_birthtim.tv_sec,
(long)st.st_birthtim.tv_nsec);
- if (st.st_blocks != 0)
+ error = ioctl(fd, FIOGSHMLPGCNF, &conf_dummy);
+ largepage = error == 0;
+ if (st.st_blocks != 0 && largepage)
printf("pagesz\t%jd\n", roundup((uintmax_t)st.st_size,
PAGE_SIZE) / st.st_blocks);
+ else
+ printf("pages\t%jd\n", st.st_blocks);
}
close(fd);
return (ret);