OSDN Git Service

a41469066f13ccd0df1008e447af4c036d916ed5
[linuxjm/LDP_man-pages.git] / original / man3 / sigsetops.3
1 .\" Copyright (c) 1994 Mike Battersby
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" Modified by aeb, 960721
26 .\" 2005-11-21, mtk, added descriptions of sigisemptyset(), sigandset(),
27 .\"                  and sigorset()
28 .\" 2007-10-26 mdw   added wording that a sigset_t must be initialized
29 .\"                  prior to use
30 .\"
31 .TH SIGSETOPS 3 2014-04-14 "Linux" "Linux Programmer's Manual"
32 .SH NAME
33 sigemptyset, sigfillset, sigaddset, sigdelset, sigismember \- POSIX
34 signal set operations
35 .SH SYNOPSIS
36 .B #include <signal.h>
37 .sp
38 .BI "int sigemptyset(sigset_t *" set );
39 .sp
40 .BI "int sigfillset(sigset_t *" set );
41 .sp
42 .BI "int sigaddset(sigset_t *" set ", int " signum );
43 .sp
44 .BI "int sigdelset(sigset_t *" set ", int " signum );
45 .sp
46 .BI "int sigismember(const sigset_t *" set ", int " signum );
47 .sp
48 .in -4n
49 Feature Test Macro Requirements for glibc (see
50 .BR feature_test_macros (7)):
51 .in
52 .sp
53 .ad l
54 .BR sigemptyset (),
55 .BR sigfillset (),
56 .BR sigaddset (),
57 .BR sigdelset (),
58 .BR sigismember ():
59 .RS 4
60 _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE
61 .RE
62 .ad b
63 .SH DESCRIPTION
64 These functions allow the manipulation of POSIX signal sets.
65 .PP
66 .BR sigemptyset ()
67 initializes the signal set given by
68 .I set
69 to empty, with all signals excluded from the set.
70 .PP
71 .BR sigfillset ()
72 initializes
73 .I set
74 to full, including all signals.
75 .PP
76 .BR sigaddset ()
77 and
78 .BR sigdelset ()
79 add and delete respectively signal
80 .I signum
81 from
82 .IR set .
83 .PP
84 .BR sigismember ()
85 tests whether
86 .I signum
87 is a member of
88 .IR set .
89 .PP
90 Objects of type
91 .I sigset_t
92 must be initialized by a call to either
93 .BR sigemptyset ()
94 or
95 .BR sigfillset ()
96 before being passed to the functions
97 .BR sigaddset (),
98 .BR sigdelset ()
99 and
100 .BR sigismember ()
101 or the additional glibc functions described below
102 .RB ( sigisemptyset (),
103 .BR sigandset (),
104 and
105 .BR sigorset ()).
106 The results are undefined if this is not done.
107 .SH RETURN VALUE
108 .BR sigemptyset (),
109 .BR sigfillset (),
110 .BR sigaddset (),
111 and
112 .BR sigdelset ()
113 return 0 on success and \-1 on error.
114 .PP
115 .BR sigismember ()
116 returns 1 if
117 .I signum
118 is a member of
119 .IR set ,
120 0 if
121 .I signum
122 is not a member, and \-1 on error.
123 On error, these functions set
124 .I errno
125 to indicate the cause.
126 .SH ERRORS
127 .TP
128 .B EINVAL
129 .I sig
130 is not a valid signal.
131 .SH ATTRIBUTES
132 .SS Multithreading (see pthreads(7))
133 The
134 .BR sigemptyset (),
135 .BR sigfillset (),
136 .BR sigaddset (),
137 .BR sigdelset (),
138 .BR sigismember (),
139 .BR sigisemptyset (),
140 .BR sigorset (),
141 and
142 .BR sigandset ()
143 functions are thread-safe.
144 .SH CONFORMING TO
145 POSIX.1-2001.
146 .SH NOTES
147 .SS Glibc notes
148 If the
149 .B _GNU_SOURCE
150 feature test macro is defined, then \fI<signal.h>\fP
151 exposes three other functions for manipulating signal
152 sets:
153
154 .nf
155 .BI "int sigisemptyset(const sigset_t *" set );
156 .BI "int sigorset(sigset_t *" dest ", const sigset_t *" left ,
157 .BI "              const sigset_t *" right );
158 .BI "int sigandset(sigset_t *" dest ", const sigset_t *" left ,
159 .BI "              const sigset_t *" right );
160 .fi
161
162 .BR sigisemptyset ()
163 returns 1 if
164 .I set
165 contains no signals, and 0 otherwise.
166
167 .BR sigorset ()
168 places the union of the sets
169 .I left
170 and
171 .I right
172 in
173 .IR dest .
174 .BR sigandset ()
175 places the intersection of the sets
176 .I left
177 and
178 .I right
179 in
180 .IR dest .
181 Both functions return 0 on success, and \-1 on failure.
182 .PP
183 These functions are nonstandard (a few other systems provide similar
184 functions) and their use should be avoided in portable applications.
185 .SH SEE ALSO
186 .BR sigaction (2),
187 .BR sigpending (2),
188 .BR sigprocmask (2),
189 .BR sigsuspend (2)
190 .SH COLOPHON
191 This page is part of release 3.67 of the Linux
192 .I man-pages
193 project.
194 A description of the project,
195 information about reporting bugs,
196 and the latest version of this page,
197 can be found at
198 \%http://www.kernel.org/doc/man\-pages/.