Repository navigation
feat(libkernel): implement sceKernelFdatasync - #2129
oneandonlydean merged 3 commits into
Conversation
|
Does Dying Light 2 (PPSA02262) stop at |
517eb1e to
8734b92
Compare
|
Independent validation on Windows Built and ran the PR head
Results:
Rigor check (is the test real?): I removed the One concern — scope / "one topic per PR": this PR bundles two unrelated changes:
The author checked "One topic per PR", but these are two distinct topics. I'd suggest splitting the font-test change into its own PR so review/rollback stay clean. Honest limits of what I verified:
Written with AI assistance. |
8734b92 to
36bc921
Compare
|
Status update after the rebase and scope cleanup. Title evidence (Dying Light 2, PPSA02262) — reported by @tv7 in #1794 (comment):
This is evidence the import blocker advances past Scope — the PR now contains only Behavior — Tests — |
|
Built the PR (head 36bc9214) merged with current main and probed the new export against a guest socket: Suggest moving the guard and the host call into Probe (linked like const int s = socket_nid_postfix(2, 1, 0); // 0x10000000
sceKernelFdatasync(s); // -> 0x80020009
fdatasync_nid_postfix(s); // -> -1, guest errno 22
sceKernelFdatasync(0x7fffffff); // -> 0x80020009Not run on Windows. AI-assisted. |
Add the guest socket descriptor guard to sceKernelFdatasync before any native syscall, matching the existing sceKernelFchmod pattern. This prevents high guest socket descriptors (e.g. 0x10000000) from reaching the Windows CRT _commit, which would trigger the invalid-parameter handler, and ensures the correct SCE error is returned on all platforms. Refactor fdatasync_nid_postfix to delegate to sceKernelFdatasync via PosixResult, removing the duplicated socket guard and native syscall. Extend GuestFilesystem tests to cover: - sceKernelFdatasync on a valid guest socket returns SCE EINVAL (0x80020016) - sceKernelFdatasync on a closed guest socket returns SCE EBADF (0x80020009) - sceKernelFdatasync on a high invalid descriptor (0x7fffffff) returns SCE EBADF - closed-ordinary-descriptor tests now run on Windows (verified _commit on a closed descriptor returns EBADF without provoking the CRT handler)
|
Thanks @orishamir for catching the guest-socket descriptor issue — that was a real bug. The fix is in
The targeted |
|
Confirmed on 57be03a merged with current main (Linux): |
Dying Light 2 (PPSA02262) imports sceKernelAioSetParam (9WK-vhNXimw) from its eboot. In #1794 tv7 reported on main b5f5362 + #2129 (2026-10-10): FAIL: unresolved ELF import -q-vbO859Tw from libSceVideoOut.prx with "12 other imports are still unresolved on `main`. In the eboot, `-q-vbO859Tw`, `GTfJ64qFCPw`, `vwtVpHQKelI` (no known names), `sceKernelAioSetParam` and `sceNpWebApi2GetMemoryPoolStats`." The import is observed; its position in the loader queue after the nameless NIDs is predicted. The function fills one SceKernelAioSchedulingParam (five 4-byte fields, 20 bytes): Orbital cc408367 tools/ida/db_types.json:1103, SharpProspero 5dfdb4b0 Interop/Kernel/KernelAio.cs ("Sets every field of param at once") and ampr_emu cfa85df3 ps5/include/sce/_fs.h agree on (param, schedulingWindowSize, delayedCountLimit, enableSplit, splitSize, splitChunkSize). No source gives an error code, so a null struct and values outside SharpProspero's maximums (window and delayed count 0..128, split flag 0 or 1, sizes up to 0x1000000) throw. The engine does not use the settings, as sceKernelAioInitializeImpl ignores its struct; this is recorded in TechnicalDebt. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> (cherry picked from commit e45a2b9)
What
Implement the missing
sceKernelFdatasynclibkernel export (NID30Rh4ixbKy4), which is imported by Dying Light 2 (PPSA02262). The implementation uses_commiton Windows andfdatasyncon POSIX, following the existingsceKernelFsyncimplementation pattern.Add regression coverage for successful synchronization and invalid POSIX file descriptors. The related open PR #1620 implements a distinct
fdatasync_nid_postfixexport with a different NID, so it does not overlap with this change.Tested
Windows/MinGW Release:
cmake --build build --target guest_filesystem_tests— passed.ctest --test-dir build -R "^guest_filesystem$" --output-on-failure— 1/1 passed.sceKernelFdatasyncis exported and the repository NID helper returns30Rh4ixbKy4.WSL/Linux Release:
cmake --build build-libs --target guest_filesystem_tests— passed.ctest --test-dir build-libs -R '^guest_filesystem$' --output-on-failure— 1/1 passed.Verified the exported symbol; both valid-descriptor and invalid-descriptor assertions passed.
Confirmed the regression before the fix via a link failure for the missing export.
git diff --check— passed.The full test suite and Dying Light 2 runtime were not tested.
Checklist
main; no duplicate PR implements this export/NID.