ProsperoEden declares the setter with the mode as its argument and the
getter with an int output, and measured on a PS5 that modes 0 and 1 are
accepted, 2 to 7 return 0x80020016 and 1 is the default. Both threw as
discovered stubs. Other modes and a null output throw.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
rand and rand_r both used FreeBSD's do_rand (Park and Miller on
state % 0x7ffffffe + 1, minus one), so rand returned values up to
0x7ffffffd and rand(), rand_r() and every seeded sequence differed
from the console. The libc.prx that titles ship (the same code in the
copies of PPSA13934, PPSA07923 and PPSA05916, read from disassembly)
uses two different generators:
- rand steps a 64-bit state, initially 1, as
state * 0x5851F42D4C957F2D + 1 and returns (state >> 32) & 0x3FFFFFFF,
so its results stay at or below 0x3FFFFFFF. srand stores the seed
zero-extended as that state.
- rand_r is the minimal standard generator, state * 16807 modulo
2^31 - 1 on the signed 32-bit state (1 gives 16807, 282475249,
1622650073), and a zero state becomes 0x2AE1B767.
guest_math now expects those results: the rand_r chain from 1, the
zero and 0x7FFFFFFF states, rand after srand(1), srand(0) and
srand(0xFFFFFFFF), and rand's range over 1000 calls. Its previous
checks expected FreeBSD's values and rand matching rand_r.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add the BSD "quad" `strtoq` export for the libc PRX as a thin wrapper
around `strtoll`, as FreeBSD 11.4 lib/libc/stdlib/strtoq.c does. The
unsigned sibling `strtouq` is already here as the same alias of
`strtoull`. Extend the guest wide strings test to probe the signed
path on an under/overflow run and a short positive run with a trailing
non-digit. Document the export in docs/dev/debt/libc.md with the
registry NID `yUUOxgk8Dmc`; console behavior is unverified beyond the
existing `strtoll` contract.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
Two host differences failed all 19 feupdateenv tests on macOS:
- Apple's libc++ looks up /usr/lib/libstdc++.6.dylib with a no-load
dlopen the first time a process builds a std::logic_error, and that
failed lookup leaves errno at ENOENT. The null check builds the first
one, so it saw errno change although feupdateenv never touched it. The
test now builds one std::invalid_argument on macOS before the checks.
- Rosetta 2 keeps the six MXCSR exception masks set and raises no
floating-point trap, x87 included. The mask check now expects the SSE
masks the host keeps, and the pending-trap tests are skipped (exit 77)
on a host that does not keep an unmasked MXCSR exception. A libc debt
entry for feupdateenv records it.
Unset, ScanHostVolumes returns no volume, so nothing is scanned or
exposed and the guest sees no USB storage, as on main. The test checks
that injected volumes are neither listed nor raised by a rescan with the
switch off, and turns it on for the device cases.