]> granicus.if.org Git - icinga2/commitdiff
Add improved error messages for resource limits
authorJean Flach <jean-marcel.flach@icinga.com>
Mon, 16 Apr 2018 11:39:20 +0000 (13:39 +0200)
committerMichael Friedrich <michael.friedrich@icinga.com>
Thu, 19 Apr 2018 06:55:05 +0000 (08:55 +0200)
refs #6215

lib/base/application.cpp

index f9c00055b8c85652182e34f3496e3dd7f75ce96b..5cedbf5d65b1086be63a7b26b08cf5cc4292c2d4 100644 (file)
@@ -178,7 +178,8 @@ void Application::SetResourceLimits()
                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 */
@@ -198,7 +199,8 @@ void Application::SetResourceLimits()
                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 */
@@ -238,7 +240,8 @@ void Application::SetResourceLimits()
                        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<char **>(malloc(sizeof(char *) * (argc + 2)));