Skip to content

fix(libkernel): poll files, pipes and stdio descriptors - #1832

Closed
TideOPL wants to merge 3 commits into
boykopovar:mainfrom
TideOPL:fix/poll-host-descriptors
Closed

TideOPL wants to merge 3 commits into
boykopovar:mainfrom
TideOPL:fix/poll-host-descriptors

Conversation

@TideOPL

@TideOPL TideOPL commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

What

poll threw for every descriptor below GuestSockets::FirstDescriptor, so a title that polls a file, a pipe or stdio (alone or next to its sockets) stopped there. That TechnicalDebt entry had no open PR (#1706 does the same for select, Linux only).

  • Linux: a host descriptor goes into the same host poll call as the sockets, with the same flag mapping. Readiness, POLLHUP and POLLNVAL come from the host.
  • Windows: WSAPoll takes only sockets. A disk file (GetFileType = FILE_TYPE_DISK) or a directory descriptor is ready at once for the requested POLLIN, POLLOUT and POLLRDNORM. That is FreeBSD's default vnode poll answer (vop_nopoll/vop_stdpoll: events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)). A descriptor with no CRT handle reports POLLNVAL, with the CRT invalid-parameter handler suppressed as NativeClose does. Pipes and consoles still throw.
  • The request-building code shared by sockets and host descriptors is now one helper, AddPollRequest.

The TechnicalDebt entry is updated: Windows pipes and consoles still throw, and the vnode answer is not confirmed for the console's file systems.

Tested

  • Windows 11, MinGW-w64 GCC 15.2: guest_poll passes. The new cases fail on main (the export throws, exit 0xc0000409) and pass with the change.
  • Linux (Ubuntu 24.04 under WSL2, GCC 13.3): guest_poll passes, including the pipe cases
  • New cases in core/libs/tests/GuestPoll.cpp:
    • a disk file polled with POLLIN | POLLPRI | POLLOUT | POLLRDNORM next to an idle listening socket, with an infinite timeout: returns 1 at once, the file reports POLLIN | POLLOUT | POLLRDNORM and the socket reports nothing
    • the same descriptor after close: POLLNVAL
    • Linux only, a pipe: the write end is writable, the read end becomes readable after a write, and it reports POLLIN/POLLHUP after the writer closes
  • Full build and full ctest on both: Windows 479/479 pass; Linux 485 pass, with 24 AGC subgroup/GPU tests skipped because WSL2 has no suitable Vulkan device. guest_udp, guest_tcp and guest_sce_net, which link the same file, pass on both.
  • tools/check_conventions.py (with this description) and tools/check_test_registration.py pass.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Which title polls a file, pipe or stdio descriptor on main? With the ID and the log line where it stops this can go in; otherwise I'll close it until one does.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 9, 2026
…poll-host-descriptors

# Conflicts:
#	docs/dev/TechnicalDebt.md
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#1857 docs/dev/TechnicalDebt.md L349
#2080 core/libs/prx/libkernel/Socket/src/Udp.cpp L15

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 9, 2026
@TideOPL TideOPL closed this Oct 9, 2026
@AchrafReyani

Copy link
Copy Markdown
Contributor

@TideOPL a title now stops here on main (a11c8f7): ProsperoTV (PPSA99003), right after its menu opens, polling the read end of a pipe (descriptor 3) next to its sockets. Log line (in the title's own download0/profiles/10000000/logs/app.log):

  what():  poll: descriptor 3 is not a socket

Details in #3584. If you reopen this with that evidence it should meet the intake rules; I won't open a copy.

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.

3 participants