Alien-libhisto
view release on metacpan or search on metacpan
bundled/tools/src/tui_engine.c view on Meta::CPAN
int fd = -1;
if (path[0] == '/') {
fd = shm_open(path, O_RDWR, 0666);
}
if (fd < 0) {
fd = open(path, O_RDWR, 0666);
}
if (fd < 0) return false;
struct stat st;
if (fstat(fd, &st) != 0 || st.st_size < (off_t)sizeof(histo_shm_ring_t)) {
close(fd);
return false;
}
size_t total_size = (size_t)st.st_size;
void *ptr = mmap(NULL, total_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (ptr == MAP_FAILED) {
close(fd);
return false;
}
( run in 0.392 second using v1.01-cache-2.11-cpan-16aabcbfbcb )