feat(libkernel_sys): implement kmq_notify registration #9302
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9302"
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 DavidSamir on 2026-10-21T17:51:27Z.
What
Builds on #9297 and implements
kmq_notifyregistration inlibkernel_sys/Mqueue.cpp, following FreeBSD 11sys/kern/uipc_mqueue.c(kern_kmq_notify,mqueue_send_notification). Until #9297 (and #9284 under it) merges, this PR's diff also shows their commits. This PR's own change is the last three commits.sigev_notifyother thanSIGEV_NONE,SIGEV_SIGNALorSIGEV_THREAD_IDgivesEINVAL, and for the two signal forms asigev_signooutside 1..128 givesEINVAL.EBADF, for a NULLsigeventas well.sigevent: removes only the calling descriptor's own registration; from another descriptor it does nothing and returns 0.EBUSY, even from the same descriptor.mqueue_senddoes.SIGEV_NONEis fully implemented.SIGEV_SIGNALandSIGEV_THREAD_IDregistrations throw, because delivering a guest signal with itssigev_valueis not modelled. A debt line records that.Tested
Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release. This is a CPU-side export, so no GPU is involved.
guest_kernel_sys_mqueuegainsNotify():EINVALkind, includingEINVALwinning over a bad descriptor;EBADF, andEBUSYfrom both descriptors of the queue;kmq_notify_nid_postfix not implemented. On this branch it passes, 3 of 3 runs.guest_kernel_sys_ksemstill passes, andtools/check_conventions.pypasses.tools/pr_overlap.pycrashes on this machine's partial clone, so it was replaced by a check against an index of every open PR's diff plusgit merge-tree. This branch merges cleanly withmainand with #9160, #9195, #9162, #9156, #9171, #9273, #9242, #9141, #9103 and #8987.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 github-actions[bot] on 2026-10-21T17:52:12Z.
Progress report (
0c6a5bd→c045c1e)📈 System libraries: 42.21% (+0.11%, +12 implemented, -7 removed functions)
✅ 12 implemented
ksem_destroy_nid_postfixksem_getvalue_nid_postfixksem_init_nid_postfixksem_post_nid_postfixksem_timedwait_nid_postfixksem_trywait_nid_postfixksem_wait_nid_postfixkmq_open_nid_postfixkmq_setattr_nid_postfixkmq_timedreceive_nid_postfixkmq_timedsend_nid_postfixkmq_unlink_nid_postfix🗑️ 7 removed
ksem_destroy_nid_postfixksem_getvalue_nid_postfixksem_init_nid_postfixksem_post_nid_postfixksem_timedwait_nid_postfixksem_trywait_nid_postfixksem_wait_nid_postfixImported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-22T02:06:23Z.
Linux: Ubuntu 24.04.1 LTS (WSL2), GCC 13.3.0, Release; head
c045c1e91merged ontomain8c26eac3c.guest_kernel_sys_ksemandguest_kernel_sys_mqueuepasses 3/3.Run from the PC (Windows host, Linux in WSL2), not from the PR author's machine.
Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T20:01:20Z.
Review: COMMENTED
Only
SIGEV_NONEis actually implemented; theSIGEV_SIGNALandSIGEV_THREAD_IDregistrations throw, so the path a real title would use is the one that is not there.Also, this carries #9297's and #9284's commits, so it cannot be reviewed on its own until those land.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T02:20:19Z.
Review: COMMENTED
Reviewed — comments
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
c045c1e91fe983f7e3e513692110e15b16470953from the prepared diff and targeted source reads usingrepo_read.py. No build or tests were run; test results in the description are author-reported.Results
Findings
Blocking
None.
Non-blocking
kmq_timedsend_nid_postfixconstructs its byte vector frommessageandmessage + lengthbefore locking. For a valid zero-length send withmessage == nullptr, formingmessage + lengthis undefined behavior. Handle the zero-length case without pointer arithmetic. (core/libs/prx/libkernel_sys/Mqueue.cpp:230)Not verified
core/libs/CMakeLists.txt,core/libs/prx/libkernel/CMakeLists.txt,core/libs/prx/libkernel/Equeue/Equeue.cpp,core/libs/prx/libkernel/File/src/Stdio.cpp,core/libs/prx/libkernel/Semaphore/include/Ksem.hpp,core/libs/prx/libkernel/Semaphore/src/Ksem.cpp,core/libs/prx/libkernel_sys/CMakeLists.txt,core/libs/prx/libkernel_sys/Export.Discovery.cpp,core/libs/prx/libkernel_sys/Mqueue.cpp,core/libs/tests/GuestKernelSysKsem.cpp,core/libs/tests/GuestKernelSysMqueue.cpp,docs/dev/debt/libkernel.md, anddocs/dev/debt/libkernel_sys.md(changed hunks and relevant source ranges only). No changed paths were excluded bymanifest.json.To get this to a good state
Nothing is required. The zero-length send edge case is optional feedback.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T20:26:23Z.
Review: COMMENTED
kmq_notifyretains theOpenreturned byFind, then locks the queue and publishes the numeric descriptor. Descriptor close can erase thatOpenand finish clearing the notifier between those steps. The queue can then retain a notification for a closed descriptor. Could registration recheck the descriptor identity under the same synchronization as close before publishing it? FreeBSD holds the descriptor table lock through that recheck and acquisition of the queue lock. FreeBSD registration codeSource review at
c045c1e91f. The trial merge conflicts in kernel CMake, equeue and stdio.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.