Changeset View
Changeset View
Standalone View
Standalone View
usr.bin/posixshmcontrol/posixshmcontrol.c
Show First 20 Lines • Show All 398 Lines • ▼ Show 20 Lines | |||||||||
} | } | ||||||||
static int | static int | ||||||||
stat_one_shm(const char *path, bool hsize, bool uname) | 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; | |||||||||
markjUnsubmitted Done Inline Actions
markj: | |||||||||
bool largepage; | |||||||||
fd = shm_open(path, O_RDONLY, 0); | fd = shm_open(path, O_RDONLY, 0); | ||||||||
if (fd == -1) { | if (fd == -1) { | ||||||||
warn("open %s", path); | warn("open %s", path); | ||||||||
return (1); | return (1); | ||||||||
} | } | ||||||||
ret = 0; | ret = 0; | ||||||||
error = fstat(fd, &st); | error = fstat(fd, &st); | ||||||||
Show All 22 Lines | if (error == -1) { | ||||||||
printf("atime\t%ld.%09ld\n", (long)st.st_atime, | printf("atime\t%ld.%09ld\n", (long)st.st_atime, | ||||||||
(long)st.st_atim.tv_nsec); | (long)st.st_atim.tv_nsec); | ||||||||
printf("mtime\t%ld.%09ld\n", (long)st.st_mtime, | printf("mtime\t%ld.%09ld\n", (long)st.st_mtime, | ||||||||
(long)st.st_mtim.tv_nsec); | (long)st.st_mtim.tv_nsec); | ||||||||
printf("ctime\t%ld.%09ld\n", (long)st.st_ctime, | printf("ctime\t%ld.%09ld\n", (long)st.st_ctime, | ||||||||
(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; | |||||||||
Done Inline ActionsIt looks like this test is inverted. error == -1 && errno == ENOTTY means that it's not a largepage object. markj: It looks like this test is inverted. `error == -1 && errno == ENOTTY` means that it's not a… | |||||||||
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); | ||||||||
} | } | ||||||||
static int | static int | ||||||||
stat_shm(int argc, char **argv) | stat_shm(int argc, char **argv) | ||||||||
{ | { | ||||||||
▲ Show 20 Lines • Show All 132 Lines • Show Last 20 Lines |