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
1 changed files with 2 additions and 4 deletions

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;
}