feat(libc): implement random, srandom, initstate and setstate #3229
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3229"
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 adriadam10 on 2026-10-11T02:08:39Z.
What
Carries @screamm's branch from #3164 (
feat/libc-random-state, commitdd2e0716kept as is, with its authorship). Intake is paused for new contributors and the issue asks a maintainer to carry it.It adds the BSD
random,srandom,initstateandsetstate(w1o05aHJT4c,sPC7XE6hfFY,IIUY-5hk-4k,woQta4WRpk0, fromlibSceLibcInternal), following FreeBSD 11lib/libc/stdlib/random.c. Details are in #3164.Titles:
mainf1ae427b6for Windows. I relinked the sha256-checked catalog release withrelinker --windows --registryand walked its imports in the order the entry stub resolves them (WindowsEntryStubBuilder, first unresolved import fails). With the bundledlibc.prxsearched as the stub does, the first import nothing exports issetstate. This comes from that walk, not from a run.random,initstateandsetstatetoo, and so do the other titles listed in #3164. They stop earlier, on exports other PRs cover.My commit only moves the TechnicalDebt line from the end of "Functional" to "Unknown function info", next to the other libc lines, since the console's generator isn't verified.
Tested
Linux (CachyOS), GCC 16, Release.
guest_random_statepasses.random.c(releng/11.0), compiled unchanged apart fromsrandomdev, gives the same first values for the default state (1408992891, 1638182910, 83848093, 145962118, 627851256) and forsrandom(12345)(1052984060, 1639322404, 1971525204, 2097956667, 2012147915).good_randconstant, the output shift or the number of seeding rounds each makes the test fail.tools/check_conventions.pypasses.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-11T02:09:13Z.
Progress report (
84cc975→b1267b3)📈 System libraries: 85.99% (+0.02%, +4 implemented functions)
✅ 4 implemented
initstate_nid_postfixrandom_nid_postfixsetstate_nid_postfixsrandom_nid_postfixImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T02:42:04Z.
Merged: Linux CI is red only on
agc_unit_shadow, which main has failed since #2864 (reported in #3215). Windows passed, andguest_random_statepassed on both.