feat(libkernel): export setrlimit #3980
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3980"
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 MarcZX10 on 2026-10-11T20:28:36Z.
What
Implements the unclaimed
setrlimitexport from #3558. The call validates a null limit before the resource number, maps negative values toRLIM_INFINITY, and clamps a soft limit that exceeds the hard limit, following FreeBSD 11. It returns success when the normalized request matches whatgetrlimitreports. A change throws because the emulator does not store guest limit state; resources thatgetrlimitcannot report remain unsupported.This PR contains only
setrlimit. The credential setters and the separategetrlimitwork are tracked by their own changes.Tested
guest_setrlimit_tests; CTestguest_setrlimitpassed 1/1.tools/check_conventions.py --base upstream/mainandgit diff --checkpassed.Checklist
mainDepends on: none
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T20:28:57Z.
Progress report (
529f7bf→f89c7fb)➖ System libraries: 87.37% (+0.0%, +1 implemented functions)
✅ 1 implemented
setrlimit_nid_postfixImported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-11T22:46:18Z.
I checked this PR on both OSes with XPSemu (PPSA97358) and PS5MC (PPSA99420), catalog builds. With #3580 merged, both stop at
setrlimitonmain5aaf26bd:undefined symbol: 4X0QwvuCfjc (setrlimit)FAIL: unresolved ELF import 4X0QwvuCfjc (setrlimit) from libkernel.prxsetrlimitresolves on both OSes:mlockall(x7g7Ebeo8-U, in your #3650).tcsendbreak(vXE-dIUIZlE, in #3781).FAIL: unresolved ELF import x7g7Ebeo8-U (mlockall) from libkernel.prxand... vXE-dIUIZlE (tcsendbreak) from libkernel.prx.guest_setrlimitpasses 5/5 (--repeat until-fail:5) on both. No warnings inProcess.cpporGuestSetrlimit.cpp.rlim_curtorlim_maxmatches FreeBSD 11'skern_proc_setrlimit(sys/kern/kern_resource.c, stable/11).Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T08:24:46Z.
Conflicts with main in
core/libs/prx/libkernel/System/src/Process.cppanddocs/dev/TechnicalDebt.md; please rebase.Imported from boykopovar/AnyPS5. Originally posted by Nixitov on 2026-10-12T16:43:56Z.
Build verification on Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7), Release fails on this branch:
setrlimit_nid_postfixcallsgetrlimit_nid_postfixat line 322, but that function is only defined at line 489 of the same file, with no declaration in scope before the call (no header declares it on this branch either).A forward declaration before the call fixes it, e.g. in
Process.cpp:I could not run the
setrlimittitles (PPSA50011, PPSA97358, PPSA99420) against this branch because the library does not build, so the "gets past4X0QwvuCfjc" evidence is still untested. Happy to re-run once it compiles.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T19:43:37Z.
Thanks for catching this. I confirmed the current head calls
getrlimit_nid_postfixbefore its definition and has no earlier declaration, so the Windows compile failure is valid. We will update the head before asking you to rerun the build or title checks.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T19:49:25Z.
Fixed in commit
2db6f669with a forward declaration beforesetrlimit_nid_postfix. On Linux, theguest_setrlimit_teststarget builds andctest -R '^guest_setrlimit$'passes 1/1;git diff --checkandtools/check_conventions.py --base origin/mainpass. This environment has no MinGW cross-compiler, so I could not reproduce the Windows build locally. @Nixitov, could you confirm the current head builds on Windows and rerun the title checks now that the compile error is fixed?Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T20:02:27Z.
Additional validation: I installed Debian MinGW-w64 GCC 12 and cross-compiled the affected
Process.cppas a Windows target (x86_64-w64-mingw32-g++ -std=gnu++20 -fno-asynchronous-unwind-tables, project include paths). The translation unit compiles successfully with the declaration on this head. This is not the repository-supported WinLibs GCC 15.2 toolchain and does not replace a native Windows run; @Nixitov, please still confirm on your supported build and retry the title checks when available.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-12T20:52:50Z.
Checked against FreeBSD 11
kern_setrlimit(null limit before resource, negative → infinity, soft clamped to hard), built libkernel and ranguest_setrlimitandguest_getrlimiton Linux (pass). The Windows forward-declaration fix is already on the head.Added in our own commit: moved the TechnicalDebt line next to the
getrlimitone, so it no longer sits at the end of the section where #4651 and #4740 also append.Not verified here: a native Windows build (@Nixitov's MinGW GCC 15.2 run) and behaviour on the console. Merging once CI is green.