libkernel: wait is absent and getrlimit throws for every resource but RLIMIT_DATA (PS5MC, XPSemu); branch ready #3733

Closed
opened 2026-10-11 16:12:12 +00:00 by screamm · 0 comments
screamm commented 2026-10-11 16:12:12 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-11T16:12:12Z.


libkernel lacks wait (ldVb3lc75PE), and getrlimit answers only RLIMIT_DATA and throws for every other resource. PS5MC (PPSA99420) imports wait (registry index 460, predicted FAIL: unresolved ELF import ldVb3lc75PE from libkernel.prx) and calls getrlimit(RLIMIT_CORE) at seven sites (predicted what(): getrlimit: unsupported resource 4); XPSemu (PPSA97358) asks for RLIMIT_NOFILE in os_setup_limits and only warns on failure.

Branch ready: screamm:feat/libkernel-wait-rlimits (two commits on main a11c8f7f, head 2be0c705: feat(libkernel): implement wait, feat(libkernel): answer getrlimit for the FreeBSD-defined resources). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commits as they are. It conflicts textually with #3650 and with screamm:feat/libkernel-exec-setuid (#3558) only in the main() of GuestGetrlimit.cpp; #3558's setrlimit rule (succeed when the request equals what getrlimit reports) would then also apply to the newly answered resources.

  • wait(status) calls the existing waitpid(-1, status, 0): -1/ECHILD with the status untouched, as FreeBSD 11.4 lib/libc/gen/wait.c over kern_wait6 (8c639945) does when there are no children.
  • getrlimit now returns RLIM_INFINITY for both limits of RLIMIT_CPU, FSIZE, CORE, SBSIZE, VMEM/AS, NPTS, SWAP, KQUEUES and UMTXP, the process-0 defaults in FreeBSD sys/kern/init_main.c proc0_init that every process inherits; RLIMIT_DATA still mirrors the host; EINVAL/EFAULT as before. STACK, NPROC and NOFILE (from the maxssiz/maxproc/maxfiles tunables) and RSS/MEMLOCK (derived from free memory at boot) keep throwing because no public source gives the console's values; all recorded in TechnicalDebt.
  • guest_waitpid and guest_getrlimit pin the behaviour (nine answered values, EFAULT for each, EINVAL, the five throws).

Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs: both tests 3/3; ctest -j8 -E "^agc_driver_|^video_out_flip" 532/536, the failures being the known windows_exceptions (#3411, fixed by #3415), guest_kernel_sys (#3510) and guest_filesystem (#3518) plus the guest_ampr_markers flake (#3371); with main's Process.cpp both extended tests fail; tools/check_conventions.py --base main and git diff --check pass. Not run on Linux.

Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5802807587 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3733). Originally posted by [screamm](https://github.com/screamm) on 2026-10-11T16:12:12Z. --- libkernel lacks `wait` (`ldVb3lc75PE`), and `getrlimit` answers only `RLIMIT_DATA` and throws for every other resource. PS5MC (PPSA99420) imports `wait` (registry index 460, predicted `FAIL: unresolved ELF import ldVb3lc75PE from libkernel.prx`) and calls `getrlimit(RLIMIT_CORE)` at seven sites (predicted `what(): getrlimit: unsupported resource 4`); XPSemu (PPSA97358) asks for `RLIMIT_NOFILE` in `os_setup_limits` and only warns on failure. **Branch ready:** [`screamm:feat/libkernel-wait-rlimits`](https://github.com/screamm/AnyPS5/tree/feat/libkernel-wait-rlimits) (two commits on `main` `a11c8f7f`, head `2be0c705`: `feat(libkernel): implement wait`, `feat(libkernel): answer getrlimit for the FreeBSD-defined resources`). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commits as they are. It conflicts textually with #3650 and with `screamm:feat/libkernel-exec-setuid` (#3558) only in the `main()` of `GuestGetrlimit.cpp`; #3558's `setrlimit` rule (succeed when the request equals what `getrlimit` reports) would then also apply to the newly answered resources. - `wait(status)` calls the existing `waitpid(-1, status, 0)`: `-1`/`ECHILD` with the status untouched, as FreeBSD 11.4 `lib/libc/gen/wait.c` over `kern_wait6` (`8c639945`) does when there are no children. - `getrlimit` now returns `RLIM_INFINITY` for both limits of `RLIMIT_CPU`, `FSIZE`, `CORE`, `SBSIZE`, `VMEM`/`AS`, `NPTS`, `SWAP`, `KQUEUES` and `UMTXP`, the process-0 defaults in FreeBSD `sys/kern/init_main.c` `proc0_init` that every process inherits; `RLIMIT_DATA` still mirrors the host; `EINVAL`/`EFAULT` as before. `STACK`, `NPROC` and `NOFILE` (from the `maxssiz`/`maxproc`/`maxfiles` tunables) and `RSS`/`MEMLOCK` (derived from free memory at boot) keep throwing because no public source gives the console's values; all recorded in TechnicalDebt. - `guest_waitpid` and `guest_getrlimit` pin the behaviour (nine answered values, `EFAULT` for each, `EINVAL`, the five throws). **Tested** on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including `libs`: both tests 3/3; `ctest -j8 -E "^agc_driver_|^video_out_flip"` 532/536, the failures being the known `windows_exceptions` (#3411, fixed by #3415), `guest_kernel_sys` (#3510) and `guest_filesystem` (#3518) plus the `guest_ampr_markers` flake (#3371); with `main`'s `Process.cpp` both extended tests fail; `tools/check_conventions.py --base main` and `git diff --check` pass. Not run on Linux. Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).
Sign in to join this conversation.
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#3733
No description provided.