std.posix.accept: handle non-listening socket EINVAL

This commit is contained in:
Nikolay Govorov 2025-11-18 18:15:22 +00:00 committed by mlugg
parent 7d9ad992ab
commit a0289d0cce
2 changed files with 5 additions and 1 deletions

View file

@ -3900,7 +3900,7 @@ fn netAcceptPosix(userdata: ?*anyopaque, listen_fd: net.Socket.Handle) net.Serve
.BADF => |err| return errnoBug(err), // File descriptor used after closed.
.CONNABORTED => return error.ConnectionAborted,
.FAULT => |err| return errnoBug(err),
.INVAL => |err| return errnoBug(err),
.INVAL => return error.SocketNotListening,
.NOTSOCK => |err| return errnoBug(err),
.MFILE => return error.ProcessFdQuotaExceeded,
.NFILE => return error.SystemFdQuotaExceeded,

View file

@ -1333,6 +1333,10 @@ pub const Server = struct {
/// Not enough free memory. This often means that the memory allocation is limited
/// by the socket buffer limits, not by the system memory.
SystemResources,
/// Either `listen` was never called, or `shutdown` was called (possibly while
/// this call was blocking). This allows `shutdown` to be used as a concurrent
/// cancellation mechanism.
SocketNotListening,
/// The network subsystem has failed.
NetworkDown,
/// No connection is already queued and ready to be accepted, and