fix(libkernel): fill every buffer of readv from a pipe on Windows #4864
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4864"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-13T00:32:27Z.
What
Fixes #4858. Carries @DavidSamir's fix branch from that issue (
DavidSamir:fix/libkernel-readv-pipe-windows,ab3d8369), keeping the commit and its authorship; it cherry-picks onto currentmainwithout changes.On Windows,
readvandsceKernelReadvon a pipe filled only the first buffer and returned, however much was waiting, becauseTransferIovecsstops after the first transfer on a descriptor that is not a disk file, so that it never waits on an empty pipe for the next buffer; that also stopped it when the next buffer's bytes were already there. FreeBSD'sreadv(2)"scatters the input data into the iovcnt buffers", and the Linux build returns everything that is waiting. The fix keeps filling buffers while bytes are already available, still without waiting for more after the first transfer. Linux is unchanged.guest_file_vectorgains pipe checks with several buffer sizes and amounts waiting.Tested
665e6f178) merged ontomain0aa4cb1c2.main'sStdio.cppand the new checks,guest_file_vectorfails at line 212.guest_file_vectorpasses 20/20 and the fullctestpasses 1098/1098.main'sStdio.cppthe new checks fail at the first one and with the fixguest_file_vectorpasses 5/5; a 33-line pipe probe matches the Linux build in every blocking case; a 188-line probe over the file, directory, vector and mapping functions differs only inreadvfrom a pipe; no timing difference on files or small pipe reads; eleven catalog titles end the same way with both sets of libraries; fullctest1001/1001.main1c5e6287.guest_file_vector,guest_filesystem,guest_kernel_fcntlandguest_pollpass, and all 324guest_*tests pass in two runs. The new checks also pass withmain'sStdio.cpp, as expected since only the Windows path changes.tools/check_conventions.py --base upstream/mainpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-13T21:14:16Z.
Tested this carry on Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release, full build, this PR (
665e6f178) merged onto currentmain0aa4cb1c2(AI-assisted: Claude Code).main'sStdio.cppand the new checks kept:guest_file_vectorfails (File vector check failed at line 212, exit 0xc0000409).guest_file_vectorpasses 20/20 (--repeat until-fail:20), and the fullctestpasses 1098/1098.