|
|
1.1 root 1: .\" Copyright (c) 1980 The Regents of the University of California.
2: .\" All rights reserved.
3: .\"
4: .\" Redistribution and use in source and binary forms are permitted provided
5: .\" that: (1) source distributions retain this entire copyright notice and
6: .\" comment, and (2) distributions including binaries display the following
7: .\" acknowledgement: ``This product includes software developed by the
8: .\" University of California, Berkeley and its contributors'' in the
9: .\" documentation or other materials provided with the distribution and in
10: .\" all advertising materials mentioning features or use of this software.
11: .\" Neither the name of the University nor the names of its contributors may
12: .\" be used to endorse or promote products derived from this software without
13: .\" specific prior written permission.
14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17: .\"
18: .\" @(#)sigvec.2 6.6 (Berkeley) 7/1/90
19: .\"
20: .TH SIGVEC 2 "July 1, 1990"
21: .UC 4
22: .ie t .ds d \(dg
23: .el .ds d \z'|+'
24: .ie t .ds b \(bu
25: .el .ds b @
26: .SH NAME
27: sigvec \- software signal facilities
28: .SH SYNOPSIS
29: .nf
30: .B #include <signal.h>
31: .PP
32: .B struct sigvec {
33: .B void (*sv_handler)();
34: .B int sv_mask;
35: .B int sv_flags;
36: .B };
37: .PP
38: .B sigvec(sig, vec, ovec)
39: .B int sig;
40: .B struct sigvec *vec, *ovec;
41: .fi
42: .SH DESCRIPTION
43: .B "This interface is made obsolete by sigaction(2).
44: .LP
45: The system defines a set of signals that may be delivered to a process.
46: Signal delivery resembles the occurence of a hardware interrupt:
47: the signal is blocked from further occurrence, the current process
48: context is saved, and a new one is built. A process may specify a
49: .I handler
50: to which a signal is delivered, or specify that a signal is to be
51: .I blocked
52: or
53: .IR ignored .
54: A process may also specify that a default action is to be taken
55: by the system when a signal occurs.
56: Normally, signal handlers execute on the current stack
57: of the process. This may be changed, on a per-handler basis,
58: so that signals are taken on a special
59: .IR "signal stack" .
60: .PP
61: All signals have the same
62: .IR priority .
63: Signal routines execute with the signal that caused their
64: invocation
65: .IR blocked ,
66: but other signals may yet occur.
67: A global
68: .I "signal mask"
69: defines the set of signals currently blocked from delivery
70: to a process. The signal mask for a process is initialized
71: from that of its parent (normally 0). It
72: may be changed with a
73: .IR sigblock (2)
74: or
75: .IR sigsetmask (2)
76: call, or when a signal is delivered to the process.
77: .PP
78: When a signal
79: condition arises for a process, the signal is added to a set of
80: signals pending for the process. If the signal is not currently
81: .I blocked
82: by the process then it is delivered to the process. When a signal
83: is delivered, the current state of the process is saved,
84: a new signal mask is calculated (as described below),
85: and the signal handler is invoked. The call to the handler
86: is arranged so that if the signal handling routine returns
87: normally the process will resume execution in the context
88: from before the signal's delivery.
89: If the process wishes to resume in a different context, then it
90: must arrange to restore the previous context itself.
91: .PP
92: When a signal is delivered to a process a new signal mask is
93: installed for the duration of the process' signal handler
94: (or until a
95: .I sigblock
96: or
97: .I sigsetmask
98: call is made).
99: This mask is formed by taking the current signal mask,
100: adding the signal to be delivered, and
101: .IR or 'ing
102: in the signal mask associated with the handler to be invoked.
103: .PP
104: .I Sigvec
105: assigns a handler for a specific signal. If
106: .I vec
107: is non-zero, it
108: specifies a handler routine and mask
109: to be used when delivering the specified signal.
110: Further, if the SV_ONSTACK bit is set in
111: .I sv_flags,
112: the system will deliver the signal to the process on a
113: .IR "signal stack" ,
114: specified with
115: .IR sigstack (2).
116: If
117: .I ovec
118: is non-zero, the previous handling information for the signal
119: is returned to the user.
120: .PP
121: The following is a list of all signals
122: with names as in the include file
123: .RI < signal.h >:
124: .LP
125: .nf
126: .ta \w'SIGVTALRM 'u +\w'15* 'u
127: SIGHUP 1 hangup
128: SIGINT 2 interrupt
129: SIGQUIT 3* quit
130: SIGILL 4* illegal instruction
131: SIGTRAP 5* trace trap
132: SIGIOT 6* IOT instruction
133: SIGEMT 7* EMT instruction
134: SIGFPE 8* floating point exception
135: SIGKILL 9 kill (cannot be caught, blocked, or ignored)
136: SIGBUS 10* bus error
137: SIGSEGV 11* segmentation violation
138: SIGSYS 12* bad argument to system call
139: SIGPIPE 13 write on a pipe with no one to read it
140: SIGALRM 14 alarm clock
141: SIGTERM 15 software termination signal
142: SIGURG 16\*b urgent condition present on socket
143: SIGSTOP 17\*d stop (cannot be caught, blocked, or ignored)
144: SIGTSTP 18\*d stop signal generated from keyboard
145: SIGCONT 19\*b continue after stop
146: SIGCHLD 20\*b child status has changed
147: SIGTTIN 21\*d background read attempted from control terminal
148: SIGTTOU 22\*d background write attempted to control terminal
149: SIGIO 23\*b i/o is possible on a descriptor (see \fIfcntl\fP(2))
150: SIGXCPU 24 cpu time limit exceeded (see \fIsetrlimit\fP(2))
151: SIGXFSZ 25 file size limit exceeded (see \fIsetrlimit\fP(2))
152: SIGVTALRM 26 virtual time alarm (see \fIsetitimer\fP(2))
153: SIGPROF 27 profiling timer alarm (see \fIsetitimer\fP(2))
154: SIGWINCH 28\*b window size change
155: SIGINFO 29\*b status request from keyboard
156: SIGUSR1 30 user defined signal 1
157: SIGUSR2 31 user defined signal 2
158: .fi
159: .PP
160: The starred signals in the list above cause a core image
161: if not caught or ignored.
162: .PP
163: Once a signal handler is installed, it remains installed
164: until another
165: .I sigvec
166: call is made, or an
167: .IR execve (2)
168: is performed.
169: The default action for a signal may be reinstated by setting
170: .I sv_handler
171: to SIG_DFL; this default is termination
172: (with a core image for starred signals)
173: except for signals marked with \*b or \*d.
174: Signals marked with \*b are discarded if the action
175: is SIG_DFL; signals marked
176: with \*d cause the process to stop.
177: If
178: .I sv_handler
179: is SIG_IGN the signal is subsequently ignored,
180: and pending instances of the signal are discarded.
181: .PP
182: If a caught signal occurs during certain system calls,
183: the call is normally restarted.
184: The call can be forced to terminate prematurely with an
185: EINTR error return by setting the SV_INTERRUPT bit in
186: .I sv_flags.
187: The affected system calls include
188: .IR read (2),
189: .IR write (2),
190: .IR sendto (2),
191: .IR recvfrom (2),
192: .IR sendmsg (2)
193: and
194: .IR recvmsg (2)
195: on a communications channel or a slow device (such as a terminal,
196: but not a regular file)
197: and during a
198: .IR wait (2)
199: or
200: .IR ioctl (2).
201: However, calls that have already committed are not restarted,
202: but instead return a partial success (for example, a short read count).
203: .PP
204: After a
205: .IR fork (2)
206: or
207: .IR vfork (2)
208: the child inherits
209: all signals, the signal mask, the signal stack,
210: and the restart/interrupt flags.
211: .PP
212: .IR Execve (2)
213: resets all
214: caught signals to default action and
215: resets all signals to be caught on the user stack.
216: Ignored signals remain ignored;
217: the signal mask remains the same;
218: signals that interrupt system calls continue to do so.
219: .SH NOTES
220: The mask specified in
221: .I vec
222: is not allowed to block SIGKILL or SIGSTOP.
223: This is done silently by the system.
224: .PP
225: The SV_INTERRUPT flag is not available in 4.2BSD,
226: hence it should not be used if backward compatibility is needed.
227: .SH "RETURN VALUE
228: A 0 value indicated that the call succeeded. A \-1 return value
229: indicates an error occurred and
230: .I errno
231: is set to indicated the reason.
232: .SH ERRORS
233: .I Sigvec
234: will fail and no new signal handler will be installed if one
235: of the following occurs:
236: .TP 15
237: [EFAULT]
238: Either
239: .I vec
240: or
241: .I ovec
242: points to memory that is not a valid part of the process
243: address space.
244: .TP 15
245: [EINVAL]
246: .I Sig
247: is not a valid signal number.
248: .TP 15
249: [EINVAL]
250: An attempt is made to ignore or supply a handler for SIGKILL
251: or SIGSTOP.
252: .SH "SEE ALSO"
253: sigaction(2), kill(1), ptrace(2), kill(2),
254: sigprocmask(2), sigsuspend(2),
255: sigblock(2), sigsetmask(2), sigpause(2),
256: sigstack(2), sigvec(2), sigsetops(3), setjmp(3), siginterrupt(3), tty(4)
257: .SH "NOTES (VAX-11)"
258: The handler routine can be declared:
259: .PP
260: void handler(sig, code, scp)
261: int sig, code;
262: struct sigcontext *scp;
263: .PP
264: Here
265: .I sig
266: is the signal number, into which the hardware faults and traps are
267: mapped as defined below.
268: .I Code
269: is a parameter that is either a constant
270: as given below or, for compatibility mode faults, the code provided by
271: the hardware (Compatibility mode faults are distinguished from the
272: other SIGILL traps by having PSL_CM set in the psl).
273: .I Scp
274: is a pointer to the
275: .I sigcontext
276: structure (defined in
277: .RI < signal.h >),
278: used to restore the context from before the signal.
279: .PP
280: The following defines the mapping of hardware traps to signals
281: and codes. All of these symbols are defined in
282: .RI < signal.h >:
283: .LP
284: .ta \w' Floating/decimal divide by zero 'u +\w'15* 'u +8n
285: .nf
286: Hardware condition Signal Code
287:
288: Arithmetic traps:
289: Integer overflow SIGFPE FPE_INTOVF_TRAP
290: Integer division by zero SIGFPE FPE_INTDIV_TRAP
291: Floating overflow trap SIGFPE FPE_FLTOVF_TRAP
292: Floating/decimal division by zero SIGFPE FPE_FLTDIV_TRAP
293: Floating underflow trap SIGFPE FPE_FLTUND_TRAP
294: Decimal overflow trap SIGFPE FPE_DECOVF_TRAP
295: Subscript-range SIGFPE FPE_SUBRNG_TRAP
296: Floating overflow fault SIGFPE FPE_FLTOVF_FAULT
297: Floating divide by zero fault SIGFPE FPE_FLTDIV_FAULT
298: Floating underflow fault SIGFPE FPE_FLTUND_FAULT
299: Length access control SIGSEGV
300: Protection violation SIGBUS
301: Reserved instruction SIGILL ILL_RESAD_FAULT
302: Customer-reserved instr. SIGEMT
303: Reserved operand SIGILL ILL_PRIVIN_FAULT
304: Reserved addressing SIGILL ILL_RESOP_FAULT
305: Trace pending SIGTRAP
306: Bpt instruction SIGTRAP
307: Compatibility-mode SIGILL hardware supplied code
308: Chme SIGSEGV
309: Chms SIGSEGV
310: Chmu SIGSEGV
311: .fi
312: .SH BUGS
313: This manual page is still confusing.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.