Skip to content

feat(libkernel): implement clock_settime argument handling - #4376

Closed
MarcZX10 wants to merge 1 commit into
boykopovar:mainfrom
MarcZX10:codex/carry-clock-settime-3632
Closed

MarcZX10 wants to merge 1 commit into
boykopovar:mainfrom
MarcZX10:codex/carry-clock-settime-3632

Conversation

@MarcZX10

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Progress report (1acfa7f → 98700ab)

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

✅ 1 implemented
Library Name
libkernel clock_settime_nid_postfix

@xXPBSXx

xXPBSXx commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

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

PS5MC (PPSA99420, Kodi 22) imports clock_settime (d7nUj1LOdDU) from
libkernel.prx, one reference, after sigwaitinfo in its import order.
Predicted stop once the imports ahead of it are covered (not a run):

  FAIL: unresolved ELF import d7nUj1LOdDU from libkernel.prx

The NID is computed with tools/nid_names.py and matches aerolib.

Follows FreeBSD 11.4 sys/kern/kern_time.c sys_clock_settime and
kern_clock_settime (8c639945a44588f6cfdddfb057bb5aad88735da0) for a
root caller: EFAULT for a null time (copyin), EINVAL for any clock but
CLOCK_REALTIME and for a negative tv_sec or a tv_nsec outside 0 to
999999999. A valid CLOCK_REALTIME request throws with the requested
time named, since the host clock must not be set and no guest clock
offset is kept.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit 43dc8bc)
@oneandonlydean

Copy link
Copy Markdown
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs libkernel needs rebase Conflicts with main, rebase needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants