feat(libc): implement __inet_addr #1972
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1972"
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 babyhuey on 2026-10-09T03:27:05Z.
What
Implements
__inet_addr(7p7kTAJcuGg) in libc on top of__inet_atonfrom #1848, as FreeBSDlib/libc/inet/inet_addr.cdoes: the address from__inet_atonin network byte order, orINADDR_NONE(0xFFFFFFFF) when it rejects the text. Titles import it fromlibSceLibcInternal.Depends on #1848. Until that merges, this branch also contains its commit.
Why
It is a title's next stop on current
main: PPSA19111 XashPS5 stops on it on Linux and Windows.mainf1451396app.elf: symbol lookup error: app.elf: undefined symbol: 7p7kTAJcuGgundefined symbol: -nvxBWa0iDs(gethostname, #1594)FAIL: unresolved ELF import 7p7kTAJcuGg from libSceLibcInternal.prxTested
Linux (Ubuntu 24.04, GCC 13, Release):
guest_stringspasses with--repeat until-fail:3. It now checks__inet_addragainst every invalid input of the__inet_atontest (INADDR_NONE), the dotted, shortened and hexadecimal forms,0.0.0.0and255.255.255.255, by the byte order of the result. The test fails when theINADDR_NONEfallback is removed.check_conventions.pypasses. Windows:StringExtensions.cppcompiles with MinGW-w64 GCC 13 (-Wall -Wextra -fsyntax-only).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T03:35:06Z.
Correction to my earlier note: I verified the pinned FreeBSD
inet_atonsource. On amd64, one-part values above 32 bits are accepted and reduced byhtonl; accumulation wraps inu_long. Therefore4294967296and18446744073709551617should not be asserted asINADDR_NONEfor this FreeBSD-compatible wrapper. Please disregard that requested test change. Sorry for the incorrect note.Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-09T03:42:46Z.
Since you withdrew that request on #1848 after checking FreeBSD
inet_aton(one-part form unchecked,u_longaccumulation wraps),INADDR_NONEwould be wrong here: FreeBSDinet_addrreturns whateverinet_atonaccepted. I added assertions for the FreeBSD results instead, so this wrapper stays tied to #1848's behaviour:4294967296gives0.0.0.0and18446744073709551617gives0.0.0.1(6f564976).Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T12:33:55Z.
PR #2231 is now the canonical, more complete IPv4-helper change. It includes this implementation along with the other parsing/formatting helpers, preserves the original author commits in its history, and adds cross-function round-trip coverage. The exact head has a local Linux full-build result with the documented GCC 12 SaveData workaround, and I requested the upstream Build. Please close this overlapping PR as superseded once the current-head Build on #2231 is reviewed.
Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-09T13:59:06Z.
Leaving #1972 open until a maintainer chooses between the two shapes; I'll close it if #2231 merges.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T17:36:33Z.
I still consider my #2231 the better canonical merge target for this IPv4 helper family: it carries your
__inet_addrcontribution alongside__inet_atonand__inet_ntoa, and adds cross-function round-trip coverage. Your authorship is retained in its commit history.The exact #2231 head
6923a54enow has a Windowsguest_stringspass with no skipped cases. The accompanying 519/519 CTest result came from an aggregate build that needed local fixes to unrelated #1611, #1796, and #1824, so the required unmodified upstream Build is still pending. Please leave #1972 open until a maintainer decides whether to land the cohesive IPv4 change as one PR; I won't treat the aggregate run as the official Build.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T17:42:15Z.
Update after rebase: #2231 is now on current
main(f8c2f072) at863ff49f; its Linuxguest_stringstest passes 1/1 and Conventions passes. The Windows results in its description are from the pre-rebase head6923a54e, not this head, and the exact-head upstream Build is still pending.I still consider #2231 the better canonical target for the IPv4 helper family because it preserves and combines the three implementations and adds cross-function tests. The overlapping PRs remain open until maintainers decide whether this cohesive family should land together; I am not treating the old Windows batch as current-head validation.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T22:09:29Z.
Progress report (
e51d4e1→128d2e8)➖ System libraries: 85.62% (+0.0%, +1 implemented functions)
✅ 1 implemented
__inet_addr_nid_postfixImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T22:12:13Z.
Rebased onto current
main(#1848 is merged, so its commit drops out; no conflicts in your two commits). Checked__inet_addragainst FreeBSDlib/libc/inet/inet_addr.c(inet_atonresult orINADDR_NONE, one-part form wrapping as on amd64); full build and ctest 544/544 pass on Linux, andguest_stringsfails to link without the change. Merging.