feat(libkernel): export truncate and report EISDIR for a directory #3433
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3433"
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 Feuris on 2026-10-11T10:29:49Z.
What
Carries @Mouad-Scriptz-0's #3181 (the author is under the intake threshold). The commit is theirs, unchanged (
a584bc6a).libkernel does not export the POSIX
truncate(ayrtszI7GBg, confirmed against aerolib). An import audit of the homebrew catalog onmainlists it as an absent import of three titles (PS5MC PPSA99420, XPSemu PPSA97358, Porpoise PPSA99764).truncate_nid_postfix(path, length)inFile/src/Stdio.cppvalidates the path (EFAULTfor null,ENOENTfor empty) and resolves throughsceKernelTruncate_nid_postfix.sceKernelTruncatenow returnsEISDIRfor a directory and the host errno for other failures instead ofEIO, as FreeBSD 11kern_truncatedoes (EINVALfor a negative length,EISDIRfor a directory).::truncateon POSIX;_wopen(_O_WRONLY | _O_BINARY)+_chsize_s+_closeon Windows.guest_truncatetest covering shrinking, growing with zero-fill, truncate to 0, negative length (EINVAL), missing path (ENOENT), empty path (ENOENT), null path (EFAULT), directory (EISDIR), and read-only file (EACCES).Closes #3181.
Tested
tools/check_conventions.py --base origin/mainandgit diff --checkpass cleanly.guest_truncateandguest_filesystempass 3/3 (--repeat until-fail:3).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T10:30:12Z.
Progress report (
99c1c26→a584bc6)➖ System libraries: 85.76% (+0.0%, +1 implemented functions)
✅ 1 implemented
truncate_nid_postfixImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T10:36:17Z.
Checked on Linux (PR merged onto current main):
guest_truncateandguest_filesystempass, andguest_truncatefails to link without the Stdio.cpp change.EISDIR/host errno mapping matches FreeBSDkern_truncate; Windows path covered by danzaio's MinGW run. Merging.