Attach the pseudo interrupt handler that the instrumented module uses
#include <sys/neutrino.h> int InterruptHookTrace( const struct sigevent * (* handler)(int), unsigned flags );
- A pointer to the handler function.
- Flags that specify how you want to attach the interrupt handler;
0, or the following bit:
- _NTO_INTR_FLAGS_END — put the new handler at the end of the list of existing handlers (for shared interrupts) instead of the start. For more information, see below.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The InterruptHookTrace() kernel call attaches the pseudo interrupt handler handle that the instrumented module uses.
Before calling this function, the thread must:
- have the PROCMGR_AID_INTERRUPT and PROCMGR_AID_IO abilities enabled. For more information, see procmgr_ability().
- request I/O privileges by calling:
ThreadCtl( _NTO_TCTL_IO, 0 );
The handler argument specifies the pseudo interrupt handler that receives trace events from the kernel. The integer that's passed to the handler is a combination of the buffer index and the sequence number; to extract each part, pass the integer to the _TRACE_GET_BUFFNUM() and _TRACE_GET_BUFFSEQ() macros defined in <sys/trace.h>.
The interrupt structure allows trace interrupts to be shared. For example, if two processes take over the same trace interrupt, both handlers are invoked consecutively. When a handler attaches, it's placed in front of any existing handlers for that interrupt and is called first. This behavior can be changed by setting the _NTO_INTR_FLAGS_END flag in the flags argument. This adds the handler at the end of any existing handlers.
This call doesn't block.
An interrupt function ID, or -1 if an error occurs (errno is set).
- All kernel interrupt entries are in use.
- A fault occurred when the kernel tried to access the buffers provided.
- The process doesn't have I/O privileges, or it doesn't have the required permission; see procmgr_ability().
- The kernel isn't instrumented.