fix(libkernel): poll kqueues as kqueue_poll answers #7605
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7605"
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 HQasper on 2026-10-18T16:41:11Z.
What
Follow-up to #7248 (merged).
pollthrew for a kqueue descriptor on both hosts ("neither a socket, a pipe, a file nor a directory"), and #7139'sguest_pollused that as its example of an unsupported descriptor.POLLINandPOLLRDNORMwhile one of its events is triggered, and never for any other event, as FreeBSD 11.4'skqueue_pollanswers. It uses #7248'sKqueueReadable.pollchecks it every millisecond and waits on the other descriptors in slices of 1 ms. This is the loop Windows already used for pipes. Linux now runs the same loop with::pollin place ofWSAPoll. Without a kqueue it makes a single host call with the full timeout, as before.POLLNVAL. One whose number was reused is polled again with the rest of the timeout, as FreeBSD 11.4'spollrescanlooks the descriptor up again.docs/dev/debt/libkernel.md: thepollentry describes the above, including the same close window asselectin #7248. A close that has removed the kqueue but not yet closed its host descriptor is seen as an unknown descriptor, which throws.poll_nid_postfixwas already counted as implemented, sotools/progress.pydoes not change.Tested
Windows 11 Pro 26300, MinGW-w64 (WinLibs) Release build of this branch on
main81cb86339.guest_poll,guest_select,guest_select_wait,guest_kqueue,guest_equeue_eventsand everyguest_socket*test pass. The new kqueue cases inguest_pollcover:EVFILT_USERevent added withEV_CLEAR: not ready, also over a 30 ms wait;pollnext to a socket: only the kqueue is reported, withPOLLIN;POLLIN | POLLRDNORMreported while the event is pending, nothing oncekeventhas collected it;POLLNVALafterclose.Without the
Udp.cppchangeguest_pollfails (the kqueue throws, exit0xc0000409).Full
ctest -j 24: 1489 of 1490 pass. The one failure,agc_driver_pixel_lds, is unrelated: it loses the device on this RTX 5090 (NVIDIA 617.42) on plainmaintoo.Linux not tested.
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)Imported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-19T00:12:56Z.
Adding Linux, which the description lists as untested, since the Linux
pollpath now goes through the shared loop. Tested at36e9b0b3eonmain8a456334f.guest_poll,guest_select,guest_select_wait,guest_kqueue,guest_equeue*andguest_socket*(16 tests) pass. WithUdp.cppreverted tomain,guest_pollaborts there too.guest_pollpasses 5/5. The negative control aborts withpoll: descriptor 4 is neither a socket, a pipe, a file nor a directory.The readiness rule matches FreeBSD 11.4's
kqueue_poll(POLLIN|POLLRDNORMwhilekq_count != 0).AI-assisted: yes (Claude Code); results above were run on this machine.
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-22T00:40:55Z.
@HQasper a merge-order note: #9512 adds a
poll on a stream socketentry todocs/dev/debt/libkernel.mdright after thepollentry this PR rewrites; the code changes merge cleanly. This one goes first: #9512 lists it under Depends on and rebases the debt file on it.Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-22T02:18:57Z.
@HQasper one more merge-order note: #9492 adds a line after the
WSAPollcall inpoll, next to this PR's change to the same loop for kqueues. This one goes first here too: #9492 lists it under Depends on and rebases on it.