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 | |
parent | 07987a9997b268a8ba1e17ee7e6e90020f468f27 (diff) | |
download | accel-ppp-xebd-2d1bb18f0facdb7c67d59e65ab3ce15afc70956c.tar.gz accel-ppp-xebd-2d1bb18f0facdb7c67d59e65ab3ce15afc70956c.zip |
increase number of maximum opened files to system maximum
link log_file with libaio
updated documentation
Diffstat (limited to 'accel-pptpd')
-rw-r--r-- | accel-pptpd/logs/CMakeLists.txt | 2 | ||||
-rw-r--r-- | accel-pptpd/main.c | 22 |
2 files changed, 24 insertions, 0 deletions
diff --git a/accel-pptpd/logs/CMakeLists.txt b/accel-pptpd/logs/CMakeLists.txt index f1b09ca..58c663b 100644 --- a/accel-pptpd/logs/CMakeLists.txt +++ b/accel-pptpd/logs/CMakeLists.txt @@ -1,4 +1,6 @@ ADD_LIBRARY(log_file SHARED log_file.c) +TARGET_LINK_LIBRARIES(log_file aio) + INSTALL(TARGETS log_file LIBRARY DESTINATION usr/lib/accel-pptp ) diff --git a/accel-pptpd/main.c b/accel-pptpd/main.c index e261fbb..ede3732 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; |