feat(libkernel_sys): implement cpuset_getid for WhichCpuset #13127

Merged
iAbdulrrahman merged 2 commits from upstream-pr/13127 into main 2026-11-02 17:26:33 +00:00
iAbdulrrahman commented 2026-10-30 03:25:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by iAbdulrrahman on 2026-10-30T03:25:03Z.


What

Implement cpuset_getid for CPU_WHICH_CPUSET (which == WhichCpuset) in libkernel_sys per FreeBSD 11.4 kern_cpuset.c specifications, validating valid dynamic/root/default cpusets, returning EINVAL for id == -1, ESRCH for unknown set IDs, and copying out the requested set ID based on level (LevelRoot returns RootSetId, LevelCpuset and LevelWhich return the cpuset ID).

Tested

Windows 11, ctest --test-dir build -R "^guest_kernel_sys_cpuset$" -V passed (100% tests passed).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5078987236 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13127). Originally posted by [iAbdulrrahman](https://github.com/iAbdulrrahman) on 2026-10-30T03:25:03Z. --- ### What Implement cpuset_getid for CPU_WHICH_CPUSET (which == WhichCpuset) in libkernel_sys per FreeBSD 11.4 kern_cpuset.c specifications, validating valid dynamic/root/default cpusets, returning EINVAL for id == -1, ESRCH for unknown set IDs, and copying out the requested set ID based on level (LevelRoot returns RootSetId, LevelCpuset and LevelWhich return the cpuset ID). ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11, `ctest --test-dir build -R "^guest_kernel_sys_cpuset$" -V` passed (100% tests passed). ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
CnRJay commented 2026-11-01 19:50:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:50:16Z.

Review: COMMENTED


On the code: the new WhichCpuset branch still falls back to NotImplemented_nid_no_patch for other which values, which is right, but for which == WhichCpuset with an id other than -1 please say which source the returned id comes from (disassembly of the libkernel wrapper, or the FreeBSD kernel behaviour) since the body does not say it was measured.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5729924949 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13127#pullrequestreview-5729924949). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-11-01T19:50:16Z. **Review:** COMMENTED --- On the code: the new `WhichCpuset` branch still falls back to `NotImplemented_nid_no_patch` for other `which` values, which is right, but for `which == WhichCpuset` with an `id` other than -1 please say which source the returned id comes from (disassembly of the libkernel wrapper, or the FreeBSD kernel behaviour) since the body does not say it was measured.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!13127
No description provided.