feat(libkernel): implement pthread_attr_getscope, setscope, getinheritsched and getstackaddr #3494
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3494"
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 babyhuey on 2026-10-11T11:39:55Z.
What
Carries #3377 by @pushkarreddyy, which the intake check closed; both commits keep their author, rebased onto
main0f863c10with no conflicts. pushkarreddyy agreed to the carry on #3377.It adds
pthread_attr_getscope(e2G+cdEkOmU),pthread_attr_setscope,pthread_attr_getinheritschedandpthread_attr_getstackaddr(DxmIMUQ-wXY) to libkernel, following FreeBSD 11libthr:PTHREAD_SCOPE_PROCESS0 andPTHREAD_SCOPE_SYSTEM2 (the default),PTHREAD_INHERIT_SCHED4 andPTHREAD_EXPLICIT_SCHED0,EINVALfor an invalid attribute, a null output or an unknown scope, andENOTSUPfor an unknown inherit value. A null output ofpthread_attr_getinheritschedthrows, since libthr writes through it unchecked. A thread keeps the scope it was created with andpthread_attr_get_npreports it; TechnicalDebt records that every guest thread still runs as a host thread at system scope.Seven catalog titles stop at
pthread_attr_getscopeonmain0f863c10(catalog builds,eboot.binandsce_module/libc.prxunwrapped as #2605 requires; tracked in #1578), each withapp.elf: symbol lookup error: app.elf: undefined symbol: e2G+cdEkOmUon Linux. With this PR, on Linux:valvefolderbaseq3baseq3v_fma_mixlo/mixhi_f16in an unsupported float modesysctl_nid_postfix: unsupported MIB 1.37(kern.arandom)ccleste, RommPS and Quake3e need
pthread_attr_getstackaddrright aftergetscope, which is why it's included.Tested
Linux (Ubuntu 24.04, GCC 13) and Windows 11 (MinGW-w64 GCC 15.2 from WinLibs), Release:
guest_pthread_attrpasses 5/5 (--repeat until-fail:5) on both, with no warnings in the changed files, andcheck_conventions.pypasses.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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T11:40:16Z.
Progress report (
51e2c51→3246697)📈 System libraries: 85.73% (+0.02%, +4 implemented functions)
✅ 4 implemented
pthread_attr_getinheritsched_nid_postfixpthread_attr_getscope_nid_postfixpthread_attr_getstackaddr_nid_postfixpthread_attr_setscope_nid_postfixImported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T11:49:29Z.
Thank you so much @babyhuey for carrying #3377 into #3494 and preserving commit authorship!
It's fantastic to see all seven catalog titles (XashPS5, Quake3e, ccleste, RommPS, ProsperoLight, PSBox Cloud Gaming, and vkQuake) advance cleanly past their imports. Really appreciate your support and testing!
Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T11:55:38Z.
Calling on @screamm and @blawesom to run title validation across non-headless Windows / Linux environments as well, to see where ccleste, RommPS, ProsperoLight, and vkQuake advance past these imports or if any subsequent stop is reached. Please feel free to provide any input or observations from runtime logs!
Also calling on reviewers @adriadam10, @oneandonlydean, and @MarcZX100 to take a look and review/merge when convenient. All conventions and intake checks are green!
Imported from boykopovar/AnyPS5. Originally posted by orishamir on 2026-10-11T14:07:28Z.
Two more titles this PR moves, on Windows: PSXS5 and SwanStationPS5 reach
pthread_attr_getscopeoncereallocf(#3522) is in. Catalog builds,maina11c8f7f+ #3522'sFileAndHeap.cpp, with and without this PR's five non-test files (33d67cc0); Windows 11, RTX 4080, Release, 45 s.FAIL: unresolved ELF import e2G+cdEkOmU from libkernel.prxpoll: descriptor 6 is not a socket(#3521)AI-assisted: yes (Claude Code Opus 5.5 xhigh)
Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T14:42:09Z.
Thank you @orishamir for testing and verifying on Windows 11 / RTX 4080!
It's huge to see both PSXS5 (PPSA97510) and SwanStationPS5 (PPSA98510) moving past start-up, with SwanStationPS5 running completely stable at 4K @ 59.94 Hz and PSXS5 cleanly advancing to descriptor polling (#3521) once
reallocf(#3522) andpthread_attr_getscope(#3494) are in place.Calling on reviewers and maintainers @babyhuey , @MarcZX100 , @adriadam10 , and @oneandonlydean :
Both PR #3494 and PR #3522 have all 14/14 CI checks green and have now been independently verified on real titles and Linux test suites (832/832 by @blawesom). Could you please take a look for final review and merge into
mainso these title unblocks land upstream? Thank you!Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T14:45:51Z.
Thank you @orishamir for the great testing and data points on Windows 11!
Regarding the 31-second abort on PSXS5 (
what(): poll: descriptor 6 is not a socket (#3521)): I have carried @screamm's ready fix for #3521 into #3649 (feat(libkernel): poll on file descriptors and Windows pipe read ends) with their authorship preserved. Combined with #3522 and this PR (#3494), PSXS5 will get past that non-socket poll error as well!Imported from boykopovar/AnyPS5. Originally posted by overlordxrz-source on 2026-10-11T15:17:14Z.
Linux results for this PR (Hetzner CPX42, Ubuntu, lavapipe under Xvfb, catalog builds). Base: main 3b620aa4 + this PR (498e8fad). Without it, all 14 titles below stop at
e2G+cdEkOmU/xesmlSI-KCI/oLjPqUKhzes/DxmIMUQ-wXY.1t1-JoZ0sZQ(sinhf)YMZO9ChZb0E(reallocf, #3522)YMZO9ChZb0E(reallocf, #3522)Nx-F5v0-qU8(asinl, #3598)oc98+zOImus(pathconf, #3611)78FiHequa9U(getlogin_r, #3606)KaK52lYTBIs(execv, #3544)sysctl_nid_postfix: unsupported MIB 1.37(kern.arandom)All 14 get past these four imports.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T15:55:13Z.
Calling on @adriadam10 and @babyhuey for final review and merge when ready:
Both major platforms now have complete title-level verification confirming this PR unblocks titles across the board:
PPSA97510) and SwanStationPS5 (PPSA98510) advance past startup without error.Ready for merge into main!
Imported from boykopovar/AnyPS5. Originally posted by Mouad-Scriptz-0 on 2026-10-11T16:13:04Z.
Reviewed the
pthread_attr_getstackaddrpart, since my #3729 was closed in favour of this PR:Valid(attr) && stack_addrthen(*attr)->stackAddress,EINVALotherwise, is what FreeBSD libthr's_pthread_attr_getstackaddr(lib/libthr/thread/thr_attr.c) does, and theguest_pthread_attradditions cover the same cases mine did (null attribute, destroyed attribute, null output, null default, address set bypthread_attr_setstack), so nothing to add from my side.Title evidence for the export, from #3488: an import audit of the homebrew catalog on
main0f863c10listsDxmIMUQ-wXYas an absent import of 13 titles, always next to the three attribute functions this PR also implements. For XashPS5 1.3, ccleste 1.00, RommPS 1.1.1, ProsperoLight 01.000.090, vkQuake 1.0 and PSBox Cloud Gaming 0.9.5 the fourpthread_attr_*functions are the only absent imports left, so with this PR they load with zero; PSXS5, SwanStationPS5, Ruffle, Porpoise, VLC, RetroArch and XPSemu each lose one of their remaining absent imports. The method and the full table are in #3488.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T22:10:34Z.
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)docs/dev/TechnicalDebt.mdL413docs/dev/TechnicalDebt.mdL413-414Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-12T00:36:31Z.
Windows validation with title evidence (Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,
BUILD_TESTING=ON, full build includinglibs): PR head32466972merged cleanly ontomainbab7b328(plus #4021's guard, since merged).guest_pthread_attr3/3;ctest -j8 -E "^agc_driver_|^video_out_flip"582/584, identical to themainbaseline in the same build directory: the two failures are the knownagc_write_tracking(#4087) andguest_kernel_stack_protect(#4088); conventions andgit diff --checkpass.PSXS5 (PPSA97510 2.2.0) relinked against this build (relinker and libs from the same commit): on this
mainit stops atFAIL: unresolved ELF import e2G+cdEkOmU from libkernel.prx(pthread_attr_getscope); with the PR it passes everypthread_attr_*import, writes 127 log lines including its ownpsxs5.log, and exits after 12.9 s withwhat(): poll: descriptor 6 is not a socket, the stop that #3649/#3644 cover. Six catalog titles sit on this import (third run, #1578), so this PR is the one most worth merging for the catalog.