Check whether the nice() function is available

refs #7115
This commit is contained in:
Gunnar Beutner 2014-09-06 02:20:25 +02:00
parent 3a44935f2d
commit 666c92fa76
3 changed files with 4 additions and 0 deletions

View File

@ -133,6 +133,7 @@ endif()
check_function_exists(vfork HAVE_VFORK)
check_function_exists(backtrace_symbols HAVE_BACKTRACE_SYMBOLS)
check_function_exists(pipe2 HAVE_PIPE2)
check_function_exists(nice HAVE_NICE)
check_library_exists(dl dladdr "dlfcn.h" HAVE_DLADDR)
check_library_exists(execinfo backtrace_symbols "" HAVE_LIBEXECINFO)
check_include_file_cxx(cxxabi.h HAVE_CXXABI_H)

View File

@ -8,6 +8,7 @@
#cmakedefine HAVE_DLADDR
#cmakedefine HAVE_LIBEXECINFO
#cmakedefine HAVE_CXXABI_H
#cmakedefine HAVE_NICE
#cmakedefine ICINGA2_UNITY_BUILD

View File

@ -527,8 +527,10 @@ void Process::Run(const boost::function<void(const ProcessResult&)>& callback)
(void)close(fds[0]);
(void)close(fds[1]);
#ifdef HAVE_NICE
if (nice(5) < 0)
Log(LogWarning, "base", "Failed to renice child process.");
#endif /* HAVE_NICE */
if (icinga2_execvpe(argv[0], argv, envp) < 0) {
char errmsg[512];