'\" te .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright 1989 AT&T .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] .TH siginfo.h 3HEAD "5 Feb 2008" "SunOS 5.11" "Headers" .SH NAME siginfo.h, siginfo \- signal generation information .SH SYNOPSIS .LP .nf #include .fi .SH DESCRIPTION .sp .LP If a process is catching a signal, it might request information that tells why the system generated that signal. See \fBsigaction\fR(2). If a process is monitoring its children, it might receive information that tells why a child changed state. See \fBwaitid\fR(2). In either case, the system returns the information in a structure of type \fBsiginfo_t\fR, which includes the following information: .sp .in +2 .nf int si_signo /* signal number */ int si_errno /* error number */ int si_code /* signal code */ union sigval si_value /* signal value */ .fi .in -2 .sp .LP \fBsi_signo\fR contains the system-generated signal number. For the \fBwaitid\fR(2) function, \fBsi_signo\fR is always \fBSIGCHLD\fR. .sp .LP If \fBsi_errno\fR is non-zero, it contains an error number associated with this signal, as defined in \fB\fR\&. .sp .LP \fBsi_code\fR contains a code identifying the cause of the signal. .sp .LP If the value of the \fBsi_code\fR member is \fBSI_NOINFO,\fR only the \fBsi_signo\fR member of \fBsiginfo_t\fR is meaningful, and the value of all other members is unspecified. .SS "User Signals" .sp .LP If the value of \fBsi_code\fR is less than or equal to 0, then the signal was generated by a user process (see \fBkill\fR(2), \fB_lwp_kill\fR(2), \fBsigqueue\fR(3C), \fBsigsend\fR(2), \fBabort\fR(3C), and \fBraise\fR(3C)) and the \fBsiginfo\fR structure contains the following additional information: .sp .in +2 .nf pid_t si_pid /* sending process ID */ uid_t si_uid /* sending user ID */ ctid_t si_ctid /* sending contract ID */ zoneid_t si_zoneid /* sending zone ID */S .fi .in -2 .sp .LP If the signal was generated by a user process, the following values are defined for \fBsi_code\fR: .sp .ne 2 .mk .na \fB\fBSI_USER\fR \fR .ad .RS 15n .rt The implementation sets \fBsi_code\fR to \fBSI_USER\fR if the signal was sent by \fBkill\fR(2), \fBsigsend\fR(2), \fBraise\fR(3C) or \fBabort\fR(3C). .RE .sp .ne 2 .mk .na \fB\fBSI_LWP\fR \fR .ad .RS 15n .rt The signal was sent by \fB_lwp_kill\fR(2). .RE .sp .ne 2 .mk .na \fB\fBSI_QUEUE\fR \fR .ad .RS 15n .rt The signal was sent by \fBsigqueue\fR(3C). .RE .sp .ne 2 .mk .na \fB\fBSI_TIMER\fR \fR .ad .RS 15n .rt The signal was generated by the expiration of a timer created by \fBtimer_settime\fR(3C). .RE .sp .ne 2 .mk .na \fB\fBSI_ASYNCIO\fR \fR .ad .RS 15n .rt The signal was generated by the completion of an asynchronous \fBI/O\fR request. .RE .sp .ne 2 .mk .na \fB\fBSI_MESGQ\fR \fR .ad .RS 15n .rt The signal was generated by the arrival of a message on an empty message queue. See \fBmq_notify\fR(3C). .RE .sp .LP \fBsi_value\fR contains the application specified value, which is passed to the application's signal-catching function at the time of the signal delivery if \fBsi_code\fR is any of \fBSI_QUEUE\fR, \fBSI_TIMER\fR, \fBSI_ASYNCHIO\fR, or \fBSI_MESGQ\fR. .SS "System Signals" .sp .LP Non-user generated signals can arise for a number of reasons. For all of these cases, \fBsi_code\fR contains a positive value reflecting the reason why the system generated the signal: .sp .sp .TS tab(); lw(1.24i) lw(1.74i) lw(2.53i) lw(1.24i) lw(1.74i) lw(2.53i) . SignalCodeReason _ SIGILLILL_ILLOPCillegal opcode ILL_ILLOPNillegal operand ILL_ILLADRillegal addressing mode ILL_ILLTRPillegal trap ILL_PRVOPCprivileged opcode ILL_PRVREGprivileged register ILL_COPROCco-processor error ILL_BADSTKinternal stack error _ SIGFPEFPE_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 _ SIGSEGVSEGV_MAPERRaddress not mapped to object SEGV_ACCERRinvalid permissions for mapped object _ SIGBUSBUS_ADRALNinvalid address alignment BUS_ADRERRnon-existent physical address BUS_OBJERRobject specific hardware error _ SIGTRAPTRAP_BRKPTprocess breakpoint TRAP_TRACEprocess trace trap _ SIGCHLDCLD_EXITEDchild has exited CLD_KILLEDchild was killed CLD_DUMPEDchild terminated abnormally CLD_TRAPPEDtraced child has trapped CLD_STOPPEDchild has stopped CLD_CONTINUEDstopped child had continued _ SIGPOLLPOLL_INdata input available POLL_OUToutput buffers available POLL_MSGinput message available POLL_ERRI/O error POLL_PRIhigh priority input available POLL_HUPdevice disconnected .TE .sp .LP Signals can also be generated from the resource control subsystem. Where these signals do not already possess kernel-level \fBsiginfo\fR codes, the \fBsiginfo\fR \fBsi_code\fR will be filled with \fBSI_RCTL\fR to indicate a kernel-generated signal from an established resource control value. .sp .sp .TS tab(); cw(1.19i) cw(1.65i) cw(2.65i) lw(1.19i) lw(1.65i) lw(2.65i) . SignalCodeReason _ SIGXRESSI_RCTLresource-control generated signal _ SIGHUP SIGTERM .TE .sp .LP The uncatchable signals \fBSIGSTOP\fR and \fBSIGKILL\fR have undefined \fBsiginfo\fR codes. .sp .LP Signals sent with a \fBsiginfo\fR code of \fBSI_RCTL\fR contain code-dependent information for kernel-generated signals: .sp .sp .TS tab(); cw(1.19i) cw(1.65i) cw(2.65i) lw(1.19i) lw(1.65i) lw(2.65i) . Code FieldValue _ SI_RCTLhr_time si_entityprocess-model entity of control .TE .sp .LP In addition, the following signal-dependent information is available for kernel-generated signals: .sp .sp .TS tab(); cw(1.19i) cw(1.67i) cw(2.64i) lw(1.19i) lw(1.67i) lw(2.64i) . SignalFieldValue _ SIGILLcaddr_t si_addraddress of faulting instruction _ SIGFPE _ SIGSEGVcaddr_t si_addraddress of faulting memory reference SIGBUS _ SIGCHLDpid_t si_pidchild process ID int si_statusexit value or signal _ SIGPOLLlong si_bandT{ band event for \fBPOLL_IN\fR, \fBPOLL_OUT\fR, or \fBPOLL_MSG\fR T} .TE .SH SEE ALSO .sp .LP \fB_lwp_kill\fR(2), \fBkill\fR(2), \fBsetrctl\fR(2), \fBsigaction\fR(2), \fBsigsend\fR(2), \fBwaitid\fR(2), \fBabort\fR(3C), \fBaio_read\fR(3C), \fBmq_notify\fR(3C), \fBraise\fR(3C), \fBsignal.h\fR(3HEAD), \fBsigqueue\fR(3C), \fBtimer_create\fR(3C), \fBtimer_settime\fR(3C) .SH NOTES .sp .LP For \fBSIGCHLD\fR signals, if \fBsi_code\fR is equal to \fBCLD_EXITED,\fR then \fBsi_status\fR 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 \fBsi_addr\fR might not be available; in that case, \fBsi_addr\fR is guaranteed to be on the same page as the faulting instruction or memory reference.