diff options
| author | Stefan Boberg <[email protected]> | 2021-08-24 16:13:04 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-08-24 16:13:04 +0200 |
| commit | 4cc836030084ec93ed3a6709e89ea62de7853de2 (patch) | |
| tree | 89d48228bebf35475af8b173187d4cec020aa267 /zencore/iobuffer.cpp | |
| parent | WIP interface for submitting workers/jobs (diff) | |
| download | zen-4cc836030084ec93ed3a6709e89ea62de7853de2.tar.xz zen-4cc836030084ec93ed3a6709e89ea62de7853de2.zip | |
Added some context to MapViewOfFile exception emit
Diffstat (limited to 'zencore/iobuffer.cpp')
| -rw-r--r-- | zencore/iobuffer.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/zencore/iobuffer.cpp b/zencore/iobuffer.cpp index b8dd62840..136c065d0 100644 --- a/zencore/iobuffer.cpp +++ b/zencore/iobuffer.cpp @@ -171,6 +171,8 @@ RwLock g_MappingLock; void IoBufferExtendedCore::Materialize() const { + using namespace fmt::literals; + // The synchronization scheme here is very primitive, if we end up with // a lot of contention we can make it more fine-grained @@ -199,16 +201,18 @@ IoBufferExtendedCore::Materialize() const const uint64_t MapOffset = m_FileOffset & ~0xffffull; const uint64_t MappedOffsetDisplacement = m_FileOffset - MapOffset; + const uint64_t MapSize = m_DataBytes + MappedOffsetDisplacement; void* MappedBase = MapViewOfFile(m_MmapHandle, /* dwDesiredAccess */ FILE_MAP_READ, /* FileOffsetHigh */ uint32_t(MapOffset >> 32), /* FileOffsetLow */ uint32_t(MapOffset & 0xffFFffFFu), - /* dwNumberOfBytesToMap */ m_DataBytes + MappedOffsetDisplacement); + /* dwNumberOfBytesToMap */ MapSize); if (MappedBase == nullptr) { - throw std::system_error(std::error_code(::GetLastError(), std::system_category()), "MapViewOfFile failed"); + throw std::system_error(std::error_code(::GetLastError(), std::system_category()), + "MapViewOfFile failed (offset {#x}, size {#x}"_format(MapOffset, MapSize)); } m_MappedPointer = MappedBase; |