From 86bd972d226d7d8e14f7c2e28fa9cc484d94e56b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 22 Dec 2023 08:58:31 -0800 Subject: [PATCH] macos: do not change nofile rlimit max Fixes #1146 I can't remember why we did this before. The comment in question makes sense if we were trying to set cur to infinity but doesn't make sense to me why we'd change max. Removing this doesn't seem to cause any issues so lets give it a shot. --- src/os/file.zig | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/os/file.zig b/src/os/file.zig index fba9f9289..ee27addb0 100644 --- a/src/os/file.zig +++ b/src/os/file.zig @@ -14,14 +14,6 @@ pub fn fixMaxFiles() void { log.warn("failed to query file handle limit, may limit max windows", .{}); return; // Oh well; we tried. }; - if (comptime builtin.target.isDarwin()) { - // On Darwin, `NOFILE` is bounded by a hardcoded value `OPEN_MAX`. - // According to the man pages for setrlimit(): - // setrlimit() now returns with errno set to EINVAL in places that historically succeeded. - // It no longer accepts "rlim_cur = RLIM.INFINITY" for RLIM.NOFILE. - // Use "rlim_cur = min(OPEN_MAX, rlim_max)". - lim.max = @min(std.os.darwin.OPEN_MAX, lim.max); - } // If we're already at the max, we're done. if (lim.cur >= lim.max) {