fix(libc): answer strerror as the titles' libc.prx does #10312
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10312"
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 ntamas94 on 2026-10-23T17:27:53Z.
What
strerrornow answers as thelibc.prxthat PS4 titles ship insce_module/: 0 is "No error", 1 to 94 keep the FreeBSD texts (30 becomes "Read-only filesystem"), and every other number, 95 and 96 included, gives "error_code=0x%08x"; errno is no longer touched. Onmainit returned "No error: 0", named 95 and 96, answered "Unknown error: %d" and set errno to 22.strerror_randperrorkeep their wording and errors; only the shared EROFS text changes for them, as it is the same table.guest_errorsnow expects these values for 0 to 96, 97, 9999,INT_MAX, -1 andINT_MIN, and checks that errno stays.The console's system libc, which homebrew without a bundled
libc.prxuses, answers differently ("No error information" for 0 and unknown numbers, 95 and 96 named); titles load their own module, so this follows the module. The debt entry records both.Tested
Windows 11, MinGW-w64 GCC (winlibs), Ninja:
guest_errorspassed on the final head (8305168); withmain'sErrors.cppit aborts.guest_err, which printsstrerrortexts, passes.python tools/check_conventions.py --base origin/mainpasses.Measured on a PS4 Pro (firmware 10.71): the bundled
libc.prxof CUSA04865 and of CUSA12435 (two different builds of the module), my own dumps, fake-signed and loaded into a homebrew process withsceKernelLoadStartModulenext to the system libc (differentsceKernelDlsymaddresses for each module). Both give the same rows; errno was set to 1234 before each call and read back:Every number from 1 to 94 matches the existing table word for word except 30. Not run with a title.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T21:22:21Z.
Review: APPROVED
Reviewed the changed
strerrorpath, tests, and debt note. The measured bundled-module behavior is separated clearly from system-libc behavior, and the implementation preserves errno while formatting unknown and out-of-range values as unsigned 32-bit hex. The regression test covers 0..96 plus large positive/negative boundaries and verifies errno preservation;strerror_rretains its prior unknown-error contract. Thestrerrorchange only changes the shared EROFS message used by strerror_r/perror, which is called out. Hosted eligibility, conventions, intake, labels, relinker matrix, and auxiliary checks pass; full Linux/Windows jobs were skipped by workflow policy. No blocking issue found in the reviewed diff.