diff options
author | Kozlov Dmitry <dima@server> | 2010-10-08 14:17:54 +0400 |
---|---|---|
committer | Kozlov Dmitry <dima@server> | 2010-10-08 14:18:07 +0400 |
commit | 2d1bb18f0facdb7c67d59e65ab3ce15afc70956c (patch) | |
tree | 256237b22f8b17334b24904851c1529f57148341 /accel-pptpd/main.c | |
parent | 07987a9997b268a8ba1e17ee7e6e90020f468f27 (diff) | |
download | accel-ppp-2d1bb18f0facdb7c67d59e65ab3ce15afc70956c.tar.gz accel-ppp-2d1bb18f0facdb7c67d59e65ab3ce15afc70956c.zip |
increase number of maximum opened files to system maximum
link log_file with libaio
updated documentation
Diffstat (limited to 'accel-pptpd/main.c')
-rw-r--r-- | accel-pptpd/main.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/accel-pptpd/main.c b/accel-pptpd/main.c index e261fbb4..ede3732d 100644 --- a/accel-pptpd/main.c +++ b/accel-pptpd/main.c @@ -3,8 +3,10 @@ #include <unistd.h> #include <stdlib.h> #include <stdio.h> +#include <errno.h> #include <sys/stat.h> #include <sys/mman.h> +#include <sys/resource.h> #include "triton/triton.h" @@ -81,6 +83,24 @@ usage: -c - config file\n"); _exit(EXIT_FAILURE); } + +static void change_limits(void) +{ + FILE *f; + struct rlimit lim; + unsigned int file_max; + + f = fopen("/proc/sys/fs/file-max", "r"); + if (f) { + fscanf(f, "%d", &file_max); + fclose(f); + + if (setrlimit(RLIMIT_NOFILE, &lim)) + log_emerg("main: setrlimit: %s", strerror(errno)); + } else + log_emerg("main: failed to open '/proc/sys/fs/file-max': %s\n", strerror(errno)); +} + int main(int argc, char **argv) { sigset_t set; @@ -118,6 +138,8 @@ int main(int argc, char **argv) //signal(SIGTERM, sigterm); //signal(SIGPIPE, sigterm); + change_limits(); + if (triton_load_modules("modules")) return EXIT_FAILURE; |