GuestSocketOnNonSocket checked ENOTSOCK on a pipe for ten calls and
EBADF only for bind, listen and connect. It now also requires ENOTSOCK
from getpeername, sendto and recvfrom on a pipe, EBADF from accept,
shutdown, getsockname, getpeername, getsockopt, send, recv, sendto and
recvfrom on -1 (shutdown(-1, 3) included: the descriptor is checked
before `how`), and EINVAL from shutdown with how -1 or 3 on a UDP
socket, as FreeBSD's socket calls and shutdown(2) define them.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
bind, listen, accept, connect, shutdown, getsockname, getsockopt, setsockopt, send, recv and the other calls that look up a guest socket answered EBADF for a descriptor that is open but not a socket, for example a pipe end. FreeBSD 11.4's getsock_cap fails these with ENOTSOCK and keeps EBADF for a closed or invalid descriptor.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>