Commit Graph

9 Commits

Author SHA1 Message Date
nabilfp ae9978a98e feat(libkernel): add clock_settime with FreeBSD argument checks
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>

Co-authored-by: David <david@example.com>
2026-10-13 14:57:46 +01:00
Dean f3abf38307
Merge pull request #3855 from Lorkydey/fix/libkernel-utc-dst-width
fix(libkernel): limit UTC-to-local DST output to 32 bits
2026-10-12 16:07:49 +13:00
Lorkydey 36d37a062a fix(libkernel): limit UTC-to-local DST output to 32 bits 2026-10-11 19:56:47 +02:00
QRMOE 10e822cf04
test(libkernel): cover omitted clock resolution
Cover 20 clock IDs, preserved guest errno, non-null unsupported clocks and the SCE null-output fault. The regression fails against main and passes with the accompanying fix.

AI-assisted: yes
2026-10-11 15:53:15 +02:00
Dean 50cea78f6b
Merge pull request #2291 from AchrafReyani/fix/libkernel-null-time-results
fix(libkernel): accept null results in gettimeofday and clock_getres
2026-10-10 20:07:40 +13:00
Achraf Reyani 70d6382e33 fix(libkernel): accept null results in gettimeofday and clock_getres
FreeBSD's gettimeofday stores the time only when tp is not null, and
clock_getres the resolution only when res is not null; both succeed
otherwise. Both threw, which aborted a title probing a clock or only
asking for the time zone. Write into a local result instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 12:24:29 +09:00
authurtabo-byte 035b675e6d fix(libkernel): initialize the full local-time conversion state 2026-10-09 15:43:24 -07:00
Adrià Franch 3f2e5150c2 feat(libc): implement _Xtime_get_ticks
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-05 20:16:11 +02:00
DotDebian 096bdb38c2 fix(libkernel): give CLOCK_VIRTUAL, CLOCK_PROF and CLOCK_SECOND their FreeBSD meaning
clock_gettime and clock_getres served three FreeBSD clock ids with the wrong
clock or not at all:

- CLOCK_VIRTUAL (1) was the monotonic clock on Windows and threw on Linux; it
  is the user CPU time of the process.
- CLOCK_PROF (2) threw on both hosts; it is the user plus system CPU time of
  the process.
- CLOCK_SECOND (13) returned the coarse realtime clock with nanoseconds and a
  sub-second resolution; it is the current second with tv_nsec 0 and a
  resolution of one second.

Behaviour follows FreeBSD 11 clock_gettime(2) and kern_clock_gettime /
kern_clock_getres in sys/kern/kern_time.c.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 10:24:22 +02:00