feat(libkernel): implement getrlimit for RLIMIT_DATA #1675
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1675"
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 Recapi on 2026-10-08T16:13:42Z.
What
getrlimitin libkernel forRLIMIT_DATA(2), the only resource the importing titles read.getrlimit(RLIMIT_DATA), withRLIM_INFINITYreported as the FreeBSDRLIM_INFINITY(INT64_MAX); on Windows the job object's process memory limit, orRLIM_INFINITYwhen the process has none.kern_getrlimit: a resource outside 0..14 returns -1 withEINVAL, checked before the output pointer; a null pointer returns -1 withEFAULT.Caller: PPSA99005 (blackbearreloaded/ps5-opengl v1.0.1) imports
getrlimit(#1578; 19 of the 34 catalog titles in the audit there). In its SDK (ps5-opengl-sdk 1.0.1) the only references are in Mesa,libmesa_util.aos_misc.c.oandlibpsbc.ps5.aos_misc.ps5.o:os_get_available_system_memory(src/util/os_misc.c, FreeBSD branch) callsgetrlimit(RLIMIT_DATA)aftersysctl(CTL_HW, HW_USERMEM). Values on hardware were not measured.Log
PPSA99005 (blackbearreloaded/ps5-opengl showcase v1.0.1), relinked on Linux (Ubuntu, GCC 15.2.0,
mainf1451396, bundledlibc.prxkept) and run in abwrapsandbox. Onmainit stops onmkstemp, as in #1578:With the open PRs for its earlier absent imports merged locally (#1978, #1869, #1656, #1729, #1613, #1714, #1482, #1650, #1872, #1641, #1685, #1859; no conflicts), the stops are:
Wh7HbV7JFqc(getrlimit, #1675)JZKw5+Wrnaw(pthread_sigmask, no PR yet)pthread_sigmaskexportnnoxZUHK+SA(pthread_getcpuclockid, #1676)Each stop is the loader's line, e.g.
./app.elf: symbol lookup error: ./app.elf: undefined symbol: Wh7HbV7JFqc. The throwawaypthread_sigmaskonly exports the NID and throws when called; it was not called before the abort.Tested
Ubuntu, Linux 7.0, GCC 15.2.0, full build with
BUILD_TESTING=ON. New testguest_getrlimit: matches the hostgetrlimit(RLIMIT_DATA), reports a loweredsetrlimitsoft limit,EINVAL/EFAULTorder, throws forRLIMIT_NOFILEandRLIMIT_AS. Patchedlibkernel.prxexportsWh7HbV7JFqc.The project's Build workflow on the fork (Linux, Windows MinGW, relinker on Ubuntu/Windows/macOS) passes; the run is linked in a comment below. Run with PPSA99005 as above.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.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-08T17:08:39Z.
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.
main)__error_nid_postfix__error_nid_postfix__error_nid_postfix__error_nid_postfix__error_nid_postfix__error_nid_postfixImported from boykopovar/AnyPS5. Originally posted by Recapi on 2026-10-08T17:25:27Z.
CI is waiting for first-time contributor approval here, so I ran the project's Build workflow (
build.yml,workflow_dispatch) on the fork for this head (851f3b7a): https://github.com/Recapi/AnyPS5/actions/runs/37876692013guest_getrlimitpassedguest_getrlimitpassedOverlap: no textual conflict with the open PRs that change these files (
git merge-treeagainst each; #1128, the clang-format of the tree, already conflicts withmain). The test registration now followsguest_kernel_errors, clear of #1908's and #1477's insertions. The__error_nid_postfixrows are the declaration used to seterrno, not an export.Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T10:04:01Z.
First Windows run, since the description says it wasn't tested on Windows.
Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Merged onto
mainb7218b3ctogether with nine other small libc/libkernel PRs: #1975, #1976, #1977, #1859, #1685, #1676, #1641, #1656, #1807.guest_getrlimitpasses (on Windows it takes the test's_WIN32branch,GuestLimit(GUEST_RLIMIT_DATA)).🤖 Addressed by Claude Code
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T22:00:54Z.
Checked on Linux (merged onto current
main): full build + ctest 524/524,guest_getrlimitpasses and fails to link without the change. Error order (EINVALfor a resource outside 0..14 before the pointer, thenEFAULT) matches FreeBSDkern_getrlimit, and reporting no limit by default agrees with SharpProspero'sgetrlimit. Windows run by @popcoder565 passes too. Merging.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T22:01:17Z.
Progress report (
f145139→851f3b7)➖ System libraries: 84.76% (+0.0%, +1 implemented functions)
✅ 1 implemented
getrlimit_nid_postfix