From 4e46616462a3717ba2c32719220b74e8c37cfe67 Mon Sep 17 00:00:00 2001 From: vl Date: Tue, 21 Sep 2010 08:54:18 +0200 Subject: [PATCH] Added: setrlimit to define how many open file we can have in the same time --- code/ryzom/client/src/client.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/code/ryzom/client/src/client.cpp b/code/ryzom/client/src/client.cpp index 54549bb51..7967c24db 100644 --- a/code/ryzom/client/src/client.cpp +++ b/code/ryzom/client/src/client.cpp @@ -25,11 +25,16 @@ // Misc. #include "nel/misc/types_nl.h" -#if defined(NL_OS_WINDOWS) +#ifdef NL_OS_WINDOWS #include #include #endif +#ifdef NL_OS_MAC +#include +#include +#endif + #include "nel/misc/debug.h" #include "nel/misc/command.h" #include "nel/net/tcp_sock.h" @@ -364,6 +369,20 @@ int main(int argc, char **argv) // temporary buffer to store Ryzom full path char filename[1024]; +#ifdef NL_OS_MAC + struct rlimit rlp, rlp2, rlp3; + + getrlimit(RLIMIT_NOFILE, &rlp); + + rlp2.rlim_cur = 1024; + rlp2.rlim_max = rlp.rlim_max; + setrlimit(RLIMIT_NOFILE, &rlp2); + + getrlimit(RLIMIT_NOFILE, &rlp3); + nlinfo("rlimit before %d %d\n", rlp.rlim_cur, rlp.rlim_max); + nlinfo("rlimit after %d %d\n", rlp3.rlim_cur, rlp3.rlim_max); +#endif + #if defined(NL_OS_WINDOWS) /* Windows bug: When the Window IconeMode is in "ThumbNails" mode, the current path is set to