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. Before calling this function, the thread must have the PROCMGR_AID_INTERRUPT ability enabled. For more information, see procmgr_ability().
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 trace buffers.
To detach the interrupt handler, call InterruptDetach(); you can't pass NULL for the handler argument.
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().
Blocking states
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 |