1.\" $NetBSD: siginfo.2,v 1.7 2015/02/27 15:21:54 riastradh Exp $ 2.\" 3.\" Copyright (c) 2003 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Christos Zoulas. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28.\" POSSIBILITY OF SUCH DAMAGE. 29.\" 30.Dd April 23, 2012 31.Dt SIGINFO 2 32.Os 33.Sh NAME 34.Nm siginfo 35.Nd signal information 36.Sh SYNOPSIS 37.In signal.h 38.Sh DESCRIPTION 39.Nm 40is a structure type which contains information about a signal delivered 41to a process. 42.Pp 43.Nm 44includes the following members: 45.Bd -literal -offset indent 46int si_signo; 47int si_errno; 48int si_code; 49.Ed 50.Pp 51.Fa si_signo 52contains the signal number generated by the system. 53.Pp 54If 55.Fa si_errno 56is non-zero, then it contains a system specific error number associated 57with this signal. 58This number is defined in 59.Xr errno 2 . 60.Pp 61If 62.Fa si_code 63is less than or equal to zero, the signal was generated by a user process 64or a user requested service: 65.Bl -tag -width SI_ASYNCIO 66.It SI_USER 67The signal was generated via 68.Xr kill 2 . 69The 70.Nm 71structure contains the following additional members: 72.Bd -literal -offset indent 73pid_t si_pid; 74uid_t si_uid; 75.Ed 76.Pp 77The 78.Fa si_pid 79field contains the pid of the sending process and the 80.Fa si_uid 81field contains the user id of the sending process. 82.\" .It SI_QUEUE 83.\" The signal was generated via 84.\" .Xr sigqueue 3 . 85.\" The 86.\" .Nm 87.\" structure contains the following additional members: 88.\" .Bd -literal -offset indent 89.\" pid_t si_pid; 90.\" uid_t si_uid; 91.\" sigval_t si_value; 92.\" .Ed 93.\" .Pp 94.\" The 95.\" .Fa si_pid 96.\" field contains the pid of the sending process and the 97.\" .Fa si_uid 98.\" field contains the user id of the sending process. 99.\" Finally, the 100.\" .Fa si_value 101.\" field contains the value sent via 102.\" .Xr sigqueue 3 . 103.It SI_TIMER 104The signal was generated because a timer set by 105.Xr timer_settime 2 106has expired. 107The 108.Nm 109structure contains the following additional members: 110.Bd -literal -offset indent 111sigval_t si_value; 112.Ed 113.Pp 114The 115.Fa si_value 116field contains the value set via 117.Xr timer_create 2 . 118.It SI_ASYNCIO 119The signal was generated by completion of an asynchronous I/O operation. 120The 121.Nm 122structure contains the following additional members: 123.Bd -literal -offset indent 124int si_fd; 125long si_band; 126.Ed 127.Pp 128The 129.Fa si_fd 130argument contains the file descriptor number on which the operation was 131completed and the 132.Fa si_band 133field contains the side and priority of the operation. 134If the operation was a normal read, 135.Fa si_band 136will contain 137.Dv POLLIN | POLLRDNORM ; 138on an out-of-band read it will contain 139.Dv POLLPRI | POLLRDBAND ; 140on a normal write it will contain 141.Dv POLLOUT | POLLWRNORM ; 142on an out-of-band write it will contain 143.Dv POLLPRI | POLLWRBAND . 144.\" .It SI_MESGQ 145.\" The signal was generated because of the arrival of a message on an empty 146.\" message queue. 147.\" See 148.\" .Xr mq_notify 3 . 149.El 150.Pp 151If 152.Fa si_code 153is positive, then it contains a signal specific reason 154why the signal was generated: 155.Bl -tag -width SIGCHLD 156.It SIGILL 157.Bl -tag -width ILL_ILLOPC 158.It ILL_ILLOPC 159Illegal opcode 160.It ILL_ILLOPN 161Illegal operand 162.It ILL_ILLADR 163Illegal addressing mode 164.It ILL_ILLTRP 165Illegal trap 166.It ILL_PRVOPC 167Privileged opcode 168.It ILL_PRVREG 169Privileged register 170.It ILL_COPROC 171Coprocessor error 172.It ILL_BADSTK 173Internal stack error 174.El 175.It SIGFPE 176.Bl -tag -width FPE_INTDIV 177.It FPE_INTDIV 178Integer divide by zero 179.It FPE_INTOVF 180Integer overflow 181.It FPE_FLTDIV 182Floating-point divide by zero 183.It FPE_FLTOVF 184Floating-point overflow 185.It FPE_FLTUND 186Floating-point underflow 187.It FPE_FLTRES 188Floating-point inexact result 189.It FPE_FLTINV 190Invalid floating-point operation 191.It FPE_FLTSUB 192Subscript out of range 193.El 194.It SIGSEGV 195.Bl -tag -width SEGV_MAPERR 196.It SEGV_MAPERR 197Address not mapped to object 198.It SEGV_ACCERR 199Invalid permissions for mapped object 200.El 201.It SIGBUS 202.Bl -tag -width BUS_ADRALN 203.It BUS_ADRALN 204Invalid address alignment 205.It BUS_ADRERR 206Nonexistent physical address 207.It BUS_OBJERR 208Object-specific hardware error 209.El 210.It SIGTRAP 211.Bl -tag -width TRAP_BRKPT 212.It TRAP_BRKPT 213Process breakpoint 214.It TRAP_TRACE 215Process trace trap 216.El 217.It SIGCHLD 218.Bl -tag -width CLD_CONTINUED 219.It CLD_EXITED 220Child has exited 221.It CLD_KILLED 222Child has terminated abnormally but did not create a core file 223.It CLD_DUMPED 224Child has terminated abnormally and created a core file 225.It CLD_TRAPPED 226Traced child has trapped 227.It CLD_STOPPED 228Child has stopped 229.It CLD_CONTINUED 230Stopped child has continued 231.El 232.It SIGPOLL 233.Bl -tag -width POLL_OUT 234.It POLL_IN 235Data input available 236.It POLL_OUT 237Output buffers available 238.It POLL_MSG 239Input message available 240.It POLL_ERR 241I/O error 242.It POLL_PRI 243High priority input available 244.It POLL_HUP 245Device disconnected 246.El 247.El 248.Pp 249For 250.Dv SIGILL , SIGFPE , 251and 252.Dv SIGTRAP 253the 254.Nm 255structure contains the following additional members: 256.Bd -literal -offset indent 257void *si_addr; 258int si_trap; 259.Ed 260.Pp 261.Fa si_addr 262contains the address of the faulting instruction and 263.Fa si_trap 264contains a hardware specific reason. 265.Pp 266For 267.Dv SIGBUS 268and 269.Dv SIGSEGV 270the 271.Nm 272structure contains the following additional members: 273.Bd -literal -offset indent 274void *si_addr; 275int si_trap; 276.Ed 277.Pp 278.Fa si_addr 279contains the address of the faulting data and 280.Fa si_trap 281contains a hardware specific reason. 282.Pp 283For some architectures 284the value of 285.Fa si_addr 286may be inaccurate. 287.Pp 288For 289.Dv SIGPOLL 290the 291.Nm 292structure contains the following additional members: 293.Bd -literal -offset indent 294int si_fd; 295long si_band; 296.Ed 297.Pp 298The 299.Fa si_fd 300argument contains the file descriptor number on which the operation was 301completed and the 302.Fa si_band 303field contains the side and priority of the operation as described above. 304.Pp 305Finally, for 306.Dv SIGCHLD 307the 308.Nm 309structure contains the following additional members: 310.Bd -literal -offset indent 311pid_t si_pid; 312uid_t si_uid; 313int si_status; 314clock_t si_utime; 315clock_t si_stime; 316.Ed 317.Pp 318The 319.Fa si_pid 320field contains the pid of the process who's status changed, the 321.Fa si_uid 322field contains the user id of the that process, the 323.Fa si_status 324field contains a status code described in 325.Xr waitpid 2 , 326and the 327.Fa si_utime 328and 329.Fa si_stime 330fields contain the user and system process accounting time. 331.Sh STANDARDS 332The 333.Nm 334type conforms to 335.St -xsh5 . 336.Sh HISTORY 337The 338.Nm 339functionality first appeared in 340.At V.4 . 341