fix: automatically bump the kqueue file limit to the hard limit
This commit is contained in:
parent
8ad17f5189
commit
db7d954a50
1 changed files with 7 additions and 0 deletions
|
|
@ -538,6 +538,13 @@ const KQueueBackend = struct {
|
|||
const NOTE_RENAME: u32 = 0x00000020;
|
||||
|
||||
fn init(handler: *Handler) (std.posix.KQueueError || std.posix.KEventError)!@This() {
|
||||
// Per-file kqueue watches require one open fd per watched file. Bump
|
||||
// the soft NOFILE limit to the hard limit so large directory trees don't
|
||||
// exhaust the default quota (256 on macOS, 1024 on many FreeBSD installs).
|
||||
if (std.posix.getrlimit(.NOFILE)) |rl| {
|
||||
if (rl.cur < rl.max)
|
||||
std.posix.setrlimit(.NOFILE, .{ .cur = rl.max, .max = rl.max }) catch {};
|
||||
} else |_| {}
|
||||
const kq = try std.posix.kqueue();
|
||||
errdefer std.posix.close(kq);
|
||||
const pipe = try std.posix.pipe();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue