Commit adbc7b3f710270f13d64953f02e70af4bcc158bd
1 parent
f8944b06
Temporary ulimit stuff
Showing
1 changed file
with
7 additions
and
0 deletions
main.cpp
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | #include <signal.h> |
| 3 | 3 | #include <memory> |
| 4 | 4 | #include <string.h> |
| 5 | +#include <sys/resource.h> | |
| 5 | 6 | |
| 6 | 7 | #include "mainapp.h" |
| 7 | 8 | |
| ... | ... | @@ -29,6 +30,12 @@ static void signal_handler(int signal) |
| 29 | 30 | |
| 30 | 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 | 39 | struct sigaction sa; |
| 33 | 40 | memset(&sa, 0, sizeof (struct sigaction)); |
| 34 | 41 | sa.sa_handler = &signal_handler; | ... | ... |