feat(libkernel): implement getpriority for the guest process #4374

Merged
MarcZX10 merged 1 commit from upstream-pr/4374 into main 2026-10-13 21:36:42 +00:00
MarcZX10 commented 2026-10-12 08:12:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T08:12:28Z.


What

Carries the getpriority implementation from #3632, preserving the original commit author. For the single guest process, it follows FreeBSD 11.4: PRIO_PROCESS and PRIO_PGRP for id 0 or the current pid, and PRIO_USER for id 0 or the guest uid, return nice 0. Unknown which returns EINVAL; other ids return ESRCH. Successful calls leave guest errno unchanged. The console nice value remains unmeasured and is documented in docs/dev/debt/libkernel.md.

PPSA99420 reaches this import after chflags is resolved by #4379 (issue #1578). This PR covers only getpriority; the other exports from #3632 remain separate work.

Tested

  • Before this current-main rebase, Linux GCC 12.2 Release built guest_sched_priority_tests; CTest passed 1/1, and conventions and diff checks passed.
  • The current-main rebase has not been built or tested locally. CI/reviewer validation should rerun against this head.

Checklist

  • Based on current main; no other open PR implements the same function
  • One topic: getpriority
  • No comments in code except technical debt
  • No notes or investigation files added
  • Generic behavior, not title-specific
  • Depends on: #4379
  • Unblocks: PPSA99420 #1578, after #4379
  • AI-assisted: yes; original implementation author preserved
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4826680435 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4374). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T08:12:28Z. --- ### What Carries the `getpriority` implementation from #3632, preserving the original commit author. For the single guest process, it follows FreeBSD 11.4: `PRIO_PROCESS` and `PRIO_PGRP` for id 0 or the current pid, and `PRIO_USER` for id 0 or the guest uid, return nice 0. Unknown `which` returns `EINVAL`; other ids return `ESRCH`. Successful calls leave guest `errno` unchanged. The console nice value remains unmeasured and is documented in `docs/dev/debt/libkernel.md`. PPSA99420 reaches this import after `chflags` is resolved by #4379 (issue #1578). This PR covers only `getpriority`; the other exports from #3632 remain separate work. ### Tested - Before this current-main rebase, Linux GCC 12.2 Release built `guest_sched_priority_tests`; CTest passed 1/1, and conventions and diff checks passed. - The current-main rebase has not been built or tested locally. CI/reviewer validation should rerun against this head. ### Checklist - [x] Based on current `main`; no other open PR implements the same function - [x] One topic: `getpriority` - [x] No comments in code except technical debt - [x] No notes or investigation files added - [x] Generic behavior, not title-specific - [x] Depends on: #4379 - [x] Unblocks: PPSA99420 #1578, after #4379 - [x] AI-assisted: yes; original implementation author preserved
github-actions[bot] commented 2026-10-12 08:23:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T08:23:31Z.


Progress report (8d98e88 → 1ba0a81)

📈 System libraries: 88.17% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libkernel getpriority_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6120510006 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4374#issuecomment-6120510006). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T08:23:31Z. --- <!-- progress-report --> ### Progress report (8d98e88 → 1ba0a81) 📈 **System libraries**: 88.17% (+0.01%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libkernel | `getpriority_nid_postfix` | </details>
xXPBSXx commented 2026-10-12 11:51:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T11:51:20Z.


Windows test: head 46614e273 merged onto current main 3d8ffeb27 (clean merge, no conflicts). Windows 10, MinGW GCC (WinLibs), Ninja Release, -j4: full build 0 errors; ctest with the filter guest_sched_priority: guest_sched_priority passed (1 test(s), 0 failed); python tools/check_conventions.py --base upstream/main passed. I did not run the new tests against main without the change.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6123695906 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4374#issuecomment-6123695906). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-12T11:51:20Z. --- Windows test: head `46614e273` merged onto current `main` `3d8ffeb27` (clean merge, no conflicts). Windows 10, MinGW GCC (WinLibs), Ninja Release, `-j4`: full build 0 errors; ctest with the filter `guest_sched_priority`: guest_sched_priority passed (1 test(s), 0 failed); `python tools/check_conventions.py --base upstream/main` passed. I did not run the new tests against `main` without the change. AI-assisted (Claude Code).
blawesom commented 2026-10-12 14:42:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-12T14:42:08Z.


