54 std::initializer_list<Protection> protection) {
59 struct stat stat_buffer = {};
61 if (::fstat(handle.
get(), &stat_buffer) != 0) {
65 if (stat_buffer.st_size == 0) {
70 const auto is_writable =
IsWritable(protection);
74 is_writable ? MAP_SHARED : MAP_PRIVATE, handle.
get(), 0);
76 if (mapping == MAP_FAILED) {
80 mapping_ =
static_cast<uint8_t*
>(mapping);
81 size_ = stat_buffer.st_size;
84 mutable_mapping_ = mapping_;