std.os: add INVALID_SOCKET (#12081)

This constant returns an invalid `socket_t` that can be used as a sentinel
value.
This commit is contained in:
yyny 2022-08-24 02:44:42 +02:00 committed by GitHub
parent d852894dcf
commit 0f01e812ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -235,6 +235,7 @@ pub const RelativePathWasi = struct {
};
pub const socket_t = if (builtin.os.tag == .windows) windows.ws2_32.SOCKET else fd_t;
pub const INVALID_SOCKET = if (builtin.os.tag == .windows) windows.ws2_32.INVALID_SOCKET else @as(socket_t, -1);
/// See also `getenv`. Populated by startup code before main().
/// TODO this is a footgun because the value will be undefined when using `zig build-lib`.