Repository navigation
feat(libkernel): implement sysctl and sysctlbyname for hw.ncpu - #1685
Conversation
ScreenTester5 (PPSA69420) stops at start-up on the unresolved sysctlbyname import and also imports sysctl. hw.ncpu (CTL_HW.HW_NCPU) reports the same processor count as sysconf(_SC_NPROCESSORS_ONLN). Other names and MIBs throw.
|
Run with the title on Windows. ScreenTester5 (PPSA69420 01.000.000) on Windows 11, Radeon 860M, MinGW-w64 GCC 15.2.0, Release, Tested with AI assistance (Claude Code). |
|
@LeandroLP23 thanks for running it with the title. That's the stop line this PR was missing. I've added your run to the Log and Tested sections. |
|
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
🤖 Addressed by Claude Code |
|
Checked on Linux (PR merged onto current |
What
ScreenTester5 (PPSA69420, Marice/ScreenTester5 01.000.000) stops at start-up on
mainwith, as reported in #1578:MhC53TKmjVAissysctlbyname(tools/nid_names.py). The title also importssysctl(DFmMT80xcNI). In the #1578 audit,sysctlis absent for 27 of the 34 catalog titles andsysctlbynamefor 14. The onlyhw./kern./vm.sysctl name string in PPSA69420'seboot.binishw.ncpu, which SDL2'sSDL_GetCPUCountreads withsysctlbyname.System/src/SystemConfiguration.cppnow exports both functions, but only forhw.ncpu(CTL_HW.HW_NCPU, MIB{6, 3}). It reports the same count assysconf(_SC_NPROCESSORS_ONLN). Every other name or MIB throws with the name or MIB in the message, so the next one a title needs shows up in its log. The rest follows FreeBSD'skern_sysctl.c:CTL_MAXNAME(24) givesEINVAL. A null name givesEFAULT.oldpstores the required size in*oldlenp.*oldlenpis set to the bytes copied, withENOMEM.hw.ncpuis read-only, so a non-nullnewpgivesEPERM.errnois left alone on success.Per review on #1405, nothing beyond what this title reaches is included. Other
hw.*/kern.*nodes, such ashw.physmem, wait until a title stops on them.Log
From #1578 (Windows,
main1081602,relinker --windows):FAIL: unresolved ELF import MhC53TKmjVA from libkernel.prxfor PPSA69420.@LeandroLP23 ran the title with this PR (Windows 11, Radeon 860M, MinGW-w64 GCC 15.2.0, Release,
main4b6ab6b, title relinked withrelinker --windows). Onmainit stops atMhC53TKmjVA(sysctlbyname). With this PR it gets past it and stops at the next import:KiJEPEWRyUYissigaction, which touches the signal masks #1431 is reworking, so it is left out of this PR.Tested
aarch64 Debian 13 host. The full project cannot be built here because it needs x86-64.
core/libs/tests/GuestSystemConfiguration.cppgainsCheckProcessorCountSysctl. It covers the size query, the read through both entry points, the partial copy withENOMEM,EPERM,EINVAL,EFAULT, an unchangederrnoon success, and the throw for an unknown name and an unknown MIB. Linked withSystemConfiguration.cpp, it passes natively against glibc.sysctl_nid_postfixandsysctlbyname_nid_postfixare undefined). Three mutants of the new code each make it abort: noENOMEMon a short buffer, noEPERMonnewp, and a wrong size query.SystemConfiguration.cppand the test compile for x86_64-linux-gnu and x86_64-windows-gnu with-Wall -Wextra(Zig 0.17 clang) without warnings.python3 tools/check_conventions.py --base origin/mainpasses.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)