feat(libkernel): implement clock_settime argument handling #4376

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

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


What

Carries the clock_settime commit from #3632 on current main, preserving its original commit author. It follows FreeBSD 11.4 argument validation: null time returns EFAULT, unsupported clocks and invalid seconds/nanoseconds return EINVAL. A valid CLOCK_REALTIME request throws with the requested timestamp because the emulator does not set the host clock or track a guest clock offset. The console privilege behavior remains documented in TechnicalDebt.

This covers only the clock_settime export from #3632; the other exports in that issue remain separate work.

Tested

  • Linux, GCC 12.2, Release, BUILD_TESTING=ON: CMake configure completed.
  • Built guest_freebsd_clocks_tests and ran ctest -R '^guest_freebsd_clocks$': 1/1 passed.
  • python3 tools/check_conventions.py --base upstream/main: passed.
  • git diff --check: passed.
  • Windows and macOS: not tested locally.

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 (NotImplemented_nid_no_patch); 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:4826693074 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4376). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T08:13:40Z. --- ### What Carries the `clock_settime` commit from #3632 on current `main`, preserving its original commit author. It follows FreeBSD 11.4 argument validation: null time returns `EFAULT`, unsupported clocks and invalid seconds/nanoseconds return `EINVAL`. A valid `CLOCK_REALTIME` request throws with the requested timestamp because the emulator does not set the host clock or track a guest clock offset. The console privilege behavior remains documented in TechnicalDebt. This covers only the `clock_settime` export from #3632; the other exports in that issue remain separate work. ### Tested - Linux, GCC 12.2, Release, `BUILD_TESTING=ON`: CMake configure completed. - Built `guest_freebsd_clocks_tests` and ran `ctest -R '^guest_freebsd_clocks$'`: 1/1 passed. - `python3 tools/check_conventions.py --base upstream/main`: passed. - `git diff --check`: passed. - Windows and macOS: not tested locally. ### 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 (`NotImplemented_nid_no_patch`); 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:26:16 +00:00 (Migrated from github.com)

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


Progress report (1acfa7f → 98700ab)

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

✅ 1 implemented
Library Name
libkernel clock_settime_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6120551297 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4376#issuecomment-6120551297). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T08:26:16Z. --- <!-- progress-report --> ### Progress report (1acfa7f → 98700ab) 📈 **System libraries**: 86.37% (+0.01%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libkernel | `clock_settime_nid_postfix` | </details>
xXPBSXx commented 2026-10-12 11:51:16 +00:00 (Migrated from github.com)

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


Windows test: head 695ed15fa merged onto current main 3d8ffeb27 (clean merge, no conflicts). Windows 10, MinGW GCC (WinLibs), Ninja Release, -j4: full build 0 errors; ctest with the filter guest_freebsd_clocks: guest_freebsd_clocks passed (1 test(s), 0 failed); 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:6123694899 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4376#issuecomment-6123694899). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-12T11:51:16Z. --- Windows test: head `695ed15fa` merged onto current `main` `3d8ffeb27` (clean merge, no conflicts). Windows 10, MinGW GCC (WinLibs), Ninja Release, `-j4`: full build 0 errors; ctest with the filter `guest_freebsd_clocks`: guest_freebsd_clocks passed (1 test(s), 0 failed); `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:05 +00:00 (Migrated from github.com)

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


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/4376
git checkout <your branch>
git merge --ff-only FETCH_HEAD
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6125842858 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4376#issuecomment-6125842858). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-12T14:02:05Z. --- **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/4376 git checkout <your branch> git merge --ff-only FETCH_HEAD ```
oneandonlydean commented 2026-10-13 00:21:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T00:21:38Z.


Closing: this is the clock_settime commit from #3654, which was closed until a title run stops at it, and no run is shown here; a valid CLOCK_REALTIME call still only throws. Reopen with the title ID and the log line when one stops there.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6135190681 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4376#issuecomment-6135190681). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T00:21:38Z. --- Closing: this is the `clock_settime` commit from #3654, which was closed until a title run stops at it, and no run is shown here; a valid `CLOCK_REALTIME` call still only throws. Reopen with the title ID and the log line when one stops there.

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!4376
No description provided.