summaryrefslogtreecommitdiff
path: root/accel-pptpd
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pptpd')
-rw-r--r--accel-pptpd/logs/CMakeLists.txt2
-rw-r--r--accel-pptpd/main.c22
2 files changed, 24 insertions, 0 deletions
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 <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;