mirror of https://github.com/Icinga/icinga2.git
Use #if rather than #ifdef to check HAVE_* macros.
This commit is contained in:
parent
9412b2be35
commit
49576d3a82
|
@ -166,7 +166,7 @@ namespace tuples = boost::tuples;
|
||||||
#include <openssl/ssl.h>
|
#include <openssl/ssl.h>
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
|
|
||||||
#ifdef HAVE_GCC_ABI_DEMANGLE
|
#if HAVE_GCC_ABI_DEMANGLE
|
||||||
# include <cxxabi.h>
|
# include <cxxabi.h>
|
||||||
#endif /* HAVE_GCC_ABI_DEMANGLE */
|
#endif /* HAVE_GCC_ABI_DEMANGLE */
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ void Process::CreateWorkers(void)
|
||||||
{
|
{
|
||||||
int fds[2];
|
int fds[2];
|
||||||
|
|
||||||
#ifdef HAVE_PIPE2
|
#if HAVE_PIPE2
|
||||||
if (pipe2(fds, O_CLOEXEC) < 0)
|
if (pipe2(fds, O_CLOEXEC) < 0)
|
||||||
BOOST_THROW_EXCEPTION(PosixException("pipe2() failed.", errno));
|
BOOST_THROW_EXCEPTION(PosixException("pipe2() failed.", errno));
|
||||||
#else /* HAVE_PIPE2 */
|
#else /* HAVE_PIPE2 */
|
||||||
|
@ -172,7 +172,7 @@ void Process::InitTask(void)
|
||||||
|
|
||||||
int fds[2];
|
int fds[2];
|
||||||
|
|
||||||
#ifdef HAVE_PIPE2
|
#if HAVE_PIPE2
|
||||||
if (pipe2(fds, O_NONBLOCK | O_CLOEXEC) < 0)
|
if (pipe2(fds, O_NONBLOCK | O_CLOEXEC) < 0)
|
||||||
BOOST_THROW_EXCEPTION(PosixException("pipe2() failed.", errno));
|
BOOST_THROW_EXCEPTION(PosixException("pipe2() failed.", errno));
|
||||||
#else /* HAVE_PIPE2 */
|
#else /* HAVE_PIPE2 */
|
||||||
|
@ -223,11 +223,11 @@ void Process::InitTask(void)
|
||||||
|
|
||||||
m_ExtraEnvironment.reset();
|
m_ExtraEnvironment.reset();
|
||||||
|
|
||||||
#ifdef HAVE_VFORK
|
#if HAVE_WORKING_VFORK
|
||||||
m_Pid = vfork();
|
m_Pid = vfork();
|
||||||
#else /* HAVE_VFORK */
|
#else /* HAVE_WORKING_VFORK */
|
||||||
m_Pid = fork();
|
m_Pid = fork();
|
||||||
#endif /* HAVE_VFORK */
|
#endif /* HAVE_WORKING_VFORK */
|
||||||
|
|
||||||
if (m_Pid < 0)
|
if (m_Pid < 0)
|
||||||
BOOST_THROW_EXCEPTION(PosixException("fork() failed.", errno));
|
BOOST_THROW_EXCEPTION(PosixException("fork() failed.", errno));
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include "i2-base.h"
|
#include "i2-base.h"
|
||||||
#include <mmatch.h>
|
#include <mmatch.h>
|
||||||
#ifdef HAVE_BACKTRACE_SYMBOLS
|
#if HAVE_BACKTRACE_SYMBOLS
|
||||||
# include <execinfo.h>
|
# include <execinfo.h>
|
||||||
#endif /* HAVE_BACKTRACE_SYMBOLS */
|
#endif /* HAVE_BACKTRACE_SYMBOLS */
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ String Utility::DemangleSymbolName(const String& sym)
|
||||||
{
|
{
|
||||||
String result = sym;
|
String result = sym;
|
||||||
|
|
||||||
#ifdef HAVE_GCC_ABI_DEMANGLE
|
#if HAVE_GCC_ABI_DEMANGLE
|
||||||
int status;
|
int status;
|
||||||
char *realname = abi::__cxa_demangle(sym.CStr(), 0, 0, &status);
|
char *realname = abi::__cxa_demangle(sym.CStr(), 0, 0, &status);
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ String Utility::GetTypeName(const type_info& ti)
|
||||||
*/
|
*/
|
||||||
bool Utility::PrintStacktrace(ostream& fp, int ignoreFrames)
|
bool Utility::PrintStacktrace(ostream& fp, int ignoreFrames)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_BACKTRACE_SYMBOLS
|
#if HAVE_BACKTRACE_SYMBOLS
|
||||||
void *frames[50];
|
void *frames[50];
|
||||||
int framecount = backtrace(frames, sizeof(frames) / sizeof(frames[0]));
|
int framecount = backtrace(frames, sizeof(frames) / sizeof(frames[0]));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue