SIGINFO(2)
๐ SIGINFO(2) ๐
okay bestie, this is the System Calls Manual page for siginfo โ literally signal information. no cap, itโs the struct that spills the tea about a signal that got delivered to your process ๐ซถ
๐ธ NAME ๐ธ
siginfo โ signal information
โจ SYNOPSIS โจ
#include <signal.h>
๐ DESCRIPTION ๐
<hotpink>siginfo</hotpink> is a structure type, and it contains info about a signal delivered to a process. iconic little data container, honestly ๐
<purple>siginfo</purple> includes these members:
int si_signo;
int si_errno;
int si_code;
si_signoโ contains the signal number generated by the system โญsi_errnoโ if itโs non-zero, then it contains a system specific error number associated with this signal. that number is defined inerrno(2).si_codeโ the main-character field that tells you where the signal came from ๐
if si_code is less than or equal to zero, the signal was generated by a user process or a user requested service. itโs giving โuser-side origin storyโ โจ
๐ซถ SI_USER
the signal was generated via kill(2). the siginfo structure contains these additional members:
pid_t si_pid;
uid_t si_uid;
the si_pid field contains the pid of the sending process, and the si_uid field contains the user id of the sending process ๐
๐ SI_QUEUE
the signal was generated via sigqueue(2). the siginfo structure contains these additional members:
pid_t si_pid;
uid_t si_uid;
sigval_t si_value;
the si_pid field contains the pid of the sending process, and the si_uid field contains the user id of the sending process. finally, the si_value field contains the value sent via sigqueue(2) ๐
โฐ SI_TIMER
the signal was generated because a timer set by timer_settime(2) has expired. the siginfo structure contains this additional member:
sigval_t si_value;
the si_value field contains the value set via timer_create(2) โฑ๏ธ
๐ฆ SI_ASYNCIO
the signal was generated by completion of an asynchronous I/O operation. the siginfo structure contains these additional members:
int si_fd;
long si_band;
the si_fd argument contains the file descriptor number on which the operation was completed, and the si_band field contains the side and priority of the operation.
if the operation was a normal read, si_band will contain POLLIN | POLLRDNORM; on an out-of-band read it will contain POLLPRI | POLLRDBAND; on a normal write it will contain POLLOUT | POLLWRNORM; on an out-of-band write it will contain POLLPRI | POLLWRBAND. slay, extremely specific ๐โจ
๐ฌ SI_MESGQ
the signal was generated because of the arrival of a message on an empty message queue. see mq_notify(3).
๐ SI_LWP
the signal was generated via _lwp_kill(2). the siginfo structure contains these additional members:
pid_t si_pid;
uid_t si_uid;
the si_pid field contains the pid of the sending process, and the si_uid field contains the user id of the sending process ๐ซถ
๐ SI_NOINFO
the signal was generated without specific info available. mysterious. elusive. no notes.
if si_code is positive, then it contains a signal specific reason why the signal was generated ๐
๐ SIGILL
ILL_BADSTKโ Internal stack errorILL_COPROCโ Coprocessor errorILL_ILLADRโ Illegal addressing modeILL_ILLOPCโ Illegal opcodeILL_ILLOPNโ Illegal operandILL_ILLTRPโ Illegal trapILL_PRVOPCโ Privileged opcodeILL_PRVREGโ Privileged register
๐งฎ SIGFPE
FPE_FLTDIVโ Floating-point divide by zeroFPE_FLTINVโ Invalid floating-point operationFPE_FLTOVFโ Floating-point overflowFPE_FLTRESโ Floating-point inexact resultFPE_FLTUNDโ Floating-point underflowFPE_FLTSUBโ Subscript out of rangeFPE_INTDIVโ Integer divide by zeroFPE_INTOVFโ Integer overflow
๐งจ SIGSEGV
SEGV_ACCERRโ Invalid permissions for mapped objectSEGV_MAPERRโ Address not mapped to object
๐ SIGBUS
BUS_ADRALNโ Invalid address alignmentBUS_ADRERRโ Nonexistent physical addressBUS_OBJERRโ Object-specific hardware error
๐ชค SIGTRAP
TRAP_BRKPTโ Process breakpointTRAP_CHLDโ Process child trapTRAP_DBREGโ Process hardware debug register trapTRAP_EXECโ Process exec trapTRAP_LWPโ Process LWP trapTRAP_SCEโ Process syscall entry trapTRAP_SCXโ Process syscall exit trapTRAP_TRACEโ Process trace trap
๐ถ SIGCHLD
CLD_CONTINUEDโ Stopped child has continuedCLD_DUMPEDโ Child has terminated abnormally and created a core fileCLD_EXITEDโ Child has exitedCLD_KILLEDโ Child has terminated abnormally but did not create a core fileCLD_STOPPEDโ Child has stoppedCLD_TRAPPEDโ Traced child has trapped
๐ก SIGIO
POLL_ERRโ I/O errorPOLL_HUPโ Device disconnectedPOLL_INโ Data input availablePOLL_MSGโ Input message availablePOLL_OUTโ Output buffers availablePOLL_PRIโ High priority input available
for SIGILL, SIGFPE, SIGBUS and SIGSEGV the siginfo structure contains these additional members:
void *si_addr;
int si_trap;
si_addr contains the address of the faulting instruction or data, and si_trap contains a hardware specific reason ๐ฅ
for SIGTRAP and TRAP_BRKPT, TRAP_TRACE or TRAP_DBREG the siginfo structure contains these additional members:
void *si_addr;
int si_trap;
si_addr contains the address of the faulting data, and si_trap contains a hardware specific reason ๐
for SIGTRAP and TRAP_SCE or TRAP_SCX the siginfo structure contains these additional members:
int si_sysnum;
int si_retval[2];
int si_error;
uint64_t si_args[8];
si_sysnum contains the syscall number, si_retval contains the syscall return value (meaningful for TRAP_SCX only), si_error contains the syscall error value (meaningful for TRAP_SCX only), and si_args[8] contains the syscall arguments ๐ง
for SIGIO the siginfo structure contains these additional members:
int si_fd;
long si_band;
the si_fd argument contains the file descriptor number on which the operation was completed, and the si_band field contains the side and priority of the operation as described above ๐ก
finally, for SIGCHLD the siginfo structure contains these additional members:
pid_t si_pid;
uid_t si_uid;
int si_status;
clock_t si_utime;
clock_t si_stime;
the si_pid field contains the pid of the process whoโs status changed, the si_uid field contains the user id of that process, and the si_status field contains either the exit code of the process (for CLD_EXITED), or the signal number received by the process. waitid(2), waitpid(2), and the si_utime and si_stime fields contain the user and system process accounting time ๐
๐ฆ STANDARDS ๐ฆ
the <cyan>siginfo</cyan> type conforms to X/Open System Interfaces and Headers Issue 5 (โXSH5โ).
signals specifying SI_LWP or SI_NOINFO are NetBSD extensions.
the TRAP_CHLD, TRAP_DBREG, TRAP_EXEC, TRAP_LWP, TRAP_SCE and TRAP_SCX signal specific reasons of SIGTRAP are NetBSD extensions ๐
๐ HISTORY ๐
the <lavender>siginfo</lavender> functionality first appeared in AT&T System V Release 4 UNIX.
TRAP_CHLD, TRAP_DBREG, TRAP_EXEC, TRAP_LWP, TRAP_SCE and TRAP_SCX first appeared in NetBSD 8.
the additional parameters with syscall information in TRAP_SCE and TRAP_SCX first appeared in NetBSD 9 ๐
thatโs the whole tea, bestie ๐ซถ this page is from Debian, dated May 25, 2019, and itโs SIGINFO(2). go decode those signals and absolutely slay ๐ โจ
๐ฆ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2003 The NetBSD Foundation, Inc
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms