-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
72 changed files
with
1,599 additions
and
1,619 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#pragma once | ||
|
||
#include "loggers/core_logger.h" | ||
|
||
#ifdef OS_UNIX | ||
#include <sys/resource.h> | ||
static void increaseFileLimit() | ||
{ | ||
|
||
struct rlimit rlim; | ||
// Get the current limit | ||
if (getrlimit(RLIMIT_NOFILE, &rlim) == -1) | ||
{ | ||
LOGF("Core: getrlimit failed"); | ||
exit(EXIT_FAILURE); | ||
} | ||
if ((unsigned long) rlim.rlim_max < 8192) | ||
{ | ||
LOGW( | ||
"Core: Maximum allowed open files limit is %lu which is below 8192 !\n if you are running as a server then \ | ||
you might experince time-outs if this limits gets reached, depends on how many clients are connected to the server simultaneously\ | ||
", | ||
(unsigned long) rlim.rlim_max); | ||
} | ||
else | ||
{ | ||
LOGD("Core: File limit %lu -> %lu", (unsigned long) rlim.rlim_cur, (unsigned long) rlim.rlim_max); | ||
} | ||
// Set the hard limit to the maximum allowed value | ||
rlim.rlim_cur = rlim.rlim_max; | ||
// Apply the new limit | ||
if (setrlimit(RLIMIT_NOFILE, &rlim) == -1) | ||
{ | ||
LOGF("Core: setrlimit failed"); | ||
exit(EXIT_FAILURE); | ||
} | ||
} | ||
#else | ||
static void increaseFileLimit() | ||
{ | ||
(void) (0); | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.