Commit adbc7b3f710270f13d64953f02e70af4bcc158bd

Authored by Wiebe Cazemier
1 parent f8944b06

Temporary ulimit stuff

Showing 1 changed file with 7 additions and 0 deletions
main.cpp
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 #include <signal.h> 2 #include <signal.h>
3 #include <memory> 3 #include <memory>
4 #include <string.h> 4 #include <string.h>
  5 +#include <sys/resource.h>
5 6
6 #include "mainapp.h" 7 #include "mainapp.h"
7 8
@@ -29,6 +30,12 @@ static void signal_handler(int signal) @@ -29,6 +30,12 @@ static void signal_handler(int signal)
29 30
30 int register_signal_handers() 31 int register_signal_handers()
31 { 32 {
  33 + // Quick'n dirty temp. TODO properly, with config file, checks, etc
  34 + rlim_t rlim = 1000000;
  35 + printf("Setting ulimit nofile to %ld.\n", rlim);
  36 + struct rlimit v = { rlim, rlim };
  37 + setrlimit(RLIMIT_NOFILE, &v);
  38 +
32 struct sigaction sa; 39 struct sigaction sa;
33 memset(&sa, 0, sizeof (struct sigaction)); 40 memset(&sa, 0, sizeof (struct sigaction));
34 sa.sa_handler = &signal_handler; 41 sa.sa_handler = &signal_handler;