| ... | @@ -3613,7 +3613,7 @@ pub const ShutdownError = error{ | ... | @@ -3613,7 +3613,7 @@ pub const ShutdownError = error{ |
| 3613 | BlockingOperationInProgress, | 3613 | BlockingOperationInProgress, |
| 3614 | | 3614 | |
| 3615 | /// The network subsystem has failed. | 3615 | /// The network subsystem has failed. |
| 3616 | NetworkSubsystemFailed, | 3616 | NetworkDown, |
| 3617 | | 3617 | |
| 3618 | /// The socket is not connected (connection-oriented sockets only). | 3618 | /// The socket is not connected (connection-oriented sockets only). |
| 3619 | SocketUnconnected, | 3619 | SocketUnconnected, |
| ... | @@ -3635,7 +3635,7 @@ pub fn shutdown(sock: socket_t, how: ShutdownHow) ShutdownError!void { | ... | @@ -3635,7 +3635,7 @@ pub fn shutdown(sock: socket_t, how: ShutdownHow) ShutdownError!void { |
| 3635 | .WSAECONNRESET => return error.ConnectionResetByPeer, | 3635 | .WSAECONNRESET => return error.ConnectionResetByPeer, |
| 3636 | .WSAEINPROGRESS => return error.BlockingOperationInProgress, | 3636 | .WSAEINPROGRESS => return error.BlockingOperationInProgress, |
| 3637 | .WSAEINVAL => unreachable, | 3637 | .WSAEINVAL => unreachable, |
| 3638 | .WSAENETDOWN => return error.NetworkSubsystemFailed, | 3638 | .WSAENETDOWN => return error.NetworkDown, |
| 3639 | .WSAENOTCONN => return error.SocketUnconnected, | 3639 | .WSAENOTCONN => return error.SocketUnconnected, |
| 3640 | .WSAENOTSOCK => unreachable, | 3640 | .WSAENOTSOCK => unreachable, |
| 3641 | .WSANOTINITIALISED => unreachable, | 3641 | .WSANOTINITIALISED => unreachable, |
| ... | @@ -3697,7 +3697,7 @@ pub const BindError = error{ | ... | @@ -3697,7 +3697,7 @@ pub const BindError = error{ |
| 3697 | ReadOnlyFileSystem, | 3697 | ReadOnlyFileSystem, |
| 3698 | | 3698 | |
| 3699 | /// The network subsystem has failed. | 3699 | /// The network subsystem has failed. |
| 3700 | NetworkSubsystemFailed, | 3700 | NetworkDown, |
| 3701 | | 3701 | |
| 3702 | FileDescriptorNotASocket, | 3702 | FileDescriptorNotASocket, |
| 3703 | | 3703 | |
| ... | @@ -3718,7 +3718,7 @@ pub fn bind(sock: socket_t, addr: *const sockaddr, len: socklen_t) BindError!voi | ... | @@ -3718,7 +3718,7 @@ pub fn bind(sock: socket_t, addr: *const sockaddr, len: socklen_t) BindError!voi |
| 3718 | .WSAEFAULT => unreachable, // invalid pointers | 3718 | .WSAEFAULT => unreachable, // invalid pointers |
| 3719 | .WSAEINVAL => return error.AlreadyBound, | 3719 | .WSAEINVAL => return error.AlreadyBound, |
| 3720 | .WSAENOBUFS => return error.SystemResources, | 3720 | .WSAENOBUFS => return error.SystemResources, |
| 3721 | .WSAENETDOWN => return error.NetworkSubsystemFailed, | 3721 | .WSAENETDOWN => return error.NetworkDown, |
| 3722 | else => |err| return windows.unexpectedWSAError(err), | 3722 | else => |err| return windows.unexpectedWSAError(err), |
| 3723 | } | 3723 | } |
| 3724 | unreachable; | 3724 | unreachable; |
| ... | @@ -3763,7 +3763,7 @@ pub const ListenError = error{ | ... | @@ -3763,7 +3763,7 @@ pub const ListenError = error{ |
| 3763 | OperationNotSupported, | 3763 | OperationNotSupported, |
| 3764 | | 3764 | |
| 3765 | /// The network subsystem has failed. | 3765 | /// The network subsystem has failed. |
| 3766 | NetworkSubsystemFailed, | 3766 | NetworkDown, |
| 3767 | | 3767 | |
| 3768 | /// Ran out of system resources | 3768 | /// Ran out of system resources |
| 3769 | /// On Windows it can either run out of socket descriptors or buffer space | 3769 | /// On Windows it can either run out of socket descriptors or buffer space |
| ... | @@ -3782,7 +3782,7 @@ pub fn listen(sock: socket_t, backlog: u31) ListenError!void { | ... | @@ -3782,7 +3782,7 @@ pub fn listen(sock: socket_t, backlog: u31) ListenError!void { |
| 3782 | if (rc == windows.ws2_32.SOCKET_ERROR) { | 3782 | if (rc == windows.ws2_32.SOCKET_ERROR) { |
| 3783 | switch (windows.ws2_32.WSAGetLastError()) { | 3783 | switch (windows.ws2_32.WSAGetLastError()) { |
| 3784 | .WSANOTINITIALISED => unreachable, // not initialized WSA | 3784 | .WSANOTINITIALISED => unreachable, // not initialized WSA |
| 3785 | .WSAENETDOWN => return error.NetworkSubsystemFailed, | 3785 | .WSAENETDOWN => return error.NetworkDown, |
| 3786 | .WSAEADDRINUSE => return error.AddressInUse, | 3786 | .WSAEADDRINUSE => return error.AddressInUse, |
| 3787 | .WSAEISCONN => return error.AlreadyConnected, | 3787 | .WSAEISCONN => return error.AlreadyConnected, |
| 3788 | .WSAEINVAL => return error.SocketNotBound, | 3788 | .WSAEINVAL => return error.SocketNotBound, |
| ... | @@ -3840,7 +3840,7 @@ pub const AcceptError = error{ | ... | @@ -3840,7 +3840,7 @@ pub const AcceptError = error{ |
| 3840 | ConnectionResetByPeer, | 3840 | ConnectionResetByPeer, |
| 3841 | | 3841 | |
| 3842 | /// The network subsystem has failed. | 3842 | /// The network subsystem has failed. |
| 3843 | NetworkSubsystemFailed, | 3843 | NetworkDown, |
| 3844 | | 3844 | |
| 3845 | /// The referenced socket is not a type that supports connection-oriented service. | 3845 | /// The referenced socket is not a type that supports connection-oriented service. |
| 3846 | OperationNotSupported, | 3846 | OperationNotSupported, |
| ... | @@ -3893,7 +3893,7 @@ pub fn accept( | ... | @@ -3893,7 +3893,7 @@ pub fn accept( |
| 3893 | .WSAENOTSOCK => return error.FileDescriptorNotASocket, | 3893 | .WSAENOTSOCK => return error.FileDescriptorNotASocket, |
| 3894 | .WSAEINVAL => return error.SocketNotListening, | 3894 | .WSAEINVAL => return error.SocketNotListening, |
| 3895 | .WSAEMFILE => return error.ProcessFdQuotaExceeded, | 3895 | .WSAEMFILE => return error.ProcessFdQuotaExceeded, |
| 3896 | .WSAENETDOWN => return error.NetworkSubsystemFailed, | 3896 | .WSAENETDOWN => return error.NetworkDown, |
| 3897 | .WSAENOBUFS => return error.FileDescriptorNotASocket, | 3897 | .WSAENOBUFS => return error.FileDescriptorNotASocket, |
| 3898 | .WSAEOPNOTSUPP => return error.OperationNotSupported, | 3898 | .WSAEOPNOTSUPP => return error.OperationNotSupported, |
| 3899 | .WSAEWOULDBLOCK => return error.WouldBlock, | 3899 | .WSAEWOULDBLOCK => return error.WouldBlock, |
| ... | @@ -3964,7 +3964,7 @@ fn setSockFlags(sock: socket_t, flags: u32) !void { | ... | @@ -3964,7 +3964,7 @@ fn setSockFlags(sock: socket_t, flags: u32) !void { |
| 3964 | if (windows.ws2_32.ioctlsocket(sock, windows.ws2_32.FIONBIO, &mode) == windows.ws2_32.SOCKET_ERROR) { | 3964 | if (windows.ws2_32.ioctlsocket(sock, windows.ws2_32.FIONBIO, &mode) == windows.ws2_32.SOCKET_ERROR) { |
| 3965 | switch (windows.ws2_32.WSAGetLastError()) { | 3965 | switch (windows.ws2_32.WSAGetLastError()) { |
| 3966 | .WSANOTINITIALISED => unreachable, | 3966 | .WSANOTINITIALISED => unreachable, |
| 3967 | .WSAENETDOWN => return error.NetworkSubsystemFailed, | 3967 | .WSAENETDOWN => return error.NetworkDown, |
| 3968 | .WSAENOTSOCK => return error.FileDescriptorNotASocket, | 3968 | .WSAENOTSOCK => return error.FileDescriptorNotASocket, |
| 3969 | // TODO: handle more errors | 3969 | // TODO: handle more errors |
| 3970 | else => |err| return windows.unexpectedWSAError(err), | 3970 | else => |err| return windows.unexpectedWSAError(err), |
| ... | @@ -4105,7 +4105,7 @@ pub const GetSockNameError = error{ | ... | @@ -4105,7 +4105,7 @@ pub const GetSockNameError = error{ |
| 4105 | SystemResources, | 4105 | SystemResources, |
| 4106 | | 4106 | |
| 4107 | /// The network subsystem has failed. | 4107 | /// The network subsystem has failed. |
| 4108 | NetworkSubsystemFailed, | 4108 | NetworkDown, |
| 4109 | | 4109 | |
| 4110 | /// Socket hasn't been bound yet | 4110 | /// Socket hasn't been bound yet |
| 4111 | SocketNotBound, | 4111 | SocketNotBound, |
| ... | @@ -4119,7 +4119,7 @@ pub fn getsockname(sock: socket_t, addr: *sockaddr, addrlen: *socklen_t) GetSock | ... | @@ -4119,7 +4119,7 @@ pub fn getsockname(sock: socket_t, addr: *sockaddr, addrlen: *socklen_t) GetSock |
| 4119 | if (rc == windows.ws2_32.SOCKET_ERROR) { | 4119 | if (rc == windows.ws2_32.SOCKET_ERROR) { |
| 4120 | switch (windows.ws2_32.WSAGetLastError()) { | 4120 | switch (windows.ws2_32.WSAGetLastError()) { |
| 4121 | .WSANOTINITIALISED => unreachable, | 4121 | .WSANOTINITIALISED => unreachable, |
| 4122 | .WSAENETDOWN => return error.NetworkSubsystemFailed, | 4122 | .WSAENETDOWN => return error.NetworkDown, |
| 4123 | .WSAEFAULT => unreachable, // addr or addrlen have invalid pointers or addrlen points to an incorrect value | 4123 | .WSAEFAULT => unreachable, // addr or addrlen have invalid pointers or addrlen points to an incorrect value |
| 4124 | .WSAENOTSOCK => return error.FileDescriptorNotASocket, | 4124 | .WSAENOTSOCK => return error.FileDescriptorNotASocket, |
| 4125 | .WSAEINVAL => return error.SocketNotBound, | 4125 | .WSAEINVAL => return error.SocketNotBound, |
| ... | @@ -4148,7 +4148,7 @@ pub fn getpeername(sock: socket_t, addr: *sockaddr, addrlen: *socklen_t) GetSock | ... | @@ -4148,7 +4148,7 @@ pub fn getpeername(sock: socket_t, addr: *sockaddr, addrlen: *socklen_t) GetSock |
| 4148 | if (rc == windows.ws2_32.SOCKET_ERROR) { | 4148 | if (rc == windows.ws2_32.SOCKET_ERROR) { |
| 4149 | switch (windows.ws2_32.WSAGetLastError()) { | 4149 | switch (windows.ws2_32.WSAGetLastError()) { |
| 4150 | .WSANOTINITIALISED => unreachable, | 4150 | .WSANOTINITIALISED => unreachable, |
| 4151 | .WSAENETDOWN => return error.NetworkSubsystemFailed, | 4151 | .WSAENETDOWN => return error.NetworkDown, |
| 4152 | .WSAEFAULT => unreachable, // addr or addrlen have invalid pointers or addrlen points to an incorrect value | 4152 | .WSAEFAULT => unreachable, // addr or addrlen have invalid pointers or addrlen points to an incorrect value |
| 4153 | .WSAENOTSOCK => return error.FileDescriptorNotASocket, | 4153 | .WSAENOTSOCK => return error.FileDescriptorNotASocket, |
| 4154 | .WSAEINVAL => return error.SocketNotBound, | 4154 | .WSAEINVAL => return error.SocketNotBound, |
| ... | @@ -6057,7 +6057,7 @@ pub const SendError = error{ | ... | @@ -6057,7 +6057,7 @@ pub const SendError = error{ |
| 6057 | NetworkUnreachable, | 6057 | NetworkUnreachable, |
| 6058 | | 6058 | |
| 6059 | /// The local network interface used to reach the destination is down. | 6059 | /// The local network interface used to reach the destination is down. |
| 6060 | NetworkSubsystemFailed, | 6060 | NetworkDown, |
| 6061 | | 6061 | |
| 6062 | /// The destination address is not listening. | 6062 | /// The destination address is not listening. |
| 6063 | ConnectionRefused, | 6063 | ConnectionRefused, |
| ... | @@ -6106,7 +6106,7 @@ pub fn sendmsg( | ... | @@ -6106,7 +6106,7 @@ pub fn sendmsg( |
| 6106 | .WSAEHOSTUNREACH => return error.NetworkUnreachable, | 6106 | .WSAEHOSTUNREACH => return error.NetworkUnreachable, |
| 6107 | // TODO: WSAEINPROGRESS, WSAEINTR | 6107 | // TODO: WSAEINPROGRESS, WSAEINTR |
| 6108 | .WSAEINVAL => unreachable, | 6108 | .WSAEINVAL => unreachable, |
| 6109 | .WSAENETDOWN => return error.NetworkSubsystemFailed, | 6109 | .WSAENETDOWN => return error.NetworkDown, |
| 6110 | .WSAENETRESET => return error.ConnectionResetByPeer, | 6110 | .WSAENETRESET => return error.ConnectionResetByPeer, |
| 6111 | .WSAENETUNREACH => return error.NetworkUnreachable, | 6111 | .WSAENETUNREACH => return error.NetworkUnreachable, |
| 6112 | .WSAENOTCONN => return error.SocketUnconnected, | 6112 | .WSAENOTCONN => return error.SocketUnconnected, |
| ... | @@ -6146,7 +6146,7 @@ pub fn sendmsg( | ... | @@ -6146,7 +6146,7 @@ pub fn sendmsg( |
| 6146 | .HOSTUNREACH => return error.NetworkUnreachable, | 6146 | .HOSTUNREACH => return error.NetworkUnreachable, |
| 6147 | .NETUNREACH => return error.NetworkUnreachable, | 6147 | .NETUNREACH => return error.NetworkUnreachable, |
| 6148 | .NOTCONN => return error.SocketUnconnected, | 6148 | .NOTCONN => return error.SocketUnconnected, |
| 6149 | .NETDOWN => return error.NetworkSubsystemFailed, | 6149 | .NETDOWN => return error.NetworkDown, |
| 6150 | else => |err| return unexpectedErrno(err), | 6150 | else => |err| return unexpectedErrno(err), |
| 6151 | } | 6151 | } |
| 6152 | } | 6152 | } |
| ... | @@ -6209,7 +6209,7 @@ pub fn sendto( | ... | @@ -6209,7 +6209,7 @@ pub fn sendto( |
| 6209 | .WSAEHOSTUNREACH => return error.NetworkUnreachable, | 6209 | .WSAEHOSTUNREACH => return error.NetworkUnreachable, |
| 6210 | // TODO: WSAEINPROGRESS, WSAEINTR | 6210 | // TODO: WSAEINPROGRESS, WSAEINTR |
| 6211 | .WSAEINVAL => unreachable, | 6211 | .WSAEINVAL => unreachable, |
| 6212 | .WSAENETDOWN => return error.NetworkSubsystemFailed, | 6212 | .WSAENETDOWN => return error.NetworkDown, |
| 6213 | .WSAENETRESET => return error.ConnectionResetByPeer, | 6213 | .WSAENETRESET => return error.ConnectionResetByPeer, |
| 6214 | .WSAENETUNREACH => return error.NetworkUnreachable, | 6214 | .WSAENETUNREACH => return error.NetworkUnreachable, |
| 6215 | .WSAENOTCONN => return error.SocketUnconnected, | 6215 | .WSAENOTCONN => return error.SocketUnconnected, |
| ... | @@ -6251,7 +6251,7 @@ pub fn sendto( | ... | @@ -6251,7 +6251,7 @@ pub fn sendto( |
| 6251 | .HOSTUNREACH => return error.NetworkUnreachable, | 6251 | .HOSTUNREACH => return error.NetworkUnreachable, |
| 6252 | .NETUNREACH => return error.NetworkUnreachable, | 6252 | .NETUNREACH => return error.NetworkUnreachable, |
| 6253 | .NOTCONN => return error.SocketUnconnected, | 6253 | .NOTCONN => return error.SocketUnconnected, |
| 6254 | .NETDOWN => return error.NetworkSubsystemFailed, | 6254 | .NETDOWN => return error.NetworkDown, |
| 6255 | else => |err| return unexpectedErrno(err), | 6255 | else => |err| return unexpectedErrno(err), |
| 6256 | } | 6256 | } |
| 6257 | } | 6257 | } |
| ... | @@ -6390,7 +6390,7 @@ pub fn copy_file_range(fd_in: fd_t, off_in: u64, fd_out: fd_t, off_out: u64, len | ... | @@ -6390,7 +6390,7 @@ pub fn copy_file_range(fd_in: fd_t, off_in: u64, fd_out: fd_t, off_out: u64, len |
| 6390 | | 6390 | |
| 6391 | pub const PollError = error{ | 6391 | pub const PollError = error{ |
| 6392 | /// The network subsystem has failed. | 6392 | /// The network subsystem has failed. |
| 6393 | NetworkSubsystemFailed, | 6393 | NetworkDown, |
| 6394 | | 6394 | |
| 6395 | /// The kernel had no space to allocate file descriptor tables. | 6395 | /// The kernel had no space to allocate file descriptor tables. |
| 6396 | SystemResources, | 6396 | SystemResources, |
| ... | @@ -6401,7 +6401,7 @@ pub fn poll(fds: []pollfd, timeout: i32) PollError!usize { | ... | @@ -6401,7 +6401,7 @@ pub fn poll(fds: []pollfd, timeout: i32) PollError!usize { |
| 6401 | switch (windows.poll(fds.ptr, @intCast(fds.len), timeout)) { | 6401 | switch (windows.poll(fds.ptr, @intCast(fds.len), timeout)) { |
| 6402 | windows.ws2_32.SOCKET_ERROR => switch (windows.ws2_32.WSAGetLastError()) { | 6402 | windows.ws2_32.SOCKET_ERROR => switch (windows.ws2_32.WSAGetLastError()) { |
| 6403 | .WSANOTINITIALISED => unreachable, | 6403 | .WSANOTINITIALISED => unreachable, |
| 6404 | .WSAENETDOWN => return error.NetworkSubsystemFailed, | 6404 | .WSAENETDOWN => return error.NetworkDown, |
| 6405 | .WSAENOBUFS => return error.SystemResources, | 6405 | .WSAENOBUFS => return error.SystemResources, |
| 6406 | // TODO: handle more errors | 6406 | // TODO: handle more errors |
| 6407 | else => |err| return windows.unexpectedWSAError(err), | 6407 | else => |err| return windows.unexpectedWSAError(err), |
| ... | @@ -6473,7 +6473,7 @@ pub const RecvFromError = error{ | ... | @@ -6473,7 +6473,7 @@ pub const RecvFromError = error{ |
| 6473 | MessageTooBig, | 6473 | MessageTooBig, |
| 6474 | | 6474 | |
| 6475 | /// The network subsystem has failed. | 6475 | /// The network subsystem has failed. |
| 6476 | NetworkSubsystemFailed, | 6476 | NetworkDown, |
| 6477 | | 6477 | |
| 6478 | /// The socket is not connected (connection-oriented sockets only). | 6478 | /// The socket is not connected (connection-oriented sockets only). |
| 6479 | SocketUnconnected, | 6479 | SocketUnconnected, |
| ... | @@ -6504,7 +6504,7 @@ pub fn recvfrom( | ... | @@ -6504,7 +6504,7 @@ pub fn recvfrom( |
| 6504 | .WSAECONNRESET => return error.ConnectionResetByPeer, | 6504 | .WSAECONNRESET => return error.ConnectionResetByPeer, |
| 6505 | .WSAEINVAL => return error.SocketNotBound, | 6505 | .WSAEINVAL => return error.SocketNotBound, |
| 6506 | .WSAEMSGSIZE => return error.MessageTooBig, | 6506 | .WSAEMSGSIZE => return error.MessageTooBig, |
| 6507 | .WSAENETDOWN => return error.NetworkSubsystemFailed, | 6507 | .WSAENETDOWN => return error.NetworkDown, |
| 6508 | .WSAENOTCONN => return error.SocketUnconnected, | 6508 | .WSAENOTCONN => return error.SocketUnconnected, |
| 6509 | .WSAEWOULDBLOCK => return error.WouldBlock, | 6509 | .WSAEWOULDBLOCK => return error.WouldBlock, |
| 6510 | .WSAETIMEDOUT => return error.ConnectionTimedOut, | 6510 | .WSAETIMEDOUT => return error.ConnectionTimedOut, |
| ... | @@ -6578,7 +6578,7 @@ pub fn recvmsg( | ... | @@ -6578,7 +6578,7 @@ pub fn recvmsg( |
| 6578 | .PIPE => return error.BrokenPipe, | 6578 | .PIPE => return error.BrokenPipe, |
| 6579 | .OPNOTSUPP => unreachable, // Some bit in the flags argument is inappropriate for the socket type. | 6579 | .OPNOTSUPP => unreachable, // Some bit in the flags argument is inappropriate for the socket type. |
| 6580 | .CONNRESET => return error.ConnectionResetByPeer, | 6580 | .CONNRESET => return error.ConnectionResetByPeer, |
| 6581 | .NETDOWN => return error.NetworkSubsystemFailed, | 6581 | .NETDOWN => return error.NetworkDown, |
| 6582 | else => |err| return unexpectedErrno(err), | 6582 | else => |err| return unexpectedErrno(err), |
| 6583 | } | 6583 | } |
| 6584 | } | 6584 | } |
| ... | @@ -6601,7 +6601,7 @@ pub const SetSockOptError = error{ | ... | @@ -6601,7 +6601,7 @@ pub const SetSockOptError = error{ |
| 6601 | PermissionDenied, | 6601 | PermissionDenied, |
| 6602 | | 6602 | |
| 6603 | OperationNotSupported, | 6603 | OperationNotSupported, |
| 6604 | NetworkSubsystemFailed, | 6604 | NetworkDown, |
| 6605 | FileDescriptorNotASocket, | 6605 | FileDescriptorNotASocket, |
| 6606 | SocketNotBound, | 6606 | SocketNotBound, |
| 6607 | NoDevice, | 6607 | NoDevice, |
| ... | @@ -6614,7 +6614,7 @@ pub fn setsockopt(fd: socket_t, level: i32, optname: u32, opt: []const u8) SetSo | ... | @@ -6614,7 +6614,7 @@ pub fn setsockopt(fd: socket_t, level: i32, optname: u32, opt: []const u8) SetSo |
| 6614 | if (rc == windows.ws2_32.SOCKET_ERROR) { | 6614 | if (rc == windows.ws2_32.SOCKET_ERROR) { |
| 6615 | switch (windows.ws2_32.WSAGetLastError()) { | 6615 | switch (windows.ws2_32.WSAGetLastError()) { |
| 6616 | .WSANOTINITIALISED => unreachable, | 6616 | .WSANOTINITIALISED => unreachable, |
| 6617 | .WSAENETDOWN => return error.NetworkSubsystemFailed, | 6617 | .WSAENETDOWN => return error.NetworkDown, |
| 6618 | .WSAEFAULT => unreachable, | 6618 | .WSAEFAULT => unreachable, |
| 6619 | .WSAENOTSOCK => return error.FileDescriptorNotASocket, | 6619 | .WSAENOTSOCK => return error.FileDescriptorNotASocket, |
| 6620 | .WSAEINVAL => return error.SocketNotBound, | 6620 | .WSAEINVAL => return error.SocketNotBound, |