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);
64 int open(
const char* path,
int flags,
int mode) {
76 ::FILE*
popen(
const char* command,
const char*
type) {
84 int32_t
ftruncate(
const int32_t fd, int64_t length) {
int32_t pclose(::FILE *fh)
::FILE * popen(const char *command, const char *type)
future< Result > async(Fn &&fn, Args &&...args)
int open(const char *path, int flags, int mode)
::FILE * fopen(const char *filename, const char *mode)
int msync(void *addr, size_t length, bool async)
std::string filename(char const *path)
void checked_munmap(void *addr, size_t length)
int32_t ftruncate(const int32_t fd, int64_t length)
size_t file_size(const int fd)
void * checked_mmap(const int fd, const size_t sz)