feat(libkernel): EVFILT_VNODE on macOS through the host kqueue #5749
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5749"
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 OleksandrS23 on 2026-10-14T09:15:45Z.
What
EVFILT_VNODE,sceKernelAddFileEventandsceKernelDeleteFileEventon macOS hosts.FileEvent.cppusedeventfdand inotify on every non-Windows host, so it did not build on macOS (#1).EVFILT_VNODE(EV_CLEAR, all mapped notes) on aF_DUPFD_CLOEXECduplicate of the descriptor in a host kqueue. XNU's notes have FreeBSD's values, so they are passed through masked byMAPPED_NOTES; astatic_assertchecks the values and<sys/event.h>supplies the constants on macOS.NOTE_LINKtoNOTE_DELETEwhen the watched file or directory is removed; FreeBSD'svop_remove_postandvop_rmdir_postreportNOTE_DELETEalone, soNOTE_LINKis dropped from a note that carriesNOTE_DELETE.EVFILT_READin the same host kqueue, in place of the Linuxeventfd.NOTE_WRITE(withNOTE_LINKfor a subdirectory), without FreeBSD'sNOTE_EXTEND, as on Windows:MoveDirectoryEntriesis skipped on macOS as it is on Windows, and a newEVFILT_VNODE on macOSentry indocs/dev/debt/libkernel.mdsays so. The existingEVFILT_VNODEentry is left untouched, as #5493 edits it.Linux and Windows code is unchanged.
Host notes measured on macOS 27.0.1 (x86-64 under Rosetta), compared with FreeBSD 11
vop_*_post:NOTE_DELETENOTE_DELETE | NOTE_LINKlinkto the watched fileNOTE_LINKNOTE_LINKNOTE_RENAMENOTE_RENAMENOTE_WRITENOTE_WRITENOTE_WRITE | NOTE_LINKNOTE_WRITE | NOTE_LINKNOTE_WRITE | NOTE_EXTENDNOTE_WRITENOTE_WRITE | NOTE_EXTEND | NOTE_LINKNOTE_WRITE | NOTE_LINKTested
Apple M4 Pro, macOS 27.0.1, x86-64 under Rosetta, AppleClang 21.
maindoes not buildlibkernelon macOS yet, so the test ran on a local merge ofmainintomugurc/macos-portwith this commit on top (plus local build fixes outside this PR):guest_kqueuepasses, 30 of 30 runs (ctest --repeat until-fail:30), andguest_equeue_eventspasses. Linux and Windows were not built locally; their code paths are unchanged.tools/check_conventions.pypasses.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 adriadam10 on 2026-10-14T13:28:37Z.
Checked the diff, Linux build and
guest_kqueue(passes; the Linux/Windows paths are unchanged apart from the#ifregrouping in the test) and the conventions. The macOS branch relies on your measurements (not reproducible here); it is isolated under__APPLE__. Merging once the full build is green.