feat(posix): implement gethostbyname #1796
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1796"
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 Mouhand-Kaddo on 2026-10-08T19:24:29Z.
What
Implements
gethostbynameinlibScePosixForWebKit, one of EVO-PLAYER-PS5's missing imports reported in #1578.Parses numeric IPv4 addresses with FreeBSD semantics before native hostname lookup. Supports decimal, octal and hexadecimal forms, one through four components, trailing whitespace and FreeBSD 64-bit accumulation. For example,
0x7f.1resolves to127.0.0.1. Copies the name, aliases and address list into per-thread storage with the guesthostentlayout. Linux uses reentrant lookup. Windows converts its 16-bit host fields into guest 32-bit fields. Failures updatesceNetErrnoLoc, the error location used by the public SDK's__h_errno. A successful numeric lookup clears that error.The ABI and SDK error location follow SDK v0.43 netdb.h, SDK netdb.c, and FreeBSD 11 netdb.h. Numeric parsing and success errors follow FreeBSD 11.4 inet_aton and fakeaddr. Exact PS5 semantics remain unverified and are recorded in TechnicalDebt. Windows conversion follows Microsoft HOSTENT.
Tested
undefined reference to gethostbyname_nid_postfix.guest_resolverandguest_sce_netpass. Checks cover numeric address bytes, guest field widths, names, aliases, address lists, per-thread result lifetime, and the SDK error location.5T4SHQqzoGo: numeric lookup and shared error reporting pass.0x7f.1regression check failed before the compatibility fix and passes after it. Sixteen numeric fixtures cover shorthand, octal, hexadecimal, whitespace, wrapping and component boundaries.inet_atonreference.hostentlayout, numeric lookup and error-slot checks. It uses the SDK's actual__h_errnofunction. SDK tooling remains outside the repository.a1e2781f. Linking libc and applying configure_windows_unwind fixes the build. guest_resolver, guest_sce_net and windows_exceptions pass (3/3); the resolver executable has the required .ehfram section.Checklist
mainImported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T15:44:50Z.
Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. I first hit this with
44964a1bin a batch build of PRs with no Windows run, then rechecked the current heada1e2781falone onmaind70b8998.guest_resolver_testsdoesn't link on Windows:On MinGW,
core/libsis built with-fno-asynchronous-unwind-tables, and the personality routine for that unwinding comes fromlibc.prx. The new test code needs it, but the test only linkslibScePosixForWebKitandlibSceNet. Linkinglibcand addingconfigure_windows_unwind, asguest_sce_net_testsdoes, fixes it:With that change,
guest_resolverpasses 3 of 3 ona1e2781f. In the batch build with44964a1b, the full suite passed too (519 of 519).🤖 Addressed by Claude Code
Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-09T16:08:29Z.
Fixed in
c80bea9b.I reproduced the reported failure on the PR head
a1e2781fwith a native Windows Release build: guest_resolver_tests failed to link with undefined reference to __gxx_personality_v0. The fix links the test to libc and adds configure_windows_unwind, matching guest_sce_net_tests.Tested on Windows 11 Pro (build 26300), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release:
Also tested the same patch in WSL2 Arch Linux, GCC 15.2.1, Release:
Repository conventions and whitespace checks pass. These were targeted regression tests; the full suite, console behavior and EVO-PLAYER startup were not tested in these runs.
The PR testing notes have been updated. AI-assisted fix and validation.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T22:02:12Z.
Checked on Linux (GCC, merged onto current main):
guest_resolverpasses, and the new test fails to build without the change. Diff matches the description, TechnicalDebt line is in place, and the Windows link fix matchesguest_sce_net_tests(also confirmed by @popcoder565's Windows run); merging.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T22:14:34Z.
Progress report (
d70b899→c80bea9)📈 System libraries: 84.7% (+0.01%, +1 implemented functions)
✅ 1 implemented
gethostbyname_nid_postfix