libScePosixForWebKit: getservbyname is absent (Cloud Play); fix branch ready #3734

Closed
opened 2026-10-11 16:12:13 +00:00 by screamm · 0 comments
screamm commented 2026-10-11 16:12:13 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-11T16:12:13Z.


libScePosixForWebKit does not export getservbyname (NID H1bArJPagV0). Cloud Play (PPSA99600) imports it from that library only (registry index 408, called from the title's own getaddrinfo for non-numeric service names; predicted FAIL: unresolved ELF import H1bArJPagV0 from libScePosixForWebKit.prx once fnmatch (#3545) lands).

Fix branch ready: screamm:feat/posixforwebkit-getservbyname (b1cf370a, one commit on main a11c8f7f). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commit as is.

  • Follows FreeBSD 11.4 lib/libc/net/getservent.c files_servent (8c639945): 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 as FreeBSD's NSS_TLS_HANDLING(servent) keeps it, null with errno untouched when not found, ENOMEM on allocation failure. The guest servent is 32 bytes (name 0, aliases 8, port 16, proto 24), which the title's call site confirms (it reads the port big-endian at offset 16).
  • The table embeds 37 lines of FreeBSD's etc/services at the pin (ftp-data, ftp, ssh, telnet, smtp, domain, tftp, http, pop3, ntp, imap, https, rtsp, submission, imaps, pop3s with all their protocol lines and aliases); none of those names appears earlier in the full file, so each lookup matches the full file's answer. The full 1976-entry file was judged too large; a reviewer may want it anyway. Guest getaddrinfo still uses the host's service database, recorded in TechnicalDebt.
  • New guest_service_database covers http/tcp with aliases, https with a null protocol, domain/udp, alias lookups, the null cases (unknown, wrong protocol, wrong case) and per-thread isolation.

Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs: guest_service_database and guest_resolver 3/3; ctest -j8 -E "^agc_driver_|^video_out_flip" 534/537, the failures being the known windows_exceptions (#3411, fixed by #3415), guest_kernel_sys (#3510) and guest_filesystem (#3518); with main's Resolver.cpp the new test fails; tools/check_conventions.py --base main and git diff --check pass. Not run on Linux.

Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5802807803 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3734). Originally posted by [screamm](https://github.com/screamm) on 2026-10-11T16:12:13Z. --- libScePosixForWebKit does not export `getservbyname` (NID `H1bArJPagV0`). Cloud Play (PPSA99600) imports it from that library only (registry index 408, called from the title's own `getaddrinfo` for non-numeric service names; predicted `FAIL: unresolved ELF import H1bArJPagV0 from libScePosixForWebKit.prx` once `fnmatch` (#3545) lands). **Fix branch ready:** [`screamm:feat/posixforwebkit-getservbyname`](https://github.com/screamm/AnyPS5/tree/feat/posixforwebkit-getservbyname) (`b1cf370a`, one commit on `main` `a11c8f7f`). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commit as is. - Follows FreeBSD 11.4 `lib/libc/net/getservent.c` `files_servent` (`8c639945`): 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 as FreeBSD's `NSS_TLS_HANDLING(servent)` keeps it, null with errno untouched when not found, `ENOMEM` on allocation failure. The guest `servent` is 32 bytes (name 0, aliases 8, port 16, proto 24), which the title's call site confirms (it reads the port big-endian at offset 16). - The table embeds 37 lines of FreeBSD's `etc/services` at the pin (ftp-data, ftp, ssh, telnet, smtp, domain, tftp, http, pop3, ntp, imap, https, rtsp, submission, imaps, pop3s with all their protocol lines and aliases); none of those names appears earlier in the full file, so each lookup matches the full file's answer. The full 1976-entry file was judged too large; a reviewer may want it anyway. Guest `getaddrinfo` still uses the host's service database, recorded in TechnicalDebt. - New `guest_service_database` covers http/tcp with aliases, https with a null protocol, domain/udp, alias lookups, the null cases (unknown, wrong protocol, wrong case) and per-thread isolation. **Tested** on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including `libs`: `guest_service_database` and `guest_resolver` 3/3; `ctest -j8 -E "^agc_driver_|^video_out_flip"` 534/537, the failures being the known `windows_exceptions` (#3411, fixed by #3415), `guest_kernel_sys` (#3510) and `guest_filesystem` (#3518); with `main`'s `Resolver.cpp` the new test fails; `tools/check_conventions.py --base main` and `git diff --check` pass. Not run on Linux. Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#3734
No description provided.