diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2014-09-19 09:20:14 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2014-09-19 09:20:14 +0200 |
commit | 6f1bc52711b12b670b3b4bbd5d52a1c029603612 (patch) | |
tree | 989a3f26744cb7137561d510b2bcfeac541a338a | |
parent | 4662e84995cf9570c18361f6686bf5964fd86cba (diff) | |
download | ponymap-6f1bc52711b12b670b3b4bbd5d52a1c029603612.tar.gz ponymap-6f1bc52711b12b670b3b4bbd5d52a1c029603612.tar.xz ponymap-6f1bc52711b12b670b3b4bbd5d52a1c029603612.zip |
Raise the file descriptor limit to the maximum
-rw-r--r-- | ponymap.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -25,6 +25,7 @@ #include <dirent.h> #include <dlfcn.h> #include <arpa/inet.h> +#include <sys/resource.h> #include <curses.h> #include <term.h> @@ -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); |