feat(libkernel): implement setitimer #4382

Closed
MarcZX10 wants to merge 1 commit from upstream-pr/4382 into main
MarcZX10 commented 2026-10-12 08:24:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T08:24:50Z.


What

Carries the ready setitimer implementation from issue #3735 onto current main, integrating it with the existing getitimer and alarm timer state. ITIMER_REAL supports countdown, disarm, and periodic rearming. Invalid inputs return FreeBSD-style errors; unsupported CPU timers, sub-millisecond intervals, and signal delivery cases fail explicitly where the emulator lacks the required behavior.

This PR covers only the setitimer portion; getitimer remains as currently implemented on main.

Tested

  • Linux Release GCC 12.2 build: guest_itimer_tests, guest_signal_tests.
  • ctest --test-dir /tmp/AnyPS5-3735-build -R '^guest_itimer$' --output-on-failure: 1/1 passed.
  • ctest --test-dir /tmp/AnyPS5-3735-build -R '^guest_signals$' --output-on-failure: 1/1 passed.
  • python3 tools/check_conventions.py: passed.
  • git diff --check upstream/main: passed.

Checklist

  • Based on current main; no other open PR implements the same function
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; silent stubs are listed in TechnicalDebt
  • 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; carried from the original implementation commit with authorship preserved
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4826809037 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4382). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T08:24:50Z. --- ### What Carries the ready `setitimer` implementation from issue #3735 onto current `main`, integrating it with the existing `getitimer` and alarm timer state. `ITIMER_REAL` supports countdown, disarm, and periodic rearming. Invalid inputs return FreeBSD-style errors; unsupported CPU timers, sub-millisecond intervals, and signal delivery cases fail explicitly where the emulator lacks the required behavior. This PR covers only the `setitimer` portion; `getitimer` remains as currently implemented on `main`. ### Tested - Linux Release GCC 12.2 build: `guest_itimer_tests`, `guest_signal_tests`. - `ctest --test-dir /tmp/AnyPS5-3735-build -R '^guest_itimer$' --output-on-failure`: 1/1 passed. - `ctest --test-dir /tmp/AnyPS5-3735-build -R '^guest_signals$' --output-on-failure`: 1/1 passed. - `python3 tools/check_conventions.py`: passed. - `git diff --check upstream/main`: passed. ### Checklist - [x] Based on current `main`; no other open PR implements the same function - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes; carried from the original implementation commit with authorship preserved
github-actions[bot] commented 2026-10-12 08:31:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T08:31:20Z.


Progress report (1acfa7f → 12abb3f)

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

✅ 1 implemented
Library Name
libkernel setitimer_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6120623680 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4382#issuecomment-6120623680). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T08:31:20Z. --- <!-- progress-report --> ### Progress report (1acfa7f → 12abb3f) 📈 **System libraries**: 86.37% (+0.01%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libkernel | `setitimer_nid_postfix` | </details>
MarcZX10 commented 2026-10-12 08:41:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T08:41:53Z.


The PR description was corrected to use the template section headings (### What, ### Tested, ### Checklist) and now passes the local conventions checker. The current hosted conventions result reflects the earlier body. Posting this update to trigger a fresh PR check against the corrected description.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6120777352 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4382#issuecomment-6120777352). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T08:41:53Z. --- The PR description was corrected to use the template section headings (`### What`, `### Tested`, `### Checklist`) and now passes the local conventions checker. The current hosted conventions result reflects the earlier body. Posting this update to trigger a fresh PR check against the corrected description.
xXPBSXx commented 2026-10-12 11:22:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T11:22:30Z.


Windows test: head 7fba6709c merged onto current main 3d8ffeb27 (clean merge, no conflicts). Windows 10, MinGW GCC (WinLibs), Ninja Release, -j4: full build 0 errors; ctest (guest_itimer): 1/1 passed; python tools/check_conventions.py --base upstream/main passed. I did not run the new tests against main without the change.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6123261765 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4382#issuecomment-6123261765). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-12T11:22:30Z. --- Windows test: head `7fba6709c` merged onto current `main` `3d8ffeb27` (clean merge, no conflicts). Windows 10, MinGW GCC (WinLibs), Ninja Release, `-j4`: full build 0 errors; ctest (guest_itimer): 1/1 passed; `python tools/check_conventions.py --base upstream/main` passed. I did not run the new tests against `main` without the change. AI-assisted (Claude Code).
blawesom commented 2026-10-12 14:02:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-12T14:02:00Z.


Rebase handoff — rebased onto current main, authorship unchanged (only a TechnicalDebt.md union conflict; both entries kept).

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

  • builds; tools/check_conventions.py --base origin/main passes
  • full suite: 954/954 passed

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/4382
git checkout <your branch>
git merge --ff-only FETCH_HEAD
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6125841611 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4382#issuecomment-6125841611). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-12T14:02:00Z. --- **Rebase handoff** — rebased onto current `main`, authorship unchanged (only a `TechnicalDebt.md` union conflict; both entries kept). Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`, AMD RX 9070 XT / RADV): - builds; `tools/check_conventions.py --base origin/main` passes - **full suite: 954/954 passed** **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/4382 git checkout <your branch> git merge --ff-only FETCH_HEAD ```
MarcZX10 commented 2026-10-12 20:31:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T20:31:55Z.


Closing this stale carry as superseded by merged #3800, which includes the same setitimer implementation plus the interval-reporting fix for getitimer. The current head here would also remove that merged getitimer interval reporting if rebased as written, so it no longer has a safe unique diff to preserve.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132114020 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4382#issuecomment-6132114020). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T20:31:55Z. --- Closing this stale carry as superseded by merged #3800, which includes the same `setitimer` implementation plus the interval-reporting fix for `getitimer`. The current head here would also remove that merged `getitimer` interval reporting if rebased as written, so it no longer has a safe unique diff to preserve.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!4382
No description provided.