feat(libkernel): implement lstat #1624
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1624"
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 babyhuey on 2026-10-08T15:11:21Z.
What
Implements
lstat(DRGXpDDh8Ng) in libkernel. Part of #1578: PPSA99039 (EVO-PLAYER-PS5) imports it.PathErrorandResolvePath_nid_no_patchlikestat; a nullsbfails withEFAULT.lstat, so a symbolic link reportsS_IFLNKand its own size, and a dangling link succeeds. Errors map throughSceErrorFromErrno, soENOENTandENOTDIRreach the guest instead of the singleENOENTsceKernelStatreturns.lstat. Anything that is not a symbolic link is identical tostat; a symbolic link callsNotImplemented_nid_no_patch.File::FillLinkStatsits next toFillFileStatinNativeStat.cpp.Tested
Linux (Ubuntu 24.04, GCC 13, Release):
guest_filesystempasses with--repeat until-fail:3. It now checkslstaton a file, a directory, a missing path, an empty path, null arguments, and (Linux only) a link, a dangling link and a path through a file (ENOTDIR). The test fails when hostlstatis replaced bystat.check_conventions.pypasses. Windows: the changed files compile with MinGW-w64 GCC 13 (-Wall -Wextra -fsyntax-only); not run on Windows. No title run.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 klosixgaming-arch on 2026-10-08T15:35:31Z.
Review: APPROVED
LGTM. Clean implementation of lstat following FreeBSD semantics with proper platform-specific handling - host lstat on Linux for correct symlink behavior, and NotImplemented_nid_no_patch for Windows symbolic links (since Windows has no CRT lstat). The test coverage is excellent - testing regular files, directories, missing/empty/null arguments, and on Linux specifically validating symlink vs stat differences (S_IFLNK mode bits, dangling symlinks succeeding with lstat but failing with stat, path-through-file ENOTDIR errors). Good addition to support EVO-PLAYER-PS5's import requirements.
Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-08T17:37:02Z.
Fork CI while the upstream run waits for approval: Build run, all jobs green on 4b9eb4ef (Linux 466/466, Windows 457/457, relinker on Linux, macOS and Windows). It builds the branch head, not the merge with
main.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-08T21:06:49Z.
The overlap bot correctly found that #1795 also adds
lstat_nid_postfixand theNativeStatpath. The implementations are not equivalent: #1624 has Linux symlink/dangling-link coverage and explicitly rejects Windows symlink semantics as unimplemented, while #1795 currently falls back tostaton Windows. Since #1795’slstatis separate from itssocketpairchange, please coordinate so only one reviewedlstatimplementation remains; the socketpair change can proceed independently. This head is now 104 commits behind currentmain0447793, so CONTRIBUTING requires a rebase and fresh checks before final review.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T21:13:57Z.
Progress report (
54f28f2→903f50a)📈 System libraries: 85.31% (+0.01%, +1 implemented functions)
✅ 1 implemented
lstat_nid_postfixImported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-08T21:20:40Z.
Rebased onto
main(81204de9);guest_filesystempasses locally and fork CI is running on the new head. Agreed on keeping onelstat, thanks for raising it on #1795.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-08T21:48:59Z.
The linked fork CI run
37845996551completed successfully for head81204de9(Linux, Windows and all relinker jobs). This is useful evidence, but does not populate upstream PR checks. Currentmainis now94b1eecb; this branch is 7 commits behind (merge base364a56b). Please rebase before merge and refresh checks on the final head.Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-08T22:57:39Z.
Titles that stop on
lstaton currentmain. Linux, Ubuntu 24.04 container, GCC 13, Release,maind64134f0(relinkerandlibs); titles from the homebrew catalog, relinked for Linux and run from the title folder.mainapp.elf: symbol lookup error: app.elf: undefined symbol: DRGXpDDh8Ng(lstat)IuxnUuXk6Bgapp.elf: symbol lookup error: app.elf: undefined symbol: DRGXpDDh8Ng(lstat)+F7C-hdk7+E(sigemptyset)The "with this branch" build also had my other open PRs merged; only this branch exports
DRGXpDDh8Ng.Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-09T01:26:38Z.
Same two titles on Windows. Windows 11, RTX 3080, WinLibs GCC 15.2.0 r7, Release,
mainf1451396(relinkerandlibs); titles relinked with--windows.mainFAIL: unresolved ELF import DRGXpDDh8Ng from libkernel.prx(lstat)FAIL: unresolved ELF import IuxnUuXk6Bg from libkernel.prxFAIL: unresolved ELF import DRGXpDDh8Ng from libkernel.prx(lstat)FAIL: unresolved ELF import +F7C-hdk7+E from libkernel.prx(sigemptyset)As on Linux, the second build also had my other open PRs merged; only this branch exports
DRGXpDDh8Ng.Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T10:00:48Z.
First Windows run, since the description says it was only compiled with MinGW. Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. #1624, #1628, #1633 and #1634 merged together onto
mainb7218b3c.guest_filesystempasses, including this PR'slstatcases for a file, a directory, a missing name, an empty name and null pointers. The symlink cases are#ifndef _WIN32, so they didn't run here.🤖 Addressed by Claude Code
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T21:52:00Z.
Checked on Linux (merged onto current
main): build andguest_filesystempass, and the test no longer links without the change. Error mapping (ENOENT/ENOTDIR/EFAULT), the link/dangling-link cases and the Windows throw on symlinks look right, and the third-party Windows and title runs in the thread agree. Merging.