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