Rebase handoff — rebased onto current main, authorship unchanged.

One conflict in Process.cpp: both sides add constants at the same spot — kept main's rlimit constants and this PR's priority/nice constants together. TechnicalDebt.md unioned.

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

  • builds; tools/check_conventions.py --base origin/main passes
  • full suite: 955/955 passed

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/4374
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is de2677b43.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6126528705 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4374#issuecomment-6126528705). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-12T14:42:08Z. --- **Rebase handoff** — rebased onto current `main`, authorship unchanged. One conflict in `Process.cpp`: both sides add constants at the same spot — kept main's rlimit constants and this PR's priority/nice constants together. `TechnicalDebt.md` unioned. Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`, AMD RX 9070 XT / RADV): - builds; `tools/check_conventions.py --base origin/main` passes - **full suite: 955/955 passed** **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/4374 git checkout <your branch> git merge --ff-only FETCH_HEAD ``` Head is `de2677b43`.
oneandonlydean commented 2026-10-13 00:19:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T00:19:34Z.


Conflicts with main in docs/dev/debt/libkernel.md; please rebase. PPSA99420 only gets to miQ1wVwSexE once chflags resolves (#4379), so list #4379 under Depends on and PPSA99420 under Unblocks.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6135168021 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4374#issuecomment-6135168021). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T00:19:34Z. --- Conflicts with main in `docs/dev/debt/libkernel.md`; please rebase. PPSA99420 only gets to `miQ1wVwSexE` once `chflags` resolves (#4379), so list #4379 under Depends on and PPSA99420 under Unblocks.
MarcZX10 commented 2026-10-13 07:13:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T07:13:31Z.


Understood. PPSA99420 reaches getpriority only after its chflags import is resolved by #4379. I will add Depends on: #4379 and list PPSA99420 as the title this export unblocks after that prerequisite, without claiming the call is reachable before #4379 lands.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6140339467 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4374#issuecomment-6140339467). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T07:13:31Z. --- Understood. PPSA99420 reaches getpriority only after its chflags import is resolved by #4379. I will add Depends on: #4379 and list PPSA99420 as the title this export unblocks after that prerequisite, without claiming the call is reachable before #4379 lands.
MarcZX10 commented 2026-10-13 07:37:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T07:37:43Z.


Rebased onto current main, resolving the debt-file conflict by keeping main's entries and adding the getpriority entry. I listed #4379 under Depends on and PPSA99420 (#1578) under Unblocks, as requested. The prior Linux run predates this rebase; I have not rerun it locally, and the description now says so.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6140705469 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4374#issuecomment-6140705469). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T07:37:43Z. --- Rebased onto current `main`, resolving the debt-file conflict by keeping main's entries and adding the `getpriority` entry. I listed #4379 under `Depends on` and PPSA99420 (#1578) under `Unblocks`, as requested. The prior Linux run predates this rebase; I have not rerun it locally, and the description now says so.
screamm commented 2026-10-13 10:42:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-13T10:42:14Z.


Windows validation with title evidence (Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs; base main 2a2a3dc6): 66cd9382 merges cleanly and builds without warnings in the touched files; guest_sched_priority 3/3; suite 688/689, the only failure being patched_libraries, broken on main until #5025; conventions and git diff --check pass. PS5MC (PPSA99420) alone still stops earlier at chflags (ixrw0h2tWuI, #4379); stacked on #4379 it moves from FAIL: unresolved ELF import miQ1wVwSexE from libkernel.prx to FAIL: unresolved ELF import hpoDTzy9Yy0 from libkernel.prx (sigpending, #4383). The only overlap with #4379 is both appending a bullet to docs/dev/debt/libkernel.md.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6143767951 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4374#issuecomment-6143767951). Originally posted by [screamm](https://github.com/screamm) on 2026-10-13T10:42:14Z. --- Windows validation with title evidence (Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including `libs`; base `main` `2a2a3dc6`): `66cd9382` merges cleanly and builds without warnings in the touched files; `guest_sched_priority` 3/3; suite 688/689, the only failure being `patched_libraries`, broken on `main` until #5025; conventions and `git diff --check` pass. PS5MC (PPSA99420) alone still stops earlier at `chflags` (`ixrw0h2tWuI`, #4379); stacked on #4379 it moves from `FAIL: unresolved ELF import miQ1wVwSexE from libkernel.prx` to `FAIL: unresolved ELF import hpoDTzy9Yy0 from libkernel.prx` (sigpending, #4383). The only overlap with #4379 is both appending a bullet to `docs/dev/debt/libkernel.md`.
p3n1cillin commented 2026-10-13 14:10:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by p3n1cillin on 2026-10-13T14:10:48Z.


Title run with this PR: Windows 11, MinGW GCC 15.2.0 (WinLibs), Release. Built on main 3faa9cb40 merged with this PR and the other open PRs that the catalog titles below need (#4377, #4379, #4374, #4383, #3798, #4863, #4105, my #5013/#5061/#5078/#5098/#5009 and the carries #5183/#5186, plus screamm's chroot branch from #3632); every title converted from its catalog release, eboot.bin kept in app0, 60 s runs.

  • PS5MC (PPSA99420): with this PR, #4379, #4383 and #5183 it loads (no absent imports) and, with #5184/#5185/#5186, Kodi reaches its GUI and runs 90 s. This PR's getpriority conflicts textually with #5061's getdtablesize in Process.cpp and docs/dev/debt/libkernel.md (both add a function after getrlimit); keeping both is enough.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6147490864 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4374#issuecomment-6147490864). Originally posted by [p3n1cillin](https://github.com/p3n1cillin) on 2026-10-13T14:10:48Z. --- Title run with this PR: Windows 11, MinGW GCC 15.2.0 (WinLibs), Release. Built on `main` `3faa9cb40` merged with this PR and the other open PRs that the catalog titles below need (#4377, #4379, #4374, #4383, #3798, #4863, #4105, my #5013/#5061/#5078/#5098/#5009 and the carries #5183/#5186, plus screamm's `chroot` branch from #3632); every title converted from its catalog release, `eboot.bin` kept in `app0`, 60 s runs. - PS5MC (PPSA99420): with this PR, #4379, #4383 and #5183 it loads (no absent imports) and, with #5184/#5185/#5186, Kodi reaches its GUI and runs 90 s. This PR's `getpriority` conflicts textually with #5061's `getdtablesize` in `Process.cpp` and `docs/dev/debt/libkernel.md` (both add a function after `getrlimit`); keeping both is enough. AI-assisted (Claude Code).
github-actions[bot] commented 2026-10-13 19:05:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T19:05:44Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#5061 core/libs/prx/libkernel/System/src/Process.cpp L550
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6153056383 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4374#issuecomment-6153056383). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-13T19:05:44Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #5061 | `core/libs/prx/libkernel/System/src/Process.cpp` [L550](https://github.com/boykopovar/AnyPS5/blob/8d98e8851f497df46f07f59f8757b0b8a2e03214/core/libs/prx/libkernel/System/src/Process.cpp#L550) | | |
oneandonlydean commented 2026-10-13 21:36:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T21:36:38Z.


Rebased onto main after #4379 and pushed here, author kept. The only conflict was docs/dev/debt/libkernel.md, where both entries are kept (chflags from #4379, getpriority from this PR). Merging on a green full build.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6155715334 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4374#issuecomment-6155715334). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T21:36:38Z. --- Rebased onto main after #4379 and pushed here, author kept. The only conflict was `docs/dev/debt/libkernel.md`, where both entries are kept (`chflags` from #4379, `getpriority` from this PR). Merging on a green full build.
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!4374
No description provided.