Repository navigation
fix(libkernel): translate scalar POSIX I/O errors - #1307
Conversation
|
Please have |
|
Linux data point from a real title: DOOM Shareware PPSA99666 v1.1.1 (lowbit/ps5-doom) needs this on Linux. While it scans
AI-assisted: yes (Claude Code). |
adriadam10
left a comment
There was a problem hiding this comment.
Thanks, and thanks @hikazey for the DOOM data point (a read on a directory aborting on EISDIR is a good reason for this fix).
Still open from @oneandonlydean's review, which isn't addressed yet:
PosixScalarResult(Stdio.cpp:287-309) matches the exception text prefix and reads the hosterrnoafter the throw. Please makesceKernelRead/sceKernelWrite/sceKernelLseek(Open.cpp:141-163) return the SCE error and have the POSIX wrappers go throughPosixResult, likeopen/stat/unlinkdo. That removes the string match and most ofGuestScalarIoErrno's duplicated table.- The
windowsjob is red on the current head; please check it. - The branch now conflicts with
mainincore/libs/CMakeLists.txt(test block adjacency); please rebase.
The regression test itself looks good and covers the right cases; it should keep working after the rework. Happy to re-review once updated.
2799d71 to
ba46784
Compare
adriadam10
left a comment
There was a problem hiding this comment.
Took over the three open points, pushed on top of your commit:
sceKernelRead/sceKernelWrite/sceKernelLseek(Open.cpp) now return the SCE error instead of throwing on a native failure (SceIoErrorFromErrno: host EAGAIN -> 35, EDEADLK -> 11, EDQUOT/EOVERFLOW -> FreeBSD values; 1..34 are identical on FreeBSD). The POSIX wrappers go throughPosixResultlikeopen/stat/unlink;PosixScalarResult, the exception-text match and the duplicated errno table are gone.- Rebased on
main(conflicts incore/libs/CMakeLists.txtandStdio.cpp). - Kept your regression test and added: direct
sceKernelRead/Write/Lseekon fd -1, the direct nonblocking-pipe EAGAIN, andreadon a directory returning EISDIR (the DOOM case, non-Windows).
Checked on Linux: guest_posix_scalar_io, guest_directory_entries, guest_file_vector, guest_parent_process pass; the new test fails without the code changes. Merging once CI is green on the new head.
What
AnyPS5 relinks guest executables into native Windows/Linux user-space programs. Its libkernel POSIX imports
read,_read,write,_write, andlseekcurrently let ordinary file failures escape as host exceptions. Translate recognized failures to-1and guesterrno, including LinuxEAGAIN11 to FreeBSD guest 35. Preserve successful values, 64-bit seek offsets, previous errno on success, directsceKernelbehaviour, and unsupported-operation diagnostics.The public synthetic VABI regression exercises file and pipe I/O, invalid descriptors/access modes/buffers/whence, zero-length null buffers, sparse seeking beyond 4 GiB, and Linux nonblocking-pipe EAGAIN. This corrects an existing Status file capability, with no measured title progress or library/shader badge increase.
Tested
df16c4c256be3c44e03eb9149a6ce5f8e8a038b2: Full build passed. The identicalguest_posix_scalar_iofixture ran successful I/O controls, then deliberately aborted at its contract assertion becauseread(-1, buffer, 1)threwsceKernelRead: read failed, fd=-1, errno=9instead of returning-1with guest EBADF. Zero skipped.2799d71161978bd4e2f1a548451f50ce3b422942: Full build/focused regression passed; complete Windows CTest 405 passed, 0 failed, 0 skipped. Conventions and diff checks passed.--repeat until-fail:3. The scalar regression, including unconditional Linux nonblocking-pipe EAGAIN mapping, passed every repetition. Each skipped GPU execution test has an individually checked 32-lane subgroup capability guard and is unrelated to scalar I/O. Exact runner subgroup width is unmeasured. The Windows job in this workflow passed separately.Checklist
main; no other open PR implements the same fix (complete inventory and shared-file review)