xref: /freebsd/lib/libc/compat-43/sigpause.2 (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1.\" Copyright (c) 1983, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\" Part of the content of the man page was derived from
29.\" The Open Group Base Specifications Issue 7
30.\" IEEE Std 1003.1-2008
31.\"
32.Dd June 2, 1993
33.Dt SIGPAUSE 2
34.Os
35.Sh NAME
36.Nm sighold ,
37.Nm sigignore ,
38.Nm sigpause ,
39.Nm sigrelse ,
40.Nm sigset
41.Nd legacy interface for signal management
42.Sh LIBRARY
43.Lb libc
44.Sh SYNOPSIS
45.In signal.h
46.Ft int
47.Fn sighold "int sig"
48.Ft int
49.Fn sigignore "int sig"
50.Ft int
51.Fn xsi_sigpause "int sigmask"
52.Ft int
53.Fn sigrelse "int sig"
54.Ft void (*)(int)
55.Fn sigset "int" "void (*disp)(int)"
56.Ft int
57.Fn sigpause "int sigmask"
58.Sh DESCRIPTION
59.Sy This interface is made obsolete by
60.Xr sigsuspend 2
61.Sy and
62.Xr sigaction 2 .
63.Pp
64The
65.Fn sigset
66function modifies signal dispositions.
67The
68.Fa sig
69argument specifies the signal, which may be any signal except
70.Dv SIGKILL
71and
72.Dv SIGSTOP .
73The
74.Fa disp
75argument specifies the signal's disposition,
76which may be
77.Dv SIG_DFL ,
78.Dv SIG_IGN ,
79or the address of a signal handler.
80If
81.Fn sigset
82is used, and
83.Fa disp
84is the address of a signal handler, the
85system adds
86.Fa sig
87to the signal mask of the calling process before executing the signal
88handler; when the signal handler returns, the system restores the
89signal mask of the calling process to its state prior to the delivery
90of the signal.
91In addition, if
92.Fn sigset
93is used, and
94.Fa disp
95is equal to
96.Dv SIG_HOLD ,
97.Fa sig
98is added to the signal
99mask of the calling process and
100.Fa sig 's
101disposition remains unchanged.
102If
103.Fn sigset
104is used, and
105.Fa disp
106is not equal to
107.Dv SIG_HOLD ,
108.Fa sig
109is removed from the signal mask of the calling process.
110.Pp
111The
112.Fn sighold
113function adds
114.Fa sig
115to the signal mask of the calling process.
116.Pp
117The
118.Fn sigrelse
119function removes
120.Fa sig
121from the signal mask of the calling process.
122.Pp
123The
124.Fn sigignore
125function sets the disposition of
126.Fa sig
127to
128.Dv SIG_IGN .
129.Pp
130The
131.Fn xsi_sigpause
132function removes
133.Fa sig
134from the signal mask of the calling process and suspend the calling process
135until a signal is received.
136The
137.Fn xsi_sigpause
138function restores the signal mask of the process to its original state before
139returning.
140.Pp
141The
142.Fn sigpause
143function
144assigns
145.Fa sigmask
146to the set of masked signals
147and then waits for a signal to arrive;
148on return the set of masked signals is restored.
149The
150.Fa sigmask
151argument
152is usually 0 to indicate that no
153signals are to be blocked.
154.Sh RETURN VALUES
155The
156.Fn sigpause
157and
158.Fn xsi_sigpause
159functions
160always terminate by being interrupted, returning -1 with
161.Va errno
162set to
163.Er EINTR .
164.Pp
165Upon successful completion,
166.Fn sigset
167returns
168.Dv SIG_HOLD
169if the signal had been blocked and the signal's previous disposition if
170it had not been blocked.
171Otherwise,
172.Dv SIG_ERR
173is returned and
174.Va errno
175set to indicate the error.
176.Pp
177For all other functions, upon successful completion, 0 is returned.
178Otherwise, -1 is returned and
179.Va errno
180is set to indicate the error:
181.Bl -tag -width Er
182.It Bq Er EINVAL
183The
184.Fa sig
185argument
186is not a valid signal number.
187.It Bq Er EINVAL
188For
189.Fn sigset
190and
191.Fn sigignore
192functions, an attempt was made to catch or ignore
193.Dv SIGKILL
194or
195.Dv SIGSTOP .
196.El
197.Sh SEE ALSO
198.Xr kill 2 ,
199.Xr sigaction 2 ,
200.Xr sigblock 2 ,
201.Xr sigprocmask 2 ,
202.Xr sigsuspend 2 ,
203.Xr sigvec 2
204.Sh STANDARDS
205The
206.Fn sigpause
207function is implemented for compatibility with historic
208.Bx 4.3
209applications.
210An incompatible interface by the same name, which used a single signal number
211rather than a mask, was present in
212.At V ,
213and was copied from there into the
214.Sy X/Open System Interfaces
215.Pq Tn XSI
216option of
217.St -p1003.1-2001 .
218.Fx
219implements it under the name
220.Fn xsi_sigpause .
221The
222.Fn sighold ,
223.Fn sigignore ,
224.Fn sigrelse
225and
226.Fn sigset
227functions are implemented for compatibility with
228.Sy System V
229and
230.Sy XSI
231interfaces.
232.Sh HISTORY
233The
234.Fn sigpause
235function appeared in
236.Bx 4.2
237and has been deprecated.
238All other functions appeared in
239.Fx 8.1
240and were deprecated before being implemented.
241