Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check for feenableexcept and mallinfo #731

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 4 additions & 0 deletions src/OSD/OSD_MemInfo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 3 additions & 6 deletions src/OSD/OSD_signal.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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
}
Expand Down