xref: /netbsd-src/share/man/man2/siginfo.2 (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1.\"	$NetBSD: siginfo.2,v 1.22 2017/02/17 01:14:31 kamil 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 January 14, 2017
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_TRACE
241Process trace trap
242.El
243.It SIGCHLD
244.Bl -tag -width CLD_CONTINUED
245.It CLD_CONTINUED
246Stopped child has continued
247.It CLD_DUMPED
248Child has terminated abnormally and created a core file
249.It CLD_EXITED
250Child has exited
251.It CLD_KILLED
252Child has terminated abnormally but did not create a core file
253.It CLD_STOPPED
254Child has stopped
255.It CLD_TRAPPED
256Traced child has trapped
257.El
258.It SIGIO
259.Bl -tag -width POLL_OUT
260.It POLL_ERR
261I/O error
262.It POLL_HUP
263Device disconnected
264.It POLL_IN
265Data input available
266.It POLL_MSG
267Input message available
268.It POLL_OUT
269Output buffers available
270.It POLL_PRI
271High priority input available
272.El
273.El
274.Pp
275For
276.Dv SIGILL , SIGFPE ,
277and
278.Dv SIGTRAP
279the
280.Nm
281structure contains the following additional members:
282.Bd -literal -offset indent
283void *si_addr;
284int si_trap;
285.Ed
286.Pp
287.Fa si_addr
288contains the address of the faulting instruction and
289.Fa si_trap
290contains a hardware specific reason.
291.Pp
292For
293.Dv SIGBUS
294and
295.Dv SIGSEGV
296the
297.Nm
298structure contains the following additional members:
299.Bd -literal -offset indent
300void *si_addr;
301int si_trap;
302.Ed
303.Pp
304.Fa si_addr
305contains the address of the faulting data and
306.Fa si_trap
307contains a hardware specific reason.
308.Pp
309For some architectures
310the value of
311.Fa si_addr
312may be inaccurate.
313.Pp
314For
315.Dv SIGIO
316the
317.Nm
318structure contains the following additional members:
319.Bd -literal -offset indent
320int si_fd;
321long si_band;
322.Ed
323.Pp
324The
325.Fa si_fd
326argument contains the file descriptor number on which the operation was
327completed and the
328.Fa si_band
329field contains the side and priority of the operation as described above.
330.Pp
331Finally, for
332.Dv SIGCHLD
333the
334.Nm
335structure contains the following additional members:
336.Bd -literal -offset indent
337pid_t si_pid;
338uid_t si_uid;
339int si_status;
340clock_t	si_utime;
341clock_t	si_stime;
342.Ed
343.Pp
344The
345.Fa si_pid
346field contains the pid of the process who's status changed, the
347.Fa si_uid
348field contains the user id of the that process, the
349.Fa si_status
350field contains either the exit code of the process (for
351.Dv CLD_EXITED ) ,
352or the signal number received by the process.
353.Xr waitid 2 ,
354.Xr waitpid 2 ,
355and the
356.Fa si_utime
357and
358.Fa si_stime
359fields contain the user and system process accounting time.
360.Sh STANDARDS
361The
362.Nm
363type conforms to
364.St -xsh5 .
365.Pp
366Signals specifying
367.Dv SI_LWP
368or
369.Dv SI_NOINFO
370are
371.Nx
372extensions.
373.Pp
374The
375.Dv TRAP_CHLD ,
376.Dv TRAP_DBREG ,
377.Dv TRAP_EXEC
378and
379.Dv TRAP_LWP
380signal specific reasons of
381.Dv SIGTRAP
382are
383.Nx
384extensions.
385.Sh HISTORY
386The
387.Nm
388functionality first appeared in
389.At V.4 .
390.Pp
391.Dv TRAP_CHLD ,
392.Dv TRAP_DBREG ,
393.Dv TRAP_EXEC
394and
395.Dv TRAP_LWP
396first appeared
397in
398.Nx 8 .
399