posixshmcontrol(1): for regular shmfd, report used pages number
Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37097
This commit is contained in:
parent
0919f29d91
commit
1bbc510134
@ -404,6 +404,8 @@ stat_one_shm(const char *path, bool hsize, bool uname)
|
|||||||
char sizebuf[8];
|
char sizebuf[8];
|
||||||
struct stat st;
|
struct stat st;
|
||||||
int error, fd, ret;
|
int error, fd, ret;
|
||||||
|
struct shm_largepage_conf conf_dummy;
|
||||||
|
bool largepage;
|
||||||
|
|
||||||
fd = shm_open(path, O_RDONLY, 0);
|
fd = shm_open(path, O_RDONLY, 0);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
@ -442,9 +444,13 @@ stat_one_shm(const char *path, bool hsize, bool uname)
|
|||||||
(long)st.st_ctim.tv_nsec);
|
(long)st.st_ctim.tv_nsec);
|
||||||
printf("birth\t%ld.%09ld\n", (long)st.st_birthtim.tv_sec,
|
printf("birth\t%ld.%09ld\n", (long)st.st_birthtim.tv_sec,
|
||||||
(long)st.st_birthtim.tv_nsec);
|
(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,
|
printf("pagesz\t%jd\n", roundup((uintmax_t)st.st_size,
|
||||||
PAGE_SIZE) / st.st_blocks);
|
PAGE_SIZE) / st.st_blocks);
|
||||||
|
else
|
||||||
|
printf("pages\t%jd\n", st.st_blocks);
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
return (ret);
|
return (ret);
|
||||||
|
Loading…
Reference in New Issue
Block a user