feat(libkernel_sys): implement pthread_main_np #9197
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9197"
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 DavidSamir on 2026-10-21T15:04:26Z.
What
Implements
pthread_main_np, whichlibkernel_sys/Export.Discovery.cppdeclared as a stub that threwNotImplemented. It returns 1 on the initial thread and 0 on any other thread.Reference: FreeBSD 11
lib/libthr/thread/thr_main_np.creturns-1if the thread library isn't initialized, elsepthread_equal(pthread_self(), _thr_initial) ? 1 : 0. The library is always initialized here, so the-1arm never applies.IsInitialThread_nid_no_patch()inPthread/src/Thread.cpp.pthread_main_npcalls it.scePthreadMainis not part of this PR: its argument and return types are not recorded anywhere we can cite.Tested
Windows 11, WinLibs GCC 15.2.0, Release,
guest_kernel_sys, extended withpthread_main_npon the initial thread and on astd::thread. Head8b634f5b16, rebased ontomaincecb540a63:main'sExport.Discovery.cppandThread.cppand this branch's test, it aborts withpthread_main_np_nid_postfix not implemented.guest_kernel_sysbefore the rebase.python tools/check_conventions.py --base origin/mainpasses.Merge checks with
git merge-tree: clean againstmain, #7838, #8987, #9097, #9156 and #9171. #7149 conflicts withmainby itself, in files this PR does not change.tools/pr_overlap.pydid not finish on this machine (stopped after 25 and then 55 minutes); the branch was checked against the diffs of all open pull requests on 2026-10-21 instead.Not run on Linux or macOS, and not run with a title. The Linux branch is
gettid() == getpid(), the documented identity of a process's main thread.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-21T15:07:21Z.
Progress report (
cecb540→8b634f5)📈 System libraries: 42.11% (+0.01%, +1 implemented functions)
✅ 1 implemented
pthread_main_np_nid_postfixImported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-21T15:09:30Z.
Closing: #9160 implements pthread_main_np the same way and opened first.
Pull request closed