feat(libScePosixForWebKit): implement getservbyname #3798
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3798"
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-11T16:46:50Z.
What
Carries screamm's
screamm/AnyPS5:feat/posixforwebkit-getservbynamecommit from #3734 unchanged onto currentmain, preserving its author:getservbynamein libScePosixForWebKit after FreeBSD 11.4files_servent: exact-case match on the name or an alias, a null protocol taking the first matching line, the port in network byte order, a per-thread result, null with errno untouched when not found andENOMEMon allocation failure. The guestserventlayout (32 bytes, port at offset 16) is checked at compile time and matches the title's call site.etc/servicesfor the common services (ftp-data, ftp, ssh, telnet, smtp, domain, tftp, http, pop3, ntp, imap, https, rtsp, submission, imaps, pop3s); none of those names appears earlier in the full file, so each lookup gives the full file's answer. The reduced table is recorded in TechnicalDebt.getservbynamefrom this library only, called from its owngetaddrinfofor non-numeric service names, as reported in #3734.The library progress moves from 2903/3383 (85.81%) to 2904/3384 (85.82%). The total rises by one because
getservbynamewas not exported before.Closes #3734.
Tested
Linux (Bazzite 44, GCC 16.2.1, Ninja, Release,
-DBUILD_TESTING=ON), based onmaina11c8f7f:libs, and fullctest: 825 pass, 8 skip, no failures (833 registered tests).guest_service_databasepasses 10 consecutive runs. This is the first Linux run of the commit; the author reported Windows only.tools/check_conventions.py --base upstream/mainandgit diff --checkpass.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T16:48:00Z.
Progress report (
0f2683c→8b9529b)📈 System libraries: 87.83% (+0.01%, +1 implemented functions)
✅ 1 implemented
getservbyname_nid_postfixImported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-11T22:03:42Z.
I checked this PR on both OSes with Cloud Play (PPSA99600, catalog build). With #3545 merged, its next stop on
mainf6203c15is this PR:FAIL: unresolved ELF import H1bArJPagV0 (getservbyname) from libScePosixForWebKit.prxfnmatch, kept both):DisplayWindow(the runner has no display).mainbuilds): it gets pastgetservbyname, then throwssysctl_nid_postfix: unsupported MIB 1.37(kern.arandom).guest_service_databasepasses 5/5 (--repeat until-fail:5) on both. No warnings inGuestResolver.hpp,Resolver.cpporGuestServiceDatabase.cpp.Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-12T00:32:17Z.
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 headcc5f53ebmerged cleanly ontomainbab7b328(#4021's guard applied locally, since merged).guest_service_database3/3;ctest -j8 -E "^agc_driver_|^video_out_flip"583/585, the two failures being the knownagc_write_tracking(#4087) andguest_kernel_stack_protect(#4088); conventions andgit diff --checkpass.Cloud Play (PPSA99600) relinked against this build: before,
FAIL: unresolved ELF import H1bArJPagV0 from libScePosixForWebKit.prx(exit 0xC0000139 after 2.9 s); after, the title loads its assets, fonts, settings and catalog, logsapp http_errno result=22, then stops at 12.3 s withwhat(): sysctl_nid_postfix: unsupported MIB 1.37(kern.arandom, open #3700), with a non-fatalFATAL: UCRT invalid parameterfromcloseon the way (#3923). So this PR removes the title's current stop onmain.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T09:04:51Z.
Two things from the full build (https://github.com/boykopovar/AnyPS5/actions/runs/38213661413):
prx_thread_local_destructors(added by #4029):libScePosixForWebKit.prx: getservbyname_nid_postfix registers a thread_local destructor. On Windows a module's thread_local destructor runs after emulated TLS is gone, so the object inResolver.cpphas to be trivially destructible or not thread_local.docs/dev/TechnicalDebt.mdconflicts withmainnow; please rebase.Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-12T11:49:39Z.
Both points addressed on
screamm:feat/posixforwebkit-getservbyname-v2:c92ebe442is this PR's commit rebased ontomain3d8ffeb2(theTechnicalDebt.mdconflict resolved by keepingmain's reworded Dinkumware bullet and placing the getservbyname bullet above it), and730931b24fix(libScePosixForWebKit): keep the getservbyname result trivially destructiblereplaces thethread_localstd::string/std::vectorresult with a plain struct of fixedcharbuffers and pointer arrays sized by aconstexprscan of the embedded table (static_asserts pin the sizes andstd::is_trivially_destructible_v), so no__cxa_thread_atexitis registered; the guestserventlayout and the per-thread result are unchanged. @YossiYad, replacing this branch with those two commits should be all. Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Release, full build includinglibs:prx_thread_local_destructors(now reporting 124 modules clean),guest_service_database,guest_resolver3/3;ctest -j8 -E "^agc_driver_|^video_out_flip"607/607; conventions andgit diff --checkpass.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T07:39:44Z.
Needs a rebase:
docs/dev/TechnicalDebt.mdhas moved todocs/dev/debt/<library>.md(tools/debt_split.py resolvemoves the entry). The code merges cleanly.Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-13T09:20:16Z.
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): headcc5f53ebmerged ontomain5f426f94(the TechnicalDebt bullet has to move todocs/dev/debt/libScePosixForWebKit.mdnow, or conventions fails with[debt-file]).guest_service_databaseandguest_resolver3/3, butprx_thread_local_destructorsstill fails withlibScePosixForWebKit.prx: getservbyname_nid_postfix registers a thread_local destructor: this head is my first commit only; with730931b2fromscreamm:feat/posixforwebkit-getservbyname-v2cherry-picked on top all three pass 3/3 and the suite is 684/687 (the other failure beingpatched_libraries, broken onmainby #4877, fix #5025). @YossiYad, replacing the branch withc92ebe44+730931b2(plus the debt-file move) resolves both of oneandonlydean's points.Cloud Play (PPSA99600) relinked against this build: on
mainit stops atFAIL: unresolved ELF import H1bArJPagV0 from libScePosixForWebKit.prx; with this PR it runs the whole minute,Cloud Play | FPS: 29.17 (1459)in the window title and[CloudPlay] first Paper UI frame presented/app first_frame result=0indownload0/debug.log(its earlierkern.arandomstop is gone now thatmainhas it).Imported from boykopovar/AnyPS5. Originally posted by YossiYad on 2026-10-13T12:50:39Z.
Replaced the branch with screamm's
c92ebe44+730931b2, rebased onto currentmain(0f2683cb), with the debt entry moved todocs/dev/debt/libScePosixForWebKit.mdviatools/debt_split.py resolve. Thanks @screamm. Linux: build OK,guest_service_database/guest_resolverpass, conventions pass;getservbyname_nid_postfixno longer calls__cxa_thread_atexit.Imported from boykopovar/AnyPS5. Originally posted by p3n1cillin on 2026-10-13T14:10:52Z.
Title run with this PR: Windows 11, MinGW GCC 15.2.0 (WinLibs), Release. Built on
main3faa9cb40merged with this PR and the other open PRs that the catalog titles need (#4377, #4379, #4374, #4383, #3798, #4863, #4105, my #5013/#5061/#5078/#5098/#5009 and the carries #5183/#5186, plus screamm'schrootbranch from #3632); every title converted from its catalog release,eboot.binkept inapp0, 60 s runs.tools/import_audit.pylists no absent import with this PR (onmainit stops loading atH1bArJPagV0,getservbyname), and the title runs the whole 60 s with no exception.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by YossiYad on 2026-10-13T20:00:47Z.
@oneandonlydean both of your points are addressed in the current head (
8b9529b9):prx_thread_local_destructors:730931b2replaces thethread_localstd::string/std::vectorresult with a plain struct of fixedcharbuffers and pointer arrays sized by aconstexprscan of the embedded table (static_asserts pin the sizes,std::is_trivially_destructible_venforces it), sogetservbyname_nid_postfixno longer registers a__cxa_thread_atexitdestructor. The guestserventlayout is unchanged.docs/dev/debt/libScePosixForWebKit.md(moved withtools/debt_split.py resolve), not the oldTechnicalDebt.md.Verified by @screamm's and @p3n1cillin's runs since:
prx_thread_local_destructors,guest_service_databaseandguest_resolverpass, conventions pass, and Cloud Play (PPSA99600), which stops onmainat the unresolvedH1bArJPagV0(getservbyname) import, now runs the full 60 s. Should be good to merge, thanks for the reviews.