feat(libkernel): support macOS pipe write readiness #13560
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/13560"
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 SHOnnay on 2026-10-30T18:17:35Z.
What
On macOS,
GuestSockets::PipeWriteStatethrew for the write end of an anonymous pipe, so guest pipe-write events could not query readiness. The macOS branch now uses a private host kqueue withEVFILT_WRITE, a zero timeout and close-on-exec. It reports available host-buffer space when writable and zero with EOF when the reader closes. Each snapshot creates a queue, which is closed on success and exception paths; interrupted queries retry and other host errors throw with the host errno.The Linux and Windows branches of
PipeWriteStateare byte-for-byte unchanged. Host buffer capacity remains different from FreeBSD's 16 KiB buffer, as recorded in the existing debt entry. Reverse-direction pipe events remain unsupported. Named FIFOs also remain unsupported: on this Mac, the host reports a FIFO writable after its reader closes without EOF, although a write fails withEPIPE.F_GETPATHdistinguishes vnode-backed FIFOs from anonymous pipes; XNU returnsEBADFfor a non-vnode descriptor before attempting path lookup.Contract sources:
The isolated fixture compiles production
Udp.cppdirectly, using dead stripping to discard unrelated runtime functions. A dedicated, file-gated CI job builds it onmacos-15-intelandmacos-15, following the write-watch job's checkout/merge pattern.Related:
sceKernelAddWriteEventthrough this helper and explicitly leaves the macOS helper throwing. This backend does not require that PR.Tested
macOS 27.0.1 (26A434), Apple M1. Native ARM64 and x86-64 under Rosetta were tested. Physical Intel macOS, Linux, Windows, a GPU and full guest titles were not run locally. The isolated fixture does not establish full guest-runtime kevent behavior.
Clean upstream/main baseline (
4bc9e779aa7abb2109c65ee3bca19e1b85df3be8):Result:
100% tests passed out of 522(268.00 seconds).Regression fixture:
With upstream/main's unchanged
Udp.cpp, 7 of 9 cases fail (ready, full, threshold, EOF, duplicate, cleanup and descriptor exhaustion); invalid descriptors and the unsupported FIFO boundary pass. With the fix, 9/9 pass. The threshold case drains 511 bytes from a full pipe (not writable), then one more (writable, data 512), then another 512 (data 1024). Other cases cover repeated level snapshots, empty/full reader closure, duplicated descriptors, linked/unlinked FIFOs, descriptor leaks, and recovery after EMFILE.Result: 180/180 successful executions on ARM64; 9/9 and 180/180 under Rosetta.
Results: relinker-only 522/522 (72.21 seconds); eligibility 10/10; conventions zero errors with the existing debt-length warning on the edited pipe entry (base 1230 characters, branch 1329); actionlint no new findings compared with upstream/main. Additional harness checks verified the new job's affected/unaffected paths for PR and manual runs, with full=true and full=false. The new output mirrors write-watch selection on push runs.
Overlap check:
python3 tools/pr_overlap.py --branch codex/feat-macos-pipe-writechecked 1597 open PRs. It reported 42 uncompared PRs because those branches conflict with main, ending withoverlap check failed closed; manually compare every reported PR branch before opening this one. This is not a clean automated result. Every reported shared-file diff was inspected from its true merge base. None implements this macOS readiness helper; the sharedUdp.cppheads retain the macOS throw or predate the helper. None changes this PR's pipe-debt bullet. #12741 adds distinctedgeWatch/edge-watchworkflow settings while this PR addspipeWrite/pipe-write; keeping both is an integration/rebase concern, not a build dependency. Other shared debt-file topics are independent.Uncompared PRs: #4630, #5021, #6936, #7088, #7105, #7121, #7135, #7149, #7192, #7447, #7464, #7509, #7804, #8605, #9156, #9242, #9293, #9297, #9302, #9326, #9389, #9557, #9566, #9843, #9938, #10025, #10442, #10552, #10645, #11215, #11628, #11661, #11689, #11698, #11939, #12682, #12688, #12700, #12741, #12925, #12965, #12970.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)