feat(libc): implement flockfile and funlockfile #3081

Merged
MarcZX10 merged 1 commit from upstream-pr/3081 into main 2026-10-10 22:00:54 +00:00
MarcZX10 commented 2026-10-10 21:51:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T21:51:04Z.


What

Carry babyhuey's explicitly offered flockfile/funlockfile fix from issue #1578. Both exports now use the existing per-stream lock, so recursive locking and contention with standard I/O share the same synchronization.

Tested

The contributor reports guest_standard_streams passing at least 3 repeated runs on Linux, and 3/3 on Windows in a combined test branch. The test checks recursive lock counts and that another thread's fputc remains blocked until the matching unlocks. In this session, conventions and git diff --check passed; the full local CMake configure was blocked by the unavailable pinned SDL2 submodule commit.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4814683799 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3081). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-10T21:51:04Z. --- ### What Carry babyhuey's explicitly offered `flockfile`/`funlockfile` fix from issue #1578. Both exports now use the existing per-stream lock, so recursive locking and contention with standard I/O share the same synchronization. ### Tested The contributor reports `guest_standard_streams` passing at least 3 repeated runs on Linux, and 3/3 on Windows in a combined test branch. The test checks recursive lock counts and that another thread's `fputc` remains blocked until the matching unlocks. In this session, conventions and `git diff --check` passed; the full local CMake configure was blocked by the unavailable pinned SDL2 submodule commit. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-10 21:51:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T21:51:49Z.


Progress report (262c031 → 92c9296)

📈 System libraries: 84.45% (+0.01%, +2 implemented functions)

✅ 2 implemented
Library Name
libc flockfile_nid_postfix
libc funlockfile_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6102557609 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3081#issuecomment-6102557609). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-10T21:51:49Z. --- <!-- progress-report --> ### Progress report (262c031 → 92c9296) 📈 **System libraries**: 84.45% (+0.01%, +2 implemented functions) <details> <summary>✅ 2 implemented</summary> | Library | Name | | - | - | | libc | `flockfile_nid_postfix` | | libc | `funlockfile_nid_postfix` | </details>
adriadam10 commented 2026-10-10 22:00:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T22:00:50Z.


Checked on Linux: build + guest_standard_streams pass, and the new test fails to link without the change. flockfile/funlockfile reuse the per-stream lock that standard I/O takes, so recursion and cross-thread blocking are covered. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6102632711 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3081#issuecomment-6102632711). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T22:00:50Z. --- Checked on Linux: build + `guest_standard_streams` pass, and the new test fails to link without the change. `flockfile`/`funlockfile` reuse the per-stream lock that standard I/O takes, so recursion and cross-thread blocking are covered. Merging.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!3081
No description provided.