Added: setrlimit to define how many open file we can have in the same time
This commit is contained in:
parent
eb45c9e694
commit
8046962fa2
1 changed files with 20 additions and 1 deletions
|
@ -25,11 +25,16 @@
|
||||||
// Misc.
|
// Misc.
|
||||||
#include "nel/misc/types_nl.h"
|
#include "nel/misc/types_nl.h"
|
||||||
|
|
||||||
#if defined(NL_OS_WINDOWS)
|
#ifdef NL_OS_WINDOWS
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NL_OS_MAC
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/resource.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "nel/misc/debug.h"
|
#include "nel/misc/debug.h"
|
||||||
#include "nel/misc/command.h"
|
#include "nel/misc/command.h"
|
||||||
#include "nel/net/tcp_sock.h"
|
#include "nel/net/tcp_sock.h"
|
||||||
|
@ -364,6 +369,20 @@ int main(int argc, char **argv)
|
||||||
// temporary buffer to store Ryzom full path
|
// temporary buffer to store Ryzom full path
|
||||||
char filename[1024];
|
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)
|
#if defined(NL_OS_WINDOWS)
|
||||||
|
|
||||||
/* Windows bug: When the Window IconeMode is in "ThumbNails" mode, the current path is set to
|
/* Windows bug: When the Window IconeMode is in "ThumbNails" mode, the current path is set to
|
||||||
|
|
Loading…
Reference in a new issue