BSD 4_3_Tahoe release
[unix-history] / usr / src / man / man3f / signal.3
CommitLineData
944ae7c9
KM
1.\" Copyright (c) 1983 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
95f51977 5.\" @(#)signal.3f 6.1 (Berkeley) 5/15/85
944ae7c9 6.\"
95f51977 7.TH SIGNAL 3F "May 15, 1985"
944ae7c9
KM
8.UC 5
9.SH NAME
10signal \- change the action for a signal
11.SH SYNOPSIS
12.B integer function signal(signum, proc, flag)
13.br
14.B integer signum, flag
15.br
16.B external proc
17.SH DESCRIPTION
18When a process incurs a signal (see
19.IR signal (3C))
20the default action
21is usually to clean up and abort.
22The user may choose to write an alternative signal handling routine.
23A call to
24.I signal
25is the way this alternate action is specified to the system.
26.PP
27.I Signum
28is the signal number (see
29.IR signal (3C)).
30If
31.I flag
32is negative, then
33.I proc
34must be the name of the user signal handling routine.
35If
36.I flag
37is zero or positive, then
38.I proc
39is ignored and the value of
40.I flag
41is passed to the system as the signal action definition.
42In particular, this is how previously saved signal actions can be restored.
43Two possible values for
44.I flag
45have specific meanings:
460 means "use the default action" (See NOTES below),
471 means "ignore this signal".
48.PP
49A positive returned value is the previous action definition.
50A value greater than 1 is the address of a routine that
51was to have been called on occurrence of the given signal.
52The returned value can be used in subsequent calls to
53.I signal
54in order to restore a previous action definition.
55A negative returned value is the negation of a system error code.
56(See
57.IR perror (3F))
58.SH FILES
59.ie \nM /usr/ucb/lib/libU77.a
60.el /usr/lib/libU77.a
61.SH "SEE ALSO"
62signal(3C), kill(3F), kill(1)
63.SH NOTES
64.B f77
65arranges to trap certain signals when a process is started.
66The only way to restore the default
67.B f77
68action is to save the returned
69value from the first call to
70.I signal.
71.PP
72If the user signal handler is called, it will be passed the signal number
73as an integer argument.