feat(libkernel_sys): implement unlinkat #4870
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4870"
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-13T00:56:39Z.
What
Implements FreeBSD/POSIX
unlinkatinlibkernel_sys.prx(NIDtCFbw1wGrqk, imported by 2 Ship 2 Harkinian / PPSA99621).flag & ~0x800fails withEINVAL(FreeBSDAT_REMOVEDIR).EFAULTand empty strings withENOENT.AT_FDCWD(-100) and absolute paths tormdir(ifAT_REMOVEDIR) orunlink.EBADFand non-directory descriptors withENOTDIR.AT_REMOVEDIR): forbids.and..withEINVAL, symlinks and regular files withENOTDIR, non-empty directories withENOTEMPTY, and removes empty directories.EPERM, trailing slashes on non-directories withENOTDIR, and unlinks regular files and symlinks.docs/dev/debt/libkernel_sys.md.Tested
core/libs/tests/GuestKernelSys.cppcovering:EINVAL)EFAULT) and empty (ENOENT) pathsEBADF) and file descriptor (ENOTDIR)ENOTDIR)ENAMETOOLONG)ENOENT)AT_REMOVEDIR(EPERM)AT_REMOVEDIR(ENOTDIR)AT_REMOVEDIR(EINVAL)ENOTEMPTY)AT_FDCWDdelegationguest_kernel_sysandguest_filesystemtest targets (100% tests passed).tools/check_conventions.py --base origin/main.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.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-13T00:57:05Z.
Progress report (
5344514→55ddffe)📈 System libraries: 88.25% (+0.01%, +1 implemented functions)
✅ 1 implemented
unlinkat_nid_postfixImported from boykopovar/AnyPS5. Originally posted by nicolasfalesy on 2026-10-13T07:25:20Z.
Linux test (Arch, GCC 16.2.1, glibc, Release), this PR merged onto
main7e181fcc3:guest_kernel_syspasses. With this PR'sExport.cppchange reverted (test kept), it fails on Linux, so the check guards the change on Linux too. Note: it conflicts with #4877 (renameat) inlibkernel_sys/Export.cppandGuestKernelSys.cpp; whichever lands second needs a small rebase.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T08:13:55Z.
Rebased onto current
main(only adjacency conflict withmkdiratinExport.cppandGuestKernelSys.cpp; both kept, and the new tests use their own directory names so they don't collide withmkdirat's). Build and the libs ctest scope pass (44/44), andguest_kernel_sysno longer links without theunlinkatchange. Flag value, errno choices (EPERMfor a directory withoutAT_REMOVEDIR,EINVALfor./..,ENOTEMPTY,ENOTDIR) match FreeBSD'skern_unlinkat; confirmed on Linux by @nicolasfalesy. Merging.