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