libkernel debt: note how a title calls sem_timedwait #10104

Closed
opened 2026-10-23 09:25:14 +00:00 by xXPBSXx · 0 comments
xXPBSXx commented 2026-10-23 09:25:14 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-23T09:25:14Z.


The debt entry in docs/dev/debt/libkernel.md does not record how a title calls the function. A title call site adds this (call-site address included so the reading can be checked).

The changed entry now reads:

sem_timedwait (libkernel) consumes an available count before checking the timeout and waits indefinitely for a null timeout, following FreeBSD 11's sem_timedwait. Console behavior for null and invalid timeouts when a count is available is unverified. One title (PPSA29866) disassembled for this entry has one call site (0x130916), in a wait helper that reads the clock with id 0 into a zeroed 16-byte time structure, adds the milliseconds multiplied by 1,000,000 to the nanoseconds and normalises them below 1e9, so its deadline is never null. It repeats the wait with the same deadline when the error is 4, returns false for any other error and when reading the clock fails, and does not tell a timeout from other errors. This title therefore gives no evidence on null or invalid timeouts.

Fix: branch docs/debt-kernel-semtimedwait-title.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5995288479 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/10104). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-23T09:25:14Z. --- The debt entry in `docs/dev/debt/libkernel.md` does not record how a title calls the function. A title call site adds this (call-site address included so the reading can be checked). The changed entry now reads: > [sem_timedwait](../../../core/libs/prx/libkernel/Pthread/Posix/Sem.cpp) (libkernel) consumes an available count before checking the timeout and waits indefinitely for a null timeout, following FreeBSD 11's `sem_timedwait`. Console behavior for null and invalid timeouts when a count is available is unverified. One title (PPSA29866) disassembled for this entry has one call site (0x130916), in a wait helper that reads the clock with id 0 into a zeroed 16-byte time structure, adds the milliseconds multiplied by 1,000,000 to the nanoseconds and normalises them below 1e9, so its deadline is never null. It repeats the wait with the same deadline when the error is 4, returns false for any other error and when reading the clock fails, and does not tell a timeout from other errors. This title therefore gives no evidence on null or invalid timeouts. Fix: branch `docs/debt-kernel-semtimedwait-title`. AI-assisted (Claude Code).
Sign in to join this conversation.
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#10104
No description provided.