feat(libkernel_sys): implement swapon #11034
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11034"
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 Gruzzberry on 2026-10-25T14:38:38Z.
What
swaponwas a throwing stub in libkernel_sys. FreeBSD 11.4'ssys_swapon(after thePRIV_SWAPONcheck, which a root guest passes) looks the name up and hands a vnode toswapongeomonly ifvn_isdiskaccepts it; otherwise it fails withENOTBLK. Here the name is copied withCopyGuestPath_nid_no_patch(an unreadable pointer fails withEFAULT, an empty name withENOENT), and a path of 1024 bytes or more or a component over 255 givesENAMETOOLONG. The lookup then goes through the gueststat, so it follows symbolic links asnameiwithFOLLOWdoes: a missing path or a dangling link givesENOENT, a path through a fileENOTDIR, and any existing file or directory, directly or through a link,ENOTBLK. A host character or block device throwsstd::runtime_error, as nothing here backs swap space. The new debt entry records thatPRIV_SWAPONfor titles is unverified.Tested
Windows 11 (10.0.26200), WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,
-DBUILD_TESTING=ON, onmain7a25f87620.guest_kernel_sys: new checks next to thechrootones for a null name and the unreadable address0x10(EFAULT),""and a missing path (ENOENT), a path through a file (ENOTDIR), a 256-byte component and a 1024-byte path (ENAMETOOLONG), a file and a directory (ENOTBLK), and, with Windows symbolic links, a link to a file and a link to a directory (ENOTBLK) and a dangling link (ENOENT). The earlier head of this PR gaveENOTBLKfor the dangling link, because MinGW'sstd::filesystem::statusdoes not see Windows links. With the body reverted to the stub the test crashes (0xc0000409); with this change it passes, three runs out of three.mainand on this branch: the only differences areagc_driver_bda_device,agc_driver_depth_clear_hleandguest_ampr_threads, which fail underctest -j 12on the branch but pass alone three times out of three, andagc_driver_depth_plane_partial_store, which fails onmaintoo.python tools/check_conventions.py --base upstream/main: passes.Overlaps
statfs/symlinkat) removes the neighbouring stubs inExport.Discovery.cppandinclude/Api.hppand adds code atExport.cppL534-535, and #10799 editslibkernel_sys.mddebt L40: proposed on each that it goes first and this PR rebases.getfsstat, mine) adds a debt entry at the same place: #11031 goes first, then this PR rebases.swapcontext) has merged and this branch is rebased on it. #11026 no longer containsswapon, so this is the only PR implementing it.Checklist
main; no other open PR implements the same functionNotImplemented_nid_no_patch); no silent stubs added.mdfiles or images added to the repositoryAI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T14:39:03Z.
Review: DISMISSED
Requesting a fix to the open-PR overlap before this can be merged. #11026 is still open and its current diff also implements
swapon_nid_postfix, changes the same declaration/stub, and adds tests for the same path errors. That means this PR’s checklist claim that no open PR implementsswaponis currently inaccurate, and the duplicate symbols/file edits cannot both merge unchanged. CONTRIBUTING.md requires checking same-function open PRs and agreeing merge order for overlapping work. Please coordinate with the #11026 author so that PR is reduced to itsprofiltopic, then update this PR’s overlap/checklist evidence; there is no need to close either PR. The focused Windows results are author-reported, and the hosted product tests are skipped, so I have not independently verified runtime behavior at this head.