33 struct sigaction
Foam::sigSegv::oldAction_;
38 void Foam::sigSegv::sigHandler(int)
41 if (sigaction(SIGSEGV, &oldAction_,
nullptr) < 0)
44 <<
"Cannot reset SIGSEGV trapping" 51 error::printStack(
Perr);
62 oldAction_.sa_handler =
nullptr;
71 if (sigaction(SIGSEGV, &oldAction_,
nullptr) < 0)
74 <<
"Cannot reset SIGSEGV trapping" 84 if (oldAction_.sa_handler)
87 <<
"Cannot call sigSegv::set() more than once" 91 struct sigaction newAction;
92 newAction.sa_handler = sigHandler;
93 newAction.sa_flags = SA_NODEFER;
94 sigemptyset(&newAction.sa_mask);
95 if (sigaction(SIGSEGV, &newAction, &oldAction_) < 0)
98 <<
"Cannot set SIGSEGV trapping"
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
errorManip< error > abort(error &err)
prefixOSstream Perr(cerr, "Perr")
void set(const bool verbose)
Activate SIGSEGV signal handler.