feat(libkernel): implement system #1859
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1859"
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 overlordxrz-source on 2026-10-08T22:15:58Z.
What
libkerneldoes not exportsystem(Jc6E7N+dHz0). Yamagi Quake II (PPSA99007) stops on it at load onmain, and ccleste (PPSA59322) imports it too.In both titles the only caller is the bundled Mesa. A small function runs
system("clrxdisasm --version > /dev/null 2>&1")and returns whether the result is 0, which tells Mesa whether the CLRX disassembler is installed. It sits on the shader-disassembly dump path, at 0x4608d0 in the PPSA99007 executable and 0x826270 in PPSA59322 (the singlecall [system]site in each).systemnow follows FreeBSD 11'slib/libc/stdlib/system.c(source) for a process with no/bin/sh:if (!command) return(1);).0x7f00. In FreeBSD, the child that cannotexecl(_PATH_BSHELL, ...)calls_exit(127), andsystemreturns its wait status. SoWIFEXITEDis true andWEXITSTATUSis 127, and Mesa's probe sees that CLRX is not available.errnois not touched.No host command is ever run. A new line in
docs/dev/TechnicalDebt.mdsays what is assumed: that the console's application sandbox has no shell, and thatvforksucceeds there (FreeBSD returns -1 when it fails).Log
I don't have a console, and I couldn't run the titles here: the host is aarch64 and the project needs x86-64. The stop is from @SleglJan's run of the homebrew catalog on
main4b6ab6bbin #1578 (comment). Each title was relinked with--registryand run for 8 s on Linux. In the table of first stops,systemis the stop for PPSA99007 Yamagi Quake II, with no open PR. That run reports the stop asapp.elf: symbol lookup error: app.elf: undefined symbol: Jc6E7N+dHz0. Closed #3 also reported a Quake II build stopping atJc6E7N+dHz0(system) before guest entry.PPSA99007.zip, sha2564fa5da07…9a70, matching the catalog recordPPSA59322.zip, sha25696861b81…fb43. It stops earlier, onshm_open(separate PR).The call sites come from the unwrapped
eboot.binof each release: the relocation forJc6E7N+dHz0, then the onlycall qword ptr [rip+…]through that slot.With this PR applied, @CouchRiv ran PPSA99007 on Linux (NVIDIA,
mainf1451396plus this PR, 90 s timeout) (comment). Onmainit stops at load withundefined symbol: Jc6E7N+dHz0, exit 127. With the PR,systemresolves and the next stop ismkstemp(uEtgPWgPxOk, claimed by #1613):The
LD_BIND_NOWtrace goes from 21 to 20 unresolved imports, with nothing new.Tested
aarch64 Debian 13 host. The full project cannot be built here because it needs x86-64.
core/libs/tests/GuestSystemCommand.cpp(guest_system_command) checks:exit 0and an empty command each return a status withWIFEXITEDtrue and exit status 127errnois unchangederrnostand-in.Process.cppand the test compile for x86_64-linux-gnu and x86_64-windows-gnu with-Wall -Wextra. The only warnings are the existing-Wreturn-type-c-linkageones fromGeneral.hppandShutdown.hpp.python3 tools/check_conventions.py --base origin/mainpasses.tools/progress.py: libkernel goes from 426 to 427 implemented.systemand stops next atmkstemp(#1613). See Log.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-08T22:16:23Z.
Progress report (
ae91d97→8f09ec3)➖ System libraries: 84.76% (+0.0%, +1 implemented functions)
✅ 1 implemented
system_nid_postfixImported from boykopovar/AnyPS5. Originally posted by CouchRiv on 2026-10-09T04:52:55Z.
Ran Yamagi Quake II 0.2.0-alpha.1 (PPSA99007, homebrew catalog release) on Linux with this PR merged onto
mainf1451396, in a sandbox, NVIDIA, 90 s timeout.On
mainit stops at load, exit 127:With this PR
systemresolves and the next stop ismkstemp(claimed by #1613), exit 127:The
LD_BIND_NOWload trace goes from 21 to 20 unresolved imports, with nothing new.Imported from boykopovar/AnyPS5. Originally posted by overlordxrz-source on 2026-10-09T05:23:07Z.
@CouchRiv thanks, that's the run this PR was missing. I've added it to Log and Tested. The next stop,
mkstemp, belongs to #1613, so I'm leaving it out of this one.Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T10:03:57Z.
First Windows run, since the description says it wasn't tested on Windows.
Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Merged onto
mainb7218b3ctogether with nine other small libc/libkernel PRs: #1975, #1976, #1977, #1685, #1676, #1675, #1641, #1656, #1807.guest_system_commandpasses.🤖 Addressed by Claude Code
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T21:55:06Z.
Checked the
systemsemantics against FreeBSD 11lib/libc/stdlib/system.c(null → 1, otherwise the wait status of a child that couldn't exec the shell,127 << 8), the guest errno being left alone, the test registration in ctest and the TechnicalDebt entry.guest_system_commandpasses locally on Linux and fails to link without the change; Linux and Windows CI are green. Also confirmed by @CouchRiv (PPSA99007 on Linux/NVIDIA gets pastsystem) and @popcoder565 (Windows, MinGW); merging.