Raise the current file descriptor limit to the maximum.

This commit is contained in:
JoelKatz
2013-07-15 14:58:04 -07:00
parent 85b25a883a
commit 3994546083
2 changed files with 16 additions and 0 deletions

View File

@@ -8,6 +8,18 @@ namespace po = boost::program_options;
void setupServer ()
{
#ifdef RLIMIT_NOFILE
struct rlimit rl;
if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
{
if (rl.rlim_cur != rl.rlim_max)
{
rl.rlim_cur = rl.rlim_max;
setrlimit(RLIMIT_NOFILE, &r1);
}
}
#endif
getApp().setup ();
}