| ... | @@ -2156,6 +2156,9 @@ pub const SocketError = error{ | ... | @@ -2156,6 +2156,9 @@ pub const SocketError = error{ |
| 2156 | | 2156 | |
| 2157 | /// The protocol type or the specified protocol is not supported within this domain. | 2157 | /// The protocol type or the specified protocol is not supported within this domain. |
| 2158 | ProtocolNotSupported, | 2158 | ProtocolNotSupported, |
| | 2159 | |
| | 2160 | /// The socket type is not supported by the protocol. |
| | 2161 | SocketTypeNotSupported, |
| 2159 | } || UnexpectedError; | 2162 | } || UnexpectedError; |
| 2160 | | 2163 | |
| 2161 | pub fn socket(domain: u32, socket_type: u32, protocol: u32) SocketError!fd_t { | 2164 | pub fn socket(domain: u32, socket_type: u32, protocol: u32) SocketError!fd_t { |
| ... | @@ -2164,7 +2167,7 @@ pub fn socket(domain: u32, socket_type: u32, protocol: u32) SocketError!fd_t { | ... | @@ -2164,7 +2167,7 @@ pub fn socket(domain: u32, socket_type: u32, protocol: u32) SocketError!fd_t { |
| 2164 | socket_type & ~@as(u32, SOCK_NONBLOCK | SOCK_CLOEXEC) | 2167 | socket_type & ~@as(u32, SOCK_NONBLOCK | SOCK_CLOEXEC) |
| 2165 | else | 2168 | else |
| 2166 | socket_type; | 2169 | socket_type; |
| 2167 | const rc = system.socket(domain, socket_type, protocol); | 2170 | const rc = system.socket(domain, filtered_sock_type, protocol); |
| 2168 | switch (errno(rc)) { | 2171 | switch (errno(rc)) { |
| 2169 | 0 => { | 2172 | 0 => { |
| 2170 | const fd = @intCast(fd_t, rc); | 2173 | const fd = @intCast(fd_t, rc); |
| ... | @@ -2181,6 +2184,7 @@ pub fn socket(domain: u32, socket_type: u32, protocol: u32) SocketError!fd_t { | ... | @@ -2181,6 +2184,7 @@ pub fn socket(domain: u32, socket_type: u32, protocol: u32) SocketError!fd_t { |
| 2181 | ENOBUFS => return error.SystemResources, | 2184 | ENOBUFS => return error.SystemResources, |
| 2182 | ENOMEM => return error.SystemResources, | 2185 | ENOMEM => return error.SystemResources, |
| 2183 | EPROTONOSUPPORT => return error.ProtocolNotSupported, | 2186 | EPROTONOSUPPORT => return error.ProtocolNotSupported, |
| | 2187 | EPROTOTYPE => return error.SocketTypeNotSupported, |
| 2184 | else => |err| return unexpectedErrno(err), | 2188 | else => |err| return unexpectedErrno(err), |
| 2185 | } | 2189 | } |
| 2186 | } | 2190 | } |
| ... | @@ -2290,6 +2294,10 @@ pub const AcceptError = error{ | ... | @@ -2290,6 +2294,10 @@ pub const AcceptError = error{ |
| 2290 | /// This error occurs when no global event loop is configured, | 2294 | /// This error occurs when no global event loop is configured, |
| 2291 | /// and accepting from the socket would block. | 2295 | /// and accepting from the socket would block. |
| 2292 | WouldBlock, | 2296 | WouldBlock, |
| | 2297 | |
| | 2298 | /// Permission to create a socket of the specified type and/or |
| | 2299 | /// protocol is denied. |
| | 2300 | PermissionDenied, |
| 2293 | } || UnexpectedError; | 2301 | } || UnexpectedError; |
| 2294 | | 2302 | |
| 2295 | /// Accept a connection on a socket. | 2303 | /// Accept a connection on a socket. |