libc: random, srandom, initstate and setstate are absent imports of eight catalog titles; fix branch ready #3164
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 screamm on 2026-10-10T23:47:33Z.
libc (libSceLibcInternal) does not export the BSD
random,srandom,initstateandsetstate(NIDsw1o05aHJT4c,sPC7XE6hfFY,IIUY-5hk-4k,woQta4WRpk0, confirmed withtools/nid_names.pyagainst aerolib). An import audit of the homebrew catalog onmain262c0316(Windows, see my comment on #1578) lists them as absent imports:randomin PPSA74126, PPSA85300 (VLC), PPSA99169 (RetroArch), PPSA99177, PPSA99420, PPSA99505, PPSA99515, PPSA99810 (PSBox);srandomin PPSA85300, PPSA99169, PPSA99420, PPSA99810;initstate/setstatein PPSA99177, PPSA99420, PPSA99505, PPSA99515. Each becomes a stop once the title's earlier stop is passed; no run has stopped on them yet.Fix branch ready:
screamm:feat/libc-random-state(dd2e0716, one commit onmain91b13413). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commit as is. No open or closed PR implements them.src/Random.cppfollows FreeBSD 11lib/libc/stdlib/random.c(stable/11 at4ab2e064) exactly: the default 128-byte TYPE_3 table,good_rand, the seeding rounds, the degree table and size rounding, the packed type/position word, the bad-state check insetstate; guestlongis 64-bit, the seed is cut to 32 bits as in FreeBSD, the state buffer is read and written byte-wise so unaligned buffers are safe.initstatewith fewer than 8 bytes returns NULL without touching errno (FreeBSD does not set EINVAL; glibc does). A null state throws. Calls are serialised with one mutex like the existingrand, because unlocked concurrent calls could write outside the guest buffer; the single-thread sequence is unchanged. All of this is in TechnicalDebt, including that the console's generator is unverified.guest_random_statepins the first values of the default andsrandom(1)sequence (1408992891, 1638182910, 83848093, 145962118, 627851256) and of seed 12345, computed from the unchanged FreeBSD file and a separate Python model; plus the 32-bit seed cut, the size rounding, the previous-state returns and resuming throughsetstate, the bad-state, small-buffer and null cases, and a 4-thread run.Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,
BUILD_TESTING=ON, full build includinglibs:guest_random_state3/3;ctest -j8 -E "^agc_driver_|^video_out_flip"480/480;tools/check_conventions.py --base mainandgit diff --checkpass. Not run on Linux.Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T02:08:45Z.
Carried in #3229 with your commit as is. The only change on top moves the TechnicalDebt line to "Unknown function info". I checked the pinned sequences against FreeBSD 11's
random.ccompiled unchanged, and they match.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T02:42:06Z.
Fixed by #3229.