IO: implement positional-file syscalls on Windows

pread/pwrite use serialized seek+read/write on the CRT, sync uses
_commit, close uses _close, and open_file_native opens files in binary
mode with _wopen. The offset-boundary test uses the backend's int64
limit instead of assuming 64-bit off_t.

Windows cross build under Wine 11 (x86_64-w64-mingw32 GCC 16.2):
Storage;Testing 674 tests (667 passed, 7 skipped, 0 failed).
Linux Storage;Testing: 674 tests (671 passed, 3 skipped, 0 failed).
This commit is contained in:
faumaray committed 2026-12-06 02:33:12 +03:00
1 parent 88cecb72c9
commit ea285d1c65
2 files changed
+85

No files matched your search

+6
View File
@@ -1774,7 +1774,13 @@ Void::Testing::Test io_file_zero_length_overflow_and_zero_queue_limit()
TaskScope scope{exec};
auto drv = make_driver(exec, mock_options({}, &sys));
file = open_rw(*drv, dir.file("edges.bin"));
#ifdef _WIN32
// The backend's limit is int64 max; off_t is 32-bit in MinGW.
const auto off_max = static_cast<std::uint64_t>(
std::numeric_limits<std::int64_t>::max());
#else
const auto off_max = static_cast<std::uint64_t>(std::numeric_limits<off_t>::max());
#endif
spawn(scope, do_read(&file, 0, {}, {}, &zr));
spawn(scope, do_write(&file, 0, {}, {}, &zw));
spawn(scope, do_read(&file, std::numeric_limits<std::uint64_t>::max(), one, {}, &ov1));