32 void (*sa_handler)(
int);
38sigaction(
int sig,
struct sigaction* action,
struct sigaction* old)
46 if (signal(sig, SIG_DFL) == SIG_ERR)
53 if (signal(sig,
action->sa_handler) == SIG_ERR)
107std::list<std::ostream*>**
111 static std::list<std::ostream*>* streams =
nullptr;
121std::list<std::ostream*>*
126 if (*pstreams ==
nullptr)
128 *pstreams =
new std::list<std::ostream*>();
139 GetStreamList()->push_back(stream);
146 std::list<std::ostream*>** pl = PeekStreamList();
151 (*pl)->remove(stream);
190 std::list<std::ostream*>** pl = PeekStreamList();
200 struct sigaction hdl;
201 hdl.sa_handler = sigHandler;
202 sigaction(SIGSEGV, &hdl,
nullptr);
204 std::list<std::ostream*>* l = *pl;
209 std::ostream* s(l->front());
215 hdl.sa_handler = SIG_DFL;
216 sigaction(SIGSEGV, &hdl,
nullptr);
219 std::fflush(
nullptr);
ns3::FatalImpl::RegisterStream(), ns3::FatalImpl::UnregisterStream(), and ns3::FatalImpl::FlushStream...
void UnregisterStream(std::ostream *stream)
Unregister a stream for flushing on abnormal exit.
std::list< std::ostream * > ** PeekStreamList()
Static variable pointing to the list of output streams to be flushed on fatal errors.
void sigHandler(int sig)
Overrides normal SIGSEGV handler once the HandleTerminate function is run.
std::list< std::ostream * > * GetStreamList()
Get the stream list, initializing it if necessary.
void RegisterStream(std::ostream *stream)
Register a stream to be flushed on abnormal exit.
void FlushStreams()
Flush all currently registered streams.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Every class exported by the ns3 library is enclosed in the ns3 namespace.