From 6f1bc52711b12b670b3b4bbd5d52a1c029603612 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Fri, 19 Sep 2014 09:20:14 +0200 Subject: Raise the file descriptor limit to the maximum --- ponymap.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ponymap.c b/ponymap.c index 0941179..f620deb 100644 --- a/ponymap.c +++ b/ponymap.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -1894,6 +1895,17 @@ main (int argc, char *argv[]) setup_signal_handlers (); + // Set the maximum count of file descriptorts to the hard limit + struct rlimit limit; + if (getrlimit (RLIMIT_NOFILE, &limit)) + print_warning ("%s: %s", "getrlimit failed", strerror (errno)); + else + { + limit.rlim_cur = limit.rlim_max; + if (setrlimit (RLIMIT_NOFILE, &limit)) + print_warning ("%s: %s", "setrlimit failed", strerror (errno)); + } + init_terminal (); atexit (free_terminal); -- cgit v1.2.3-70-g09d2