feat(libSceLibcInternal): implement _readdir_unlocked and _seekdir #13881

Merged
heditrigui merged 13 commits from upstream-pr/13881 into main 2026-11-07 23:38:13 +00:00
heditrigui commented 2026-10-31 11:01:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by heditrigui on 2026-10-31T11:01:29Z.


What

Implements _readdir_unlocked and _seekdir in libSceLibcInternal (core/libs/prx/libSceLibcInternal/Directory.cpp), replacing their placeholder stub declarations in InventoryExports.cpp (libSceLibcInternalInventory_276_nid_no_patch and libSceLibcInternalInventory_282_nid_no_patch):

  • _readdir_unlocked (-u3XfqNumMU): implements FreeBSD 11.4 _readdir_unlocked(dirp, skip) (lib/libc/gen/readdir.c), performing unlocked traversal without acquiring dd_lock. Skips zero-inode entries (fileNumber == 0) when skip != 0 (adopted also in readdir and readdir_r wrappers) and preserves them when skip == 0. Returns nullptr with errno = EBADF (9) on a null directory pointer.
  • _seekdir (Do3zPpsXj1o): implements FreeBSD 11.4 _seekdir(dirp, loc) (lib/libc/gen/telldir.c), performing unlocked repositioning without acquiring dd_lock. Shares the underlying seek handler where unrecognized offsets set EINVAL (indexed), forward to seek callbacks (descriptor), or pass to host seekdir (native). Sets errno = EBADF (9) on a null directory pointer.

