Skip to content

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

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
MarcZX10:codex/carry-getpriority-3632
Oct 13, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
MarcZX10:codex/carry-getpriority-3632

Conversation

@MarcZX10

@MarcZX10 MarcZX10 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Progress report (8d98e88 → 1ba0a81)

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

✅ 1 implemented
Library Name
libkernel getpriority_nid_postfix

@xXPBSXx

xXPBSXx commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

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.

@MarcZX10
MarcZX10 force-pushed the codex/carry-getpriority-3632 branch from 46614e2 to 94ba790 Compare October 12, 2026 16:10
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@MarcZX10
MarcZX10 force-pushed the codex/carry-getpriority-3632 branch 2 times, most recently from 8d212f2 to 8c87cae Compare October 12, 2026 18:49
@oneandonlydean oneandonlydean self-assigned this Oct 12, 2026
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@screamm

screamm commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

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.

danielradosa added a commit to danielradosa/AnyPS5 that referenced this pull request Oct 13, 2026
getpriority reuses the existing errnoNoSuchProcess/errnoInvalidArgument constants instead of a duplicate guestNoProcess; the test drops its second __error_nid_postfix declaration.
@p3n1cillin

Copy link
Copy Markdown

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.

AI-assisted (Claude Code).

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

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

PS5MC (PPSA99420, Kodi 22) imports getpriority (miQ1wVwSexE) from
libkernel.prx, one reference, next to chflags in its import order.
Predicted stop once the imports ahead of it are covered (not a run):

  FAIL: unresolved ELF import miQ1wVwSexE from libkernel.prx

The NID is computed with tools/nid_names.py and matches aerolib.

Follows FreeBSD 11.4 sys/kern/kern_resource.c sys_getpriority
(8c639945a44588f6cfdddfb057bb5aad88735da0) for the only guest process,
taken to run at nice 0 and to lead its own process group (as kill and
setsid already assume): PRIO_PROCESS and PRIO_PGRP with 0 or its pid,
and PRIO_USER with 0 or its uid 0, return 0; other ids give ESRCH and
an unknown which gives EINVAL. getpriority is a bare system call in
FreeBSD's libc (lib/libc/sys/Symbol.map), so errno is left unchanged
on success.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit 6326224)
@oneandonlydean
oneandonlydean force-pushed the codex/carry-getpriority-3632 branch from b515899 to 1ba0a81 Compare October 13, 2026 21:23
@oneandonlydean

Copy link
Copy Markdown
Collaborator

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.

@oneandonlydean
oneandonlydean merged commit 665ad7d into boykopovar:main Oct 13, 2026
8 checks passed
@Nixitov Nixitov mentioned this pull request Oct 13, 2026
11 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants