feat(libkernel): support EV_DISABLE and EV_ENABLE in kevent #5440
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5440"
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 Sevthered on 2026-10-13T19:52:07Z.
What
keventacceptsEV_DISABLEandEV_ENABLEinstead of throwing onEV_DISABLE.Semantics follow FreeBSD 11
kern_event.c, the revision the libkernel technical debt entry already pins:kqueue_register(done_ev_add):EV_ENABLEclearsKN_DISABLED, otherwiseEV_DISABLEsets it, after the other changes of the same kevent. It applies to a knote added by the same change and to an existing one.EV_DELETEis handled first, soEV_DELETE | EV_DISABLEdeletes.kqueue_scan: a disabled knote is not reported and stays registered.KNOTE_ACTIVATE: activity that arrives while a knote is disabled is kept, so it is reported afterEV_ENABLE.Implementation:
KernelEqueueEventgets adisabledflag, set when the knote is added (AddVnodeEventtakes it as a parameter so the knote is never visible enabled) and changed inModifyKnote.CollectOncePerWaitskips disabled knotes.PollEventsandWaitForDescriptorsskip them too, so a disabled socket that is readable does not wake the wait.EV_ENABLE.EV_DISABLEonEVFILT_TIMERstill throws: enabling it again is a change to an existing timer, which throws onmain.EV_DISPATCHandEV_FORCEONESHOTare unchanged. Not measured on a console.Tested
Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7), full build with
BUILD_TESTING=ON.guest_kqueue: newDisabledEventscoversEV_ENABLE/EV_DISABLEon a missing knote (ENOENT), a user event added disabled then triggered and enabled, disabling and enabling an existing level event,EV_DELETE | EV_DISABLE, anEV_CLEARuser event touched while disabled, anEV_ONESHOTevent enabled from another thread whilekeventwaits, a readable socket added disabled (a 30 mskeventdoes not return early) then enabled, and a file watch added disabled whose write is reported afterEV_ENABLE. The assertion inErrorsthatEV_ADD | EV_DISABLEthrows now uses a timer.ctest -j 8, 1097 tests, 1090 passed, 0 failed, 7 skipped. The same 7 are skipped onmainon this machine (fivevideo_out_flip_*,agc_driver_stencil_ref_export,guest_video_out_wqhd_detection_no_vulkan).python tools/check_conventions.py --base origin/mainpasses.Linux: WSL2 Ubuntu 24.04 (kernel 6.6.87.2), GCC 13.3.0, lavapipe (Mesa 25.2.8), this branch merged into
main0aa4cb1c2as the CIlinuxjob does.guest_kqueuepasses. Full suite with the CI environment,ctest --parallel 8: 1080 tests, 2 failed, 48 skipped. Both failures also occur onmainalone in this environment, three runs out of three:agc_driver_depth_compare_copyneeds the write watch, which the WSL kernel lacks (no asynchronous userfaultfd write protection), andguest_socket_read_writegetsEAGAINwhere it expectsEPIPEat line 154.tools/check_skips.pyreports five of the skips as unexpected: four write-watch tests andguest_video_out_high_frame_rate(no 120 Hz display). No title or homebrew was run.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)EV_DISABLEorEV_ENABLE; #4924 changes the same files.Imported from boykopovar/AnyPS5. Originally posted by johnohhh1 on 2026-10-13T22:34:19Z.
Independent Linux validation of
691616e38d0f0c283c5da1c4817f7388759404c6, cleanly cherry-picked onto maina0f5916a293067ca840e835e58a8a55a0b764b4b. Original author and stable patch ID retained; no implementation changes.Ubuntu 26.04.1 x86-64, GCC 15.2.0, Release, bundled dependencies,
BUILD_TESTING=ON.guest_kqueue,guest_equeue_events,guest_socket_events,guest_socket_pair,guest_socket_read_write,guest_poll,guest_select,patched_libraries. Serial run, 30-second per-test limit, 2.88 seconds total;guest_kqueuetakes 1.73 seconds. This includes the new disabled socket and file-watch cases and existing Linux-specific file/directory tests.guest_kqueue_testsexecutable, run against frozen baseline libraries, aborts withkevent: EV_DISABLE not implemented; it passes with the PR libraries. The baseline's existing regression also passes when local IPC is permitted.Initial socket sends returned EPERM under the Codex sandbox on both versions. The results above use host execution with local IPC permitted; no external service was contacted. Initial failure logs are retained as environment evidence.
Expectations use the PR's pinned FreeBSD source. No console, title, extra Windows or complete CTest-suite run is claimed. Timer enable/disable remains outside the supported scope described in this PR.
AI-assisted validation/report: Codex. Your existing patch is unchanged.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:29:01Z.
Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.
Pull request closed