From 2d1bb18f0facdb7c67d59e65ab3ce15afc70956c Mon Sep 17 00:00:00 2001 From: Kozlov Dmitry Date: Fri, 8 Oct 2010 14:17:54 +0400 Subject: increase number of maximum opened files to system maximum link log_file with libaio updated documentation --- accel-pptpd/logs/CMakeLists.txt | 2 ++ accel-pptpd/main.c | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) (limited to 'accel-pptpd') diff --git a/accel-pptpd/logs/CMakeLists.txt b/accel-pptpd/logs/CMakeLists.txt index f1b09ca8..58c663b9 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 e261fbb4..ede3732d 100644 --- a/accel-pptpd/main.c +++ b/accel-pptpd/main.c @@ -3,8 +3,10 @@ #include #include #include +#include #include #include +#include #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; -- cgit v1.2.3