diff --git a/CMakeLists.txt b/CMakeLists.txt index a1937e734d..9444b45d99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -640,6 +640,8 @@ if (NOT WIN32) check_function_exists(localtime_r HAVE_LOCALTIME_R) check_function_exists(clock_gettime HAVE_CLOCK_GETTIME) check_function_exists(posix_memalign HAVE_POSIX_MEMALIGN) + check_function_exists(mallinfo HAVE_MALLINFO) + check_function_exists(feenableexcept HAVE_FEENABLEEXCEPT) include(TestBigEndian) test_big_endian(WORDS_BIGENDIAN) diff --git a/src/OSD/OSD_MemInfo.cxx b/src/OSD/OSD_MemInfo.cxx index 92224c0d13..48a262f001 100644 --- a/src/OSD/OSD_MemInfo.cxx +++ b/src/OSD/OSD_MemInfo.cxx @@ -143,8 +143,12 @@ void OSD_MemInfo::Update() } aFile.close(); +#if (defined(HAVE_MALLINFO)) struct mallinfo aMI = mallinfo(); myCounters[MemHeapUsage] = aMI.uordblks; +#else + myCounters[MemHeapUsage] = Standard_Size(-1); +#endif #elif (defined(__APPLE__)) struct task_basic_info aTaskInfo; diff --git a/src/OSD/OSD_signal.cxx b/src/OSD/OSD_signal.cxx index e9a80d6149..9dae79c52f 100644 --- a/src/OSD/OSD_signal.cxx +++ b/src/OSD/OSD_signal.cxx @@ -217,10 +217,9 @@ static void Handler (const int theSignal) // cout << "OSD::Handler: signal " << (int) theSignal << " occured inside a try block " << endl ; if ( ADR_ACT_SIGIO_HANDLER != NULL ) (*ADR_ACT_SIGIO_HANDLER)() ; -#ifdef linux +#if defined(linux) && defined(HAVE_FEENABLEEXCEPT) if (fFltExceptions) feenableexcept (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW); - //feenableexcept (FE_INVALID | FE_DIVBYZERO); #endif sigset_t set; sigemptyset(&set); @@ -338,10 +337,9 @@ static void SegvHandler(const int theSignal, return; } #endif -#ifdef linux +#if defined(linux) && defined(HAVE_FEENABLEEXCEPT) if (fFltExceptions) feenableexcept (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW); - //feenableexcept (FE_INVALID | FE_DIVBYZERO); #endif // cout << "OSD::SegvHandler activated(SA_SIGINFO)" << endl ; if ( ip != NULL ) { @@ -394,9 +392,8 @@ void OSD::SetSignal(const Standard_Boolean aFloatingSignal) cerr << "ieee_handler does not work !!! KO " << endl; #endif } -#elif defined (linux) +#elif defined(linux) && defined(HAVE_FEENABLEEXCEPT) feenableexcept (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW); - //feenableexcept (FE_INVALID | FE_DIVBYZERO); fFltExceptions = Standard_True; #endif }