Fix #34: use ~75% of max open file descs

This commit is contained in:
Arun Prakash Jana 2017-07-25 10:13:22 +05:30
parent 75e3118acf
commit 16f0054b48
No known key found for this signature in database
GPG key ID: A75979F35C080412

6
nnn.c
View file

@ -245,11 +245,9 @@ max_openfds()
limit = rl.rlim_cur;
rl.rlim_cur = rl.rlim_max;
/* Return ~75% of max possible */
if (setrlimit(RLIMIT_NOFILE, &rl) == 0)
return rl.rlim_max - 64;
if (limit > 128)
return limit - 64;
return (rl.rlim_max - (rl.rlim_max >> 2));
return 32;
}