'\"macro stdmacro
.if n .pH g5.siginfo @(#)siginfo	40.16 of 12/1/89
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} siginfo 5 "" "\&"
.if \nX=1 .ds x} siginfo 5 ""
.if \nX=2 .ds x} siginfo 5 "" "\&"
.if \nX=3 .ds x} siginfo "" "" "\&"
.TH \*(x}
.SH NAME
\f4siginfo\f1 \- signal generation information
.SH SYNOPSIS
\f4#include <siginfo.h>\f1
.SH DESCRIPTION
If a process is catching a signal, 
it may request information that tells
why the system generated that signal [see \f4sigaction\fP(2)].
If a process is monitoring its children, it may receive information
that tells why a child changed state [see \f4waitid\fP(2)].
In either case, the system returns the information in
a structure of type \f4siginfo_t\f1, which includes the following
information:
.P
.RS
.ft 4
.nf
int si_signo	/* signal number */
int si_errno	/* error number */
int si_code	/* signal code */
.fi
.ft 1
.RE
.PP
\f4si_signo\f1
contains the system-generated signal number.
(For the \f4waitid\fP(2) function, \f4si_signo\f1 is always \f4SIGCHLD\fP.)
.PP
If \f4si_errno\f1 is non-zero, it contains an error number
associated with this signal, as defined in \f4errno.h\f1.
.PP
\f4si_code\f1
contains a code identifying the cause of the signal.
If the value of 
\f4si_code\fP
is less than or equal to 0, then the signal was generated by a user
process [see 
\f4kill\fP(2)
and
\f4sigsend\fP(2)]
and the \f4siginfo\fP structure contains the following additional information:
.P
.RS
.ft 4
.nf
pid_t si_pid	/* sending process ID */
uid_t si_uid	/* sending user ID */
.fi
.ft 1
.RE
.PP
Otherwise, 
\f4si_code\fP
contains a signal-specific reason why the signal was generated, as follows:
.PP
.TS H
center;
l l l
lf4 lf4 l.
Signal	Code	Reason
_
.TH
SIGILL	ILL_ILLOPC	illegal opcode
	ILL_ILLOPN	illegal operand
	ILL_ILLADR	illegal addressing mode
	ILL_ILLTRP	illegal trap
	ILL_PRVOPC	privileged opcode
	ILL_PRVREG	privileged register
	ILL_COPROC	coprocessor error
	ILL_BADSTK	internal stack error
.sp .5
_
SIGFPE	FPE_INTDIV	integer divide by zero
	FPE_INTOVF	integer overflow
	FPE_FLTDIV	floating point divide by zero
	FPE_FLTOVF	floating point overflow
	FPE_FLTUND	floating point underflow
	FPE_FLTRES	floating point inexact result
	FPE_FLTINV	invalid floating point operation
	FPE_FLTSUB	subscript out of range
.sp .5
SIGSEGV	SEGV_MAPERR	address not mapped to object
	SEGV_ACCERR	invalid permissions for mapped object
.sp .5
_
SIGBUS	BUS_ADRALN	invalid address alignment
	BUS_ADRERR	non-existent physical address
	BUS_OBJERR	object specific hardware error
.sp .5
_
SIGTRAP	TRAP_BRKPT	process breakpoint
	TRAP_TRACE	process trace trap
.sp .5
_
SIGCHLD	CLD_EXITED	child has exited
	CLD_KILLED	child was killed
	CLD_DUMPED	child terminated abnormally
	CLD_TRAPPED	traced child has trapped
	CLD_STOPPED	child has stopped
	CLD_CONTINUED	stopped child had continued
.sp .5
_
SIGPOLL	POLL_IN	data input available
	POLL_OUT	output buffers available
	POLL_MSG	input message available
	POLL_ERR	I/O error
	POLL_PRI	high priority input available
	POLL_HUP	device disconnected
.TE
.PP
In addition, the following signal-dependent information is available
for kernel-generated signals:
.PP
.TS
center;
c c c
_ _ _
lf4 lf4 l.
Signal	Field	Value
SIGILL	caddr_t si_addr	address of faulting instruction 
SIGFPE
_
SIGSEGV	caddr_t si_addr	address of faulting memory reference
SIGBUS
_
SIGCHLD	pid_t si_pid	child process \s-1ID\s+1
	int si_status	exit value or signal
_
SIGPOLL	long si_band	band event for \f4POLL_IN\f1, \f4POLL_OUT\f1, or
		\f4POLL_MSG\f1
.TE
.SH SEE ALSO
\f4sigaction\fP(2), \f4waitid\fP(2), \f4signal\fP(5).
.SH NOTES
For \f4SIGCHLD\fP signals, if \f4si_code\f1 is equal to \f4CLD_EXITED\fP, then 
\f4si_status\f1 is equal to the exit value of the process;
otherwise, it is equal to the signal that caused the process to 
change state.
For some implementations, the exact value of \f4si_addr\f1 may not
be available; in that case, \f4si_addr\f1 is guaranteed to be on the
same page as the faulting instruction or memory reference.
.\"	@(#)siginfo.5	1 of 9/28/88
.Ee
