Two stream send behaviours of XNU differ from FreeBSD and Linux:
- MSG_DONTWAIT does not keep a stream send on a blocking socket from
waiting for buffer space; XNU only skips the wait for the send buffer
lock. A 16 MiB send to a slow peer blocked until the peer went away.
A MSG_DONTWAIT transfer now also passes XNU's MSG_NBIO (0x20000), which
makes one call non-blocking: the send queues what fits and returns that
count, or EAGAIN when nothing fits.
- A blocking stream send that fails after queuing data, for example when
sceNetSocketAbort shuts the socket down, returns only the error, where
Linux returns the bytes queued. A blocking stream send now goes to the
host in sends of 64 KiB and reports the bytes of the sends that
completed when a later one fails, as #8658 does.
The debt entry records the undocumented flag and the bytes that a failing
64 KiB send queued but does not report.
Co-authored-by: iamthehimansh <[email protected]>
sceNetEpollCreate fails with EINVAL for a null name or non-zero flags,
sceNetResolverCreate and sceNetGetMacAddress for non-zero flags, and
sceNetResolverStartNtoa, before any other check, for a negative timeout
or retry count or a flag bit outside 0x10001, as prosper reads the
libSceNet module. The two accepted resolver flag bits are still ignored,
which the debt file now records.
Apply the firmware 13.42 module-probe report in PR #9506: all four DNS calls check initialization first; getters return EINVAL for null outputs or nonzero flags; setters reject flags before reading guest memory. Keep the checked input copy and document EFAULT as host safety, not firmware behavior. Use the current public Net.hpp declarations in the regression.
Rebased onto upstream e7e3e9c198. Ubuntu 24.04, GCC 13.3, Release: actual libc/libkernel/libSceNet libraries and both focused test executables built. guest_sce_net passes. A separate harness linked against those unmodified libraries passes initialization, errno, invalid flags, unreadable-input flag precedence, null clearing and unchanged-output checks. The full guest_net_dns_info test is blocked here: process_vm_readv is denied with EPERM by the execution environment. No full DNS regression pass is claimed. Public-header audit, conventions, test registration and whitespace checks pass.
The resolver still uses host DNS; IPv6 host-server discovery and firmware server-count behavior remain debt. Firmware evidence: https://github.com/boykopovar/AnyPS5/pull/9506#issuecomment-6390574180
AI-assisted: yes
Main's #10706 removes the local declarations at the top of libSceNet's
Export.cpp, where this branch had added __inet_pton and __inet_ntop.
libkernel's Api.hpp, which Export.cpp includes, now declares both, so the
merge takes main's side there.
After sceNetInit, the console's sceNetUsleep prints
"[LIBNET] usleep <count>" to standard output for a negative count
before failing with EINVAL, as a payload measured on firmware 13.60
(#9076). AnyPS5 failed without printing it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>