blob: 1f5c211ef05a40f997ab14cce9895a57aca05feb [file] [log] [blame]
#include <stdplus/fd/mmap.hpp>
#include <stdplus/util/cexec.hpp>
namespace stdplus
{
namespace fd
{
MMap::MMap(Fd& fd, std::span<std::byte> window, ProtFlags prot, MMapFlags flags,
off_t offset) :
mapping(fd.mmap(window, prot, flags, offset), fd)
{}
std::span<std::byte> MMap::get() const
{
return *mapping;
}
void MMap::drop(std::span<std::byte>&& mapping, std::reference_wrapper<Fd>& fd)
{
fd.get().munmap(mapping);
}
} // namespace fd
} // namespace stdplus