feat(libkernel): implement pthread_set_name_np #1872
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1872"
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 TheAggie on 2026-10-08T22:27:50Z.
What
pthread_set_name_npwas not exported. Quake II (PPSA99007, the homebrew port) calls it.It renames through the existing
scePthreadRename. A null name clears the name, as in FreeBSD. Like FreeBSD's version it returns nothing, so a failure (for example a null thread) is ignored.Test (
guest_thread_self): the main thread's name reads back throughscePthreadGetnameafter a rename, is empty after a null name, and a null thread does nothing.Related: #1798 implements
pthread_getname_np; no overlap.Tested
Windows 11 Pro (26200), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release.
mainwith this PR and four other small libc/libkernel PRs of mine merged together (atol, getprogname, dup2, ctime/rewind, pthread_set_name_np). It was run from the generatedCTestTestfile.cmakecommands because antivirus blocksctest.exeon this machine.tools/check_conventions.py --base origin/mainpasses on this branch alone.Not tested on Linux or macOS.
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 github-actions[bot] on 2026-10-08T22:32:31Z.
Progress report (
ce64d8e→25f95d9)➖ System libraries: 84.76% (+0.0%, +1 implemented functions)
✅ 1 implemented
pthread_set_name_np_nid_postfixImported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-09T02:46:39Z.
Review: COMMENTED
Verified on Linux — the differential holds, which is the half the "Tested" line could not cover.
cmake --build build --target guest_thread_self_tests --parallel 16→ clean; the binary runs and passes, exit 0.mainwith the new test kept → the target fails to link:So the test cannot even run without the export, and its behavioural assertions are what carry the rest.
Claim cross-check: it delegates to
scePthreadRename(thread, name != nullptr ? name : "")(Pthread/Posix/Thread.cpp:72) and returnsvoid, so the null name clears the name and a failure (a null thread) is ignored, as the FreeBSD original does — the behaviour the body describes.The titles are named (Quake II PPSA99007) — that is exactly the part reviewers ask for, and it is here.
Not verified: Windows (the author's platform), and behaviour beyond what this test asserts.
Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T09:04:10Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libkernel/Pthread/Posix/Thread.cppL70Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T09:30:27Z.
Closing: Quake II (PPSA99007) stops at
systemon main, and PICO-8 reachespthread_set_name_nponly after six other missing imports (#1578). Reopen when it's a title's next stop on main, with the log line.Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-10T02:16:38Z.
This is now a title's next stop on current
main, so here is the log line the close note asked for, plus a check of this branch.Checked
25f95d9dmerged ontomainc963432d(the conflict inThread.cppismain's newpthread_getname_npright next to this function; keeping both resolves it), Linux (Ubuntu 24.04, GCC 13) and Windows 11 (MinGW-w64 GCC from WinLibs), Release.guest_thread_selfpasses 5/5 on both (--repeat until-fail:5); no CRT assertion dialog on Windows.main(catalog runs on2edaf7f4Linux and0c0dc1e9Windows) and with this branch:mainundefined symbol: oxMp8uPqa+U(pthread_set_name_np)JZKw5+Wrnaw(pthread_sigmask)Example lines for ScreenTester5 (PPSA69420):
mainWindowsFAIL: unresolved ELF import oxMp8uPqa+U (pthread_set_name_np) from libkernel.prx; with this branch, Linuxapp.elf: symbol lookup error: app.elf: undefined symbol: JZKw5+Wrnaw, WindowsFAIL: unresolved ELF import JZKw5+Wrnaw from libkernel.prx.Imported from boykopovar/AnyPS5. Originally posted by overlordxrz-source on 2026-10-10T03:36:50Z.
Another title that stops here on current
main: Nuvio (PPSA99997) on our Linux rig run of 2026-10-09 (x86-64 Ubuntu, lavapipe, Release) stops at the unresolved libkernel importoxMp8uPqa+U, which ispthread_set_name_np(tools/nid_names.py; also in zecoxao'saerolib.csv). Together with @babyhuey's ScreenTester5 lines above, that's two homebrew titles whose next stop onmainis this function. Thanks @TheAggie, could this be reopened?Imported from boykopovar/AnyPS5. Originally posted by TheAggie on 2026-10-10T04:49:05Z.
@oneandonlydean the reopen condition is met:
pthread_set_name_npis now a title's next stop on currentmain. Two runs by others above:oxMp8uPqa+U(pthread_set_name_np) onmain, Linux and Windows (FAIL: unresolved ELF import oxMp8uPqa+U (pthread_set_name_np) from libkernel.prx); with this branch it moves on toJZKw5+Wrnaw(pthread_sigmask).I rebased the branch onto current
main(afb8cd22) and force-pushed it. The only conflict wasmain's newpthread_getname_npnext to this function, and both are kept. On Windows (MinGW-w64 GCC 15.2, WinLibs, Release) it builds,guest_thread_selfand the otherguest_thread_*tests pass, andtools/check_conventions.pypasses. I don't have ScreenTester5 or Nuvio locally, so the title runs are theirs, not mine.Could you reopen it? GitHub doesn't let me reopen a PR a maintainer closed. Thanks @babyhuey and @overlordxrz-source for the runs.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by Get-fix on 2026-10-10T13:29:38Z.
Jelly5 (PPSA99505) also stops here, after its
libSceAudioOutstop (#1578, branchGet-fix:fix/audioout-ex-exportsf2b4bf3b). I checked this branch at 07fb84da (the rebase ontoafb8cd22) merged ontomainb69270dd(clean), together with that branch, on Windows 11 (WinLibs GCC 15.2.0 r7, Release):ctest -R ^guest_thread --repeat until-fail:5: 4/4 (guest_thread_self,guest_thread_atexit,guest_thread_callback_abi,guest_thread_cpu_clock).main+fix/audioout-ex-exportsFAIL: unresolved ELF import oxMp8uPqa+U from libkernel.prxlibkernel.prxFAIL: unresolved ELF import -nvxBWa0iDs from libSceLibcInternal.prx(gethostname)The full library set rebuilt with both branches gives the same stop.
AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by TheAggie on 2026-10-10T13:39:47Z.
More titles stop here, from a triage of the whole homebrew catalog on
maincf8b129e2(Windows 11, MinGW-w64 GCC 15.2.0; each release ZIP checked against its catalog sha256, relinked withrelinker --windows --registry, run for 12 s). Three titles stop atoxMp8uPqa+U(pthread_set_name_np), and with this branch each moves on:mainpthread_set_name_npJZKw5+Wrnaw(pthread_sigmask)pthread_set_name_npn1KOc0lTUEs(arc4random_buf, libScePosixForWebKit)pthread_set_name_npJb2uGFMr688(pthread_getaffinity_np)The "with this branch" column comes from one build of
mainwith this branch (07fb84da, the rebased head) plus #2765, #2478 and #2024, which add unrelated imports (alarm,dup/dup2,utime). This matches @babyhuey's ScreenTester5 run on Linux and Windows and @overlordxrz-source's Nuvio report. @oneandonlydean, could this be reopened?AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-10T14:02:19Z.
Update for current
main, since title stops moved after #2605 (each title's ownlibc.prxis now loaded; details in #1578). This is now the next stop for three catalog titles onmain, and more reach it once other open work lands.Checked
25f95d9dmerged ontomain808d8dc4, Linux (Ubuntu 24.04, GCC 13) and Windows 11 (MinGW-w64 GCC 15.2 from WinLibs), Release. The only conflict is the same one as before:main'spthread_getname_npsits right above this function inThread.cpp, and keeping both resolves it.guest_thread_selfpasses 5/5 on both (--repeat until-fail:5).mainoxMp8uPqa+U(pthread_set_name_np)JZKw5+Wrnaw(pthread_sigmask)oxMp8uPqa+Un1KOc0lTUEs(arc4random_buf)oxMp8uPqa+UJb2uGFMr688(pthread_getaffinity_np)Example lines for EVO Player:
mainWindowsFAIL: unresolved ELF import oxMp8uPqa+U (pthread_set_name_np) from libkernel.prx; with this branch, Linuxapp.elf: symbol lookup error: app.elf: undefined symbol: n1KOc0lTUEs, WindowsFAIL: unresolved ELF import n1KOc0lTUEs (arc4random_buf) from libScePosixForWebKit.prx.Titles that reach
pthread_set_name_nponce an open PR or posted branch is in: Jelly5 and Emby5 (Get-fix'ssceAudioOutExGetMonitorInfobranch in #1578), PSBox Cloud Gaming (#1772), and OpenNOW (the cpuset and rwlockattr branches in #1578). Nuvio PS5 also stops here on Windowsmain; on Linux it reportsTf9-yOJwF-A(sceAudioOutSysGetHdmiMonitorInfo) first, so it needs both.Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-10T17:36:52Z.
@TheAggie in case it helps: with the intake check now at 10 merged PRs and the title lines above, this can go up again as a new PR (a closed PR can't be reopened by its author once a maintainer closed it).
Pull request closed