Skip to content

Commit 8717b58

Browse files
authored
Merge pull request #133 from RFCreations/fix_windows_zero
Fix unaligned map_handle::zero_memory on windows and support COW
2 parents 305647f + 5c22f5c commit 8717b58

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

include/llfio/v2.0/detail/impl/posix/mapped_file_handle.ipp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ result<mapped_file_handle::size_type> mapped_file_handle::_reserve(extent_type &
5959
}
6060
// Reserve the full reservation in address space
6161
section_handle::flag mapflags = section_handle::flag::nocommit | section_handle::flag::read;
62+
mapflags |= _sh.section_flags() & section_handle::flag::cow;
6263
if(this->is_writable())
6364
{
6465
mapflags |= section_handle::flag::write;

include/llfio/v2.0/detail/impl/windows/map_handle.ipp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ result<void> map_handle::zero_memory(buffer_type region) noexcept
934934
memset(region.data(), 0, region.size());
935935
if(region.size() >= utils::page_size())
936936
{
937-
region = utils::round_to_page_size_larger(region, _pagesize);
937+
region = utils::round_to_page_size_smaller(region, _pagesize);
938938
if(region.size() > 0)
939939
{
940940
OUTCOME_TRYV(win32_maps_apply(region.data(), region.size(), win32_map_sought::committed,

include/llfio/v2.0/detail/impl/windows/mapped_file_handle.ipp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ result<mapped_file_handle::size_type> mapped_file_handle::_reserve(extent_type &
6363
return _reservation;
6464
}
6565
section_handle::flag mapflags = section_handle::flag::read;
66+
mapflags |= _sh.section_flags() & section_handle::flag::cow;
6667
auto map_size = reservation;
6768
// Reserve the full reservation in address space
6869
if(this->is_writable())

0 commit comments

Comments
 (0)