Skip to content

feat(libkernel): accept pipe read ends in sceKernelAddReadEvent - #8057

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
HQasper:feat/kernel-pipe-read-event
Oct 20, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
HQasper:feat/kernel-pipe-read-event

Conversation

@HQasper

@HQasper HQasper commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

What

sceKernelAddReadEvent threw for anything but a guest socket, although kevent already accepts EVFILT_READ on the read end of a pipe (FreeBSD filt_piperead). It now registers a read event on a pipe's read end through the same path kevent uses and ignores the size argument there. Host streams, other descriptors and a write event on a pipe still throw, as recorded in docs/dev/debt/libkernel.md.

Tested

Linux (gcc, Release): guest_socket_events passes, including new checks that a pipe read event stays quiet on an empty pipe, reports the readable byte count after a write, wakes a blocked wait when another thread writes, and reports EV_EOF once the write end closes. No title was run.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The entry before it still says sceKernelAddReadEvent and
sceKernelAddWriteEvent take only guest sockets. The pipe entry now says it
is the exception, without editing that entry, which an open change to the
shared-memory entry next to it would conflict with.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@HQasper

HQasper commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

Manual check of the files the overlap report could not compare. #7049 and #7509 change Equeue.cpp in CollectTriggered, AddEvent and TriggerEvent, not AddDescriptorEvent. No other open pull request changes sceKernelAddReadEvent: #7075 (EVFILT_WRITE on a pipe's write end) and #7088 (kevent on regular files) change kevent in Kqueue.cpp. #6044 moves GuestSocketEvents.cpp to core/libs/tests/networking/; a merge carries this change's test lines to the new path. The other pull requests share only docs/dev/debt/libkernel.md; merged directly with this branch, each conflicts only where it already conflicts with main.

One wording overlap: #7088's new debt entry ends with "sceKernelAddReadEvent and sceKernelAddWriteEvent still refuse non-socket descriptors", which is no longer true for a pipe's read end once this lands. Whichever merges second should reword that sentence. The pipe entry here now says it is the exception to the sockets-only socket entry before it; that entry itself is left as it is because #7299 edits the line above it. Depends on: none.

@wachi35676

Copy link
Copy Markdown
Contributor

Windows run (the description has Linux only): Windows 11 Home 26300, Ryzen 5 9600X, WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON. This PR merged onto main 9127ea3.

  • guest_socket_events, including the new pipe checks, passes in every run: 3/3, plus 6 more serial runs.
  • Negative control (Equeue.cpp from main, new test kept): guest_socket_events aborts (0xc0000409).
  • guest_kqueue passes.
  • guest_select is flaky on this loaded machine with or without the change:
    • this PR: 4/8;
    • this PR with Equeue.cpp reverted: 1/8;
    • plain main: 5/6.
      This PR doesn't touch select.
  • Ignoring the size argument for a pipe matches FreeBSD 11.4 filt_piperead. It sets kn_data to the buffered byte count and fires on kn_data > 0 or EOF; it doesn't read NOTE_LOWAT or kn_sdata.

AI-assisted: yes (Claude Code); results above were run on this machine.

@oneandonlydean oneandonlydean self-assigned this Oct 20, 2026
@oneandonlydean
oneandonlydean merged commit bec309f into boykopovar:main Oct 20, 2026
10 checks passed
HQasper pushed a commit to HQasper/AnyPS5 that referenced this pull request Oct 20, 2026
The only conflict was the sceKernelAddReadEvent entry in
docs/dev/debt/libkernel.md; it takes the v0.1.3 text, which already holds
the pipe read event and libSceNet work merged upstream as boykopovar#8057 and boykopovar#8054.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants