feat(libkernel_sys): implement pthread_set_defaultstacksize_np, scePthreadSetDefaultstacksize and scePthreadSetName #9279
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9279"
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 YossiYad on 2026-10-21T17:24:16Z.
What
Three libkernel_sys exports threw. They now follow fpPS4's libkernel (LGPL-2.1):
pthread_set_defaultstacksize_np(size)sets the stack size used byscePthreadAttrInitand byscePthreadCreatewithout attributes. A size of 16384 bytes or less returnsEINVALand keeps the old default.scePthreadSetDefaultstacksizeis the same call returning0x80020016instead.scePthreadSetName(thread, name)returns nothing and renames the thread through the existingpthread_set_name_np, so a null name clears it (fpPS4).The default used to be a
constexprof 1 MiB written twice, inAttr.cppandThread.cpp. It is now one atomic inAttr.cpp, read by both, still starting at 1 MiB. Attributes initialised before a change keep their size.Not measured on a PS5; the debt entry says where the rule comes from.
Tested
Linux (Fedora 44, GCC, Ninja,
-DBUILD_TESTING=ON), based onmaind34da5d694:guest_kernel_sys_thread_defaults(core/libs/tests/GuestKernelSysThreadDefaults.cpp): sizes 0 and 16384 are refused by both forms and leave the default alone, 16385 is taken, a new attribute and a thread created without attributes report the new size, andscePthreadSetNamesets and clears the name read back withscePthreadGetname. It aborts onmain. Each of these changes made it fail: accepting 16384,scePthreadAttrInitorscePthreadCreatekeeping 1 MiB,scePthreadSetNamedoing nothing, and the sce form returning the errno.ctest: 1795 of 1803 pass. The 8 failures fail the same way onmainon this machine and do not use these exports:application_heap_scripting,application_heap_lazy,agc_driver_guest_memory_lifetime,agc_driver_image_array_window_past_layer_limit,agc_driver_tessellationand the threenet_dontwait_blocking_*cases.tools/progress.py --compare: libraries +0.03%, 3 functions implemented, none lost.tools/check_conventions.py --base upstream/mainpasses.tools/pr_overlap.py: no open PR implements these three. #9141 rewritesscePthreadSetconcurrencyright after thescePthreadSetNamestub this removes, so whichever merges second needs a small rebase. #9160 adds lines near the removedDEFAULT_STACK_SIZEinThread.cpp, separated by unchanged lines.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.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-21T17:25:07Z.
Progress report (
99844c7→5cca233)📈 System libraries: 42.13% (+0.03%, +3 implemented functions)
✅ 3 implemented
pthread_set_defaultstacksize_np_nid_postfixscePthreadSetDefaultstacksizescePthreadSetNameImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T17:49:06Z.
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/src/Thread.cppL827-828docs/dev/debt/libkernel_sys.mdL20docs/dev/debt/libkernel_sys.mdL20core/libs/CMakeLists.txtL311, L317docs/dev/debt/libkernel_sys.mdL20core/libs/prx/libkernel_sys/Export.cppL25docs/dev/debt/libkernel_sys.mdL20core/libs/CMakeLists.txtL311, L317core/libs/prx/libkernel_sys/Export.Discovery.cppL2431-2443docs/dev/debt/libkernel_sys.mdL20core/libs/prx/libkernel_sys/Export.cppL25core/libs/prx/libkernel_sys/Export.Discovery.cppL481-490Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libkernel/Pthread/src/Thread.cppcore/libs/CMakeLists.txtcore/libs/prx/libkernel/Pthread/include/Pthread.hppcore/libs/prx/libkernel/Pthread/src/Thread.cppcore/libs/prx/libkernel_sys/Export.cppcore/libs/prx/libkernel_sys/Export.cppcore/libs/CMakeLists.txtcore/libs/prx/libkernel_sys/Export.cppdocs/dev/debt/libkernel_sys.mdcore/libs/prx/libkernel/Pthread/include/Pthread.hppcore/libs/prx/libkernel/Pthread/src/Thread.cppcore/libs/prx/libkernel/Pthread/include/Pthread.hppcore/libs/prx/libkernel/Pthread/src/Thread.cppcore/libs/CMakeLists.txtcore/libs/prx/libkernel/Pthread/src/Thread.cppcore/libs/prx/libkernel_sys/Export.cppcore/libs/CMakeLists.txtcore/libs/prx/libkernel/Pthread/include/Pthread.hppcore/libs/prx/libkernel/Pthread/src/Thread.cppcore/libs/CMakeLists.txtcore/libs/CMakeLists.txtcore/libs/prx/libkernel/Pthread/include/Pthread.hppcore/libs/prx/libkernel/Pthread/src/Thread.cppcore/libs/CMakeLists.txtcore/libs/CMakeLists.txtcore/libs/prx/libkernel_sys/Export.cppImported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T19:43:47Z.
Independent Windows run of this PR (data only).
Environment: Windows 10 Pro 10.0.19045, Ryzen 7 5800X3D, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release, BUILD_TESTING=ON. Merge-tree of the PR head against
mainis clean. I built onlyguest_kernel_sys_thread_defaults_tests;ctest -N -R guest_kernel_sys_thread_defaultslists exactly one test.PR head tested:
5cca233e989d2ef5fc6a26172a0a7c23ba0db4d1.Results (3 runs each):
guest_kernel_sys_thread_defaultspasses 3/3.core/libs/prx/libkernel/Pthread/include/Pthread.hpp,core/libs/prx/libkernel/Pthread/src/Attr.cpp,core/libs/prx/libkernel/Pthread/src/Thread.cpp,core/libs/prx/libkernel_sys/Export.Discovery.cpp,core/libs/prx/libkernel_sys/Export.cppwith the version from the PR's merge base (99844c7eef), then rebuilt. The test fails 3/3 (exit 0xc0000409). I restored the PR's files afterwards.Not run: other platforms, the other tests in the same family, the full repository CTest, and any title or console run.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by YossiYad on 2026-10-22T05:34:50Z.
@oneandonlydean @adriadam10 ready from my side: CI is green, it merges cleanly, and xXPBSXx's Windows run shows the test passing here and failing with
main's library code.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-22T06:02:00Z.
@YossiYad thanks, it's in my review queue now. I'll come back here with the result.