commit 0f01e812ff054ea83661272bf0a96af228f2ffe3 (tree)
parent d852894dcf6143ff76575245f092d9e26b0e8fa6
Author: yyny <6576327+yyny@users.noreply.github.com>
Date: Wed, 24 Aug 2022 02:44:42 +0200
std.os: add INVALID_SOCKET (#12081)
This constant returns an invalid `socket_t` that can be used as a sentinel
value.
Diffstat:
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/lib/std/os.zig b/lib/std/os.zig
@@ -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`.