From 978d707e3bf085c754cc5fc098bdc55c0b9c41c0 Mon Sep 17 00:00:00 2001 From: Jean Flach Date: Mon, 16 Apr 2018 13:39:20 +0200 Subject: [PATCH] Add improved error messages for resource limits refs #6215 refs #6241 --- lib/base/application.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/base/application.cpp b/lib/base/application.cpp index b6e09bfce7f..a65e0b9d282 100644 --- a/lib/base/application.cpp +++ b/lib/base/application.cpp @@ -197,7 +197,8 @@ void Application::SetResourceLimits(void) rl.rlim_max = rl.rlim_cur; if (setrlimit(RLIMIT_NOFILE, &rl) < 0) - Log(LogNotice, "Application", "Could not adjust resource limit for open file handles (RLIMIT_NOFILE)"); + Log(LogWarning, "Application") + << "Failed adjust resource limit for open file handles (RLIMIT_NOFILE) with error \"" << strerror(errno) << "\""; # else /* RLIMIT_NOFILE */ Log(LogNotice, "Application", "System does not support adjusting the resource limit for open file handles (RLIMIT_NOFILE)"); # endif /* RLIMIT_NOFILE */ @@ -217,7 +218,8 @@ void Application::SetResourceLimits(void) rl.rlim_max = rl.rlim_cur; if (setrlimit(RLIMIT_NPROC, &rl) < 0) - Log(LogNotice, "Application", "Could not adjust resource limit for number of processes (RLIMIT_NPROC)"); + Log(LogWarning, "Application") + << "Failed adjust resource limit for number of processes (RLIMIT_NPROC) with error \"" << strerror(errno) << "\""; # else /* RLIMIT_NPROC */ Log(LogNotice, "Application", "System does not support adjusting the resource limit for number of processes (RLIMIT_NPROC)"); # endif /* RLIMIT_NPROC */ @@ -257,7 +259,8 @@ void Application::SetResourceLimits(void) rl.rlim_cur = rl.rlim_max; if (setrlimit(RLIMIT_STACK, &rl) < 0) { - Log(LogNotice, "Application", "Could not adjust resource limit for stack size (RLIMIT_STACK)"); + Log(LogWarning, "Application") + << "Failed adjust resource limit for stack size (RLIMIT_STACK) with error \"" << strerror(errno) << "\""; if (set_stack_rlimit) { char **new_argv = static_cast(malloc(sizeof(char *) * (argc + 2)));