From 364530bef99017afae05dde5af56e5092b6b092c Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 18 Mar 2024 23:31:56 -0700 Subject: [PATCH] compiler: fix wrong detection of rlimit related to #19352 --- src/main.zig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.zig b/src/main.zig index afdfb49c48ed..4609109d15ad 100644 --- a/src/main.zig +++ b/src/main.zig @@ -5985,8 +5985,12 @@ fn parseCodeModel(arg: []const u8) std.builtin.CodeModel { /// garbage collector to run concurrently to zig processes, and to allow multiple /// zig processes to run concurrently with each other, without clobbering each other. fn gimmeMoreOfThoseSweetSweetFileDescriptors() void { + const have_rlimit = switch (builtin.os.tag) { + .windows, .wasi => false, + else => true, + }; + if (!have_rlimit) return; const posix = std.posix; - if (!@hasDecl(posix, "rlimit")) return; var lim = posix.getrlimit(.NOFILE) catch return; // Oh well; we tried. if (comptime builtin.target.isDarwin()) {