Repository navigation
feat(libkernel): implement poll for guest sockets - #1278
Conversation
|
Linux data point: this is required to start DOOM Shareware PPSA99666 v1.1.1 (lowbit/ps5-doom) on Linux. On current I haven't exercised the upload server path that waits on AI-assisted: yes (Claude Code). |
Translate the FreeBSD pollfd layout and flags to WSAPoll on Windows and poll on Linux. Closed socket descriptors report POLLNVAL, a timeout below -1 fails with EINVAL and a null array with EFAULT. Non-socket descriptors, unknown event bits, POLLPRI on Windows and an infinite wait without sockets throw; these are recorded in TechnicalDebt. DOOM (PPSA99666) imports poll for its upload server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Checked: build + full ctest on current main + this PR (439/439), 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 |
79c0945 to
408e305
Compare
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 perf(recompiler): loop the BDA byte stores and written-page probes #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 fix(libkernel): accept guest socket addresses whatever their sa_len #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