docs(libc): record fopen and freopen of directories as measured on a PS5 #10251

Merged
orezraey merged 2 commits from upstream-pr/10251 into main 2026-10-27 07:52:16 +00:00
orezraey commented 2026-10-23 15:43:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by orezraey on 2026-10-23T15:43:10Z.


What

fopen and freopen on directories, and the mode strings, measured on a retail PS5 (firmware 13.60) through libSceLibcInternal.sprx from a payload process. The source and console log are in this gist (pfopen).

The debt entry said what the console's filesystems return for a directory stream was unverified. The console:

  • opens a directory in a read mode (r, rb, rw), and fread returns its raw directory blocks for /data and /system, or fails with EIO and sets the error indicator for /;
  • lets freopen reopen a stream onto a directory in a read mode.

AnyPS5 keeps failing a directory read with EISDIR, since the host's directory blocks are not the console's, and on Windows freopen onto a directory still fails with EACCES; the entry now says both. The other answers already matched and gain tests: EEXIST for wx on an existing file, EINVAL for an unknown or empty mode, rw read as r. EISDIR for a directory in a write or update mode and ENOENT for a missing file were already tested.

Tested

Windows 11, MinGW (winlibs).

  • guest_filesystem checks wx, the invalid modes and rw, and passes three runs in a row.
  • tools/check_conventions.py passes.
  • tools/pr_overlap.py reports only shared files.

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 under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: #9763, #10433 (merge order only: they edit the same lines; this PR is refreshed after them)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4985359069 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10251). Originally posted by [orezraey](https://github.com/orezraey) on 2026-10-23T15:43:10Z. --- ### What `fopen` and `freopen` on directories, and the mode strings, measured on a retail PS5 (firmware 13.60) through `libSceLibcInternal.sprx` from a payload process. The source and console log are in [this gist](https://gist.github.com/orezraey/ebb4cfc0db793b19d47cd8d1c6222875) (`pfopen`). The debt entry said what the console's filesystems return for a directory stream was unverified. The console: - opens a directory in a read mode (`r`, `rb`, `rw`), and `fread` returns its raw directory blocks for `/data` and `/system`, or fails with `EIO` and sets the error indicator for `/`; - lets `freopen` reopen a stream onto a directory in a read mode. AnyPS5 keeps failing a directory read with `EISDIR`, since the host's directory blocks are not the console's, and on Windows `freopen` onto a directory still fails with `EACCES`; the entry now says both. The other answers already matched and gain tests: `EEXIST` for `wx` on an existing file, `EINVAL` for an unknown or empty mode, `rw` read as `r`. `EISDIR` for a directory in a write or update mode and `ENOENT` for a missing file were already tested. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11, MinGW (winlibs). - `guest_filesystem` checks `wx`, the invalid modes and `rw`, and passes three runs in a row. - `tools/check_conventions.py` passes. - `tools/pr_overlap.py` reports only shared files. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: #9763, #10433 (merge order only: they edit the same lines; this PR is refreshed after them) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
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!10251
No description provided.