siginfo_t

Information about a signal

Synopsis:

#include <sys/siginfo.h>

typedef struct {
    int             si_signo;
    int             si_code;
    int             si_errno;
    union {
        int             __pad[7];
        struct {
            pid_t           __pid;
            union {
                struct {
                    uid_t           __uid;
                    union sigval    __value;
                } __kill;     /* si_code <= 0 SI_FROMUSER */
                struct {
                    clock_t         __utime;
                    int             __status; /* CLD_EXITED status, else signo */
                    clock_t         __stime;
                } __chld; /* si_signo=SIGCHLD si_code=CLD_* */
            } __pdata;
        } __proc;
        struct {
            int             __fltno;
            void            *__fltip;   
            void            *__addr;    
            int             __bdslot;
        } __fault;                /* si_signo=SIGSEGV,ILL,FPE,TRAP,BUS */
    } __data;
} siginfo_t;

#define si_pid      __data.__proc.__pid
#define si_value    __data.__proc.__pdata.__kill.__value
#define si_uid      __data.__proc.__pdata.__kill.__uid
#define si_status   __data.__proc.__pdata.__chld.__status
#define si_utime    __data.__proc.__pdata.__chld.__utime
#define si_stime    __data.__proc.__pdata.__chld.__stime
#define si_fltno    __data.__fault.__fltno
#define si_trapno   si_fltno
#define si_addr     __data.__fault.__addr
#define si_fltip    __data.__fault.__fltip
#define si_bdslot   __data.__fault.__bdslot

Description:

The siginfo_t structure is used to hold information about a signal. It's defined in <sys/siginfo.h>, which <signal.h> includes. This structure includes the following:

si_signo
The signal number.
si_code
The signal code, which is limited to an 8-bit signed value as follows:
Value Description
-128 <= si_code <= 0 User values; you can provide this when you call SignalKill() or SignalKillSigval()
0 < si_code <= 127 System values generated by the kernel

QNX Neutrino defines SI_FROMUSER() and SI_FROMKERNEL() macros that determine whether or not an si_code value falls in the above ranges.

POSIX defines the following values, not all of which QNX Neutrino uses:

Signal Code Reason
SIGILL ILL_ILLOPC Illegal opcode
ILL_ILLOPN Illegal operand (not currently used)
ILL_ILLADR Illegal addressing mode (not currently used)
ILL_ILLTRP Illegal trap (not currently used)
ILL_PRVOPC Privileged opcode; instruction requires privileged CPU mode
ILL_PRVREG Privileged register (not currently used)
ILL_COPROC Coprocessor instruction error
ILL_BADSTK Internal stack error
SIGFPE FPE_INTDIV Integer division by zero
FPE_INTOVF Integer overflow
FPE_FLTDIV Floating-point divide by zero
FPE_FLTOVF Floating-point overflow
FPE_FLTUND Floating-point underflow
FPE_FLTRES Floating-point inexact result
FPE_FLTINV Invalid floating-point operation
FPE_FLTSUB Subscript out of range (not currently used)
SIGSEGV SEGV_MAPERR Address isn't mapped to an object
SEGV_ACCERR The mapping doesn't allow the attempted access
SIGBUS BUS_ADRALN Invalid address alignment
BUS_ADRERR Access to a non-existent area of a memory object
BUS_OBJERR Object-specific hardware error
SIGTRAP TRAP_BRKPT Process breakpoint trap
TRAP_TRACE Process trace trap
SIGCHLD CLD_EXITED Child has exited
CLD_KILLED Child has terminated abnormally and did not create a core file
CLD_DUMPED Child has terminated abnormally and created a core file
CLD_TRAPPED Traced child has trapped
CLD_STOPPED Child has stopped
CLD_CONTINUED Stopped child has continued
SIGPOLL POLL_IN Data input available
POLL_OUT Output buffers available
POLL_MSG Input message available
POLL_ERR I/O error
POLL_PRI High priority input available
POLL_HUP Device disconnected
Any SI_USER Signal sent by kill()
SI_QUEUE Signal sent by sigqueue()
SI_TIMER Signal generated by expiration of a timer set by timer_settime()
SI_ASYNCIO Signal generated by completion of an asynchronous I/O request
SI_MESGQ Signal generated by arrival of a message on an empty POSIX (not QNX) message queue

QNX Neutrino also defines the following:

Signal Code Reason
SIGFPE FPE_NOFPU No floating point hardware or software emulator present
FPE_NOMEM No memory for floating point context save area
SIGSEGV SEGV_STKERR Stack exception
SEGV_GPERR General protection
SEGV_IRQERR Interrupt handler fault (not currently used)
SIGTRAP TRAP_KDBRK Kdebug breakpoint
TRAP_CRASH Crash

As a QNX Neutrino extension, if si_code is SI_NOINFO, only si_signo is valid.

si_errno
Zero, or an errno value associated with the signal.
si_value
The signal value; you can provide this when you call SignalKill(), SignalKillSigval() or sigqueue().
__data
A union that contains additional information, depending on the signal. POSIX defines the following:
Signal Member Value
SIGILL, SIGFPE void *si_addr The address of the faulting instruction
SIGSEGV, SIGBUS void *si_addr The address of the faulting memory reference
SIGCHLD pid_t si_pid The child process ID
int si_status The exit value or signal
uid_t si_uid The real user ID of the process that sent the signal

QNX Neutrino defines the following:

Signal Member Value
SIGILL, SIGFPE, SIGSEGV, SIGBUS int si_fltno The fault number (see below)
void * si_fltip The address of the instruction that caused the fault
int si_bdslot (QNX Neutrino 6.3.2 or later) Nonzero if the faulting instruction is in a branch delay slot on architectures that support them

Earlier versions of procnto left this field as a random value, so you should check the procnto version number before examining this field.

SIGTRAP int si_trapno The trap number
SIGCHLD clock_t si_utime The user time consumed, in clock ticks
clock_t si_stime The system time consumed, in clock ticks

The fault numbers (reported in si_fltno), are defined in <sys/fault.h> and include:

FLTILL
Illegal instruction
FLTPRIV
Privileged instruction
FLTBPT
Breakpoint instruction
FLTTRACE
Trace trap (single-step)
FLTACCESS
Memory access (e.g., alignment)
FLTBOUNDS
Memory bounds (invalid address)
FLTIOVF
Integer overflow
FLTIZDIV
Integer zero divide
FLTFPE
Floating-point exception
FLTSTACK
Irrecoverable stack fault
FLTPAGE
Recoverable page fault (no associated sig)

Target-specific fault numbers are defined in <platform/fault.h>.

Classification:

POSIX 1003.1, with QNX Neutrino extensions