siginfo(3)

siginfo3

Signal generation information

Usage

#include <signal.h>

Overview

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:

TypeMemberDescription
intsi_signo
intsi_errno
intsi_code
union sigvalsi_value
pid_tsi_pid
uid_tsi_uid
void*si_addr
intsi_status
longsi_band
intsi_trapno
intsi_timerid
intsi_overrun
intsi_mqd
intsi_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:

SignalCodeReason
SIGILLILL_ILLOPC
ILL_ILLOPN
ILL_ILLADR
ILL_ILLTRP
ILL_PRVOPC
ILL_PRVREG
ILL_COPROC
ILL_BADSTK
SIGFPEFPE_INTDIV
FPE_INTOVF
FPE_FLTDIV
FPE_FLTOVF
FPE_FLTUND
FPE_FLTRES
FPE_FLTINV
FPE_FLTSUB
SIGSEGVSEGV_MAPERR
SEGV_ACCERR
SIGBUSBUS_ADRALN
BUS_ADRERR
BUS_OBJERR
BUS_OOMERR
SIGTRAPTRAP_BRKPT
TRAP_TRACE
TRAP_DTRACE
TRAP_CAP
SIGCHLDCLD_EXITED
CLD_KILLED
CLD_DUMPED
CLD_TRAPPED
CLD_STOPPED
CLD_CONTINUED
SIGPOLLPOLL_IN
POLL_OUT
POLL_MSG
POLL_ERR
POLL_PRI
POLL_HUP
AnySI_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:

SignalMemberValue
SIGCHLDsi_pid
si_status
si_uidreal user ID of the process that sent the signal
SIGPOLLsi_bandband event for

Finally, the following code-specific information is available:

CodeMemberValue
SI_USERsi_pid
si_uid
SI_QUEUEsi_value
si_pid
si_uid
SI_TIMERsi_value
si_timerid
si_overrun
si_errno
SI_ASYNCIOsi_value
SI_MESGQsi_value
si_mqd
SI_LWPsi_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.

Releases

44 releases since FreeBSD 7.0-RELEASE; the text changed 34 times.

  1. 7.0
  2. 7.1
  3. 7.2
  4. 7.3
  5. 7.4
  6. 8.0
  7. 8.1
  8. 8.2
  9. 8.3
  10. 8.4
  11. 9.0
  12. 9.1
  13. 9.2
  14. 9.3
  15. 10.0
  16. 10.1
  17. 10.2
  18. 10.3
  19. 10.4
  20. 11.0
  21. 11.1
  22. 11.2
  23. 11.3
  24. 11.4
  25. 12.0
  26. 12.1
  27. 12.2
  28. 12.3
  29. 12.4
  30. 13.0–13.2
  31. 13.3–13.5
  32. 14.0–14.3
  33. 14.4–14.5
  34. 15.0
  35. 15.1–16.0

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]⟩.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.