SIGINFO(3)
π NAME π
<pink>siginfo</pink> β signal generation information. Bestie, this is SIGINFO(3) from the Library Functions Manual, and it's literally the whole rundown on why the system sent you a signal. β¨
πΈ SYNOPSIS πΈ
#include <signal.h>
π¦ DESCRIPTION π¦
Okay so picture this: 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:
intβsi_signoβ signal numberintβsi_errnoβ error numberintβsi_codeβ signal codeunion sigvalβsi_valueβ signal valuepid_tβsi_pidβ sending process IDuid_tβsi_uidβ sending process's real user IDvoid *βsi_addrβ virtual addressintβsi_statusβ exit value or signallongβsi_bandβ band event forSIGPOLLintβsi_trapnoβ machine trap codeintβsi_timeridβ POSIX timer IDintβsi_overrunβ POSIX timer overrun countintβsi_mqdβ POSIX message queue IDintβsi_syscallβ system-call number for system calls blocked by Capsicum
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:
SIGILLILL_ILLOPCβ illegal opcodeILL_ILLOPNβ illegal operandILL_ILLADRβ illegal addressing modeILL_ILLTRPβ illegal trapILL_PRVOPCβ illegal privileged opcodeILL_PRVREGβ illegal privileged registerILL_COPROCβ coprocessor errorILL_BADSTKβ internal stack error
SIGFPEFPE_INTDIVβ integer divide by zeroFPE_INTOVFβ integer overflowFPE_FLTDIVβ floating-point divide by zeroFPE_FLTOVFβ floating-point overflowFPE_FLTUNDβ floating-point underflowFPE_FLTRESβ floating-point inexact resultFPE_FLTINVβ invalid floating-point operationFPE_FLTSUBβ subscript out of range
SIGSEGVSEGV_MAPERRβ address not mapped to objectSEGV_ACCERRβ invalid permissions for mapped object
SIGBUSBUS_ADRALNβ invalid address alignmentBUS_ADRERRβ nonexistent physical addressBUS_OBJERRβ object-specific hardware errorBUS_OOMERRβ cannot alloc a page to map at fault
SIGTRAPTRAP_BRKPTβ process breakpointTRAP_TRACEβ process trace trapTRAP_DTRACEβ DTrace induced trapTRAP_CAPβ capabilities protective trap
SIGCHLDCLD_EXITEDβ child has exitedCLD_KILLEDβ child has terminated abnormally and did not create a core fileCLD_DUMPEDβ child has terminated abnormally and created a core fileCLD_TRAPPEDβ traced child has trappedCLD_STOPPEDβ child has stoppedCLD_CONTINUEDβ stopped child has continued
SIGPOLLPOLL_INβ data input availablePOLL_OUTβ output buffers availablePOLL_MSGβ input message availablePOLL_ERRβ I/O errorPOLL_PRIβ high priority input availablePOLL_HUPβ device disconnected
- Any
SI_NOINFOβ Only thesi_signomember is meaningful; the value of all other members is unspecified.SI_USERβ signal sent bykill(2)SI_QUEUEβ signal sent bysigqueue(2)SI_TIMERβ signal generated by expiration of a timer set bytimer_settime(2)SI_ASYNCIOβ signal generated by completion of an asynchronous I/O requestSI_MESGQβ signal generated by arrival of a message on an empty message queueSI_KERNELβ signal generated by miscellaneous parts of the kernelSI_LWPβ signal sent bypthread_kill(3)
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:
SIGCHLDsi_pidβ child process IDsi_statusβ exit value or signal; ifsi_codeis equal toCLD_EXITED, then it is equal to the exit value of the child process, otherwise, it is equal to a signal that caused the child process to change state.si_uidβ real user ID of the process that sent the signal
SIGPOLLsi_bandβ band event forPOLL_IN,POLL_OUT, orPOLL_MSG
Finally, the following code-specific information is available:
SI_USERsi_pidβ the process ID that sent the signalsi_uidβ real user ID of the process that sent the signal
SI_QUEUEsi_valueβ the value passed tosigqueue(2)system callsi_pidβ the process ID that sent the signalsi_uidβ real user ID of the process that sent the signal
SI_TIMERsi_valueβ the value passed totimer_create(2)system callsi_timeridβ the timer ID returned bytimer_create(2)system callsi_overrunβ timer overrun count corresponding to the signalsi_errnoβ If timer overrun will be{DELAYTIMER_MAX}, an error code defined in<errno.h>is set
SI_ASYNCIOsi_valueβ the value passed to aio system calls
SI_MESGQsi_valueβ the value passed tomq_notify(2)system callsi_mqdβ the ID of the message queue which generated the signal
SI_LWPsi_pidβ the process ID that sent the signalsi_uidβ real user ID of the process that sent the signal
π NOTES π
Okay, some tea: 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β). Periodt. π
π§ 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 <davidxu@FreeBSD.org>. Iconic. π
π And that's the tea: this page comes from the Debian source, dated February 17, 2021, and it's SIGINFO(3) β mwah, bestie! π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2005 David Xu <davidxu@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms