NAME
siginfo – signal generation information
SYNOPSIS
#include <signal.h>
DESCRIPTION
A process may request signal information when it is catching a signal. The information specifies why the system generated that signal. To request signal information in a signal handler, the user can set SA_SIGINFO in sa_flags before sigaction(2) is called, otherwise the user can use sigwaitinfo(2) and sigtimedwait(2) to get signal information. In either case, the system returns the information in a structure of type siginfo_t, which includes the following information:
| Type | Member | Description |
| int | si_signo | |
| int | si_errno | |
| int | si_code | |
| union sigval | si_value | |
| pid_t | si_pid | |
| uid_t | si_uid | |
| void | *si_addr | |
| int | si_status | |
| long | si_band | |
| int | si_trapno | |
| int | si_timerid | |
| int | si_overrun | |
| int | si_mqd | |
| int | si_syscall |
The si_signo member contains the signal number.
The si_errno member contains an error number defined in the file ⟨errno.h⟩.
The si_code member contains a code which describes the cause of the signal. The macros specified in the Code column of the following table are defined for use as values of si_code that are signal-specific or non-signal-specific reasons why the signal was generated:
| Signal | Code | Reason |
| SIGILL | ILL_ILLOPC | |
| ILL_ILLOPN | ||
| ILL_ILLADR | ||
| ILL_ILLTRP | ||
| ILL_PRVOPC | ||
| ILL_PRVREG | ||
| ILL_COPROC | ||
| ILL_BADSTK | ||
| SIGFPE | FPE_INTDIV | |
| FPE_INTOVF | ||
| FPE_FLTDIV | ||
| FPE_FLTOVF | ||
| FPE_FLTUND | ||
| FPE_FLTRES | ||
| FPE_FLTINV | ||
| FPE_FLTSUB | ||
| SIGSEGV | SEGV_MAPERR | |
| SEGV_ACCERR | ||
| SIGBUS | BUS_ADRALN | |
| BUS_ADRERR | ||
| BUS_OBJERR | ||
| BUS_OOMERR | ||
| SIGTRAP | TRAP_BRKPT | |
| TRAP_TRACE | ||
| TRAP_DTRACE | ||
| TRAP_CAP | ||
| SIGCHLD | CLD_EXITED | |
| CLD_KILLED | ||
| CLD_DUMPED | ||
| CLD_TRAPPED | ||
| CLD_STOPPED | ||
| CLD_CONTINUED | ||
| SIGPOLL | POLL_IN | |
| POLL_OUT | ||
| POLL_MSG | ||
| POLL_ERR | ||
| POLL_PRI | ||
| POLL_HUP | ||
| Any | SI_NOINFO | |
| SI_USER | ||
| SI_QUEUE | ||
| SI_TIMER | ||
| SI_ASYNCIO | ||
| SI_MESGQ | ||
| SI_KERNEL | ||
| SI_LWP |
For synchronous signals, si_addr is generally set to the address of the faulting instruction. However, synchronous signals raised by a faulting memory access such as SIGSEGV and SIGBUS may report the address of the faulting memory access (if available) in si_addr instead. Additionally SIGTRAP raised by a hardware watchpoint exception may report the data address that triggered the watchpoint in si_addr.
Synchronous signals set si_trapno to a machine-dependent trap number.
In addition, the following signal-specific information is available:
| Signal | Member | Value |
| SIGCHLD | si_pid | |
| si_status | ||
| si_uid | real user ID of the process that sent the signal | |
| SIGPOLL | si_band | band event for |
Finally, the following code-specific information is available:
| Code | Member | Value |
| SI_USER | si_pid | |
| si_uid | ||
| SI_QUEUE | si_value | |
| si_pid | ||
| si_uid | ||
| SI_TIMER | si_value | |
| si_timerid | ||
| si_overrun | ||
| si_errno | ||
| SI_ASYNCIO | si_value | |
| SI_MESGQ | si_value | |
| si_mqd | ||
| SI_LWP | si_pid | |
| si_uid |
NOTES
Currently, the kernel never generates the SIGPOLL signal. SIGCHLD signal is queued when a process changed its status or exited. POSIX Realtime Extensions like aio, timer, and message queue also queue signals. Signals with code SI_USER, SI_KERNEL or SI_LWP are only queued if there are sufficient resources; otherwise, SI_NOINFO results. For some hardware architectures, the exact value of si_addr might not be available.
SEE ALSO
aio_read(2), kill(2), mq_notify(2), sigaction(2), sigqueue(2), sigwaitinfo(2), timer_create(2), timer_settime(2), waitpid(2), pthread_kill(3)
STANDARDS
The siginfo_t type conforms to IEEE Std 1003.1-2004 (“POSIX.1”).
HISTORY
Full support for POSIX signal information first appeared in FreeBSD 7.0. The codes SI_USER and SI_KERNEL can be generated as of FreeBSD 8.1. The code SI_LWP can be generated as of FreeBSD 9.0.
AUTHORS
This manual page was written by David Xu ⟨[email protected]⟩.