mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-29 00:24:23 +02:00
parent
5436256ed7
commit
5dcf1a777b
@ -182,13 +182,19 @@ void Application::SetResourceLimits(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (set_stack_rlimit) {
|
if (getrlimit(RLIMIT_STACK, &rl) < 0) {
|
||||||
rl.rlim_cur = 1024 * 1024;
|
Log(LogWarning, "Application", "Could not determine resource limit for stack size (RLIMIT_STACK)");
|
||||||
rl.rlim_max = rl.rlim_cur;
|
rl.rlim_max = RLIM_INFINITY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (set_stack_rlimit)
|
||||||
|
rl.rlim_cur = 256 * 1024;
|
||||||
|
else
|
||||||
|
rl.rlim_cur = rl.rlim_max;
|
||||||
|
|
||||||
if (setrlimit(RLIMIT_STACK, &rl) < 0)
|
if (setrlimit(RLIMIT_STACK, &rl) < 0)
|
||||||
Log(LogNotice, "Application", "Could not adjust resource limit for stack size (RLIMIT_STACK)");
|
Log(LogNotice, "Application", "Could not adjust resource limit for stack size (RLIMIT_STACK)");
|
||||||
else {
|
else if (set_stack_rlimit) {
|
||||||
char **new_argv = static_cast<char **>(malloc(sizeof(char *) * (argc + 2)));
|
char **new_argv = static_cast<char **>(malloc(sizeof(char *) * (argc + 2)));
|
||||||
|
|
||||||
if (!new_argv) {
|
if (!new_argv) {
|
||||||
@ -213,7 +219,6 @@ void Application::SetResourceLimits(void)
|
|||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
# else /* RLIMIT_STACK */
|
# else /* RLIMIT_STACK */
|
||||||
Log(LogNotice, "Application", "System does not support adjusting the resource limit for stack size (RLIMIT_STACK)");
|
Log(LogNotice, "Application", "System does not support adjusting the resource limit for stack size (RLIMIT_STACK)");
|
||||||
# endif /* RLIMIT_STACK */
|
# endif /* RLIMIT_STACK */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user