mirror of
https://github.com/ziglang/zig.git
synced 2026-01-17 21:05:12 +00:00
force comptime on isDarwin
This commit is contained in:
parent
8dda64fa3e
commit
e023a5fe5d
@ -2986,13 +2986,13 @@ fn gimmeMoreOfThoseSweetSweetFileDescriptors() void {
|
||||
const posix = std.os;
|
||||
|
||||
var lim = posix.getrlimit(.NOFILE) catch return; // Oh well; we tried.
|
||||
if (std.Target.current.isDarwin()) {
|
||||
if (comptime std.Target.current.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 = std.math.min(posix.darwin.OPEN_MAX, lim.max);
|
||||
lim.max = std.math.min(std.os.darwin.OPEN_MAX, lim.max);
|
||||
}
|
||||
if (lim.cur == lim.max) return;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user