feat(libkernel): implement pthread_getname_np #1798
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1798"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by hugodearaujo on 2026-10-08T19:27:16Z.
What
Hades (PPSA03355, v01.003) stops at load on
main:9HzfhdtESioispthread_getname_np. The executable imports it from libkernel and calls it once:pthread_getname_np(pthread_self(), buffer), with a 32-byte stack buffer that was zeroed first. No length is set before the call.I measured the console function on a PS5 (firmware 13.60) by calling libkernel's export through
dlopenfrom a homebrew payload, with the buffer filled with0xAAbefore each call:"","A","AnyPS5Probe", a 31-character name""ESRCH), nothing writtenEFAULT)So on the PS5 it takes
(thread, buffer), not FreeBSD's(thread, buffer, length). This addspthread_getname_npwith that signature on top ofscePthreadGetname, which already writes the stored name truncated to 31 characters and terminated, and returnsESRCHandEFAULTfor the two measured errors.A joined thread cannot be detected here:
scePthreadJoinfrees the thread object, so the pointer is indistinguishable from a live one. The TechnicalDebt entry records that. Hades only passespthread_self().With this branch, Hades gets past load and runs until
sceKernelDebugRaiseException(0xa0020013), before it reaches thepthread_getname_npcall. That stop is unrelated and is not touched here.A fork branch (
budhilaw/AnyPS5,feat/macos-uncharted, not in a PR) has a three-argument version that would read the length fromrdx. Hades never sets that register before this call.Measured in passing, and not changed here: the console's
pthread_rename_nprefuses a name of 32 characters or more with 63 (ENAMETOOLONG) and keeps the old name, whilemainstores any length.Tested
mainwith the line above, and gets past load with this branch.libs, full CTest 480/480. The newguest_pthread_getnamecovers every row except the joined thread.libs, CTest 0 failed of 474,guest_pthread_getnameincluded (GPU execution tests skipped, the VM has no GPU).guest_pthread_getnamefail. They drop the null-thread or null-buffer check, returnEINVALfor the buffer, drop the terminator, or pad the buffer past the name.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by hugodearaujo on 2026-10-08T19:27:25Z.
Probe and raw output. It is a ps5-payload-sdk v0.43 payload (
prospero-clang -O1 -rdynamic) that resolvespthread_getname_npandpthread_rename_npfrom libkernel withdlopen. Each line shows the return value and the bytes written into a 64-byte buffer pre-filled with0xAA. Theinitialline is the payload's own main thread name.getname.c
raw output
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T19:27:43Z.
Progress report (
b858fdc→3c7859c)➖ System libraries: 84.76% (+0.0%, +1 implemented functions)
✅ 1 implemented
pthread_getname_np_nid_postfixImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T21:51:54Z.
Checked the diff, build + full ctest (524/524) on Linux, and that
guest_pthread_getnamefails to link without the change; Linux, Windows and conventions CI are green. The joined-thread gap is recorded in TechnicalDebt under "Unknown function info". Merging.