feat(libc): implement unlocked character I/O #3375
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3375"
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 MarcZX10 on 2026-10-11T09:24:19Z.
What
Implement the missing
getc_unlockedandputc_unlockedimports with host unlocked byte I/O while keeping guest EOF/error state and read/write macro counters synchronized.This replaces closed #1765. The original PR was closed when no title reached these imports; new title evidence in its discussion now identifies them as a blocker. GitHub froze the closed PR head, so this branch carries the corrected change on current
main. The original implementation commit is preserved, and Romans Pokrovskis's lock-free status fix is a separate commit adapted from his fork commit.Linux
feofandferrormay reacquire the stream lock, so status synchronization after unlocked byte I/O usesfeof_unlockedandferror_unlocked. Windows uses_fgetc_nolockand_fputc_nolock; the UCRT status queries were exercised while another thread held the stream lock. Console and other host CRT behavior remain unverified; the limitation is recorded inTechnicalDebt.md.The Porpoise (PPSA99764) report on #1765 identifies
putc_unlockedas its next unresolved import. Its startup log after #3261 wasapp.elf: symbol lookup error: app.elf: undefined symbol: H-QeERgWuTM. The run used original head151814a3and then stopped atpathconf; that is evidence of import reachability, not validation of this corrected head. The separate Sonic Unleashed Recompiled (PPSA99902) validation reports that replacing onlylibc.prxadvances startup fromputc_unlockedtolocaleconv. That run used a local experimental integration and prerequisites, so it is not an unmodified-main startup claim.Tested
On Linux x86-64, GCC 12.2, Release, current
main(5ad2cb8):guest_standard_stream_tests.guest_standard_streamspassed five consecutive runs (--repeat until-fail:5), including held-lock reads and writes, byte conversion, EOF/error status, and error clearing.python3 tools/check_conventions.py --base upstream/mainandgit diff upstream/main...HEAD --checkpassed.Independent validation of the same corrective patch on an earlier base (
ccf9ff9):guest_standard_streamspassed 5/5; held-lock native probes passed for five reads and five writes. This was not rerun on the current head.Windows on the current head and PS5 hardware were not tested.
Checklist
main; no other open PR implements these functionsNotImplemented_nid_no_patch); no stub added.mdfiles or images addedImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T09:24:40Z.
Progress report (
09bd4aa→228532e)📈 System libraries: 85.49% (+0.01%, +2 implemented functions)
✅ 2 implemented
getc_unlocked_nid_postfixputc_unlocked_nid_postfixImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T09:31:00Z.
Checked the unlocked byte I/O and status sync (
feof_unlocked/ferror_unlocked), the held-lock tests and the TechnicalDebt entry;guest_standard_streamspasses on Linux, and fails to link without the change. Windows held-lock results by @Amoenus noted; merging once CI is green.