Repository navigation
Conversation
FreeBSD's inet_pton refuses an IPv4 address with a component that has a leading zero, such as "01.2.3.4", and guest_sce_net expects sceNetInetPton to refuse it. macOS's inet_pton accepts it as 1.2.3.4, so sceNetInetPton refuses it there before calling the host. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…et type on macOS FreeBSD's socket fails with EPROTONOSUPPORT when the protocol belongs to another socket type, such as IPPROTO_UDP for SOCK_STREAM, and guest_sce_net expects that error from sceNetSocket. XNU fails with EPROTOTYPE instead. sceNetSocket only passes the stream, datagram and raw types, which XNU supports with protocol 0, so a host EPROTOTYPE there is always a protocol of another type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
@Gonic0 a merge-order note: #9578 changes |
|
Thanks @EagleBearerYS, agreed. I ran the same AI-assisted: yes |
What
guest_sce_netaborts on macOS at two checks where XNU's sockets library differs from FreeBSD's:sceNetInetPton(AF_INET, "01.2.3.4")must return 0 (GuestSceNet.cpp:786). FreeBSD'sinet_ptonrefuses an IPv4 component with a leading zero; macOS's accepts it and returns 1.2.3.4. On macOSsceNetInetPtonnow refuses such a component before calling the host.sceNetSocket(AF_INET, SOCK_STREAM, IPPROTO_UDP)must fail withEPROTONOSUPPORT(GuestSceNet.cpp:151). FreeBSD'ssocketreportsEPROTONOSUPPORTfor a protocol of another socket type; XNU reportsEPROTOTYPE.sceNetSocketonly passes the stream, datagram and raw types, which XNU supports with protocol 0, so on macOS a hostEPROTOTYPEthere becomesEPROTONOSUPPORT.Both changes are inside
#ifdef __APPLE__; Linux and Windows are unchanged.Commits:
sceNetInetPton.EPROTOTYPEmapping insceNetSocket.No debt entry: the guest sees FreeBSD's results.
Precedents: libkernel already follows FreeBSD here on every host. Its
inet_ptonparses with FreeBSD's text rules (#3530), and itssocketreportsEPROTOTYPEonly for a type inet does not have (#7151).sceNetInetPtonandsceNetSocketstill call the host, so this PR only covers the two places where macOS's host differs.Overlap: #8658 carries the same two hunks among its 100 commits. This PR takes them on their own so they can be reviewed and merged separately; whichever lands second drops or rebases them.
Tested
macOS 27.2, Apple M5 Pro, Apple clang 21.0.0, x86-64 build under Rosetta 2, Release.
maindoes not build libSceNet's dependencies on macOS, so the tests ran in a local tree ofmain53a0a27 with the community macOS stack merged, with this branch'sExport.cppchanges applied on top (the same diff as this branch onmaincecb540).inet_pton(AF_INET, "01.2.3.4")returns 1;socket(AF_INET, SOCK_STREAM, IPPROTO_UDP),socket(AF_INET, SOCK_DGRAM, IPPROTO_TCP)andsocket(AF_INET6, SOCK_STREAM, IPPROTO_UDP)fail withEPROTOTYPE(41);socket(AF_INET, SOCK_DGRAM, 99)fails withEPROTONOSUPPORT(43).guest_sce_netfails atGuestSceNet.cpp:786and:787for"01.2.3.4".guest_sce_netfails atGuestSceNet.cpp:151.guest_sce_netfails (checked with a non-abortingRequirethat prints the line), andctest -R '^guest_sce_net$'passes 5 runs of 5.e0a3ccec0(comment):guest_sce_netpasses 5/5 with both blocks and aborts with either one reverted.tools/check_conventions.py --base upstream/mainandgit diff --checkpass.Not built on Linux or Windows; the changes are preprocessed out there.
Checklist
main; no other open PR implements the same functions (see Overlap above: feat: macOS host support (Apple Silicon via Rosetta 2, Vulkan on MoltenVK) #8658)NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code