1 .\" Copyright (c) 1980, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" @(#)sigvec.2 8.2 (Berkeley) 4/19/94
35 .Nd software signal facilities
48 .Fn sigvec "int sig" "struct sigvec *vec" "struct sigvec *ovec"
51 This interface is made obsolete by
55 The system defines a set of signals that may be delivered to a process.
56 Signal delivery resembles the occurrence of a hardware interrupt:
57 the signal is blocked from further occurrence, the current process
58 context is saved, and a new one is built.
59 A process may specify a
61 to which a signal is delivered, or specify that a signal is to be
65 A process may also specify that a default action is to be taken
66 by the system when a signal occurs.
67 Normally, signal handlers execute on the current stack
69 This may be changed, on a per-handler basis,
70 so that signals are taken on a special
73 All signals have the same
75 Signal routines execute with the signal that caused their
78 but other signals may yet occur.
81 defines the set of signals currently blocked from delivery
83 The signal mask for a process is initialized
84 from that of its parent (normally 0).
90 call, or when a signal is delivered to the process.
93 condition arises for a process, the signal is added to a set of
94 signals pending for the process.
95 If the signal is not currently
97 by the process then it is delivered to the process.
99 is delivered, the current state of the process is saved,
100 a new signal mask is calculated (as described below),
101 and the signal handler is invoked.
102 The call to the handler
103 is arranged so that if the signal handling routine returns
104 normally the process will resume execution in the context
105 from before the signal's delivery.
106 If the process wishes to resume in a different context, then it
107 must arrange to restore the previous context itself.
109 When a signal is delivered to a process a new signal mask is
110 installed for the duration of the process' signal handler
116 This mask is formed by taking the current signal mask,
117 adding the signal to be delivered, and
119 in the signal mask associated with the handler to be invoked.
124 assigns a handler for a specific signal.
128 specifies a handler routine and mask
129 to be used when delivering the specified signal.
134 the system will deliver the signal to the process on a
140 is non-zero, the previous handling information for the signal
141 is returned to the user.
143 The following is a list of all signals
144 with names as in the include file
146 .Bl -column SIGVTALARMXX "create core imagexxx"
147 .It Sy "NAME Default Action Description"
148 .It Dv SIGHUP No " terminate process" " terminal line hangup"
149 .It Dv SIGINT No " terminate process" " interrupt program"
150 .It Dv SIGQUIT No " create core image" " quit program"
151 .It Dv SIGILL No " create core image" " illegal instruction"
152 .It Dv SIGTRAP No " create core image" " trace trap"
153 .It Dv SIGABRT No " create core image" Ta Xr abort 3
156 .It Dv SIGEMT No " create core image" " emulate instruction executed"
157 .It Dv SIGFPE No " create core image" " floating-point exception"
158 .It Dv SIGKILL No " terminate process" " kill program"
159 .It Dv SIGBUS No " create core image" " bus error"
160 .It Dv SIGSEGV No " create core image" " segmentation violation"
161 .It Dv SIGSYS No " create core image" " non-existent system call invoked"
162 .It Dv SIGPIPE No " terminate process" " write on a pipe with no reader"
163 .It Dv SIGALRM No " terminate process" " real-time timer expired"
164 .It Dv SIGTERM No " terminate process" " software termination signal"
165 .It Dv SIGURG No " discard signal" " urgent condition present on socket"
166 .It Dv SIGSTOP No " stop process" " stop (cannot be caught or ignored)"
167 .It Dv SIGTSTP No " stop process" " stop signal generated from keyboard"
168 .It Dv SIGCONT No " discard signal" " continue after stop"
169 .It Dv SIGCHLD No " discard signal" " child status has changed"
170 .It Dv SIGTTIN No " stop process" " background read attempted from control terminal"
171 .It Dv SIGTTOU No " stop process" " background write attempted to control terminal"
172 .It Dv SIGIO No " discard signal" Tn " I/O"
173 is possible on a descriptor (see
175 .It Dv SIGXCPU No " terminate process" " cpu time limit exceeded (see"
177 .It Dv SIGXFSZ No " terminate process" " file size limit exceeded (see"
179 .It Dv SIGVTALRM No " terminate process" " virtual time alarm (see"
181 .It Dv SIGPROF No " terminate process" " profiling timer alarm (see"
183 .It Dv SIGWINCH No " discard signal" " Window size change"
184 .It Dv SIGINFO No " discard signal" " status request from keyboard"
185 .It Dv SIGUSR1 No " terminate process" " User defined signal 1"
186 .It Dv SIGUSR2 No " terminate process" " User defined signal 2"
189 Once a signal handler is installed, it remains installed
195 A signal-specific default action may be reset by
200 The defaults are process termination, possibly with core dump;
201 no action; stopping the process; or continuing the process.
202 See the above signal list for each signal's default action.
207 current and pending instances
208 of the signal are ignored and discarded.
210 If a signal is caught during the system calls listed below,
211 the call is normally restarted.
212 The call can be forced to terminate prematurely with an
214 error return by setting the
218 The affected system calls include
226 on a communications channel or a slow device (such as a terminal,
227 but not a regular file)
232 However, calls that have already committed are not restarted,
233 but instead return a partial success (for example, a short read count).
239 all signals, the signal mask, the signal stack,
240 and the restart/interrupt flags are inherited by the child.
244 system call reinstates the default
245 action for all signals which were caught and
246 resets all signals to be caught on the user stack.
247 Ignored signals remain ignored;
248 the signal mask remains the same;
249 signals that interrupt system calls continue to do so.
251 The mask specified in
253 is not allowed to block
257 This is done silently by the system.
261 flag is not available in
263 hence it should not be used if backward compatibility is needed.
269 The handler routine can be declared:
270 .Bd -literal -offset indent
271 void handler(sig, code, scp)
273 struct sigcontext *scp;
278 is the signal number, into which the hardware faults and traps are
279 mapped as defined below.
284 as given below or, for compatibility mode faults, the code provided by
285 the hardware (Compatibility mode faults are distinguished from the
296 structure (defined in
298 used to restore the context from before the signal.
303 will fail and no new signal handler will be installed if one
304 of the following occurs:
311 points to memory that is not a valid part of the process
317 is not a valid signal number.
319 An attempt is made to ignore or supply a handler for
343 system call first appeared in
345 It was reimplemented as a wrapper around
350 This manual page is still confusing.