summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-11 00:30:55 +0800
committerwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-11 00:30:55 +0800
commit9f4b76939748677234d5f73981fdd9b25ed90e17 (patch)
tree09cb13265bb541d185353e0002949de174a194ef
parent9613eebbc215ac45a73f9a2326ab04d09ec2be9e (diff)
downloadpttbbs-9f4b76939748677234d5f73981fdd9b25ed90e17.tar
pttbbs-9f4b76939748677234d5f73981fdd9b25ed90e17.tar.gz
pttbbs-9f4b76939748677234d5f73981fdd9b25ed90e17.tar.bz2
pttbbs-9f4b76939748677234d5f73981fdd9b25ed90e17.tar.lz
pttbbs-9f4b76939748677234d5f73981fdd9b25ed90e17.tar.xz
pttbbs-9f4b76939748677234d5f73981fdd9b25ed90e17.tar.zst
pttbbs-9f4b76939748677234d5f73981fdd9b25ed90e17.zip
Increase maximum number of open files
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4551 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--daemon/logind/logind.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/daemon/logind/logind.c b/daemon/logind/logind.c
index c5939a9f..017bede8 100644
--- a/daemon/logind/logind.c
+++ b/daemon/logind/logind.c
@@ -19,6 +19,7 @@
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
+#include <sys/resource.h>
#include <signal.h>
#include <event.h>
@@ -49,6 +50,10 @@
#define MAX_TEXT_SCREEN_LINES (24)
+#ifndef MAX_FDS
+#define MAX_FDS (100000)
+#endif
+
///////////////////////////////////////////////////////////////////////
// global variables
int g_tunnel; // tunnel for service daemon
@@ -1272,6 +1277,9 @@ main(int argc, char *argv[])
}
}
+ struct rlimit r = {.rlim_cur = MAX_FDS, .rlim_max = MAX_FDS};
+ setrlimit(RLIMIT_NOFILE, &r);
+
chdir(BBSHOME);
attach_SHM();