xref: /titanic_44/usr/src/man/man3head/siginfo.h.3head (revision 430b4c467020edf2445feb0c21db01c88b86243a)
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]
siginfo.h 3HEAD "5 Feb 2008" "SunOS 5.11" "Headers"
NAME
siginfo.h, siginfo - signal generation information
SYNOPSIS

#include <siginfo.h> 
DESCRIPTION

If a process is catching a signal, it might request information that tells why the system generated that signal. See sigaction(2). If a process is monitoring its children, it might receive information that tells why a child changed state. See waitid(2). In either case, the system returns the information in a structure of type siginfo_t, which includes the following information:

int si_signo /* signal number */
int si_errno /* error number */
int si_code /* signal code */
union sigval si_value /* signal value */

si_signo contains the system-generated signal number. For the waitid(2) function, si_signo is always SIGCHLD.

If si_errno is non-zero, it contains an error number associated with this signal, as defined in <errno.h>.

si_code contains a code identifying the cause of the signal.

If the value of the si_code member is SI_NOINFO, only the si_signo member of siginfo_t is meaningful, and the value of all other members is unspecified.

"User Signals"

If the value of si_code is less than or equal to 0, then the signal was generated by a user process (see kill(2), _lwp_kill(2), sigqueue(3C), sigsend(2), abort(3C), and raise(3C)) and the siginfo structure contains the following additional information:

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

If the signal was generated by a user process, the following values are defined for si_code:

SI_USER

The implementation sets si_code to SI_USER if the signal was sent by kill(2), sigsend(2), raise(3C) or abort(3C).

SI_LWP

The signal was sent by _lwp_kill(2).

SI_QUEUE

The signal was sent by sigqueue(3C).

SI_TIMER

The signal was generated by the expiration of a timer created by timer_settime(3C).

SI_ASYNCIO

The signal was generated by the completion of an asynchronous I/O request.

SI_MESGQ

The signal was generated by the arrival of a message on an empty message queue. See mq_notify(3C).

si_value contains the application specified value, which is passed to the application's signal-catching function at the time of the signal delivery if si_code is any of SI_QUEUE, SI_TIMER, SI_ASYNCHIO, or SI_MESGQ.

"System Signals"

Non-user generated signals can arise for a number of reasons. For all of these cases, si_code contains a positive value reflecting the reason why the system generated the signal:

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

Signals can also be generated from the resource control subsystem. Where these signals do not already possess kernel-level siginfo codes, the siginfo si_code will be filled with SI_RCTL to indicate a kernel-generated signal from an established resource control value.

SignalCodeReason
SIGXRESSI_RCTLresource-control generated signal
SIGHUP
SIGTERM

The uncatchable signals SIGSTOP and SIGKILL have undefined siginfo codes.

Signals sent with a siginfo code of SI_RCTL contain code-dependent information for kernel-generated signals:

Code FieldValue
SI_RCTLhr_time si_entityprocess-model entity of control

In addition, the following signal-dependent information is available for kernel-generated signals:

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_band
band event for POLL_IN, POLL_OUT, or POLL_MSG
SEE ALSO

_lwp_kill(2), kill(2), setrctl(2), sigaction(2), sigsend(2), waitid(2), abort(3C), aio_read(3C), mq_notify(3C), raise(3C), signal.h(3HEAD), sigqueue(3C), timer_create(3C), timer_settime(3C)

NOTES

For SIGCHLD signals, if si_code is equal to CLD_EXITED, then si_status 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 si_addr might not be available; in that case, si_addr is guaranteed to be on the same page as the faulting instruction or memory reference.