tail head cat sleep
QR code linking to this page

Manual Pages  — SIGINFO

NAME

siginfo – signal generation information

CONTENTS

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_signosignal number

int
si_errnoerror number

int
si_codesignal code

union sigval
si_valuesignal value

pid_t
si_pidsending process ID

uid_t
si_uidsending process's real user ID

void
*si_addraddress of faulting instruction

int
si_statusexit value or signal

long
si_bandband event for SIGPOLL

int
si_trapnomachine trap code

int
si_timerid POSIX timer ID

int
si_overrun POSIX timer overrun count

int
si_mqd POSIX message queue ID

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_ILLOPCillegal opcode
ILL_ILLOPNillegal operand
ILL_ILLADRillegal addressing mode
ILL_ILLTRPillegal trap
ILL_PRVOPCillegal privileged opcode
ILL_PRVREGillegal privileged register
ILL_COPROCcoprocessor error
ILL_BADSTKinternal stack error
SIGFPE FPE_INTDIVinteger divide by zero
FPE_INTOVFinteger overflow
FPE_FLTDIVfloating-point divide by zero
FPE_FLTOVFfloating-point overflow
FPE_FLTUNDfloating-point underflow
FPE_FLTRESfloating-point inexact result
FPE_FLTINVinvalid floating-point operation
FPE_FLTSUBsubscript out of range
SIGSEGV SEGV_MAPERRaddress not mapped to object
SEGV_ACCERRinvalid permissions for mapped object
SIGBUS BUS_ADRALNinvalid address alignment
BUS_ADRERRnonexistent physical address
BUS_OBJERRobject-specific hardware error
SIGTRAP TRAP_BRKPTprocess breakpoint
TRAP_TRACEprocess trace trap
TRAP_DTRACEDTrace induced trap
TRAP_CAPcapabilities protective trap
SIGCHLD CLD_EXITEDchild has exited
CLD_KILLEDchild has terminated abnormally and did not create a core file
CLD_DUMPEDchild has terminated abnormally and created a core file
CLD_TRAPPEDtraced child has trapped
CLD_STOPPEDchild has stopped
CLD_CONTINUEDstopped child has continued
SIGPOLL POLL_INdata input available
POLL_OUToutput buffers available
POLL_MSGinput message available
POLL_ERRI/O error
POLL_PRIhigh priority input available
POLL_HUPdevice disconnected

Any
SI_NOINFOOnly the si_signo member is meaningful; the value of all other members is unspecified.
SI_USERsignal sent by kill(2)
SI_QUEUEsignal sent by sigqueue(2)
SI_TIMERsignal generated by expiration of a timer set by timer_settime(2)
SI_ASYNCIOsignal generated by completion of an asynchronous I/O request
SI_MESGQsignal generated by arrival of a message on an empty message queue
SI_KERNELsignal generated by miscellaneous parts of the kernel
SI_LWPsignal sent by pthread_kill(3)

In addition, the following signal-specific information is available:
Signal Member Value
SIGILL si_addraddress of faulting instruction
si_trapnomachine dependent of trap code
SIGFPE si_addraddress of faulting instruction
si_trapnomachine dependent of trap code
SIGSEGV si_addraddress of faulting memory reference
si_trapnomachine dependent of trap code
SIGBUS si_addraddress of faulting instruction
si_trapnomachine dependent of trap code
SIGCHLD si_pidchild process ID
si_statusexit value or signal; if si_code is equal to CLD_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
SIGPOLL si_band band event for POLL_IN, POLL_OUT, or POLL_MSG

Finally, the following code-specific information is available:
Code Member Value
SI_USER si_pidthe process ID that sent the signal
si_uidreal user ID of the process that sent the signal
SI_QUEUE si_valuethe value passed to sigqueue(2) system call
si_pidthe process ID that sent the signal
si_uidreal user ID of the process that sent the signal
SI_TIMER si_valuethe value passed to timer_create(2) system call
si_timeridthe timer ID returned by timer_create(2) system call
si_overruntimer overrun count corresponding to the signal
si_errnoIf timer overrun will be { DELAYTIMER_MAX}, an error code defined in <errno.h> is set
SI_ASYNCIO si_valuethe value passed to aio system calls
SI_MESGQ si_valuethe value passed to mq_notify(2) system call
si_mqdthe ID of the message queue which generated the signal
SI_LWP si_pidthe process ID that sent the signal
si_uidreal user ID of the process that sent the signal

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 <Mt davidxu@FreeBSD.org>.

SIGINFO (3) April 24, 2018

tail head cat sleep
QR code linking to this page


Please direct any comments about this manual page service to Ben Bullock. Privacy policy.

If you have any trouble sounding condescending, find a Unix user to show you how it's done.
— Scott Adams