xref: /freebsd/lib/libc/gen/sigsetops.3 (revision 22cf89c938886d14f5796fc49f9f020c23ea8eaf)
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.\"     @(#)sigsetops.3	8.1 (Berkeley) 6/4/93
29.\"
30.Dd October 29, 2019
31.Dt SIGSETOPS 3
32.Os
33.Sh NAME
34.Nm sigemptyset ,
35.Nm sigfillset ,
36.Nm sigaddset ,
37.Nm sigandset ,
38.Nm sigdelset ,
39.Nm sigisemptyset ,
40.Nm sigismember ,
41.Nm sigorset
42.Nd manipulate signal sets
43.Sh LIBRARY
44.Lb libc
45.Sh SYNOPSIS
46.In signal.h
47.Ft int
48.Fn sigemptyset "sigset_t *set"
49.Ft int
50.Fn sigfillset "sigset_t *set"
51.Ft int
52.Fn sigaddset "sigset_t *set" "int signo"
53.Ft int
54.Fn sigandset "sigset_t *set" "const sigset_t *left" "const sigset_t *right"
55.Ft int
56.Fn sigdelset "sigset_t *set" "int signo"
57.Ft int
58.Fn sigisemptyset "const sigset_t *set"
59.Ft int
60.Fn sigismember "const sigset_t *set" "int signo"
61.Ft int
62.Fn sigorset "sigset_t *set" "const sigset_t *left" "const sigset_t *right"
63.Sh DESCRIPTION
64These functions manipulate signal sets stored in a
65.Fa sigset_t .
66Either
67.Fn sigemptyset
68or
69.Fn sigfillset
70must be called for every object of type
71.Fa sigset_t
72before any other use of the object.
73.Pp
74The
75.Fn sigemptyset
76function initializes a signal set to be empty.
77.Pp
78The
79.Fn sigfillset
80function initializes a signal set to contain all signals.
81.Pp
82The
83.Fn sigaddset
84function adds the specified signal
85.Fa signo
86to the signal set.
87.Pp
88The
89.Fn sigandset
90function sets the specified
91.Fa set
92to the logical AND of all signals from the
93.Fa left
94and
95.Fa right
96signal sets.
97.Pp
98The
99.Fn sigdelset
100function deletes the specified signal
101.Fa signo
102from the signal set.
103.Pp
104The
105.Fn sigisemptyset
106function returns whether the specified
107.Fa set
108is empty or not.
109.Pp
110The
111.Fn sigismember
112function returns whether a specified signal
113.Fa signo
114is contained in the signal set.
115.Pp
116The
117.Fn sigorset
118function sets the specified
119.Fa set
120to the logical OR of all signals from the
121.Fa left
122and
123.Fa right
124signal sets.
125.Sh RETURN VALUES
126The
127.Fn sigisemptyset
128function returns 1
129if the set is empty, 0 otherwise.
130.Pp
131The
132.Fn sigismember
133function returns 1
134if the signal is a member of the set,
1350 otherwise.
136.Pp
137The other functions return 0 upon success.
138A \-1 return value
139indicates an error occurred and the global variable
140.Va errno
141is set to indicate the reason.
142.Sh ERRORS
143These functions could fail if one of the following occurs:
144.Bl -tag -width Er
145.It Bq Er EINVAL
146.Fa signo
147has an invalid value.
148.El
149.Sh SEE ALSO
150.Xr kill 2 ,
151.Xr sigaction 2 ,
152.Xr sigpending 2 ,
153.Xr sigprocmask 2 ,
154.Xr sigsuspend 2
155.Sh STANDARDS
156The
157.Fn sigandset ,
158.Fn sigisemptyset ,
159and
160.Fn sigorset
161functions are FreeBSD extensions, compatible with functions of the same name
162provided by both musl libc and GNU libc.
163.Pp
164The rest of these functions are defined by
165.St -p1003.1-88 .
166