feat(libkernel_sys): implement mkdirat #4743
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4743"
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 jagrat04 on 2026-10-12T20:29:33Z.
What
Implement mkdirat in libkernel_sys (PRX library).
Tested
Built and verified locally with unit tests in core/libs/tests/GuestKernelSys.cpp:
Checklist
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T20:29:56Z.
Progress report (
758aca7→ec0d61e)📈 System libraries: 87.9% (+0.01%, +1 implemented functions)
✅ 1 implemented
mkdirat_nid_postfixImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-12T21:17:17Z.
Review: CHANGES_REQUESTED
Thanks for the PR. It also conflicts with
mainnow (core/libs/tests/GuestKernelSys.cppanddocs/dev/debt/libkernel_sys.md, next to the newpathconf/readlinkatlines), so it needs a rebase. Points to fix:core/libs/prx/libkernel_sys/Export.cpp:289:Fail(errno)stores the host Linux errno as the guest errno. Values above 34 differ from FreeBSD (e.g.ENAMETOOLONGis 36 on Linux, 63 on FreeBSD, seeGuestEnametoolongabove). Map it the waymkdirdoes (SceErrorFromErrno) or withGuestError.Export.cpp:265-290re-implements whatmkdir_nid_postfixalready does incore/libs/prx/libkernel/File/src/Stdio.cpp:668(ResolvePathError_nid_no_patch,NativeMkdir,HasNonDirectoryPrefix). The hand-rolled checks dropENAMETOOLONGand the invalid-name handlingmkdirhas. Resolve the joined path through the same helpers instead of duplicating them.Export.cpp:281-287):modeis ignored (fine, but say so in the debt line) and every otherGetLastError()becomesEIO;ERROR_PATH_NOT_FOUNDshould beENOENT, as insymlinkabove.ENAMETOOLONG) and a..component; they pin the two behaviours above.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T23:06:57Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libkernel_sys/Export.cppL355core/libs/tests/GuestKernelSys.cppL40Imported from boykopovar/AnyPS5. Originally posted by johnohhh1 on 2026-10-13T00:37:47Z.
Independent Linux validation: the full build and all 18 selected runtime suites pass on Ubuntu 26.04.1 x86-64, GCC 15.2.0, Release, bundled dependencies,
BUILD_TESTING=ON.Tested upstream
1c5e62878ab01af05d5a75bd94146228f5dea9d4plus PR commit588657423eb2f730967456143e89927d8fb4a7e2(local cherry-pick43e91af02fead98effd85b0640e2ebab268d057f, same stable patch ID). The PR head still matches.guest_kernel_sys,patched_libraries, and 16 related filesystem suites passed without skips, serially with a 30-second per-test timeout. Conventions checks also pass.A standalone probe passed 141 checks:
AT_FDCWD/ absolute paths, and trailing slashes. Access bits matched native Linuxmkdirat...traversal.No defect found in these cases. These are synthetic Linux checks; I did not test Windows, a console or a game, and this does not verify the documented guest-umask/path-alias limitations or additional mode bits.
AI-assisted validation/report: Codex. The tested implementation is your existing patch.
Imported from boykopovar/AnyPS5. Originally posted by jagrat04 on 2026-10-13T00:42:17Z.
@adriadam10 Thanks for the review! Updated as requested:
origin/main.GuestError(std::error_code(nativeError, std::generic_category())), correctly translating errors likeENAMETOOLONG(63) and checking non-directory prefix forENOTDIR.ERROR_ALREADY_EXISTSandERROR_FILE_EXISTS(EEXIST), and mapsERROR_PATH_NOT_FOUNDtoENOTDIR(if non-directory prefix exists) orENOENT. Recorded thatmodeis ignored on Windows indocs/dev/debt/libkernel_sys.md.GuestKernelSys.cppfor a component name > 255 bytes (ENAMETOOLONG63) and a relative path with..(dir/../dotdot_dir).guest_kernel_systest (100% pass) andpython tools/check_conventions.py --base origin/main.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T07:55:09Z.
Review: APPROVED
Checked the rebuilt head on Linux (build,
guest_kernel_sysand the rest of the libs tests green; the new test does not link without the change). Errno mapping, Windows error handling, the../long-name tests and the debt line address the earlier review; merging.