1 .\" $NetBSD: sigvec.3,v 1.26 2010/03/22 19:30:53 joerg Exp $
3 .\" Copyright (c) 1980, 1991, 1993
4 .\" The Regents of the University of California. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. Neither the name of the University nor the names of its contributors
15 .\" may be used to endorse or promote products derived from this software
16 .\" without specific prior written permission.
18 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" from: @(#)sigvec.2 8.2 (Berkeley) 4/19/94
37 .Nd software signal facilities
50 .Fn sigvec "int sig" "struct sigvec *vec" "struct sigvec *ovec"
53 This interface is made obsolete by
55 The structure, flags, and function declaration have been removed from
56 the header files but the function is kept in the c library for binary
60 The system defines a set of signals that may be delivered to a process.
61 Signal delivery resembles the occurrence of a hardware interrupt:
62 the signal is blocked from further occurrence, the current process
63 context is saved, and a new one is built.
64 A process may specify a
66 to which a signal is delivered, or specify that a signal is to be
68 A process may also specify that a default action is to be taken
69 by the system when a signal occurs.
72 in which case its delivery is postponed until it is
74 The action to be taken on delivery is determined at the time
76 Normally, signal handlers execute on the current stack
78 This may be changed, on a per-handler basis, so that signals are
82 Signal routines execute with the signal that caused their
85 but other signals may yet occur.
88 defines the set of signals currently blocked from delivery
90 The signal mask for a process is initialized from that of its parent
92 It may be changed with a
96 call, or when a signal is delivered to the process.
99 condition arises for a process, the signal is added to a set of
100 signals pending for the process.
101 If the signal is not currently
103 by the process then it is delivered to the process.
105 is delivered, the current state of the process is saved,
106 a new signal mask is calculated (as described below),
107 and the signal handler is invoked.
108 The call to the handler is arranged so that if the signal handling
109 routine returns normally the process will resume execution in the
110 context from before the signal's delivery.
111 If the process wishes to resume in a different context, then it
112 must arrange to restore the previous context itself.
114 When a signal is delivered to a process a new signal mask is
115 installed for the duration of the process' signal handler
121 This mask is formed by taking the union of the current signal mask,
122 the signal to be delivered, and
123 the signal mask associated with the handler to be invoked.
126 assigns a handler for a specific signal.
133 or a handler routine) and mask
134 to be used when delivering the specified signal.
139 the system will deliver the signal to the process on a
145 is non-zero, the previous handling information for the signal
146 is returned to the user.
148 Once a signal handler is installed, it remains installed
154 A signal-specific default action may be reset by
159 The defaults are process termination, possibly with core dump;
160 no action; stopping the process; or continuing the process.
161 See the signal list below for each signal's default action.
166 the default action for the signal is to discard the signal,
167 and if a signal is pending,
168 the pending signal is discarded even if the signal is masked.
173 current and pending instances
174 of the signal are ignored and discarded.
176 Options may be specified by setting
182 the system will deliver the signal to the process on a
187 If a signal is caught during the system calls listed below,
188 the call may be restarted,
189 the call may return with a data transfer shorter than requested,
190 or the call may be forced to terminate
193 Interrupting of pending calls is requested
198 The affected system calls include
207 on a communications channel or a slow device (such as a terminal,
208 but not a regular file)
213 However, calls that have already committed are not restarted,
214 but instead return a partial success (for example, a short read count).
220 all signals, the signal mask, the signal stack,
221 and the interrupt/restart flags are inherited by the child.
225 system call reinstates the default action for all signals which
226 were caught and resets all signals to be caught on the user stack.
227 Ignored signals remain ignored;
228 the signal mask remains the same;
229 signals that interrupt pending system calls continue to do so.
233 for comprehensive list of supported signals.
235 The mask specified in
237 is not allowed to block
241 This is enforced silently by the system.
245 flag is not available in
247 hence it should not be used if backward compatibility is needed.
249 A 0 value indicated that the call succeeded.
250 A \-1 return value indicates an error occurred and
252 is set to indicated the reason.
254 The handler routine can be declared:
255 .Bd -literal -offset indent
257 handler(sig, code, scp)
259 struct sigcontext *scp;
264 is the signal number, into which the hardware faults and traps are
265 mapped as defined below.
267 is a parameter that is either a constant
268 or the code provided by the hardware.
272 structure (defined in
274 used to restore the context from before the signal.
277 will fail and no new signal handler will be installed if one
278 of the following occurs:
285 points to memory that is not a valid part of the process
289 is not a valid signal number.
291 An attempt is made to ignore or supply a handler for