Skip to content

feat(libScePosixForWebKit): implement gethostbyname - #1805

Closed
ahir061 wants to merge 1 commit into
boykopovar:mainfrom
ahir061:feat/posix-gethostbyname
Closed

ahir061 wants to merge 1 commit into
boykopovar:mainfrom
ahir061:feat/posix-gethostbyname

Conversation

@ahir061

@ahir061 ahir061 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

What

Implements gethostbyname (NID 5T4SHQqzoGo) in libScePosixForWebKit. Partially addresses #1578: EVO-PLAYER-PS5 (PPSA99039), PS5VR (PPSA99177), and Nuvio PS5 (PPSA99997) import this function, which is currently unresolved.

Signature: struct hostent *gethostbyname(const char *name);

Existing getaddrinfo, getnameinfo, freeaddrinfo, and gai_strerror implementations remain unchanged.

Tested

Not built or executed locally. The development machine does not have the required toolchain installed. Compilation and runtime validation are pending through the Linux and Windows Build workflow jobs.

Added regression coverage to guest_resolver for:

  • Guest hostent size and field offsets.
  • Nine valid IPv4 representations, including abbreviated, octal, hexadecimal, single-integer, truncated 32-bit, and trailing-whitespace forms.
  • Sixteen rejected numeric representations, tested directly against the parser without invoking DNS.
  • Empty names, IPv6 literals (::1, ::ffff:127.0.0.1), oversized names, and null pointers.
  • Correct address bytes, canonical names, and NULL-terminated alias and address lists.
  • Repeated calls returning the same thread-local storage with updated contents.
  • Two concurrent threads performing 1,000 lookups each without interfering with one another.
  • Deep-copy behavior using host hostent fixtures containing aliases and multiple addresses.
  • Rejection of malformed resolver results, including incorrect address families, invalid lengths, and missing required fields.

All test inputs are deterministic and avoid external DNS access.

The resolver test target now links libc and configures Windows exception unwinding consistently with the project's existing test patterns.

Verification status:

  • git diff --check passed.
  • Source-level review covered guest ABI compatibility, FreeBSD numeric parsing, memory and exception safety, concurrency, and platform portability.
  • check_conventions.py and check_test_registration.py were reviewed manually but not executed because Python was unavailable.
  • The exported NID was verified against the NID algorithm and aerolib mapping, but not against a compiled PRX.
  • Real hostname resolution, Linux/Windows compilation, CTest execution, and homebrew runtime testing remain pending.

No title was run. Other missing imports tracked in #1578 may still prevent the affected titles from starting.

Overlap: #1637 (arc4random_buf) and #1613 (mkstemp, isatty) modify the same library, while #1128 reformats Resolver.cpp. None implements gethostbyname; a rebase may be necessary depending on merge order.

Checklist

  • Based on current main (4ddbf049 at branch creation); no other open PR implements the same function
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); no silent stubs introduced
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes (Claude Code)

Numeric names follow FreeBSD 11.4 inet_aton and are answered without a
lookup; other names are resolved by the host (Winsock gethostbyname on
Windows, glibc gethostbyname_r on Linux) and copied into a FreeBSD-layout
hostent held in per-thread storage. An empty name, an IPv6 literal or a
name longer than 255 characters fails without a lookup; a null name throws.
h_errno is not set; the gap is recorded in TechnicalDebt.

Refs boykopovar#1578

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

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.

Pull request Conflicting files (lines on main) Same exports Same new files
#1796 core/libs/prx/libScePosixForWebKit/CMakeLists.txt L11
core/libs/prx/libScePosixForWebKit/Resolver.cpp L13
core/libs/tests/GuestResolver.cpp L0, L8, L21-22
gethostbyname_nid_postfix

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

Progress report (4b6ab6b → cfbc522)

➖ System libraries: 84.76% (+0.0%, +1 implemented functions)

✅ 1 implemented
Library Name
libScePosixForWebKit gethostbyname_nid_postfix

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Closing: no log shows a title stopping at gethostbyname on main, and the change hasn't been built or run. Reopen when it's a title's next stop on main, with the log line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants