mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-12-05 17:11:09 +00:00
recv and recvfrom answer a zero-length receive on a stream socket without the host: 0 when it is connected, ENOTCONN when it is not, as FreeBSD 11.4's soreceive_generic does when nothing is queued. recvmsg asked the host instead, after waiting for the socket to be readable, so on an empty connected socket it failed with EAGAIN under MSG_DONTWAIT or a non-blocking socket and blocked otherwise, and an unconnected socket did not get ENOTCONN. recvmsg now takes the same answer before waiting, except on a Unix stream socket with a control buffer, where FreeBSD delivers queued control messages and the host still answers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
904 B
904 B
libkernel
change [recv and recvfrom]
- recv, recvfrom and recvmsg (libkernel) answer some cases without the host. A zero-length receive on a stream socket returns 0, or
ENOTCONNwhen it is not connected (L1566-L1578), as on a PS5 (firmware 13.60). On an empty datagram socket it returns 0 at once; the console was measured only withMSG_DONTWAIT, and the blocking case follows FreeBSD 11.4'ssoreceive_dgram, which returns 0 before waiting. A zero-lengthrecvmsgon a Unix stream socket with a control buffer still asks the host, as FreeBSD then delivers queued control messages, and the answers ignore a pending socket error, which FreeBSD returns first. A datagram another thread takes after the check makes a zero-length receive wait