|
|
1.1 root 1: .TH SIGVEC 2 "7 July 1983"
2: .UC 4
3: .ie t .ds d \(dg
4: .el .ds d \z'|+'
5: .ie t .ds b \(bu
6: .el .ds b @
7: .SH NAME
8: sigvec \- software signal facilities
9: .SH SYNOPSIS
10: .nf
11: .B #include <signal.h>
12: .PP
13: .B struct sigvec {
14: .B int (*sv_handler)();
15: .B int sv_mask;
16: .B int sv_onstack;
17: .B };
18: .PP
19: .B sigvec(sig, vec, ovec)
20: .B int sig;
21: .B struct sigvec *vec, *ovec;
22: .fi
23: .SH DESCRIPTION
24: The system defines a set of signals that may be delivered to a process.
25: Signal delivery resembles the occurence of a hardware interrupt:
26: the signal is blocked from further occurrence, the current process
27: context is saved, and a new one is built. A process may specify a
28: .I handler
29: to which a signal is delivered, or specify that a signal is to be
30: .I blocked
31: or
32: .IR ignored .
33: A process may also specify that a default action is to be taken
34: by the system when a signal occurs.
35: Normally, signal handlers execute on the current stack
36: of the process. This may be changed, on a per-handler basis,
37: so that signals are taken on a special
38: .IR "signal stack" .
39: .PP
40: All signals have the same
41: .IR priority .
42: Signal routines execute with the signal that caused their
43: invocation
44: .IR blocked ,
45: but other signals may yet occur.
46: A global
47: .I "signal mask"
48: defines the set of signals currently blocked from delivery
49: to a process. The signal mask for a process is initilized
50: from that of its parent (normally 0). It
51: may be changed with a
52: .IR sigblock (2)
53: or
54: .IR sigsetmask (2)
55: call, or when a signal is delivered to the process.
56: .PP
57: When a signal
58: condition arises for a process, the signal is added to a set of
59: signals pending for the process. If the signal is not currently
60: .I blocked
61: by the process then it is delivered to the process. When a signal
62: is delivered, the current state of the process is saved,
63: a new signal mask is calculated (as described below),
64: and the signal handler is invoked. The call to the handler
65: is arranged so that if the signal handling routine returns
1.1.1.2 ! root 66: normally the process resumes execution in the context
1.1 root 67: from before the signal's delivery.
68: If the process wishes to resume in a different context, then it
69: must arrange to restore the previous context itself.
70: .PP
71: When a signal is delivered to a process a new signal mask is
72: installed for the duration of the process' signal handler
73: (or until a
74: .I sigblock
75: or
76: .I sigsetmask
77: call is made).
78: This mask is formed by taking the current signal mask,
79: adding the signal to be delivered, and
80: .IR or 'ing
81: in the signal mask associated with the handler to be invoked.
82: .PP
83: .I Sigvec
84: assigns a handler for a specific signal. If
85: .I vec
86: is non-zero, it
87: specifies a handler routine and mask
88: to be used when delivering the specified signal. Further, if
89: .I sv_onstack
1.1.1.2 ! root 90: is 1, the system delivers the signal to the process on a
1.1 root 91: .IR "signal stack" ,
92: specified with
93: .IR sigstack (2).
94: If
95: .I ovec
96: is non-zero, the previous handling information for the signal
97: is returned to the user.
98: .PP
99: The following is a list of all signals
100: with names as in the include file
101: .RI < signal.h >:
102: .LP
103: .nf
104: .ta \w'SIGVTALRM 'u +\w'15* 'u
105: SIGHUP 1 hangup
106: SIGINT 2 interrupt
107: SIGQUIT 3* quit
108: SIGILL 4* illegal instruction
109: SIGTRAP 5* trace trap
110: SIGIOT 6* IOT instruction
111: SIGEMT 7* EMT instruction
112: SIGFPE 8* floating point exception
113: SIGKILL 9 kill (cannot be caught, blocked, or ignored)
114: SIGBUS 10* bus error
115: SIGSEGV 11* segmentation violation
116: SIGSYS 12* bad argument to system call
117: SIGPIPE 13 write on a pipe with no one to read it
118: SIGALRM 14 alarm clock
119: SIGTERM 15 software termination signal
120: SIGURG 16\*b urgent condition present on socket
121: SIGSTOP 17\*d stop (cannot be caught, blocked, or ignored)
122: SIGTSTP 18\*d stop signal generated from keyboard
123: SIGCONT 19\*b continue after stop (cannot be blocked)
124: SIGCHLD 20\*b child status has changed
125: SIGTTIN 21\*d background read attempted from control terminal
126: SIGTTOU 22\*d background write attempted to control terminal
127: SIGIO 23\*b i/o is possible on a descriptor (see \fIfcntl\fP(2))
128: SIGXCPU 24 cpu time limit exceeded (see \fIsetrlimit\fP(2))
129: SIGXFSZ 25 file size limit exceeded (see \fIsetrlimit\fP(2))
130: SIGVTALRM 26 virtual time alarm (see \fIsetitimer\fP(2))
131: SIGPROF 27 profiling timer alarm (see \fIsetitimer\fP(2))
132: .fi
133: .PP
134: The starred signals in the list above cause a core image
135: if not caught or ignored.
136: .PP
137: Once a signal handler is installed, it remains installed
138: until another
139: .I sigvec
140: call is made, or an
141: .IR execve (2)
142: is performed.
143: The default action for a signal may be reinstated by setting
144: .I sv_handler
145: to SIG_DFL; this default is termination
146: (with a core image for starred signals)
147: except for signals marked with \*b or \*d.
148: Signals marked with \*b are discarded if the action
149: is SIG_DFL; signals marked
150: with \*d cause the process to stop.
151: If
152: .I sv_handler
153: is SIG_IGN the signal is subsequently ignored,
154: and pending instances of the signal are discarded.
155: .PP
156: If a caught signal occurs
157: during certain system calls, causing
158: the call to terminate prematurely, the call
159: is automatically restarted. In particular this can occur
160: during a
161: .I read
162: or
163: .IR write (2)
164: on a slow device (such as a terminal; but not a file)
165: and during a
166: .IR wait (2).
167: .PP
168: After a
169: .IR fork (2)
170: or
171: .IR vfork (2)
172: the child inherits
173: all signals, the signal mask, and the signal stack.
174: .PP
175: .IR Execve (2)
176: resets all
177: caught signals to default action; ignored signals remain ignored;
178: the signal mask remains the same; the signal stack state is reset.
179: .SH NOTES
180: The mask specified in
181: .I vec
182: is not allowed to block SIGKILL, SIGSTOP, or SIGCONT. This
183: is done silently by the system.
184: .SH "RETURN VALUE
185: A 0 value indicated that the call succeeded. A \-1 return value
186: indicates an error occured and
187: .I errno
188: is set to indicated the reason.
189: .SH ERRORS
190: .I Sigvec
1.1.1.2 ! root 191: fails and no new signal handler is installed if one
1.1 root 192: of the following occurs:
193: .TP 15
194: [EFAULT]
195: Either
196: .I vec
197: or
198: .I ovec
199: points to memory which is not a valid part of the process
200: address space.
201: .TP 15
202: [EINVAL]
203: .I Sig
204: is not a valid signal number.
205: .TP 15
206: [EINVAL]
207: An attempt is made to ignore or supply a handler for SIGKILL
208: or SIGSTOP.
209: .TP 15
210: [EINVAL]
211: An attempt is made to ignore SIGCONT (by default SIGCONT
212: is ignored).
213: .SH "SEE ALSO"
214: kill(1),
215: ptrace(2), kill(2),
216: sigblock(2), sigsetmask(2), sigpause(2)
217: sigstack(2), sigvec(2), setjmp(3), tty(4)
218: .PP
219: handler(sig, code, scp)
220: int sig, code;
221: struct sigcontext *scp;
222: .PP
223: Here
224: .I sig
225: is the signal number, into which the hardware faults and traps are
226: mapped as defined below.
227: .I Code
228: is a parameter which is either a constant
229: as given below or, for compatibility mode faults, the code provided by
230: the hardware (Compatibility mode faults are distinguished from the
231: other SIGILL traps by having PSL_CM set in the psl).
232: .I Scp
233: is a pointer to the
234: .I sigcontext
235: structure (defined in
236: .RI < signal.h >),
237: used to restore the context from before the signal.
238: .PP
239: The following defines the mapping of hardware traps to signals
240: and codes. All of these symbols are defined in
241: .RI < signal.h >:
242: .LP
243: .ta \w' Floating/decimal divide by zero 'u +\w'15* 'u +8n
244: .nf
245: Hardware condition Signal Code
246:
247: Arithmetic traps:
248: Integer overflow SIGFPE FPE_INTOVF_TRAP
249: Integer division by zero SIGFPE FPE_INTDIV_TRAP
250: Floating overflow trap SIGFPE FPE_FLTOVF_TRAP
251: Floating/decimal division by zero SIGFPE FPE_FLTDIV_TRAP
252: Floating underflow trap SIGFPE FPE_FLTUND_TRAP
253: Decimal overflow trap SIGFPE FPE_DECOVF_TRAP
254: Subscript-range SIGFPE FPE_SUBRNG_TRAP
255: Floating overflow fault SIGFPE FPE_FLTOVF_FAULT
256: Floating divide by zero fault SIGFPE FPE_FLTDIV_FAULT
257: Floating underflow fault SIGFPE FPE_FLTUND_FAULT
258: Length access control SIGSEGV
259: Protection violation SIGBUS
260: Reserved instruction SIGILL ILL_RESAD_FAULT
261: Customer-reserved instr. SIGEMT
262: Reserved operand SIGILL ILL_PRIVIN_FAULT
263: Reserved addressing SIGILL ILL_RESOP_FAULT
264: Trace pending SIGTRAP
265: Bpt instruction SIGTRAP
266: Compatibility-mode SIGILL hardware supplied code
267: Chme SIGSEGV
268: Chms SIGSEGV
269: Chmu SIGSEGV
270: .fi
271: .SH BUGS
272: This manual page is confusing.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.