Skip to content

feat(libkernel): report _SC_CLK_TCK through sysconf - #5185

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
p3n1cillin:claude/sysconf-clk-tck
Oct 14, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
p3n1cillin:claude/sysconf-clk-tck

Conversation

@p3n1cillin

@p3n1cillin p3n1cillin commented Oct 13, 2026 •

Copy link
Copy Markdown

What

Once PS5MC (PPSA99420, Kodi 22, catalog release) gets past mimalloc (#5184), its embedded Python fails while importing posix, and Kodi exits:

[stderr]   File "<frozen importlib._bootstrap_external>", line 38, in <module>
[stderr] RuntimeError: cannot read ticks_per_second
critical <general>: XBPython: Python initialization failed in _PyImport_InitExternal: external importer setup failed (exit code 0); Python add-ons are unavailable
critical <general>: CServiceManager::InitStageTwo: Unable to initialize the python binding modules
ERROR: Unable to create application. Exiting

CPython raises "cannot read ticks_per_second" when sysconf(_SC_CLK_TCK) is below 1. AnyPS5's sysconf returned -1 with EINVAL for _SC_CLK_TCK (3), since it knew only the page size, the processor counts and the physical pages.

sysconf(_SC_CLK_TCK) now returns 128: FreeBSD's sysconf returns CLK_TCK, which time.h defines as 128, and _SC_CLK_TCK is 3 in FreeBSD's unistd.h. AnyPS5 has no times() that reports ticks at another rate. The console's value is not checked; this is recorded under Unknown function info in docs/dev/debt/libkernel.md.

Tested

Checklist

🤖 Generated with Claude Code

The Python in PS5MC (PPSA99420) reads sysconf(_SC_CLK_TCK) while
importing its posix module and failed with "cannot read
ticks_per_second". It returns FreeBSD's CLK_TCK, 128.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@p3n1cillin

Copy link
Copy Markdown
Author

Linux run: Ubuntu in WSL2, GCC 15.2.0, Ninja Release, BUILD_TESTING=ON, full build of a local test head 838d4fd85. That head is main 3faa9cb40 with this PR, my other open libkernel PRs (#5013, #5061, #5078, #5098, #5183–#5187, #5191) and the open PRs the catalog titles need (#4377, #4379, #4374, #4383, #3798, #4467, #4863, #4105). All 123 libkernel and 69 libc tests pass, including guest_system_configuration, guest_getrlimit, guest_kernel_fcntl, guest_freebsd_clocks, guest_kernel_sys and guest_filesystem. Not built alone on Linux; no title run on Linux.

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#5275 docs/dev/debt/libkernel.md L17

@coltken95

Copy link
Copy Markdown

Tested on Linux x86-64 (Release build), with this PR alone (72a685b) merged into main 9d0a41d:

  • With the PR: guest_system_configuration passes.
  • With main's sources and the PR's test: guest_system_configuration aborts.

AI-assisted: yes (Claude Code)

@oneandonlydean
oneandonlydean merged commit fc1e388 into boykopovar:main Oct 14, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants