SCE kernel errors are 0x80020000 plus the FreeBSD errno. The equeue and
direct memory constants used an unrelated 0x8001xxxx range with mismatched
errno values (e.g. ETIMEDOUT was 0x80010023), so a guest checking
sceKernelWaitEqueue for SCE_KERNEL_ERROR_ETIMEDOUT saw an unexpected error.
SCE_KERNEL_ERROR_EDEADLK in Mutex.cpp held the EAGAIN value.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- scePthreadSelf returned null on Linux and for threads not created by
scePthreadCreate (including the main thread); such threads now get a
lazily adopted, non-joinable handle
- scePthreadExit on Linux skipped FinishThread, losing the join value
- detached threads on Linux were never freed; use the reference count
already used on Windows
- unlocking a recursive mutex from a non-owner was undefined behaviour;
return SCE_KERNEL_ERROR_EPERM
- scePthreadCondTimedwait did not restore the mutex owner after waking,
so another thread locking during the wait made the waiter's unlock
fail with EPERM and left the mutex locked forever
- SCE_KERNEL_ERROR_ETIMEDOUT in Cond.cpp was 0x80020062 instead of 0x8002003C
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
libkernel: a TimedWait service for condition variables, semaphores, event flags, rwlocks and
equeues with the scheduler tick; mutex/cond/sem corner cases the title hits; job worker
affinity is opt-in (APS5_JOB_AFFINITY). libc: calloc/realloc heap slot swap, a default
terminate handler with a backtrace, CPU topology helper. libSceRtc export fixes with tests.
libSceVideoOut: APS5_NO_PAD_INPUT ignores host input for unattended measurements,
APS5_FLIP_QUEUE_WAIT keeps a stalled process alive for a debugger. ApplicationHeap and
GuestRtc tests wired into the test build.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0177gthrWEBBfBu5xJDXgBfo
feat(rtc): implement libSceRtc date and tick functions
- Ticks count microseconds since 0001-01-01 00:00:00 in the proleptic Gregorian calendar, up to 9999-12-31 23:59:59.999999. `sceRtcGetTickResolution` returns 1000000.
- Validation (`sceRtcCheckValid`, `sceRtcIsLeapYear`, `sceRtcGetDayOfWeek`) returns the matching `SCE_RTC_ERROR_INVALID_*` code (`0x80B50002`–`0x80B5000E`).
- Conversions: `sceRtcGetTick`/`SetTick`, `GetTime_t`/`SetTime_t`, `GetWin32FileTime`/`SetWin32FileTime`.
- Current time: `sceRtcGetCurrentTick`, `GetCurrentClock`, `GetCurrentClockLocalTime`. `sceRtcGetCurrentNetworkTick` uses the host clock.
- UTC and local time conversion through the host time zone.
- `sceRtcFormatRFC3339` (`YYYY-MM-DDThh:mm:ss.cc` plus `Z` or `±hh:mm`) and `sceRtcParseRFC3339`.
- Tick arithmetic (`sceRtcTickAdd*`) rejects results outside the valid range with `SCE_RTC_ERROR_INVALID_VALUE`.
- New exports: `sceRtcGetDaysInMonth`, `sceRtcTickAddMonths` and `sceRtcTickAddYears`. The last two clamp the day to the end of the target month (2024-01-31 + 1 month = 2024-02-29).
Ticks count microseconds since 0001-01-01 in the proleptic Gregorian
calendar, up to 9999-12-31 23:59:59.999999. Implement validation, tick
and date conversion, time_t and Win32 FILETIME conversion, UTC and
local time conversion through the host time zone, RFC 3339 formatting
and parsing, and tick arithmetic. Add sceRtcGetDaysInMonth,
sceRtcTickAddMonths and sceRtcTickAddYears, which clamp the day to the
end of the target month.
The network clock uses the host clock.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fill the buffer from std::random_device and reject a null buffer or a
size above SCE_RANDOM_MAX_SIZE (64) with SCE_RANDOM_ERROR_INVALID, as
the system library does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SceLibcMallocReplace lists calloc before realloc (malloc, free, calloc,
realloc, memalign, reallocalign, posix_memalign, ...), as the table in
retail titles shows. realloc therefore called the application's calloc
with the old pointer as the element count, and calloc called realloc.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>