3 #include <unordered_map>
14 auto it = file_mem_entries_.find(addr);
15 if (it != file_mem_entries_.end()) {
18 common::die(
"File pointer %p was passed but not allocated by Itoyori", addr);
22 void*
create(
const std::string& fpath,
bool mlock) {
23 entry e(fpath, mlock);
25 ITYR_CHECK(file_mem_entries_.find(e.vm.addr()) == file_mem_entries_.end());
26 void* addr = e.vm.addr();
33 auto it = file_mem_entries_.find(addr);
34 if (it != file_mem_entries_.end()) {
35 file_mem_entries_.erase(it);
37 common::die(
"File pointer %p was passed but not allocated by Itoyori", addr);
44 entry(
const std::string& fpath,
bool mlock)
47 fm.map_to_vm(vm.addr(), vm.size(), 0);
49 if (::mlock2(vm.addr(), vm.size(), MLOCK_ONFAULT) == -1) {
51 common::die(
"mlock2() failed");
57 common::virtual_mem vm;
60 std::unordered_map<void*, entry> file_mem_entries_;
Definition: file_mem_manager.hpp:11
void destroy(void *addr)
Definition: file_mem_manager.hpp:32
void * create(const std::string &fpath, bool mlock)
Definition: file_mem_manager.hpp:22
file_mem & get(void *addr)
Definition: file_mem_manager.hpp:13
Definition: file_mem.hpp:12
#define ITYR_CHECK(cond)
Definition: util.hpp:48
std::size_t get_page_size()
Definition: util.hpp:170
virtual_mem reserve_same_vm_coll(std::size_t size, std::size_t alignment=alignof(max_align_t))
Definition: virtual_mem.hpp:170
Definition: file_mem_manager.hpp:9
constexpr auto size(const checkout_span< T, Mode > &cs) noexcept
Definition: checkout_span.hpp:178
ForwardIteratorD move(const ExecutionPolicy &policy, ForwardIterator1 first1, ForwardIterator1 last1, ForwardIteratorD first_d)
Move a range to another.
Definition: parallel_loop.hpp:934