feat(libkernel): implement poll for guest sockets #1278
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1278"
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 TheAggie on 2026-10-07T21:42:03Z.
What
Implements
poll(ku7D4q1Y9PI) in libkernel for guest sockets.pollfdarray (FreeBSD layout:int fd; short events; short revents) is translated toWSAPollon Windows andpollon Linux. Requested and returned flags are mapped one by one, since the host values differ (on WindowsPOLLINisPOLLRDNORM | POLLRDBAND).revents0. A closed socket descriptor reportsPOLLNVALand counts towards the result; the call then returns without waiting.EINVAL, and a null array with a nonzero count withEFAULT, as on FreeBSD.POLLIN,POLLPRI,POLLOUT,POLLRDNORM,POLLRDBANDandPOLLWRBAND(POLLERR,POLLHUPandPOLLNVALineventsare ignored),POLLPRIon Windows, whichWSAPollrejects, and an infinite timeout with no socket to wait on. All are recorded in TechnicalDebt.guest_poll: loopback TCP listener and connection; checks no events with a zero timeout, the 50 ms timeout being honoured, the listener becoming readable on connect,POLLOUT, data arriving,POLLIN/POLLHUPafter the peer closes,POLLNVALfor a closed descriptor, skipped negative descriptors,EFAULTandEINVAL.Related to #1091, which adds
GuestSockets::Readyand also changesUdp.cpp; whichever merges second rebases.Tested
Windows 11 Pro (26200), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, NVIDIA GeForce RTX 5070 Ti, Ryzen 7 7800X3D.
guest_poll,guest_udp,guest_tcp,guest_sce_netpass.mainwith this,MSG_NOSIGNALand #1265 applied. They were run from the commands and environments in the generatedCTestTestfile.cmakefiles, because antivirus blocksctest.exeon this machine.unresolved ELF import ku7D4q1Y9PI from libkernel.prx; with it, the launcher starts and runs. Its upload server waits withpollon its listener and up to 8 connections. Together with theMSG_NOSIGNALPR and the same change as #1088, it served its upload page and received a 28.8 MB WAD (Freedoom) intact.Not tested on Linux.
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 github-actions[bot] on 2026-10-08T04:36:40Z.
Progress report (
539cbd8→ 79c0945)📈 System libraries: 86.15% (+0.01%, +1 implemented functions)
✅ 1 implemented
poll_nid_postfixImported from boykopovar/AnyPS5. Originally posted by hikazey on 2026-10-08T09:22:55Z.
Linux data point: this is required to start DOOM Shareware PPSA99666 v1.1.1 (lowbit/ps5-doom) on Linux. On current
main(0e173a46) the Linux relink fails at load with./app.elf: symbol lookup error: undefined symbol: ku7D4q1Y9PI(poll). With this PR merged locally (onlydocs/dev/TechnicalDebt.mdconflicts; I kept both entries), plus #1279 and #1307, the title starts and reaches E1M1 on Linux (Ubuntu 24.04 container, GCC 14.2, Mesa llvmpipe). Reaching E1M1 also needs the bundledlibc.prxexcluded (#1497).I haven't exercised the upload server path that waits on
poll, only start-up and gameplay.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T10:35:45Z.
Checked: build + full ctest on current main + this PR (439/439),
guest_pollpasses and doesn't even link without theUdp.cppchange. Flag values andpollfdlayout match FreeBSD (sys/poll.h); negative descriptors are skipped, a closed socket reportsPOLLNVAL, unmodelled cases throw and are in TechnicalDebt. Linux and Windows CI green.The only conflict with main was the TechnicalDebt line at the end of the section; I rebased and moved it a few lines up. Merging once CI is green on the rebased head. #1091 also touches
Udp.cpp, so whichever of the two lands second rebases.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T10:36:35Z.
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.
main)docs/dev/TechnicalDebt.mdL311