diff --git a/include/fls/io/mmap.hpp b/include/fls/io/mmap.hpp index 9461037..fbe4c31 100644 --- a/include/fls/io/mmap.hpp +++ b/include/fls/io/mmap.hpp @@ -7,10 +7,6 @@ namespace fastlanes { class Mmap { public: - static std::byte* Resize(bsz_t bsz, int& fd); - template - static T* Resize(bsz_t bsz, int& fd); - static void Close(void* p, bsz_t bsz, int& fd); }; } // namespace fastlanes diff --git a/src/io/mmap.cpp b/src/io/mmap.cpp index f2b8183..e5a52f7 100644 --- a/src/io/mmap.cpp +++ b/src/io/mmap.cpp @@ -1,35 +1,6 @@ #include "fls/io/mmap.hpp" -#include -#include -#if defined(_WIN32) -#include // For Windows memory-mapping -#define open _open -#define close _close -#else -#include // For POSIX memory-mapping -#endif -#include -#include -namespace fastlanes { - -void Mmap::Close(void* p, bsz_t bsz, int& fd) { - /**/ - if (munmap(p, bsz) == -1) { throw std::runtime_error(strerror(errno)); } - close(fd); -} - -std::byte* Mmap::Resize(bsz_t bsz, int& fd) { - if (ftruncate(fd, static_cast(bsz)) == -1) { throw std::runtime_error("Error resizing the file"); } - auto* p = reinterpret_cast(mmap(nullptr, bsz, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)); - return p; -} -template -T* Mmap::Resize(bsz_t bsz, int& fd) { - return reinterpret_cast(Resize(bsz, fd)); -} - -template uint64_t* Mmap::Resize<>(bsz_t bsz, int& fd); +namespace fastlanes { } // namespace fastlanes \ No newline at end of file