add symlin(1)
[unix-history] / usr / src / old / man / sigset.3
CommitLineData
bb5fd2c3
KM
1.\" Copyright (c) 1980 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
5.\" @(#)sigset.3 4.1 (Berkeley) %G%
6.\"
7.TH SIGSET 3
8.UC 4
9.SH NAME
10sigset, signal, sighold, sigignore, sigrelse, sigpause \- manage signals
11.SH SYNOPSIS
12.nf
13.B #include <signal.h>
14.B void action();
15.B int sig;
16.PP
17.B sigset(sig, action)
18.B signal(sig, action)
19.PP
20.B sighold(sig)
21.B sigignore(sig)
22.B sigrelse(sig)
23.PP
24.B sigpause(sig)
25.PP
26.fi
27.B cc ... \-ljobs
28.nf
29.SH DESCRIPTION
30This is a package of signal management functions to manage the signals
31as described in
32.IR sigsys (2).
33These functions are available only in this version of UNIX, and should
34not be used when the mechanisms of
35.IR signal (2)
36would suffice, as they would then impair portability.
37These functions are contained in the \fIjobs\fR library, obtained by
38specifying the loader option \fB\-ljobs\fR.
39.PP
40.I Sigset
41is used to provide a default signal handler for signal
42.I sig.
43This function is remembered across subsequent calls to the other
44functions, and need not be specified again.
45After
46.I sigset
47instances of
48.I sig
49will cause an interrupt to be taken at
50.I func,
51with the signal then held so that recursive trapping due to
52the signal will not occur. During normal return from
53.I func,
54the routines arrange for the signal action to be restored so that
55subsequent signals will also trap to
56.I func.
57If a non-local exit is to be taken, then
58.I sigrelse
59must be called to un-hold the signal action, restoring the
60original catch.
61.I Func
62may also be specified as
63SIG_DFL, SIG_IGN or SIG_HOLD, as described in
64.IR sigsys (2).
65The value specified on the previous call to
66.I sigset
67is returned; if
68.I sigset
69has never been called, then the default action inherited from the
70system is returned.
71.PP
72.I Signal
73is like
74.I sigset,
75but the signal will not be held when the action routine is called;
76rather it will have reverted to SIG_DFL.
77This is generally unsafe, but is included for backwards compatibility
78to the old signal mechanism.
79It should not be used.
80.PP
81.I Sighold
82and
83.I sigrelse
84may be used to block off
85.I sig
86in a piece of code where it cannot be tolerated.
87After
88.I sigrelse
89the catch initially set with
90.I sigset
91will be restored.
92.PP
93.I Sigignore
94can be used to temporarily set the action for
95.I sig
96to ignore the signal. If the signal had been held before
97the call to
98.I sigignore,
99any pending instance of the signal will be discarded.
100.PP
101.I Sigpause
102may be used by a routine which wishes to check for some condition
103produced at interrupt level by the
104.I sig
105signal, and then to pause waiting for the condition to arise with
106the catch of the signal enabled.
107In correct usage it must be preceded by an instance of
108.I sighold
109to block the signal.
110.I Sigpause
111is like
112.I pause
113in that it will return after
114.I any
115signal is processed.
116The usual thing to do then is to reenable the hold with
117.I sighold,
118check the condition
119again, and
120.I sigpause
121again if the condition has not arisen.
122.SH "SEE ALSO"
123sigsys(2), signal(2), jobs(3), tty(4)
124.SH BUGS
125.I Sighold
126and
127.I sigrelse
128do not nest; the first
129.I sigrelse
130restores the default catch.
131.PP
132These functions store information in data space. You thus
133.B must
134call
135.IR sigsys (2)
136rather than any of
137.I sigset
138or
139.I signal
140after a
141.IR vfork (2)
142in the child which is to then
143.IR exec (2).