fix(libSceSystemService): answer the shell core free size calls with the host's disk space #16787

Merged
xXPBSXx merged 3 commits from upstream-pr/16787 into main 2026-11-11 21:30:48 +00:00
xXPBSXx commented 2026-11-07 16:26:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-11-07T16:26:21Z.


What

sceShellCoreUtilGetFreeSizeOfUserPartition and sceShellCoreUtilGetFreeSizeOfAvContentsTmp threw as unimplemented. On a PS5 the first returns 0 with a non-zero free and total size and the second returns a non-zero size. They now return the available and total bytes of the host disk that holds the working directory (the partition call) and the available bytes (the other call). The exact values, the units and what the partition covers were not measured, and the debt entry says so. No title checked calls these functions.

Tested

Measured on a PS5 with firmware 11.60 (kernel_get_fw_version 0x11600005), from a homebrew payload process (ps5-payload-sdk v0.45, elfldr), on 2026-11-06 at 17:49 UTC and 18:19 UTC (two runs, identical); the console's own clock read about 1 h 41 min more (see the first comment). Only zero versus non-zero was recorded. A title process may differ.

call PS5, payload process, firmware 11.60 main before here now
sceShellCoreUtilGetFreeSizeOfUserPartition(&free, &total) 0, free non-zero, total non-zero throws 0, free non-zero, total non-zero
sceShellCoreUtilGetFreeSizeOfAvContentsTmp() non-zero throws non-zero

The new test guest_system_service_free_size checks the return value, that both sizes are non-zero and that free is not above total. On Ubuntu 24.04 under WSL2 with GCC 13.3.0 and an AddressSanitizer build, on main 2150294122 the test commit alone aborts ("sceShellCoreUtilGetFreeSizeOfUserPartition not implemented"), and with the fix commit on the same main it passes in 0.33 s. All 40 guest_system_service* tests pass with this change when leak detection is off; with it on, guest_system_service_usb_storage reports a leak that this change does not touch. tools/check_conventions.py --base upstream/main passes.

Overlap: the 14 other open pull requests that change docs/dev/debt/libSceSystemService.md, PendingExports.cpp, the library's CMakeLists.txt or GuestSystemServiceFreeSize.cpp were checked on 2026-11-07 between 16:05 UTC and 16:12 UTC against main dd00a9c54e (the base of this change is the older 2150294122; it still merges without a conflict); two more (#12848 and #14330) have been merged. Five already conflict with main without this change (#15947 and #8651 in the debt file, #16463, #14212 and #12315 in other files), and none conflicts only with this change. The other nine merge cleanly with and without it, among them #16546, which edits another entry of the debt file.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (system service change)
  • AI-assisted: yes

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5203617983 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16787). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-11-07T16:26:21Z. --- ### What `sceShellCoreUtilGetFreeSizeOfUserPartition` and `sceShellCoreUtilGetFreeSizeOfAvContentsTmp` threw as unimplemented. On a PS5 the first returns 0 with a non-zero free and total size and the second returns a non-zero size. They now return the available and total bytes of the host disk that holds the working directory (the partition call) and the available bytes (the other call). The exact values, the units and what the partition covers were not measured, and the debt entry says so. No title checked calls these functions. ### Tested Measured on a PS5 with firmware 11.60 (`kernel_get_fw_version` 0x11600005), from a homebrew payload process (ps5-payload-sdk v0.45, elfldr), on 2026-11-06 at 17:49 UTC and 18:19 UTC (two runs, identical); the console's own clock read about 1 h 41 min more (see the first comment). Only zero versus non-zero was recorded. A title process may differ. | call | PS5, payload process, firmware 11.60 | `main` before | here now | |---|---|---|---| | `sceShellCoreUtilGetFreeSizeOfUserPartition(&free, &total)` | 0, free non-zero, total non-zero | throws | 0, free non-zero, total non-zero | | `sceShellCoreUtilGetFreeSizeOfAvContentsTmp()` | non-zero | throws | non-zero | The new test `guest_system_service_free_size` checks the return value, that both sizes are non-zero and that free is not above total. On Ubuntu 24.04 under WSL2 with GCC 13.3.0 and an AddressSanitizer build, on `main` `2150294122` the test commit alone aborts ("sceShellCoreUtilGetFreeSizeOfUserPartition not implemented"), and with the fix commit on the same `main` it passes in 0.33 s. All 40 `guest_system_service*` tests pass with this change when leak detection is off; with it on, `guest_system_service_usb_storage` reports a leak that this change does not touch. `tools/check_conventions.py --base upstream/main` passes. Overlap: the 14 other open pull requests that change `docs/dev/debt/libSceSystemService.md`, `PendingExports.cpp`, the library's `CMakeLists.txt` or `GuestSystemServiceFreeSize.cpp` were checked on 2026-11-07 between 16:05 UTC and 16:12 UTC against `main` `dd00a9c54e` (the base of this change is the older `2150294122`; it still merges without a conflict); two more (#12848 and #14330) have been merged. Five already conflict with `main` without this change (#15947 and #8651 in the debt file, #16463, #14212 and #12315 in other files), and none conflicts only with this change. The other nine merge cleanly with and without it, among them #16546, which edits another entry of the debt file. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a (system service change) <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no --> AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!16787
No description provided.