() — MISC. REFERENCE MANUAL PAGES
NAME
siginfo − signal generation information
SYNOPSIS
#include <siginfo.h>
DESCRIPTION
If a process is catching a signal, it may request information that tells why the system generated that signal [see sigaction(2)]. If a process is monitoring its children, it may receive information that tells why a child changed state [see waitid(2)]. In either case, the system returns the information in a structure of type siginfo_t, which includes the following information:
int si_signo /∗ signal number ∗/
int si_errno /∗ error number ∗/
int si_code /∗ signal code ∗/
si_signo contains the system-generated signal number. (For the waitid(2) function, si_signo is always SIGCHLD.)
If si_errno is non-zero, it contains an error number associated with this signal, as defined in errno.h.
si_code contains a code identifying the cause of the signal. If the value of si_code is less than or equal to 0, then the signal was generated by a user process [see kill(2) and sigsend(2)] and the siginfo structure contains the following additional information:
pid_t si_pid/∗ sending process ID ∗/
uid_t si_uid/∗ sending user ID ∗/
Otherwise, si_code contains a signal-specific reason why the signal was generated, as follows:
| Signal | Code | Reason |
| ILL_PRVOPC | privileged opcode | |
| ILL_PRVREG | privileged register | |
| SIGFPE | FPE_INTDIV | integer divide 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 | |
| FPE_FTLNAN | FP NaN operand | |
| SIGSEGV | SEGV_MAPERR | address not mapped to object |
| SEGV_ACCERR | invalid permissions for mapped object | |
| SIGBUS | BUS_ADRALN | invalid address alignment |
| BUS_PROT | protection violation |
|
| SIGTRAP | TRAP_BRKPT | process breakpoint |
| TRAP_TRACE | process trace trap | |
| trap_number | traps 504-511 | |
| SIGCHLD | CLD_EXITED | child has exited |
| CLD_KILLED | child was killed | |
| CLD_DUMPED | child terminated abnormally | |
| CLD_TRAPPED | traced child has trapped | |
| CLD_STOPPED | child has stopped | |
| CLD_CONTINUED | stopped child had 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 |
In addition, the following signal-dependent information is available for kernel-generated signals:
| Signal | Field | Value |
| int si_status | exit value or signal | |
| SIGPOLL | long si_band | band event for POLL_IN, POLL_OUT, or |
| POLL_MSG |
NOTES
For SIGCHLD signals, if si_code is equal to CLD_EXITED, then si_status is equal to the exit value of the process; otherwise, it is equal to the signal that caused the process to change state. If si_ncodes is non zero, the signal was generated as a result of a machine exception. The signals that an exception may give rise to are SIGSEGV, SIGILL, SIGBUS, SIGTRAP and SIGFPE. When one of these signals is delivered as a result of a machine exception, one or more exception blocks containing relevant information is also made available through the siginfo structure. In that case si_ncodes contains the number of exception blocks available, and si_exblks points to an array of exception blocks containing si_ncodes elements. The contents of each exception block include the signal number, eb_signo, the exception code, eb_code (one of those listed above), and signal-specific information, eb_registers. eb_register contains valid information only for SIGSEGV, SIGBUS and SIGFPE. When eb_code is FPE_FLTINV, SEGV_MAPERR, SEGV_ACCERR, BUS_ADRERR, or BUS_OBJERR the eb_subcode field will contain additional information about the cause of the exception:
| Code | Subcode | Reason |
| FPE_FLTINV_NAN | Floating point NaN operand | |
| SEGV_MAPERR | SEGV_MAPERR_CODE | Code access |
| SEGV_MAPERR_DATA | Data access | |
| SEGV_ACCERR | SEGV_ACCERR_CODE | Code access |
| SEGV_ACCERR_DATA | Data access | |
| BUS_ADRERR | BUS_ADRERR_VME_ERR | Non-existent VME address |
| BUS_OBJERR | BUS_OBJERR_CODE | Code access |
| BUS_OBJERR_DATA | Data access | |
| BUS_OBJERR_PARITY_ERR | Parity error | |
| BUS_OBJERR_SB_HANG | Processor scoreboard hang |
For SIGSEGV and SIGBUS, the address, transaction and data registers of the faulting data-pipe stage are available in eb_dma, eb_dmt and eb_dmd, respectively.
For SIGFPE imprecise exception codes, the high and low words of the floating point result are available in eb_fprh and eb_fprl, and the floating point imprecise operation type register is available in eb_fpit.