Attach the pseudo interrupt handler that the instrumented module uses
#include <sys/neutrino.h> int InterruptHookTrace( const struct sigevent * (* handler)(int), unsigned flags );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The InterruptHookTrace() kernel call attaches handler to the _NTO_HOOK_TRACE synthetic interrupt that the instrumented module uses to notify your program when trace data is available.
This function requires the instrumented kernel. For more information, see the System Analysis Toolkit (SAT) User's Guide. |
You'd use this function if you were writing your own data-capture program and had earlier called TraceEvent() with the _NTO_TRACE_ALLOCBUFFER command to create the kernel's ring of buffers.
Before calling this function, the thread must obtain I/O privileges by successfully calling:
ThreadCtl( _NTO_TCTL_IO, 0 );
To detach the interrupt handler, call InterruptDetach().
The handler argument specifies the function that you want to be called to receive trace events from the kernel. Its prototype is as follows:
const struct sigevent* handler( int info );
You can use some macros that are defined in <sys/trace.h> to extract the data that's included in the info argument:
The handler function runs in the environment of your process. For guidelines on writing this handler, see “Interrupt handler function” in the entry for InterruptAttach().
This call doesn't block.
An interrupt function ID, or -1 if an error occurs (errno is set).
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
InterruptAttach(), TraceEvent()
Writing an Interrupt Handler chapter of the Neutrino Programmer's Guide
System Analysis Toolkit (SAT) User's Guide