19 #include <sys/fcntl.h>
33 int err = fstat(fd, &buf);
39 auto ptr = mmap(
nullptr, sz, PROT_WRITE | PROT_READ, MAP_SHARED, fd, 0);
40 CHECK(ptr != reinterpret_cast<void*>(-1));
43 madvise(ptr, sz, MADV_RANDOM | MADV_WILLNEED | MADV_HUGEPAGE);
45 madvise(ptr, sz, MADV_RANDOM | MADV_WILLNEED);
55 int msync(
void* addr,
size_t length,
bool async) {
64 int open(
const char* path,
int flags,
int mode) {
std::string filename(char const *path)
int open(const char *path, int flags, int mode)
void * checked_mmap(const int fd, const size_t sz)
::FILE * fopen(const char *filename, const char *mode)
int msync(void *addr, size_t length, bool async)
void checked_munmap(void *addr, size_t length)
size_t file_size(const int fd)