Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[release/6.0] Enforce scatter/gather file I/O Windows API requirement…
…s et. al. (#58423) * Move checking and pinning Windows vectored I/O buffers to a dedicated method. * Refactor the scatter/gather APIs to use the common checking method. And use pinned GCHandles and IntPtrs instead of MemoryHandles when passing the segment array to the bottom-most method. * Shorten the name of the buffer-checking method. * Directly get the pinned array's address instead of calling GCHandle.AddrOfPinnedObject. * Refactor the error handling logic in TryPrepareScatterGatherBuffers. * Allocate the segment array from native memory and at TryPrepareScatterGatherBuffers. * Cache the page size on a static readonly field and add a couple of TODOs. * Make the memory handlers readonly structs. * Add a test. * Reorder some methods with PR feedback taken into consideration. * Stop special-casing scatter/gather operations with zero or one buffer. * Factor the cleaning-up of the segment buffers into a separate method. * Follow up on Scatter/Gather API changes (#58447) * Allocate an array of memory handles only if needed. * Remove an unnecessary variable in the multiple-syscall write gather. * Actually verify the content read by the read scatter operation. * Delay allocating native memory. * Verify that the whole file was read in the scatter/gather test. * Test the case when the scatter/gather buffers are acceptable by the Windows API. * Avoid null pointer dereferences when passing an empty segment array. * Test performing scatter/gather I/O with an empty segment array. Co-authored-by: Stephen Toub <stoub@microsoft.com> Co-authored-by: Theodore Tsirpanis <teo.tsirpanis.718@gmail.com> Co-authored-by: Theodore Tsirpanis <12659251+teo-tsirpanis@users.noreply.github.com> Co-authored-by: Stephen Toub <stoub@microsoft.com>
- Loading branch information