Skip to content

feat(libkernel): query real-time alarms with getitimer - #3572

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
Lorkydey:feat/libkernel-getitimer
Oct 11, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
Lorkydey:feat/libkernel-getitimer

Conversation

@Lorkydey

Copy link
Copy Markdown
Contributor

What

PS5MC 1.2 (PPSA99420, Kodi 22) imports getitimer from libkernel, but main a11c8f7f does not export it. Its public release's ELF dynamic symbol 457 is the undefined function J1H1QRCJf2Q#M#N; the import metadata maps this to libkernel. The same missing function is listed for PS5MC in #1578. Searches for the function and its NID found no existing PR; the relevant closed homebrew bundle #3293 also contains no implementation of it.

Implement getitimer(ITIMER_REAL) using the existing guest alarm's synchronized monotonic deadline. It returns normalized, signed 64-bit seconds/microseconds, reports an inactive or expired alarm as zero, and does not reset or cancel it. The interval is zero because the current alarm backend is one-shot. Invalid selectors return guest EINVAL; a null real-timer output returns EFAULT; success preserves errno. CPU interval timers (ITIMER_VIRTUAL and ITIMER_PROF) explicitly throw because those timers are not implemented.

The ABI and relative-time/error rules follow FreeBSD's getitimer implementation and itimerval definition. No new comments, Markdown changes, dependencies, or generated files.

Tested

Windows 11 Pro 26100, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON.

  • With the new regression test but main's unchanged implementation, the test executable fails to link: undefined reference to getitimer_nid_postfix.
  • Full build succeeds. All six targeted tests pass: guest_getitimer, guest_signals, guest_signal_sets, guest_sigtimedwait, guest_process_time, and guest_cpu_time_clocks.
  • The new behavioral test takes 1.17 seconds. It covers countdown, cancellation, expiry, simultaneous readers, alarms longer than INT32_MAX seconds, output bounds/layout, errno, invalid inputs, and explicit CPU-timer refusal.
  • Patched libkernel.prx exports J1H1QRCJf2Q. Conventions and diff whitespace checks pass.
  • tools/progress.py: system libraries 2903/3383 (85.81%) -> 2904/3384 (85.82%). This is the source counter, not a claim that CPU timers or PS5MC startup are fully supported.

Title evidence: the public PS5MC 1.2 Kodi 22 release, archive SHA256 5a9eeff4a0024a341a4924b8d283fe65b4ff94d7f5dbea446c8a677c4db157b6, verified against the catalog and inspected without executing it. PS5MC was not launched; this does not establish getitimer as its first startup failure. Linux and macOS runtime tests were not run locally.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no silent stubs
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes (Codex)

@github-actions

Copy link
Copy Markdown

Progress report (a11c8f7 → 1fc9b4d)

📈 System libraries: 85.82% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libkernel getitimer_nid_postfix

@adriadam10

Copy link
Copy Markdown
Collaborator

Checked build + guest_getitimer on Linux (passes; fails to link without the change), FreeBSD getitimer errno order/ABI, no NID alias duplicates; merging.

@adriadam10
adriadam10 merged commit 195f55e into boykopovar:main Oct 11, 2026
15 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.

2 participants