Tested

  • Extended core/libs/tests/GuestOpendir2.cpp verifying:
    • _readdir_unlocked_nid_postfix(nullptr, 0) fails with nullptr and sets errno = 9 (EBADF).
    • _seekdir_nid_postfix(nullptr, 0) sets errno = 9 (EBADF).
    • Traversing directory entries with _readdir_unlocked_nid_postfix retrieves all directory entries matching standard readdir.
    • Bookmarking position with telldir_nid_postfix and seeking back via _seekdir_nid_postfix correctly rewinds traversal so _readdir_unlocked_nid_postfix reads the bookmarked entry again.
    • On a descriptor-backed directory fixture with zero-inode deleted entries:
      • readdir_nid_postfix and readdir_r_nid_postfix skip zero-inode records and return active first.
      • _readdir_unlocked_nid_postfix(fakeDir, 1) skips zero-inode records (fileNumber == 0) and returns active.
      • _readdir_unlocked_nid_postfix(fakeDir, 0) preserves zero-inode records and returns deleted.
  • Ran python core/libs/tests/test_public_headers.py --audit-only (399 libraries, 26,745 exports checked; 0 errors).
  • Ran python tools/check_conventions.py --base upstream/main --head HEAD (all conventions checks passed; 0 errors).

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: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5096917090 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13881). Originally posted by [heditrigui](https://github.com/heditrigui) on 2026-10-31T11:01:29Z. --- ### What Implements `_readdir_unlocked` and `_seekdir` in `libSceLibcInternal` (`core/libs/prx/libSceLibcInternal/Directory.cpp`), replacing their placeholder stub declarations in `InventoryExports.cpp` (`libSceLibcInternalInventory_276_nid_no_patch` and `libSceLibcInternalInventory_282_nid_no_patch`): - `_readdir_unlocked` (`-u3XfqNumMU`): implements FreeBSD 11.4 `_readdir_unlocked(dirp, skip)` (`lib/libc/gen/readdir.c`), performing unlocked traversal without acquiring `dd_lock`. Skips zero-inode entries (`fileNumber == 0`) when `skip != 0` (adopted also in `readdir` and `readdir_r` wrappers) and preserves them when `skip == 0`. Returns `nullptr` with `errno = EBADF` (9) on a null directory pointer. - `_seekdir` (`Do3zPpsXj1o`): implements FreeBSD 11.4 `_seekdir(dirp, loc)` (`lib/libc/gen/telldir.c`), performing unlocked repositioning without acquiring `dd_lock`. Shares the underlying seek handler where unrecognized offsets set `EINVAL` (indexed), forward to seek callbacks (descriptor), or pass to host `seekdir` (native). Sets `errno = EBADF` (9) on a null directory pointer. ### Tested - Extended `core/libs/tests/GuestOpendir2.cpp` verifying: - `_readdir_unlocked_nid_postfix(nullptr, 0)` fails with `nullptr` and sets `errno = 9` (`EBADF`). - `_seekdir_nid_postfix(nullptr, 0)` sets `errno = 9` (`EBADF`). - Traversing directory entries with `_readdir_unlocked_nid_postfix` retrieves all directory entries matching standard `readdir`. - Bookmarking position with `telldir_nid_postfix` and seeking back via `_seekdir_nid_postfix` correctly rewinds traversal so `_readdir_unlocked_nid_postfix` reads the bookmarked entry again. - On a descriptor-backed directory fixture with zero-inode deleted entries: - `readdir_nid_postfix` and `readdir_r_nid_postfix` skip zero-inode records and return `active` first. - `_readdir_unlocked_nid_postfix(fakeDir, 1)` skips zero-inode records (`fileNumber == 0`) and returns `active`. - `_readdir_unlocked_nid_postfix(fakeDir, 0)` preserves zero-inode records and returns `deleted`. - Ran `python core/libs/tests/test_public_headers.py --audit-only` (399 libraries, 26,745 exports checked; 0 errors). - Ran `python tools/check_conventions.py --base upstream/main --head HEAD` (all conventions checks passed; 0 errors). ### 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: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-31 11:05:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T11:05:36Z.

Review: DISMISSED


Reviewed — changes requested

The replacement functions currently lose their NID export aliases, and _readdir_unlocked does not preserve the referenced FreeBSD argument or behavior.

What I ran

Reviewed head 21960ccf49288d0e342c59cbe7b6f9b18d01df9d against base 1847a6f9da38f03d1b92952ca6977a40278615e7; the dependency and merge previews were clean. Environment: Debian Linux x86_64, Python 3.11.2. No local build or C++ test was run.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 13881
python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base 1847a6f9da38f03d1b92952ca6977a40278615e7 --head 21960ccf49288d0e342c59cbe7b6f9b18d01df9d --json
git diff --check 1847a6f9da38f03d1b92952ca6977a40278615e7...21960ccf49288d0e342c59cbe7b6f9b18d01df9d
gh pr checks 13881 --repo boykopovar/AnyPS5

Results

Check Result
Diff and conventions Passed.
Dependency/current-base preview Passed.
ABI audit passed_with_warnings; it reports both previous NID stub exports as removed. The exact-head implementation has no replacement aliases.
Source review Found two blocking compatibility issues below.
Hosted CI Still queued when checked.
Local build/tests Not run under the no-build initial-review rule.
Relevant unedited output
status: passed_with_warnings
findings: 2
{'symbol': 'libSceLibcInternalInventory_276_nid_no_patch', 'kind': 'export-removed', 'message': 'This APS5_VABI declaration, definition, or explicit alias appeared in the changed base files but not in the corresponding head files; verify that removing it is intentional.'}
{'symbol': 'libSceLibcInternalInventory_282_nid_no_patch', 'kind': 'export-removed', 'message': 'This APS5_VABI declaration, definition, or explicit alias appeared in the changed base files but not in the corresponding head files; verify that removing it is intentional.'}

Findings

Blocking

  1. The new implementations are not exported under either PRX NID. The base registers -u3XfqNumMU and Do3zPpsXj1o with APS5_EXPORT, but the PR removes those registrations and adds no APS5_EXPORT for the new functions. APS5_EXPORT creates the linker aliases ending in _nid_no_patch_cut; the tests call the C++ function names directly, so they do not catch the missing NID aliases. Register both NIDs against the new implementations.

  2. _readdir_unlocked has the wrong signature and behavior for the cited FreeBSD implementation. The PR declares one argument and forwards to readdir_nid_postfix, which always uses the normal readdir behavior. FreeBSD 11.4 declares _readdir_unlocked(DIR *, int skip); skip controls whether entries with d_ino == 0 are skipped. The current test only exercises the readdir-equivalent path and cannot validate skip == 0. Add the skip argument and implement/test both values, or provide pinned PS5 disassembly demonstrating that this NID uses a different signature and behavior.

  3. _seekdir forwards to the locking wrapper rather than the unlocked implementation. In the cited FreeBSD source, seekdir acquires the directory mutex and then calls _seekdir; _seekdir itself performs the seek without reacquiring the lock. The PR forwards _seekdir to seekdir_nid_postfix, which takes the mutex. Preserve the unlocked helper semantics or provide PS5-specific evidence that this export intentionally aliases the public locking wrapper.

Non-blocking

None.

Sources

Not verified

  • The hosted checks were queued; I did not wait for them to complete.
  • I did not build or run guest_opendir2, test console behavior, or perform negative controls.

To get this to a good state

Restore the two NID aliases, correct or document the PS5-specific _readdir_unlocked signature/behavior, and preserve or substantiate the _seekdir locking behavior. I will rerun the same checks and inspect the updated head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5722460835 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13881#pullrequestreview-5722460835). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T11:05:36Z. **Review:** DISMISSED --- # Reviewed — changes requested The replacement functions currently lose their NID export aliases, and `_readdir_unlocked` does not preserve the referenced FreeBSD argument or behavior. ## What I ran Reviewed head `21960ccf49288d0e342c59cbe7b6f9b18d01df9d` against base `1847a6f9da38f03d1b92952ca6977a40278615e7`; the dependency and merge previews were clean. Environment: Debian Linux x86_64, Python 3.11.2. No local build or C++ test was run. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 13881 python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base 1847a6f9da38f03d1b92952ca6977a40278615e7 --head 21960ccf49288d0e342c59cbe7b6f9b18d01df9d --json git diff --check 1847a6f9da38f03d1b92952ca6977a40278615e7...21960ccf49288d0e342c59cbe7b6f9b18d01df9d gh pr checks 13881 --repo boykopovar/AnyPS5 ``` ## Results | Check | Result | |---|---| | Diff and conventions | Passed. | | Dependency/current-base preview | Passed. | | ABI audit | `passed_with_warnings`; it reports both previous NID stub exports as removed. The exact-head implementation has no replacement aliases. | | Source review | Found two blocking compatibility issues below. | | Hosted CI | Still queued when checked. | | Local build/tests | Not run under the no-build initial-review rule. | <details><summary>Relevant unedited output</summary> ```text status: passed_with_warnings findings: 2 {'symbol': 'libSceLibcInternalInventory_276_nid_no_patch', 'kind': 'export-removed', 'message': 'This APS5_VABI declaration, definition, or explicit alias appeared in the changed base files but not in the corresponding head files; verify that removing it is intentional.'} {'symbol': 'libSceLibcInternalInventory_282_nid_no_patch', 'kind': 'export-removed', 'message': 'This APS5_VABI declaration, definition, or explicit alias appeared in the changed base files but not in the corresponding head files; verify that removing it is intentional.'} ``` </details> ## Findings ### Blocking 1. **The new implementations are not exported under either PRX NID.** The base registers `-u3XfqNumMU` and `Do3zPpsXj1o` with `APS5_EXPORT`, but the PR removes those registrations and adds no `APS5_EXPORT` for the new functions. `APS5_EXPORT` creates the linker aliases ending in `_nid_no_patch_cut`; the tests call the C++ function names directly, so they do not catch the missing NID aliases. Register both NIDs against the new implementations. 2. **`_readdir_unlocked` has the wrong signature and behavior for the cited FreeBSD implementation.** The PR declares one argument and forwards to `readdir_nid_postfix`, which always uses the normal readdir behavior. FreeBSD 11.4 declares `_readdir_unlocked(DIR *, int skip)`; `skip` controls whether entries with `d_ino == 0` are skipped. The current test only exercises the readdir-equivalent path and cannot validate `skip == 0`. Add the `skip` argument and implement/test both values, or provide pinned PS5 disassembly demonstrating that this NID uses a different signature and behavior. 3. **`_seekdir` forwards to the locking wrapper rather than the unlocked implementation.** In the cited FreeBSD source, `seekdir` acquires the directory mutex and then calls `_seekdir`; `_seekdir` itself performs the seek without reacquiring the lock. The PR forwards `_seekdir` to `seekdir_nid_postfix`, which takes the mutex. Preserve the unlocked helper semantics or provide PS5-specific evidence that this export intentionally aliases the public locking wrapper. ### Non-blocking None. ## Sources - Removed base NID registrations: [InventoryExports.cpp at the reviewed base](https://github.com/boykopovar/AnyPS5/blob/1847a6f9da38f03d1b92952ca6977a40278615e7/core/libs/prx/libSceLibcInternal/InventoryExports.cpp#L1402-L1435). - New implementations and declarations at [Directory.cpp, reviewed head](https://github.com/boykopovar/AnyPS5/blob/21960ccf49288d0e342c59cbe7b6f9b18d01df9d/core/libs/prx/libSceLibcInternal/Directory.cpp#L33-L39) and [Api.hpp, reviewed head](https://github.com/boykopovar/AnyPS5/blob/21960ccf49288d0e342c59cbe7b6f9b18d01df9d/core/libs/prx/libSceLibcInternal/include/Api.hpp#L29-L32). - The NID alias macro at [ExportMacros.hpp, reviewed head](https://github.com/boykopovar/AnyPS5/blob/21960ccf49288d0e342c59cbe7b6f9b18d01df9d/core/libs/prx/libc/include/general/ExportMacros.hpp#L7-L16). - FreeBSD 11.4 `_readdir_unlocked` signature and `skip` behavior at [readdir.c, pinned commit](https://github.com/freebsd/freebsd-src/blob/8c639945a44588f6cfdddfb057bb5aad88735da0/lib/libc/gen/readdir.c#L51-L103). - FreeBSD 11.4 locking wrapper at [seekdir.c, pinned commit](https://github.com/freebsd/freebsd-src/blob/8c639945a44588f6cfdddfb057bb5aad88735da0/lib/libc/gen/seekdir.c#L50-L58) and unlocked helper at [telldir.c, pinned commit](https://github.com/freebsd/freebsd-src/blob/8c639945a44588f6cfdddfb057bb5aad88735da0/lib/libc/gen/telldir.c#L118-L152). - [Guest test at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/21960ccf49288d0e342c59cbe7b6f9b18d01df9d/core/libs/tests/GuestOpendir2.cpp#L49-L73). ## Not verified - The hosted checks were queued; I did not wait for them to complete. - I did not build or run `guest_opendir2`, test console behavior, or perform negative controls. ## To get this to a good state Restore the two NID aliases, correct or document the PS5-specific `_readdir_unlocked` signature/behavior, and preserve or substantiate the `_seekdir` locking behavior. I will rerun the same checks and inspect the updated head.
adriadam10 commented 2026-11-01 05:10:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-11-01T05:10:42Z.

Review: CHANGES_REQUESTED


Thanks for the update; the skip signature and the unlocked helpers look right. Still open on 7d437d4245:

  • core/libs/prx/libSceLibcInternal/Directory.cpp:36 and :41: _readdir_unlocked_nid_postfix and _seekdir_nid_postfix already hash to -u3XfqNumMU and Do3zPpsXj1o, so the APS5_EXPORT lines export each NID twice. This is what fails the Windows job (duplicate patched export name: -u3XfqNumMU). Delete both lines; the names alone are the exports. Until then guest_opendir2 has not run on any job.
  • core/libs/tests/GuestOpendir2.cpp:118: readdir and readdir_r now call ReadEntry(directory, 1) and skip zero file numbers on descriptor-backed and indexed directories (core/libs/prx/libc/src/Directory.cpp:360,372). This matches FreeBSD's readdir, but it is a behaviour change with no test. Call readdir_nid_postfix and readdir_r_nid_postfix on the fake directory and require active first, and say so in the debt entry.
  • docs/dev/debt/libSceLibcInternal.md:347: _seekdir shares the old seekdir body, so a location telldir did not return is not ignored as in FreeBSD's _seekdir (indexed directories set EINVAL, descriptor directories pass it to the seek callback, native ones to the host seekdir). Either make that case a no-op or add a clause to the entry so "follows FreeBSD" stays true.
  • Update ### What / ### Tested for the two-argument signature, the unlocked helpers and the skip test.

The macOS write-watch failures (duplicate write_watch_*-fault test names) are not from this PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5726582567 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13881#pullrequestreview-5726582567). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-11-01T05:10:42Z. **Review:** CHANGES_REQUESTED --- Thanks for the update; the `skip` signature and the unlocked helpers look right. Still open on `7d437d4245`: - `core/libs/prx/libSceLibcInternal/Directory.cpp:36` and `:41`: `_readdir_unlocked_nid_postfix` and `_seekdir_nid_postfix` already hash to `-u3XfqNumMU` and `Do3zPpsXj1o`, so the `APS5_EXPORT` lines export each NID twice. This is what fails the Windows job (`duplicate patched export name: -u3XfqNumMU`). Delete both lines; the names alone are the exports. Until then `guest_opendir2` has not run on any job. - `core/libs/tests/GuestOpendir2.cpp:118`: `readdir` and `readdir_r` now call `ReadEntry(directory, 1)` and skip zero file numbers on descriptor-backed and indexed directories (`core/libs/prx/libc/src/Directory.cpp:360,372`). This matches FreeBSD's `readdir`, but it is a behaviour change with no test. Call `readdir_nid_postfix` and `readdir_r_nid_postfix` on the fake directory and require `active` first, and say so in the debt entry. - `docs/dev/debt/libSceLibcInternal.md:347`: `_seekdir` shares the old `seekdir` body, so a location `telldir` did not return is not ignored as in FreeBSD's `_seekdir` (indexed directories set `EINVAL`, descriptor directories pass it to the seek callback, native ones to the host `seekdir`). Either make that case a no-op or add a clause to the entry so "follows FreeBSD" stays true. - Update `### What` / `### Tested` for the two-argument signature, the unlocked helpers and the `skip` test. The macOS `write-watch` failures (duplicate `write_watch_*-fault` test names) are not from this PR.
ahmadmuj commented 2026-11-06 11:02:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-11-06T11:02:23Z.

Review: COMMENTED


Reviewed head 7e51d31a201fa6c68cb7cb5b52b1b9dc2cf70a23 against PR base f79ea3f893cb854c68e7ed2d4a0223bd2cbe2454.

On Ubuntu 24.04/WSL2, GCC 13.3, the focused build and guest_opendir2 pass. Conventions and the public header audit pass too.

cmake --build builds/anyps5-pr-13881 --target guest_opendir2_tests -j 16
ctest --test-dir builds/anyps5-pr-13881 -R '^guest_opendir2$' --output-on-failure
python3 tools/check_conventions.py --base origin/main
python3 core/libs/tests/test_public_headers.py --audit-only

The separate probe runs are:

timeout 20s builds/anyps5-pr-13881/deleted-batch-probe
timeout 20s builds/anyps5-pr-13881/deleted-batch-probe builds/anyps5-pr-13881/directory-main.so
LD_PRELOAD="$PWD/builds/anyps5-pr-13881/directory-corrected.so" timeout 20s builds/anyps5-pr-13881/deleted-batch-probe

A separate probe linked to this head's actual libSceLibcInternal, libkernel, and libc finds one refill gap:

A deleted-only descriptor batch ends iteration too early. In ReadEntry, the skip loop exhausts pending and returns null without refilling.

I return a valid 16-byte deleted record, then an active record (inode=42, name="active") in the next callback. _readdir_unlocked(dir, 1), readdir, and readdir_r all stop after one read. The first two return null; readdir_r returns 0 with a null result. Each should reach the active record after two reads. A following EIO is also hidden by this early return.

The three same-batch controls pass. skip=0 also returns deleted, then active, after one and two reads. The existing fixture puts both records in one batch, so it misses this boundary.

An isolated copy with an outer refill loop passes all 16 probe cases. Removing that overlay restores all 23 assertion failures. A control built from Directory.cpp at main 5299939ecfa9e186e1eb457c6f4bd133bdb087c7 returns deleted, then active, through both existing wrappers. That control uses head dependencies; it is not a full main build.

Please refill when skipping exhausts a batch, and add a separate-batch assertion for each wrapper. The adopted FreeBSD source keeps refill and skip in one outer loop.

This is a synthetic callback contract check. The current libkernel producer normalizes zero inode values, so I do not establish title reachability or console behavior. GPU testing is n/a. Hosted CI remains queued.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5799199198 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13881#pullrequestreview-5799199198). Originally posted by [ahmadmuj](https://github.com/ahmadmuj) on 2026-11-06T11:02:23Z. **Review:** COMMENTED --- Reviewed head `7e51d31a201fa6c68cb7cb5b52b1b9dc2cf70a23` against PR base `f79ea3f893cb854c68e7ed2d4a0223bd2cbe2454`. On Ubuntu 24.04/WSL2, GCC 13.3, the focused build and `guest_opendir2` pass. Conventions and the public header audit pass too. ```sh cmake --build builds/anyps5-pr-13881 --target guest_opendir2_tests -j 16 ctest --test-dir builds/anyps5-pr-13881 -R '^guest_opendir2$' --output-on-failure python3 tools/check_conventions.py --base origin/main python3 core/libs/tests/test_public_headers.py --audit-only ``` The separate probe runs are: ```sh timeout 20s builds/anyps5-pr-13881/deleted-batch-probe timeout 20s builds/anyps5-pr-13881/deleted-batch-probe builds/anyps5-pr-13881/directory-main.so LD_PRELOAD="$PWD/builds/anyps5-pr-13881/directory-corrected.so" timeout 20s builds/anyps5-pr-13881/deleted-batch-probe ``` A separate probe linked to this head's actual `libSceLibcInternal`, `libkernel`, and `libc` finds one refill gap: **A deleted-only descriptor batch ends iteration too early.** In [ReadEntry](https://github.com/boykopovar/AnyPS5/blob/7e51d31a201fa6c68cb7cb5b52b1b9dc2cf70a23/core/libs/prx/libc/src/Directory.cpp#L209-L236), the skip loop exhausts `pending` and returns null without refilling. I return a valid 16-byte deleted record, then an active record (`inode=42`, `name="active"`) in the next callback. `_readdir_unlocked(dir, 1)`, `readdir`, and `readdir_r` all stop after one read. The first two return null; `readdir_r` returns 0 with a null result. Each should reach the active record after two reads. A following EIO is also hidden by this early return. The three same-batch controls pass. `skip=0` also returns deleted, then active, after one and two reads. The existing fixture puts both records in one batch, so it misses this boundary. An isolated copy with an outer refill loop passes all 16 probe cases. Removing that overlay restores all 23 assertion failures. A control built from `Directory.cpp` at main `5299939ecfa9e186e1eb457c6f4bd133bdb087c7` returns deleted, then active, through both existing wrappers. That control uses head dependencies; it is not a full main build. Please refill when skipping exhausts a batch, and add a separate-batch assertion for each wrapper. The adopted [FreeBSD source](https://github.com/freebsd/freebsd-src/blob/8c639945a44588f6cfdddfb057bb5aad88735da0/lib/libc/gen/readdir.c#L58-L96) keeps refill and skip in one outer loop. This is a synthetic callback contract check. The current libkernel producer normalizes zero inode values, so I do not establish title reachability or console behavior. GPU testing is n/a. Hosted CI remains queued.
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!13881
No description provided.