1.\" $NetBSD: siginfo.2,v 1.24 2020/06/08 17:19:44 sevan 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 May 25, 2019 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 83The signal was generated via 84.Xr sigqueue 2 . 85The 86.Nm 87structure contains the following additional members: 88.Bd -literal -offset indent 89pid_t si_pid; 90uid_t si_uid; 91sigval_t si_value; 92.Ed 93.Pp 94The 95.Fa si_pid 96field contains the pid of the sending process and the 97.Fa si_uid 98field contains the user id of the sending process. 99Finally, the 100.Fa si_value 101field contains the value sent via 102.Xr sigqueue 2 . 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 145The signal was generated because of the arrival of a message on an empty 146message queue. 147See 148.Xr mq_notify 3 . 149.It SI_LWP 150The signal was generated via 151.Xr _lwp_kill 2 . 152The 153.Nm 154structure contains the following additional members: 155.Bd -literal -offset indent 156pid_t si_pid; 157uid_t si_uid; 158.Ed 159.Pp 160The 161.Fa si_pid 162field contains the pid of the sending process and the 163.Fa si_uid 164field contains the user id of the sending process. 165.It SI_NOINFO 166The signal was generated without specific info available. 167.El 168.Pp 169If 170.Fa si_code 171is positive, then it contains a signal specific reason 172why the signal was generated: 173.Bl -tag -width SIGCHLD 174.It SIGILL 175.Bl -tag -width ILL_ILLOPC 176.It ILL_BADSTK 177Internal stack error 178.It ILL_COPROC 179Coprocessor error 180.It ILL_ILLADR 181Illegal addressing mode 182.It ILL_ILLOPC 183Illegal opcode 184.It ILL_ILLOPN 185Illegal operand 186.It ILL_ILLTRP 187Illegal trap 188.It ILL_PRVOPC 189Privileged opcode 190.It ILL_PRVREG 191Privileged register 192.El 193.It SIGFPE 194.Bl -tag -width FPE_INTDIV 195.It FPE_FLTDIV 196Floating-point divide by zero 197.It FPE_FLTINV 198Invalid floating-point operation 199.It FPE_FLTOVF 200Floating-point overflow 201.It FPE_FLTRES 202Floating-point inexact result 203.It FPE_FLTUND 204Floating-point underflow 205.It FPE_FLTSUB 206Subscript out of range 207.It FPE_INTDIV 208Integer divide by zero 209.It FPE_INTOVF 210Integer overflow 211.El 212.It SIGSEGV 213.Bl -tag -width SEGV_MAPERR 214.It SEGV_ACCERR 215Invalid permissions for mapped object 216.It SEGV_MAPERR 217Address not mapped to object 218.El 219.It SIGBUS 220.Bl -tag -width BUS_ADRALN 221.It BUS_ADRALN 222Invalid address alignment 223.It BUS_ADRERR 224Nonexistent physical address 225.It BUS_OBJERR 226Object-specific hardware error 227.El 228.It SIGTRAP 229.Bl -tag -width TRAP_BRKPT 230.It TRAP_BRKPT 231Process breakpoint 232.It TRAP_CHLD 233Process child trap 234.It TRAP_DBREG 235Process hardware debug register trap 236.It TRAP_EXEC 237Process exec trap 238.It TRAP_LWP 239Process LWP trap 240.It TRAP_SCE 241Process syscall entry trap 242.It TRAP_SCX 243Process syscall exit trap 244.It TRAP_TRACE 245Process trace trap 246.El 247.It SIGCHLD 248.Bl -tag -width CLD_CONTINUED 249.It CLD_CONTINUED 250Stopped child has continued 251.It CLD_DUMPED 252Child has terminated abnormally and created a core file 253.It CLD_EXITED 254Child has exited 255.It CLD_KILLED 256Child has terminated abnormally but did not create a core file 257.It CLD_STOPPED 258Child has stopped 259.It CLD_TRAPPED 260Traced child has trapped 261.El 262.It SIGIO 263.Bl -tag -width POLL_OUT 264.It POLL_ERR 265I/O error 266.It POLL_HUP 267Device disconnected 268.It POLL_IN 269Data input available 270.It POLL_MSG 271Input message available 272.It POLL_OUT 273Output buffers available 274.It POLL_PRI 275High priority input available 276.El 277.El 278.Pp 279For 280.Dv SIGILL , 281.Dv SIGFPE , 282.Dv SIGBUS 283and 284.Dv SIGSEGV 285the 286.Nm 287structure contains the following additional members: 288.Bd -literal -offset indent 289void *si_addr; 290int si_trap; 291.Ed 292.Pp 293.Fa si_addr 294contains the address of the faulting instruction or data and 295.Fa si_trap 296contains a hardware specific reason. 297.Pp 298For 299.Dv SIGTRAP 300and 301.Dv TRAP_BRKPT , 302.Dv TRAP_TRACE 303or 304.Dv TRAP_DBREG 305the 306.Nm 307structure contains the following additional members: 308.Bd -literal -offset indent 309void *si_addr; 310int si_trap; 311.Ed 312.Pp 313.Fa si_addr 314contains the address of the faulting data and 315.Fa si_trap 316contains a hardware specific reason. 317.Pp 318For 319.Dv SIGTRAP 320and 321.Dv TRAP_SCE 322or 323.Dv TRAP_SCX 324the 325.Nm 326structure contains the following additional members: 327.Bd -literal -offset indent 328int si_sysnum; 329int si_retval[2]; 330int si_error; 331uint64_t si_args[8]; 332.Ed 333.Pp 334.Fa si_sysnum 335contains the syscall number, 336.Fa si_retval 337contains the syscall return value (meaningful for 338.Dv TRAP_SCX 339only), 340.Fa si_error 341contains the syscall error value (meaningful for 342.Dv TRAP_SCX 343only) and 344.Fa si_args[8] 345contains the syscall arguments, 346.Pp 347For 348.Dv SIGIO 349the 350.Nm 351structure contains the following additional members: 352.Bd -literal -offset indent 353int si_fd; 354long si_band; 355.Ed 356.Pp 357The 358.Fa si_fd 359argument contains the file descriptor number on which the operation was 360completed and the 361.Fa si_band 362field contains the side and priority of the operation as described above. 363.Pp 364Finally, for 365.Dv SIGCHLD 366the 367.Nm 368structure contains the following additional members: 369.Bd -literal -offset indent 370pid_t si_pid; 371uid_t si_uid; 372int si_status; 373clock_t si_utime; 374clock_t si_stime; 375.Ed 376.Pp 377The 378.Fa si_pid 379field contains the pid of the process who's status changed, the 380.Fa si_uid 381field contains the user id of the that process, the 382.Fa si_status 383field contains either the exit code of the process (for 384.Dv CLD_EXITED ) , 385or the signal number received by the process. 386.Xr waitid 2 , 387.Xr waitpid 2 , 388and the 389.Fa si_utime 390and 391.Fa si_stime 392fields contain the user and system process accounting time. 393.Sh STANDARDS 394The 395.Nm 396type conforms to 397.St -xsh5 . 398.Pp 399Signals specifying 400.Dv SI_LWP 401or 402.Dv SI_NOINFO 403are 404.Nx 405extensions. 406.Pp 407The 408.Dv TRAP_CHLD , 409.Dv TRAP_DBREG , 410.Dv TRAP_EXEC , 411.Dv TRAP_LWP , 412.Dv TRAP_SCE 413and 414.Dv TRAP_SCX 415signal specific reasons of 416.Dv SIGTRAP 417are 418.Nx 419extensions. 420.Sh HISTORY 421The 422.Nm 423functionality first appeared in 424.At V.4 . 425.Pp 426.Dv TRAP_CHLD , 427.Dv TRAP_DBREG , 428.Dv TRAP_EXEC , 429.Dv TRAP_LWP , 430.Dv TRAP_SCE 431and 432.Dv TRAP_SCX 433first appeared 434in 435.Nx 8 . 436.Pp 437The additional parameters with syscall information in 438.Dv TRAP_SCE 439and 440.Dv TRAP_SCX 441first appeared in 442.Nx 9 . 443