2023-11-19 20:21:56 -05:00
|
|
|
// Copyright 2023 The LightningBolt Authors
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
2023-11-19 06:19:15 -05:00
|
|
|
#include <base/MmapFile.hpp>
|
|
|
|
|
|
|
|
#ifdef __linux__
|
|
|
|
#include "MmapFile.linux.cpp"
|
|
|
|
#else
|
|
|
|
#error Invalid platform
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace lightningbolt {
|
|
|
|
|
|
|
|
MmapFile::MmapFile() : impl(std::make_unique<Impl>()) {
|
|
|
|
}
|
|
|
|
|
|
|
|
MmapFile::~MmapFile() = default;
|
|
|
|
|
|
|
|
ErrorOr<void> MmapFile::Open(const fs::path& path) {
|
|
|
|
return impl->Open(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MmapFile::Close() {
|
|
|
|
return impl->Close();
|
|
|
|
}
|
|
|
|
|
|
|
|
u8* MmapFile::GetMapping() const {
|
|
|
|
return impl->GetMapping();
|
|
|
|
}
|
|
|
|
usize MmapFile::GetMappingSize() const {
|
|
|
|
return impl->GetMappingSize();
|
|
|
|
}
|
|
|
|
|
2023-11-19 20:24:40 -05:00
|
|
|
} // namespace lightningbolt
|