fix(libkernel): translate fsync errors for guest callers #2030
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2030"
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 STUPIDCONTEM on 2026-10-09T05:30:02Z.
Evidence review (2026-10-09)
Game/title evidence has not been established. Validation below is host regression/build evidence only; it does not establish title compatibility. Older checked items and test results describe their stated revisions, not current merge readiness.
Game/title ID: none verified. No PS5 title execution is claimed.
What
sceKernelFsyncreturned the host's-1on failure instead of an encoded kernel error. It also sent guest socket descriptors to the host CRT, which could only report an invalid descriptor.Translate native failures through the existing kernel error mapping and preserve the caller's errno in the kernel entry point. The POSIX
fsyncwrapper now decodes the kernel result into-1plus guest errno. Open guest sockets return EINVAL, and invalid/closed descriptors return EBADF.The socket/invalid-descriptor distinction follows FreeBSD 11 fsync; the kernel encoding is the project's existing KernelErrors/SceErrorFromErrno convention. Regular files still use the existing host flush operation.
Tested
Windows 10 Pro 19045, WinLibs MinGW-w64 GCC 15.2.0 UCRT/posix/SEH r7, Ninja Release, BUILD_TESTING=ON, SPIRV-Tools disabled. Based directly on
f145139676a48306681d3a4d5fabf83938759daf; independent of #2029.guest_fsyncfails against upstream atkernel result encodes the guest error.guest_fsync,guest_filesystem, andguest_kernel_sync: 3/3 passed.libsbuilds succeed.Linux and PS5 hardware/title behavior were not tested. The regression checks API results, not crash/power-loss durability.
Overlap review: #1738 registers a terminal test at the same CMake insertion point; it changes different production functions and is not a dependency. #2001 deletes the POSIX fsync wrapper as part of broader removals; it does not implement the error translation here. This PR remains independently based on main; overlapping hunks need reconciliation if either change lands first.
An external review approved this exact head and reports a Linux/GCC 12.2 build plus passing
guest_fsync(1/1). This is reviewer-reported validation, separate from the local Windows results above.Checklist
main; no other open PR implements the same change (historical base; current readiness not asserted)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T05:33:32Z.
Review: APPROVED
Reviewed the full three-file diff at
7ea7f59a5f. The kernel API now returns the project’s encoded error and preserves errno; the POSIX wrapper uses the existing PosixResult path. The new test covers regular files, sockets, invalid/closed descriptors, and errno behavior. Exact-head Linux/GCC 12.2 build passed andguest_fsyncpassed (1/1, 0.05 s); conventions and diff checks pass. The author reports the Windows run and full CTest. GitHub currently reports no checks.Pull request closed